@spiffcommerce/core 32.2.2-beta.2c2f71ee-099a-5b12-afe9-5733bef091e2 → 32.2.3-beta.b5a7d626-2f37-53ef-b01b-0ee2a6660230

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
@@ -14690,7 +14690,7 @@ const bl = w`
14690
14690
  `;
14691
14691
  class _e {
14692
14692
  constructor(t, e, a, n, i, s) {
14693
- this.workflowExperiences = [], this.eventEmitter = new El(), this.client = t, this.id = e.id, this.name = e.name || "", this.dispatchDate = e.dispatchDate, this.template = e.template || !1, this.quoteId = e.quoteId, this.shareActions = e.bundleShareActions, this.workflowViewerLink = e.workflowViewerLink, this.workflowViewerAmendLink = e.workflowViewerAmendLink, this.ownerId = i, this.metadata = new Map(e.metadata?.map((c) => [c.key, c.value]) || []), this.completed = e.completed ?? !1, this.productCollection = e.productCollection, this.bundleStateManager = new gl(e.bundleStateData);
14693
+ this.workflowExperiences = [], this.eventEmitter = new El(), this.updatesLocked = !1, this.client = t, this.id = e.id, this.name = e.name || "", this.dispatchDate = e.dispatchDate, this.template = e.template || !1, this.quoteId = e.quoteId, this.shareActions = e.bundleShareActions, this.workflowViewerLink = e.workflowViewerLink, this.workflowViewerAmendLink = e.workflowViewerAmendLink, this.ownerId = i, this.metadata = new Map(e.metadata?.map((c) => [c.key, c.value]) || []), this.completed = e.completed ?? !1, this.productCollection = e.productCollection, this.bundleStateManager = new gl(e.bundleStateData);
14694
14694
  const o = this.productCollection?.globalPropertyConfiguration;
14695
14695
  this.globalConfigurationPropertyId = o?.id, this.globalPropertyStateManager = new ml(
14696
14696
  this.id,
@@ -14834,51 +14834,55 @@ class _e {
14834
14834
  );
14835
14835
  }
14836
14836
  async applyGlobalPropertyState(t) {
14837
+ this.updatesLocked = !0;
14837
14838
  const e = await this.globalPropertyHandleService.getHandles();
14838
- for (const a of t.aspects) {
14839
- const n = a?.name;
14840
- this.getGlobalPropertyStateManager().setAspect(n, a.value);
14841
- }
14842
- for (const a of t.aspects) {
14843
- const n = a?.name, i = e.find((s) => s.getName() === n);
14844
- if (i)
14845
- switch (a.type) {
14846
- case $.FileUpload: {
14847
- const s = i, o = await be([a.value]);
14848
- o.length > 0 && await s.selectImage(o[0]);
14849
- const l = a.storage?.colors;
14850
- if (l) {
14851
- const c = Object.fromEntries(
14852
- l.map((d) => [
14853
- d.key,
14854
- { browserValue: d.browserValue, pmsValue: d.pmsValue }
14855
- ]) ?? []
14856
- );
14857
- await s.changeColors(c);
14839
+ try {
14840
+ for (const a of t.aspects) {
14841
+ const n = a?.name;
14842
+ this.getGlobalPropertyStateManager().setAspect(n, a.value);
14843
+ }
14844
+ for (const a of t.aspects) {
14845
+ const n = a?.name, i = e.find((s) => s.getName() === n);
14846
+ if (i)
14847
+ switch (a.type) {
14848
+ case $.FileUpload: {
14849
+ const s = i, o = await be([a.value]);
14850
+ o.length > 0 && await s.selectImage(o[0]);
14851
+ const l = a.storage?.colors;
14852
+ if (l) {
14853
+ const c = Object.fromEntries(
14854
+ l.map((d) => [
14855
+ d.key,
14856
+ { browserValue: d.browserValue, pmsValue: d.pmsValue }
14857
+ ]) ?? []
14858
+ );
14859
+ await s.changeColors(c);
14860
+ }
14861
+ break;
14858
14862
  }
14859
- break;
14860
- }
14861
- case $.ColorOption: {
14862
- const s = i;
14863
- if (a.type === $.ColorOption) {
14864
- const l = s.getAllVariants().find((c) => c.getId() === a.value);
14863
+ case $.ColorOption: {
14864
+ const s = i;
14865
+ if (a.type === $.ColorOption) {
14866
+ const l = s.getAllVariants().find((c) => c.getId() === a.value);
14867
+ l && await s.selectVariant(l);
14868
+ } else
14869
+ s.setCustomColor(a.value);
14870
+ break;
14871
+ }
14872
+ case $.Option: {
14873
+ const s = i, l = s.getAllVariants().find((c) => c.getId() === a.value);
14865
14874
  l && await s.selectVariant(l);
14866
- } else
14867
- s.setCustomColor(a.value);
14868
- break;
14869
- }
14870
- case $.Option: {
14871
- const s = i, l = s.getAllVariants().find((c) => c.getId() === a.value);
14872
- l && await s.selectVariant(l);
14873
- break;
14874
- }
14875
- case $.Text: {
14876
- await i.setText(a.value);
14877
- break;
14875
+ break;
14876
+ }
14877
+ case $.Text: {
14878
+ await i.setText(a.value);
14879
+ break;
14880
+ }
14878
14881
  }
14879
- }
14882
+ }
14883
+ } finally {
14884
+ this.updatesLocked = !1, this.onGlobalPropertiesChanged(void 0, this.globalPropertyStateManager.getGlobalPropertyState());
14880
14885
  }
14881
- this.checkMandatoryHandlesChanged(void 0, e);
14882
14886
  }
14883
14887
  getGlobalPropertyStateManager() {
14884
14888
  return this.globalPropertyStateManager;
@@ -15346,6 +15350,8 @@ class _e {
15346
15350
  });
15347
15351
  }
15348
15352
  async onGlobalPropertiesChanged(t, e) {
15353
+ if (this.updatesLocked)
15354
+ return;
15349
15355
  const a = await this.globalPropertyHandleService.getHandles(), n = this.globalPropertyHandleService.applyConditionsFromState(a, t), i = this.globalPropertyHandleService.applyConditionsFromState(a, e);
15350
15356
  this.checkConditionalHandlesChanged(n, i), this.checkMandatoryHandlesChanged(t, i);
15351
15357
  const s = a.map((o) => {
@@ -15973,7 +15979,7 @@ class pd {
15973
15979
  } catch (a) {
15974
15980
  throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
15975
15981
  }
15976
- }, this.options = t, this.options.applicationKey && Vr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.2.2"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15982
+ }, this.options = t, this.options.applicationKey && Vr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.2.3"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15977
15983
  }
15978
15984
  configure(t) {
15979
15985
  gt.setHubUrl(t.hubUrl), gt.setServerUrl(t.serverUrl), gt.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 && Gr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);