@spiffcommerce/core 28.0.1-beta.29d7ea3f-e4d3-5c03-bd48-b02b5e782f5a → 28.0.1-beta.c0ca606a-6b3b-564d-94a5-be05027cc197

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
- }, X = (r, t) => {
6544
+ }, Z = (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 = X(a, n);
6637
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(a, n);
6659
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(a, n);
6690
+ const n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(a, n);
6822
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(a, n);
6844
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(ee(a, i), n);
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);
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 = X(ee(a, i), n);
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);
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 = X(a, n);
6910
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(a, n);
6971
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(a, n);
6993
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(ee(e, this.text, e), a);
7012
+ const a = _(e.id, Object.values(t.layouts)), n = Z(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 = X(a, n);
7035
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(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 = X(i, s);
7067
+ }, s = _(e.id, Object.values(t.layouts)), o = Z(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 = X(a, n);
7090
+ }, n = _(e.id, Object.values(t.layouts)), i = Z(a, n);
7091
7091
  return {
7092
7092
  ...t,
7093
7093
  layouts: {
@@ -11468,7 +11468,7 @@ class Bo extends it {
11468
11468
  */
11469
11469
  async setFillColor(t) {
11470
11470
  const e = this.manager.getRegionElements(this.step.stepName);
11471
- await j.changeFillColor(this.step, t, e, this.manager);
11471
+ 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
11472
  }
11473
11473
  /**
11474
11474
  * Gets the color currently applied to the element.
@@ -11516,7 +11516,6 @@ class Bo extends it {
11516
11516
  */
11517
11517
  setText(t) {
11518
11518
  var d;
11519
- console.log("LOG: attempting to set text in handle"), console.trace();
11520
11519
  const e = {
11521
11520
  input: t,
11522
11521
  helperData: {}
@@ -11991,22 +11990,22 @@ const ko = async (r, t) => {
11991
11990
  for (const T of Object.keys(i)) {
11992
11991
  const nt = i[T], R = t.steps.find((tt) => tt.stepName === T);
11993
11992
  for (let tt = 0; tt < nt.selections.length; ++tt) {
11994
- const Z = nt.selections[tt];
11993
+ const X = nt.selections[tt];
11995
11994
  if (R && (!D || R.option && (R.option.variants || []).length > 1 && !R.data.hideSelectionInCart && !R.data.hideSelectionsInCart)) {
11996
11995
  const Nt = R.stepTitle;
11997
11996
  F[Nt] ? F[Nt].push({
11998
- id: Z.id || "",
11999
- name: Z.name,
12000
- priceModifier: Z.priceModifier
11997
+ id: X.id || "",
11998
+ name: X.name,
11999
+ priceModifier: X.priceModifier
12001
12000
  }) : F[Nt] = [
12002
12001
  {
12003
- id: Z.id || "",
12004
- name: Z.name,
12005
- priceModifier: Z.priceModifier
12002
+ id: X.id || "",
12003
+ name: X.name,
12004
+ priceModifier: X.priceModifier
12006
12005
  }
12007
12006
  ];
12008
12007
  }
12009
- k += Z.priceModifier;
12008
+ k += X.priceModifier;
12010
12009
  }
12011
12010
  }
12012
12011
  return [F, k];
@@ -13493,17 +13492,15 @@ class Ia {
13493
13492
  * @param targetExperiences Optionally filter the steps to only those in the given experiences.
13494
13493
  */
13495
13494
  getSharedSteps(t) {
13496
- return (t ?? this.bundle.getWorkflowExperiences()).flatMap(
13497
- (n) => n.getStepsConditionallyActive().filter((i) => {
13498
- var s;
13499
- return i.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (s = i.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : s.some(
13500
- (o) => {
13501
- var l, c;
13502
- return o.globalPropertyConfigurationId === ((c = (l = this.bundle.getProductCollection()) == null ? void 0 : l.getResource().globalPropertyConfiguration) == null ? void 0 : c.id) && o.aspectName === this.property.name;
13503
- }
13504
- );
13505
- })
13506
- );
13495
+ return (t ?? this.bundle.getWorkflowExperiences()).flatMap((n) => n.getSteps().filter((s) => {
13496
+ var o;
13497
+ return s.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (o = s.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : o.some(
13498
+ (l) => {
13499
+ var c, d;
13500
+ return l.globalPropertyConfigurationId === ((d = (c = this.bundle.getProductCollection()) == null ? void 0 : c.getResource().globalPropertyConfiguration) == null ? void 0 : d.id) && l.aspectName === this.property.name;
13501
+ }
13502
+ );
13503
+ }));
13507
13504
  }
13508
13505
  getStateValue() {
13509
13506
  return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);
@@ -13788,14 +13785,13 @@ class Zn extends Ia {
13788
13785
  */
13789
13786
  async initDefaultVariant() {
13790
13787
  var e, a;
13791
- console.log(`LOG: attempting to init default variant for property ${this.property.name}`);
13792
13788
  const t = (a = (e = this.optionResource) == null ? void 0 : e.variants) == null ? void 0 : a.find(
13793
13789
  (n) => {
13794
13790
  var i, s;
13795
13791
  return n.id === ((s = (i = this.optionResource) == null ? void 0 : i.defaultVariant) == null ? void 0 : s.id);
13796
13792
  }
13797
13793
  );
13798
- t && (console.log("LOG: found one"), await this.selectVariant(new st(t)));
13794
+ t && await this.selectVariant(new st(t));
13799
13795
  }
13800
13796
  /**
13801
13797
  * Gets the currently selected variant, or undefined if no variant is selected.
@@ -13837,7 +13833,7 @@ class Zn extends Ia {
13837
13833
  * @param variant The variant to select.
13838
13834
  */
13839
13835
  async selectVariant(t, e) {
13840
- console.log(`LOG: selecting variant ${t.getName()} (${t.getId()}) for property ${this.property.name}`), console.trace(), await Promise.all([
13836
+ await Promise.all([
13841
13837
  this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e),
13842
13838
  this.applyVariantSelection(t)
13843
13839
  ]);
@@ -13864,13 +13860,14 @@ class Ja extends Zn {
13864
13860
  * @param variant The variant to select.
13865
13861
  */
13866
13862
  async selectVariant(t, e) {
13867
- console.log(`LOG: selecting color variant ${t.getName()} (${t.getId()}) for property ${this.property.name}`), console.trace(), await Promise.all([
13863
+ await Promise.all([
13868
13864
  this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name, t.getId(), void 0, e),
13869
13865
  this.applyColorVariant(t, void 0, e)
13870
13866
  ]);
13871
13867
  }
13872
13868
  async applyGlobalState(t) {
13873
13869
  var i, s, o;
13870
+ console.log(`LOG: applying global state for color ${this.property.name}`);
13874
13871
  const e = this.getStateValue();
13875
13872
  if (!e)
13876
13873
  return Promise.resolve();
@@ -13879,11 +13876,13 @@ class Ja extends Zn {
13879
13876
  return Promise.resolve();
13880
13877
  await this.applyColorVariant(new st(a), t);
13881
13878
  const n = (o = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)) == null ? void 0 : o.customColor;
13882
- n && this.setCustomColor(n);
13879
+ console.log(`LOG: custom color ${n}`), n && this.setCustomColor(n);
13883
13880
  }
13884
13881
  async applyColorVariant(t, e, a) {
13885
- const i = this.getSharedSteps(e).map((s) => {
13886
- switch (s.getType()) {
13882
+ const n = this.getSharedSteps(e);
13883
+ console.log(`LOG: applying color variant ${t.getName()} for ${n.length} shared steps`);
13884
+ const i = n.map((s) => {
13885
+ switch (console.log(`LOG: applying to step type ${s.getType()}`), s.getType()) {
13887
13886
  case P.Shape:
13888
13887
  return s.selectVariant(t);
13889
13888
  case P.Text:
@@ -15994,7 +15993,7 @@ class Ad {
15994
15993
  } catch (a) {
15995
15994
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15996
15995
  }
15997
- }, 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.f5df4b3f-ec7b-542e-84ca-48ed7f2a1458"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15996
+ }, 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.c9d47279-485f-5468-a067-5177a42fb1ae"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15998
15997
  }
15999
15998
  configure(t) {
16000
15999
  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);
@@ -16556,18 +16555,18 @@ class Ad {
16556
16555
  singleVariantsRenderable: (tt = k == null ? void 0 : k.workflowConfiguration) == null ? void 0 : tt.singleVariantsRenderable,
16557
16556
  stateMutationFunc: I ? async () => {
16558
16557
  throw new G("State mutation is forbidden in read only mode!");
16559
- } : async (Z) => this.updateTransactionState({
16560
- ...Z,
16558
+ } : async (X) => (console.log(`LOG: updating transaction with options ${JSON.stringify(X, null, 2)}`), console.trace(), this.updateTransactionState({
16559
+ ...X,
16561
16560
  context: { transactionOwnerId: T, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId }
16562
- }),
16561
+ })),
16563
16562
  graphQlClient: () => nt,
16564
16563
  readOnly: I,
16565
16564
  workflow: F,
16566
16565
  isReloadedTransaction: k.type === "transaction"
16567
16566
  };
16568
16567
  if (!I && k.workflowState) {
16569
- const Z = JSON.parse(k.workflowState);
16570
- R.layouts = Object.values(Z.layouts || {}).map((Nt) => Nt.layout), await cs(Z), R.reloadedState = Z;
16568
+ const X = JSON.parse(k.workflowState);
16569
+ R.layouts = Object.values(X.layouts || {}).map((Nt) => Nt.layout), await cs(X), R.reloadedState = X;
16571
16570
  } else
16572
16571
  R.layouts = Rl(
16573
16572
  R.transaction,