@spiffcommerce/core 16.4.1 → 16.4.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHttpLink as Qt, InMemoryCache as ut, ApolloClient as mt, from as pt, gql as M } from "@apollo/client/core";
2
- import { fetch as Ae, getAttributesFromArrayBuffer as fe, AssetType as ge, StepType as I, StepAspectType as O, getFrameData as ee, frameDataCache as It, UpdateFramePattern as Fe, calculateOffsets as te, LayoutElementType as U, generate as k, CreateElementCommand as J, generateSVGWithUnknownColors as Me, svgObjectURL as FA, fetchAsString as Z, DeleteElementCommand as $, GroupCommand as G, generateDefaultRectangleFrameSvg as le, GetSVGDimensions as Dt, patternImageDataCache as Be, fetchAsArrayBuffer as ye, findElement as MA, modifySVGWithElementProperties as ft, IllustrationColorCommand as VA, IllustrationCacheCommand as Ft, getFontMetrics as Mt, getPatternImageData as WA, FontColorCommand as yt, FontImageFillCommand as TA, applyTextTransformations as XA, determineCorrectFontSizeAndLines as IA, FontSourceCommand as de, loadFontFromExternalUrl as Ye, TextChangeCommand as Yt, FontSizeCommand as St, createElementNS as xt, createElement as wA, loadFontFromDataUrl as UA, UpdateWorkflowStateCommand as we, CommandContext as Nt, createCanvas as yA, getSvgElement as Se, LayoutRenderingPurpose as xe, renderPapyrusComponentAsString as Ne, loadImage as Re, getDomParser as Pe, toBase64 as Ee, getVariant as Rt, generateFrameSVG as Pt, getDefaultVariant as GA, domParser as He, sanitizeSvgTree as Ue, traverse as Ht, xmlSerializer as Ge, arrayBufferToDataUrl as Ut, loadFontFaceSet as Gt, CreateLayoutCommand as vt, sortElementsByLayersWithIndex as kt, AspectType as DA, rehydrateSerializedLayout as AA } from "@spiffcommerce/papyrus";
2
+ import { fetch as FA, getAttributesFromArrayBuffer as fe, AssetType as ge, StepType as I, StepAspectType as O, getFrameData as ee, frameDataCache as It, UpdateFramePattern as Fe, calculateOffsets as te, LayoutElementType as U, generate as k, CreateElementCommand as J, generateSVGWithUnknownColors as Me, svgObjectURL as MA, fetchAsString as Z, DeleteElementCommand as $, GroupCommand as G, generateDefaultRectangleFrameSvg as le, GetSVGDimensions as Dt, patternImageDataCache as Be, fetchAsArrayBuffer as ye, findElement as yA, modifySVGWithElementProperties as ft, IllustrationColorCommand as WA, IllustrationCacheCommand as Ft, getFontMetrics as Mt, getPatternImageData as XA, FontColorCommand as yt, FontImageFillCommand as LA, applyTextTransformations as qA, determineCorrectFontSizeAndLines as IA, FontSourceCommand as de, loadFontFromExternalUrl as Ye, TextChangeCommand as Yt, FontSizeCommand as St, createElementNS as xt, createElement as wA, loadFontFromDataUrl as GA, UpdateWorkflowStateCommand as we, CommandContext as Nt, createCanvas as YA, getSvgElement as Se, LayoutRenderingPurpose as xe, renderPapyrusComponentAsString as Ne, loadImage as Re, getDomParser as Pe, toBase64 as Ee, getVariant as Rt, generateFrameSVG as Pt, getDefaultVariant as vA, domParser as He, sanitizeSvgTree as Ue, traverse as Ht, xmlSerializer as Ge, arrayBufferToDataUrl as Ut, loadFontFaceSet as Gt, CreateLayoutCommand as vt, sortElementsByLayersWithIndex as kt, AspectType as DA, rehydrateSerializedLayout as AA } from "@spiffcommerce/papyrus";
3
3
  import { AssetType as Os, BringForwardCommand as zs, BringToBackCommand as Ks, BringToFrontCommand as js, CanvasCommand as Vs, CommandContext as Ws, CreateElementCommand as Xs, CreateLayoutCommand as qs, DeleteElementCommand as Zs, FontAlignmentCommand as $s, FontColorCommand as _s, FontSizeCommand as Ai, FontSourceCommand as ei, GroupCommand as ti, LayoutElementFactory as ai, LayoutElementType as ni, MoveCommand as si, ResizeCommand as ii, RotateCommand as oi, SendBackwardsCommand as ri, StepAspectType as ci, StepType as gi, TextChangeCommand as li, UnitOfMeasurement as Bi, dataUrlFromExternalUrl as di, determineCorrectFontSizeAndLines as wi, findElement as Ei, frameDataCache as hi, generate as Ci, generateSVGWithUnknownColors as Qi, getAttributesFromArrayBuffer as ui, getAxisAlignedBoundingBox as mi, getFrameData as pi, getSvgElement as Ii, loadFontFromDataUrl as Di, loadFontFromExternalUrl as fi, patternImageDataCache as Fi, registerFetchImplementation as Mi, registerWindowImplementation as yi, rehydrateSerializedLayout as Yi } from "@spiffcommerce/papyrus";
4
4
  import { setContext as Jt } from "@apollo/client/link/context";
5
5
  import { onError as bt } from "@apollo/client/link/error";
@@ -8,7 +8,7 @@ import ke from "lodash.debounce";
8
8
  import Je from "lodash.isequal";
9
9
  import gA from "lodash.clonedeep";
10
10
  import { toString as be } from "qrcode";
11
- import { split as qA } from "unicode-default-word-boundary";
11
+ import { split as ZA } from "unicode-default-word-boundary";
12
12
  import ae from "svg-path-bbox";
