@spiffcommerce/core 22.2.0 → 22.2.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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createHttpLink as xA, InMemoryCache as NA, ApolloClient as RA, from as HA, gql as f } from "@apollo/client/core";
2
- import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as vA, modifySVGColors as UA, svgToDataUrl as kA, GroupCommand as k, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as GA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as Re, fetchAsString as Z, DeleteElementCommand as te, generateDefaultRectangleFrameSvg as ft, GetSVGDimensions as bA, patternImageDataCache as Ft, fetchAsArrayBuffer as JA, findElement as He, modifySVGWithElementProperties as TA, IllustrationColorCommand as et, IllustrationCacheCommand as OA, getFontMetrics as LA, getPatternImageData as tt, FontAlignmentCommand as zA, FontColorCommand as KA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as xe, FontSourceCommand as yt, loadFont as gt, TextChangeCommand as jA, FontSizeCommand as VA, createElementNS as WA, createElement as Ie, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as Mt, CommandContext as XA, createCanvas as ve, getSvgElement as Lt, LayoutRenderingPurpose as zt, renderPapyrusComponentAsString as Kt, loadImage as jt, getDomParser as Vt, toBase64 as St, getVariant as qA, generateFrameSVG as ZA, getDefaultVariant as Le, domParser as Wt, sanitizeSvgTree as Xt, traverse as $A, xmlSerializer as qt, CreateLayoutCommand as _A, AspectType as oe, rehydrateSerializedLayout as ae } from "@spiffcommerce/papyrus";
3
- import { AspectType as Fs, AssetType as ys, BringForwardCommand as Ms, BringToBackCommand as Ss, BringToFrontCommand as Ys, CanvasCommand as Ps, CommandContext as xs, CreateElementCommand as Ns, CreateLayoutCommand as Rs, DeleteElementCommand as Hs, FontAlignmentCommand as vs, FontColorCommand as Us, FontSizeCommand as ks, FontSourceCommand as Gs, GroupCommand as bs, LayoutElementFactory as Js, LayoutElementType as Ts, MoveCommand as Os, ResizeCommand as Ls, RotateCommand as zs, SendBackwardsCommand as Ks, StepAspectType as js, StepType as Vs, TextChangeCommand as Ws, UnitOfMeasurement as Xs, UpdateImageSourceCommand as qs, dataUrlFromExternalUrl as Zs, determineCorrectFontSizeAndLines as $s, findElement as _s, frameDataCache as eo, generate as to, generateSVGWithUnknownColors as Ao, getAttributesFromArrayBuffer as ao, getAxisAlignedBoundingBox as no, getFrameData as io, getSvgElement as so, loadFont as oo, patternImageDataCache as ro, registerFetchImplementation as co, registerWindowImplementation as go, rehydrateSerializedLayout as lo, setCanvasModule as Bo, svgToDataUrl as Co } from "@spiffcommerce/papyrus";
2
+ import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as vA, modifySVGColors as UA, svgToDataUrl as GA, GroupCommand as G, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as kA, calculateOffsets as ct, LayoutElementType as k, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as Re, fetchAsString as Z, DeleteElementCommand as te, generateDefaultRectangleFrameSvg as ft, GetSVGDimensions as bA, patternImageDataCache as Ft, fetchAsArrayBuffer as JA, findElement as He, modifySVGWithElementProperties as TA, IllustrationColorCommand as et, IllustrationCacheCommand as OA, getFontMetrics as LA, getPatternImageData as tt, FontAlignmentCommand as zA, FontColorCommand as KA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as xe, FontSourceCommand as yt, loadFont as gt, TextChangeCommand as jA, FontSizeCommand as VA, createElementNS as WA, createElement as Ie, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as Mt, CommandContext as XA, createCanvas as ve, getSvgElement as Lt, LayoutRenderingPurpose as zt, renderPapyrusComponentAsString as Kt, loadImage as jt, getDomParser as Vt, toBase64 as St, getVariant as qA, generateFrameSVG as ZA, getDefaultVariant as Le, domParser as Wt, sanitizeSvgTree as Xt, traverse as $A, xmlSerializer as qt, CreateLayoutCommand as _A, AspectType as oe, rehydrateSerializedLayout as ae } from "@spiffcommerce/papyrus";
3
+ import { AspectType as Fs, AssetType as ys, BringForwardCommand as Ms, BringToBackCommand as Ss, BringToFrontCommand as Ys, CanvasCommand as Ps, CommandContext as xs, CreateElementCommand as Ns, CreateLayoutCommand as Rs, DeleteElementCommand as Hs, FontAlignmentCommand as vs, FontColorCommand as Us, FontSizeCommand as Gs, FontSourceCommand as ks, GroupCommand as bs, LayoutElementFactory as Js, LayoutElementType as Ts, MoveCommand as Os, ResizeCommand as Ls, RotateCommand as zs, SendBackwardsCommand as Ks, StepAspectType as js, StepType as Vs, TextChangeCommand as Ws, UnitOfMeasurement as Xs, UpdateImageSourceCommand as qs, dataUrlFromExternalUrl as Zs, determineCorrectFontSizeAndLines as $s, findElement as _s, frameDataCache as eo, generate as to, generateSVGWithUnknownColors as Ao, getAttributesFromArrayBuffer as ao, getAxisAlignedBoundingBox as no, getFrameData as io, getSvgElement as so, loadFont as oo, patternImageDataCache as ro, registerFetchImplementation as co, registerWindowImplementation as go, rehydrateSerializedLayout as lo, setCanvasModule as Bo, svgToDataUrl as Co } from "@spiffcommerce/papyrus";
4
4
  import { setContext as ea } from "@apollo/client/link/context";
5
5
  import { onError as ta } from "@apollo/client/link/error";
6
6
  import { Pith as Zt } from "pith";
@@ -42,7 +42,7 @@ class ue extends pe {
42
42
  super(`Resource not found for asset: ${e.name}`), this.asset = e;
43
43
  }
44
44
  }
45
- class ke extends pe {
45
+ class Ge extends pe {
46
46
  constructor(e, t) {
47
47
  super(`Workflow Misconfiguration: ${e.stepName} - ${t}`), this.step = e;
48
48
  }
@@ -807,7 +807,7 @@ class fa {
807
807
  }
808
808
  }
809
809
  const j = new fa();
810
- var Fa = /* @__PURE__ */ ((c) => (c.Hyperlink = "Hyperlink", c.Edit = "Edit", c.Approve = "Approve", c))(Fa || {}), ya = /* @__PURE__ */ ((c) => (c.Hub = "Hub", c.Shopify = "Shopify", c))(ya || {}), wt = /* @__PURE__ */ ((c) => (c.BackgroundRemover = "BackgroundRemover", c.ConversionAccelerator = "Conversion Accelerator", c.ProcessBuilder = "ProcessBuilder", c))(wt || {}), Ma = /* @__PURE__ */ ((c) => (c[c.Orbit = 0] = "Orbit", c[c.Pan = 1] = "Pan", c))(Ma || {}), Sa = /* @__PURE__ */ ((c) => (c.Manual = "Manual", c.OnStart = "OnStart", c.OnQuit = "OnQuit", c.OnEnd = "OnEnd", c))(Sa || {}), Ya = /* @__PURE__ */ ((c) => (c.Email = "Email", c.FirstName = "FirstName", c.LastName = "LastName", c.Phone = "Phone", c))(Ya || {}), Ge = /* @__PURE__ */ ((c) => (c.Owner = "Owner", c.Approver = "Approver", c.Editor = "Editor", c.Viewer = "Viewer", c))(Ge || {});
810
+ var Fa = /* @__PURE__ */ ((c) => (c.Hyperlink = "Hyperlink", c.Edit = "Edit", c.Approve = "Approve", c))(Fa || {}), ya = /* @__PURE__ */ ((c) => (c.Hub = "Hub", c.Shopify = "Shopify", c))(ya || {}), wt = /* @__PURE__ */ ((c) => (c.BackgroundRemover = "BackgroundRemover", c.ConversionAccelerator = "Conversion Accelerator", c.ProcessBuilder = "ProcessBuilder", c))(wt || {}), Ma = /* @__PURE__ */ ((c) => (c[c.Orbit = 0] = "Orbit", c[c.Pan = 1] = "Pan", c))(Ma || {}), Sa = /* @__PURE__ */ ((c) => (c.Manual = "Manual", c.OnStart = "OnStart", c.OnQuit = "OnQuit", c.OnEnd = "OnEnd", c))(Sa || {}), Ya = /* @__PURE__ */ ((c) => (c.Email = "Email", c.FirstName = "FirstName", c.LastName = "LastName", c.Phone = "Phone", c))(Ya || {}), ke = /* @__PURE__ */ ((c) => (c.Owner = "Owner", c.Approver = "Approver", c.Editor = "Editor", c.Viewer = "Viewer", c))(ke || {});
811
811
  const ge = f`
812
812
  fragment AdditionalIntegrationProductFields on IntegrationProduct {
813
813
  id
@@ -1379,7 +1379,7 @@ const va = f`
1379
1379
  ...IntegrationProductFields
1380
1380
  }
1381
1381
  }
1382
- `, ka = f`
1382
+ `, Ga = f`
1383
1383
  ${cA}
