@spiffcommerce/core 20.1.0-alpha.0 → 20.1.0-alpha.2

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,14 +1,14 @@
1
1
  import { createHttpLink as Et, InMemoryCache as ht, ApolloClient as Ct, from as Qt, gql as F } from "@apollo/client/core";
2
- import { fetch as $A, getAttributesFromArrayBuffer as ye, AssetType as Be, StepType as D, getFrameData as _A, frameDataCache as ut, GroupCommand as G, UpdateFramePattern as Ye, UpdateFrameThresholdSettingsCommand as mt, calculateOffsets as Ae, LayoutElementType as v, generate as J, CreateElementCommand as L, generateSVGWithUnknownColors as Se, svgObjectURL as fA, fetchAsString as Z, DeleteElementCommand as $, generateDefaultRectangleFrameSvg as de, GetSVGDimensions as It, patternImageDataCache as we, fetchAsArrayBuffer as pt, findElement as DA, modifySVGWithElementProperties as ft, IllustrationColorCommand as zA, IllustrationCacheCommand as Dt, getFontMetrics as Ft, getPatternImageData as KA, FontAlignmentCommand as Mt, FontColorCommand as yt, FontImageFillCommand as kA, applyTextTransformations as jA, determineCorrectFontSizeAndLines as mA, FontSourceCommand as Ee, loadFont as ee, TextChangeCommand as Yt, FontSizeCommand as St, createElementNS as xt, createElement as BA, _loadFontExternalDataURL as te, UpdateWorkflowStateCommand as he, CommandContext as Pt, createCanvas as FA, getSvgElement as xe, LayoutRenderingPurpose as Pe, renderPapyrusComponentAsString as Ne, loadImage as He, getDomParser as Re, toBase64 as Ce, getVariant as Nt, generateFrameSVG as Ht, getDefaultVariant as NA, domParser as Ue, sanitizeSvgTree as Ge, traverse as Rt, xmlSerializer as ve, CreateLayoutCommand as Ut, AspectType as IA, rehydrateSerializedLayout as AA } from "@spiffcommerce/papyrus";
2
+ import { fetch as $A, getAttributesFromArrayBuffer as ye, AssetType as Be, StepType as D, getFrameData as _A, frameDataCache as ut, GroupCommand as G, UpdateFramePattern as Ye, UpdateFrameThresholdSettingsCommand as mt, calculateOffsets as Ae, LayoutElementType as v, generate as J, CreateElementCommand as L, generateSVGWithUnknownColors as Se, svgObjectURL as fA, fetchAsString as Z, DeleteElementCommand as $, generateDefaultRectangleFrameSvg as de, GetSVGDimensions as It, patternImageDataCache as we, fetchAsArrayBuffer as pt, findElement as DA, modifySVGWithElementProperties as ft, IllustrationColorCommand as KA, IllustrationCacheCommand as Dt, getFontMetrics as Ft, getPatternImageData as jA, FontAlignmentCommand as Mt, FontColorCommand as yt, FontImageFillCommand as JA, applyTextTransformations as VA, determineCorrectFontSizeAndLines as mA, FontSourceCommand as Ee, loadFont as ee, TextChangeCommand as Yt, FontSizeCommand as St, createElementNS as xt, createElement as BA, _loadFontExternalDataURL as te, UpdateWorkflowStateCommand as he, CommandContext as Pt, createCanvas as FA, getSvgElement as xe, LayoutRenderingPurpose as Pe, renderPapyrusComponentAsString as Ne, loadImage as He, getDomParser as Re, toBase64 as Ce, getVariant as Nt, generateFrameSVG as Ht, getDefaultVariant as HA, domParser as Ue, sanitizeSvgTree as Ge, traverse as Rt, xmlSerializer as ve, CreateLayoutCommand as Ut, AspectType as IA, rehydrateSerializedLayout as AA } from "@spiffcommerce/papyrus";
3
3
  import { AssetType as Oi, BringForwardCommand as zi, BringToBackCommand as Ki, BringToFrontCommand as ji, CanvasCommand as Vi, CommandContext as Wi, CreateElementCommand as Xi, CreateLayoutCommand as qi, DeleteElementCommand as Zi, FontAlignmentCommand as $i, FontColorCommand as _i, FontSizeCommand as As, FontSourceCommand as es, GroupCommand as ts, LayoutElementFactory as ns, LayoutElementType as as, MoveCommand as is, ResizeCommand as ss, RotateCommand as os, SendBackwardsCommand as rs, StepAspectType as cs, StepType as gs, TextChangeCommand as ls, UnitOfMeasurement as Bs, dataUrlFromExternalUrl as ds, determineCorrectFontSizeAndLines as ws, findElement as Es, frameDataCache as hs, generate as Cs, generateSVGWithUnknownColors as Qs, getAttributesFromArrayBuffer as us, getAxisAlignedBoundingBox as ms, getFrameData as Is, getSvgElement as ps, loadFont as fs, patternImageDataCache as Ds, registerFetchImplementation as Fs, registerWindowImplementation as Ms, rehydrateSerializedLayout as ys, setCanvasModule as Ys } from "@spiffcommerce/papyrus";
