@spiffcommerce/core 17.5.1-0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1428,6 +1428,13 @@ interface WorkflowExperience {
1428
1428
  * A convenience function returning the sum of the selection and base price values.
1429
1429
  */
1430
1430
  getTotalPriceSubunits(): number;
1431
+ /**
1432
+ * Takes selections made by the user in another workflow and applies them to this workflow. For
1433
+ * selections to be copied they must both have a matching global property configuration.
1434
+ * @param experience The experience to take selections from.
1435
+ * @param filter A list of steps to apply the selections to. If undefined all steps will be updated.
1436
+ */
1437
+ copySelectionsViaGlobalConfiguration(bundle: Bundle, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1431
1438
  /**
1432
1439
  * Attach specific details about the customer to the experience. This is useful for things like retargeting. Currently only
1433
1440
  * email is supported. From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
@@ -1504,6 +1511,7 @@ declare class WorkflowExperienceImpl implements WorkflowExperience {
1504
1511
  getSelectionPriceSubunits(): number;
1505
1512
  getBasePriceSubunits(): number;
1506
1513
  getTotalPriceSubunits(): number;
1514
+ copySelectionsViaGlobalConfiguration(bundle: Bundle, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1507
1515
  getStepByName(name: string): TextStepHandle | FrameStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
1508
1516
  getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1509
1517
  getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createHttpLink as rt, InMemoryCache as ct, ApolloClient as gt, from as lt, gql as y } from "@apollo/client/core";
2
2
  import { fetch as XA, getAttributesFromArrayBuffer as Ie, AssetType as oe, StepType as f, getFrameData as qA, frameDataCache as Bt, GroupCommand as R, UpdateFramePattern as pe, UpdateFrameThresholdSettingsCommand as wt, calculateOffsets as ZA, LayoutElementType as U, generate as k, CreateElementCommand as b, generateSVGWithUnknownColors as De, svgObjectURL as IA, fetchAsString as q, DeleteElementCommand as Z, generateDefaultRectangleFrameSvg as re, GetSVGDimensions as dt, patternImageDataCache as ce, fetchAsArrayBuffer as Et, findElement as pA, modifySVGWithElementProperties as ht, IllustrationColorCommand as OA, IllustrationCacheCommand as Ct, getFontMetrics as Qt, getPatternImageData as TA, FontAlignmentCommand as ut, FontColorCommand as mt, FontImageFillCommand as vA, applyTextTransformations as zA, determineCorrectFontSizeAndLines as QA, FontSourceCommand as ge, loadFont as $A, TextChangeCommand as It, FontSizeCommand as pt, createElementNS as Dt, createElement as gA, _loadFontExternalDataURL as _A, UpdateWorkflowStateCommand as le, CommandContext as ft, createCanvas as DA, getSvgElement as fe, LayoutRenderingPurpose as Fe, renderPapyrusComponentAsString as Me, loadImage as ye, getDomParser as Ye, toBase64 as Be, getVariant as Ft, generateFrameSVG as Mt, getDefaultVariant as NA, domParser as Se, sanitizeSvgTree as xe, traverse as yt, xmlSerializer as Ne, CreateLayoutCommand as Yt, AspectType as uA, rehydrateSerializedLayout as _ } from "@spiffcommerce/papyrus";
3
- import { AssetType as Ns, BringForwardCommand as Hs, BringToBackCommand as Ps, BringToFrontCommand as Rs, CanvasCommand as Us, CommandContext as Gs, CreateElementCommand as vs, CreateLayoutCommand as ks, DeleteElementCommand as Js, FontAlignmentCommand as bs, FontColorCommand as Ls, FontSizeCommand as Os, FontSourceCommand as Ts, GroupCommand as zs, LayoutElementFactory as Ks, LayoutElementType as js, MoveCommand as Vs, ResizeCommand as Ws, RotateCommand as Xs, SendBackwardsCommand as qs, StepAspectType as Zs, StepType as $s, TextChangeCommand as _s, UnitOfMeasurement as Ai, dataUrlFromExternalUrl as ei, determineCorrectFontSizeAndLines as ti, findElement as ai, frameDataCache as ni, generate as si, generateSVGWithUnknownColors as ii, getAttributesFromArrayBuffer as oi, getAxisAlignedBoundingBox as ri, getFrameData as ci, getSvgElement as gi, loadFont as li, patternImageDataCache as Bi, registerFetchImplementation as wi, registerWindowImplementation as di, rehydrateSerializedLayout as Ei, setCanvasModule as hi } from "@spiffcommerce/papyrus";
3
+ import { AssetType as Ns, BringForwardCommand as Ps, BringToBackCommand as Hs, BringToFrontCommand as Rs, CanvasCommand as Us, CommandContext as Gs, CreateElementCommand as vs, CreateLayoutCommand as ks, DeleteElementCommand as Js, FontAlignmentCommand as bs, FontColorCommand as Ls, FontSizeCommand as Os, FontSourceCommand as Ts, GroupCommand as zs, LayoutElementFactory as Ks, LayoutElementType as js, MoveCommand as Vs, ResizeCommand as Ws, RotateCommand as Xs, SendBackwardsCommand as qs, StepAspectType as Zs, StepType as $s, TextChangeCommand as _s, UnitOfMeasurement as Ai, dataUrlFromExternalUrl as ei, determineCorrectFontSizeAndLines as ti, findElement as ai, frameDataCache as ni, generate as si, generateSVGWithUnknownColors as ii, getAttributesFromArrayBuffer as oi, getAxisAlignedBoundingBox as ri, getFrameData as ci, getSvgElement as gi, loadFont as li, patternImageDataCache as Bi, registerFetchImplementation as wi, registerWindowImplementation as di, rehydrateSerializedLayout as Ei, setCanvasModule as hi } from "@spiffcommerce/papyrus";
4
4
  import { setContext as St } from "@apollo/client/link/context";
5
5
  import { onError as xt } from "@apollo/client/link/error";
6
- import { Pith as He } from "pith";
7
- import Pe from "lodash.debounce";
6
+ import { Pith as Pe } from "pith";
7
+ import He from "lodash.debounce";
8
8
  import Re from "lodash.isequal";
9
- import HA from "lodash.clonedeep";
9
+ import PA from "lodash.clonedeep";
10
10
  import { toString as Ue } from "qrcode";
11
11
  import { split as KA } from "unicode-default-word-boundary";
12
12
  import Ae from "svg-path-bbox";
@@ -45,27 +45,27 @@ class FA extends cA {
45
45
  super(`Workflow Misconfiguration: ${A.stepName} - ${e}`), this.step = A;
46
46
  }
47
47
  }
48
- class PA extends Ge {
48
+ class HA extends Ge {
49
49
  constructor(A) {
50
50
  super(`ImplementationError - ${A}`);
51
51
  }
52
52
  }
53
- class v extends PA {
53
+ class v extends HA {
54
54
  constructor(A) {
55
55
  super(`Unhandled Behavior Encountered: ${A}`);
56
56
  }
57
57
  }
58
- class sA extends PA {
58
+ class sA extends HA {
59
59
  constructor(A) {
60
60
  super(`Parsing Error: ${A}`);
61
61
  }
62
62
  }
63
- class P extends PA {
63
+ class H extends HA {
64
64
  constructor(A) {
65
65
  super(`Client Error: ${A}`);
66
66
  }
67
67
  }
68
- class RA extends PA {
68
+ class RA extends HA {
69
69
  constructor(A) {
70
70
  super(`Resource Generation Failed: ${A}`);
71
71
  }
@@ -113,14 +113,14 @@ class we {
113
113
  this.set(A, t);
114
114
  }
115
115
  }
116
- const Ht = () => {
116
+ const Pt = () => {
117
117
  try {
118
118
  return localStorage ? new Nt() : new we();
119
119
  } catch {
120
120
  return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."), new we();
121
121
  }
122
- }, x = Ht();
123
- class Pt {
122
+ }, x = Pt();
123
+ class Ht {
124
124
  constructor() {
125
125
  this.defaultServerUrl = "https://api.spiff.com.au", this.defaultServicesApiUrl = "https://services.spiff.com.au", this.defaultHubUrl = "https://hub.spiff.com.au", this.serverUrl = this.defaultServerUrl, this.servicesApiUrl = this.defaultServicesApiUrl, this.hubUrl = this.defaultHubUrl, this.serverUrlCallbacks = [];
126
126
  }
@@ -146,7 +146,7 @@ class Pt {
146
146
  this.serverUrlCallbacks.push(A);
147
147
  }
148
148
  }
149
- const MA = new Pt();
149
+ const MA = new Ht();
150
150
  let ve;
151
151
  const de = (c) => {
152
152
  ve = c;
@@ -1211,7 +1211,7 @@ function BA(c, A, e) {
1211
1211
  }
1212
1212
  class ga {
1213
1213
  constructor(A) {
1214
- this.minZoomScale = [0.03], this.maxZoomScale = [20], this._debouncedUpdateFrameOffsets = Pe(this.updateFrameOffsets, 200), this.targetElements = [], this.onFrameDataChangeListeners = [], this.onZoomChangeListeners = [], this.forceImageCover = A, this.thresholdSettings = { useThreshold: !1, invertThreshold: !1, threshold: 128, thresholdSaturation: 0.5 };
1214
+ this.minZoomScale = [0.03], this.maxZoomScale = [20], this._debouncedUpdateFrameOffsets = He(this.updateFrameOffsets, 200), this.targetElements = [], this.onFrameDataChangeListeners = [], this.onZoomChangeListeners = [], this.forceImageCover = A, this.thresholdSettings = { useThreshold: !1, invertThreshold: !1, threshold: 128, thresholdSaturation: 0.5 };
1215
1215
  }
1216
1216
  /**
1217
1217
  * When we want to connect a workflow manager to the state of the image cropper we
@@ -4492,14 +4492,14 @@ IfnI8vaNAAAAAElFTkSuQmCC" transform="matrix(0.13 0.0141 -0.0141 0.1301 104.926 1
4492
4492
  </g>
4493
4493
  </svg>
4494
4494
 
4495
- `, H = (c) => Dt("http://www.w3.org/2000/svg", c), ae = (c, A) => {
4496
- const e = H("rect");
4495
+ `, P = (c) => Dt("http://www.w3.org/2000/svg", c), ae = (c, A) => {
4496
+ const e = P("rect");
4497
4497
  return e.setAttribute("height", `${c}`), e.setAttribute("width", `${A}`), e;
4498
4498
  }, Sa = () => {
4499
- const c = H("svg");
4499
+ const c = P("svg");
4500
4500
  return c.setAttribute("xmlns", "http://www.w3.org/2000/svg"), c.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), c.setAttribute("version", "1.1"), c;
4501
4501
  }, xa = (c) => {
4502
- const A = H("use");
4502
+ const A = P("use");
4503
4503
  return A.setAttribute("xlink:href", c), A.setAttribute("href", c), A;
4504
4504
  };
4505
4505
  function Xe(c) {
@@ -4507,7 +4507,7 @@ function Xe(c) {
4507
4507
  return A.setAttribute("height", `${a}`), A.setAttribute("width", `${t}`), [A, a, t];
4508
4508
  }
4509
4509
  const Na = (c, A, e) => {
4510
- const t = H("g");
4510
+ const t = P("g");
4511
4511
  c.appendChild(t), t.setAttribute("id", e), t.innerHTML = A;
4512
4512
  };
4513
4513
  function qe(c, A, e) {
@@ -4536,10 +4536,10 @@ function ne(c, A, e, t, a, n) {
4536
4536
  };
4537
4537
  if (o.width <= 0)
4538
4538
  return;
4539
- const r = Ha(o.height, o.width, e * s, t * i), g = (t - r * o.width) / 2 - r * o.x, B = (e - r * o.height) / 2 - r * o.y;
4539
+ const r = Pa(o.height, o.width, e * s, t * i), g = (t - r * o.width) / 2 - r * o.x, B = (e - r * o.height) / 2 - r * o.y;
4540
4540
  c.setAttribute("transform", `translate(${g} ${B}) scale(${r} ${r})`);
4541
4541
  }
4542
- function Ha(c, A, e, t) {
4542
+ function Pa(c, A, e, t) {
4543
4543
  const a = e / c, n = t / A;
4544
4544
  return a > 1 && n > 1 ? Math.min(a, n) : a > 1 && n < 1 ? n : a < 1 && n > 1 ? a : Math.min(a, n);
4545
4545
  }
@@ -4653,7 +4653,7 @@ class se {
4653
4653
  }
4654
4654
  }
4655
4655
  }
4656
- class Pa extends te {
4656
+ class Ha extends te {
4657
4657
  constructor() {
4658
4658
  super(...arguments), this.moduleName = "Favourites";
4659
4659
  }
@@ -4669,26 +4669,26 @@ class Pa extends te {
4669
4669
  }
4670
4670
  brandSvg(A, e) {
4671
4671
  const t = A.toSVG(2), a = A.getBoundingBox(), n = a.x2 - a.x1, s = A.toPathData(3), i = () => {
4672
- const D = H("g"), p = H("defs");
4672
+ const D = P("g"), p = P("defs");
4673
4673
  D.appendChild(p), p.appendChild(Ze(3, 7, 4, "shadow"));
4674
- const m = H("g");
4674
+ const m = P("g");
4675
4675
  D.appendChild(m), m.setAttribute("filter", "url(#shadow)"), m.innerHTML = t;
4676
- const F = H("g");
4676
+ const F = P("g");
4677
4677
  D.appendChild(F), F.setAttribute("fill", "red"), F.setAttribute("stroke", "red"), F.setAttribute("stroke-width", "9"), F.innerHTML = t;
4678
- const Y = H("g");
4678
+ const Y = P("g");
4679
4679
  D.appendChild(Y), Y.setAttribute("fill", "#9d2621"), Y.setAttribute("transform", "translate(1,1)"), Y.innerHTML = t;
4680
- const M = H("g");
4680
+ const M = P("g");
4681
4681
  return D.appendChild(M), M.setAttribute("fill", "yellow"), M.innerHTML = t, new se(D).transform(([S, J]) => [S, J + (n / 2 - S) ** 2 / (n * 2.9)]), D;
4682
4682
  }, [o, r, g] = Xe(e);
4683
4683
  if (!o)
4684
4684
  return "";
4685
- const B = H("defs");
4685
+ const B = P("defs");
4686
4686
  o.appendChild(B), qe(o, B, e);
4687
- const l = r * 0.23, w = g * 0.94, d = g * 0.04, C = r * 0.53, E = H("g");
4687
+ const l = r * 0.23, w = g * 0.94, d = g * 0.04, C = r * 0.53, E = P("g");
4688
4688
  o.appendChild(E), E.setAttribute("transform", `translate(${d} ${C}) rotate(-21)`);
4689
4689
  const Q = ae(l, w);
4690
4690
  Q.setAttribute("opacity", "0"), E.appendChild(Q);
4691
- const h = H("g");
4691
+ const h = P("g");
4692
4692
  E.appendChild(h);
4693
4693
  const I = i();
4694
4694
  h.appendChild(I);
@@ -4713,11 +4713,11 @@ class Ua extends te {
4713
4713
  }
4714
4714
  brandSvg(A, e, t) {
4715
4715
  const a = A.toSVG(2), n = A.getBoundingBox(), s = n.y2 - n.y1, i = n.x2 - n.x1, o = A.toPathData(3), r = () => {
4716
- const m = H("g"), F = H("g");
4716
+ const m = P("g"), F = P("g");
4717
4717
  m.appendChild(F), F.setAttribute("stroke", "#5C1A0D"), F.setAttribute("stroke-width", "4"), F.setAttribute("transform", "translate(1,1)"), F.innerHTML = a;
4718
- const Y = H("g");
4718
+ const Y = P("g");
4719
4719
  m.appendChild(Y), Y.setAttribute("fill", "#FFE386"), Y.setAttribute("transform", "translate(1,1)"), Y.innerHTML = a;
4720
- const M = H("g");
4720
+ const M = P("g");
4721
4721
  m.appendChild(M), M.setAttribute("fill", "white"), M.innerHTML = a;
4722
4722
  const G = new se(m);
4723
4723
  return G.transform(([S, J]) => [S, J + ((i - S) * J) ** 2 / (i * 5e4)]), G.transform(([S, J]) => [
@@ -4727,15 +4727,15 @@ class Ua extends te {
4727
4727
  }, [g, B, l] = Xe(e);
4728
4728
  if (!g)
4729
4729
  return "";
4730
- const w = H("defs");
4730
+ const w = P("defs");
4731
4731
  g.appendChild(w), qe(g, w, e);
4732
4732
  let d, C, E, Q;
4733
4733
  t ? (d = B * 0.25 * (1 + 0.1), C = l / 2 * (1 + 0.1), E = l * 0.22, Q = B * 0.32) : (d = B * 0.22 * (1 + 0.1), C = l * 0.8, E = l * 0.067, Q = B * 0.33);
4734
- const h = H("g");
4734
+ const h = P("g");
4735
4735
  g.appendChild(h), h.setAttribute("transform", `translate(${E} ${Q}) rotate(-10)`);
4736
4736
  const I = ae(d, C);
4737
4737
  I.setAttribute("opacity", "0"), h.appendChild(I);
4738
- const u = H("g");
4738
+ const u = P("g");
4739
4739
  h.appendChild(u);
4740
4740
  const D = r();
4741
4741
  u.appendChild(D);
@@ -4757,29 +4757,29 @@ class va extends te {
4757
4757
  }
4758
4758
  svgElement(A, e) {
4759
4759
  const t = _A(Ga), n = A !== "" ? ((I) => I.charAt(0).toUpperCase() + I.substr(1).toLowerCase())(A) : "", s = t.getPath(n, 0, 72, 72), i = s.toSVG(2), o = s.getBoundingBox(), r = o.x2 - o.x1, g = s.toPathData(3), B = () => {
4760
- const I = H("g");
4760
+ const I = P("g");
4761
4761
  I.classList.add("module-text-group");
4762
- const u = H("defs");
4762
+ const u = P("defs");
4763
4763
  I.appendChild(u), u.appendChild(Ze(0, 2, 2, "shadow"));
4764
- const D = H("path");
4764
+ const D = P("path");
4765
4765
  D.setAttribute("d", g), D.setAttribute("stroke", "black"), D.setAttribute("stroke-width", "3"), u.appendChild(D);
4766
- const p = H("g");
4766
+ const p = P("g");
4767
4767
  p.classList.add("module-layer0"), I.appendChild(p), p.setAttribute("filter", "url(#shadow)"), p.innerHTML = D.outerHTML;
4768
- const m = H("g");
4768
+ const m = P("g");
4769
4769
  m.classList.add("module-layer1"), I.appendChild(m), m.setAttribute("stroke-width", "3"), m.setAttribute("stroke", "rgb(45,41,38)"), m.setAttribute("fill", "rgb(45,41,38)"), m.setAttribute("transform", "translate(0.5,0)"), m.innerHTML = i;
4770
- const F = H("g");
4770
+ const F = P("g");
4771
4771
  F.classList.add("module-layer2"), I.appendChild(F), F.setAttribute("fill", "rgb(255,209,0)"), F.setAttribute("transform", "translate(1,-0.1)"), F.innerHTML = i;
4772
- const Y = H("g");
4772
+ const Y = P("g");
4773
4773
  return Y.classList.add("module-layer3"), I.appendChild(Y), Y.setAttribute("fill", "white"), Y.innerHTML = i, new se(I).transform(([G, S]) => [G, S + (r / 2 - G) ** 2 / (r * 6)]), I;
4774
- }, l = H("g");
4774
+ }, l = P("g");
4775
4775
  l.classList.add("module-root");
4776
- const w = H("defs");
4776
+ const w = P("defs");
4777
4777
  l.appendChild(w);
4778
- const d = H("g");
4778
+ const d = P("g");
4779
4779
  d.classList.add("module-bounds"), l.appendChild(d);
4780
4780
  const C = ae(e.height, e.width);
4781
4781
  C.setAttribute("opacity", "0"), d.appendChild(C);
4782
- const E = H("g");
4782
+ const E = P("g");
4783
4783
  E.classList.add("module-text-enclosure"), l.appendChild(E);
4784
4784
  const Q = B();
4785
4785
  E.appendChild(Q);
@@ -4789,7 +4789,7 @@ class va extends te {
4789
4789
  }
4790
4790
  async function _e(c) {
4791
4791
  if (c === "Favourites")
4792
- return new Pa();
4792
+ return new Ha();
4793
4793
  if (c === "Maltesers") {
4794
4794
  const A = q("https://assets.spiff.com.au/public/modules/img/MaltesersBackground.svg"), e = q("https://assets.spiff.com.au/public/modules/img/MaltesersBackgroundShort.svg"), t = await Promise.all([A, e]);
4795
4795
  return new Ua(t[0], t[1]);
@@ -5122,7 +5122,7 @@ class Ja {
5122
5122
  const A = this.getCommandContext().getState();
5123
5123
  if (!A)
5124
5124
  throw new v("Attempted to serialize state before it was initialized.");
5125
- return { transaction: JSON.stringify(this.dehydrateState(HA(A.transaction))) };
5125
+ return { transaction: JSON.stringify(this.dehydrateState(PA(A.transaction))) };
5126
5126
  }
5127
5127
  dehydrateState(A) {
5128
5128
  for (const e of Object.values(A.layouts).map((t) => t.elements).flat())
@@ -6383,7 +6383,7 @@ const bA = new en(), tn = y`
6383
6383
  class dA {
6384
6384
  constructor(A, e) {
6385
6385
  var a;
6386
- if (this.renderableScenes = [], this.renderableSceneCallbacks = [], this.debouncedSavedDesignUpdate = Pe(async () => {
6386
+ if (this.renderableScenes = [], this.renderableSceneCallbacks = [], this.debouncedSavedDesignUpdate = He(async () => {
6387
6387
  await bA.getSavedDesignByTransaction(
6388
6388
  this.getWorkflowManager().getTransaction().id
6389
6389
  ) && this.save();
@@ -6480,7 +6480,7 @@ class dA {
6480
6480
  region: { left: B.x, top: B.y, width: B.width, height: B.height }
6481
6481
  }
6482
6482
  }), C = Me(d);
6483
- await (await He.from(w, C, {
6483
+ await (await Pe.from(w, C, {
6484
6484
  anonymousCrossOrigin: !0,
6485
6485
  ignoreDimensions: !1,
6486
6486
  createCanvas: DA,
@@ -6519,6 +6519,27 @@ class dA {
6519
6519
  getTotalPriceSubunits() {
6520
6520
  return this.getBasePriceSubunits() + this.getSelectionPriceSubunits();
6521
6521
  }
6522
+ async copySelectionsViaGlobalConfiguration(A, e, t) {
6523
+ const a = await A.getGlobalProperties(), n = t == null ? void 0 : t.map((r) => r.getId()), s = this.getSteps().filter((r) => n === void 0 || n.includes(r.getId())), i = e.getSteps(), o = (r) => a.find((g) => g.getRawProperty().name === r.aspectName);
6524
+ s.forEach((r) => {
6525
+ const g = /* @__PURE__ */ new Set(), B = r.getRaw().globalPropertyAspectConfigurations;
6526
+ B !== void 0 && (B.forEach((l) => g.add(JSON.stringify(l))), i.forEach((l) => {
6527
+ const w = l.getRaw().globalPropertyAspectConfigurations;
6528
+ w !== void 0 && w.forEach((d) => {
6529
+ const C = o(d), E = g.has(JSON.stringify(d));
6530
+ if (E && (C == null ? void 0 : C.getType()) === "Option") {
6531
+ const Q = l.getCurrentVariant();
6532
+ if (!Q)
6533
+ return;
6534
+ r.selectVariant(Q), g.delete(JSON.stringify(d));
6535
+ } else if (E && (C == null ? void 0 : C.getType()) === "Text") {
6536
+ const Q = l.getText();
6537
+ r.setText(Q), g.delete(JSON.stringify(d));
6538
+ }
6539
+ });
6540
+ }));
6541
+ });
6542
+ }
6522
6543
  getStepByName(A) {
6523
6544
  const e = this.getWorkflowManager().getWorkflow().steps.find((t) => t.stepTitle === A);
6524
6545
  if (!(!e || !this.stepHasHandle(e)))
@@ -6592,7 +6613,7 @@ class dA {
6592
6613
  }
6593
6614
  async copy() {
6594
6615
  var i;
6595
- const A = HA(this.getCommandContext().getState());
6616
+ const A = PA(this.getCommandContext().getState());
6596
6617
  if (!A)
6597
6618
  throw new v("Internal state is undefined! Cannot copy experience!");
6598
6619
  const e = JSON.stringify(A.transaction), t = this.getWorkflowManager().getWorkflow(), a = new Bs({}), n = (i = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : i.id;
@@ -7221,7 +7242,7 @@ class Cn {
7221
7242
  * Actions to perform when a static render event is fired for this canvas.
7222
7243
  */
7223
7244
  async render(A, e, t) {
7224
- const a = HA(e);
7245
+ const a = PA(e);
7225
7246
  this.lastRequestedRenderArguments = {
7226
7247
  workflow: A,
7227
7248
  layouts: a,
@@ -7298,7 +7319,7 @@ class Qn extends Oe {
7298
7319
  i = this.getDynamicTextureResolution().width, o = this.getDynamicTextureResolution().height;
7299
7320
  const r = fe(A.layoutState.layout, e, {
7300
7321
  renderingConfiguration: { purpose: Fe.ThreeD }
7301
- }), g = Me(r), B = await He.from(this.ctx, g, {
7322
+ }), g = Me(r), B = await Pe.from(this.ctx, g, {
7302
7323
  anonymousCrossOrigin: !0,
7303
7324
  ignoreDimensions: !this.nonPOTSupport,
7304
7325
  ignoreAnimation: !0,
@@ -7491,7 +7512,7 @@ const Ms = (c, A) => {
7491
7512
  }
7492
7513
  `, fn = y`
7493
7514
  ${nt}
7494
- mutation CreateBundle($collectionId: String, $initialMetadata: [MetadataInput]) {
7515
+ mutation CreateBundle($collectionId: String, $initialMetadata: [MetadataInput!]) {
7495
7516
  bundleCreate(collectionId: $collectionId, metadata: $initialMetadata) {
7496
7517
  id
7497
7518
  bundleOwnerId
@@ -7596,14 +7617,14 @@ const Ms = (c, A) => {
7596
7617
  }
7597
7618
  }
7598
7619
  }
7599
- `, Hn = y`
7620
+ `, Pn = y`
7600
7621
  mutation BundleUpdateTransactionOrder($id: String!, $transactionIds: [String!]!) {
7601
7622
  bundleUpdateTransactionOrder(id: $id, transactionIds: $transactionIds) {
7602
7623
  id
7603
7624
  }
7604
7625
  }
7605
7626
  `;
7606
- class Pn {
7627
+ class Hn {
7607
7628
  constructor(A) {
7608
7629
  this.handleCache = {}, this.bundle = A;
7609
7630
  }
@@ -7901,7 +7922,7 @@ class bn {
7901
7922
  async setAspect(A, e) {
7902
7923
  if (!this.globalPropertyState)
7903
7924
  throw new Error("Global property state not initialized");
7904
- const t = HA(this.globalPropertyState), a = this.globalPropertyState.aspects.find((n) => n.name === A);
7925
+ const t = PA(this.globalPropertyState), a = this.globalPropertyState.aspects.find((n) => n.name === A);
7905
7926
  a ? a.value = e : this.globalPropertyState.aspects.push({ name: A, value: e }), await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(t, this.globalPropertyState);
7906
7927
  }
7907
7928
  async updateGlobalPropertyState() {
@@ -8097,7 +8118,7 @@ class Tn {
8097
8118
  getDefaultWorkflow() {
8098
8119
  const A = this.product.workflows || [];
8099
8120
  if (A.length === 0)
8100
- throw new P(
8121
+ throw new H(
8101
8122
  "No workflows found on product. This is generally due to a configuration error. Please confirm at least one workflow is configured for this product."
8102
8123
  );
8103
8124
  const e = this.productResource.workflowId;
@@ -8203,7 +8224,7 @@ class me {
8203
8224
  this.id,
8204
8225
  this.ownerId,
8205
8226
  this.checkConditionalHandlesChanged.bind(this)
8206
- ), this.globalPropertyHandleService = new Pn(this), this.setPreviewService(t), this.initializationPromise = this.loadExistingBundles(
8227
+ ), this.globalPropertyHandleService = new Hn(this), this.setPreviewService(t), this.initializationPromise = this.loadExistingBundles(
8207
8228
  ((o = e.transactions) == null ? void 0 : o.map((r) => r.id)) || [],
8208
8229
  a
8209
8230
  );
@@ -8577,7 +8598,7 @@ class me {
8577
8598
  }
8578
8599
  async updateTransactionOrder() {
8579
8600
  await N.getShadowGraphqlClient().mutate({
8580
- mutation: Hn,
8601
+ mutation: Pn,
8581
8602
  variables: {
8582
8603
  id: this.id,
8583
8604
  transactionIds: this.workflowExperiences.map((A) => A.getWorkflowManager().getTransaction().id)
@@ -9477,7 +9498,7 @@ class Bs {
9477
9498
  mutation: aa
9478
9499
  });
9479
9500
  } catch (t) {
9480
- throw console.error(t), new P("Critical - Unable to synchronize workflow state with server.");
9501
+ throw console.error(t), new H("Critical - Unable to synchronize workflow state with server.");
9481
9502
  }
9482
9503
  }, this.initialized = !1, this.options = A, this.options.applicationKey && Rt(this.options.applicationKey);
9483
9504
  }
@@ -9802,13 +9823,13 @@ class Bs {
9802
9823
  fetchPolicy: "no-cache"
9803
9824
  });
9804
9825
  if (!((Q = D.data) != null && Q.transactions) || D.data.transactions.length === 0)
9805
- throw new P("Existing transaction not found.");
9826
+ throw new H("Existing transaction not found.");
9806
9827
  const p = (h = D.data) == null ? void 0 : h.transactions[0];
9807
9828
  if (!p.workflowId)
9808
- throw new P("Existing transaction has no workflow ID.");
9829
+ throw new H("Existing transaction has no workflow ID.");
9809
9830
  const m = await CA(p.workflowId);
9810
9831
  if (!p.product)
9811
- throw new P("Failed to load transaction, product not available.");
9832
+ throw new H("Failed to load transaction, product not available.");
9812
9833
  return { transaction: p, workflow: m, readOnly: u };
9813
9834
  }
9814
9835
  if (a.type === "integration" || a.type === "external") {
@@ -9829,15 +9850,15 @@ class Bs {
9829
9850
  context: this.options.applicationKey ? { headers: { "X-Application-Key": this.options.applicationKey } } : void 0
9830
9851
  });
9831
9852
  if (!F.data || !F.data.transactionCreate)
9832
- throw new P("Failed to create transaction!");
9853
+ throw new H("Failed to create transaction!");
9833
9854
  const Y = F.data.transactionCreate;
9834
9855
  if (!Y.product)
9835
- throw new P("Failed to create transaction, product not available.");
9856
+ throw new H("Failed to create transaction, product not available.");
9836
9857
  return Y;
9837
9858
  }, u = CA(a.workflowId, a == null ? void 0 : a.graphql), [D, p] = await Promise.all([I(), u]);
9838
9859
  return { transaction: D, workflow: p };
9839
9860
  }
9840
- throw new P("No workflow ID provided.");
9861
+ throw new H("No workflow ID provided.");
9841
9862
  }, { transaction: s, workflow: i, readOnly: o } = await n();
9842
9863
  this.currencyCode = (B = s.product.partner) == null ? void 0 : B.currencyCode;
9843
9864
  const r = {
@@ -9891,7 +9912,7 @@ class Bs {
9891
9912
  */
9892
9913
  async getWorkflowExperiences(A, e) {
9893
9914
  if (A.length === 0)
9894
- throw new P("No options provided!");
9915
+ throw new H("No options provided!");
9895
9916
  const t = N.getShadowGraphqlClient(), a = A.map((h, I) => ({ option: h, index: I })), n = a.filter((h) => h.option.type === "transaction"), s = a.filter(
9896
9917
  (h) => h.option.type === "integration" || h.option.type === "external"
9897
9918
  ), i = async () => {
@@ -9908,7 +9929,7 @@ class Bs {
9908
9929
  }), u = I.data.transactions;
9909
9930
  if (u.length !== n.length) {
9910
9931
  const m = ((p = (D = I.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9911
- throw new P(`Not all transactions were found: ${m}`);
9932
+ throw new H(`Not all transactions were found: ${m}`);
9912
9933
  }
9913
9934
  return u.map((m, F) => {
9914
9935
  var Y;
@@ -9939,7 +9960,7 @@ class Bs {
9939
9960
  }), I = (u = h.data) == null ? void 0 : u.transactionCreateMany;
9940
9961
  if (!I || I.length === 0) {
9941
9962
  const m = ((p = (D = h.errors) == null ? void 0 : D[0]) == null ? void 0 : p.message) || "Unknown error";
9942
- throw new P(`Failed to create transactions: ${m}`);
9963
+ throw new H(`Failed to create transactions: ${m}`);
9943
9964
  }
9944
9965
  return I.map((m, F) => ({
9945
9966
  transaction: m,
@@ -9993,7 +10014,7 @@ class Bs {
9993
10014
  async initFromIntegrationProduct(A) {
9994
10015
  var s;
9995
10016
  if (A === "")
9996
- throw new P("No integration product ID provided.");
10017
+ throw new H("No integration product ID provided.");
9997
10018
  const t = await N.getShadowGraphqlClient().mutate({
9998
10019
  mutation: Ee,
9999
10020
  variables: {
@@ -10006,10 +10027,10 @@ class Bs {
10006
10027
  context: this.options.applicationKey ? { headers: { "X-Application-Key": this.options.applicationKey } } : void 0
10007
10028
  });
10008
10029
  if (!t.data || !t.data.transactionCreate)
10009
- throw new P("Failed to create transaction!");
10030
+ throw new H("Failed to create transaction!");
10010
10031
  const a = t.data.transactionCreate;
10011
10032
  if (!a.product)
10012
- throw new P("Failed to create transaction, product not available.");
10033
+ throw new H("Failed to create transaction, product not available.");
10013
10034
  this.currencyCode = (s = a.product.partner) == null ? void 0 : s.currencyCode;
10014
10035
  const n = x.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map();
10015
10036
  n.set(a.id, a.transactionOwnerId), x.setMap("transactionOwnerIds", n), this.experienceOptions = {
@@ -10028,7 +10049,7 @@ class Bs {
10028
10049
  async initFromTransaction(A, e = !1) {
10029
10050
  var i, o, r, g;
10030
10051
  if (A === "")
10031
- throw new P("No transaction ID provided.");
10052
+ throw new H("No transaction ID provided.");
10032
10053
  const t = N.getShadowGraphqlClient(), a = async () => {
10033
10054
  var w, d;
10034
10055
  const l = (w = (await t.query({
@@ -10038,9 +10059,9 @@ class Bs {
10038
10059
  errorPolicy: "all"
10039
10060
  })).data) == null ? void 0 : w.transactions[0];
10040
10061
  if (!l)
10041
- throw new P("Failed to read transaction.");
10062
+ throw new H("Failed to read transaction.");
10042
10063
  if (!l.product)
10043
- throw new P("Failed to load transaction, product not available.");
10064
+ throw new H("Failed to load transaction, product not available.");
10044
10065
  this.currencyCode = (d = l.product.partner) == null ? void 0 : d.currencyCode, this.experienceOptions = {
10045
10066
  product: l.product,
10046
10067
  transaction: l,
@@ -10063,9 +10084,9 @@ class Bs {
10063
10084
  errorPolicy: "all"
10064
10085
  })).data) == null ? void 0 : i.transactions[0];
10065
10086
  if (!l)
10066
- throw new P("Failed to read transaction.");
10087
+ throw new H("Failed to read transaction.");
10067
10088
  if (!l.product)
10068
- throw new P("Failed to load transaction, product not available.");
10089
+ throw new H("Failed to load transaction, product not available.");
10069
10090
  this.currencyCode = (o = l.product.partner) == null ? void 0 : o.currencyCode, this.experienceOptions = {
10070
10091
  product: l.product,
10071
10092
  transaction: l,
@@ -10082,9 +10103,9 @@ class Bs {
10082
10103
  errorPolicy: "all"
10083
10104
  })).data) == null ? void 0 : r.transactionClaim;
10084
10105
  if (!l)
10085
- throw new P("Failed to read transaction.");
10106
+ throw new H("Failed to read transaction.");
10086
10107
  if (!l.product)
10087
- throw new P("Failed to load transaction, product not available.");
10108
+ throw new H("Failed to load transaction, product not available.");
10088
10109
  this.currencyCode = (g = l.product.partner) == null ? void 0 : g.currencyCode, l.transactionOwnerId && (n.set(l.id, l.transactionOwnerId), x.setMap("transactionOwnerIds", n)), this.experienceOptions = {
10089
10110
  product: l.product,
10090
10111
  transaction: l,
@@ -10093,7 +10114,7 @@ class Bs {
10093
10114
  readOnly: e
10094
10115
  }, this.initialized = !0;
10095
10116
  } catch {
10096
- throw new P("Attempted to access a transaction that isn't available.");
10117
+ throw new H("Attempted to access a transaction that isn't available.");
10097
10118
  }
10098
10119
  }
10099
10120
  /**
@@ -10102,7 +10123,7 @@ class Bs {
10102
10123
  async getWorkflowExperienceDeprecated(A, e, t) {
10103
10124
  var a, n, s, i;
10104
10125
  if (!this.initialized || !this.experienceOptions)
10105
- throw new P("Cannot launch experience: Not initialized.");
10126
+ throw new H("Cannot launch experience: Not initialized.");
10106
10127
  if (this.experienceOptions.transaction.workflowId) {
10107
10128
  const o = await CA(this.experienceOptions.transaction.workflowId);
10108
10129
  if (this.experienceOptions.workflow = o, this.experienceOptions.transaction.workflowState) {
@@ -10142,7 +10163,7 @@ class Bs {
10142
10163
  const l = new dA(this, this.experienceOptions);
10143
10164
  return await l.getWorkflowManager().getInitializationPromise(), l;
10144
10165
  }
10145
- throw new P("No workflow ID provided.");
10166
+ throw new H("No workflow ID provided.");
10146
10167
  }
10147
10168
  /**
10148
10169
  * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
@@ -10158,7 +10179,7 @@ class Bs {
10158
10179
  */
10159
10180
  getProduct() {
10160
10181
  if (!this.initialized || !this.experienceOptions)
10161
- throw new P("Cannot get product: Not initialized.");
10182
+ throw new H("Cannot get product: Not initialized.");
10162
10183
  return this.experienceOptions.product;
10163
10184
  }
10164
10185
  /**
@@ -10167,7 +10188,7 @@ class Bs {
10167
10188
  */
10168
10189
  getTransaction() {
10169
10190
  if (!this.initialized || !this.experienceOptions)
10170
- throw new P("Cannot get transaction: Not initialized.");
10191
+ throw new H("Cannot get transaction: Not initialized.");
10171
10192
  return this.experienceOptions.transaction;
10172
10193
  }
10173
10194
  storeCustomer(A) {
@@ -10342,8 +10363,8 @@ class ds extends j {
10342
10363
  export {
10343
10364
  $ as AssetNotFoundError,
10344
10365
  Ns as AssetType,
10345
- Hs as BringForwardCommand,
10346
- Ps as BringToBackCommand,
10366
+ Ps as BringForwardCommand,
10367
+ Hs as BringToBackCommand,
10347
10368
  Rs as BringToFrontCommand,
10348
10369
  Us as CanvasCommand,
10349
10370
  Tn as CollectionProduct,