1384
1384
  query GetIntegrationProductFromExternalIds($externalIntegrationId: String!, $externalProductId: String!) {
1385
1385
  integrationProductFromExternalIds(
@@ -1389,7 +1389,7 @@ const va = f`
1389
1389
  ...IntegrationProductFields
1390
1390
  }
1391
1391
  }
1392
- `, Ga = f`
1392
+ `, ka = f`
1393
1393
  ${sA}
1394
1394
  query ReadStakeholdersForTransaction($id: String!) {
1395
1395
  transactions(ids: [$id]) {
@@ -1655,7 +1655,7 @@ class za {
1655
1655
  if (this.imageData) {
1656
1656
  if (this.imageData.svg) {
1657
1657
  const e = UA(this.imageData.svg, this.imageData.colors || {}, !1);
1658
- return kA(e);
1658
+ return GA(e);
1659
1659
  }
1660
1660
  return this.imageData.src;
1661
1661
  }
@@ -1771,9 +1771,9 @@ class za {
1771
1771
  const s = this.workflowManager.getCommandDispatcher();
1772
1772
  n.forEach((o, r) => {
1773
1773
  s(
1774
- new k([
1774
+ new G([
1775
1775
  new Ot(o, t, e[r]),
1776
- new GA(
1776
+ new kA(
1777
1777
  o,
1778
1778
  a.useThreshold,
1779
1779
  a.invertThreshold,
@@ -1820,10 +1820,10 @@ class Ht {
1820
1820
  if (this.configuration.type === F.ProductOverlay) {
1821
1821
  let l = "";
1822
1822
  if ((o = this.product) != null && o.overlayImageUrl && (l = this.product.overlayImageUrl), i = l, !l)
1823
- throw new ke(this.configuration, "Couldn't find an asset for product overlay step");
1823
+ throw new Ge(this.configuration, "Couldn't find an asset for product overlay step");
1824
1824
  }
1825
1825
  const s = this.evaluateAssetType();
1826
- if (s === G.Image) {
1826
+ if (s === k.Image) {
1827
1827
  const l = this.configuration.type === F.SilentIllustration ? (r = this.configuration.data.asset) == null ? void 0 : r.fileLink : (g = this.product) == null ? void 0 : g.overlayImageUrl;
1828
1828
  if (!l)
1829
1829
  throw new Error("Undefined raster silent step source");
@@ -1891,7 +1891,7 @@ class Ht {
1891
1891
  }
1892
1892
  async trigger() {
1893
1893
  if (!this.configuration.data.regions)
1894
- throw new ke(this.configuration, "Missing regions.");
1894
+ throw new Ge(this.configuration, "Missing regions.");
1895
1895
  if (this.configuration.type === F.SilentIllustration) {
1896
1896
  const e = this.configuration.data.regions.map(this.processRegion);
1897
1897
  return Promise.all(e);
@@ -1907,7 +1907,7 @@ class Ht {
1907
1907
  evaluateAssetType() {
1908
1908
  var t, A, a;
1909
1909
  const e = this.configuration.type === F.ProductOverlay && ((t = this.product) != null && t.overlayImageUrl) ? this.product.overlayImageUrl.toLowerCase() : (a = (A = this.configuration.data.asset) == null ? void 0 : A.fileLink) == null ? void 0 : a.toLowerCase().split("?")[0];
1910
- return e != null && e.startsWith("data:image/png") || e != null && e.endsWith(".jpeg") || e != null && e.endsWith(".jpg") || e != null && e.endsWith(".png") ? G.Image : e != null && e.endsWith(".svg") || e != null && e.startsWith("image/svg+xml") ? G.Illustration : G.Illustration;
1910
+ return e != null && e.startsWith("data:image/png") || e != null && e.endsWith(".jpeg") || e != null && e.endsWith(".jpg") || e != null && e.endsWith(".png") ? k.Image : e != null && e.endsWith(".svg") || e != null && e.startsWith("image/svg+xml") ? k.Illustration : k.Illustration;
1911
1911
  }
1912
1912
  }
1913
1913
  const Ka = async (c) => {
@@ -1998,7 +1998,7 @@ class ja {
1998
1998
  throw new Ke("Cannot create QR code, URL too long.");
1999
1999
  const E = await Ka(d);
2000
2000
  if (s(E), !i.data || !i.data.regions)
2001
- throw new ke(i, "Missing regions.");
2001
+ throw new Ge(i, "Missing regions.");
2002
2002
  const w = await this.regionElements(i), u = await this.command(E, w, n, i.stepName);
2003
2003
  u && (u.command && n.getCommandDispatcher()(u.command), u.followup && await u.followup()), await n.setSelectionsAndElements(i.stepName, [], w, async () => {
2004
2004
  n.updateStorage(i.stepName, {
@@ -2028,7 +2028,7 @@ class ja {
2028
2028
  stepName: a,
2029
2029
  id: r.id,
2030
2030
  src: s,
2031
- type: G.Image,
2031
+ type: k.Image,
2032
2032
  y: g.top,
2033
2033
  x: g.left,
2034
2034
  width: g.width,
@@ -2038,7 +2038,7 @@ class ja {
2038
2038
  B
2039
2039
  );
2040
2040
  });
2041
- return { command: new k(o), followup: async () => {
2041
+ return { command: new G(o), followup: async () => {
2042
2042
  } };
2043
2043
  }
2044
2044
  }
@@ -4922,7 +4922,7 @@ class $a {
4922
4922
  return new O(
4923
4923
  {
4924
4924
  id: e,
4925
- type: G.Frame,
4925
+ type: k.Frame,
4926
4926
  x: t.left,
4927
4927
  y: t.top,
4928
4928
  width: t.width,
@@ -5093,7 +5093,7 @@ class $a {
5093
5093
  })
5094
5094
  ), g = r.map((C) => C.command), B = r.map((C) => C.removeExistingCommands).flat();
5095
5095
  return {
5096
- command: new k([...g, ...B]),
5096
+ command: new G([...g, ...B]),
5097
5097
  followup: async () => {
5098
5098
  n && n(!1), await a.setSelectionsAndElements(
5099
5099
  e.stepName,
@@ -5175,7 +5175,7 @@ class _a {
5175
5175
  src: a.src,
5176
5176
  svg: a.svg.svg,
5177
5177
  cachedObjectURL: a.objectURL,
5178
- type: G.Illustration,
5178
+ type: k.Illustration,
5179
5179
  y: t.top,
5180
5180
  x: t.left,
5181
5181
  rotation: t.rotation,
@@ -5264,7 +5264,7 @@ class _a {
5264
5264
  r.push(new et(B, l, C));
5265
5265
  r.push(new OA(B, s, o));
5266
5266
  }
5267
- return new k(r);
5267
+ return new G(r);
5268
5268
  }
5269
5269
  async changeColors(e, t, A, a, n) {
5270
5270
  var C, d;
@@ -5311,7 +5311,7 @@ class _a {
5311
5311
  async selectVariantCommand(e, t, A, a, n) {
5312
5312
  var u;
5313
5313
  if (!e.data || !e.data.regions)
5314
- throw new ke(e, "Missing regions.");
5314
+ throw new Ge(e, "Missing regions.");
5315
5315
  a(!0);
5316
5316
  const i = A.map((h) => new te(h.id));
5317
5317
  e.mandatory && n.setMandatoryFulfilled(e.stepName, !1);
@@ -5344,7 +5344,7 @@ class _a {
5344
5344
  return D.toLowerCase() === ((m = h.color) == null ? void 0 : m.toLowerCase()) ? h.name : D;
5345
5345
  });
5346
5346
  })), n.updateMetadata(e.stepName, { colors: E }), {
5347
- command: new k(d),
5347
+ command: new G(d),
5348
5348
  followup: async () => {
5349
5349
  await n.setSelectionsAndElements(
5350
5350
  e.stepName,
@@ -5576,7 +5576,7 @@ class An {
5576
5576
  colors: {},
5577
5577
  id: d,
5578
5578
  svg: B,
5579
- type: G.Illustration,
5579
+ type: k.Illustration,
5580
5580
  y: l.top,
5581
5581
  x: l.left,
5582
5582
  rotation: l.rotation,
@@ -5591,7 +5591,7 @@ class An {
5591
5591
  ), {
5592
5592
  id: d,
5593
5593
  region: l,
5594
- command: new k(u)
5594
+ command: new G(u)
5595
5595
  };
5596
5596
  };
5597
5597
  if (i.length > 0) {
@@ -5602,7 +5602,7 @@ class An {
5602
5602
  return r(d, C.region, C.id);
5603
5603
  }).filter((C) => !!C).filter((C) => !!C).map((C) => C && C.command);
5604
5604
  return {
5605
- command: new k(l),
5605
+ command: new G(l),
5606
5606
  followup: async () => {
5607
5607
  }
5608
5608
  };
@@ -5611,7 +5611,7 @@ class An {
5611
5611
  (C) => r(s.svgPrint(t, C), C)
5612
5612
  ), l = B.filter((C) => !!C).map((C) => C && C.command);
5613
5613
  return {
5614
- command: new k(l),
5614
+ command: new G(l),
5615
5615
  followup: async () => {
5616
5616
  const C = B.filter((d) => d).map((d) => d && { id: d.id, region: d.region });
5617
5617
  await A.setSelectionsAndElements(
@@ -5703,7 +5703,7 @@ class nn {
5703
5703
  stepRegion: B,
5704
5704
  id: d,
5705
5705
  src: i,
5706
- type: G.Image,
5706
+ type: k.Image,
5707
5707
  y: B.top,
5708
5708
  x: B.left,
5709
5709
  rotation: B.rotation,
@@ -5719,7 +5719,7 @@ class nn {
5719
5719
  };
5720
5720
  }, g = e.data.regions.map(r);
5721
5721
  return {
5722
- command: new k([...o, ...g.map((B) => B.command)]),
5722
+ command: new G([...o, ...g.map((B) => B.command)]),
5723
5723
  followup: async () => {
5724
5724
  await A.setSelectionsAndElements(
5725
5725
  e.stepName,
@@ -5814,7 +5814,7 @@ class on {
5814
5814
  throw new z(o);
5815
5815
  return new et(s.id, this.shapeFillId, e);
5816
5816
  }).filter((s) => !!s);
5817
- A.getCommandDispatcher()(new k(i)), A.updateStorage(t.stepName, { colour: e });
5817
+ A.getCommandDispatcher()(new G(i)), A.updateStorage(t.stepName, { colour: e });
5818
5818
  }
5819
5819
  async init(e, t, A) {
5820
5820
  const a = e.option;
@@ -5887,7 +5887,7 @@ class on {
5887
5887
  return new et(B.id, this.shapeFillId, d);
5888
5888
  }, g = A.map(r).filter((B) => !!B);
5889
5889
  return {
5890
- command: new k(g),
5890
+ command: new G(g),
5891
5891
  followup: async () => {
5892
5892
  await a.setSelectionsAndElements(
5893
5893
  e.stepName,
@@ -5934,7 +5934,7 @@ class on {
5934
5934
  colors: u,
5935
5935
  id: h,
5936
5936
  svg: w,
5937
- type: G.Illustration,
5937
+ type: k.Illustration,
5938
5938
  y: C.top,
5939
5939
  x: C.left,
5940
5940
  rotation: C.rotation,
@@ -5950,7 +5950,7 @@ class on {
5950
5950
  };
5951
5951
  }, g = e.data.regions.map(r), B = g.filter((C) => !!C).map((C) => C == null ? void 0 : C.command), l = g.filter((C) => !!C).map((C) => ({ id: C.id, region: C.region }));
5952
5952
  return {
5953
- command: new k(B),
5953
+ command: new G(B),
5954
5954
  followup: async () => {
5955
5955
  await a.setSelectionsAndElements(
5956
5956
  e.stepName,
@@ -6203,7 +6203,7 @@ class ln {
6203
6203
  }
6204
6204
  return !A.data.curved && t.length > 0 && !Array.from(B.values()).every((C) => C) ? (s.errors.push({ localizationKey: "workflow.steps.text.doesNotFit" }), s) : (a.updateStorage(A.stepName, { text: e }), a.updateMetadata(A.stepName, {
6205
6205
  text: i
6206
- }), n.defaultCleared && a.setMandatoryFulfilled(A.stepName, !0), s.command = new k(r), s);
6206
+ }), n.defaultCleared && a.setMandatoryFulfilled(A.stepName, !0), s.command = new G(r), s);
6207
6207
  }
6208
6208
  async selectVariant(e, t, A, a, n) {
6209
6209
  const i = await this.selectVariantCommand(
@@ -6247,7 +6247,7 @@ class ln {
6247
6247
  E,
6248
6248
  async () => {
6249
6249
  t.updateMetadata(e.stepName, { color: w, text: u }), t.updateStorage(e.stepName, { text: u, inputText: u });
6250
- const D = s.map((p) => new yt(p.id, d)), m = new k(D);
6250
+ const D = s.map((p) => new yt(p.id, d)), m = new G(D);
6251
6251
  t.getCommandDispatcher()(m);
6252
6252
  }
6253
6253
  );
@@ -6313,7 +6313,7 @@ class ln {
6313
6313
  s
6314
6314
  );
6315
6315
  return C && l.push(C), {
6316
- command: new k(l),
6316
+ command: new G(l),
6317
6317
  followup: async () => {
6318
6318
  n.markUpdateCompleted(r), await n.setSelectionsAndElements(e.stepName, [t], a);
6319
6319
  }
@@ -6344,7 +6344,7 @@ class ln {
6344
6344
  d.push(...w);
6345
6345
  }
6346
6346
  return C && d.push(C), {
6347
- command: new k(d),
6347
+ command: new G(d),
6348
6348
  followup: async () => {
6349
6349
  n.markUpdateCompleted(r);
6350
6350
  }
@@ -6392,7 +6392,7 @@ class ln {
6392
6392
  rotation: B.rotation,
6393
6393
  text: o,
6394
6394
  input: s,
6395
- type: G.Textbox,
6395
+ type: k.Textbox,
6396
6396
  vertical: A.vertical,
6397
6397
  x: B.left,
6398
6398
  y: B.top,
@@ -6458,7 +6458,7 @@ class ln {
6458
6458
  const o = new VA(A, e);
6459
6459
  n.push(o);
6460
6460
  }
6461
- return new k(n);
6461
+ return new G(n);
6462
6462
  }
6463
6463
  /**
6464
6464
  * @deprecated
@@ -6511,7 +6511,7 @@ class ln {
6511
6511
  )
6512
6512
  );
6513
6513
  }
6514
- return new k(h);
6514
+ return new G(h);
6515
6515
  }
6516
6516
  }
6517
6517
  const V = new ln();
@@ -8086,7 +8086,7 @@ async function pA(c) {
8086
8086
  }
8087
8087
  var Te = /* @__PURE__ */ ((c) => (c.Error = "Error", c.Warning = "Warning", c.Info = "Info", c))(Te || {});
8088
8088
  const In = 1e3;
8089
- class kt extends gA {
8089
+ class Gt extends gA {
8090
8090
  constructor(e) {
8091
8091
  super(), this.createdAt = /* @__PURE__ */ new Date(), this.update = e;
8092
8092
  }
@@ -8131,7 +8131,7 @@ class fn {
8131
8131
  this.storage[s.stepName] = s.storage || {};
8132
8132
  }), this.allScenes = await ba(e);
8133
8133
  const a = se(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: n, commands: i } = await this.stepElementsForIntroducedSilentSteps(a, !!this.reloadedState);
8134
- this.commandContext.apply(new k(i), !0), this.stepElements = { ...this.stepElements, ...n }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && t();
8134
+ this.commandContext.apply(new G(i), !0), this.stepElements = { ...this.stepElements, ...n }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && t();
8135
8135
  }
8136
8136
  getClient() {
8137
8137
  return this.client;
@@ -8405,7 +8405,7 @@ class fn {
8405
8405
  return;
8406
8406
  const e = this.serialize();
8407
8407
  this.workflowStatePromiseQueue.enqueue(
8408
- new kt(async () => {
8408
+ new Gt(async () => {
8409
8409
  await new Promise((t) => {
8410
8410
  setTimeout(() => {
8411
8411
  t();
@@ -8423,7 +8423,7 @@ class fn {
8423
8423
  if (this.readOnly)
8424
8424
  return;
8425
8425
  const e = this.serialize();
8426
- return new kt(async () => {
8426
+ return new Gt(async () => {
8427
8427
  await this.updateTransaction({
8428
8428
  variables: {
8429
8429
  id: this.transaction.id,
@@ -8523,7 +8523,7 @@ class fn {
8523
8523
  async updateTransactionStakeholders() {
8524
8524
  var t;
8525
8525
  const e = await x.getShadowGraphqlClient().query({
8526
- query: Ga,
8526
+ query: ka,
8527
8527
  errorPolicy: "all",
8528
8528
  fetchPolicy: "no-cache",
8529
8529
  variables: {
@@ -8566,7 +8566,7 @@ class fn {
8566
8566
  (p = Q == null ? void 0 : Q.frameService) == null || p.setTargetElements(A.map((I) => I.id));
8567
8567
  }
8568
8568
  const w = l.map((Q) => new te(Q.id)), u = new Mt(this.constructSerializableWorkflow()), h = [...d, ...w, u];
8569
- h.length > 0 && this.commandContext.apply(new k(h), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
8569
+ h.length > 0 && this.commandContext.apply(new G(h), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
8570
8570
  const D = this.getInvalidModelVariants(), m = this.modelContainer;
8571
8571
  if (m) {
8572
8572
  const Q = D.map(
@@ -8649,7 +8649,7 @@ class fn {
8649
8649
  throw new Error(`Step initialization failed: ${o.reason}`);
8650
8650
  return o.value;
8651
8651
  }), i = n.filter((o) => !!o && !!o.command).map((o) => o.command), s = n.filter((o) => !!o && !!o.followup).map((o) => o.followup);
8652
- i && i.length > 0 && this.commandContext.apply(new k(i), !0);
8652
+ i && i.length > 0 && this.commandContext.apply(new G(i), !0);
8653
8653
  for (const o of s)
8654
8654
  await o();
8655
8655
  s.length > 0 && await this.ensureStepsAreLoaded(), this.onInitChange();
@@ -9405,7 +9405,7 @@ function mt(c) {
9405
9405
  const e = JSON.parse(atob(c.split(".")[1])).exp;
9406
9406
  return Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) >= e;
9407
9407
  }
9408
- const kn = async (c) => {
9408
+ const Gn = async (c) => {
9409
9409
  var i, s;
9410
9410
  const t = ((i = Object.entries(localStorage).find(([o, r]) => o.startsWith("CognitoIdentityServiceProvider") && o.endsWith("idToken"))) == null ? void 0 : i[0]) || "", A = localStorage.getItem(t), a = {};
9411
9411
  return A && !mt(A) && (a.Authorization = `Bearer ${A}`), (s = (await x.getShadowGraphqlClient().mutate({
@@ -9426,7 +9426,7 @@ const kn = async (c) => {
9426
9426
  headers: a
9427
9427
  }
9428
9428
  })).data) == null ? void 0 : s.designCreate;
9429
- }, Gn = async (c) => {
9429
+ }, kn = async (c) => {
9430
9430
  var i, s;
9431
9431
  const t = ((i = Object.entries(localStorage).find(([o, r]) => o.startsWith("CognitoIdentityServiceProvider") && o.endsWith("idToken"))) == null ? void 0 : i[0]) || "", A = localStorage.getItem(t), a = {};
9432
9432
  return A && !mt(A) && (a.Authorization = `Bearer ${A}`), (s = (await x.getShadowGraphqlClient().mutate({
@@ -9487,35 +9487,22 @@ const kn = async (c) => {
9487
9487
  }), a;
9488
9488
  }, bn = (c, e, t, A) => {
9489
9489
  const a = {};
9490
- let n;
9491
- if (t) {
9492
- n = st(t, e, !1);
9493
- for (const i of Object.keys(n))
9494
- a[i] = {
9495
- value: n[i],
9496
- priceModifier: 0
9490
+ let n = {};
9491
+ t ? n = st(t, e, !1) : A && (n = A);
9492
+ const s = e.steps.map((o) => o.stepTitle).filter((o, r, g) => g.indexOf(o) == r);
9493
+ for (const o of s) {
9494
+ if (Object.keys(c).includes(o)) {
9495
+ const r = c[o], g = e.steps.find((B) => B.stepTitle === o);
9496
+ a[`${g == null ? void 0 : g.stepTitle} selection`] = {
9497
+ value: r[0].name,
9498
+ priceModifier: r[0].priceModifier
9497
9499
  };
9498
- } else if (A) {
9499
- n = A;
9500
- for (const i of Object.keys(n))
9501
- a[i] = {
9502
- value: n[i],
9500
+ }
9501
+ for (const r of Object.keys(n))
9502
+ [`${o} color`, `${o} colors`, `${o} text`, `${o} image`].includes(r) && (a[r] = {
9503
+ value: n[r],
9503
9504
  priceModifier: 0
9504
- };
9505
- }
9506
- for (const i of Object.keys(c)) {
9507
- const s = c[i], o = e.steps.find((r) => r.stepTitle === i);
9508
- if (s.length === 1)
9509
- a[`${o == null ? void 0 : o.stepTitle} selection`] = {
9510
- value: s[0].name,
9511
- priceModifier: s[0].priceModifier
9512
- };
9513
- else if (s.length > 1)
9514
- for (let r = 0; r < s.length; r++)
9515
- a[`${o == null ? void 0 : o.stepTitle} selection ${r + 1}`] = {
9516
- value: s[r].name,
9517
- priceModifier: s[r].priceModifier
9518
- };
9505
+ });
9519
9506
  }
9520
9507
  return a;
9521
9508
  }, fA = (c, e, t, A, a, n, i, s) => {
@@ -9651,7 +9638,7 @@ const kn = async (c) => {
9651
9638
  g
9652
9639
  );
9653
9640
  o("workflow.steps.finish.finalize.creatingDesign");
9654
- const d = await kn(B), E = (u = d == null ? void 0 : d.transaction) == null ? void 0 : u.previewImageLink;
9641
+ const d = await Gn(B), E = (u = d == null ? void 0 : d.transaction) == null ? void 0 : u.previewImageLink;
9655
9642
  if (!(d != null && d.transaction))
9656
9643
  throw new Error("Failed to create design");
9657
9644
  o("workflow.steps.finish.finalize.updatingTransaction");
@@ -9698,7 +9685,7 @@ const kn = async (c) => {
9698
9685
  ))
9699
9686
  );
9700
9687
  e("workflow.steps.finish.finalize.creatingDesign");
9701
- const i = await Gn(n.map((s) => s.designDetails));
9688
+ const i = await kn(n.map((s) => s.designDetails));
9702
9689
  if (!i)
9703
9690
  throw new Error("Failed to create designs");
9704
9691
  return e("workflow.steps.finish.finalize.updatingTransaction"), i.map((s, o) => {
@@ -10206,7 +10193,7 @@ const Kn = [
10206
10193
  {
10207
10194
  id: E,
10208
10195
  src: g,
10209
- type: G.Image,
10196
+ type: k.Image,
10210
10197
  y: C.top,
10211
10198
  x: C.left,
10212
10199
  width: C.width,
@@ -10249,7 +10236,7 @@ const Kn = [
10249
10236
  path: B.path,
10250
10237
  dataWidth: B.width,
10251
10238
  dataHeight: B.height,
10252
- type: G.Frame,
10239
+ type: k.Frame,
10253
10240
  focalBlur: A.data.focalBlur,
10254
10241
  focalBlurStrength: A.data.focalBlurStrength,
10255
10242
  focalBlurRadius: A.data.focalBlurRadius,
@@ -10325,7 +10312,7 @@ const Kn = [
10325
10312
  colors: E,
10326
10313
  id: M,
10327
10314
  svg: u,
10328
- type: G.Illustration,
10315
+ type: k.Illustration,
10329
10316
  y: I.top,
10330
10317
  x: I.left,
10331
10318
  rotation: I.rotation,
@@ -10354,7 +10341,7 @@ const Kn = [
10354
10341
  colors: {},
10355
10342
  id: g,
10356
10343
  svg: s,
10357
- type: G.Illustration,
10344
+ type: k.Illustration,
10358
10345
  y: o.top,
10359
10346
  x: o.left,
10360
10347
  rotation: o.rotation,
@@ -10396,7 +10383,7 @@ const Kn = [
10396
10383
  {
10397
10384
  id: d,
10398
10385
  src: s,
10399
- type: G.Image,
10386
+ type: k.Image,
10400
10387
  y: l.top,
10401
10388
  x: l.left,
10402
10389
  rotation: l.rotation,
@@ -10454,7 +10441,7 @@ const Kn = [
10454
10441
  colors: d,
10455
10442
  id: E,
10456
10443
  svg: l,
10457
- type: G.Illustration,
10444
+ type: k.Illustration,
10458
10445
  y: g.top,
10459
10446
  x: g.left,
10460
10447
  rotation: g.rotation,
@@ -10476,7 +10463,7 @@ const Kn = [
10476
10463
  const A = [], n = (() => {
10477
10464
  var r, g;
10478
10465
  return e.type === F.ProductOverlay ? t || ((r = e.data.asset) == null ? void 0 : r.fileLink) || "" : ((g = e.data.asset) == null ? void 0 : g.fileLink) || "";
10479
- })(), s = (() => n.endsWith(".jpeg") || n.endsWith(".jpg") || n.endsWith(".png") ? G.Image : n.endsWith(".svg") ? G.Illustration : G.Illustration)(), o = e.data.regions;
10466
+ })(), s = (() => n.endsWith(".jpeg") || n.endsWith(".jpg") || n.endsWith(".png") ? k.Image : n.endsWith(".svg") ? k.Illustration : k.Illustration)(), o = e.data.regions;
10480
10467
  if (s === "image")
10481
10468
  try {
10482
10469
  o.forEach((r) => {
@@ -10589,7 +10576,7 @@ const Kn = [
10589
10576
  paths: A.data.paths,
10590
10577
  rotation: w.rotation,
10591
10578
  text: l,
10592
- type: G.Textbox,
10579
+ type: k.Textbox,
10593
10580
  vertical: A.data.vertical,
10594
10581
  verticalAlign: A.data.verticalAlign || "middle",
10595
10582
  width: w.width,
@@ -10871,9 +10858,9 @@ const us = (c, e) => {
10871
10858
  serializableWorkflow: { steps: [] },
10872
10859
  layouts: {}
10873
10860
  };
10874
- a = new k(t.map((o) => new _A(o))).apply(a);
10861
+ a = new G(t.map((o) => new _A(o))).apply(a);
10875
10862
  const i = await ti(c, e, t, A);
10876
- return new k(i).apply(a);
10863
+ return new G(i).apply(a);
10877
10864
  }, si = f`
10878
10865
  ${ge}
10879
10866
  fragment ProductFields on Product {
@@ -11212,14 +11199,14 @@ class pi {
11212
11199
  case oe.FileUpload:
11213
11200
  return new Di(this.bundle, e);
11214
11201
  case oe.ColorOption:
11215
- return new Gt(
11202
+ return new kt(
11216
11203
  this.bundle,
11217
11204
  e,
11218
11205
  e.entityId ? await j.getOption(e.entityId) : void 0
11219
11206
  );
11220
11207
  case oe.Option: {
11221
11208
  const t = e.entityId ? await j.getOption(e.entityId) : void 0;
11222
- return (t == null ? void 0 : t.type) === "Color" ? new Gt(this.bundle, e, t) : new SA(this.bundle, e, t);
11209
+ return (t == null ? void 0 : t.type) === "Color" ? new kt(this.bundle, e, t) : new SA(this.bundle, e, t);
11223
11210
  }
11224
11211
  case oe.Text:
11225
11212
  return new Ii(this.bundle, e);
@@ -11515,7 +11502,7 @@ class SA extends pt {
11515
11502
  await Promise.all(a);
11516
11503
  }
11517
11504
  }
11518
- class Gt extends SA {
11505
+ class kt extends SA {
11519
11506
  constructor(e, t, A) {
11520
11507
  super(e, t, A);
11521
11508
  }
@@ -12320,7 +12307,7 @@ class bt {
12320
12307
  variables: {
12321
12308
  id: this.id,
12322
12309
  details: e,
12323
- type: t || Ge.Owner
12310
+ type: t || ke.Owner
12324
12311
  },
12325
12312
  context: {
12326
12313
  bundleOwnerId: this.ownerId
@@ -12761,7 +12748,7 @@ const Ui = f`
12761
12748
  height
12762
12749
  }
12763
12750
  }
12764
- `, ki = f`
12751
+ `, Gi = f`
12765
12752
  fragment LookAtAnimationFields on LookAtAnimation {
12766
12753
  latDeg
12767
12754
  lonDeg
@@ -12772,7 +12759,7 @@ const Ui = f`
12772
12759
  z
12773
12760
  }
12774
12761
  }
12775
- `, Gi = f`
12762
+ `, ki = f`
12776
12763
  fragment RenderingPipelineConfigurationFields on RenderingPipelineConfiguration {
12777
12764
  antiAliasing {
12778
12765
  samples
@@ -12868,8 +12855,8 @@ const Ui = f`
12868
12855
  ${dt}
12869
12856
  ${iA}
12870
12857
  ${Ui}
12871
- ${ki}
12872
12858
  ${Gi}
12859
+ ${ki}
12873
12860
  ${bi}
12874
12861
  query GetWorkflows($ids: [String!]!) {
12875
12862
  workflows(ids: $ids) {
@@ -13399,13 +13386,13 @@ const Ui = f`
13399
13386
  var e;
13400
13387
  for (const t in c.layouts) {
13401
13388
  const A = c.layouts[t].elements.filter(
13402
- (n) => n.type === G.Illustration
13389
+ (n) => n.type === k.Illustration
13403
13390
  );
13404
13391
  for (let n = 0; n < A.length; ++n) {
13405
13392
  const i = A[n];
13406
13393
  i.src && i.svg && (i.cachedObjectURL = await Re(i.svg));
13407
13394
  }
13408
- const a = c.layouts[t].elements.filter((n) => n.type === G.Textbox);
13395
+ const a = c.layouts[t].elements.filter((n) => n.type === k.Textbox);
13409
13396
  for (let n = 0; n < a.length; ++n) {
13410
13397
  const i = a[n];
13411
13398
  (e = i.fontData) != null && e.assetUrl && await gt(i.fontData.assetUrl);
@@ -13472,7 +13459,7 @@ class $i {
13472
13459
  } catch (A) {
13473
13460
  throw console.error(A), new v("Critical - Unable to synchronize workflow state with server.");
13474
13461
  }
13475
- }, this.initialized = !1, this.options = e, this.options.applicationKey && sa(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.1.5-beta.48866ff2-4747-587f-9ab9-bd1ae140115b"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
13462
+ }, this.initialized = !1, this.options = e, this.options.applicationKey && sa(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.2.0-beta.a6a7f1c4-e3e8-51ba-816d-b998f4e3f9a1"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
13476
13463
  }
13477
13464
  /**
13478
13465
  * @returns The asset manager allows for common operations related to assets
@@ -13521,7 +13508,7 @@ class $i {
13521
13508
  var a, n;
13522
13509
  const t = Y.getMap("bundleOwnerIds");
13523
13510
  if (t != null && t.has(e))
13524
- return Promise.resolve({ success: !0, stakeholderType: Ge.Owner });
13511
+ return Promise.resolve({ success: !0, stakeholderType: ke.Owner });
13525
13512
  const A = Y.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
13526
13513
  if (A.has(e)) {
13527
13514
  const i = A.get(e), o = (Y.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map()).get(i);
@@ -13570,7 +13557,7 @@ class $i {
13570
13557
  return Promise.resolve({ success: !1, transactionReadOnly: !0 });
13571
13558
  const i = Y.getMap("transactionOwnerIds");
13572
13559
  if (i != null && i.has(e))
13573
- return Promise.resolve({ success: !0, stakeholderType: Ge.Owner });
13560
+ return Promise.resolve({ success: !0, stakeholderType: ke.Owner });
13574
13561
  const s = Y.getMap("transactionCustomerIds");
13575
13562
  if (s != null && s.has(e)) {
13576
13563
  const w = s.get(e);
@@ -14228,7 +14215,7 @@ class $i {
14228
14215
  async getIntegrationProductFromExternalIds(e, t) {
14229
14216
  var i;
14230
14217
  const n = (i = (await x.getShadowGraphqlClient().query({
14231
- query: ka,
14218
+ query: Ga,
14232
14219
  variables: {
14233
14220
  externalProductId: t,
14234
14221
  externalIntegrationId: e
@@ -14588,7 +14575,7 @@ export {
14588
14575
  Ys as BringToFrontCommand,
14589
14576
  Ps as CanvasCommand,
14590
14577
  Ze as CollectionProduct,
14591
- Gt as ColorOptionGlobalPropertyHandle,
14578
+ kt as ColorOptionGlobalPropertyHandle,
14592
14579
  xs as CommandContext,
14593
14580
  Ya as ConversionDataType,
14594
14581
  Sa as ConversionLocation,
@@ -14602,8 +14589,8 @@ export {
14602
14589
  Ri as FlowService,
14603
14590
  vs as FontAlignmentCommand,
14604
14591
  Us as FontColorCommand,
14605
- ks as FontSizeCommand,
14606
- Gs as FontSourceCommand,
14592
+ Gs as FontSizeCommand,
14593
+ ks as FontSourceCommand,
14607
14594
  za as FrameService,
14608
14595
  _i as FrameStep,
14609
14596
  es as FrameStepHandle,
@@ -14618,7 +14605,7 @@ export {
14618
14605
  Ts as LayoutElementType,
14619
14606
  z as LayoutNotFoundError,
14620
14607
  yn as MaterialStepHandle,
14621
- ke as MisconfigurationError,
14608
+ Ge as MisconfigurationError,
14622
14609
  Ds as MockWorkflowManager,
14623
14610
  Mn as ModelStepHandle,
14624
14611
  Hn as ModuleStepHandle,
@@ -14642,7 +14629,7 @@ export {
14642
14629
  Ks as SendBackwardsCommand,
14643
14630
  Pn as ShapeStepHandle,
14644
14631
  $i as SpiffCommerceClient,
14645
- Ge as StakeholderType,
14632
+ ke as StakeholderType,
14646
14633
  js as StepAspectType,
14647
14634
  X as StepHandle,
14648
14635
  Vs as StepType,
@@ -2100,7 +2100,7 @@ IfnI8vaNAAAAAElFTkSuQmCC" transform="matrix(0.13 0.0141 -0.0141 0.1301 104.926 1
2100
2100
  }
2101
2101
  }
2102
2102
  }
2103
- `;function _e(c){const e=JSON.parse(atob(c.split(".")[1])).exp;return Math.floor(new Date().getTime()/1e3)>=e}const Kn=async c=>{var i,o;const t=((i=Object.entries(localStorage).find(([s,r])=>s.startsWith("CognitoIdentityServiceProvider")&&s.endsWith("idToken")))==null?void 0:i[0])||"",A=localStorage.getItem(t),n={};return A&&!_e(A)&&(n.Authorization=`Bearer ${A}`),(o=(await x.getShadowGraphqlClient().mutate({mutation:zn,errorPolicy:"all",fetchPolicy:"no-cache",variables:{name:c.name,layouts:c.layouts,workflowId:c.workflowId,transactionId:c.transactionId,previewImage:c.previewImage,useThreeDimPreview:c.useThreeDimPreview,metadata:c.metadata,selectedVariants:c.selectedVariants},context:{headers:n}})).data)==null?void 0:o.designCreate},Vn=async c=>{var i,o;const t=((i=Object.entries(localStorage).find(([s,r])=>s.startsWith("CognitoIdentityServiceProvider")&&s.endsWith("idToken")))==null?void 0:i[0])||"",A=localStorage.getItem(t),n={};return A&&!_e(A)&&(n.Authorization=`Bearer ${A}`),(o=(await x.getShadowGraphqlClient().mutate({mutation:jn,errorPolicy:"all",fetchPolicy:"no-cache",variables:{inputs:c.map(s=>({name:s.name,layouts:s.layouts,workflowId:s.workflowId,transactionId:s.transactionId,previewImage:s.previewImage,useThreeDimPreview:s.useThreeDimPreview,metadata:s.metadata,selectedVariants:s.selectedVariants}))},context:{headers:n}})).data)==null?void 0:o.designCreateMany},et=(c,e,t)=>{const A=a=>{const i={};if(a.type==="Frame"){const o=c[a.stepName],s=a.data;if(!o||!o.image||s.hideImageInCart&&t)return i;i[`${a.stepTitle} image`]=o.image}if(a.type==="Illustration"){const o=c[a.stepName],s=a.data;if(!o||s.hideColorsInCart&&t||!o.colors)return i;if(o.colors.length>0){const r=o.colors.join(", ").toUpperCase();i[`${a.stepTitle} colors`]=r}}if(a.type==="Module"){const o=c[a.stepName],s=a.data;if(!o||o.text===void 0||o.text===null||s.hideTextInCart&&t)return i;i[`${a.stepTitle} text`]=o.text}if(a.type==="Text"){const o=c[a.stepName];if(!o)return i;const s=a.data;(!s.hideTextInCart||!t&&o.text!==void 0&&o.text!==null)&&(i[`${a.stepTitle} text`]=o.text),o.color&&(!s.hideColorInCart||!t)&&(i[`${a.stepTitle} color`]=o.color)}return i},n={};return e.steps.forEach(a=>{Object.assign(n,A(a))}),n},Wn=(c,e,t,A)=>{const n={};let a;if(t){a=et(t,e,!1);for(const i of Object.keys(a))n[i]={value:a[i],priceModifier:0}}else if(A){a=A;for(const i of Object.keys(a))n[i]={value:a[i],priceModifier:0}}for(const i of Object.keys(c)){const o=c[i],s=e.steps.find(r=>r.stepTitle===i);if(o.length===1)n[`${s==null?void 0:s.stepTitle} selection`]={value:o[0].name,priceModifier:o[0].priceModifier};else if(o.length>1)for(let r=0;r<o.length;r++)n[`${s==null?void 0:s.stepTitle} selection ${r+1}`]={value:o[r].name,priceModifier:o[r].priceModifier}}return n},gA=(c,e,t,A,n,a,i,o)=>{var w,u;const s=e.basePrice||0,r=c.priceModifierTotal||0,g=Wn(A,t,void 0,a),B=(Y.getMap("transactionOwnerIds")||new Map).get(c.id),C={additionalExternalProductId:(w=c.integrationProduct)==null?void 0:w.additionalExternalProductId,additionalExternalVariantId:(u=c.integrationProduct)==null?void 0:u.additionalExternalVariantId,baseCost:s,designExternalVariants:c.designExternalVariants,designProductId:c.externalDesignProductId,designProductVariantId:c.externalDesignProductVariantId,event:"onComplete",exportedData:g,externalCartProductId:c.externalCartProductId,externalCartProductVariantId:c.externalCartProductVariantId,lineItemImageUrl:i||"",optionsCost:r,processExecutionId:o,quantity:c.quantity,transactionId:c.id,transactionOwnerId:B,weight:e.weight,workflowViewerLink:c.workflowViewerLink||"",workflowViewerReadOnlyLink:c.workflowViewerReadOnlyLink||""};return a&&(C.metadata=a),A&&(C.selectedVariants=A),n&&(C.sku=n),C},lA=async(c,e,t,A,n,a,i,o,s,r)=>{var S;await(async()=>{var T;if(r!==void 0)return r;await c.outstandingRequestsPromise();const N=(Y.getMap("transactionOwnerIds")||new Map).get(n.id),v=await x.getShadowGraphqlClient().query({query:Nt,variables:{ids:[n.id]},fetchPolicy:"no-cache",errorPolicy:"all",context:{transactionOwnerId:N}}),R=(T=v.data)==null?void 0:T.transactions[0].workflowState;return v.errors?(v.errors.forEach(b=>{v.errors&&console.log("Server Error:",b.message)}),null):R??null})()||(console.warn("State mismatch detected. Uploading known state explicitly"),console.warn("State Object:",JSON.stringify(A())),await c.updateStateWithServerImmediate(A),console.log("Server state is undefined @ Workflow completion"));const B=c.getPreviewService(),C=(S=e==null?void 0:e.finalizeStepConfig)==null?void 0:S.lookAtAnimation,w=B&&e.showModelOnFinishStep&&!!C,u=s&&et(s,e,!0),h=s&&et(s,e,!1),Q=async y=>{const N={};let P=0;if(Object.keys(a).length>0)for(const v of Object.keys(a)){const R=a[v],T=e.steps.find(b=>b.stepName===v);for(let b=0;b<R.selections.length;++b){const K=R.selections[b];if(T&&(!y||T.option&&(T.option.variants||[]).length>1&&!T.data.hideSelectionInCart&&!T.data.hideSelectionsInCart)){const ct=T.stepTitle;N[ct]?N[ct].push({id:K.id||"",name:K.name,priceModifier:K.priceModifier}):N[ct]=[{id:K.id||"",name:K.name,priceModifier:K.priceModifier}]}P+=K.priceModifier}}return[N,P]},[m]=await Q(!0),p=Object.fromEntries(Object.keys(m).map(y=>[y,m[y].map(N=>N.id)])),[f]=await Q(!1),I=Object.fromEntries(Object.keys(f).map(y=>[y,f[y].map(N=>N.id)]));let D=await o(w,n.id);if(D){const y=await(await fetch(D)).blob();D=(await G.uploadAsset({name:`${n.id}-preview-image.png`,blob:y},l.AssetType.Image,!0,!1)).fileLink}return{designDetails:(()=>{const y={name:i,layouts:t.map(N=>({index:N.index,panelId:N.panelId})),workflowId:e.id,transactionId:n.id,useThreeDimPreview:!!w,previewImage:D};if(h){const N=[];for(const[P,v]of Object.entries(h))N.push({key:P,value:v});y.metadata=N}if(p){const N=[];for(const[P,v]of Object.entries(I))N.push({key:P,ids:v});y.selectedVariants=N}return y})(),cartSelectionsWithPrices:m,cartMetadata:u}},BA=async(c,e,t,A,n,a,i,o,s,r,g)=>{var Q,m;s("workflow.steps.finish.finalize.buildingLayouts");const{designDetails:d,cartSelectionsWithPrices:B,cartMetadata:C}=await lA(c,e,t,A,a,i,o,r,g);s("workflow.steps.finish.finalize.creatingDesign");const w=await Kn(d),u=(Q=w==null?void 0:w.transaction)==null?void 0:Q.previewImageLink;if(!(w!=null&&w.transaction))throw new Error("Failed to create design");s("workflow.steps.finish.finalize.updatingTransaction");const h=w.transaction;return gA(h,n,e,B,w==null?void 0:w.sku,C,u,(m=w==null?void 0:w.processExecution)==null?void 0:m.id)},Xn=async(c,e,t)=>{e("workflow.steps.finish.finalize.buildingLayouts"),await Promise.all(c.map(async o=>{await o.workflowManager.outstandingRequestsPromise()}));const n=await(async()=>{var r;const s=await x.getShadowGraphqlClient().query({query:Nt,variables:{ids:c.map(g=>g.transaction.id)},fetchPolicy:"no-cache",errorPolicy:"all"});return s.errors?(s.errors.forEach(g=>{s.errors&&console.log("Server Error:",g.message)}),null):(r=s.data)!=null&&r.transactions?s.data.transactions.map(g=>g.workflowState??null):null})(),a=await Promise.all(c.map(async(o,s)=>await lA(o.workflowManager,o.workflow,o.layouts,o.getReducerState,o.transaction,o.workflowSelections,o.designName,t??(()=>Promise.resolve(void 0)),o.workflowMetadata,n?n[s]:void 0)));e("workflow.steps.finish.finalize.creatingDesign");const i=await Vn(a.map(o=>o.designDetails));if(!i)throw new Error("Failed to create designs");return e("workflow.steps.finish.finalize.updatingTransaction"),i.map((o,s)=>{var B;const r=c[s],g=a[s],d=o.transaction;return gA(d,r.product,r.workflow,g.cartSelectionsWithPrices,o.sku,g.cartMetadata,void 0,(B=o.processExecution)==null?void 0:B.id)})};class qn{constructor(){this.localPersistenceKey="designTransactions",this.storageMethod="Local",this.designSavedListeners=[]}attachSaveListener(e){this.designSavedListeners.push(e)}detachSaveListener(e){this.designSavedListeners=this.designSavedListeners.filter(t=>t!==e)}async getSavedDesigns(){if(this.storageMethod==="Local"){const e=Y.get(this.localPersistenceKey);return e?JSON.parse(e):[]}throw new k("Unexpected storage method requested")}async getSavedDesignByTransaction(e){return(await this.getSavedDesigns()).find(A=>A.transactionId===e)}async addDesign(e){const A=(await this.getSavedDesigns()).filter(n=>n.transactionId!==e.transactionId);A.unshift(e),await this.setDesigns(A),this.designSavedListeners.forEach(n=>n(e))}async renameDesign(e,t){const A=await this.getSavedDesigns(),n=A.find(a=>a.transactionId===e);if(!n)throw new Error(`No saved design for transaction ${e}.`);n.title=t,await this.setDesigns(A)}async removeDesign(e){const t=await this.getSavedDesigns();await this.setDesigns(t.filter(A=>A.transactionId!==e))}async setDesigns(e){if(this.storageMethod==="Local"){Y.set(this.localPersistenceKey,JSON.stringify(e));return}throw new k("Unexpected storage method requested")}}const Ne=new qn,Zn=M.gql`
2103
+ `;function _e(c){const e=JSON.parse(atob(c.split(".")[1])).exp;return Math.floor(new Date().getTime()/1e3)>=e}const Kn=async c=>{var i,o;const t=((i=Object.entries(localStorage).find(([s,r])=>s.startsWith("CognitoIdentityServiceProvider")&&s.endsWith("idToken")))==null?void 0:i[0])||"",A=localStorage.getItem(t),n={};return A&&!_e(A)&&(n.Authorization=`Bearer ${A}`),(o=(await x.getShadowGraphqlClient().mutate({mutation:zn,errorPolicy:"all",fetchPolicy:"no-cache",variables:{name:c.name,layouts:c.layouts,workflowId:c.workflowId,transactionId:c.transactionId,previewImage:c.previewImage,useThreeDimPreview:c.useThreeDimPreview,metadata:c.metadata,selectedVariants:c.selectedVariants},context:{headers:n}})).data)==null?void 0:o.designCreate},Vn=async c=>{var i,o;const t=((i=Object.entries(localStorage).find(([s,r])=>s.startsWith("CognitoIdentityServiceProvider")&&s.endsWith("idToken")))==null?void 0:i[0])||"",A=localStorage.getItem(t),n={};return A&&!_e(A)&&(n.Authorization=`Bearer ${A}`),(o=(await x.getShadowGraphqlClient().mutate({mutation:jn,errorPolicy:"all",fetchPolicy:"no-cache",variables:{inputs:c.map(s=>({name:s.name,layouts:s.layouts,workflowId:s.workflowId,transactionId:s.transactionId,previewImage:s.previewImage,useThreeDimPreview:s.useThreeDimPreview,metadata:s.metadata,selectedVariants:s.selectedVariants}))},context:{headers:n}})).data)==null?void 0:o.designCreateMany},et=(c,e,t)=>{const A=a=>{const i={};if(a.type==="Frame"){const o=c[a.stepName],s=a.data;if(!o||!o.image||s.hideImageInCart&&t)return i;i[`${a.stepTitle} image`]=o.image}if(a.type==="Illustration"){const o=c[a.stepName],s=a.data;if(!o||s.hideColorsInCart&&t||!o.colors)return i;if(o.colors.length>0){const r=o.colors.join(", ").toUpperCase();i[`${a.stepTitle} colors`]=r}}if(a.type==="Module"){const o=c[a.stepName],s=a.data;if(!o||o.text===void 0||o.text===null||s.hideTextInCart&&t)return i;i[`${a.stepTitle} text`]=o.text}if(a.type==="Text"){const o=c[a.stepName];if(!o)return i;const s=a.data;(!s.hideTextInCart||!t&&o.text!==void 0&&o.text!==null)&&(i[`${a.stepTitle} text`]=o.text),o.color&&(!s.hideColorInCart||!t)&&(i[`${a.stepTitle} color`]=o.color)}return i},n={};return e.steps.forEach(a=>{Object.assign(n,A(a))}),n},Wn=(c,e,t,A)=>{const n={};let a={};t?a=et(t,e,!1):A&&(a=A);const o=e.steps.map(s=>s.stepTitle).filter((s,r,g)=>g.indexOf(s)==r);for(const s of o){if(Object.keys(c).includes(s)){const r=c[s],g=e.steps.find(d=>d.stepTitle===s);n[`${g==null?void 0:g.stepTitle} selection`]={value:r[0].name,priceModifier:r[0].priceModifier}}for(const r of Object.keys(a))[`${s} color`,`${s} colors`,`${s} text`,`${s} image`].includes(r)&&(n[r]={value:a[r],priceModifier:0})}return n},gA=(c,e,t,A,n,a,i,o)=>{var w,u;const s=e.basePrice||0,r=c.priceModifierTotal||0,g=Wn(A,t,void 0,a),B=(Y.getMap("transactionOwnerIds")||new Map).get(c.id),C={additionalExternalProductId:(w=c.integrationProduct)==null?void 0:w.additionalExternalProductId,additionalExternalVariantId:(u=c.integrationProduct)==null?void 0:u.additionalExternalVariantId,baseCost:s,designExternalVariants:c.designExternalVariants,designProductId:c.externalDesignProductId,designProductVariantId:c.externalDesignProductVariantId,event:"onComplete",exportedData:g,externalCartProductId:c.externalCartProductId,externalCartProductVariantId:c.externalCartProductVariantId,lineItemImageUrl:i||"",optionsCost:r,processExecutionId:o,quantity:c.quantity,transactionId:c.id,transactionOwnerId:B,weight:e.weight,workflowViewerLink:c.workflowViewerLink||"",workflowViewerReadOnlyLink:c.workflowViewerReadOnlyLink||""};return a&&(C.metadata=a),A&&(C.selectedVariants=A),n&&(C.sku=n),C},lA=async(c,e,t,A,n,a,i,o,s,r)=>{var S;await(async()=>{var T;if(r!==void 0)return r;await c.outstandingRequestsPromise();const N=(Y.getMap("transactionOwnerIds")||new Map).get(n.id),v=await x.getShadowGraphqlClient().query({query:Nt,variables:{ids:[n.id]},fetchPolicy:"no-cache",errorPolicy:"all",context:{transactionOwnerId:N}}),R=(T=v.data)==null?void 0:T.transactions[0].workflowState;return v.errors?(v.errors.forEach(b=>{v.errors&&console.log("Server Error:",b.message)}),null):R??null})()||(console.warn("State mismatch detected. Uploading known state explicitly"),console.warn("State Object:",JSON.stringify(A())),await c.updateStateWithServerImmediate(A),console.log("Server state is undefined @ Workflow completion"));const B=c.getPreviewService(),C=(S=e==null?void 0:e.finalizeStepConfig)==null?void 0:S.lookAtAnimation,w=B&&e.showModelOnFinishStep&&!!C,u=s&&et(s,e,!0),h=s&&et(s,e,!1),Q=async y=>{const N={};let P=0;if(Object.keys(a).length>0)for(const v of Object.keys(a)){const R=a[v],T=e.steps.find(b=>b.stepName===v);for(let b=0;b<R.selections.length;++b){const K=R.selections[b];if(T&&(!y||T.option&&(T.option.variants||[]).length>1&&!T.data.hideSelectionInCart&&!T.data.hideSelectionsInCart)){const ct=T.stepTitle;N[ct]?N[ct].push({id:K.id||"",name:K.name,priceModifier:K.priceModifier}):N[ct]=[{id:K.id||"",name:K.name,priceModifier:K.priceModifier}]}P+=K.priceModifier}}return[N,P]},[m]=await Q(!0),p=Object.fromEntries(Object.keys(m).map(y=>[y,m[y].map(N=>N.id)])),[f]=await Q(!1),I=Object.fromEntries(Object.keys(f).map(y=>[y,f[y].map(N=>N.id)]));let D=await o(w,n.id);if(D){const y=await(await fetch(D)).blob();D=(await G.uploadAsset({name:`${n.id}-preview-image.png`,blob:y},l.AssetType.Image,!0,!1)).fileLink}return{designDetails:(()=>{const y={name:i,layouts:t.map(N=>({index:N.index,panelId:N.panelId})),workflowId:e.id,transactionId:n.id,useThreeDimPreview:!!w,previewImage:D};if(h){const N=[];for(const[P,v]of Object.entries(h))N.push({key:P,value:v});y.metadata=N}if(p){const N=[];for(const[P,v]of Object.entries(I))N.push({key:P,ids:v});y.selectedVariants=N}return y})(),cartSelectionsWithPrices:m,cartMetadata:u}},BA=async(c,e,t,A,n,a,i,o,s,r,g)=>{var Q,m;s("workflow.steps.finish.finalize.buildingLayouts");const{designDetails:d,cartSelectionsWithPrices:B,cartMetadata:C}=await lA(c,e,t,A,a,i,o,r,g);s("workflow.steps.finish.finalize.creatingDesign");const w=await Kn(d),u=(Q=w==null?void 0:w.transaction)==null?void 0:Q.previewImageLink;if(!(w!=null&&w.transaction))throw new Error("Failed to create design");s("workflow.steps.finish.finalize.updatingTransaction");const h=w.transaction;return gA(h,n,e,B,w==null?void 0:w.sku,C,u,(m=w==null?void 0:w.processExecution)==null?void 0:m.id)},Xn=async(c,e,t)=>{e("workflow.steps.finish.finalize.buildingLayouts"),await Promise.all(c.map(async o=>{await o.workflowManager.outstandingRequestsPromise()}));const n=await(async()=>{var r;const s=await x.getShadowGraphqlClient().query({query:Nt,variables:{ids:c.map(g=>g.transaction.id)},fetchPolicy:"no-cache",errorPolicy:"all"});return s.errors?(s.errors.forEach(g=>{s.errors&&console.log("Server Error:",g.message)}),null):(r=s.data)!=null&&r.transactions?s.data.transactions.map(g=>g.workflowState??null):null})(),a=await Promise.all(c.map(async(o,s)=>await lA(o.workflowManager,o.workflow,o.layouts,o.getReducerState,o.transaction,o.workflowSelections,o.designName,t??(()=>Promise.resolve(void 0)),o.workflowMetadata,n?n[s]:void 0)));e("workflow.steps.finish.finalize.creatingDesign");const i=await Vn(a.map(o=>o.designDetails));if(!i)throw new Error("Failed to create designs");return e("workflow.steps.finish.finalize.updatingTransaction"),i.map((o,s)=>{var B;const r=c[s],g=a[s],d=o.transaction;return gA(d,r.product,r.workflow,g.cartSelectionsWithPrices,o.sku,g.cartMetadata,void 0,(B=o.processExecution)==null?void 0:B.id)})};class qn{constructor(){this.localPersistenceKey="designTransactions",this.storageMethod="Local",this.designSavedListeners=[]}attachSaveListener(e){this.designSavedListeners.push(e)}detachSaveListener(e){this.designSavedListeners=this.designSavedListeners.filter(t=>t!==e)}async getSavedDesigns(){if(this.storageMethod==="Local"){const e=Y.get(this.localPersistenceKey);return e?JSON.parse(e):[]}throw new k("Unexpected storage method requested")}async getSavedDesignByTransaction(e){return(await this.getSavedDesigns()).find(A=>A.transactionId===e)}async addDesign(e){const A=(await this.getSavedDesigns()).filter(n=>n.transactionId!==e.transactionId);A.unshift(e),await this.setDesigns(A),this.designSavedListeners.forEach(n=>n(e))}async renameDesign(e,t){const A=await this.getSavedDesigns(),n=A.find(a=>a.transactionId===e);if(!n)throw new Error(`No saved design for transaction ${e}.`);n.title=t,await this.setDesigns(A)}async removeDesign(e){const t=await this.getSavedDesigns();await this.setDesigns(t.filter(A=>A.transactionId!==e))}async setDesigns(e){if(this.storageMethod==="Local"){Y.set(this.localPersistenceKey,JSON.stringify(e));return}throw new k("Unexpected storage method requested")}}const Ne=new qn,Zn=M.gql`
2104
2104
  mutation AddTransactionStakeholder($id: String!, $type: String!, $details: CustomerDetailsInput!) {
2105
2105
  transactionAddStakeholder(id: $id, details: $details, type: $type) {
2106
2106
  id
@@ -3140,4 +3140,4 @@ IfnI8vaNAAAAAElFTkSuQmCC" transform="matrix(0.13 0.0141 -0.0141 0.1301 104.926 1
3140
3140
  }
3141
3141
  }
3142
3142
  }
3143
- `,re=async c=>{var e;for(const t in c.layouts){const A=c.layouts[t].elements.filter(a=>a.type===l.LayoutElementType.Illustration);for(let a=0;a<A.length;++a){const i=A[a];i.src&&i.svg&&(i.cachedObjectURL=await l.svgObjectURL(i.svg))}const n=c.layouts[t].elements.filter(a=>a.type===l.LayoutElementType.Textbox);for(let a=0;a<n.length;++a){const i=n[a];(e=i.fontData)!=null&&e.assetUrl&&await l.loadFont(i.fontData.assetUrl)}}},qa=async(c,e)=>{var n;const t=await x.getShadowGraphqlClient().query({query:Ta(((n=e==null?void 0:e.assets)==null?void 0:n.metadata)||!1),errorPolicy:"all",fetchPolicy:"no-cache",variables:{ids:c}}),A=t.data.workflows;if(A===void 0||A.length!==c.length)throw new Error(`Unable to read workflows: ${t.errors??"Length mismatch in response"}`);return A.forEach(a=>{a.steps.forEach(i=>{var o,s,r;delete i.data.__typename,(o=i.option)!=null&&o.id&&((s=i.option.defaultVariant)!=null&&s.asset&&G.cacheAsset(i.option.defaultVariant.asset),i.option.colorProfile&&G.cacheAsset(i.option.colorProfile),(r=i.option.variants)==null||r.forEach(g=>{g.asset&&G.cacheAsset(g.asset),g.displayImage&&G.cacheAsset(g.displayImage),g.thumbnail&&G.cacheAsset(g.thumbnail),g.material&&G.cacheMaterial(g.material)}),te.set({id:i.option.id},Promise.resolve(i.option)))}),a.finalizeStepConfig||(a.finalizeStepConfig={}),a.finalizeStepConfig.termsMarkdown=a.partner.termsMarkdown}),A},Za=async(c,e)=>{const A=(await e).find(n=>n.id===c);if(!A)throw new Error(`Workflow not found: ${c}`);return A},st=async(c,e)=>{const t=c.map(o=>te.get({id:o,options:e})),A=c.filter((o,s)=>t[s]===void 0);if(A.length===0)return Promise.all(t);const n=qa(A,e),a=A.map(o=>te.set({id:o,options:e},Za(o,n))),i=t.filter(o=>o!==void 0);return await Promise.all(i.concat(a))},Ie=async(c,e)=>(await st([c],e))[0],$a=c=>c.sort((e,t)=>e.index-t.index).map(e=>({id:l.generate(),panelId:e.name,name:e.name,index:e.index,createdAt:new Date,updatedAt:new Date,transparentBackground:e.transparentBackground,height:e.height,width:e.width,previewRegion:e.previewRegion,useEditableArea:e.useEditableArea,editableArea:e.editableArea})),rt=(c,e)=>{const t=c.workflowState,A=t?JSON.parse(t):void 0;return A?Object.values(A.layouts).map(n=>n.layout):$a(e.panels)};class MA{constructor(e){this.activeIntegration=void 0,this.updateTransactionState=async t=>{try{return x.getShadowGraphqlClient().mutate({...t,mutation:An})}catch(A){throw console.error(A),new U("Critical - Unable to synchronize workflow state with server.")}},this.initialized=!1,this.options=e,this.options.applicationKey&&RA(this.options.applicationKey),console.debug("------------------------"),console.debug("Spiff Commerce Core SDK"),console.debug("Version: 22.1.5-beta.48866ff2-4747-587f-9ab9-bd1ae140115b"),console.debug(`Application Key Provided: ${!!this.options.applicationKey}`),console.debug("------------------------")}getAssetManager(){return G}getCurrencyCode(){if(this.currencyCode===void 0)throw new Error("No currency code set.");return this.currencyCode}getFlowService(){if(!HA())throw new Error("Application key required to use Flow Service.");return new IA}async getIntegration(){if(!this.options.applicationKey)throw new Error("Cannot get current Integration without specifying an Application Key.");if(this.activeIntegration)return this.activeIntegration;const e=async()=>(await x.getShadowGraphqlClient().query({query:La,errorPolicy:"all",fetchPolicy:"no-cache"})).data.currentIntegration;return this.activeIntegration=e(),this.activeIntegration}async canUseAddon(e){var t;try{return((t=(await this.getIntegration()).partner.activeAddons)==null?void 0:t.includes(e))??!1}catch(A){return console.error(A),!1}}async authenticateBundleFromLocalStorage(e){var n,a;const t=Y.getMap("bundleOwnerIds");if(t!=null&&t.has(e))return Promise.resolve({success:!0,stakeholderType:we.Owner});const A=Y.getMap("bundlePartnerIds")||new Map;if(A.has(e)){const i=A.get(e),s=(Y.getMap("partnerCustomerIds")||new Map).get(i);if(s&&await this.authenticateCustomerId(s)){const g=(a=(n=this.customer)==null?void 0:n.bundleStakeholders)==null?void 0:a.find(d=>{var B;return((B=d.bundle)==null?void 0:B.id)===e});if(g)return Promise.resolve({success:!0,stakeholderType:g.type})}}return Promise.resolve({success:!1})}async authenticateTransactionFromLocalStorage(e){var g,d,B,C,w,u;const t=x.getShadowGraphqlClient(),A=await t.query({query:Oa,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e}});if(!A.data.transactions||A.data.transactions.length===0)throw new Error(`Transaction not found: ${e}`);const n=A.data.transactions[0];if(!((d=(g=n.product)==null?void 0:g.partner)==null?void 0:d.id))throw new Error(`Unable to read transaction: ${e}`);if(n.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const i=Y.getMap("transactionOwnerIds");if(i!=null&&i.has(e))return Promise.resolve({success:!0,stakeholderType:we.Owner});const o=Y.getMap("transactionCustomerIds");if(o!=null&&o.has(e)){const h=o.get(e);if(h&&await this.authenticateCustomerId(h)){const m=((C=(B=this.customer)==null?void 0:B.bundleStakeholders)==null?void 0:C.find(p=>{var f,I;return(I=(f=p.bundle)==null?void 0:f.transactions)==null?void 0:I.some(D=>D.id===e)}))||((u=(w=this.customer)==null?void 0:w.stakeholders)==null?void 0:u.find(p=>{var f;return((f=p.transaction)==null?void 0:f.id)===e}));if(m)return Promise.resolve({success:!0,stakeholderType:m.type})}}const r=(await t.query({query:za,errorPolicy:"all",variables:{id:n.workflowId}})).data.workflow;if(!r)throw new Error(`Unable to read workflow: ${n.workflowId}`);return Promise.resolve({success:!1,theme:r.overrideTheme,customLogoLink:n.customLogoLink})}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(e){const t=Y.getMap("transactionCustomerIds");t!=null&&t.has(e)&&(t.delete(e),Y.setMap("transactionCustomerIds",t))}getStakeholderTypeForTransaction(e){var A,n;const t=(n=(A=this.customer)==null?void 0:A.stakeholders)==null?void 0:n.find(a=>{var i;return((i=a.transaction)==null?void 0:i.id)===e});if(t)return t.type}async getOrCreateCustomer(e){var i;this.customer=void 0;const t=x.getShadowGraphqlClient(),n=(await t.query({query:ja,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!n.id){const s=(i=(await t.mutate({mutation:Ka,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:e}}})).data)==null?void 0:i.customerCreate;if(!s)throw new Error("Unable to create customer.");return this.storeCustomer(s),this.customer=s,{customer:s,isAuthenticated:!1}}this.storeCustomer(n);const a=await this.authenticateCustomerId(n.id);return{customer:this.customer||n,isAuthenticated:a}}async authenticateCustomerId(e){var o;const t=x.getShadowGraphqlClient(),A=Y.getMap("customerTokens");if(!(A!=null&&A.has(e)))return!1;const n=A.get(e);if(!n)return!1;const i=(o=(await t.mutate({mutation:Va,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:n}})).data)==null?void 0:o.customerAuthenticate;return i?(this.storeCustomer(i),mt(n),this.customer=i,!0):!1}async generateVerificationCode(e){await x.getShadowGraphqlClient().mutate({mutation:Wa,variables:{emailAddress:e}})}async verifyCode(e,t){var a,i;const n=(a=(await x.getShadowGraphqlClient().mutate({mutation:Xa,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e,verificationCode:t}})).data)==null?void 0:a.customerVerifyCode;if(n!=null&&n.loginToken){if(!((i=n.partner)!=null&&i.id))throw new Error(`Unable to find customer: ${e}`);const o=Y.getMap("customerTokens")||new Map;return o.set(n.id,n.loginToken),Y.setMap("customerTokens",o),this.storeCustomer(n),mt(n.loginToken),this.customer={...n,loginToken:void 0},!0}return!1}async getNewBundle(e,t,A){var r,g,d;const a=(d=(await x.getShadowGraphqlClient().mutate({mutation:ua(((g=(r=A==null?void 0:A.graphql)==null?void 0:r.productCollection)==null?void 0:g.eagerFetchProducts)||!1),variables:{collectionId:e,initialMetadata:t?Object.entries(t).map((B,C)=>({key:B[0],value:B[1]})):void 0},fetchPolicy:"no-cache"})).data)==null?void 0:d.bundleCreate;if(!(a!=null&&a.id))throw new Error("Unable to create bundle");const i=Y.getMap("bundlePartnerIds")||new Map;i.set(a.id,a.partner.id),Y.setMap("bundlePartnerIds",i);const o=Y.getMap("bundleOwnerIds")||new Map;o.set(a.id,a.bundleOwnerId),Y.setMap("bundleOwnerIds",o);const s=new fA(this,a,void 0,void 0,a.bundleOwnerId);return await s.getInitializationPromise(),s}async getExistingBundle(e,t,A,n){var h,Q,m,p,f,I,D,F,S;const a=Y.getMap("bundleOwnerIds"),i=a==null?void 0:a.get(e),s=((h=Object.entries(localStorage).find(([y,N])=>y.startsWith("CognitoIdentityServiceProvider")&&y.endsWith("idToken")))==null?void 0:h[0])||"",r=localStorage.getItem(s),g={};r&&!_e(r)&&(g.Authorization=`Bearer ${r}`);const d={bundleOwnerId:i,...g,...(Q=n==null?void 0:n.graphql)==null?void 0:Q.additionalHeaders},B=await x.getShadowGraphqlClient().query({query:Ca(((p=(m=n==null?void 0:n.graphql)==null?void 0:m.productCollection)==null?void 0:p.eagerFetchProducts)||!1),variables:{id:e},fetchPolicy:"no-cache",context:{headers:d}});if(!((f=B.data)!=null&&f.bundles)||((I=B.data)==null?void 0:I.bundles.length)===0||!((D=B.data)!=null&&D.bundles[0]))throw new Error(`Unable to find bundle: ${e}`);const C=(F=B.data)==null?void 0:F.bundles[0],w=Y.getMap("bundlePartnerIds")||new Map;w.set(C.id,C.partner.id),Y.setMap("bundlePartnerIds",w);const u=new fA(this,C,t,A,i,{additionalHeaders:(S=n==null?void 0:n.graphql)==null?void 0:S.additionalHeaders});return await u.getInitializationPromise(),u}async getBundleStakeholders(){var a;if(!this.customer)throw new Error("Customer not authenticated.");const e=await x.getShadowGraphqlClient().query({query:Ea,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!((a=e.data)!=null&&a.customers)||e.data.customers.length===0)throw new Error("Unable to find customer.");const A=e.data.customers[0].bundleStakeholders||[],n=Y.getMap("bundlePartnerIds")||new Map;return A.forEach(i=>{var o,s;(o=i.bundle)!=null&&o.id&&((s=i.bundle.partner)!=null&&s.id)&&n.set(i.bundle.id,i.bundle.partner.id)}),Y.setMap("bundlePartnerIds",n),A}async getWorkflowExperience(e,t,A,n){var d,B,C,w,u;if(!n)return await this.getWorkflowExperienceDeprecated(e,t,A);const a=async()=>{var Q,m;const h=x.getShadowGraphqlClient();if(n.type==="transaction"){const{transactionId:p,readOnly:f}=n,I=await h.query({query:Se,variables:{ids:[p]},errorPolicy:"all",fetchPolicy:"no-cache"});if(!((Q=I.data)!=null&&Q.transactions)||I.data.transactions.length===0)throw new U("Existing transaction not found.");const D=(m=I.data)==null?void 0:m.transactions[0];if(!D.workflowId)throw new U("Existing transaction has no workflow ID.");const F=await Ie(D.workflowId);if(!D.product)throw new U("Failed to load transaction, product not available.");return{transaction:D,workflow:F,readOnly:f}}if(n.type==="integration"||n.type==="external"){const p=async()=>{const F=n.type==="integration"?{integrationProductId:n.integrationProductId}:{externalIntegrationId:n.externalIntegrationId,externalProductId:n.externalProductId},S=await h.mutate({mutation:Yt,variables:{...F,workflowId:n.workflowId,designName:n.designName,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!S.data||!S.data.transactionCreate)throw new U("Failed to create transaction!");const y=S.data.transactionCreate;if(!y.product)throw new U("Failed to create transaction, product not available.");return y},f=Ie(n.workflowId,n==null?void 0:n.graphql),[I,D]=await Promise.all([p(),f]);return{transaction:I,workflow:D}}throw new U("No workflow ID provided.")},{transaction:i,workflow:o,readOnly:s}=await a();this.currencyCode=(d=i.product.partner)==null?void 0:d.currencyCode;const r={product:i.product,transaction:i,layouts:[],singleVariantsRenderable:(B=n==null?void 0:n.workflowConfiguration)==null?void 0:B.singleVariantsRenderable,stateMutationFunc:s?async()=>{throw new k("State mutation is forbidden in read only mode!")}:async h=>{const m=(Y.getMap("transactionOwnerIds")||new Map).get(i.id)||void 0;return this.updateTransactionState({...h,context:{transactionOwnerId:m}})},readOnly:s,workflow:o};if(n.type==="transaction"&&i.workflowState){const h=JSON.parse(i.workflowState);r.layouts=Object.values(h.layouts).map(Q=>Q.layout),await l.rehydrateSerializedLayout(h),await re(h),r.reloadedState=h}else if(!s&&n.workflowState){const h=JSON.parse(n.workflowState);r.layouts=Object.values(h.layouts).map(Q=>Q.layout),await l.rehydrateSerializedLayout(h),await re(h),r.reloadedState=h}else r.layouts=rt(r.transaction,r.workflow);if(r.renderableContextService=new ve(r.layouts),n.previewService?(r.previewService=n.previewService,(C=r.product)!=null&&C.modelUrl&&(r.modelContainer=r.previewService.loadModel({model:r.product.modelUrl,contextService:r.renderableContextService}))):(r.previewService=A&&A(o),(w=r.product)!=null&&w.modelUrl&&(r.modelContainer=(u=r.previewService)==null?void 0:u.loadModel({model:r.product.modelUrl,contextService:r.renderableContextService}))),n.type!=="transaction"){const h=Y.getMap("transactionOwnerIds")||new Map;h.set(i.id,i.transactionOwnerId),Y.setMap("transactionOwnerIds",h)}else r.isReloadedTransaction=!0;this.initialized=!0,this.experienceOptions=r;const g=new De(this,r);return await g.getWorkflowManager().getInitializationPromise(),n.type!=="transaction"&&this.customer&&await g.attachCustomerDetails({email:this.customer.emailAddress}),g}async getWorkflowExperiences(e,t){if(e.length===0)throw new U("No options provided!");const A=x.getShadowGraphqlClient(),n=async I=>{var y,N;if(I.length===0)return[];const D=I.map(P=>P.option.transactionId),F=await A.query({query:Se,variables:{ids:D},errorPolicy:"all",fetchPolicy:"no-cache"}),S=F.data.transactions;if(S.length!==I.length){const P=((N=(y=F.errors)==null?void 0:y[0])==null?void 0:N.message)||"Unknown error";throw new U(`Not all transactions were found: ${P}`)}return S.map((P,v)=>{var R;return{transaction:P,workflowId:P.workflowId,readOnly:((R=I.find(T=>T.option.transactionId===P.id))==null?void 0:R.option.readOnly)??!1,index:I[v].index}})},a=async I=>{var S,y,N;if(I.length===0)return[];const D=await A.mutate({mutation:en,variables:{inputs:I.map(P=>({integrationProductId:P.option.type==="integration"?P.option.integrationProductId:void 0,externalIntegrationId:P.option.type==="external"?P.option.externalIntegrationId:void 0,externalProductId:P.option.type==="external"?P.option.externalProductId:void 0,workflowId:P.option.workflowId,designName:P.option.designName,claim:!0}))},errorPolicy:"all",fetchPolicy:"no-cache"}),F=(S=D.data)==null?void 0:S.transactionCreateMany;if(!F||F.length===0){const P=((N=(y=D.errors)==null?void 0:y[0])==null?void 0:N.message)||"Unknown error";throw new U(`Failed to create transactions: ${P}`)}return F.map((P,v)=>({transaction:P,workflowId:P.workflowId,readOnly:!1,index:I[v].index}))},i=e.map((I,D)=>({option:I,index:D})),o=i.filter(I=>I.option.type==="transaction"),s=i.filter(I=>I.option.type==="integration"||I.option.type==="external"),r=wt(o,10),g=wt(s,10),d=(await Promise.all([...r.map(n),...g.map(a)])).flat(),B=[...new Set(d.map(I=>I.workflowId))],C=await st(B,t),w=new Map(C.map(I=>[I.id,I])),u=Y.getMap("transactionOwnerIds")||new Map,h=d.map(async I=>{var T;const{transaction:D,workflowId:F,readOnly:S,index:y}=I,N=w.get(F),P=e[y];!u.get(D.id)&&D.transactionOwnerId&&u.set(D.id,D.transactionOwnerId);const v=u.get(D.id)||void 0,R={product:D.product,transaction:D,layouts:[],singleVariantsRenderable:(T=P==null?void 0:P.workflowConfiguration)==null?void 0:T.singleVariantsRenderable,stateMutationFunc:S?async()=>{throw new k("State mutation is forbidden in read only mode!")}:async b=>this.updateTransactionState({...b,context:{transactionOwnerId:v}}),readOnly:S,workflow:N,isReloadedTransaction:P.type==="transaction"};if(P.type==="transaction"&&D.workflowState){const b=JSON.parse(D.workflowState);R.layouts=Object.values(b.layouts||{}).map(K=>K.layout),await l.rehydrateSerializedLayout(b),await re(b),R.reloadedState=b}else if(!S&&P.workflowState){const b=JSON.parse(P.workflowState);R.layouts=Object.values(b.layouts||{}).map(K=>K.layout),await l.rehydrateSerializedLayout(b),await re(b),R.reloadedState=b}else R.layouts=rt(R.transaction,R.workflow);return R.renderableContextService=new ve(R.layouts),R.delayWorkflowStateSync=!0,this.initialized=!0,this.experienceOptions=R,{experienceOptions:R,index:y,options:P}});Y.setMap("transactionOwnerIds",u);const p=(await Promise.all(h)).sort((I,D)=>I.index-D.index).map(async I=>{const{experienceOptions:D,options:F}=I,S=new De(this,D);return await S.getWorkflowManager().getInitializationPromise(),F.type!=="transaction"&&this.customer&&await S.attachCustomerDetails({email:this.customer.emailAddress}),S}),f=await Promise.all(p);return f.forEach(I=>I.getWorkflowManager().setWorkflowStateSyncEnabled(!0)),f}async initFromIntegrationProduct(e){var i;if(e==="")throw new U("No integration product ID provided.");const A=await x.getShadowGraphqlClient().mutate({mutation:Yt,variables:{integrationProductId:e,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!A.data||!A.data.transactionCreate)throw new U("Failed to create transaction!");const n=A.data.transactionCreate;if(!n.product)throw new U("Failed to create transaction, product not available.");this.currencyCode=(i=n.product.partner)==null?void 0:i.currencyCode;const a=Y.getMap("transactionOwnerIds")||new Map;a.set(n.id,n.transactionOwnerId),Y.setMap("transactionOwnerIds",a),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:async o=>this.updateTransactionState({...o,context:{transactionOwnerId:n.transactionOwnerId}})},this.initialized=!0}async initFromTransaction(e,t=!1){var o,s,r,g;if(e==="")throw new U("No transaction ID provided.");const A=x.getShadowGraphqlClient(),n=async()=>{var C,w;const B=(C=(await A.query({query:Se,variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data)==null?void 0:C.transactions[0];if(!B)throw new U("Failed to read transaction.");if(!B.product)throw new U("Failed to load transaction, product not available.");this.currencyCode=(w=B.product.partner)==null?void 0:w.currencyCode,this.experienceOptions={product:B.product,transaction:B,layouts:[],stateMutationFunc:async()=>{throw new k("State mutation is forbidden in read only mode!")},readOnly:t},this.initialized=!0};if(t)return await n();const a=Y.getMap("transactionOwnerIds")||new Map,i=a.get(e);if(i){const B=(o=(await A.query({query:Se,variables:{ids:[e]},errorPolicy:"all"})).data)==null?void 0:o.transactions[0];if(!B)throw new U("Failed to read transaction.");if(!B.product)throw new U("Failed to load transaction, product not available.");this.currencyCode=(s=B.product.partner)==null?void 0:s.currencyCode,this.experienceOptions={product:B.product,transaction:B,layouts:[],stateMutationFunc:async C=>this.updateTransactionState({...C,context:{transactionOwnerId:i}}),readOnly:t},this.initialized=!0;return}try{const B=(r=(await A.mutate({mutation:tn,variables:{id:e},errorPolicy:"all"})).data)==null?void 0:r.transactionClaim;if(!B)throw new U("Failed to read transaction.");if(!B.product)throw new U("Failed to load transaction, product not available.");this.currencyCode=(g=B.product.partner)==null?void 0:g.currencyCode,B.transactionOwnerId&&(a.set(B.id,B.transactionOwnerId),Y.setMap("transactionOwnerIds",a)),this.experienceOptions={product:B.product,transaction:B,layouts:[],stateMutationFunc:async C=>this.updateTransactionState({...C,context:{transactionOwnerId:B.transactionOwnerId}}),readOnly:t},this.initialized=!0}catch{throw new U("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(e,t,A){var n,a,i,o;if(!this.initialized||!this.experienceOptions)throw new U("Cannot launch experience: Not initialized.");if(this.experienceOptions.transaction.workflowId){const s=await Ie(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=s,this.experienceOptions.transaction.workflowState){const g=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(g.layouts).map(d=>d.layout),await l.rehydrateSerializedLayout(g),await re(g),this.experienceOptions.reloadedState=g}this.experienceOptions.previewService=A&&A(s),this.experienceOptions.renderableContextService=new ve(this.experienceOptions.layouts),(n=this.experienceOptions.product)!=null&&n.modelUrl&&(this.experienceOptions.modelContainer=(a=this.experienceOptions.previewService)==null?void 0:a.loadModel({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}));const r=new De(this,this.experienceOptions);return await r.getWorkflowManager().getInitializationPromise(),r}if(e){const r=(Y.getMap("transactionOwnerIds")||new Map).get(this.experienceOptions.transaction.id),g=x.getShadowGraphqlClient().mutate({mutation:nn,variables:{workflowId:e,id:this.experienceOptions.transaction.id},context:{transactionOwnerId:r}}),d=Ie(e);if(await Promise.all([g,d]),this.experienceOptions.workflow=await d,t){const C=JSON.parse(t);this.experienceOptions.layouts=Object.values(C.layouts).map(w=>w.layout),await l.rehydrateSerializedLayout(C),await re(C),this.experienceOptions.reloadedState=C}else this.experienceOptions.layouts=rt(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=A&&A(await d),this.experienceOptions.renderableContextService=new ve(this.experienceOptions.layouts),(i=this.experienceOptions.product)!=null&&i.modelUrl&&(this.experienceOptions.modelContainer=(o=this.experienceOptions.previewService)==null?void 0:o.loadModel({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}));const B=new De(this,this.experienceOptions);return await B.getWorkflowManager().getInitializationPromise(),B}throw new U("No workflow ID provided.")}getPreviewService(){var e;return(e=this.experienceOptions)==null?void 0:e.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new U("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new U("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}configureUrls(e,t,A){X.setHubUrl(e),X.setServerUrl(t),X.setServicesApiUrl(A),this.getIntegration()}storeCustomer(e){const t=Y.getMap("partnerCustomerIds")||new Map;t.set(e.partner.id,e.id),Y.setMap("partnerCustomerIds",t)}async getIntegrationProductById(e){var a,i;const n=(a=(await x.getShadowGraphqlClient().query({query:sn,variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data)==null?void 0:a.integrationProducts;if(!n||n.length===0||!((i=n[0])!=null&&i.id))throw new Error("Integration product not found.");return new ot(n[0])}async getIntegrationProductFromExternalIds(e,t){var i;const a=(i=(await x.getShadowGraphqlClient().query({query:rn,variables:{externalProductId:t,externalIntegrationId:e},fetchPolicy:"no-cache",errorPolicy:"all"})).data)==null?void 0:i.integrationProductFromExternalIds;if(!(a!=null&&a.id))throw new Error("Integration product not found.");return new ot(a)}async getIntegrationProduct(e){return e.type==="integration"?this.getIntegrationProductById(e.integrationProductId):this.getIntegrationProductFromExternalIds(e.externalIntegrationId,e.externalProductId)}async getShareActionsForTransaction(e){const A=(Y.getMap("transactionOwnerIds")||new Map).get(e)||void 0,n=await x.getShadowGraphqlClient().query({query:on,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e},context:{transactionOwnerId:A}});if(!n.data.transactions||n.data.transactions.length!==1)throw new Error(`Failed to fetch share actions for transaction: ${e}`);return n.data.transactions[0].transactionShareActions}}class _a{getClient(){return this.client??{}}setClient(e){this.client=e}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}async reset(){}updateStateWithServer(e){}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(e){}addPoller(e){}addConfirmCallback(e){}addEditedCallback(e){}addElementsCallback(e){}addInformationResultCallback(e){}addInitCallback(e){}addMakingAdjustmentsCallback(e){}addMandatoryCallback(e){}addMetadataCallback(e){}addSelectionCallback(e){}addStepSpecificStorageCallback(e,t){}addStorageCallback(e){}getCommandDispatcher(){return e=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getProfanities(){return[]}getRegionElements(e){return[]}getSerializedStep(e,t){}getStepSpecificServices(e){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(e){}markUpdateCompleted(e){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(e){}setEditedStatus(e,t){}setInformationResults(e){}setMandatoryFulfilled(e,t){}async setSelectionsAndElements(e,t,A){}toggleDesignConfirmed(){}updateMetadata(e,t){}async updateStorage(e,t){}injectIntoPreviewService(e){return Promise.resolve()}ejectFromPreviewService(){}setWorkflowStateSyncEnabled(e){}async updateTransactionShareActions(){}addValidationCallback(e){}setStepError(e,t,A){}getStepErrors(e){}getValidationErrors(){return{steps:new Map}}async updateTransactionStakeholders(){}}var SA=(c=>(c.SelectFrame="SelectFrame",c.SelectImage="SelectImage",c.Position="Position",c))(SA||{});class yA extends j{constructor(e,t){var A;super(e,t),this.frameService=(A=this.manager.getStepSpecificServices(this.getId()))==null?void 0:A.frameService}selectVariant(e){const t=this.manager.getRegionElements(this.step.stepName);return q.selectVariant(this.step,e.getResource(),t,this.manager,A=>this.setUpdateState(A))}onFrameDataChanged(e){this.frameService&&this.frameService.onFrameDataChanged(t=>{t&&e(t)})}async selectImage(e,t=!0,A=!0){var n;if(await q.selectImage(this.step,e,this.manager,A),t){const a=((n=this.manager.getStepStorage(this.step.stepName))==null?void 0:n.framePatternData)||{};this.manager.updateStorage(this.step.stepName,{framePatternData:{...a,originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,useOriginalAsset:void 0}})}}async canUseBackgroundRemover(){return this.manager.getClient().canUseAddon(Me.BackgroundRemover)}async canRemoveBackground(){var e,t,A,n;return await this.canUseBackgroundRemover()&&this.hasOriginalImageSelection()&&!!((t=(e=this.frameService)==null?void 0:e.getImageData())!=null&&t.src)&&!((n=(A=this.frameService)==null?void 0:A.getImageData())!=null&&n.svg)}async removeBackgroundFromImageSelection(e=!0){var a;if(!await this.canUseBackgroundRemover())throw new Error("The current Integration does not have access to the Background Remover. Please call canUseBackgroundRemover to ensure you disable this feature when appropriate.");const t=await this.getOriginalImageSelection();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const A=await G.removeBackgroundFromAsset(t);e&&await q.selectImage(this.step,A,this.manager,!1);const n=((a=this.manager.getStepStorage(this.step.stepName))==null?void 0:a.framePatternData)||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...n,backgroundRemovedAssetKey:A.key,useOriginalAsset:!e}}),A}changeColors(e){q.changeColors(this.step,this.manager,e)}getImageData(){if(this.frameService)return this.frameService.getImageData()}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?q.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}async getOriginalImageColors(){const e=this.getImageData();return e!=null&&e.svg?(await l.generateSVGWithUnknownColors(e.svg)).colors:void 0}getMaxAllowedColors(){return this.step.data.maxColors}getUniqueColorCount(){return q.getUniqueColorCount(this.step,this.manager)}getCurrentFrameStep(e,t,A,n){return n&&n.length>1&&e===void 0?"SelectFrame":t||A||this.getImageData()?"Position":"SelectImage"}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}getWhitelistedExtensions(){return[...this.step.data.whitelistedExtensions,...this.step.data.whitelistedExtensions.includes(".jpg")?[".jpeg"]:[]]}async getOriginalImageSelection(){var t,A;const e=(A=(t=this.manager.getStepStorage(this.step.stepName))==null?void 0:t.framePatternData)==null?void 0:A.originalAssetKey;if(e)return G.getLocalOrFromServer(e)}async getBackgroundRemovedImageSelection(){var t,A;const e=(A=(t=this.manager.getStepStorage(this.step.stepName))==null?void 0:t.framePatternData)==null?void 0:A.backgroundRemovedAssetKey;if(e)return G.getLocalOrFromServer(e)}hasOriginalImageSelection(){var e,t;return!!((t=(e=this.manager.getStepStorage(this.step.stepName))==null?void 0:e.framePatternData)!=null&&t.originalAssetKey)}hasBackgroundRemovedImageSelection(){var e,t;return!!((t=(e=this.getFrameStepStorage())==null?void 0:e.framePatternData)!=null&&t.backgroundRemovedAssetKey)}getUseOriginalImageSelection(){var e,t;return((t=(e=this.getFrameStepStorage())==null?void 0:e.framePatternData)==null?void 0:t.useOriginalAsset)??!1}async setUseOriginalImageSelection(e){var n;const t=((n=this.getFrameStepStorage())==null?void 0:n.framePatternData)||{};if(t.useOriginalAsset===e)return;const A=await this.getOriginalImageSelection();if(!A)throw new Error("You must provide an image selection before calling setUseOriginalImageSelection");if(e)await this.selectImage(A,!1,!1);else{const a=await this.getBackgroundRemovedImageSelection();if(!a)throw new Error("You must call removeBackgroundFromImageSelection before attempting to apply the image.");await this.selectImage(a,!1,!1)}this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:e}})}getFrameStepStorage(){return this.manager.getStepStorage(this.step.stepName)}}Object.defineProperty(E,"AspectType",{enumerable:!0,get:()=>l.AspectType}),Object.defineProperty(E,"AssetType",{enumerable:!0,get:()=>l.AssetType}),Object.defineProperty(E,"BringForwardCommand",{enumerable:!0,get:()=>l.BringForwardCommand}),Object.defineProperty(E,"BringToBackCommand",{enumerable:!0,get:()=>l.BringToBackCommand}),Object.defineProperty(E,"BringToFrontCommand",{enumerable:!0,get:()=>l.BringToFrontCommand}),Object.defineProperty(E,"CanvasCommand",{enumerable:!0,get:()=>l.CanvasCommand}),Object.defineProperty(E,"CommandContext",{enumerable:!0,get:()=>l.CommandContext}),Object.defineProperty(E,"CreateElementCommand",{enumerable:!0,get:()=>l.CreateElementCommand}),Object.defineProperty(E,"CreateLayoutCommand",{enumerable:!0,get:()=>l.CreateLayoutCommand}),Object.defineProperty(E,"DeleteElementCommand",{enumerable:!0,get:()=>l.DeleteElementCommand}),Object.defineProperty(E,"FontAlignmentCommand",{enumerable:!0,get:()=>l.FontAlignmentCommand}),Object.defineProperty(E,"FontColorCommand",{enumerable:!0,get:()=>l.FontColorCommand}),Object.defineProperty(E,"FontSizeCommand",{enumerable:!0,get:()=>l.FontSizeCommand}),Object.defineProperty(E,"FontSourceCommand",{enumerable:!0,get:()=>l.FontSourceCommand}),Object.defineProperty(E,"GroupCommand",{enumerable:!0,get:()=>l.GroupCommand}),Object.defineProperty(E,"LayoutElementFactory",{enumerable:!0,get:()=>l.LayoutElementFactory}),Object.defineProperty(E,"LayoutElementType",{enumerable:!0,get:()=>l.LayoutElementType}),Object.defineProperty(E,"MoveCommand",{enumerable:!0,get:()=>l.MoveCommand}),Object.defineProperty(E,"ResizeCommand",{enumerable:!0,get:()=>l.ResizeCommand}),Object.defineProperty(E,"RotateCommand",{enumerable:!0,get:()=>l.RotateCommand}),Object.defineProperty(E,"SendBackwardsCommand",{enumerable:!0,get:()=>l.SendBackwardsCommand}),Object.defineProperty(E,"StepAspectType",{enumerable:!0,get:()=>l.StepAspectType}),Object.defineProperty(E,"StepType",{enumerable:!0,get:()=>l.StepType}),Object.defineProperty(E,"TextChangeCommand",{enumerable:!0,get:()=>l.TextChangeCommand}),Object.defineProperty(E,"UnitOfMeasurement",{enumerable:!0,get:()=>l.UnitOfMeasurement}),Object.defineProperty(E,"UpdateImageSourceCommand",{enumerable:!0,get:()=>l.UpdateImageSourceCommand}),Object.defineProperty(E,"dataUrlFromExternalUrl",{enumerable:!0,get:()=>l.dataUrlFromExternalUrl}),Object.defineProperty(E,"determineCorrectFontSizeAndLines",{enumerable:!0,get:()=>l.determineCorrectFontSizeAndLines}),Object.defineProperty(E,"findElement",{enumerable:!0,get:()=>l.findElement}),Object.defineProperty(E,"frameDataCache",{enumerable:!0,get:()=>l.frameDataCache}),Object.defineProperty(E,"generate",{enumerable:!0,get:()=>l.generate}),Object.defineProperty(E,"generateSVGWithUnknownColors",{enumerable:!0,get:()=>l.generateSVGWithUnknownColors}),Object.defineProperty(E,"getAttributesFromArrayBuffer",{enumerable:!0,get:()=>l.getAttributesFromArrayBuffer}),Object.defineProperty(E,"getAxisAlignedBoundingBox",{enumerable:!0,get:()=>l.getAxisAlignedBoundingBox}),Object.defineProperty(E,"getFrameData",{enumerable:!0,get:()=>l.getFrameData}),Object.defineProperty(E,"getSvgElement",{enumerable:!0,get:()=>l.getSvgElement}),Object.defineProperty(E,"loadFont",{enumerable:!0,get:()=>l.loadFont}),Object.defineProperty(E,"patternImageDataCache",{enumerable:!0,get:()=>l.patternImageDataCache}),Object.defineProperty(E,"registerFetchImplementation",{enumerable:!0,get:()=>l.registerFetchImplementation}),Object.defineProperty(E,"registerWindowImplementation",{enumerable:!0,get:()=>l.registerWindowImplementation}),Object.defineProperty(E,"rehydrateSerializedLayout",{enumerable:!0,get:()=>l.rehydrateSerializedLayout}),Object.defineProperty(E,"setCanvasModule",{enumerable:!0,get:()=>l.setCanvasModule}),Object.defineProperty(E,"svgToDataUrl",{enumerable:!0,get:()=>l.svgToDataUrl}),E.AddonHandle=Me,E.ArrayInput=Ua,E.AssetNotFoundError=W,E.CollectionProduct=He,E.ColorOptionGlobalPropertyHandle=At,E.ConversionDataType=yt,E.ConversionLocation=St,E.DigitalContentStepHandle=sA,E.FileUploadGlobalPropertyHandle=hA,E.FlowExecutionNodeResult=fe,E.FlowExecutionResult=pA,E.FlowService=IA,E.FrameService=Ht,E.FrameStep=SA,E.FrameStepHandle=yA,E.GlobalPropertyHandle=Re,E.IllustrationStepHandle=_t,E.InformationMessageType=Qe,E.InformationStepHandle=oA,E.IntegrationProduct=ot,E.IntegrationType=Ft,E.LayoutNotFoundError=J,E.MaterialStepHandle=eA,E.MisconfigurationError=Be,E.MockWorkflowManager=_a,E.ModelStepHandle=tA,E.ModuleStepHandle=rA,E.ObjectInput=it,E.ObjectInputType=FA,E.OptionGlobalPropertyHandle=tt,E.OptionNotFoundError=le,E.ParseError=_,E.PictureStepHandle=AA,E.ProductCameraRig=Mt,E.ProductCollection=mA,E.ProductWorkflow=se,E.PromiseCache=te,E.PromiseQueue=Oe,E.QuestionStepHandle=nA,E.QueueablePromise=Te,E.ResourceNotFoundError=$,E.ShapeStepHandle=aA,E.SpiffCommerceClient=MA,E.StakeholderType=we,E.StepHandle=j,E.TextGlobalPropertyHandle=uA,E.TextInput=Ha,E.TextStepHandle=iA,E.TransactionShareActionType=pt,E.Transform=DA,E.TransformCollection=QA,E.UnhandledBehaviorError=k,E.Variant=V,E.WorkflowExperienceEventType=dA,E.WorkflowExperienceImpl=De,E.assetService=G,E.browserColorToHex=Tt,E.createDesign=BA,E.designService=Ne,E.digitalContentStepService=bt,E.findPmsColors=mn,E.frameStepService=q,E.generateCommands=CA,E.generateStateFromDesignInputSteps=Ba,E.getBoundedOffsets=Rt,E.getWorkflow=Ie,E.getWorkflows=st,E.graphQlManager=x,E.illustrationStepService=me,E.matchHexToPms=En,E.materialStepService=ze,E.modelStepService=je,E.moduleStepService=Lt,E.optionService=L,E.persistenceService=Y,E.pictureStepService=Ke,E.pmsToRgb=wn,E.questionStepService=Ve,E.rgbToPms=Jt,E.setBearerAuthenticationToken=UA,E.shapeStepService=oe,E.shortenUrl=Gt,E.spiffCoreConfiguration=X,E.stepAspectValuesToDesignInputSteps=la,E.textStepService=z,E.toast=zt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
3143
+ `,re=async c=>{var e;for(const t in c.layouts){const A=c.layouts[t].elements.filter(a=>a.type===l.LayoutElementType.Illustration);for(let a=0;a<A.length;++a){const i=A[a];i.src&&i.svg&&(i.cachedObjectURL=await l.svgObjectURL(i.svg))}const n=c.layouts[t].elements.filter(a=>a.type===l.LayoutElementType.Textbox);for(let a=0;a<n.length;++a){const i=n[a];(e=i.fontData)!=null&&e.assetUrl&&await l.loadFont(i.fontData.assetUrl)}}},qa=async(c,e)=>{var n;const t=await x.getShadowGraphqlClient().query({query:Ta(((n=e==null?void 0:e.assets)==null?void 0:n.metadata)||!1),errorPolicy:"all",fetchPolicy:"no-cache",variables:{ids:c}}),A=t.data.workflows;if(A===void 0||A.length!==c.length)throw new Error(`Unable to read workflows: ${t.errors??"Length mismatch in response"}`);return A.forEach(a=>{a.steps.forEach(i=>{var o,s,r;delete i.data.__typename,(o=i.option)!=null&&o.id&&((s=i.option.defaultVariant)!=null&&s.asset&&G.cacheAsset(i.option.defaultVariant.asset),i.option.colorProfile&&G.cacheAsset(i.option.colorProfile),(r=i.option.variants)==null||r.forEach(g=>{g.asset&&G.cacheAsset(g.asset),g.displayImage&&G.cacheAsset(g.displayImage),g.thumbnail&&G.cacheAsset(g.thumbnail),g.material&&G.cacheMaterial(g.material)}),te.set({id:i.option.id},Promise.resolve(i.option)))}),a.finalizeStepConfig||(a.finalizeStepConfig={}),a.finalizeStepConfig.termsMarkdown=a.partner.termsMarkdown}),A},Za=async(c,e)=>{const A=(await e).find(n=>n.id===c);if(!A)throw new Error(`Workflow not found: ${c}`);return A},st=async(c,e)=>{const t=c.map(o=>te.get({id:o,options:e})),A=c.filter((o,s)=>t[s]===void 0);if(A.length===0)return Promise.all(t);const n=qa(A,e),a=A.map(o=>te.set({id:o,options:e},Za(o,n))),i=t.filter(o=>o!==void 0);return await Promise.all(i.concat(a))},Ie=async(c,e)=>(await st([c],e))[0],$a=c=>c.sort((e,t)=>e.index-t.index).map(e=>({id:l.generate(),panelId:e.name,name:e.name,index:e.index,createdAt:new Date,updatedAt:new Date,transparentBackground:e.transparentBackground,height:e.height,width:e.width,previewRegion:e.previewRegion,useEditableArea:e.useEditableArea,editableArea:e.editableArea})),rt=(c,e)=>{const t=c.workflowState,A=t?JSON.parse(t):void 0;return A?Object.values(A.layouts).map(n=>n.layout):$a(e.panels)};class MA{constructor(e){this.activeIntegration=void 0,this.updateTransactionState=async t=>{try{return x.getShadowGraphqlClient().mutate({...t,mutation:An})}catch(A){throw console.error(A),new U("Critical - Unable to synchronize workflow state with server.")}},this.initialized=!1,this.options=e,this.options.applicationKey&&RA(this.options.applicationKey),console.debug("------------------------"),console.debug("Spiff Commerce Core SDK"),console.debug("Version: 22.2.0-beta.a6a7f1c4-e3e8-51ba-816d-b998f4e3f9a1"),console.debug(`Application Key Provided: ${!!this.options.applicationKey}`),console.debug("------------------------")}getAssetManager(){return G}getCurrencyCode(){if(this.currencyCode===void 0)throw new Error("No currency code set.");return this.currencyCode}getFlowService(){if(!HA())throw new Error("Application key required to use Flow Service.");return new IA}async getIntegration(){if(!this.options.applicationKey)throw new Error("Cannot get current Integration without specifying an Application Key.");if(this.activeIntegration)return this.activeIntegration;const e=async()=>(await x.getShadowGraphqlClient().query({query:La,errorPolicy:"all",fetchPolicy:"no-cache"})).data.currentIntegration;return this.activeIntegration=e(),this.activeIntegration}async canUseAddon(e){var t;try{return((t=(await this.getIntegration()).partner.activeAddons)==null?void 0:t.includes(e))??!1}catch(A){return console.error(A),!1}}async authenticateBundleFromLocalStorage(e){var n,a;const t=Y.getMap("bundleOwnerIds");if(t!=null&&t.has(e))return Promise.resolve({success:!0,stakeholderType:we.Owner});const A=Y.getMap("bundlePartnerIds")||new Map;if(A.has(e)){const i=A.get(e),s=(Y.getMap("partnerCustomerIds")||new Map).get(i);if(s&&await this.authenticateCustomerId(s)){const g=(a=(n=this.customer)==null?void 0:n.bundleStakeholders)==null?void 0:a.find(d=>{var B;return((B=d.bundle)==null?void 0:B.id)===e});if(g)return Promise.resolve({success:!0,stakeholderType:g.type})}}return Promise.resolve({success:!1})}async authenticateTransactionFromLocalStorage(e){var g,d,B,C,w,u;const t=x.getShadowGraphqlClient(),A=await t.query({query:Oa,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e}});if(!A.data.transactions||A.data.transactions.length===0)throw new Error(`Transaction not found: ${e}`);const n=A.data.transactions[0];if(!((d=(g=n.product)==null?void 0:g.partner)==null?void 0:d.id))throw new Error(`Unable to read transaction: ${e}`);if(n.isOrdered)return Promise.resolve({success:!1,transactionReadOnly:!0});const i=Y.getMap("transactionOwnerIds");if(i!=null&&i.has(e))return Promise.resolve({success:!0,stakeholderType:we.Owner});const o=Y.getMap("transactionCustomerIds");if(o!=null&&o.has(e)){const h=o.get(e);if(h&&await this.authenticateCustomerId(h)){const m=((C=(B=this.customer)==null?void 0:B.bundleStakeholders)==null?void 0:C.find(p=>{var f,I;return(I=(f=p.bundle)==null?void 0:f.transactions)==null?void 0:I.some(D=>D.id===e)}))||((u=(w=this.customer)==null?void 0:w.stakeholders)==null?void 0:u.find(p=>{var f;return((f=p.transaction)==null?void 0:f.id)===e}));if(m)return Promise.resolve({success:!0,stakeholderType:m.type})}}const r=(await t.query({query:za,errorPolicy:"all",variables:{id:n.workflowId}})).data.workflow;if(!r)throw new Error(`Unable to read workflow: ${n.workflowId}`);return Promise.resolve({success:!1,theme:r.overrideTheme,customLogoLink:n.customLogoLink})}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(e){const t=Y.getMap("transactionCustomerIds");t!=null&&t.has(e)&&(t.delete(e),Y.setMap("transactionCustomerIds",t))}getStakeholderTypeForTransaction(e){var A,n;const t=(n=(A=this.customer)==null?void 0:A.stakeholders)==null?void 0:n.find(a=>{var i;return((i=a.transaction)==null?void 0:i.id)===e});if(t)return t.type}async getOrCreateCustomer(e){var i;this.customer=void 0;const t=x.getShadowGraphqlClient(),n=(await t.query({query:ja,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!n.id){const s=(i=(await t.mutate({mutation:Ka,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:e}}})).data)==null?void 0:i.customerCreate;if(!s)throw new Error("Unable to create customer.");return this.storeCustomer(s),this.customer=s,{customer:s,isAuthenticated:!1}}this.storeCustomer(n);const a=await this.authenticateCustomerId(n.id);return{customer:this.customer||n,isAuthenticated:a}}async authenticateCustomerId(e){var o;const t=x.getShadowGraphqlClient(),A=Y.getMap("customerTokens");if(!(A!=null&&A.has(e)))return!1;const n=A.get(e);if(!n)return!1;const i=(o=(await t.mutate({mutation:Va,errorPolicy:"all",fetchPolicy:"no-cache",variables:{loginToken:n}})).data)==null?void 0:o.customerAuthenticate;return i?(this.storeCustomer(i),mt(n),this.customer=i,!0):!1}async generateVerificationCode(e){await x.getShadowGraphqlClient().mutate({mutation:Wa,variables:{emailAddress:e}})}async verifyCode(e,t){var a,i;const n=(a=(await x.getShadowGraphqlClient().mutate({mutation:Xa,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e,verificationCode:t}})).data)==null?void 0:a.customerVerifyCode;if(n!=null&&n.loginToken){if(!((i=n.partner)!=null&&i.id))throw new Error(`Unable to find customer: ${e}`);const o=Y.getMap("customerTokens")||new Map;return o.set(n.id,n.loginToken),Y.setMap("customerTokens",o),this.storeCustomer(n),mt(n.loginToken),this.customer={...n,loginToken:void 0},!0}return!1}async getNewBundle(e,t,A){var r,g,d;const a=(d=(await x.getShadowGraphqlClient().mutate({mutation:ua(((g=(r=A==null?void 0:A.graphql)==null?void 0:r.productCollection)==null?void 0:g.eagerFetchProducts)||!1),variables:{collectionId:e,initialMetadata:t?Object.entries(t).map((B,C)=>({key:B[0],value:B[1]})):void 0},fetchPolicy:"no-cache"})).data)==null?void 0:d.bundleCreate;if(!(a!=null&&a.id))throw new Error("Unable to create bundle");const i=Y.getMap("bundlePartnerIds")||new Map;i.set(a.id,a.partner.id),Y.setMap("bundlePartnerIds",i);const o=Y.getMap("bundleOwnerIds")||new Map;o.set(a.id,a.bundleOwnerId),Y.setMap("bundleOwnerIds",o);const s=new fA(this,a,void 0,void 0,a.bundleOwnerId);return await s.getInitializationPromise(),s}async getExistingBundle(e,t,A,n){var h,Q,m,p,f,I,D,F,S;const a=Y.getMap("bundleOwnerIds"),i=a==null?void 0:a.get(e),s=((h=Object.entries(localStorage).find(([y,N])=>y.startsWith("CognitoIdentityServiceProvider")&&y.endsWith("idToken")))==null?void 0:h[0])||"",r=localStorage.getItem(s),g={};r&&!_e(r)&&(g.Authorization=`Bearer ${r}`);const d={bundleOwnerId:i,...g,...(Q=n==null?void 0:n.graphql)==null?void 0:Q.additionalHeaders},B=await x.getShadowGraphqlClient().query({query:Ca(((p=(m=n==null?void 0:n.graphql)==null?void 0:m.productCollection)==null?void 0:p.eagerFetchProducts)||!1),variables:{id:e},fetchPolicy:"no-cache",context:{headers:d}});if(!((f=B.data)!=null&&f.bundles)||((I=B.data)==null?void 0:I.bundles.length)===0||!((D=B.data)!=null&&D.bundles[0]))throw new Error(`Unable to find bundle: ${e}`);const C=(F=B.data)==null?void 0:F.bundles[0],w=Y.getMap("bundlePartnerIds")||new Map;w.set(C.id,C.partner.id),Y.setMap("bundlePartnerIds",w);const u=new fA(this,C,t,A,i,{additionalHeaders:(S=n==null?void 0:n.graphql)==null?void 0:S.additionalHeaders});return await u.getInitializationPromise(),u}async getBundleStakeholders(){var a;if(!this.customer)throw new Error("Customer not authenticated.");const e=await x.getShadowGraphqlClient().query({query:Ea,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!((a=e.data)!=null&&a.customers)||e.data.customers.length===0)throw new Error("Unable to find customer.");const A=e.data.customers[0].bundleStakeholders||[],n=Y.getMap("bundlePartnerIds")||new Map;return A.forEach(i=>{var o,s;(o=i.bundle)!=null&&o.id&&((s=i.bundle.partner)!=null&&s.id)&&n.set(i.bundle.id,i.bundle.partner.id)}),Y.setMap("bundlePartnerIds",n),A}async getWorkflowExperience(e,t,A,n){var d,B,C,w,u;if(!n)return await this.getWorkflowExperienceDeprecated(e,t,A);const a=async()=>{var Q,m;const h=x.getShadowGraphqlClient();if(n.type==="transaction"){const{transactionId:p,readOnly:f}=n,I=await h.query({query:Se,variables:{ids:[p]},errorPolicy:"all",fetchPolicy:"no-cache"});if(!((Q=I.data)!=null&&Q.transactions)||I.data.transactions.length===0)throw new U("Existing transaction not found.");const D=(m=I.data)==null?void 0:m.transactions[0];if(!D.workflowId)throw new U("Existing transaction has no workflow ID.");const F=await Ie(D.workflowId);if(!D.product)throw new U("Failed to load transaction, product not available.");return{transaction:D,workflow:F,readOnly:f}}if(n.type==="integration"||n.type==="external"){const p=async()=>{const F=n.type==="integration"?{integrationProductId:n.integrationProductId}:{externalIntegrationId:n.externalIntegrationId,externalProductId:n.externalProductId},S=await h.mutate({mutation:Yt,variables:{...F,workflowId:n.workflowId,designName:n.designName,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!S.data||!S.data.transactionCreate)throw new U("Failed to create transaction!");const y=S.data.transactionCreate;if(!y.product)throw new U("Failed to create transaction, product not available.");return y},f=Ie(n.workflowId,n==null?void 0:n.graphql),[I,D]=await Promise.all([p(),f]);return{transaction:I,workflow:D}}throw new U("No workflow ID provided.")},{transaction:i,workflow:o,readOnly:s}=await a();this.currencyCode=(d=i.product.partner)==null?void 0:d.currencyCode;const r={product:i.product,transaction:i,layouts:[],singleVariantsRenderable:(B=n==null?void 0:n.workflowConfiguration)==null?void 0:B.singleVariantsRenderable,stateMutationFunc:s?async()=>{throw new k("State mutation is forbidden in read only mode!")}:async h=>{const m=(Y.getMap("transactionOwnerIds")||new Map).get(i.id)||void 0;return this.updateTransactionState({...h,context:{transactionOwnerId:m}})},readOnly:s,workflow:o};if(n.type==="transaction"&&i.workflowState){const h=JSON.parse(i.workflowState);r.layouts=Object.values(h.layouts).map(Q=>Q.layout),await l.rehydrateSerializedLayout(h),await re(h),r.reloadedState=h}else if(!s&&n.workflowState){const h=JSON.parse(n.workflowState);r.layouts=Object.values(h.layouts).map(Q=>Q.layout),await l.rehydrateSerializedLayout(h),await re(h),r.reloadedState=h}else r.layouts=rt(r.transaction,r.workflow);if(r.renderableContextService=new ve(r.layouts),n.previewService?(r.previewService=n.previewService,(C=r.product)!=null&&C.modelUrl&&(r.modelContainer=r.previewService.loadModel({model:r.product.modelUrl,contextService:r.renderableContextService}))):(r.previewService=A&&A(o),(w=r.product)!=null&&w.modelUrl&&(r.modelContainer=(u=r.previewService)==null?void 0:u.loadModel({model:r.product.modelUrl,contextService:r.renderableContextService}))),n.type!=="transaction"){const h=Y.getMap("transactionOwnerIds")||new Map;h.set(i.id,i.transactionOwnerId),Y.setMap("transactionOwnerIds",h)}else r.isReloadedTransaction=!0;this.initialized=!0,this.experienceOptions=r;const g=new De(this,r);return await g.getWorkflowManager().getInitializationPromise(),n.type!=="transaction"&&this.customer&&await g.attachCustomerDetails({email:this.customer.emailAddress}),g}async getWorkflowExperiences(e,t){if(e.length===0)throw new U("No options provided!");const A=x.getShadowGraphqlClient(),n=async I=>{var y,N;if(I.length===0)return[];const D=I.map(P=>P.option.transactionId),F=await A.query({query:Se,variables:{ids:D},errorPolicy:"all",fetchPolicy:"no-cache"}),S=F.data.transactions;if(S.length!==I.length){const P=((N=(y=F.errors)==null?void 0:y[0])==null?void 0:N.message)||"Unknown error";throw new U(`Not all transactions were found: ${P}`)}return S.map((P,v)=>{var R;return{transaction:P,workflowId:P.workflowId,readOnly:((R=I.find(T=>T.option.transactionId===P.id))==null?void 0:R.option.readOnly)??!1,index:I[v].index}})},a=async I=>{var S,y,N;if(I.length===0)return[];const D=await A.mutate({mutation:en,variables:{inputs:I.map(P=>({integrationProductId:P.option.type==="integration"?P.option.integrationProductId:void 0,externalIntegrationId:P.option.type==="external"?P.option.externalIntegrationId:void 0,externalProductId:P.option.type==="external"?P.option.externalProductId:void 0,workflowId:P.option.workflowId,designName:P.option.designName,claim:!0}))},errorPolicy:"all",fetchPolicy:"no-cache"}),F=(S=D.data)==null?void 0:S.transactionCreateMany;if(!F||F.length===0){const P=((N=(y=D.errors)==null?void 0:y[0])==null?void 0:N.message)||"Unknown error";throw new U(`Failed to create transactions: ${P}`)}return F.map((P,v)=>({transaction:P,workflowId:P.workflowId,readOnly:!1,index:I[v].index}))},i=e.map((I,D)=>({option:I,index:D})),o=i.filter(I=>I.option.type==="transaction"),s=i.filter(I=>I.option.type==="integration"||I.option.type==="external"),r=wt(o,10),g=wt(s,10),d=(await Promise.all([...r.map(n),...g.map(a)])).flat(),B=[...new Set(d.map(I=>I.workflowId))],C=await st(B,t),w=new Map(C.map(I=>[I.id,I])),u=Y.getMap("transactionOwnerIds")||new Map,h=d.map(async I=>{var T;const{transaction:D,workflowId:F,readOnly:S,index:y}=I,N=w.get(F),P=e[y];!u.get(D.id)&&D.transactionOwnerId&&u.set(D.id,D.transactionOwnerId);const v=u.get(D.id)||void 0,R={product:D.product,transaction:D,layouts:[],singleVariantsRenderable:(T=P==null?void 0:P.workflowConfiguration)==null?void 0:T.singleVariantsRenderable,stateMutationFunc:S?async()=>{throw new k("State mutation is forbidden in read only mode!")}:async b=>this.updateTransactionState({...b,context:{transactionOwnerId:v}}),readOnly:S,workflow:N,isReloadedTransaction:P.type==="transaction"};if(P.type==="transaction"&&D.workflowState){const b=JSON.parse(D.workflowState);R.layouts=Object.values(b.layouts||{}).map(K=>K.layout),await l.rehydrateSerializedLayout(b),await re(b),R.reloadedState=b}else if(!S&&P.workflowState){const b=JSON.parse(P.workflowState);R.layouts=Object.values(b.layouts||{}).map(K=>K.layout),await l.rehydrateSerializedLayout(b),await re(b),R.reloadedState=b}else R.layouts=rt(R.transaction,R.workflow);return R.renderableContextService=new ve(R.layouts),R.delayWorkflowStateSync=!0,this.initialized=!0,this.experienceOptions=R,{experienceOptions:R,index:y,options:P}});Y.setMap("transactionOwnerIds",u);const p=(await Promise.all(h)).sort((I,D)=>I.index-D.index).map(async I=>{const{experienceOptions:D,options:F}=I,S=new De(this,D);return await S.getWorkflowManager().getInitializationPromise(),F.type!=="transaction"&&this.customer&&await S.attachCustomerDetails({email:this.customer.emailAddress}),S}),f=await Promise.all(p);return f.forEach(I=>I.getWorkflowManager().setWorkflowStateSyncEnabled(!0)),f}async initFromIntegrationProduct(e){var i;if(e==="")throw new U("No integration product ID provided.");const A=await x.getShadowGraphqlClient().mutate({mutation:Yt,variables:{integrationProductId:e,claim:!0},errorPolicy:"all",fetchPolicy:"no-cache",context:this.options.applicationKey?{headers:{"X-Application-Key":this.options.applicationKey}}:void 0});if(!A.data||!A.data.transactionCreate)throw new U("Failed to create transaction!");const n=A.data.transactionCreate;if(!n.product)throw new U("Failed to create transaction, product not available.");this.currencyCode=(i=n.product.partner)==null?void 0:i.currencyCode;const a=Y.getMap("transactionOwnerIds")||new Map;a.set(n.id,n.transactionOwnerId),Y.setMap("transactionOwnerIds",a),this.experienceOptions={product:n.product,transaction:n,layouts:[],stateMutationFunc:async o=>this.updateTransactionState({...o,context:{transactionOwnerId:n.transactionOwnerId}})},this.initialized=!0}async initFromTransaction(e,t=!1){var o,s,r,g;if(e==="")throw new U("No transaction ID provided.");const A=x.getShadowGraphqlClient(),n=async()=>{var C,w;const B=(C=(await A.query({query:Se,variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data)==null?void 0:C.transactions[0];if(!B)throw new U("Failed to read transaction.");if(!B.product)throw new U("Failed to load transaction, product not available.");this.currencyCode=(w=B.product.partner)==null?void 0:w.currencyCode,this.experienceOptions={product:B.product,transaction:B,layouts:[],stateMutationFunc:async()=>{throw new k("State mutation is forbidden in read only mode!")},readOnly:t},this.initialized=!0};if(t)return await n();const a=Y.getMap("transactionOwnerIds")||new Map,i=a.get(e);if(i){const B=(o=(await A.query({query:Se,variables:{ids:[e]},errorPolicy:"all"})).data)==null?void 0:o.transactions[0];if(!B)throw new U("Failed to read transaction.");if(!B.product)throw new U("Failed to load transaction, product not available.");this.currencyCode=(s=B.product.partner)==null?void 0:s.currencyCode,this.experienceOptions={product:B.product,transaction:B,layouts:[],stateMutationFunc:async C=>this.updateTransactionState({...C,context:{transactionOwnerId:i}}),readOnly:t},this.initialized=!0;return}try{const B=(r=(await A.mutate({mutation:tn,variables:{id:e},errorPolicy:"all"})).data)==null?void 0:r.transactionClaim;if(!B)throw new U("Failed to read transaction.");if(!B.product)throw new U("Failed to load transaction, product not available.");this.currencyCode=(g=B.product.partner)==null?void 0:g.currencyCode,B.transactionOwnerId&&(a.set(B.id,B.transactionOwnerId),Y.setMap("transactionOwnerIds",a)),this.experienceOptions={product:B.product,transaction:B,layouts:[],stateMutationFunc:async C=>this.updateTransactionState({...C,context:{transactionOwnerId:B.transactionOwnerId}}),readOnly:t},this.initialized=!0}catch{throw new U("Attempted to access a transaction that isn't available.")}}async getWorkflowExperienceDeprecated(e,t,A){var n,a,i,o;if(!this.initialized||!this.experienceOptions)throw new U("Cannot launch experience: Not initialized.");if(this.experienceOptions.transaction.workflowId){const s=await Ie(this.experienceOptions.transaction.workflowId);if(this.experienceOptions.workflow=s,this.experienceOptions.transaction.workflowState){const g=JSON.parse(this.experienceOptions.transaction.workflowState);this.experienceOptions.layouts=Object.values(g.layouts).map(d=>d.layout),await l.rehydrateSerializedLayout(g),await re(g),this.experienceOptions.reloadedState=g}this.experienceOptions.previewService=A&&A(s),this.experienceOptions.renderableContextService=new ve(this.experienceOptions.layouts),(n=this.experienceOptions.product)!=null&&n.modelUrl&&(this.experienceOptions.modelContainer=(a=this.experienceOptions.previewService)==null?void 0:a.loadModel({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}));const r=new De(this,this.experienceOptions);return await r.getWorkflowManager().getInitializationPromise(),r}if(e){const r=(Y.getMap("transactionOwnerIds")||new Map).get(this.experienceOptions.transaction.id),g=x.getShadowGraphqlClient().mutate({mutation:nn,variables:{workflowId:e,id:this.experienceOptions.transaction.id},context:{transactionOwnerId:r}}),d=Ie(e);if(await Promise.all([g,d]),this.experienceOptions.workflow=await d,t){const C=JSON.parse(t);this.experienceOptions.layouts=Object.values(C.layouts).map(w=>w.layout),await l.rehydrateSerializedLayout(C),await re(C),this.experienceOptions.reloadedState=C}else this.experienceOptions.layouts=rt(this.experienceOptions.transaction,this.experienceOptions.workflow);this.experienceOptions.previewService=A&&A(await d),this.experienceOptions.renderableContextService=new ve(this.experienceOptions.layouts),(i=this.experienceOptions.product)!=null&&i.modelUrl&&(this.experienceOptions.modelContainer=(o=this.experienceOptions.previewService)==null?void 0:o.loadModel({model:this.experienceOptions.product.modelUrl,contextService:this.experienceOptions.renderableContextService}));const B=new De(this,this.experienceOptions);return await B.getWorkflowManager().getInitializationPromise(),B}throw new U("No workflow ID provided.")}getPreviewService(){var e;return(e=this.experienceOptions)==null?void 0:e.previewService}getProduct(){if(!this.initialized||!this.experienceOptions)throw new U("Cannot get product: Not initialized.");return this.experienceOptions.product}getTransaction(){if(!this.initialized||!this.experienceOptions)throw new U("Cannot get transaction: Not initialized.");return this.experienceOptions.transaction}configureUrls(e,t,A){X.setHubUrl(e),X.setServerUrl(t),X.setServicesApiUrl(A),this.getIntegration()}storeCustomer(e){const t=Y.getMap("partnerCustomerIds")||new Map;t.set(e.partner.id,e.id),Y.setMap("partnerCustomerIds",t)}async getIntegrationProductById(e){var a,i;const n=(a=(await x.getShadowGraphqlClient().query({query:sn,variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data)==null?void 0:a.integrationProducts;if(!n||n.length===0||!((i=n[0])!=null&&i.id))throw new Error("Integration product not found.");return new ot(n[0])}async getIntegrationProductFromExternalIds(e,t){var i;const a=(i=(await x.getShadowGraphqlClient().query({query:rn,variables:{externalProductId:t,externalIntegrationId:e},fetchPolicy:"no-cache",errorPolicy:"all"})).data)==null?void 0:i.integrationProductFromExternalIds;if(!(a!=null&&a.id))throw new Error("Integration product not found.");return new ot(a)}async getIntegrationProduct(e){return e.type==="integration"?this.getIntegrationProductById(e.integrationProductId):this.getIntegrationProductFromExternalIds(e.externalIntegrationId,e.externalProductId)}async getShareActionsForTransaction(e){const A=(Y.getMap("transactionOwnerIds")||new Map).get(e)||void 0,n=await x.getShadowGraphqlClient().query({query:on,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e},context:{transactionOwnerId:A}});if(!n.data.transactions||n.data.transactions.length!==1)throw new Error(`Failed to fetch share actions for transaction: ${e}`);return n.data.transactions[0].transactionShareActions}}class _a{getClient(){return this.client??{}}setClient(e){this.client=e}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}async reset(){}updateStateWithServer(e){}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(e){}addPoller(e){}addConfirmCallback(e){}addEditedCallback(e){}addElementsCallback(e){}addInformationResultCallback(e){}addInitCallback(e){}addMakingAdjustmentsCallback(e){}addMandatoryCallback(e){}addMetadataCallback(e){}addSelectionCallback(e){}addStepSpecificStorageCallback(e,t){}addStorageCallback(e){}getCommandDispatcher(){return e=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getProfanities(){return[]}getRegionElements(e){return[]}getSerializedStep(e,t){}getStepSpecificServices(e){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(e){}markUpdateCompleted(e){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}setCurrentAdjustingStepId(e){}setEditedStatus(e,t){}setInformationResults(e){}setMandatoryFulfilled(e,t){}async setSelectionsAndElements(e,t,A){}toggleDesignConfirmed(){}updateMetadata(e,t){}async updateStorage(e,t){}injectIntoPreviewService(e){return Promise.resolve()}ejectFromPreviewService(){}setWorkflowStateSyncEnabled(e){}async updateTransactionShareActions(){}addValidationCallback(e){}setStepError(e,t,A){}getStepErrors(e){}getValidationErrors(){return{steps:new Map}}async updateTransactionStakeholders(){}}var SA=(c=>(c.SelectFrame="SelectFrame",c.SelectImage="SelectImage",c.Position="Position",c))(SA||{});class yA extends j{constructor(e,t){var A;super(e,t),this.frameService=(A=this.manager.getStepSpecificServices(this.getId()))==null?void 0:A.frameService}selectVariant(e){const t=this.manager.getRegionElements(this.step.stepName);return q.selectVariant(this.step,e.getResource(),t,this.manager,A=>this.setUpdateState(A))}onFrameDataChanged(e){this.frameService&&this.frameService.onFrameDataChanged(t=>{t&&e(t)})}async selectImage(e,t=!0,A=!0){var n;if(await q.selectImage(this.step,e,this.manager,A),t){const a=((n=this.manager.getStepStorage(this.step.stepName))==null?void 0:n.framePatternData)||{};this.manager.updateStorage(this.step.stepName,{framePatternData:{...a,originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,useOriginalAsset:void 0}})}}async canUseBackgroundRemover(){return this.manager.getClient().canUseAddon(Me.BackgroundRemover)}async canRemoveBackground(){var e,t,A,n;return await this.canUseBackgroundRemover()&&this.hasOriginalImageSelection()&&!!((t=(e=this.frameService)==null?void 0:e.getImageData())!=null&&t.src)&&!((n=(A=this.frameService)==null?void 0:A.getImageData())!=null&&n.svg)}async removeBackgroundFromImageSelection(e=!0){var a;if(!await this.canUseBackgroundRemover())throw new Error("The current Integration does not have access to the Background Remover. Please call canUseBackgroundRemover to ensure you disable this feature when appropriate.");const t=await this.getOriginalImageSelection();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const A=await G.removeBackgroundFromAsset(t);e&&await q.selectImage(this.step,A,this.manager,!1);const n=((a=this.manager.getStepStorage(this.step.stepName))==null?void 0:a.framePatternData)||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...n,backgroundRemovedAssetKey:A.key,useOriginalAsset:!e}}),A}changeColors(e){q.changeColors(this.step,this.manager,e)}getImageData(){if(this.frameService)return this.frameService.getImageData()}async getColorOption(){return this.step.data.colorOption}getAvailableColors(){return this.step.data.colorPickerEnabled?q.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}async getOriginalImageColors(){const e=this.getImageData();return e!=null&&e.svg?(await l.generateSVGWithUnknownColors(e.svg)).colors:void 0}getMaxAllowedColors(){return this.step.data.maxColors}getUniqueColorCount(){return q.getUniqueColorCount(this.step,this.manager)}getCurrentFrameStep(e,t,A,n){return n&&n.length>1&&e===void 0?"SelectFrame":t||A||this.getImageData()?"Position":"SelectImage"}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}getWhitelistedExtensions(){return[...this.step.data.whitelistedExtensions,...this.step.data.whitelistedExtensions.includes(".jpg")?[".jpeg"]:[]]}async getOriginalImageSelection(){var t,A;const e=(A=(t=this.manager.getStepStorage(this.step.stepName))==null?void 0:t.framePatternData)==null?void 0:A.originalAssetKey;if(e)return G.getLocalOrFromServer(e)}async getBackgroundRemovedImageSelection(){var t,A;const e=(A=(t=this.manager.getStepStorage(this.step.stepName))==null?void 0:t.framePatternData)==null?void 0:A.backgroundRemovedAssetKey;if(e)return G.getLocalOrFromServer(e)}hasOriginalImageSelection(){var e,t;return!!((t=(e=this.manager.getStepStorage(this.step.stepName))==null?void 0:e.framePatternData)!=null&&t.originalAssetKey)}hasBackgroundRemovedImageSelection(){var e,t;return!!((t=(e=this.getFrameStepStorage())==null?void 0:e.framePatternData)!=null&&t.backgroundRemovedAssetKey)}getUseOriginalImageSelection(){var e,t;return((t=(e=this.getFrameStepStorage())==null?void 0:e.framePatternData)==null?void 0:t.useOriginalAsset)??!1}async setUseOriginalImageSelection(e){var n;const t=((n=this.getFrameStepStorage())==null?void 0:n.framePatternData)||{};if(t.useOriginalAsset===e)return;const A=await this.getOriginalImageSelection();if(!A)throw new Error("You must provide an image selection before calling setUseOriginalImageSelection");if(e)await this.selectImage(A,!1,!1);else{const a=await this.getBackgroundRemovedImageSelection();if(!a)throw new Error("You must call removeBackgroundFromImageSelection before attempting to apply the image.");await this.selectImage(a,!1,!1)}this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:e}})}getFrameStepStorage(){return this.manager.getStepStorage(this.step.stepName)}}Object.defineProperty(E,"AspectType",{enumerable:!0,get:()=>l.AspectType}),Object.defineProperty(E,"AssetType",{enumerable:!0,get:()=>l.AssetType}),Object.defineProperty(E,"BringForwardCommand",{enumerable:!0,get:()=>l.BringForwardCommand}),Object.defineProperty(E,"BringToBackCommand",{enumerable:!0,get:()=>l.BringToBackCommand}),Object.defineProperty(E,"BringToFrontCommand",{enumerable:!0,get:()=>l.BringToFrontCommand}),Object.defineProperty(E,"CanvasCommand",{enumerable:!0,get:()=>l.CanvasCommand}),Object.defineProperty(E,"CommandContext",{enumerable:!0,get:()=>l.CommandContext}),Object.defineProperty(E,"CreateElementCommand",{enumerable:!0,get:()=>l.CreateElementCommand}),Object.defineProperty(E,"CreateLayoutCommand",{enumerable:!0,get:()=>l.CreateLayoutCommand}),Object.defineProperty(E,"DeleteElementCommand",{enumerable:!0,get:()=>l.DeleteElementCommand}),Object.defineProperty(E,"FontAlignmentCommand",{enumerable:!0,get:()=>l.FontAlignmentCommand}),Object.defineProperty(E,"FontColorCommand",{enumerable:!0,get:()=>l.FontColorCommand}),Object.defineProperty(E,"FontSizeCommand",{enumerable:!0,get:()=>l.FontSizeCommand}),Object.defineProperty(E,"FontSourceCommand",{enumerable:!0,get:()=>l.FontSourceCommand}),Object.defineProperty(E,"GroupCommand",{enumerable:!0,get:()=>l.GroupCommand}),Object.defineProperty(E,"LayoutElementFactory",{enumerable:!0,get:()=>l.LayoutElementFactory}),Object.defineProperty(E,"LayoutElementType",{enumerable:!0,get:()=>l.LayoutElementType}),Object.defineProperty(E,"MoveCommand",{enumerable:!0,get:()=>l.MoveCommand}),Object.defineProperty(E,"ResizeCommand",{enumerable:!0,get:()=>l.ResizeCommand}),Object.defineProperty(E,"RotateCommand",{enumerable:!0,get:()=>l.RotateCommand}),Object.defineProperty(E,"SendBackwardsCommand",{enumerable:!0,get:()=>l.SendBackwardsCommand}),Object.defineProperty(E,"StepAspectType",{enumerable:!0,get:()=>l.StepAspectType}),Object.defineProperty(E,"StepType",{enumerable:!0,get:()=>l.StepType}),Object.defineProperty(E,"TextChangeCommand",{enumerable:!0,get:()=>l.TextChangeCommand}),Object.defineProperty(E,"UnitOfMeasurement",{enumerable:!0,get:()=>l.UnitOfMeasurement}),Object.defineProperty(E,"UpdateImageSourceCommand",{enumerable:!0,get:()=>l.UpdateImageSourceCommand}),Object.defineProperty(E,"dataUrlFromExternalUrl",{enumerable:!0,get:()=>l.dataUrlFromExternalUrl}),Object.defineProperty(E,"determineCorrectFontSizeAndLines",{enumerable:!0,get:()=>l.determineCorrectFontSizeAndLines}),Object.defineProperty(E,"findElement",{enumerable:!0,get:()=>l.findElement}),Object.defineProperty(E,"frameDataCache",{enumerable:!0,get:()=>l.frameDataCache}),Object.defineProperty(E,"generate",{enumerable:!0,get:()=>l.generate}),Object.defineProperty(E,"generateSVGWithUnknownColors",{enumerable:!0,get:()=>l.generateSVGWithUnknownColors}),Object.defineProperty(E,"getAttributesFromArrayBuffer",{enumerable:!0,get:()=>l.getAttributesFromArrayBuffer}),Object.defineProperty(E,"getAxisAlignedBoundingBox",{enumerable:!0,get:()=>l.getAxisAlignedBoundingBox}),Object.defineProperty(E,"getFrameData",{enumerable:!0,get:()=>l.getFrameData}),Object.defineProperty(E,"getSvgElement",{enumerable:!0,get:()=>l.getSvgElement}),Object.defineProperty(E,"loadFont",{enumerable:!0,get:()=>l.loadFont}),Object.defineProperty(E,"patternImageDataCache",{enumerable:!0,get:()=>l.patternImageDataCache}),Object.defineProperty(E,"registerFetchImplementation",{enumerable:!0,get:()=>l.registerFetchImplementation}),Object.defineProperty(E,"registerWindowImplementation",{enumerable:!0,get:()=>l.registerWindowImplementation}),Object.defineProperty(E,"rehydrateSerializedLayout",{enumerable:!0,get:()=>l.rehydrateSerializedLayout}),Object.defineProperty(E,"setCanvasModule",{enumerable:!0,get:()=>l.setCanvasModule}),Object.defineProperty(E,"svgToDataUrl",{enumerable:!0,get:()=>l.svgToDataUrl}),E.AddonHandle=Me,E.ArrayInput=Ua,E.AssetNotFoundError=W,E.CollectionProduct=He,E.ColorOptionGlobalPropertyHandle=At,E.ConversionDataType=yt,E.ConversionLocation=St,E.DigitalContentStepHandle=sA,E.FileUploadGlobalPropertyHandle=hA,E.FlowExecutionNodeResult=fe,E.FlowExecutionResult=pA,E.FlowService=IA,E.FrameService=Ht,E.FrameStep=SA,E.FrameStepHandle=yA,E.GlobalPropertyHandle=Re,E.IllustrationStepHandle=_t,E.InformationMessageType=Qe,E.InformationStepHandle=oA,E.IntegrationProduct=ot,E.IntegrationType=Ft,E.LayoutNotFoundError=J,E.MaterialStepHandle=eA,E.MisconfigurationError=Be,E.MockWorkflowManager=_a,E.ModelStepHandle=tA,E.ModuleStepHandle=rA,E.ObjectInput=it,E.ObjectInputType=FA,E.OptionGlobalPropertyHandle=tt,E.OptionNotFoundError=le,E.ParseError=_,E.PictureStepHandle=AA,E.ProductCameraRig=Mt,E.ProductCollection=mA,E.ProductWorkflow=se,E.PromiseCache=te,E.PromiseQueue=Oe,E.QuestionStepHandle=nA,E.QueueablePromise=Te,E.ResourceNotFoundError=$,E.ShapeStepHandle=aA,E.SpiffCommerceClient=MA,E.StakeholderType=we,E.StepHandle=j,E.TextGlobalPropertyHandle=uA,E.TextInput=Ha,E.TextStepHandle=iA,E.TransactionShareActionType=pt,E.Transform=DA,E.TransformCollection=QA,E.UnhandledBehaviorError=k,E.Variant=V,E.WorkflowExperienceEventType=dA,E.WorkflowExperienceImpl=De,E.assetService=G,E.browserColorToHex=Tt,E.createDesign=BA,E.designService=Ne,E.digitalContentStepService=bt,E.findPmsColors=mn,E.frameStepService=q,E.generateCommands=CA,E.generateStateFromDesignInputSteps=Ba,E.getBoundedOffsets=Rt,E.getWorkflow=Ie,E.getWorkflows=st,E.graphQlManager=x,E.illustrationStepService=me,E.matchHexToPms=En,E.materialStepService=ze,E.modelStepService=je,E.moduleStepService=Lt,E.optionService=L,E.persistenceService=Y,E.pictureStepService=Ke,E.pmsToRgb=wn,E.questionStepService=Ve,E.rgbToPms=Jt,E.setBearerAuthenticationToken=UA,E.shapeStepService=oe,E.shortenUrl=Gt,E.spiffCoreConfiguration=X,E.stepAspectValuesToDesignInputSteps=la,E.textStepService=z,E.toast=zt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "22.2.0",
3
+ "version": "22.2.1",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.umd.cjs",