4
4
  import { setContext as Gt } from "@apollo/client/link/context";
5
5
  import { onError as vt } from "@apollo/client/link/error";
6
6
  import { Pith as ke } from "pith";
7
7
  import Je from "lodash.debounce";
8
8
  import be from "lodash.isequal";
9
- import HA from "lodash.clonedeep";
9
+ import RA from "lodash.clonedeep";
10
10
  import { toString as Le } from "qrcode";
11
- import { split as VA } from "unicode-default-word-boundary";
11
+ import { split as WA } from "unicode-default-word-boundary";
12
12
  import ne from "svg-path-bbox";
13
13
  import Qe from "lodash.chunk";
14
14
  class Te extends Error {
@@ -46,27 +46,27 @@ class yA extends lA {
46
46
  super(`Workflow Misconfiguration: ${A.stepName} - ${e}`), this.step = A;
47
47
  }
48
48
  }
49
- class RA extends Te {
49
+ class UA extends Te {
50
50
  constructor(A) {
51
51
  super(`ImplementationError - ${A}`);
52
52
  }
53
53
  }
54
- class k extends RA {
54
+ class k extends UA {
55
55
  constructor(A) {
56
56
  super(`Unhandled Behavior Encountered: ${A}`);
57
57
  }
58
58
  }
59
- class oA extends RA {
59
+ class oA extends UA {
60
60
  constructor(A) {
61
61
  super(`Parsing Error: ${A}`);
62
62
  }
63
63
  }
64
- class U extends RA {
64
+ class U extends UA {
65
65
  constructor(A) {
66
66
  super(`Client Error: ${A}`);
67
67
  }
68
68
  }
69
- class UA extends RA {
69
+ class GA extends UA {
70
70
  constructor(A) {
71
71
  super(`Resource Generation Failed: ${A}`);
72
72
  }
@@ -258,7 +258,7 @@ const P = new Kt(), jt = F`
258
258
  value
259
259
  }
260
260
  }
261
- `, GA = (c) => F`
261
+ `, vA = (c) => F`
262
262
  ${c && jt || ""}
263
263
  fragment AssetFields on Asset {
264
264
  name
@@ -274,7 +274,7 @@ const P = new Kt(), jt = F`
274
274
  ${c && "...AssetMetadataFields" || ""}
275
275
  }
276
276
  `, Vt = F`
277
- ${GA(!1)}
277
+ ${vA(!1)}
278
278
  query GetAssets($keys: [String]!) {
279
279
  assets(keys: $keys) {
280
280
  ...AssetFields
@@ -445,7 +445,7 @@ class $t {
445
445
  g.lengthComputable && t(g.loaded * 100 / g.total);
446
446
  }, r.onload = () => {
447
447
  const g = i.assetResponse.asset;
448
- JA.add(i.assetResponse.asset), s(g);
448
+ bA.add(i.assetResponse.asset), s(g);
449
449
  }, r.onerror = o, r.send(A.blob);
450
450
  }), i.assetResponse.asset;
451
451
  }
@@ -463,10 +463,10 @@ class $t {
463
463
  }
464
464
  }
465
465
  removePersistedAsset(A) {
466
- JA.remove(A);
466
+ bA.remove(A);
467
467
  }
468
468
  getPersistedAssets() {
469
- return JA.list();
469
+ return bA.list();
470
470
  }
471
471
  /**
472
472
  * Handles mimeType resolution & asset creation request
@@ -496,7 +496,7 @@ class $t {
496
496
  }
497
497
  }
498
498
  const iA = "persistentAssets";
499
- class JA {
499
+ class bA {
500
500
  /**
501
501
  * Add a new asset to persistence
502
502
  * @param asset The asset to add.
@@ -605,7 +605,7 @@ const gA = new _t(), Ke = F`
605
605
  }
606
606
  }
607
607
  `, An = F`
608
- ${GA(!1)}
608
+ ${vA(!1)}
609
609
  ${ie}
610
610
  ${Ke}
611
611
  query GetOptions($ids: [String]!) {
@@ -1624,7 +1624,7 @@ const pn = async (c) => {
1624
1624
  }
1625
1625
  })).json()).shortUrl;
1626
1626
  } catch (e) {
1627
- throw console.error(e), new UA("Failed to shorten URL, see console.");
1627
+ throw console.error(e), new GA("Failed to shorten URL, see console.");
1628
1628
  }
1629
1629
  };
1630
1630
  class qe {
@@ -1698,7 +1698,7 @@ class fn {
1698
1698
  d.searchParams.append("video", btoa(JSON.stringify([B]))), d.pathname = d.pathname + (d.pathname.slice(-1) === "/" ? "" : "/");
1699
1699
  const w = d.toString();
1700
1700
  if (w.length >= 2e3)
1701
- throw new UA("Cannot create QR code, URL too long.");
1701
+ throw new GA("Cannot create QR code, URL too long.");
1702
1702
  const h = await pn(w);
1703
1703
  if (s(h), !i.data || !i.data.regions)
1704
1704
  throw new yA(i, "Missing regions.");
@@ -1852,7 +1852,7 @@ class Fn {
1852
1852
  });
1853
1853
  },
1854
1854
  () => {
1855
- throw new UA("Failed to resolve transcoded PDF");
1855
+ throw new GA("Failed to resolve transcoded PDF");
1856
1856
  }
1857
1857
  )
1858
1858
  ) : this.loadPatternFromAsset(e, A, t);
@@ -2002,7 +2002,7 @@ class Fn {
2002
2002
  }), t.markUpdateCompleted(a);
2003
2003
  }
2004
2004
  }
2005
- const WA = new Fn();
2005
+ const XA = new Fn();
2006
2006
  class Mn {
2007
2007
  async getIllustrationBody(A) {
2008
2008
  return new Promise((e) => {
@@ -2107,7 +2107,7 @@ class Mn {
2107
2107
  const s = ft(A, e, t, i), o = await fA(s), r = [];
2108
2108
  for (const B of n) {
2109
2109
  for (const [l, d] of a.entries())
2110
- r.push(new zA(B, l, d));
2110
+ r.push(new KA(B, l, d));
2111
2111
  r.push(new Dt(B, s, o));
2112
2112
  }
2113
2113
  return new G(r);
@@ -2478,7 +2478,7 @@ class Sn {
2478
2478
  }
2479
2479
  if (!/^$|^[a-zA-Z0-9 ]+$/.test(e))
2480
2480
  return n("Unsupported characters."), !1;
2481
- const a = VA(e.toLowerCase());
2481
+ const a = WA(e.toLowerCase());
2482
2482
  for (const i of a)
2483
2483
  for (const s in t) {
2484
2484
  const o = t[s].toLowerCase().replace(/\s/g, "");
@@ -2659,7 +2659,7 @@ class Hn {
2659
2659
  const o = s.region;
2660
2660
  if (!n.find((g) => g.panelId === (o == null ? void 0 : o.panelId)))
2661
2661
  throw new z(o);
2662
- return new zA(s.id, this.shapeFillId, A);
2662
+ return new KA(s.id, this.shapeFillId, A);
2663
2663
  }).filter((s) => !!s);
2664
2664
  t.getCommandDispatcher()(new G(i)), t.updateStorage(e.stepName, { colour: A });
2665
2665
  }
@@ -2731,7 +2731,7 @@ class Hn {
2731
2731
  if (!a.find((h) => h.panelId === (l == null ? void 0 : l.panelId)))
2732
2732
  throw new z(l);
2733
2733
  const w = s();
2734
- return new zA(B.id, this.shapeFillId, w);
2734
+ return new KA(B.id, this.shapeFillId, w);
2735
2735
  }, g = t.map(r).filter((B) => !!B);
2736
2736
  return {
2737
2737
  command: new G(g),
@@ -2835,7 +2835,7 @@ class Rn {
2835
2835
  );
2836
2836
  }
2837
2837
  }
2838
- const Un = new Rn(), bA = 30;
2838
+ const Un = new Rn(), LA = 30;
2839
2839
  class SA extends Error {
2840
2840
  constructor(A) {
2841
2841
  super(A), Object.setPrototypeOf(this, new.target.prototype), this.name = SA.name;
@@ -2867,7 +2867,7 @@ class vn {
2867
2867
  }, this.textAlign = (A) => A.vertical ? "center" : A.textAlign || "center", this.getErrorsForText = (A, e, t) => {
2868
2868
  const n = [];
2869
2869
  e.data && e.data.maxLength && A.length > e.data.maxLength && n.push({ localizationKey: "workflow.steps.text.characterLimit" });
2870
- const a = t.getProfanities(), i = VA(A.toLowerCase());
2870
+ const a = t.getProfanities(), i = WA(A.toLowerCase());
2871
2871
  for (const o of i)
2872
2872
  for (const r in a) {
2873
2873
  const g = a[r].toLowerCase().replace(/\s/g, "");
@@ -2888,7 +2888,7 @@ class vn {
2888
2888
  if (t)
2889
2889
  await this.reload(A, e, t);
2890
2890
  else {
2891
- const o = this.getDefaultImageFillVariant(A.data), r = (a = o == null ? void 0 : o.asset) == null ? void 0 : a.fileLink, g = r ? await KA(r) : void 0, B = g ? {
2891
+ const o = this.getDefaultImageFillVariant(A.data), r = (a = o == null ? void 0 : o.asset) == null ? void 0 : a.fileLink, g = r ? await jA(r) : void 0, B = g ? {
2892
2892
  src: g.src,
2893
2893
  height: g.height,
2894
2894
  width: g.width,
@@ -2983,7 +2983,7 @@ class vn {
2983
2983
  })) == null ? void 0 : n.filter((i) => !!i)) || [];
2984
2984
  return Promise.all(
2985
2985
  a.map(async (i) => {
2986
- const s = await KA(i);
2986
+ const s = await jA(i);
2987
2987
  return {
2988
2988
  src: i,
2989
2989
  width: s.width,
@@ -3007,13 +3007,13 @@ class vn {
3007
3007
  fillImage: e
3008
3008
  });
3009
3009
  for (const r of t) {
3010
- const g = new kA(r.id, e);
3010
+ const g = new JA(r.id, e);
3011
3011
  a(g);
3012
3012
  }
3013
3013
  }
3014
3014
  getProcessedInput(A, e, t) {
3015
3015
  const n = t ? A : this.injectReplaceableText(A, e);
3016
- return jA(n, {
3016
+ return VA(n, {
3017
3017
  vertical: e.vertical,
3018
3018
  uppercase: e.uppercase
3019
3019
  });
@@ -3141,12 +3141,12 @@ class vn {
3141
3141
  if (n.length > 0) {
3142
3142
  const l = n.map((h) => new Ee(h.id, g));
3143
3143
  if (o) {
3144
- const h = n.map((E) => new kA(E.id, o));
3144
+ const h = n.map((E) => new JA(E.id, o));
3145
3145
  l.push(...h);
3146
3146
  }
3147
3147
  const d = await this.changeInputTextWithRegion(
3148
3148
  A,
3149
- A.data.size || bA,
3149
+ A.data.size || LA,
3150
3150
  g,
3151
3151
  t.text || "",
3152
3152
  t,
@@ -3171,7 +3171,7 @@ class vn {
3171
3171
  a
3172
3172
  ), d = await this.changeInputTextWithRegion(
3173
3173
  A,
3174
- A.data.size || bA,
3174
+ A.data.size || LA,
3175
3175
  g,
3176
3176
  ((B = l[0]) == null ? void 0 : B.newElement.input) || t.text || A.data.defaultText || "",
3177
3177
  t,
@@ -3182,7 +3182,7 @@ class vn {
3182
3182
  ), w = l.flatMap((E) => E.commands);
3183
3183
  if (o) {
3184
3184
  const E = l.map(
3185
- (Q) => new kA(Q.regionElement.id, o)
3185
+ (Q) => new JA(Q.regionElement.id, o)
3186
3186
  );
3187
3187
  w.push(...E);
3188
3188
  }
@@ -3227,7 +3227,7 @@ class vn {
3227
3227
  stepName: A,
3228
3228
  align: this.textAlign(t),
3229
3229
  fill: a.color ? a.color : f,
3230
- fontSize: t.size || bA,
3230
+ fontSize: t.size || LA,
3231
3231
  fontData: n,
3232
3232
  id: w,
3233
3233
  layer: B.layer,
@@ -3322,7 +3322,7 @@ class vn {
3322
3322
  const Q = (() => {
3323
3323
  if (A.data && A.data.maxLength && l.length > A.data.maxLength)
3324
3324
  return g && g(!0), { info: "0" };
3325
- const u = i.getProfanities(), m = VA(l.toLowerCase());
3325
+ const u = i.getProfanities(), m = WA(l.toLowerCase());
3326
3326
  for (const I of m)
3327
3327
  for (const p in u) {
3328
3328
  const M = u[p].toLowerCase().replace(/\s/g, "");
@@ -5254,7 +5254,7 @@ class qn {
5254
5254
  const A = this.getCommandContext().getState();
5255
5255
  if (!A)
5256
5256
  throw new k("Attempted to serialize state before it was initialized.");
5257
- return { transaction: JSON.stringify(this.dehydrateState(HA(A.transaction))) };
5257
+ return { transaction: JSON.stringify(this.dehydrateState(RA(A.transaction))) };
5258
5258
  }
5259
5259
  dehydrateState(A) {
5260
5260
  for (const e of Object.values(A.layouts).map((t) => t.elements).flat())
@@ -5404,7 +5404,7 @@ class qn {
5404
5404
  r.connectWorkflowManager(this, o.stepName), this.stepSpecificServices[o.stepName] = {
5405
5405
  frameService: r
5406
5406
  }, t.push(
5407
- WA.init(o, this, this.reloadedState)
5407
+ XA.init(o, this, this.reloadedState)
5408
5408
  );
5409
5409
  }
5410
5410
  break;
@@ -5593,7 +5593,7 @@ class X {
5593
5593
  return this.variantData.enabled;
5594
5594
  }
5595
5595
  }
5596
- const st = class XA {
5596
+ const st = class qA {
5597
5597
  constructor(A, e) {
5598
5598
  this.manager = A, this.step = e;
5599
5599
  }
@@ -5603,13 +5603,13 @@ const st = class XA {
5603
5603
  * @param value The new value
5604
5604
  */
5605
5605
  setUpdateState(A) {
5606
- XA.updateState.set(this.step.stepName, A);
5606
+ qA.updateState.set(this.step.stepName, A);
5607
5607
  }
5608
5608
  /**
5609
5609
  * @returns Gets the current update state of this step. All step handles for this step will see this value.
5610
5610
  */
5611
5611
  getUpdateState() {
5612
- return !!XA.updateState.get(this.step.stepName);
5612
+ return !!qA.updateState.get(this.step.stepName);
5613
5613
  }
5614
5614
  /**
5615
5615
  * Gets the currently selected variant, or undefined if no variant is selected.
@@ -6172,7 +6172,7 @@ const ot = F`
6172
6172
  }))
6173
6173
  }
6174
6174
  })).data) == null ? void 0 : e.designCreateMany;
6175
- }, qA = (c, A, e) => {
6175
+ }, ZA = (c, A, e) => {
6176
6176
  const t = (a) => {
6177
6177
  const i = {};
6178
6178
  if (a.type === "Frame") {
@@ -6212,7 +6212,7 @@ const ot = F`
6212
6212
  const n = {};
6213
6213
  let a;
6214
6214
  if (e) {
6215
- a = qA(e, A, !1);
6215
+ a = ZA(e, A, !1);
6216
6216
  for (const i of Object.keys(a))
6217
6217
  n[i] = {
6218
6218
  value: a[i],
@@ -6283,7 +6283,7 @@ const ot = F`
6283
6283
  N.errors && console.log("Server Error:", b.message);
6284
6284
  }), null) : H ?? null;
6285
6285
  })() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(t())), await c.updateStateWithServerImmediate(t), console.log("Server state is undefined @ Workflow completion"));
6286
- const l = c.getPreviewService(), d = (M = A == null ? void 0 : A.finalizeStepConfig) == null ? void 0 : M.lookAtAnimation, w = l && A.showModelOnFinishStep && !!d, h = o && qA(o, A, !0), E = o && qA(o, A, !1), Q = async (y) => {
6286
+ const l = c.getPreviewService(), d = (M = A == null ? void 0 : A.finalizeStepConfig) == null ? void 0 : M.lookAtAnimation, w = l && A.showModelOnFinishStep && !!d, h = o && ZA(o, A, !0), E = o && ZA(o, A, !1), Q = async (y) => {
6287
6287
  const S = {};
6288
6288
  let Y = 0;
6289
6289
  if (Object.keys(a).length > 0)
@@ -6292,12 +6292,12 @@ const ot = F`
6292
6292
  for (let b = 0; b < H.selections.length; ++b) {
6293
6293
  const V = H.selections[b];
6294
6294
  if (T && (!y || T.option && (T.option.variants || []).length > 1 && !T.data.hideSelectionInCart && !T.data.hideSelectionsInCart)) {
6295
- const vA = T.stepTitle;
6296
- S[vA] ? S[vA].push({
6295
+ const kA = T.stepTitle;
6296
+ S[kA] ? S[kA].push({
6297
6297
  id: V.id || "",
6298
6298
  name: V.name,
6299
6299
  priceModifier: V.priceModifier
6300
- }) : S[vA] = [
6300
+ }) : S[kA] = [
6301
6301
  {
6302
6302
  id: V.id || "",
6303
6303
  name: V.name,
@@ -6497,7 +6497,7 @@ class Ba {
6497
6497
  throw new k("Unexpected storage method requested");
6498
6498
  }
6499
6499
  }
6500
- const LA = new Ba(), da = F`
6500
+ const TA = new Ba(), da = F`
6501
6501
  mutation AddTransactionStakeholder($id: String!, $type: String!, $details: CustomerDetailsInput!) {
6502
6502
  transactionAddStakeholder(id: $id, details: $details, type: $type) {
6503
6503
  id
@@ -6516,7 +6516,7 @@ class hA {
6516
6516
  constructor(A, e) {
6517
6517
  var n;
6518
6518
  if (this.renderableScenes = [], this.renderableSceneCallbacks = [], this.debouncedSavedDesignUpdate = Je(async () => {
6519
- await LA.getSavedDesignByTransaction(
6519
+ await TA.getSavedDesignByTransaction(
6520
6520
  this.getWorkflowManager().getTransaction().id
6521
6521
  ) && this.save();
6522
6522
  }, 2500), this.getCanvasObjectURLAsync = async (a) => new Promise((i, s) => {
@@ -6606,7 +6606,7 @@ class hA {
6606
6606
  height: g.layoutState.layout.height
6607
6607
  }, l = this.commandContext.getLayoutById(g.layoutState.layout.id), d = i.getContext("2d");
6608
6608
  if (!d)
6609
- throw new UA("Failed to obtain 2D context for preview image creation");
6609
+ throw new GA("Failed to obtain 2D context for preview image creation");
6610
6610
  const w = xe(l.layoutState.layout, l.layoutState.elements, {
6611
6611
  renderingConfiguration: {
6612
6612
  purpose: Pe.Print,
@@ -6742,7 +6742,7 @@ class hA {
6742
6742
  var o;
6743
6743
  if (A)
6744
6744
  return A;
6745
- const a = this.getWorkflowManager().getTransaction().id, s = (o = (await LA.getSavedDesigns()).find((r) => r.transactionId === a)) == null ? void 0 : o.title;
6745
+ const a = this.getWorkflowManager().getTransaction().id, s = (o = (await TA.getSavedDesigns()).find((r) => r.transactionId === a)) == null ? void 0 : o.title;
6746
6746
  return s || "My design";
6747
6747
  })(),
6748
6748
  thumbnail: await this.createPreviewImage(!1, 256),
@@ -6753,11 +6753,11 @@ class hA {
6753
6753
  workflowId: this.getWorkflowManager().getWorkflow().id,
6754
6754
  lastEdited: /* @__PURE__ */ new Date()
6755
6755
  };
6756
- return await LA.addDesign(n), n;
6756
+ return await TA.addDesign(n), n;
6757
6757
  }
6758
6758
  async copy() {
6759
6759
  var s;
6760
- const A = HA(this.getCommandContext().getState());
6760
+ const A = RA(this.getCommandContext().getState());
6761
6761
  if (!A)
6762
6762
  throw new k("Internal state is undefined! Cannot copy experience!");
6763
6763
  const e = JSON.stringify(A.transaction), t = this.getWorkflowManager().getWorkflow(), n = new Ii({}), a = (s = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : s.id;
@@ -6847,7 +6847,7 @@ const wa = [
6847
6847
  return console.error(d), [];
6848
6848
  }
6849
6849
  }, ha = async (c, A, e, t) => {
6850
- const n = e.data, a = n.assetUrl, i = await KA(a);
6850
+ const n = e.data, a = n.assetUrl, i = await jA(a);
6851
6851
  try {
6852
6852
  const s = Nt(n, t.option);
6853
6853
  s && (A[t.stepName] = { selectedVariants: [s] });
@@ -6904,7 +6904,7 @@ const wa = [
6904
6904
  const n = e.data, a = t.option;
6905
6905
  if (!a)
6906
6906
  return console.error(`No option for step ${t.stepName}.`), [];
6907
- const i = ((m = a.variants) == null ? void 0 : m.find((p) => p.id === n.illustrationVariantId)) || NA(a);
6907
+ const i = ((m = a.variants) == null ? void 0 : m.find((p) => p.id === n.illustrationVariantId)) || HA(a);
6908
6908
  if (!i)
6909
6909
  return console.error(`No variant with ID: ${n.illustrationVariantId}`), [];
6910
6910
  if (!i.asset)
@@ -7003,7 +7003,7 @@ const wa = [
7003
7003
  const n = e.data, a = t.option;
7004
7004
  if (!a)
7005
7005
  return console.error(`No option for step ${t.stepName}.`), [];
7006
- const i = ((g = a.variants) == null ? void 0 : g.find((l) => l.id === n.pictureVariantId)) || NA(a);
7006
+ const i = ((g = a.variants) == null ? void 0 : g.find((l) => l.id === n.pictureVariantId)) || HA(a);
7007
7007
  if (!i)
7008
7008
  return console.error(`No variant with ID: ${n.pictureVariantId}`), [];
7009
7009
  if (!i.asset)
@@ -7045,7 +7045,7 @@ const wa = [
7045
7045
  const n = e.data, a = t.option;
7046
7046
  if (!a)
7047
7047
  return console.error(`No option for step ${t.stepName}.`), [];
7048
- const i = ((r = a.variants) == null ? void 0 : r.find((g) => g.id === n.colorVariantId)) || NA(a);
7048
+ const i = ((r = a.variants) == null ? void 0 : r.find((g) => g.id === n.colorVariantId)) || HA(a);
7049
7049
  if (!i)
7050
7050
  return console.error(`No variant with ID: ${n.colorVariantId}`), [];
7051
7051
  A[t.stepName] = { selectedVariants: [i] };
@@ -7170,7 +7170,7 @@ const wa = [
7170
7170
  const E = t.option;
7171
7171
  if (!E)
7172
7172
  return;
7173
- const Q = ((f = E.variants) == null ? void 0 : f.find((u) => u.id === a.fontVariantId)) || NA(E);
7173
+ const Q = ((f = E.variants) == null ? void 0 : f.find((u) => u.id === a.fontVariantId)) || HA(E);
7174
7174
  if (!Q || !Q.asset)
7175
7175
  return;
7176
7176
  A[t.stepName] = { selectedVariants: [Q] };
@@ -7186,7 +7186,7 @@ const wa = [
7186
7186
  assetUrl: E,
7187
7187
  name: Q.names.fullName.en
7188
7188
  };
7189
- })(), B = (t.data.replaceableText ? t.data.replaceableText.replace("{{}}", a.text) : a.text) || "", l = jA(B, {
7189
+ })(), B = (t.data.replaceableText ? t.data.replaceableText.replace("{{}}", a.text) : a.text) || "", l = VA(B, {
7190
7190
  vertical: t.data.vertical,
7191
7191
  uppercase: t.data.uppercase
7192
7192
  }), d = async (E) => {
@@ -7227,7 +7227,7 @@ const wa = [
7227
7227
  g,
7228
7228
  E,
7229
7229
  [
7230
- jA(l, {
7230
+ VA(l, {
7231
7231
  vertical: t.data.vertical,
7232
7232
  uppercase: t.data.uppercase
7233
7233
  })
@@ -7386,7 +7386,7 @@ class ya {
7386
7386
  * Actions to perform when a static render event is fired for this canvas.
7387
7387
  */
7388
7388
  async render(A, e, t) {
7389
- const n = HA(e);
7389
+ const n = RA(e);
7390
7390
  this.lastRequestedRenderArguments = {
7391
7391
  workflow: A,
7392
7392
  layouts: n,
@@ -8079,7 +8079,7 @@ class qa {
8079
8079
  async setAspect(A, e) {
8080
8080
  if (!this.globalPropertyState)
8081
8081
  throw new Error("Global property state not initialized");
8082
- const t = HA(this.globalPropertyState), n = this.globalPropertyState.aspects.find((a) => a.name === A);
8082
+ const t = RA(this.globalPropertyState), n = this.globalPropertyState.aspects.find((a) => a.name === A);
8083
8083
  n ? n.value = e : this.globalPropertyState.aspects.push({ name: A, value: e }), await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(t, this.globalPropertyState);
8084
8084
  }
8085
8085
  async updateGlobalPropertyState() {
@@ -8235,14 +8235,14 @@ class $a {
8235
8235
  getProducts() {
8236
8236
  if (!this.collection.productCollectionProducts)
8237
8237
  throw new Error("Failed to find products on collection. Ensure you fetch them first!");
8238
- return this.collection.productCollectionProducts.map((A) => new TA(A));
8238
+ return this.collection.productCollectionProducts.map((A) => new OA(A));
8239
8239
  }
8240
8240
  /**
8241
8241
  * A list of products in this collections with useful helpers for interacting with them.
8242
8242
  */
8243
8243
  async fetchProducts() {
8244
8244
  if (this.collection.productCollectionProducts)
8245
- return this.collection.productCollectionProducts.map((e) => new TA(e));
8245
+ return this.collection.productCollectionProducts.map((e) => new OA(e));
8246
8246
  const A = await P.getShadowGraphqlClient().query({
8247
8247
  query: Ha,
8248
8248
  variables: {
@@ -8251,7 +8251,7 @@ class $a {
8251
8251
  errorPolicy: "all",
8252
8252
  fetchPolicy: "no-cache"
8253
8253
  });
8254
- return this.collection.productCollectionProducts = A.data.productCollections[0].productCollectionProducts || [], this.collection.productCollectionProducts.map((e) => new TA(e));
8254
+ return this.collection.productCollectionProducts = A.data.productCollections[0].productCollectionProducts || [], this.collection.productCollectionProducts.map((e) => new OA(e));
8255
8255
  }
8256
8256
  getTransformCollection() {
8257
8257
  if (this.collection.transformCollection)
@@ -8264,7 +8264,7 @@ class $a {
8264
8264
  return this.collection;
8265
8265
  }
8266
8266
  }
8267
- class TA {
8267
+ class OA {
8268
8268
  constructor(A) {
8269
8269
  this.product = A.product, this.productResource = A;
8270
8270
  }
@@ -8312,10 +8312,10 @@ class TA {
8312
8312
  if (e) {
8313
8313
  const n = A.find((a) => a.workflowName === e);
8314
8314
  if (n)
8315
- return new ZA(n);
8315
+ return new NA(n);
8316
8316
  }
8317
8317
  const t = A[0];
8318
- return new ZA(t);
8318
+ return new NA(t);
8319
8319
  }
8320
8320
  /**
8321
8321
  * A list of all integrations this product is connected to.
@@ -8362,7 +8362,7 @@ class TA {
8362
8362
  ), (s = t == null ? void 0 : t.additionalIntegrationProduct) != null && s.product ? e + (t.additionalIntegrationProduct.product.basePrice || 0) : e;
8363
8363
  }
8364
8364
  }
8365
- class ZA {
8365
+ class NA {
8366
8366
  constructor(A) {
8367
8367
  this.workflow = A;
8368
8368
  }
@@ -8443,7 +8443,7 @@ class Fe {
8443
8443
  this.id,
8444
8444
  this.ownerId,
8445
8445
  this.checkConditionalHandlesChanged.bind(this)
8446
- ), this.globalPropertyHandleService = new Oa(this), this.setPreviewService(t), this.initializationPromise = this.loadExistingBundles(
8446
+ ), this.globalPropertyHandleService = new Oa(this), this.setPreviewService(t), this.initializationPromise = this.loadExistingWorkflowExperiences(
8447
8447
  ((s = e.transactions) == null ? void 0 : s.map((o) => o.id)) || [],
8448
8448
  n
8449
8449
  );
@@ -8785,7 +8785,7 @@ class Fe {
8785
8785
  await e;
8786
8786
  }
8787
8787
  }
8788
- async loadExistingBundles(A, e) {
8788
+ async loadExistingWorkflowExperiences(A, e) {
8789
8789
  if (A.length === 0)
8790
8790
  return;
8791
8791
  const t = await this.client.getWorkflowExperiences(
@@ -9059,7 +9059,17 @@ class Me {
9059
9059
  throw new Error(
9060
9060
  "No workflows found on product. This is generally due to a configuration error. Please confirm at least one workflow is configured for this product."
9061
9061
  );
9062
- return new ZA(A[0]);
9062
+ return new NA(A[0]);
9063
+ }
9064
+ getAllWorkflows() {
9065
+ if (!this.integrationProduct.product)
9066
+ throw new Error("IntegrationProductResource does not have a product");
9067
+ const A = this.integrationProduct.product.workflows || [];
9068
+ if (A.length === 0)
9069
+ throw new Error(
9070
+ "No workflows found on product. This is generally due to a configuration error. Please confirm at least one workflow is configured for this product."
9071
+ );
9072
+ return A.sort((e, t) => (e.index ?? 0) - (t.index ?? 0)).map((e) => new NA(e));
9063
9073
  }
9064
9074
  }
9065
9075
  const ii = F`
@@ -9183,7 +9193,7 @@ const ii = F`
9183
9193
  name
9184
9194
  }
9185
9195
  `, ci = (c) => F`
9186
- ${GA(c)}
9196
+ ${vA(c)}
9187
9197
  ${ie}
9188
9198
  ${Ke}
9189
9199
  ${ii}
@@ -9603,7 +9613,7 @@ const ii = F`
9603
9613
  }
9604
9614
  }
9605
9615
  `, Bi = F`
9606
- ${GA(!1)}
9616
+ ${vA(!1)}
9607
9617
  query GetWorkflowForTheme($id: String!) {
9608
9618
  workflow(id: $id) {
9609
9619
  id
@@ -9765,7 +9775,7 @@ const ii = F`
9765
9775
  previewRegion: A.previewRegion,
9766
9776
  useEditableArea: A.useEditableArea,
9767
9777
  editableArea: A.editableArea
9768
- })), OA = (c, A) => {
9778
+ })), zA = (c, A) => {
9769
9779
  const e = c.workflowState, t = e ? JSON.parse(e) : void 0;
9770
9780
  return t ? Object.values(t.layouts).map((n) => n.layout) : mi(A.panels);
9771
9781
  };
@@ -10168,7 +10178,7 @@ class Ii {
10168
10178
  const E = JSON.parse(n.workflowState);
10169
10179
  r.layouts = Object.values(E.layouts).map((Q) => Q.layout), await AA(E), await eA(E), r.reloadedState = E;
10170
10180
  } else
10171
- r.layouts = OA(
10181
+ r.layouts = zA(
10172
10182
  r.transaction,
10173
10183
  r.workflow
10174
10184
  );
@@ -10280,7 +10290,7 @@ class Ii {
10280
10290
  const b = JSON.parse(Y.workflowState);
10281
10291
  H.layouts = Object.values(b.layouts).map((V) => V.layout), await AA(b), await eA(b), H.reloadedState = b;
10282
10292
  } else
10283
- H.layouts = OA(
10293
+ H.layouts = zA(
10284
10294
  H.transaction,
10285
10295
  H.workflow
10286
10296
  );
@@ -10447,7 +10457,7 @@ class Ii {
10447
10457
  const d = JSON.parse(e);
10448
10458
  this.experienceOptions.layouts = Object.values(d.layouts).map((w) => w.layout), await AA(d), await eA(d), this.experienceOptions.reloadedState = d;
10449
10459
  } else
10450
- this.experienceOptions.layouts = OA(
10460
+ this.experienceOptions.layouts = zA(
10451
10461
  this.experienceOptions.transaction,
10452
10462
  this.experienceOptions.workflow
10453
10463
  );
@@ -10656,7 +10666,7 @@ class fi extends W {
10656
10666
  }
10657
10667
  selectVariant(A) {
10658
10668
  const e = this.manager.getRegionElements(this.step.stepName);
10659
- return WA.selectVariant(
10669
+ return XA.selectVariant(
10660
10670
  this.step,
10661
10671
  A.getResource(),
10662
10672
  e,
@@ -10670,7 +10680,7 @@ class fi extends W {
10670
10680
  });
10671
10681
  }
10672
10682
  selectImage(A) {
10673
- return WA.selectImage(this.step, A, this.manager);
10683
+ return XA.selectImage(this.step, A, this.manager);
10674
10684
  }
10675
10685
  getImageData() {
10676
10686
  if (this.frameService)
@@ -10697,7 +10707,7 @@ export {
10697
10707
  Ki as BringToBackCommand,
10698
10708
  ji as BringToFrontCommand,
10699
10709
  Vi as CanvasCommand,
10700
- TA as CollectionProduct,
10710
+ OA as CollectionProduct,
10701
10711
  Wi as CommandContext,
10702
10712
  cn as ConversionDataType,
10703
10713
  rn as ConversionLocation,
@@ -10736,7 +10746,7 @@ export {
10736
10746
  Aa as PictureStepHandle,
10737
10747
  on as ProductCameraRig,
10738
10748
  $a as ProductCollection,
10739
- ZA as ProductWorkflow,
10749
+ NA as ProductWorkflow,
10740
10750
  gA as PromiseCache,
10741
10751
  Xe as PromiseQueue,
10742
10752
  ea as QuestionStepHandle,
@@ -10763,12 +10773,12 @@ export {
10763
10773
  O as assetService,
10764
10774
  ga as createDesign,
10765
10775
  ds as dataUrlFromExternalUrl,
10766
- LA as designService,
10776
+ TA as designService,
10767
10777
  ws as determineCorrectFontSizeAndLines,
10768
10778
  Dn as digitalContentStepService,
10769
10779
  Es as findElement,
10770
10780
  hs as frameDataCache,
10771
- WA as frameStepService,
10781
+ XA as frameStepService,
10772
10782
  Cs as generate,
10773
10783
  Da as generateCommands,
10774
10784
  Qs as generateSVGWithUnknownColors,