@spiffcommerce/core 31.2.0-beta.a27ad618-ade0-577a-a396-e9182c5d191a → 31.2.0-beta.dd65281e-c94f-5366-965e-8ae4343ab58b

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
@@ -10251,20 +10251,8 @@ class yo {
10251
10251
  })
10252
10252
  );
10253
10253
  }
10254
- async getTemplatingContext() {
10255
- const t = this.transaction.recipient;
10256
- if (t?.conversionConfigurationId && !this.recipientConversionConfiguration) {
10257
- const a = await this.graphQlClient().query({
10258
- query: Bi,
10259
- errorPolicy: "all",
10260
- fetchPolicy: "no-cache",
10261
- variables: {
10262
- id: t.conversionConfigurationId
10263
- }
10264
- });
10265
- a.data.conversionConfiguration && (this.recipientConversionConfiguration = a.data.conversionConfiguration);
10266
- }
10267
- const e = { recipient: t };
10254
+ getTemplatingContext() {
10255
+ const t = this.transaction.recipient, e = { recipient: t };
10268
10256
  return this.recipientConversionConfiguration?.requestedDataItems?.forEach((a) => {
10269
10257
  const n = a.uniqueIdentifier ?? a.title ?? "";
10270
10258
  a.type === Ce.FirstName ? e[n] = t?.firstName : a.type === Ce.LastName ? e[n] = t?.lastName : a.type === Ce.Custom && (a.customFieldIndex === 1 ? e[n] = t?.customField1 : a.customFieldIndex === 2 ? e[n] = t?.customField2 : a.customFieldIndex === 3 ? e[n] = t?.customField3 : a.customFieldIndex === 4 ? e[n] = t?.customField4 : a.customFieldIndex === 5 && (e[n] = t?.customField5));
@@ -10373,7 +10361,21 @@ class yo {
10373
10361
  }
10374
10362
  });
10375
10363
  }
10376
- this.recipientCallbacks.forEach((S) => S(this.transaction.recipient));
10364
+ await this.fetchConversionConfiguration(), this.recipientCallbacks.forEach((S) => S(this.transaction.recipient));
10365
+ }
10366
+ async fetchConversionConfiguration() {
10367
+ const t = this.transaction.recipient;
10368
+ if (t?.conversionConfigurationId && !this.recipientConversionConfiguration) {
10369
+ const e = await this.graphQlClient().query({
10370
+ query: Bi,
10371
+ errorPolicy: "all",
10372
+ fetchPolicy: "no-cache",
10373
+ variables: {
10374
+ id: t.conversionConfigurationId
10375
+ }
10376
+ });
10377
+ e.data.conversionConfiguration && (this.recipientConversionConfiguration = e.data.conversionConfiguration);
10378
+ }
10377
10379
  }
10378
10380
  async initializeDefaultWorkflowState(t) {
10379
10381
  const e = () => {
@@ -10384,7 +10386,7 @@ class yo {
10384
10386
  };
10385
10387
  this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
10386
10388
  this.storage[o.stepName] = o.storage || {};
10387
- }), this.allScenes = await qi(t);
10389
+ }), await this.fetchConversionConfiguration(), this.allScenes = await qi(t);
10388
10390
  const n = Pt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
10389
10391
  this.commandContext.apply(new R(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
10390
10392
  }
@@ -12298,7 +12300,7 @@ class Go {
12298
12300
  }, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
12299
12301
  if (!h)
12300
12302
  throw new ke("Failed to obtain 2D context for preview image creation");
12301
- const m = await this.workflowManager.getTemplatingContext(), p = Sa(u.layoutState.layout, u.layoutState.elements, {
12303
+ const m = this.workflowManager.getTemplatingContext(), p = Sa(u.layoutState.layout, u.layoutState.elements, {
12302
12304
  renderingConfiguration: {
12303
12305
  purpose: Ht.Print,
12304
12306
  region: { left: A.x, top: A.y, width: A.width, height: A.height },
@@ -13317,7 +13319,7 @@ class ol extends xn {
13317
13319
  l = g.width, c = g.height;
13318
13320
  } else
13319
13321
  l = i.width, c = i.height;
13320
- const d = await this.getWorkflowManager?.()?.getTemplatingContext(), A = Sa(t.layoutState.layout, e, {
13322
+ const d = this.getWorkflowManager?.()?.getTemplatingContext(), A = Sa(t.layoutState.layout, e, {
13321
13323
  renderingConfiguration: {
13322
13324
  purpose: Ht.ThreeD,
13323
13325
  templatingContext: d
@@ -15937,7 +15939,7 @@ class md {
15937
15939
  } catch (a) {
15938
15940
  throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
15939
15941
  }
15940
- }, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.2.0-beta.db42d4ce-e654-556c-beb7-6a0b4defc362"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15942
+ }, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.2.0-beta.a27ad618-ade0-577a-a396-e9182c5d191a"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15941
15943
  }
15942
15944
  configure(t) {
15943
15945
  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 && zr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);