@spiffcommerce/core 28.0.1-beta.cf9847f6-7f99-59a1-a7ce-5381b1ac1990 → 28.0.1-beta.ecd0c9f9-3452-55d8-9a01-b4ec364f53fb

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
@@ -6541,7 +6541,7 @@ const L = (r, t) => _(r, t).elements.find((n) => n.id === r), _ = (r, t) => {
6541
6541
  if (!e)
6542
6542
  throw new V();
6543
6543
  return e;
6544
- }, Z = (r, t) => {
6544
+ }, X = (r, t) => {
6545
6545
  const e = [...t.elements.filter((n) => n.id !== r.id), r], a = va(e);
6546
6546
  return {
6547
6547
  layout: t.layout,
@@ -6634,7 +6634,7 @@ class Kc extends O {
6634
6634
  ...e,
6635
6635
  x: this.x,
6636
6636
  y: this.y
6637
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6637
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6638
6638
  return {
6639
6639
  ...t,
6640
6640
  layouts: {
@@ -6656,7 +6656,7 @@ class _c extends O {
6656
6656
  const a = {
6657
6657
  ...e,
6658
6658
  rotation: this.angle
6659
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6659
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6660
6660
  return {
6661
6661
  ...t,
6662
6662
  layouts: {
@@ -6687,7 +6687,7 @@ class Xc extends O {
6687
6687
  const s = a, o = (!s.algorithm || s.algorithm === kt.Autosize ? s.text : s.input) ?? "";
6688
6688
  a = ee(s, o, e);
6689
6689
  }
6690
- const n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6690
+ const n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6691
6691
  return {
6692
6692
  ...t,
6693
6693
  layouts: {
@@ -6819,7 +6819,7 @@ class ds extends O {
6819
6819
  fill: this.color,
6820
6820
  fillSpotColorDefinition: this.textFillSpotColor,
6821
6821
  textFillImage: void 0
6822
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6822
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6823
6823
  return {
6824
6824
  ...t,
6825
6825
  layouts: {
@@ -6841,7 +6841,7 @@ class We extends O {
6841
6841
  const a = {
6842
6842
  ...e,
6843
6843
  textFillImage: this.imageFill
6844
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6844
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6845
6845
  return {
6846
6846
  ...t,
6847
6847
  layouts: {
@@ -6863,7 +6863,7 @@ class As extends O {
6863
6863
  const a = {
6864
6864
  ...e,
6865
6865
  fontSize: this.size
6866
- }, n = _(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === kt.Autosize ? e.text : e.input) ?? "", s = Z(ee(a, i), n);
6866
+ }, n = _(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === kt.Autosize ? e.text : e.input) ?? "", s = X(ee(a, i), n);
6867
6867
  return {
6868
6868
  ...t,
6869
6869
  layouts: {
@@ -6885,7 +6885,7 @@ class Wa extends O {
6885
6885
  const a = {
6886
6886
  ...e,
6887
6887
  fontData: this.fontData
6888
- }, n = _(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === kt.Autosize ? e.text : e.input) ?? "", s = Z(ee(a, i), n);
6888
+ }, n = _(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === kt.Autosize ? e.text : e.input) ?? "", s = X(ee(a, i), n);
6889
6889
  return {
6890
6890
  ...t,
6891
6891
  layouts: {
@@ -6907,7 +6907,7 @@ class us extends O {
6907
6907
  const a = {
6908
6908
  ...e,
6909
6909
  align: this.align
6910
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6910
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6911
6911
  return {
6912
6912
  ...t,
6913
6913
  layouts: {
@@ -6968,7 +6968,7 @@ class ms extends O {
6968
6968
  invertThreshold: this.invertThreshold,
6969
6969
  threshold: this.threshold,
6970
6970
  thresholdSaturation: this.thresholdSaturation
6971
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6971
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6972
6972
  return {
6973
6973
  ...t,
6974
6974
  layouts: {
@@ -6990,7 +6990,7 @@ class Zc extends O {
6990
6990
  const a = {
6991
6991
  ...e,
6992
6992
  src: this.src
6993
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
6993
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
6994
6994
  return {
6995
6995
  ...t,
6996
6996
  layouts: {
@@ -7009,7 +7009,7 @@ class gs extends O {
7009
7009
  const e = L(this.id, Object.values(t.layouts));
7010
7010
  if (!e.id)
7011
7011
  throw new V();
7012
- const a = _(e.id, Object.values(t.layouts)), n = Z(ee(e, this.text, e), a);
7012
+ const a = _(e.id, Object.values(t.layouts)), n = X(ee(e, this.text, e), a);
7013
7013
  return {
7014
7014
  ...t,
7015
7015
  layouts: {
@@ -7032,7 +7032,7 @@ class je extends O {
7032
7032
  ...e,
7033
7033
  strokeColor: this.strokeColor,
7034
7034
  strokeThickness: this.strokeThickness
7035
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
7035
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
7036
7036
  return {
7037
7037
  ...t,
7038
7038
  layouts: {
@@ -7064,7 +7064,7 @@ class oa extends O {
7064
7064
  const i = {
7065
7065
  ...e,
7066
7066
  colors: a
7067
- }, s = _(e.id, Object.values(t.layouts)), o = Z(i, s);
7067
+ }, s = _(e.id, Object.values(t.layouts)), o = X(i, s);
7068
7068
  return {
7069
7069
  ...t,
7070
7070
  layouts: {
@@ -7087,7 +7087,7 @@ class ps extends O {
7087
7087
  ...e,
7088
7088
  svg: this.svgBody,
7089
7089
  cachedObjectURL: this.objectURL
7090
- }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
7090
+ }, n = _(e.id, Object.values(t.layouts)), i = X(a, n);
7091
7091
  return {
7092
7092
  ...t,
7093
7093
  layouts: {
@@ -10391,6 +10391,7 @@ class Co {
10391
10391
  this.recipientCallbacks.forEach((p) => p(this.transaction.recipient));
10392
10392
  }
10393
10393
  async initializeDefaultWorkflowState(t) {
10394
+ console.log("LOG: default workflow state?");
10394
10395
  const e = () => {
10395
10396
  var d, A;
10396
10397
  const o = this.workflow.finalizeStepConfig;
@@ -10851,7 +10852,7 @@ class Co {
10851
10852
  });
10852
10853
  }
10853
10854
  async reset() {
10854
- this.commandContext.getAllLayouts().forEach(
10855
+ console.log("LOG: reset?"), this.commandContext.getAllLayouts().forEach(
10855
10856
  (e) => e.layoutState.elements.forEach((a) => {
10856
10857
  this.getCommandDispatcher()(new Et(a.id));
10857
10858
  })
@@ -10859,6 +10860,7 @@ class Co {
10859
10860
  }
10860
10861
  async setSelectionsAndElements(t, e, a, n) {
10861
10862
  var y;
10863
+ console.log("LOG: set selections?");
10862
10864
  const i = this.stepSelections;
10863
10865
  this.stepSelections = {
10864
10866
  ...this.stepSelections,
@@ -10901,10 +10903,11 @@ class Co {
10901
10903
  await this.onSelectionChange(), n && await n();
10902
10904
  }
10903
10905
  async ensureStepsAreLoaded() {
10906
+ console.log("LOG: ensure steps loaded"), console.trace();
10904
10907
  const e = Pt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
10905
10908
  for (const l of n)
10906
10909
  if (!this.stepInitialised[l.stepName])
10907
- switch (this.stepInitialised[l.stepName] = !0, l.type) {
10910
+ switch (console.log(`LOG: step ${l.stepTitle} (${l.stepName}) was not inited`), this.stepInitialised[l.stepName] = !0, l.type) {
10908
10911
  case P.DigitalContent:
10909
10912
  a.push(
10910
10913
  zn.init(
@@ -11468,7 +11471,7 @@ class Bo extends it {
11468
11471
  */
11469
11472
  async setFillColor(t) {
11470
11473
  const e = this.manager.getRegionElements(this.step.stepName);
11471
- await j.changeFillColor(this.step, t, e, this.manager);
11474
+ console.log(`LOG: changing fill color of step ${this.step.stepTitle} (${this.step.stepName}) with ${e.length} elements to ${t}`), await j.changeFillColor(this.step, t, e, this.manager);
11472
11475
  }
11473
11476
  /**
11474
11477
  * Gets the color currently applied to the element.
@@ -11990,22 +11993,22 @@ const ko = async (r, t) => {
11990
11993
  for (const T of Object.keys(i)) {
11991
11994
  const nt = i[T], R = t.steps.find((tt) => tt.stepName === T);
11992
11995
  for (let tt = 0; tt < nt.selections.length; ++tt) {
11993
- const X = nt.selections[tt];
11996
+ const Z = nt.selections[tt];
11994
11997
  if (R && (!D || R.option && (R.option.variants || []).length > 1 && !R.data.hideSelectionInCart && !R.data.hideSelectionsInCart)) {
11995
11998
  const Nt = R.stepTitle;
11996
11999
  F[Nt] ? F[Nt].push({
11997
- id: X.id || "",
11998
- name: X.name,
11999
- priceModifier: X.priceModifier
12000
+ id: Z.id || "",
12001
+ name: Z.name,
12002
+ priceModifier: Z.priceModifier
12000
12003
  }) : F[Nt] = [
12001
12004
  {
12002
- id: X.id || "",
12003
- name: X.name,
12004
- priceModifier: X.priceModifier
12005
+ id: Z.id || "",
12006
+ name: Z.name,
12007
+ priceModifier: Z.priceModifier
12005
12008
  }
12006
12009
  ];
12007
12010
  }
12008
- k += X.priceModifier;
12011
+ k += Z.priceModifier;
12009
12012
  }
12010
12013
  }
12011
12014
  return [F, k];
@@ -13492,17 +13495,15 @@ class Ia {
13492
13495
  * @param targetExperiences Optionally filter the steps to only those in the given experiences.
13493
13496
  */
13494
13497
  getSharedSteps(t) {
13495
- return (t ?? this.bundle.getWorkflowExperiences()).flatMap(
13496
- (n) => n.getStepsConditionallyActive().filter((i) => {
13497
- var s;
13498
- return i.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (s = i.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : s.some(
13499
- (o) => {
13500
- var l, c;
13501
- return o.globalPropertyConfigurationId === ((c = (l = this.bundle.getProductCollection()) == null ? void 0 : l.getResource().globalPropertyConfiguration) == null ? void 0 : c.id) && o.aspectName === this.property.name;
13502
- }
13503
- );
13504
- })
13505
- );
13498
+ return (t ?? this.bundle.getWorkflowExperiences()).flatMap((n) => n.getSteps().filter((s) => {
13499
+ var o;
13500
+ return s.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (o = s.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : o.some(
13501
+ (l) => {
13502
+ var c, d;
13503
+ return l.globalPropertyConfigurationId === ((d = (c = this.bundle.getProductCollection()) == null ? void 0 : c.getResource().globalPropertyConfiguration) == null ? void 0 : d.id) && l.aspectName === this.property.name;
13504
+ }
13505
+ );
13506
+ }));
13506
13507
  }
13507
13508
  getStateValue() {
13508
13509
  return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);
@@ -13842,7 +13843,6 @@ class Zn extends Ia {
13842
13843
  }
13843
13844
  async applyGlobalState(t) {
13844
13845
  var n, i;
13845
- console.log(`LOG: applying global state for option ${this.property.name}`);
13846
13846
  const e = this.getStateValue();
13847
13847
  if (!e)
13848
13848
  return Promise.resolve();
@@ -13883,9 +13883,9 @@ class Ja extends Zn {
13883
13883
  }
13884
13884
  async applyColorVariant(t, e, a) {
13885
13885
  const n = this.getSharedSteps(e);
13886
- console.log(`LOG: applying color variant for ${n.length} shared steps`);
13886
+ console.log(`LOG: applying color variant ${t.getName()} for ${n.length} shared steps`);
13887
13887
  const i = n.map((s) => {
13888
- switch (s.getType()) {
13888
+ switch (console.log(`LOG: applying to step type ${s.getType()}`), s.getType()) {
13889
13889
  case P.Shape:
13890
13890
  return s.selectVariant(t);
13891
13891
  case P.Text:
@@ -15996,7 +15996,7 @@ class Ad {
15996
15996
  } catch (a) {
15997
15997
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15998
15998
  }
15999
- }, this.options = t, this.options.applicationKey && $r(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 28.0.1-beta.ac9a049c-ad73-555a-adbf-f7557a7cdbde"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15999
+ }, this.options = t, this.options.applicationKey && $r(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 28.0.1-beta.c0ca606a-6b3b-564d-94a5-be05027cc197"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16000
16000
  }
16001
16001
  configure(t) {
16002
16002
  mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.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 && Lr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
@@ -16558,8 +16558,8 @@ class Ad {
16558
16558
  singleVariantsRenderable: (tt = k == null ? void 0 : k.workflowConfiguration) == null ? void 0 : tt.singleVariantsRenderable,
16559
16559
  stateMutationFunc: I ? async () => {
16560
16560
  throw new G("State mutation is forbidden in read only mode!");
16561
- } : async (X) => (console.log(`LOG: updating transaction with options ${JSON.stringify(X, null, 2)}`), console.trace(), this.updateTransactionState({
16562
- ...X,
16561
+ } : async (Z) => (console.log("LOG: updating transaction"), console.trace(), this.updateTransactionState({
16562
+ ...Z,
16563
16563
  context: { transactionOwnerId: T, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId }
16564
16564
  })),
16565
16565
  graphQlClient: () => nt,
@@ -16568,8 +16568,8 @@ class Ad {
16568
16568
  isReloadedTransaction: k.type === "transaction"
16569
16569
  };
16570
16570
  if (!I && k.workflowState) {
16571
- const X = JSON.parse(k.workflowState);
16572
- R.layouts = Object.values(X.layouts || {}).map((Nt) => Nt.layout), await cs(X), R.reloadedState = X;
16571
+ const Z = JSON.parse(k.workflowState);
16572
+ R.layouts = Object.values(Z.layouts || {}).map((Nt) => Nt.layout), await cs(Z), R.reloadedState = Z;
16573
16573
  } else
16574
16574
  R.layouts = Rl(
16575
16575
  R.transaction,