@spiffcommerce/core 34.4.6 → 34.4.8

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.mjs CHANGED
@@ -312,7 +312,7 @@ const oi = (n) => {
312
312
  async function ci(n, t) {
313
313
  const e = pt.getServerUrl(), a = e.includes(".aumelbdev.spiffcommerce.com") ? "https://moonlight.aumelbdev.spiffcommerce.com" : e.includes(".us.spiffcommerce.com") ? "https://moonlight.us.spiffcommerce.com" : "https://moonlight.au.spiffcommerce.com";
314
314
  let r = await nt(n, { ...t, redirect: "manual" });
315
- return r.type === "opaqueredirect" && (typeof n != "string" && "url" in n ? r = await nt({ ...n, url: `${a}/graphql` }, t) : r = await nt(`${a}/graphql`, t)), r;
315
+ return (r.type === "opaqueredirect" || r.status === 307) && (typeof n != "string" && "url" in n ? r = await nt({ ...n, url: `${a}/graphql` }, t) : r = await nt(`${a}/graphql`, t)), r;
316
316
  }
317
317
  class di {
318
318
  constructor() {
@@ -332,26 +332,31 @@ class di {
332
332
  fetch: ci
333
333
  }), e = Pr(async (i, o) => {
334
334
  const { headers: s } = o, l = s || {}, c = await li();
335
- let d = o.bearer ?? c.bearer;
336
- if (this.spiffClient)
335
+ let d = o.bearer ?? c.bearer, A;
336
+ if (this.spiffClient) {
337
337
  try {
338
338
  d = await this.spiffClient.loggedInBearerToken();
339
339
  } catch {
340
340
  }
341
- const A = o.partnerId ?? c.partnerId, u = o.activeIntegration ?? c.activeIntegration, h = o.transactionOwnerId, g = o.customerToken ?? c.customerToken, m = o.applicationKey ?? c.applicationKey, p = o.bundleOwnerId;
341
+ try {
342
+ A = await this.spiffClient.getIntegration();
343
+ } catch {
344
+ }
345
+ }
346
+ const u = o.partnerId ?? c.partnerId, h = o.activeIntegration ?? c.activeIntegration, g = o.transactionOwnerId, m = o.customerToken ?? c.customerToken, p = o.applicationKey ?? c.applicationKey, f = o.bundleOwnerId;
342
347
  try {
343
348
  if (window && window.__SENTRY__) {
344
- const f = window.__SENTRY__.hub;
345
- if (f) {
346
- const v = f.traceHeaders();
347
- Object.entries(v).forEach(([w, x]) => {
348
- l[w] = x;
349
+ const S = window.__SENTRY__.hub;
350
+ if (S) {
351
+ const w = S.traceHeaders();
352
+ Object.entries(w).forEach(([x, v]) => {
353
+ l[x] = v;
349
354
  });
350
355
  }
351
356
  }
352
357
  } catch {
353
358
  }
354
- return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), g && (l.customerToken = g), m && (l["X-Application-Key"] = m), p && (l.bundleOwnerId = p), l["Allow-Moonlight-Redirect"] = "true", {
359
+ return d && (l.Authorization = `Bearer ${d}`), u && (l.partnerId = u), h && (l.activeIntegration = h), g && (l.transactionOwnerId = g), m && (l.customerToken = m), p && (l["X-Application-Key"] = p), f && (l.bundleOwnerId = f), A?.partner?.beta && (l["X-Spiff-Beta"] = "true"), l["Allow-Moonlight-Redirect"] = "true", {
355
360
  headers: l
356
361
  };
357
362
  }), a = xr(({ operation: i, graphQLErrors: o, networkError: s }) => {
@@ -5311,14 +5316,14 @@ const T = () => {
5311
5316
  viewBox: A,
5312
5317
  width: u
5313
5318
  }) => {
5314
- const h = e || 0, g = 2 * (l?.scale || 1), m = A || { x: 0, y: 0, width: u, height: i }, p = `${m.x} ${m.y} ${m.width} ${m.height}`, f = T(), v = a.purpose === Yt.FreeDesign && /* @__PURE__ */ P("defs", { children: /* @__PURE__ */ P("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ P("rect", { width: m.width, height: m.height, rx: h }) }) }), w = a.colorProfiles?.map((S, I) => (
5319
+ const h = e || 0, g = 2 * (l?.scale || 1), m = A || { x: 0, y: 0, width: u, height: i }, p = `${m.x} ${m.y} ${m.width} ${m.height}`, f = T(), S = a.purpose === Yt.FreeDesign && /* @__PURE__ */ P("defs", { children: /* @__PURE__ */ P("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ P("rect", { width: m.width, height: m.height, rx: h }) }) }), w = a.colorProfiles?.map((E, I) => (
5315
5320
  /* @ts-ignore */
5316
- /* @__PURE__ */ P("color-profile", { name: S.name, xlinkHref: S.key, children: " " }, I)
5317
- )), x = r.map((S) => ({
5318
- ...S,
5321
+ /* @__PURE__ */ P("color-profile", { name: E.name, xlinkHref: E.key, children: " " }, I)
5322
+ )), x = r.map((E) => ({
5323
+ ...E,
5319
5324
  _renderingConfiguration: a,
5320
5325
  mask: l ? `url(#viewmask-${f})` : void 0
5321
- })), E = Ma(x);
5326
+ })), v = Ma(x);
5322
5327
  return /* @__PURE__ */ ct(
5323
5328
  "svg",
5324
5329
  {
@@ -5339,7 +5344,7 @@ const T = () => {
5339
5344
  viewBox: p,
5340
5345
  children: [
5341
5346
  w,
5342
- v,
5347
+ S,
5343
5348
  !!n && /* @__PURE__ */ P(
5344
5349
  "rect",
5345
5350
  {
@@ -5355,7 +5360,7 @@ const T = () => {
5355
5360
  {
5356
5361
  id: "element-group",
5357
5362
  clipPath: a.purpose === Yt.FreeDesign ? "url(#viewboxClip)" : void 0,
5358
- children: E.map((S) => Xn(S)).filter((S) => !!S)
5363
+ children: v.map((E) => Xn(E)).filter((E) => !!E)
5359
5364
  }
5360
5365
  ),
5361
5366
  l && /* @__PURE__ */ P(
@@ -5397,12 +5402,12 @@ const T = () => {
5397
5402
  }
5398
5403
  );
5399
5404
  }, hd = (n, t, e, a, r) => {
5400
- const i = Ct(r), o = e / 2, s = a / 2, l = n + o, c = t + s, d = Math.sin(i), A = Math.cos(i), u = o, h = o, g = -s, m = s, p = u * A - g * d, f = h * A - m * d, v = u * d + g * A, w = h * d + m * A, x = Math.max(Math.abs(p), Math.abs(f)), E = Math.max(Math.abs(v), Math.abs(w));
5405
+ const i = Ct(r), o = e / 2, s = a / 2, l = n + o, c = t + s, d = Math.sin(i), A = Math.cos(i), u = o, h = o, g = -s, m = s, p = u * A - g * d, f = h * A - m * d, S = u * d + g * A, w = h * d + m * A, x = Math.max(Math.abs(p), Math.abs(f)), v = Math.max(Math.abs(S), Math.abs(w));
5401
5406
  return {
5402
5407
  minX: l - x,
5403
5408
  maxX: l + x,
5404
- minY: c - E,
5405
- maxY: c + E
5409
+ minY: c - v,
5410
+ maxY: c + v
5406
5411
  };
5407
5412
  }, gd = (n, t, e) => {
5408
5413
  const a = Math.sqrt(Math.pow(t.x - n.x, 2) + Math.pow(t.y - n.y, 2)), r = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), i = Math.sqrt(Math.pow(e.x - n.x, 2) + Math.pow(e.y - n.y, 2));
@@ -5710,22 +5715,22 @@ const yo = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", Je = /* @_
5710
5715
  });
5711
5716
  const o = e.querySelectorAll("tspan");
5712
5717
  for (let d = 0; d < o.length; d++) {
5713
- const A = o.item(d), u = A.closest("text"), h = A.closest("g"), g = u.getAttribute("font-family"), m = await Tt(r.get(g)), p = Tr(A.innerHTML), f = u.getAttribute("fill"), v = u.getAttribute("stroke"), w = u.getAttribute("stroke-width"), x = m.getPath(
5718
+ const A = o.item(d), u = A.closest("text"), h = A.closest("g"), g = u.getAttribute("font-family"), m = await Tt(r.get(g)), p = Tr(A.innerHTML), f = u.getAttribute("fill"), S = u.getAttribute("stroke"), w = u.getAttribute("stroke-width"), x = m.getPath(
5714
5719
  p,
5715
5720
  0,
5716
5721
  0,
5717
5722
  parseInt(u.getAttribute("font-size") ?? "72")
5718
- ), E = x.getBoundingBox().x2 - x.getBoundingBox().x1;
5719
- let S = 0;
5723
+ ), v = x.getBoundingBox().x2 - x.getBoundingBox().x1;
5724
+ let E = 0;
5720
5725
  const I = A.getAttribute("text-anchor");
5721
- I === "middle" ? S = E / 2 : I === "end" && (S = E);
5726
+ I === "middle" ? E = v / 2 : I === "end" && (E = v);
5722
5727
  const N = m.getPath(
5723
5728
  p,
5724
- parseFloat(A.getAttribute("x") ?? "0") - S,
5729
+ parseFloat(A.getAttribute("x") ?? "0") - E,
5725
5730
  parseFloat(A.getAttribute("y") ?? "0"),
5726
5731
  parseInt(u.getAttribute("font-size") ?? "72")
5727
5732
  );
5728
- N.fill = f, N.stroke = v, N.strokeWidth = parseFloat(w ?? "0");
5733
+ N.fill = f, N.stroke = S, N.strokeWidth = parseFloat(w ?? "0");
5729
5734
  const R = N.toSVG(2), M = t.parseFromString(R, "image/svg+xml").firstElementChild;
5730
5735
  h.appendChild(M);
5731
5736
  }
@@ -7685,7 +7690,7 @@ class De {
7685
7690
  i && i(!0);
7686
7691
  const c = t.data.initialZoomLevel, d = await Promise.all(
7687
7692
  t.data.regions.map(async (h, g) => {
7688
- const m = await Le(l[g]), p = s.getImageData(), f = a.map((I) => new Nt(I.id)), v = p ? Ta(
7693
+ const m = await Le(l[g]), p = s.getImageData(), f = a.map((I) => new Nt(I.id)), S = p ? Ta(
7689
7694
  p,
7690
7695
  m,
7691
7696
  c && !t.data.forceImageCover ? { scale: c } : void 0,
@@ -7693,18 +7698,18 @@ class De {
7693
7698
  ) : void 0, w = p ? {
7694
7699
  id: T(),
7695
7700
  src: p.src,
7696
- x: v?.x || 0,
7697
- y: v?.y || 0,
7701
+ x: S?.x || 0,
7702
+ y: S?.y || 0,
7698
7703
  width: p.width,
7699
7704
  height: p.height,
7700
- scaleX: v?.zoom || 1,
7701
- scaleY: v?.zoom || 1,
7705
+ scaleX: S?.zoom || 1,
7706
+ scaleY: S?.zoom || 1,
7702
7707
  rotation: 0
7703
- } : void 0, x = T(), S = r.getLayouts().find((I) => I.panelId === h.panelId);
7704
- if (!S)
7708
+ } : void 0, x = T(), E = r.getLayouts().find((I) => I.panelId === h.panelId);
7709
+ if (!E)
7705
7710
  throw new Y(h);
7706
7711
  return {
7707
- command: this.getCreateElementCommand(x, h, g, S, {
7712
+ command: this.getCreateElementCommand(x, h, g, E, {
7708
7713
  frameData: m,
7709
7714
  pattern: w,
7710
7715
  disablePlaceholder: t.data.disablePlaceholder,
@@ -7949,14 +7954,14 @@ class Go {
7949
7954
  const l = s.fileLink;
7950
7955
  if (!l)
7951
7956
  throw new Jt(s);
7952
- const c = await st(await this.getIllustrationBody(l)), d = await _t(c.svg), A = (f, v) => {
7953
- const w = i.getLayouts().find((E) => E.panelId === f.panelId);
7957
+ const c = await st(await this.getIllustrationBody(l)), d = await _t(c.svg), A = (f, S) => {
7958
+ const w = i.getLayouts().find((v) => v.panelId === f.panelId);
7954
7959
  if (!w)
7955
7960
  throw new Y(f);
7956
7961
  const x = T();
7957
7962
  return {
7958
- regionElement: { id: x, region: f, regionIndex: v },
7959
- command: this.getCreateElementCommand(x, f, v, w, {
7963
+ regionElement: { id: x, region: f, regionIndex: S },
7964
+ command: this.getCreateElementCommand(x, f, S, w, {
7960
7965
  stepName: t.stepName,
7961
7966
  src: l,
7962
7967
  objectURL: d,
@@ -7967,47 +7972,47 @@ class Go {
7967
7972
  let m = Array.from(Object.values(c.colors)).map((f) => f.browserValue);
7968
7973
  const p = t.data.colorOption;
7969
7974
  return p && p.variants?.forEach((f) => {
7970
- m = m.map((v) => v.toLowerCase() === f.color?.toLowerCase() ? f.name : v);
7975
+ m = m.map((S) => S.toLowerCase() === f.color?.toLowerCase() ? f.name : S);
7971
7976
  }), i.updateMetadata(t.stepName, { colors: m }), {
7972
7977
  command: new U(g),
7973
7978
  followup: async () => {
7974
7979
  await i.setSelectionsAndElements(
7975
7980
  t.stepName,
7976
7981
  [e],
7977
- u.map((v) => v.regionElement),
7982
+ u.map((S) => S.regionElement),
7978
7983
  async () => {
7979
7984
  r(!1);
7980
7985
  }
7981
7986
  );
7982
7987
  const f = s.assetConfiguration?.defaultColorVariants || [];
7983
7988
  if (f.length !== 0) {
7984
- const v = {};
7989
+ const S = {};
7985
7990
  (s.assetConfiguration?.channelNumbers || []).forEach((x) => {
7986
- const E = f.find((S) => S.channelNumber === x.number);
7987
- E && (v[`${x.id.replace(/\W/g, "")}`] = { browserValue: E?.variant?.color || "" });
7991
+ const v = f.find((E) => E.channelNumber === x.number);
7992
+ v && (S[`${x.id.replace(/\W/g, "")}`] = { browserValue: v?.variant?.color || "" });
7988
7993
  }), await this.changeColors(
7989
7994
  t,
7990
7995
  u.map((x) => x.regionElement),
7991
7996
  i,
7992
7997
  () => i.getCommandContext().getAllLayouts(),
7993
- new Map(Object.entries(v))
7998
+ new Map(Object.entries(S))
7994
7999
  );
7995
8000
  }
7996
8001
  if (t.data.colorPickerEnabled) {
7997
- const v = await this.availableColors(t, i) || [], w = Object.keys(c.colors), x = v.length === 1 && w.length === 1;
8002
+ const S = await this.availableColors(t, i) || [], w = Object.keys(c.colors), x = S.length === 1 && w.length === 1;
7998
8003
  if (x) {
7999
- const E = v[0], S = w[0];
8004
+ const v = S[0], E = w[0];
8000
8005
  await this.changeColors(
8001
8006
  t,
8002
8007
  u.map((I) => I.regionElement),
8003
8008
  i,
8004
8009
  () => i.getCommandContext().getAllLayouts(),
8005
- /* @__PURE__ */ new Map([[S, E.variant.color]])
8010
+ /* @__PURE__ */ new Map([[E, v.variant.color]])
8006
8011
  );
8007
8012
  }
8008
8013
  !x && f.length === 0 && await this.changeColors(
8009
8014
  t,
8010
- u.map((E) => E.regionElement),
8015
+ u.map((v) => v.regionElement),
8011
8016
  i,
8012
8017
  () => i.getCommandContext().getAllLayouts(),
8013
8018
  /* @__PURE__ */ new Map()
@@ -8218,7 +8223,7 @@ class Ho {
8218
8223
  return console.error("Missing configuration."), null;
8219
8224
  a.updateStorage(t.stepName, { text: e }), a.updateMetadata(t.stepName, { text: e });
8220
8225
  const c = (d, A, u, h) => {
8221
- const g = h || T(), p = a.getLayouts().find((v) => v.panelId === A.panelId);
8226
+ const g = h || T(), p = a.getLayouts().find((S) => S.panelId === A.panelId);
8222
8227
  if (!p)
8223
8228
  return console.error(`Can not find layout for region: ${A.panelId}`), null;
8224
8229
  const f = [];
@@ -8573,9 +8578,9 @@ class Jo {
8573
8578
  </svg>
8574
8579
  `, f = {};
8575
8580
  f[this.shapeFillId] = { browserValue: m };
8576
- const v = T();
8581
+ const S = T();
8577
8582
  return {
8578
- id: v,
8583
+ id: S,
8579
8584
  region: u,
8580
8585
  command: new W(
8581
8586
  {
@@ -8583,7 +8588,7 @@ class Jo {
8583
8588
  stepRegionIndex: h,
8584
8589
  stepName: t.stepName,
8585
8590
  colors: f,
8586
- id: v,
8591
+ id: S,
8587
8592
  svg: p,
8588
8593
  type: D.Illustration,
8589
8594
  y: u.top,
@@ -8655,7 +8660,7 @@ const _o = new Ko(), ea = (n, t, e, a, r) => {
8655
8660
  const A = Math.max(...s);
8656
8661
  if (A <= n.width)
8657
8662
  return [i, A];
8658
- const u = s.reduce((p, f, v, w) => f > w[p] ? v : p, 0), h = i[u];
8663
+ const u = s.reduce((p, f, S, w) => f > w[p] ? S : p, 0), h = i[u];
8659
8664
  let g = !1, m = h.length;
8660
8665
  for (; !g && m > -1; ) {
8661
8666
  m = h.lastIndexOf(" ", m - 1);
@@ -8983,7 +8988,7 @@ class Zo {
8983
8988
  const m = e.getWorkflowExperience().getBundle();
8984
8989
  if (m && t.globalPropertyAspectConfigurations) {
8985
8990
  const f = m.getGlobalPropertyConfiguration()?.aspects?.find(
8986
- (v) => v.type === z.Text && t.globalPropertyAspectConfigurations?.map((w) => w.aspectName).includes(v.name)
8991
+ (S) => S.type === z.Text && t.globalPropertyAspectConfigurations?.map((w) => w.aspectName).includes(S.name)
8987
8992
  );
8988
8993
  if (f) {
8989
8994
  const w = m.getGlobalPropertyStateManager().getAspect(f.name);
@@ -8996,7 +9001,7 @@ class Zo {
8996
9001
  u,
8997
9002
  async () => {
8998
9003
  e.updateMetadata(t.stepName, { color: h, text: g }), e.updateStorage(t.stepName, { text: g, inputText: g });
8999
- const p = s.map((v) => new tn(v.id, A)), f = new U(p);
9004
+ const p = s.map((S) => new tn(S.id, A)), f = new U(p);
9000
9005
  e.getCommandDispatcher()(f);
9001
9006
  }
9002
9007
  ), s.length === 0 && l) {
@@ -9187,14 +9192,14 @@ class Zo {
9187
9192
  if (!m)
9188
9193
  throw new ke("Failed to find layout for region: " + u.panelId);
9189
9194
  const f = a.colorOption;
9190
- let v;
9195
+ let S;
9191
9196
  if (f && f.variants) {
9192
9197
  const F = O.getDefaultVariant(f);
9193
- F && (v = this.createTextFillSpotColor(f, F), o.updateStorage(t, {
9198
+ F && (S = this.createTextFillSpotColor(f, F), o.updateStorage(t, {
9194
9199
  colorProfileAssetKey: f.colorProfile?.key
9195
9200
  }));
9196
9201
  }
9197
- const w = await this.getDefaultColor(a), x = w || "#000000", E = {
9202
+ const w = await this.getDefaultColor(a), x = w || "#000000", v = {
9198
9203
  stepRegion: u,
9199
9204
  stepRegionIndex: h,
9200
9205
  stepName: t,
@@ -9218,34 +9223,34 @@ class Zo {
9218
9223
  verticalAlign: a.verticalAlign || "middle",
9219
9224
  curved: a.curved,
9220
9225
  paths: a.paths,
9221
- fillSpotColorDefinition: v
9222
- }, S = [], I = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
9223
- if (!E.fontData) throw new Q("Failed to resolve font data for text.");
9226
+ fillSpotColorDefinition: S
9227
+ }, E = [], I = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
9228
+ if (!v.fontData) throw new Q("Failed to resolve font data for text.");
9224
9229
  const [R, B] = Ce(
9225
- E.fontSize,
9226
- E.fontData,
9230
+ v.fontSize,
9231
+ v.fontData,
9227
9232
  {
9228
- left: E.x,
9229
- top: E.y,
9230
- width: E.width,
9231
- height: E.height,
9232
- rotation: E.rotation,
9233
+ left: v.x,
9234
+ top: v.y,
9235
+ width: v.width,
9236
+ height: v.height,
9237
+ rotation: v.rotation,
9233
9238
  panelId: ""
9234
9239
  },
9235
9240
  [c],
9236
9241
  { size: a.size, minSize: a.minSize, maxSize: a.maxSize }
9237
9242
  );
9238
- I.set(E.id, R), N.set(E.id, B);
9243
+ I.set(v.id, R), N.set(v.id, B);
9239
9244
  const M = a.curved || a.vertical ? c : (B || []).join(`
9240
9245
  `);
9241
- S.push(
9242
- this.generateTextChangeCommandsForRegion(R, a, E.id, M)
9246
+ E.push(
9247
+ this.generateTextChangeCommandsForRegion(R, a, v.id, M)
9243
9248
  );
9244
- const L = new W(E, m);
9249
+ const L = new W(v, m);
9245
9250
  return {
9246
9251
  regionElement: { id: p, region: u, regionIndex: h },
9247
- commands: [L, ...S],
9248
- newElement: E,
9252
+ commands: [L, ...E],
9253
+ newElement: v,
9249
9254
  fontData: r
9250
9255
  };
9251
9256
  } catch (f) {
@@ -9280,49 +9285,49 @@ class Zo {
9280
9285
  */
9281
9286
  async changeInputTextWithRegion(t, e, a, r, i, o, s, l, c, d) {
9282
9287
  const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = xt(A, o), h = this.getProcessedInput(u, t.data, s), g = o.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
9283
- for (const E of g)
9284
- if (E.region) {
9285
- const [S, I] = Ce(
9288
+ for (const v of g)
9289
+ if (v.region) {
9290
+ const [E, I] = Ce(
9286
9291
  e,
9287
9292
  a,
9288
- E.region,
9293
+ v.region,
9289
9294
  [h],
9290
9295
  { size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
9291
9296
  );
9292
- m.set(E.id, S), p.set(E.id, I);
9297
+ m.set(v.id, E), p.set(v.id, I);
9293
9298
  }
9294
- const v = (() => {
9299
+ const S = (() => {
9295
9300
  if (t.data && t.data.maxLength && h.length > t.data.maxLength)
9296
9301
  return d && d(!0), { info: "0" };
9297
- const E = o.getWorkflowExperience().getProfanityList(), S = la(h.toLowerCase());
9298
- for (const I of S)
9299
- for (const N in E) {
9300
- const R = E[N].toLowerCase().replace(/\s/g, "");
9302
+ const v = o.getWorkflowExperience().getProfanityList(), E = la(h.toLowerCase());
9303
+ for (const I of E)
9304
+ for (const N in v) {
9305
+ const R = v[N].toLowerCase().replace(/\s/g, "");
9301
9306
  if (I === R)
9302
9307
  return l(!0), { error: "Blocked profanity." };
9303
9308
  }
9304
9309
  return !t.data.vertical && !t.data.allowNewlines && (h.includes(`
9305
9310
  `) || h.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(p.values()).every((N) => N) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - h.length).toString() });
9306
9311
  })();
9307
- if (v.error) {
9308
- c(v.error);
9312
+ if (S.error) {
9313
+ c(S.error);
9309
9314
  return;
9310
9315
  }
9311
- if (c(`${v.info} characters remaining` || ""), d)
9316
+ if (c(`${S.info} characters remaining` || ""), d)
9312
9317
  return;
9313
9318
  o.updateStorage(t.stepName, { text: A }), o.updateMetadata(t.stepName, {
9314
9319
  text: this.injectReplaceableText(A, t.data)
9315
9320
  }), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && o.setMandatoryFulfilled(t.stepName, !0);
9316
9321
  const w = [];
9317
- for (const E of g) {
9318
- const S = t.data.curved ? h : (p.get(E.id) || []).join(`
9322
+ for (const v of g) {
9323
+ const E = t.data.curved ? h : (p.get(v.id) || []).join(`
9319
9324
  `);
9320
9325
  w.push(
9321
9326
  this.generateTextChangeCommandsForRegion(
9322
- m.get(E.id) || 1,
9327
+ m.get(v.id) || 1,
9323
9328
  t.data,
9324
- E.id,
9325
- S
9329
+ v.id,
9330
+ E
9326
9331
  )
9327
9332
  );
9328
9333
  }
@@ -9490,10 +9495,10 @@ class ls extends ts {
9490
9495
  w.classList.add("module-text-group");
9491
9496
  const x = et("defs");
9492
9497
  w.appendChild(x), x.appendChild(ns(0, 2, 2, "shadow"));
9493
- const E = et("path");
9494
- E.setAttribute("d", d), E.setAttribute("stroke", "black"), E.setAttribute("stroke-width", "3"), x.appendChild(E);
9495
- const S = et("g");
9496
- S.classList.add("module-layer0"), w.appendChild(S), S.setAttribute("filter", "url(#shadow)"), S.innerHTML = E.outerHTML;
9498
+ const v = et("path");
9499
+ v.setAttribute("d", d), v.setAttribute("stroke", "black"), v.setAttribute("stroke-width", "3"), x.appendChild(v);
9500
+ const E = et("g");
9501
+ E.classList.add("module-layer0"), w.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = v.outerHTML;
9497
9502
  const I = et("g");
9498
9503
  I.classList.add("module-layer1"), w.appendChild(I), I.setAttribute("stroke-width", "3"), I.setAttribute("stroke", "rgb(45,41,38)"), I.setAttribute("fill", "rgb(45,41,38)"), I.setAttribute("transform", "translate(0.5,0)"), I.innerHTML = s;
9499
9504
  const N = et("g");
@@ -9512,8 +9517,8 @@ class ls extends ts {
9512
9517
  p.classList.add("module-text-enclosure"), u.appendChild(p);
9513
9518
  const f = A();
9514
9519
  p.appendChild(f);
9515
- const v = Rr(d);
9516
- return is(p, v, e.height, e.width, 0.35, 0.65), rs(u.outerHTML);
9520
+ const S = Rr(d);
9521
+ return is(p, S, e.height, e.width, 0.35, 0.65), rs(u.outerHTML);
9517
9522
  }
9518
9523
  }
9519
9524
  async function dr(n) {
@@ -9621,7 +9626,7 @@ const cs = [
9621
9626
  const r = e.data, i = a.option;
9622
9627
  if (!i)
9623
9628
  return console.error(`No option for step ${a.stepName}.`), [];
9624
- const o = i.variants?.find((E) => E.id === r.illustrationVariantId) || O.getDefaultVariant(i, a.overrideDefaultVariantId);
9629
+ const o = i.variants?.find((v) => v.id === r.illustrationVariantId) || O.getDefaultVariant(i, a.overrideDefaultVariantId);
9625
9630
  if (!o)
9626
9631
  return console.error(`No variant with ID: ${r.illustrationVariantId}`), [];
9627
9632
  if (!o.asset)
@@ -9635,32 +9640,32 @@ const cs = [
9635
9640
  return console.error("Failed to read SVG."), [];
9636
9641
  Pa(g);
9637
9642
  const m = {};
9638
- Ft(g, (E) => {
9639
- cs.includes(E.tagName) && !E.attributes.getNamedItem("fill") && E.setAttribute("fill", "#000000");
9640
- const S = E.attributes.getNamedItem("fill");
9641
- if (S && S.value !== "none") {
9642
- const N = S.value, B = `spiff-fill-${N.replace(/\W/g, "")}`;
9643
- E.classList.add(B), m[B] = { browserValue: N };
9644
- }
9645
- const I = E.attributes.getNamedItem("stroke");
9643
+ Ft(g, (v) => {
9644
+ cs.includes(v.tagName) && !v.attributes.getNamedItem("fill") && v.setAttribute("fill", "#000000");
9645
+ const E = v.attributes.getNamedItem("fill");
9646
+ if (E && E.value !== "none") {
9647
+ const N = E.value, B = `spiff-fill-${N.replace(/\W/g, "")}`;
9648
+ v.classList.add(B), m[B] = { browserValue: N };
9649
+ }
9650
+ const I = v.attributes.getNamedItem("stroke");
9646
9651
  if (I && I.value !== "none") {
9647
9652
  const N = I.value, B = `spiff-stroke-${N.replace(/\W/g, "")}`;
9648
- E.classList.add(B), m[B] = { browserValue: N };
9653
+ v.classList.add(B), m[B] = { browserValue: N };
9649
9654
  }
9650
9655
  });
9651
- const f = It().serializeToString(g), v = r.colors;
9652
- if (v) {
9653
- for (const [E, S] of Object.entries(m))
9654
- for (const I of Object.keys(v))
9655
- if (S.browserValue === I) {
9656
- m[E] = { browserValue: v[I] };
9656
+ const f = It().serializeToString(g), S = r.colors;
9657
+ if (S) {
9658
+ for (const [v, E] of Object.entries(m))
9659
+ for (const I of Object.keys(S))
9660
+ if (E.browserValue === I) {
9661
+ m[v] = { browserValue: S[I] };
9657
9662
  break;
9658
9663
  }
9659
9664
  }
9660
- const w = (E) => {
9661
- const S = n.find((N) => N.panelId === E.panelId);
9662
- if (!S)
9663
- throw new Y(E);
9665
+ const w = (v) => {
9666
+ const E = n.find((N) => N.panelId === v.panelId);
9667
+ if (!E)
9668
+ throw new Y(v);
9664
9669
  const I = T();
9665
9670
  return new W(
9666
9671
  {
@@ -9668,22 +9673,22 @@ const cs = [
9668
9673
  id: I,
9669
9674
  svg: f,
9670
9675
  type: D.Illustration,
9671
- y: E.top,
9672
- x: E.left,
9673
- rotation: E.rotation,
9674
- width: E.width,
9675
- height: E.height,
9676
- layer: E.layer,
9677
- layerIndex: E.layerIndex,
9678
- immutable: E.immutable
9676
+ y: v.top,
9677
+ x: v.left,
9678
+ rotation: v.rotation,
9679
+ width: v.width,
9680
+ height: v.height,
9681
+ layer: v.layer,
9682
+ layerIndex: v.layerIndex,
9683
+ immutable: v.immutable
9679
9684
  },
9680
- S
9685
+ E
9681
9686
  );
9682
9687
  }, x = a.data.regions;
9683
9688
  try {
9684
9689
  return x.map(w);
9685
- } catch (E) {
9686
- return console.error(E), [];
9690
+ } catch (v) {
9691
+ return console.error(v), [];
9687
9692
  }
9688
9693
  }, hs = async (n, t, e) => {
9689
9694
  const a = await dr(e.data.module), r = t.data, i = (s, l) => {
@@ -9885,9 +9890,9 @@ const cs = [
9885
9890
  if (!f || !f.asset)
9886
9891
  return;
9887
9892
  t[a.stepName] = { selectedVariants: [f] };
9888
- const v = f.asset.fileLink;
9889
- if (v)
9890
- return v;
9893
+ const S = f.asset.fileLink;
9894
+ if (S)
9895
+ return S;
9891
9896
  }, d = await (async () => {
9892
9897
  const p = l();
9893
9898
  if (!p)
@@ -9908,7 +9913,7 @@ const cs = [
9908
9913
  const f = n.find((w) => w.panelId === p.panelId);
9909
9914
  if (!f)
9910
9915
  continue;
9911
- const v = {
9916
+ const S = {
9912
9917
  stepName: e.name,
9913
9918
  id: T(),
9914
9919
  align: s(a.data),
@@ -9949,16 +9954,16 @@ const cs = [
9949
9954
  r.push(
9950
9955
  new W(
9951
9956
  {
9952
- ...v,
9957
+ ...S,
9953
9958
  fontSize: w,
9954
- text: v.curved ? v.text : (x || []).join(`
9959
+ text: S.curved ? S.text : (x || []).join(`
9955
9960
  `)
9956
9961
  },
9957
9962
  f
9958
9963
  )
9959
9964
  );
9960
9965
  } else
9961
- r.push(new W(v, f));
9966
+ r.push(new W(S, f));
9962
9967
  }
9963
9968
  return r;
9964
9969
  }, Cs = (n, t) => n.conditions ? n.conditions.every((e) => {
@@ -11001,7 +11006,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11001
11006
  a.type === we.FirstName ? e[r] = t?.firstName : a.type === we.LastName ? e[r] = t?.lastName : a.type === we.Custom && (a.customFieldIndex === 1 ? e[r] = t?.customField1 : a.customFieldIndex === 2 ? e[r] = t?.customField2 : a.customFieldIndex === 3 ? e[r] = t?.customField3 : a.customFieldIndex === 4 ? e[r] = t?.customField4 : a.customFieldIndex === 5 && (e[r] = t?.customField5), a.option && (e[r] = a.option.variants?.find((i) => i.id === e[r])?.name));
11002
11007
  }), e;
11003
11008
  }
11004
- async updateRecipient(t, e, a, r, i, o, s, l, c, d, A, u, h, g, m, p, f, v) {
11009
+ async updateRecipient(t, e, a, r, i, o, s, l, c, d, A, u, h, g, m, p, f, S) {
11005
11010
  const w = this.experience.getTransaction();
11006
11011
  if (w.recipient?.id)
11007
11012
  this.experience.getTransaction().recipient = {
@@ -11046,7 +11051,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11046
11051
  customField4: m || w.recipient.customField4,
11047
11052
  customField5: p || w.recipient.customField5,
11048
11053
  conversionConfigurationId: f || w.recipient.conversionConfigurationId,
11049
- prevalidated: v
11054
+ prevalidated: S
11050
11055
  }
11051
11056
  });
11052
11057
  else {
@@ -11586,14 +11591,14 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11586
11591
  this.stepSelections = {
11587
11592
  ...this.stepSelections,
11588
11593
  [t]: { selectedVariants: e }
11589
- }, this.selectionCost = Object.values(this.stepSelections).reduce((S, I) => S + I.selectedVariants.map((N) => N.priceModifier || 0).reduce((N, R) => N + R, 0), 0), i.steps.forEach((S) => {
11590
- vt(S, this.stepSelections) || (this.stepInitialised[S.stepName] = !1, delete this.stepMetadata[S.stepName], delete this.stepSelections[S.stepName], delete this.storage[S.stepName]);
11594
+ }, this.selectionCost = Object.values(this.stepSelections).reduce((E, I) => E + I.selectedVariants.map((N) => N.priceModifier || 0).reduce((N, R) => N + R, 0), 0), i.steps.forEach((E) => {
11595
+ vt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
11591
11596
  });
11592
- const s = this.allScenes, l = yt(s, o), c = yt(s, this.stepSelections), d = l.map((S) => S.silentSteps).flat(), u = c.map((S) => S.silentSteps).flat().filter(
11593
- (S) => !d.some((I) => I.stepName === S.stepName)
11597
+ const s = this.allScenes, l = yt(s, o), c = yt(s, this.stepSelections), d = l.map((E) => E.silentSteps).flat(), u = c.map((E) => E.silentSteps).flat().filter(
11598
+ (E) => !d.some((I) => I.stepName === E.stepName)
11594
11599
  );
11595
- d.forEach((S) => {
11596
- vt(S, this.stepSelections) || (this.stepInitialised[S.stepName] = !1);
11600
+ d.forEach((E) => {
11601
+ vt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1);
11597
11602
  });
11598
11603
  const h = this.getInvalidCanvasRegions(), { stepElements: g, commands: m } = await this.stepElementsForIntroducedSilentSteps(u, !1);
11599
11604
  this.stepElements = {
@@ -11601,14 +11606,14 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11601
11606
  ...g,
11602
11607
  [t]: a
11603
11608
  }, this.removeElements(h);
11604
- const p = i.steps.find((S) => S.stepName === t);
11609
+ const p = i.steps.find((E) => E.stepName === t);
11605
11610
  p?.type === b.Frame && this.getWorkflowExperience().getStepById(p.stepName)?.frameService?.setTargetElements(a.map((I) => I.id));
11606
- const f = h.map((S) => new Nt(S.id)), v = new Za(this.constructSerializableWorkflow()), w = [...m, ...f, v];
11611
+ const f = h.map((E) => new Nt(E.id)), S = new Za(this.constructSerializableWorkflow()), w = [...m, ...f, S];
11607
11612
  w.length > 0 && this.commandContext.apply(new U(w), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
11608
- const x = this.getInvalidModelVariants(), E = this.modelContainer;
11609
- if (E) {
11610
- const S = x.map(
11611
- (I) => E.applyModelVariant(
11613
+ const x = this.getInvalidModelVariants(), v = this.modelContainer;
11614
+ if (v) {
11615
+ const E = x.map(
11616
+ (I) => v.applyModelVariant(
11612
11617
  I,
11613
11618
  {
11614
11619
  contextService: this.getLayoutPreviewService()
@@ -11616,7 +11621,7 @@ const rl = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
11616
11621
  !1
11617
11622
  )
11618
11623
  );
11619
- await Promise.all(S);
11624
+ await Promise.all(E);
11620
11625
  }
11621
11626
  await this.onSelectionChange(), p?.type !== b.Frame && p?.type !== b.Text && this.setMandatoryFulfilled(t, !0), r && await r();
11622
11627
  }
@@ -12620,7 +12625,7 @@ const Cl = async (n, t) => {
12620
12625
  return i && (h.metadata = i), a && (h.selectedVariants = a), r && (h.sku = r), h;
12621
12626
  }, Sl = async (n, t, e, a, r, i, o, s, l, c) => {
12622
12627
  c && (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await n.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
12623
- const d = n.getPreviewService(), A = t?.finalizeStepConfig?.lookAtAnimation, u = d && t.showModelOnFinishStep && !!A, h = l && on(l, t, !0), g = l && on(l, t, !1), m = async (S) => {
12628
+ const d = n.getPreviewService(), A = t?.finalizeStepConfig?.lookAtAnimation, u = d && t.showModelOnFinishStep && !!A, h = l && on(l, t, !0), g = l && on(l, t, !1), m = async (E) => {
12624
12629
  const I = {};
12625
12630
  let N = 0;
12626
12631
  if (Object.keys(i).length > 0)
@@ -12628,7 +12633,7 @@ const Cl = async (n, t) => {
12628
12633
  const B = i[R], M = t.steps.find((L) => L.stepName === R);
12629
12634
  for (let L = 0; L < B.selections.length; ++L) {
12630
12635
  const F = B.selections[L];
12631
- if (M && (!S || M.option && (M.option.variants || []).length > 1 && !M.data.hideSelectionInCart && !M.data.hideSelectionsInCart)) {
12636
+ if (M && (!E || M.option && (M.option.variants || []).length > 1 && !M.data.hideSelectionInCart && !M.data.hideSelectionsInCart)) {
12632
12637
  const J = M.stepTitle;
12633
12638
  I[J] ? I[J].push({
12634
12639
  id: F.id || "",
@@ -12647,18 +12652,18 @@ const Cl = async (n, t) => {
12647
12652
  }
12648
12653
  return [I, N];
12649
12654
  }, [p] = await m(!0), f = Object.fromEntries(
12650
- Object.keys(p).map((S) => [S, p[S].map((I) => I.id)])
12651
- ), [v] = await m(!1), w = Object.fromEntries(
12652
- Object.keys(v).map((S) => [
12653
- S,
12654
- v[S].map((I) => I.id)
12655
+ Object.keys(p).map((E) => [E, p[E].map((I) => I.id)])
12656
+ ), [S] = await m(!1), w = Object.fromEntries(
12657
+ Object.keys(S).map((E) => [
12658
+ E,
12659
+ S[E].map((I) => I.id)
12655
12660
  ])
12656
12661
  );
12657
12662
  let x = await s(u, r.id);
12658
12663
  if (x) {
12659
- const S = await (await nt(x)).blob();
12664
+ const E = await (await nt(x)).blob();
12660
12665
  x = (await j.uploadAsset(
12661
- { name: `${r.id}-preview-image.png`, blob: S },
12666
+ { name: `${r.id}-preview-image.png`, blob: E },
12662
12667
  Se.Image,
12663
12668
  !0,
12664
12669
  !1
@@ -12666,7 +12671,7 @@ const Cl = async (n, t) => {
12666
12671
  }
12667
12672
  return {
12668
12673
  designDetails: (() => {
12669
- const S = {
12674
+ const E = {
12670
12675
  name: o,
12671
12676
  layouts: e.map((I) => ({
12672
12677
  index: I.index,
@@ -12681,15 +12686,15 @@ const Cl = async (n, t) => {
12681
12686
  const I = [];
12682
12687
  for (const [N, R] of Object.entries(g))
12683
12688
  I.push({ key: N, value: R });
12684
- S.metadata = I;
12689
+ E.metadata = I;
12685
12690
  }
12686
12691
  if (f) {
12687
12692
  const I = [];
12688
12693
  for (const [N, R] of Object.entries(w))
12689
12694
  I.push({ key: N, ids: R });
12690
- S.selectedVariants = I;
12695
+ E.selectedVariants = I;
12691
12696
  }
12692
- return S;
12697
+ return E;
12693
12698
  })(),
12694
12699
  cartSelectionsWithPrices: p,
12695
12700
  cartMetadata: h
@@ -13152,8 +13157,8 @@ class Bl {
13152
13157
  DOMParser: Ba(),
13153
13158
  fetch
13154
13159
  })).render();
13155
- const v = await this.getCanvasObjectURLAsync(o);
13156
- return o.toDataURL(v);
13160
+ const S = await this.getCanvasObjectURLAsync(o);
13161
+ return o.toDataURL(S);
13157
13162
  }
13158
13163
  getStepById(t) {
13159
13164
  const e = this.getWorkflow()?.steps.find((i) => i.stepName === t);
@@ -14867,7 +14872,7 @@ class cn {
14867
14872
  const g = h.map((m) => {
14868
14873
  if (m.getType() === z.ColorOption || m.getType() === z.Option) {
14869
14874
  const p = m;
14870
- if (!u.aspects.find((v) => v.name === p.getName()))
14875
+ if (!u.aspects.find((S) => S.name === p.getName()))
14871
14876
  return p.initDefaultVariant();
14872
14877
  }
14873
14878
  });
@@ -16183,7 +16188,7 @@ class Vd {
16183
16188
  } catch (a) {
16184
16189
  throw console.error(a), new gt("Critical - Unable to synchronize workflow state with server.");
16185
16190
  }
16186
- }, this.options = t, this.options.applicationKey && ri(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 34.4.6"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16191
+ }, this.options = t, this.options.applicationKey && ri(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 34.4.8"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16187
16192
  }
16188
16193
  configure(t) {
16189
16194
  pt.setHubUrl(t.hubUrl), pt.setServerUrl(t.serverUrl), pt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && oi(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
@@ -16502,7 +16507,7 @@ class Vd {
16502
16507
  const g = await this.loggedInBearerToken();
16503
16508
  l.Authorization = `Bearer ${g}`;
16504
16509
  } catch {
16505
- const p = Object.entries(localStorage).find(([v, w]) => v.startsWith("CognitoIdentityServiceProvider") && v.endsWith("idToken"))?.[0] || "", f = localStorage.getItem(p);
16510
+ const p = Object.entries(localStorage).find(([S, w]) => S.startsWith("CognitoIdentityServiceProvider") && S.endsWith("idToken"))?.[0] || "", f = localStorage.getItem(p);
16506
16511
  f && !Me(f) && (l.Authorization = `Bearer ${f}`);
16507
16512
  }
16508
16513
  const c = {
@@ -16705,11 +16710,11 @@ class Vd {
16705
16710
  ...new Set(m.map((B) => B.transaction.integrationProductId))
16706
16711
  ].filter((B) => B !== void 0), f = [...new Set(m.map((B) => B.workflowId))].filter(
16707
16712
  (B) => B !== void 0
16708
- ), [v, w] = await Promise.all([
16713
+ ), [S, w] = await Promise.all([
16709
16714
  (async () => p.length > 0 ? await cc(p) : [])(),
16710
16715
  (async () => f.length > 0 ? await fr(f, e) : [])()
16711
- ]), x = new Map(v.map((B) => [B.id, B])), E = new Map(w.map((B) => [B.id, B])), S = m.map(async (B) => {
16712
- const { transaction: M, workflowId: L, readOnly: F, index: J } = B, We = L ? E.get(L) : void 0, At = t[J];
16716
+ ]), x = new Map(S.map((B) => [B.id, B])), v = new Map(w.map((B) => [B.id, B])), E = m.map(async (B) => {
16717
+ const { transaction: M, workflowId: L, readOnly: F, index: J } = B, We = L ? v.get(L) : void 0, At = t[J];
16713
16718
  if (M.integrationProductId) {
16714
16719
  const rt = x.get(M.integrationProductId);
16715
16720
  M.integrationProduct = rt, M.product = rt?.product, M.integrationProduct || console.error("failed to find transaction's product");
@@ -16741,7 +16746,7 @@ class Vd {
16741
16746
  await Xa(rt), ie.reloadedState = rt;
16742
16747
  }
16743
16748
  return ie.delayWorkflowStateSync = !0, { experienceOptions: ie, index: J, options: At };
16744
- }), N = (await Promise.all(S)).sort((B, M) => B.index - M.index);
16749
+ }), N = (await Promise.all(E)).sort((B, M) => B.index - M.index);
16745
16750
  let R = [];
16746
16751
  for (const B of N) {
16747
16752
  const { experienceOptions: M, options: L } = B, F = new Bl(this, M);