13
13
  class Te extends Error {
14
14
  constructor(A) {
@@ -20,7 +20,7 @@ class dA extends Te {
20
20
  super(`ConfigurationError - ${A}`);
21
21
  }
22
22
  }
23
- class YA extends dA {
23
+ class SA extends dA {
24
24
  constructor(A) {
25
25
  super(`Option not Configured: ${A.stepTitle}`), this.optionId = (A == null ? void 0 : A.optionId) || "N/A";
26
26
  }
@@ -40,32 +40,32 @@ class lA extends dA {
40
40
  super(`Resource not found for asset: ${A.name}`), this.asset = A;
41
41
  }
42
42
  }
43
- class SA extends dA {
43
+ class xA extends dA {
44
44
  constructor(A, e) {
45
45
  super(`Workflow Misconfiguration: ${A.stepName} - ${e}`), this.step = A;
46
46
  }
47
47
  }
48
- class vA extends Te {
48
+ class kA extends Te {
49
49
  constructor(A) {
50
50
  super(`ImplementationError - ${A}`);
51
51
  }
52
52
  }
53
- class v extends vA {
53
+ class v extends kA {
54
54
  constructor(A) {
55
55
  super(`Unhandled Behavior Encountered: ${A}`);
56
56
  }
57
57
  }
58
- class rA extends vA {
58
+ class rA extends kA {
59
59
  constructor(A) {
60
60
  super(`Parsing Error: ${A}`);
61
61
  }
62
62
  }
63
- class H extends vA {
63
+ class H extends kA {
64
64
  constructor(A) {
65
65
  super(`Client Error: ${A}`);
66
66
  }
67
67
  }
68
- class kA extends vA {
68
+ class JA extends kA {
69
69
  constructor(A) {
70
70
  super(`Resource Generation Failed: ${A}`);
71
71
  }
@@ -146,13 +146,13 @@ class Ot {
146
146
  this.serverUrlCallbacks.push(A);
147
147
  }
148
148
  }
149
- const xA = new Ot();
149
+ const NA = new Ot();
150
150
  let Le;
151
151
  const eA = (g) => {
152
152
  Le = g;
153
153
  };
154
154
  let Oe;
155
- const LA = (g) => {
155
+ const OA = (g) => {
156
156
  Oe = g;
157
157
  };
158
158
  let ze;
@@ -163,7 +163,7 @@ let Ke;
163
163
  const zt = (g) => {
164
164
  Ke = g;
165
165
  }, Kt = () => new Promise((g) => {
166
- const A = xA.getHubUrl(), e = (t) => {
166
+ const A = NA.getHubUrl(), e = (t) => {
167
167
  t.origin === A && (window.removeEventListener("message", e), g(t.data));
168
168
  };
169
169
  window.parent !== window && (window.addEventListener("message", e, !1), window.parent.postMessage("ready", A));
@@ -178,7 +178,7 @@ const zt = (g) => {
178
178
  };
179
179
  class Vt {
180
180
  constructor() {
181
- this.shadowGraphqlClient = this.constructShadowGraphqlClient(), xA.addServerUrlCallback(() => {
181
+ this.shadowGraphqlClient = this.constructShadowGraphqlClient(), NA.addServerUrlCallback(() => {
182
182
  this.shadowGraphqlClient = this.constructShadowGraphqlClient();
183
183
  });
184
184
  }
@@ -186,9 +186,10 @@ class Vt {
186
186
  return this.shadowGraphqlClient;
187
187
  }
188
188
  constructShadowGraphqlClient() {
189
+ console.log(`constructing shadow gql client with ${FA.__spiffId}`);
189
190
  const A = Qt({
190
- uri: `${xA.getServerUrl()}/graphql`,
191
- fetch: Ae
191
+ uri: `${NA.getServerUrl()}/graphql`,
192
+ fetch: FA
192
193
  }), e = Jt(async (s, i) => {
193
194
  const { headers: o } = i, r = o || {}, c = await jt(), B = i.bearer ?? c.bearer, l = i.partnerId ?? c.partnerId, d = i.activeIntegration ?? c.activeIntegration, E = i.transactionOwnerId ?? c.transactionOwnerId, h = i.customerToken ?? c.customerToken, w = i.applicationKey ?? c.applicationKey, Q = i.bundleOwnerId ?? c.bundleOwnerId;
194
195
  return B && (r.Authorization = `Bearer ${B}`), l && (r.partnerId = l), d && (r.activeIntegration = d), E && (r.transactionOwnerId = E), h && (r.customerToken = h), w && (r["X-Application-Key"] = w), Q && (r.bundleOwnerId = Q), {
@@ -258,7 +259,7 @@ const x = new Vt(), Wt = M`
258
259
  value
259
260
  }
260
261
  }
261
- `, JA = (g) => M`
262
+ `, bA = (g) => M`
262
263
  ${g && Wt || ""}
263
264
  fragment AssetFields on Asset {
264
265
  name
@@ -274,7 +275,7 @@ const x = new Vt(), Wt = M`
274
275
  ${g && "...AssetMetadataFields" || ""}
275
276
  }
276
277
  `, Xt = M`
277
- ${JA(!1)}
278
+ ${bA(!1)}
278
279
  query GetAssets($keys: [String]!) {
279
280
  assets(keys: $keys) {
280
281
  ...AssetFields
@@ -439,7 +440,7 @@ class Aa {
439
440
  c.lengthComputable && t(c.loaded * 100 / c.total);
440
441
  }, r.onload = () => {
441
442
  const c = s.assetResponse.asset;
442
- OA.add(s.assetResponse.asset), i(c);
443
+ zA.add(s.assetResponse.asset), i(c);
443
444
  }, r.onerror = o, r.send(A.blob);
444
445
  }), s.assetResponse.asset;
445
446
  }
@@ -457,10 +458,10 @@ class Aa {
457
458
  }
458
459
  }
459
460
  removePersistedAsset(A) {
460
- OA.remove(A);
461
+ zA.remove(A);
461
462
  }
462
463
  getPersistedAssets() {
463
- return OA.list();
464
+ return zA.list();
464
465
  }
465
466
  /**
466
467
  * Handles mimeType resolution & asset creation request
@@ -490,7 +491,7 @@ class Aa {
490
491
  }
491
492
  }
492
493
  const sA = "persistentAssets";
493
- class OA {
494
+ class zA {
494
495
  /**
495
496
  * Add a new asset to persistence
496
497
  * @param asset The asset to add.
@@ -587,7 +588,7 @@ const BA = new ea(), Ve = M`
587
588
  }
588
589
  }
589
590
  `, ta = M`
590
- ${JA(!1)}
591
+ ${bA(!1)}
591
592
  ${ne}
592
593
  ${Ve}
593
594
  query GetOptions($ids: [String]!) {
@@ -673,7 +674,7 @@ class ia {
673
674
  }
674
675
  }
675
676
  const z = new ia();
676
- var oa = /* @__PURE__ */ ((g) => (g[g.Orbit = 0] = "Orbit", g[g.Pan = 1] = "Pan", g))(oa || {}), ra = /* @__PURE__ */ ((g) => (g.PerVariation = "PerVariation", g.BaseProduct = "BaseProduct", g))(ra || {}), ca = /* @__PURE__ */ ((g) => (g.Manual = "Manual", g.OnStart = "OnStart", g.OnQuit = "OnQuit", g.OnEnd = "OnEnd", g))(ca || {}), ga = /* @__PURE__ */ ((g) => (g.Email = "Email", g.FirstName = "FirstName", g.LastName = "LastName", g.Phone = "Phone", g))(ga || {}), NA = /* @__PURE__ */ ((g) => (g.Owner = "Owner", g.Approver = "Approver", g.Editor = "Editor", g.Viewer = "Viewer", g))(NA || {});
677
+ var oa = /* @__PURE__ */ ((g) => (g[g.Orbit = 0] = "Orbit", g[g.Pan = 1] = "Pan", g))(oa || {}), ra = /* @__PURE__ */ ((g) => (g.PerVariation = "PerVariation", g.BaseProduct = "BaseProduct", g))(ra || {}), ca = /* @__PURE__ */ ((g) => (g.Manual = "Manual", g.OnStart = "OnStart", g.OnQuit = "OnQuit", g.OnEnd = "OnEnd", g))(ca || {}), ga = /* @__PURE__ */ ((g) => (g.Email = "Email", g.FirstName = "FirstName", g.LastName = "LastName", g.Phone = "Phone", g))(ga || {}), RA = /* @__PURE__ */ ((g) => (g.Owner = "Owner", g.Approver = "Approver", g.Editor = "Editor", g.Viewer = "Viewer", g))(RA || {});
677
678
  const Qe = M`
678
679
  mutation CreateTransaction(
679
680
  $integrationProductId: String
@@ -1599,7 +1600,7 @@ class ue {
1599
1600
  if (this.configuration.type === I.ProductOverlay) {
1600
1601
  let l = "";
1601
1602
  if ((o = this.product) != null && o.overlayImageUrl && (l = this.product.overlayImageUrl), s = l, !l)
1602
- throw new SA(this.configuration, "Couldn't find an asset for product overlay step");
1603
+ throw new xA(this.configuration, "Couldn't find an asset for product overlay step");
1603
1604
  }
1604
1605
  const i = this.evaluateAssetType();
1605
1606
  if (i === U.Image) {
@@ -1642,7 +1643,7 @@ class ue {
1642
1643
  }))()), h = {
1643
1644
  stepName: this.configuration.stepName,
1644
1645
  id: k(),
1645
- cachedObjectURL: await FA(E.svg),
1646
+ cachedObjectURL: await MA(E.svg),
1646
1647
  src: l,
1647
1648
  svg: E.svg,
1648
1649
  colors: E.colors,
@@ -1670,7 +1671,7 @@ class ue {
1670
1671
  }
1671
1672
  async trigger() {
1672
1673
  if (!this.configuration.data.regions)
1673
- throw new SA(this.configuration, "Missing regions.");
1674
+ throw new xA(this.configuration, "Missing regions.");
1674
1675
  if (this.configuration.type === I.SilentIllustration) {
1675
1676
  const A = this.configuration.data.regions.map(this.processRegion);
1676
1677
  return Promise.all(A);
@@ -1690,7 +1691,7 @@ class ue {
1690
1691
  }
1691
1692
  }
1692
1693
  const Ia = async (g) => {
1693
- const A = `${xA.getServicesApiUrl()}/shortener`;
1694
+ const A = `${NA.getServicesApiUrl()}/shortener`;
1694
1695
  try {
1695
1696
  return (await (await fetch(A, {
1696
1697
  method: "POST",
@@ -1700,7 +1701,7 @@ const Ia = async (g) => {
1700
1701
  }
1701
1702
  })).json()).shortUrl;
1702
1703
  } catch (e) {
1703
- throw console.error(e), new kA("Failed to shorten URL, see console.");
1704
+ throw console.error(e), new JA("Failed to shorten URL, see console.");
1704
1705
  }
1705
1706
  };
1706
1707
  class $e {
@@ -1774,10 +1775,10 @@ class Da {
1774
1775
  d.searchParams.append("video", btoa(JSON.stringify([B]))), d.pathname = d.pathname + (d.pathname.slice(-1) === "/" ? "" : "/");
1775
1776
  const E = d.toString();
1776
1777
  if (E.length >= 2e3)
1777
- throw new kA("Cannot create QR code, URL too long.");
1778
+ throw new JA("Cannot create QR code, URL too long.");
1778
1779
  const h = await Ia(E);
1779
1780
  if (i(h), !s.data || !s.data.regions)
1780
- throw new SA(s, "Missing regions.");
1781
+ throw new xA(s, "Missing regions.");
1781
1782
  const w = await this.regionElements(s), Q = await this.command(h, w, n, s.stepName);
1782
1783
  Q && (Q.command && n.getCommandDispatcher()(Q.command), Q.followup && await Q.followup()), await n.setSelectionsAndElements(s.stepName, [], w, async () => {
1783
1784
  n.updateStorage(s.stepName, {
@@ -1928,7 +1929,7 @@ class Fa {
1928
1929
  });
1929
1930
  },
1930
1931
  () => {
1931
- throw new kA("Failed to resolve transcoded PDF");
1932
+ throw new JA("Failed to resolve transcoded PDF");
1932
1933
  }
1933
1934
  )
1934
1935
  ) : this.loadPatternFromAsset(e, A, t);
@@ -2078,7 +2079,7 @@ class Fa {
2078
2079
  }), t.markUpdateCompleted(n);
2079
2080
  }
2080
2081
  }
2081
- const ZA = new Fa();
2082
+ const $A = new Fa();
2082
2083
  class Ma {
2083
2084
  async getIllustrationBody(A) {
2084
2085
  return new Promise((e) => {
@@ -2115,7 +2116,7 @@ class Ma {
2115
2116
  if (t.length === 0)
2116
2117
  return [];
2117
2118
  try {
2118
- return MA(
2119
+ return yA(
2119
2120
  t[0].id,
2120
2121
  e.getAllLayoutData()
2121
2122
  ).colors;
@@ -2180,10 +2181,10 @@ class Ma {
2180
2181
  const s = {};
2181
2182
  for (const [B, l] of n.entries())
2182
2183
  s[B] = { browserValue: l, spotColor: (c = s[B]) == null ? void 0 : c.spotColor };
2183
- const i = ft(A, e, t, s), o = await FA(i), r = [];
2184
+ const i = ft(A, e, t, s), o = await MA(i), r = [];
2184
2185
  for (const B of a) {
2185
2186
  for (const [l, d] of n.entries())
2186
- r.push(new VA(B, l, d));
2187
+ r.push(new WA(B, l, d));
2187
2188
  r.push(new Ft(B, i, o));
2188
2189
  }
2189
2190
  return new G(r);
@@ -2192,7 +2193,7 @@ class Ma {
2192
2193
  var d, E;
2193
2194
  if (e.length === 0)
2194
2195
  return;
2195
- const s = MA(
2196
+ const s = yA(
2196
2197
  e[0].id,
2197
2198
  a().map((h) => h.layoutState)
2198
2199
  ), i = { ...s.colors }, o = {};
@@ -2233,7 +2234,7 @@ class Ma {
2233
2234
  async selectVariantCommand(A, e, t, a, n) {
2234
2235
  var Q;
2235
2236
  if (!A.data || !A.data.regions)
2236
- throw new SA(A, "Missing regions.");
2237
+ throw new xA(A, "Missing regions.");
2237
2238
  a(!0);
2238
2239
  const s = t.map((C) => new $(C.id));
2239
2240
  n.setMandatoryFulfilled(A.stepName, !1);
@@ -2243,7 +2244,7 @@ class Ma {
2243
2244
  const o = i.fileLink;
2244
2245
  if (!o)
2245
2246
  throw new lA(i);
2246
- const r = await Me(await this.getIllustrationBody(o)), c = await FA(r.svg), B = (C) => {
2247
+ const r = await Me(await this.getIllustrationBody(o)), c = await MA(r.svg), B = (C) => {
2247
2248
  const u = n.getLayouts().find((p) => p.panelId === C.panelId);
2248
2249
  if (!u)
2249
2250
  throw new T(C);
@@ -2285,7 +2286,7 @@ class ya {
2285
2286
  async init(A, e, t) {
2286
2287
  const a = A.option;
2287
2288
  if (!a)
2288
- throw new YA(A);
2289
+ throw new SA(A);
2289
2290
  if (t)
2290
2291
  await this.reload(A, e, t);
2291
2292
  else {
@@ -2303,7 +2304,7 @@ class ya {
2303
2304
  t.serializableWorkflow.steps
2304
2305
  ), i = Object.values(t.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === A.stepName), o = A.option;
2305
2306
  if (!o)
2306
- throw new YA(A);
2307
+ throw new SA(A);
2307
2308
  if (a != null && a.selectedVariants) {
2308
2309
  const c = a.selectedVariants[0].id;
2309
2310
  if (c) {
@@ -2359,7 +2360,7 @@ class Ya {
2359
2360
  async init(A, e, t) {
2360
2361
  const a = A.option;
2361
2362
  if (!a)
2362
- throw new YA(A);
2363
+ throw new SA(A);
2363
2364
  if (t)
2364
2365
  await this.reload(A, e, t);
2365
2366
  else {
@@ -2543,7 +2544,7 @@ class Sa {
2543
2544
  }
2544
2545
  if (!/^$|^[a-zA-Z0-9 ]+$/.test(e))
2545
2546
  return a("Unsupported characters."), !1;
2546
- const n = qA(e.toLowerCase());
2547
+ const n = ZA(e.toLowerCase());
2547
2548
  for (const s of n)
2548
2549
  for (const i in t) {
2549
2550
  const o = t[i].toLowerCase().replace(/\s/g, "");
@@ -2724,14 +2725,14 @@ class Pa {
2724
2725
  const o = i.region;
2725
2726
  if (!a.find((c) => c.panelId === (o == null ? void 0 : o.panelId)))
2726
2727
  throw new T(o);
2727
- return new VA(i.id, this.shapeFillId, A);
2728
+ return new WA(i.id, this.shapeFillId, A);
2728
2729
  }).filter((i) => !!i);
2729
2730
  t.getCommandDispatcher()(new G(s)), t.updateStorage(e.stepName, { colour: A });
2730
2731
  }
2731
2732
  async init(A, e, t) {
2732
2733
  const a = A.option;
2733
2734
  if (!a)
2734
- throw new YA(A);
2735
+ throw new SA(A);
2735
2736
  if (t)
2736
2737
  await this.reload(A, e, t);
2737
2738
  else {
@@ -2796,7 +2797,7 @@ class Pa {
2796
2797
  if (!n.find((h) => h.panelId === (l == null ? void 0 : l.panelId)))
2797
2798
  throw new T(l);
2798
2799
  const E = i();
2799
- return new VA(B.id, this.shapeFillId, E);
2800
+ return new WA(B.id, this.shapeFillId, E);
2800
2801
  }, c = t.map(r).filter((B) => !!B);
2801
2802
  return {
2802
2803
  command: new G(c),
@@ -2900,17 +2901,17 @@ class Ha {
2900
2901
  );
2901
2902
  }
2902
2903
  }
2903
- const Ua = new Ha(), zA = 30;
2904
- class RA extends Error {
2904
+ const Ua = new Ha(), KA = 30;
2905
+ class PA extends Error {
2905
2906
  constructor(A) {
2906
- super(A), Object.setPrototypeOf(this, new.target.prototype), this.name = RA.name;
2907
+ super(A), Object.setPrototypeOf(this, new.target.prototype), this.name = PA.name;
2907
2908
  }
2908
2909
  }
2909
2910
  const Ga = ["‘", "’", "“", "”", `
2910
2911
  `];
2911
- class PA extends Error {
2912
+ class HA extends Error {
2912
2913
  constructor(A) {
2913
- super(A), Object.setPrototypeOf(this, new.target.prototype), this.name = PA.name;
2914
+ super(A), Object.setPrototypeOf(this, new.target.prototype), this.name = HA.name;
2914
2915
  }
2915
2916
  }
2916
2917
  class va {
@@ -2932,7 +2933,7 @@ class va {
2932
2933
  }, this.textAlign = (A) => A.vertical ? "center" : A.textAlign || "center", this.getErrorsForText = (A, e, t) => {
2933
2934
  const a = [];
2934
2935
  e.data && e.data.maxLength && A.length > e.data.maxLength && a.push({ localizationKey: "workflow.steps.text.characterLimit" });
2935
- const n = t.getProfanities(), s = qA(A.toLowerCase());
2936
+ const n = t.getProfanities(), s = ZA(A.toLowerCase());
2936
2937
  for (const o of s)
2937
2938
  for (const r in n) {
2938
2939
  const c = n[r].toLowerCase().replace(/\s/g, "");
@@ -2953,7 +2954,7 @@ class va {
2953
2954
  if (t)
2954
2955
  await this.reload(A, e, t);
2955
2956
  else {
2956
- const o = this.getDefaultImageFillVariant(A.data), r = (n = o == null ? void 0 : o.asset) == null ? void 0 : n.fileLink, c = r ? await WA(r) : void 0, B = c ? {
2957
+ const o = this.getDefaultImageFillVariant(A.data), r = (n = o == null ? void 0 : o.asset) == null ? void 0 : n.fileLink, c = r ? await XA(r) : void 0, B = c ? {
2957
2958
  src: c.src,
2958
2959
  height: c.height,
2959
2960
  width: c.width,
@@ -2986,7 +2987,7 @@ class va {
2986
2987
  return null;
2987
2988
  }
2988
2989
  findLayoutElements(A, e) {
2989
- return A.getRegionElements(e.stepName).map((n) => MA(n.id, A.getAllLayoutData()));
2990
+ return A.getRegionElements(e.stepName).map((n) => yA(n.id, A.getAllLayoutData()));
2990
2991
  }
2991
2992
  /**
2992
2993
  * Get the colors that can be used for a given text step.
@@ -3039,7 +3040,7 @@ class va {
3039
3040
  })) == null ? void 0 : a.filter((s) => !!s)) || [];
3040
3041
  return Promise.all(
3041
3042
  n.map(async (s) => {
3042
- const i = await WA(s);
3043
+ const i = await XA(s);
3043
3044
  return {
3044
3045
  src: s,
3045
3046
  width: i.width,
@@ -3063,13 +3064,13 @@ class va {
3063
3064
  fillImage: e
3064
3065
  });
3065
3066
  for (const r of t) {
3066
- const c = new TA(r.id, e);
3067
+ const c = new LA(r.id, e);
3067
3068
  n(c);
3068
3069
  }
3069
3070
  }
3070
3071
  getProcessedInput(A, e, t) {
3071
3072
  const a = t ? A : this.injectReplaceableText(A, e);
3072
- return XA(a, {
3073
+ return qA(a, {
3073
3074
  vertical: e.vertical,
3074
3075
  uppercase: e.uppercase
3075
3076
  });
@@ -3197,12 +3198,12 @@ class va {
3197
3198
  if (a.length > 0) {
3198
3199
  const l = a.map((h) => new de(h.id, c));
3199
3200
  if (o) {
3200
- const h = a.map((w) => new TA(w.id, o));
3201
+ const h = a.map((w) => new LA(w.id, o));
3201
3202
  l.push(...h);
3202
3203
  }
3203
3204
  const d = await this.changeInputTextWithRegion(
3204
3205
  A,
3205
- A.data.size || zA,
3206
+ A.data.size || KA,
3206
3207
  c,
3207
3208
  t.text || "",
3208
3209
  t,
@@ -3227,7 +3228,7 @@ class va {
3227
3228
  n
3228
3229
  ), d = await this.changeInputTextWithRegion(
3229
3230
  A,
3230
- A.data.size || zA,
3231
+ A.data.size || KA,
3231
3232
  c,
3232
3233
  ((B = l[0]) == null ? void 0 : B.newElement.input) || t.text || A.data.defaultText || "",
3233
3234
  t,
@@ -3238,7 +3239,7 @@ class va {
3238
3239
  ), E = l.flatMap((w) => w.commands);
3239
3240
  if (o) {
3240
3241
  const w = l.map(
3241
- (Q) => new TA(Q.regionElement.id, o)
3242
+ (Q) => new LA(Q.regionElement.id, o)
3242
3243
  );
3243
3244
  E.push(...w);
3244
3245
  }
@@ -3266,7 +3267,7 @@ class va {
3266
3267
  const E = s.getLayouts().find((Q) => Q.panelId === l.panelId), h = k();
3267
3268
  try {
3268
3269
  if (!E)
3269
- throw new PA("Failed to find layout for region: " + l.panelId);
3270
+ throw new HA("Failed to find layout for region: " + l.panelId);
3270
3271
  const Q = t.colorOption;
3271
3272
  let C;
3272
3273
  if (Q && Q.variants) {
@@ -3283,7 +3284,7 @@ class va {
3283
3284
  stepName: A,
3284
3285
  align: this.textAlign(t),
3285
3286
  fill: n.color ? n.color : D,
3286
- fontSize: t.size || zA,
3287
+ fontSize: t.size || KA,
3287
3288
  fontData: a,
3288
3289
  id: h,
3289
3290
  layer: l.layer,
@@ -3333,10 +3334,10 @@ class va {
3333
3334
  fontData: a
3334
3335
  };
3335
3336
  } catch (Q) {
3336
- throw console.log(Q), new RA("Error adding font to region");
3337
+ throw console.log(Q), new PA("Error adding font to region");
3337
3338
  }
3338
3339
  }, B = await Promise.all(t.regions.map(c)).catch((l) => {
3339
- throw l instanceof RA ? (Ua.setLatestToast("Failed to load font.", HA.Error), l) : l instanceof PA ? l : new Error(l);
3340
+ throw l instanceof PA ? (Ua.setLatestToast("Failed to load font.", UA.Error), l) : l instanceof HA ? l : new Error(l);
3340
3341
  });
3341
3342
  return await s.setSelectionsAndElements(
3342
3343
  A,
@@ -3379,7 +3380,7 @@ class va {
3379
3380
  const Q = (() => {
3380
3381
  if (A.data && A.data.maxLength && l.length > A.data.maxLength)
3381
3382
  return c && c(!0), { info: "0" };
3382
- const p = s.getProfanities(), f = qA(l.toLowerCase());
3383
+ const p = s.getProfanities(), f = ZA(l.toLowerCase());
3383
3384
  for (const m of f)
3384
3385
  for (const y in p) {
3385
3386
  const Y = p[y].toLowerCase().replace(/\s/g, "");
@@ -4854,7 +4855,7 @@ class za extends se {
4854
4855
  return this.svg(A);
4855
4856
  }
4856
4857
  svg(A) {
4857
- const e = UA(ka), a = A !== "" ? ((s) => s.charAt(0).toUpperCase() + s.substr(1).toLowerCase())(A) : "", n = e.getPath(a, 0, 72, 72);
4858
+ const e = GA(ka), a = A !== "" ? ((s) => s.charAt(0).toUpperCase() + s.substr(1).toLowerCase())(A) : "", n = e.getPath(a, 0, 72, 72);
4858
4859
  return this.brandSvg(n, Ja);
4859
4860
  }
4860
4861
  brandSvg(A, e) {
@@ -4898,7 +4899,7 @@ class ja extends se {
4898
4899
  return this.svg(A);
4899
4900
  }
4900
4901
  svg(A) {
4901
- const e = UA(Ka), a = A !== "" ? ((o) => o.charAt(0).toUpperCase() + o.substr(1).toLowerCase())(A) : "", n = e.getPath(a, 0, 72, 72), s = A.length < this.shortLength, i = s ? this.backgroundShortSvg : this.backgroundSvg;
4902
+ const e = GA(Ka), a = A !== "" ? ((o) => o.charAt(0).toUpperCase() + o.substr(1).toLowerCase())(A) : "", n = e.getPath(a, 0, 72, 72), s = A.length < this.shortLength, i = s ? this.backgroundShortSvg : this.backgroundSvg;
4902
4903
  return this.brandSvg(n, i, s);
4903
4904
  }
4904
4905
  brandSvg(A, e, t) {
@@ -4946,7 +4947,7 @@ class Wa extends se {
4946
4947
  return this.svgElement(A, e);
4947
4948
  }
4948
4949
  svgElement(A, e) {
4949
- const t = UA(Va), n = A !== "" ? ((u) => u.charAt(0).toUpperCase() + u.substr(1).toLowerCase())(A) : "", s = t.getPath(n, 0, 72, 72), i = s.toSVG(2), o = s.getBoundingBox(), r = o.x2 - o.x1, c = s.toPathData(3), B = () => {
4950
+ const t = GA(Va), n = A !== "" ? ((u) => u.charAt(0).toUpperCase() + u.substr(1).toLowerCase())(A) : "", s = t.getPath(n, 0, 72, 72), i = s.toSVG(2), o = s.getBoundingBox(), r = o.x2 - o.x1, c = s.toPathData(3), B = () => {
4950
4951
  const u = P("g");
4951
4952
  u.classList.add("module-text-group");
4952
4953
  const D = P("defs");
@@ -4988,7 +4989,7 @@ async function ot(g) {
4988
4989
  return new Wa();
4989
4990
  throw new v(`Failed to resolve Module, Module ${g} not found`);
4990
4991
  }
4991
- var HA = /* @__PURE__ */ ((g) => (g.Error = "Error", g.Warning = "Warning", g.Info = "Info", g))(HA || {});
4992
+ var UA = /* @__PURE__ */ ((g) => (g.Error = "Error", g.Warning = "Warning", g.Info = "Info", g))(UA || {});
4992
4993
  const Xa = 1e3;
4993
4994
  class pe extends qe {
4994
4995
  constructor(A) {
@@ -5521,7 +5522,7 @@ class qa {
5521
5522
  B.connectWorkflowManager(this, c.stepName), this.stepSpecificServices[c.stepName] = {
5522
5523
  frameService: B
5523
5524
  }, t.push(
5524
- ZA.init(c, this, this.reloadedState)
5525
+ $A.init(c, this, this.reloadedState)
5525
5526
  );
5526
5527
  }
5527
5528
  break;
@@ -5720,7 +5721,7 @@ class X {
5720
5721
  return this.variantData.enabled;
5721
5722
  }
5722
5723
  }
5723
- const rt = class $A {
5724
+ const rt = class _A {
5724
5725
  constructor(A, e) {
5725
5726
  this.manager = A, this.step = e;
5726
5727
  }
@@ -5730,13 +5731,13 @@ const rt = class $A {
5730
5731
  * @param value The new value
5731
5732
  */
5732
5733
  setUpdateState(A) {
5733
- $A.updateState.set(this.step.stepName, A);
5734
+ _A.updateState.set(this.step.stepName, A);
5734
5735
  }
5735
5736
  /**
5736
5737
  * @returns Gets the current update state of this step. All step handles for this step will see this value.
5737
5738
  */
5738
5739
  getUpdateState() {
5739
- return !!$A.updateState.get(this.step.stepName);
5740
+ return !!_A.updateState.get(this.step.stepName);
5740
5741
  }
5741
5742
  /**
5742
5743
  * Gets the currently selected variant, or undefined if no variant is selected.
@@ -5911,7 +5912,7 @@ class _a extends j {
5911
5912
  const A = this.manager.getRegionElements(this.step.stepName) || [];
5912
5913
  if (A.length !== 0)
5913
5914
  try {
5914
- return MA(A[0].id, this.manager.getAllLayoutData()).colors;
5915
+ return yA(A[0].id, this.manager.getAllLayoutData()).colors;
5915
5916
  } catch (e) {
5916
5917
  console.error(e);
5917
5918
  }
@@ -6087,7 +6088,7 @@ class sn extends j {
6087
6088
  ...this.manager.getInformationResults(),
6088
6089
  {
6089
6090
  message: "An issue has occured with test",
6090
- messageType: HA.Error,
6091
+ messageType: UA.Error,
6091
6092
  stepID: this.step.stepName
6092
6093
  }
6093
6094
  ]);
@@ -6174,7 +6175,7 @@ class sn extends j {
6174
6175
  ...B,
6175
6176
  {
6176
6177
  message: `${l} - ${this.step.stepTitle}`,
6177
- messageType: HA.Error,
6178
+ messageType: UA.Error,
6178
6179
  stepID: this.step.stepName
6179
6180
  }
6180
6181
  ]);
@@ -6381,7 +6382,7 @@ const gt = M`
6381
6382
  }))
6382
6383
  }
6383
6384
  })).data) == null ? void 0 : e.designCreateMany;
6384
- }, _A = (g, A, e) => {
6385
+ }, Ae = (g, A, e) => {
6385
6386
  const t = (n) => {
6386
6387
  const s = {};
6387
6388
  if (n.type === "Frame") {
@@ -6421,7 +6422,7 @@ const gt = M`
6421
6422
  const a = {};
6422
6423
  let n;
6423
6424
  if (e) {
6424
- n = _A(e, A, !1);
6425
+ n = Ae(e, A, !1);
6425
6426
  for (const s of Object.keys(n))
6426
6427
  a[s] = {
6427
6428
  value: n[s],
@@ -6519,7 +6520,7 @@ const gt = M`
6519
6520
  F.errors && console.log("Server Error:", L.message);
6520
6521
  }), null) : R ?? null;
6521
6522
  })() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(t())), await g.updateStateWithServerImmediate(t), console.log("Server state is undefined @ Workflow completion"));
6522
- const l = g.getPreviewService(), d = (y = A == null ? void 0 : A.finalizeStepConfig) == null ? void 0 : y.lookAtAnimation, E = l && A.showModelOnFinishStep && !!d, h = o && _A(o, A, !0), w = o && _A(o, A, !1), Q = async (Y) => {
6523
+ const l = g.getPreviewService(), d = (y = A == null ? void 0 : A.finalizeStepConfig) == null ? void 0 : y.lookAtAnimation, E = l && A.showModelOnFinishStep && !!d, h = o && Ae(o, A, !0), w = o && Ae(o, A, !1), Q = async (Y) => {
6523
6524
  const F = {};
6524
6525
  let R = 0;
6525
6526
  if (Object.keys(n).length > 0)
@@ -6528,12 +6529,12 @@ const gt = M`
6528
6529
  for (let W = 0; W < L.selections.length; ++W) {
6529
6530
  const q = L.selections[W];
6530
6531
  if (V && (!Y || V.option && (V.option.variants || []).length > 1 && !V.data.hideSelectionInCart && !V.data.hideSelectionsInCart)) {
6531
- const bA = V.stepTitle;
6532
- F[bA] ? F[bA].push({
6532
+ const TA = V.stepTitle;
6533
+ F[TA] ? F[TA].push({
6533
6534
  id: q.id || "",
6534
6535
  name: q.name,
6535
6536
  priceModifier: q.priceModifier
6536
- }) : F[bA] = [
6537
+ }) : F[TA] = [
6537
6538
  {
6538
6539
  id: q.id || "",
6539
6540
  name: q.name,
@@ -6739,12 +6740,12 @@ class hn {
6739
6740
  throw new v("Unexpected storage method requested");
6740
6741
  }
6741
6742
  }
6742
- const KA = new hn();
6743
+ const jA = new hn();
6743
6744
  class CA {
6744
6745
  constructor(A, e) {
6745
6746
  var a;
6746
6747
  if (this.renderableScenes = [], this.renderableSceneCallbacks = [], this.debouncedSavedDesignUpdate = ke(async () => {
6747
- await KA.getSavedDesignByTransaction(
6748
+ await jA.getSavedDesignByTransaction(
6748
6749
  this.getWorkflowManager().getTransaction().id
6749
6750
  ) && this.save();
6750
6751
  }, 2500), this.getCanvasObjectURLAsync = async (n) => new Promise((s, i) => {
@@ -6833,7 +6834,7 @@ class CA {
6833
6834
  }
6834
6835
  let n = 2048;
6835
6836
  e && e <= 2048 && (n = e);
6836
- const s = yA(n, n), i = this.commandContext.getAllLayouts(), o = t.defaultPreviewPanelIndex || 0, r = t.panels[o], c = i.find((D) => {
6837
+ const s = YA(n, n), i = this.commandContext.getAllLayouts(), o = t.defaultPreviewPanelIndex || 0, r = t.panels[o], c = i.find((D) => {
6837
6838
  var p;
6838
6839
  return ((p = D.layoutState) == null ? void 0 : p.layout.panelId) === (r == null ? void 0 : r.name);
6839
6840
  }) || i[0], B = c.layoutState.layout.previewRegion ? {
@@ -6848,7 +6849,7 @@ class CA {
6848
6849
  height: c.layoutState.layout.height
6849
6850
  }, l = this.commandContext.getLayoutById(c.layoutState.layout.id), d = s.getContext("2d");
6850
6851
  if (!d)
6851
- throw new kA("Failed to obtain 2D context for preview image creation");
6852
+ throw new JA("Failed to obtain 2D context for preview image creation");
6852
6853
  const E = Se(l.layoutState.layout, l.layoutState.elements, {
6853
6854
  renderingConfiguration: {
6854
6855
  purpose: xe.Print,
@@ -6858,10 +6859,10 @@ class CA {
6858
6859
  await (await ve.from(d, h, {
6859
6860
  anonymousCrossOrigin: !0,
6860
6861
  ignoreDimensions: !1,
6861
- createCanvas: yA,
6862
+ createCanvas: YA,
6862
6863
  createImage: Re,
6863
6864
  DOMParser: Pe(),
6864
- fetch: Ae
6865
+ fetch: FA
6865
6866
  })).render();
6866
6867
  const Q = await this.getCanvasObjectURLAsync(s);
6867
6868
  return s.toDataURL(Q);
@@ -6964,7 +6965,7 @@ class CA {
6964
6965
  var o;
6965
6966
  if (A)
6966
6967
  return A;
6967
- const n = this.getWorkflowManager().getTransaction().id, i = (o = (await KA.getSavedDesigns()).find((r) => r.transactionId === n)) == null ? void 0 : o.title;
6968
+ const n = this.getWorkflowManager().getTransaction().id, i = (o = (await jA.getSavedDesigns()).find((r) => r.transactionId === n)) == null ? void 0 : o.title;
6968
6969
  return i || "My design";
6969
6970
  })(),
6970
6971
  thumbnail: await this.createPreviewImage(!1, 256),
@@ -6975,7 +6976,7 @@ class CA {
6975
6976
  workflowId: this.getWorkflowManager().getWorkflow().id,
6976
6977
  lastEdited: /* @__PURE__ */ new Date()
6977
6978
  };
6978
- return await KA.addDesign(a), a;
6979
+ return await jA.addDesign(a), a;
6979
6980
  }
6980
6981
  async copy() {
6981
6982
  var i;
@@ -7071,7 +7072,7 @@ const Cn = [
7071
7072
  return console.error(d), [];
7072
7073
  }
7073
7074
  }, un = async (g, A, e, t) => {
7074
- const a = e.data, n = a.assetUrl, s = await WA(n);
7075
+ const a = e.data, n = a.assetUrl, s = await XA(n);
7075
7076
  try {
7076
7077
  const i = Rt(a, t.option);
7077
7078
  i && (A[t.stepName] = { selectedVariants: [i] });
@@ -7128,7 +7129,7 @@ const Cn = [
7128
7129
  const a = e.data, n = t.option;
7129
7130
  if (!n)
7130
7131
  return console.error(`No option for step ${t.stepName}.`), [];
7131
- const s = ((p = n.variants) == null ? void 0 : p.find((m) => m.id === a.illustrationVariantId)) || GA(n);
7132
+ const s = ((p = n.variants) == null ? void 0 : p.find((m) => m.id === a.illustrationVariantId)) || vA(n);
7132
7133
  if (!s)
7133
7134
  return console.error(`No variant with ID: ${a.illustrationVariantId}`), [];
7134
7135
  if (!s.asset)
@@ -7227,7 +7228,7 @@ const Cn = [
7227
7228
  const a = e.data, n = t.option;
7228
7229
  if (!n)
7229
7230
  return console.error(`No option for step ${t.stepName}.`), [];
7230
- const s = ((c = n.variants) == null ? void 0 : c.find((l) => l.id === a.pictureVariantId)) || GA(n);
7231
+ const s = ((c = n.variants) == null ? void 0 : c.find((l) => l.id === a.pictureVariantId)) || vA(n);
7231
7232
  if (!s)
7232
7233
  return console.error(`No variant with ID: ${a.pictureVariantId}`), [];
7233
7234
  if (!s.asset)
@@ -7269,7 +7270,7 @@ const Cn = [
7269
7270
  const a = e.data, n = t.option;
7270
7271
  if (!n)
7271
7272
  return console.error(`No option for step ${t.stepName}.`), [];
7272
- const s = ((r = n.variants) == null ? void 0 : r.find((c) => c.id === a.colorVariantId)) || GA(n);
7273
+ const s = ((r = n.variants) == null ? void 0 : r.find((c) => c.id === a.colorVariantId)) || vA(n);
7273
7274
  if (!s)
7274
7275
  return console.error(`No variant with ID: ${a.colorVariantId}`), [];
7275
7276
  A[t.stepName] = { selectedVariants: [s] };
@@ -7394,7 +7395,7 @@ const Cn = [
7394
7395
  const w = t.option;
7395
7396
  if (!w)
7396
7397
  return;
7397
- const Q = ((u = w.variants) == null ? void 0 : u.find((D) => D.id === n.fontVariantId)) || GA(w);
7398
+ const Q = ((u = w.variants) == null ? void 0 : u.find((D) => D.id === n.fontVariantId)) || vA(w);
7398
7399
  if (!Q || !Q.asset)
7399
7400
  return;
7400
7401
  A[t.stepName] = { selectedVariants: [Q] };
@@ -7405,12 +7406,12 @@ const Cn = [
7405
7406
  const w = o();
7406
7407
  if (!w)
7407
7408
  return;
7408
- const Q = await ye(w, !0), C = await Ut(Q), u = UA(C);
7409
+ const Q = await ye(w, !0), C = await Ut(Q), u = GA(C);
7409
7410
  return await Gt(u, w), {
7410
7411
  assetUrl: w,
7411
7412
  name: u.names.fullName.en
7412
7413
  };
7413
- })(), B = t.data.replaceableText ? t.data.replaceableText.replace("{{}}", n.text) : n.text, l = XA(B, {
7414
+ })(), B = t.data.replaceableText ? t.data.replaceableText.replace("{{}}", n.text) : n.text, l = qA(B, {
7414
7415
  vertical: t.data.vertical,
7415
7416
  uppercase: t.data.uppercase
7416
7417
  }), d = async (w) => {
@@ -7451,7 +7452,7 @@ const Cn = [
7451
7452
  c,
7452
7453
  w,
7453
7454
  [
7454
- XA(l, {
7455
+ qA(l, {
7455
7456
  vertical: t.data.vertical,
7456
7457
  uppercase: t.data.uppercase
7457
7458
  })
@@ -7556,7 +7557,7 @@ class QA {
7556
7557
  }
7557
7558
  }
7558
7559
  let uA;
7559
- const Yn = () => (uA !== void 0 || (uA = !!yA().getContext("webgl2")), uA);
7560
+ const Yn = () => (uA !== void 0 || (uA = !!YA().getContext("webgl2")), uA);
7560
7561
  class Sn {
7561
7562
  constructor(A, e, t) {
7562
7563
  this.hasSetStaticContext = !1, this.interactiveDirty = !1, this.staticCtxDirty = !1, this.lastRequestedRenderArguments = void 0, this.lastCompletedStaticRender = void 0, this.lastModificationID = void 0, this.renderQueue = new Ze(2), this.id = A, this.name = e, this.service = t;
@@ -7711,10 +7712,10 @@ class xn extends qe {
7711
7712
  ignoreClear: !0,
7712
7713
  ignoreMouse: !0,
7713
7714
  enableRedraw: !1,
7714
- createCanvas: yA,
7715
+ createCanvas: YA,
7715
7716
  createImage: Re,
7716
7717
  DOMParser: Pe(),
7717
- fetch: Ae
7718
+ fetch: FA
7718
7719
  });
7719
7720
  B.resize(i, o), await B.render(), this.onRender();
7720
7721
  }
@@ -8817,7 +8818,7 @@ class De {
8817
8818
  variables: {
8818
8819
  id: this.id,
8819
8820
  details: A,
8820
- type: e || NA.Owner
8821
+ type: e || RA.Owner
8821
8822
  }
8822
8823
  });
8823
8824
  if (!((n = t.data) != null && n.bundleAddStakeholder))
@@ -9262,7 +9263,7 @@ const ls = M`
9262
9263
  name
9263
9264
  }
9264
9265
  `, Es = (g) => M`
9265
- ${JA(g)}
9266
+ ${bA(g)}
9266
9267
  ${ne}
9267
9268
  ${Ve}
9268
9269
  ${ls}
@@ -9674,7 +9675,7 @@ const ls = M`
9674
9675
  }
9675
9676
  }
9676
9677
  `, Cs = M`
9677
- ${JA(!1)}
9678
+ ${bA(!1)}
9678
9679
  query GetWorkflowForTheme($id: String!) {
9679
9680
  workflow(id: $id) {
9680
9681
  id
@@ -9782,7 +9783,7 @@ const ls = M`
9782
9783
  );
9783
9784
  for (let n = 0; n < t.length; ++n) {
9784
9785
  const s = t[n];
9785
- s.src && s.svg && (s.cachedObjectURL = await FA(s.svg));
9786
+ s.src && s.svg && (s.cachedObjectURL = await MA(s.svg));
9786
9787
  }
9787
9788
  const a = g.layouts[e].elements.filter((n) => n.type === U.Textbox);
9788
9789
  for (let n = 0; n < a.length; ++n) {
@@ -9836,7 +9837,7 @@ const ls = M`
9836
9837
  previewRegion: A.previewRegion,
9837
9838
  useEditableArea: A.useEditableArea,
9838
9839
  editableArea: A.editableArea
9839
- })), jA = (g, A) => {
9840
+ })), VA = (g, A) => {
9840
9841
  const e = g.workflowState, t = e ? JSON.parse(e) : void 0;
9841
9842
  return t ? Object.values(t.layouts).map((a) => a.layout) : Fs(A.panels);
9842
9843
  };
@@ -9881,7 +9882,7 @@ class Ms {
9881
9882
  const e = S.getMap("bundleOwnerIds");
9882
9883
  if (e != null && e.has(A)) {
9883
9884
  const s = e.get(A);
9884
- return LA(s), Promise.resolve({ success: !0, stakeholderType: NA.Owner });
9885
+ return OA(s), Promise.resolve({ success: !0, stakeholderType: RA.Owner });
9885
9886
  }
9886
9887
  const t = S.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
9887
9888
  if (t.has(A)) {
@@ -9932,7 +9933,7 @@ class Ms {
9932
9933
  const s = S.getMap("transactionOwnerIds");
9933
9934
  if (s != null && s.has(A)) {
9934
9935
  const w = s.get(A);
9935
- return eA(w), Promise.resolve({ success: !0, stakeholderType: NA.Owner });
9936
+ return eA(w), Promise.resolve({ success: !0, stakeholderType: RA.Owner });
9936
9937
  }
9937
9938
  const i = S.getMap("transactionCustomerIds");
9938
9939
  if (i != null && i.has(A)) {
@@ -10099,7 +10100,7 @@ class Ms {
10099
10100
  if (!(t != null && t.id))
10100
10101
  throw new Error("Unable to create bundle");
10101
10102
  const a = S.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
10102
- a.set(t.id, t.partner.id), S.setMap("bundlePartnerIds", a), LA(t.bundleOwnerId);
10103
+ a.set(t.id, t.partner.id), S.setMap("bundlePartnerIds", a), OA(t.bundleOwnerId);
10103
10104
  const n = S.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
10104
10105
  return n.set(t.id, t.bundleOwnerId), S.setMap("bundleOwnerIds", n), new De(this, t);
10105
10106
  }
@@ -10113,7 +10114,7 @@ class Ms {
10113
10114
  async getExistingBundle(A, e, t) {
10114
10115
  var c, B, l, d;
10115
10116
  const a = S.getMap("bundleOwnerIds"), n = a == null ? void 0 : a.get(A);
10116
- n && LA(n);
10117
+ n && OA(n);
10117
10118
  const s = await x.getShadowGraphqlClient().query({
10118
10119
  query: Un,
10119
10120
  variables: {
@@ -10235,7 +10236,7 @@ class Ms {
10235
10236
  const h = JSON.parse(a.workflowState);
10236
10237
  r.layouts = Object.values(h.layouts).map((w) => w.layout), await AA(h), await tA(h), r.reloadedState = h;
10237
10238
  } else
10238
- r.layouts = jA(
10239
+ r.layouts = VA(
10239
10240
  r.transaction,
10240
10241
  r.workflow
10241
10242
  );
@@ -10345,7 +10346,7 @@ class Ms {
10345
10346
  const R = JSON.parse(y.workflowState);
10346
10347
  F.layouts = Object.values(R.layouts).map((N) => N.layout), await AA(R), await tA(R), F.reloadedState = R;
10347
10348
  } else
10348
- F.layouts = jA(
10349
+ F.layouts = VA(
10349
10350
  F.transaction,
10350
10351
  F.workflow
10351
10352
  );
@@ -10505,7 +10506,7 @@ class Ms {
10505
10506
  const B = JSON.parse(e);
10506
10507
  this.experienceOptions.layouts = Object.values(B.layouts).map((l) => l.layout), await AA(B), await tA(B), this.experienceOptions.reloadedState = B;
10507
10508
  } else
10508
- this.experienceOptions.layouts = jA(
10509
+ this.experienceOptions.layouts = VA(
10509
10510
  this.experienceOptions.transaction,
10510
10511
  this.experienceOptions.workflow
10511
10512
  );
@@ -10703,7 +10704,7 @@ class Ys extends j {
10703
10704
  }
10704
10705
  selectVariant(A) {
10705
10706
  const e = this.manager.getRegionElements(this.step.stepName);
10706
- return ZA.selectVariant(
10707
+ return $A.selectVariant(
10707
10708
  this.step,
10708
10709
  A.getResource(),
10709
10710
  e,
@@ -10717,7 +10718,7 @@ class Ys extends j {
10717
10718
  });
10718
10719
  }
10719
10720
  selectImage(A) {
10720
- return ZA.selectImage(this.step, A, this.manager);
10721
+ return $A.selectImage(this.step, A, this.manager);
10721
10722
  }
10722
10723
  getImageData() {
10723
10724
  if (this.frameService)
@@ -10771,19 +10772,19 @@ export {
10771
10772
  ce as GlobalPropertyHandle,
10772
10773
  ti as GroupCommand,
10773
10774
  _a as IllustrationStepHandle,
10774
- HA as InformationMessageType,
10775
+ UA as InformationMessageType,
10775
10776
  on as InformationStepHandle,
10776
10777
  ai as LayoutElementFactory,
10777
10778
  ni as LayoutElementType,
10778
10779
  T as LayoutNotFoundError,
10779
10780
  An as MaterialStepHandle,
10780
- SA as MisconfigurationError,
10781
+ xA as MisconfigurationError,
10781
10782
  bs as MockWorkflowManager,
10782
10783
  en as ModelStepHandle,
10783
10784
  si as MoveCommand,
10784
10785
  ht as ObjectInput,
10785
10786
  gs as ObjectInputType,
10786
- YA as OptionNotFoundError,
10787
+ SA as OptionNotFoundError,
10787
10788
  rA as ParseError,
10788
10789
  tn as PictureStepHandle,
10789
10790
  oa as ProductCameraRig,
@@ -10798,7 +10799,7 @@ export {
10798
10799
  ri as SendBackwardsCommand,
10799
10800
  nn as ShapeStepHandle,
10800
10801
  Ms as SpiffCommerceClient,
10801
- NA as StakeholderType,
10802
+ RA as StakeholderType,
10802
10803
  ci as StepAspectType,
10803
10804
  j as StepHandle,
10804
10805
  gi as StepType,
@@ -10813,12 +10814,12 @@ export {
10813
10814
  b as assetService,
10814
10815
  wn as createDesign,
10815
10816
  di as dataUrlFromExternalUrl,
10816
- KA as designService,
10817
+ jA as designService,
10817
10818
  wi as determineCorrectFontSizeAndLines,
10818
10819
  fa as digitalContentStepService,
10819
10820
  Ei as findElement,
10820
10821
  hi as frameDataCache,
10821
- ZA as frameStepService,
10822
+ $A as frameStepService,
10822
10823
  Xe as gatherVaryingStepAspects,
10823
10824
  Ci as generate,
10824
10825
  yn as generateCommands,
@@ -10848,7 +10849,7 @@ export {
10848
10849
  Yi as rehydrateSerializedLayout,
10849
10850
  cA as shapeStepService,
10850
10851
  Ia as shortenUrl,
10851
- xA as spiffCoreConfiguration,
10852
+ NA as spiffCoreConfiguration,
10852
10853
  Nn as stepAspectValuesToDesignInputSteps,
10853
10854
  K as textStepService,
10854
10855
  Ua as toast
@@ -1,4 +1,4 @@
1
- (function(u,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("@apollo/client/core"),require("@spiffcommerce/papyrus"),require("@apollo/client/link/context"),require("@apollo/client/link/error"),require("pith"),require("lodash.debounce"),require("lodash.isequal"),require("lodash.clonedeep"),require("qrcode"),require("unicode-default-word-boundary"),require("svg-path-bbox")):typeof define=="function"&&define.amd?define(["exports","@apollo/client/core","@spiffcommerce/papyrus","@apollo/client/link/context","@apollo/client/link/error","pith","lodash.debounce","lodash.isequal","lodash.clonedeep","qrcode","unicode-default-word-boundary","svg-path-bbox"],M):(u=typeof globalThis<"u"?globalThis:u||self,M(u.Core={},u.core,u.papyrus,u.context,u.error,u.pith,u.debounce,u.isEqual,u.cloneDeep,u.qrcode,u.unicodeDefaultWordBoundary,u.svgPathBbox))})(this,function(u,M,r,gA,lA,$e,_e,et,te,tt,ye,Ye){"use strict";class At extends Error{constructor(e){super(e),this.name=this.constructor.name}}class Ae extends At{constructor(e){super(`ConfigurationError - ${e}`)}}class ae extends Ae{constructor(e){super(`Option not Configured: ${e.stepTitle}`),this.optionId=(e==null?void 0:e.optionId)||"N/A"}}class v extends Ae{constructor(e){super(`Panel not Found: ${e.panelId}`),this.panelId=(e==null?void 0:e.panelId)||"N/A"}}class z extends Ae{constructor(e){super(`Asset not found for variant: ${e.name}`),this.variant=e}}class W extends Ae{constructor(e){super(`Resource not found for asset: ${e.name}`),this.asset=e}}class ne extends Ae{constructor(e,t){super(`Workflow Misconfiguration: ${e.stepName} - ${t}`),this.step=e}}class he extends At{constructor(e){super(`ImplementationError - ${e}`)}}class G extends he{constructor(e){super(`Unhandled Behavior Encountered: ${e}`)}}class X extends he{constructor(e){super(`Parsing Error: ${e}`)}}class U extends he{constructor(e){super(`Client Error: ${e}`)}}class Ce extends he{constructor(e){super(`Resource Generation Failed: ${e}`)}}class BA{get(e){return localStorage.getItem(e)||void 0}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}class at{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||void 0}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}const N=(()=>{try{return localStorage?new BA:new at}catch{return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."),new at}})();class dA{constructor(){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=[]}getServerUrl(){return this.serverUrl}getServicesApiUrl(){return this.servicesApiUrl}getHubUrl(){return this.hubUrl}setServerUrl(e){this.serverUrl=e,this.serverUrlCallbacks.forEach(t=>t())}setServicesApiUrl(e){this.servicesApiUrl=e}setHubUrl(e){this.hubUrl=e}addServerUrlCallback(e){this.serverUrlCallbacks.push(e)}}const ie=new dA;let nt;const q=l=>{nt=l};let it;const Ne=l=>{it=l};let ot;const st=l=>{ot=l};let rt;const wA=l=>{rt=l},EA=()=>new Promise(l=>{const e=ie.getHubUrl(),t=A=>{A.origin===e&&(window.removeEventListener("message",t),l(A.data))};window.parent!==window&&(window.addEventListener("message",t,!1),window.parent.postMessage("ready",e))}),hA=async()=>{const l={applicationKey:rt,bundleOwnerId:it,customerToken:ot,transactionOwnerId:nt};return typeof window<"u"&&(window.location.href.includes("/workflows/product/")||window.location.href.includes("hub=true"))?{...await EA(),...l}:l};class CA{constructor(){this.shadowGraphqlClient=this.constructShadowGraphqlClient(),ie.addServerUrlCallback(()=>{this.shadowGraphqlClient=this.constructShadowGraphqlClient()})}getShadowGraphqlClient(){return this.shadowGraphqlClient}constructShadowGraphqlClient(){const e=M.createHttpLink({uri:`${ie.getServerUrl()}/graphql`,fetch:r.fetch}),t=gA.setContext(async(i,o)=>{const{headers:s}=o,c=s||{},g=await hA(),d=o.bearer??g.bearer,B=o.partnerId??g.partnerId,w=o.activeIntegration??g.activeIntegration,h=o.transactionOwnerId??g.transactionOwnerId,C=o.customerToken??g.customerToken,E=o.applicationKey??g.applicationKey,m=o.bundleOwnerId??g.bundleOwnerId;return d&&(c.Authorization=`Bearer ${d}`),B&&(c.partnerId=B),w&&(c.activeIntegration=w),h&&(c.transactionOwnerId=h),C&&(c.customerToken=C),E&&(c["X-Application-Key"]=E),m&&(c.bundleOwnerId=m),{headers:c}}),A=lA.onError(({operation:i,graphQLErrors:o,networkError:s})=>{const c=o||[];s&&console.log("GraphQL Network error"),c.forEach(()=>console.log("GraphQL Error: "+i.operationName))});function a(){return{read(i=null){return i},merge(i,o){return o||i||null}}}const n=new M.InMemoryCache({addTypename:!1,typePolicies:{Transaction:{fields:{bulkEmailAddress:a(),transactionOwnerId:a(),customLogoLink:a(),workflowFooterLogoLink:a(),workflowState:a(),bulkSourceUrl:a(),externalDesignProductId:a(),externalDesignProductVariantId:a(),externalCartProductId:a(),externalCartProductVariantId:a(),lastSyncedAt:a(),lineItem:a()}},WorkflowProduct:{fields:{isPresent:a()}},Product:{fields:{imageUrl:a(),overlayImageUrl:a(),preloadImageUrl:a(),weight:a(),conversionConfiguration:a(),bulkConfiguration:a()}}}});return new M.ApolloClient({link:M.from([A,t,e]),cache:n,name:"Core"})}}const P=new CA,QA=M.gql`
1
+ (function(u,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("@apollo/client/core"),require("@spiffcommerce/papyrus"),require("@apollo/client/link/context"),require("@apollo/client/link/error"),require("pith"),require("lodash.debounce"),require("lodash.isequal"),require("lodash.clonedeep"),require("qrcode"),require("unicode-default-word-boundary"),require("svg-path-bbox")):typeof define=="function"&&define.amd?define(["exports","@apollo/client/core","@spiffcommerce/papyrus","@apollo/client/link/context","@apollo/client/link/error","pith","lodash.debounce","lodash.isequal","lodash.clonedeep","qrcode","unicode-default-word-boundary","svg-path-bbox"],M):(u=typeof globalThis<"u"?globalThis:u||self,M(u.Core={},u.core,u.papyrus,u.context,u.error,u.pith,u.debounce,u.isEqual,u.cloneDeep,u.qrcode,u.unicodeDefaultWordBoundary,u.svgPathBbox))})(this,function(u,M,r,gA,lA,$e,_e,et,te,tt,ye,Ye){"use strict";class At extends Error{constructor(e){super(e),this.name=this.constructor.name}}class Ae extends At{constructor(e){super(`ConfigurationError - ${e}`)}}class ae extends Ae{constructor(e){super(`Option not Configured: ${e.stepTitle}`),this.optionId=(e==null?void 0:e.optionId)||"N/A"}}class v extends Ae{constructor(e){super(`Panel not Found: ${e.panelId}`),this.panelId=(e==null?void 0:e.panelId)||"N/A"}}class z extends Ae{constructor(e){super(`Asset not found for variant: ${e.name}`),this.variant=e}}class W extends Ae{constructor(e){super(`Resource not found for asset: ${e.name}`),this.asset=e}}class ne extends Ae{constructor(e,t){super(`Workflow Misconfiguration: ${e.stepName} - ${t}`),this.step=e}}class he extends At{constructor(e){super(`ImplementationError - ${e}`)}}class G extends he{constructor(e){super(`Unhandled Behavior Encountered: ${e}`)}}class X extends he{constructor(e){super(`Parsing Error: ${e}`)}}class U extends he{constructor(e){super(`Client Error: ${e}`)}}class Ce extends he{constructor(e){super(`Resource Generation Failed: ${e}`)}}class BA{get(e){return localStorage.getItem(e)||void 0}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}class at{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||void 0}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}const N=(()=>{try{return localStorage?new BA:new at}catch{return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."),new at}})();class dA{constructor(){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=[]}getServerUrl(){return this.serverUrl}getServicesApiUrl(){return this.servicesApiUrl}getHubUrl(){return this.hubUrl}setServerUrl(e){this.serverUrl=e,this.serverUrlCallbacks.forEach(t=>t())}setServicesApiUrl(e){this.servicesApiUrl=e}setHubUrl(e){this.hubUrl=e}addServerUrlCallback(e){this.serverUrlCallbacks.push(e)}}const ie=new dA;let nt;const q=l=>{nt=l};let it;const Ne=l=>{it=l};let ot;const st=l=>{ot=l};let rt;const wA=l=>{rt=l},EA=()=>new Promise(l=>{const e=ie.getHubUrl(),t=A=>{A.origin===e&&(window.removeEventListener("message",t),l(A.data))};window.parent!==window&&(window.addEventListener("message",t,!1),window.parent.postMessage("ready",e))}),hA=async()=>{const l={applicationKey:rt,bundleOwnerId:it,customerToken:ot,transactionOwnerId:nt};return typeof window<"u"&&(window.location.href.includes("/workflows/product/")||window.location.href.includes("hub=true"))?{...await EA(),...l}:l};class CA{constructor(){this.shadowGraphqlClient=this.constructShadowGraphqlClient(),ie.addServerUrlCallback(()=>{this.shadowGraphqlClient=this.constructShadowGraphqlClient()})}getShadowGraphqlClient(){return this.shadowGraphqlClient}constructShadowGraphqlClient(){console.log(`constructing shadow gql client with ${r.fetch.__spiffId}`);const e=M.createHttpLink({uri:`${ie.getServerUrl()}/graphql`,fetch:r.fetch}),t=gA.setContext(async(i,o)=>{const{headers:s}=o,c=s||{},g=await hA(),d=o.bearer??g.bearer,B=o.partnerId??g.partnerId,w=o.activeIntegration??g.activeIntegration,h=o.transactionOwnerId??g.transactionOwnerId,C=o.customerToken??g.customerToken,E=o.applicationKey??g.applicationKey,m=o.bundleOwnerId??g.bundleOwnerId;return d&&(c.Authorization=`Bearer ${d}`),B&&(c.partnerId=B),w&&(c.activeIntegration=w),h&&(c.transactionOwnerId=h),C&&(c.customerToken=C),E&&(c["X-Application-Key"]=E),m&&(c.bundleOwnerId=m),{headers:c}}),A=lA.onError(({operation:i,graphQLErrors:o,networkError:s})=>{const c=o||[];s&&console.log("GraphQL Network error"),c.forEach(()=>console.log("GraphQL Error: "+i.operationName))});function a(){return{read(i=null){return i},merge(i,o){return o||i||null}}}const n=new M.InMemoryCache({addTypename:!1,typePolicies:{Transaction:{fields:{bulkEmailAddress:a(),transactionOwnerId:a(),customLogoLink:a(),workflowFooterLogoLink:a(),workflowState:a(),bulkSourceUrl:a(),externalDesignProductId:a(),externalDesignProductVariantId:a(),externalCartProductId:a(),externalCartProductVariantId:a(),lastSyncedAt:a(),lineItem:a()}},WorkflowProduct:{fields:{isPresent:a()}},Product:{fields:{imageUrl:a(),overlayImageUrl:a(),preloadImageUrl:a(),weight:a(),conversionConfiguration:a(),bulkConfiguration:a()}}}});return new M.ApolloClient({link:M.from([A,t,e]),cache:n,name:"Core"})}}const P=new CA,QA=M.gql`
2
2
  fragment AssetMetadataFields on Asset {
3
3
  metadata {
4
4
  key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "16.4.1",
3
+ "version": "16.4.2-0",
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",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@apollo/client": "^3.8.3",
55
- "@spiffcommerce/papyrus": "6.1.1",
55
+ "@spiffcommerce/papyrus": "6.1.2-0",
56
56
  "graphql": "^16.8.0",
57
57
  "lodash.clonedeep": "^4.5.0",
58
58
  "lodash.debounce": "^4.0.8",