@spiffcommerce/core 34.0.3 → 34.1.0

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
@@ -3964,6 +3964,7 @@ const Y = new Or(), Un = C`
3964
3964
  name
3965
3965
  activeAddons
3966
3966
  currencyCode
3967
+ beta
3967
3968
  }
3968
3969
  }
3969
3970
  `, Ue = C`
@@ -12494,25 +12495,29 @@ function Te(n) {
12494
12495
  const pl = async (n, t) => {
12495
12496
  const e = {};
12496
12497
  try {
12497
- if (!t) throw new Error();
12498
+ if (t) {
12499
+ const r = await t.loggedInBearerToken();
12500
+ e.Authorization = `Bearer ${r}`;
12501
+ } else
12502
+ throw new Error();
12498
12503
  } catch {
12499
- const o = Object.entries(localStorage).find(([l, c]) => l.startsWith("CognitoIdentityServiceProvider") && l.endsWith("idToken"))?.[0] || "", s = localStorage.getItem(o);
12500
- s && !Te(s) && (e.Authorization = `Bearer ${s}`);
12504
+ const s = Object.entries(localStorage).find(([c, d]) => c.startsWith("CognitoIdentityServiceProvider") && c.endsWith("idToken"))?.[0] || "", l = localStorage.getItem(s);
12505
+ l && !Te(l) && (e.Authorization = `Bearer ${l}`);
12501
12506
  }
12502
- return (await y.getShadowGraphqlClient().mutate({
12507
+ return (await t.getIntegration()).partner.beta && (e["X-Spiff-Beta"] = "true"), (await y.getShadowGraphqlClient().mutate({
12503
12508
  mutation: ml,
12504
12509
  errorPolicy: "all",
12505
12510
  fetchPolicy: "no-cache",
12506
12511
  variables: {
12507
- inputs: n.map((i) => ({
12508
- name: i.name,
12509
- layouts: i.layouts,
12510
- workflowId: i.workflowId,
12511
- transactionId: i.transactionId,
12512
- previewImage: i.previewImage,
12513
- useThreeDimPreview: i.useThreeDimPreview,
12514
- metadata: i.metadata,
12515
- selectedVariants: i.selectedVariants
12512
+ inputs: n.map((r) => ({
12513
+ name: r.name,
12514
+ layouts: r.layouts,
12515
+ workflowId: r.workflowId,
12516
+ transactionId: r.transactionId,
12517
+ previewImage: r.previewImage,
12518
+ useThreeDimPreview: r.useThreeDimPreview,
12519
+ metadata: r.metadata,
12520
+ selectedVariants: r.selectedVariants
12516
12521
  }))
12517
12522
  },
12518
12523
  context: {
@@ -12676,58 +12681,61 @@ const pl = async (n, t) => {
12676
12681
  };
12677
12682
  }, hi = async (n, t) => {
12678
12683
  await Promise.all(
12679
- n.map(async (o) => {
12680
- await o.workflowManager.outstandingRequestsPromise();
12684
+ n.map(async (s) => {
12685
+ await s.workflowManager.outstandingRequestsPromise();
12681
12686
  })
12682
12687
  );
12683
12688
  const a = await (async () => {
12684
- const o = y.getShadowGraphqlClient(), s = await Promise.all(
12685
- n.map(async (A) => ({
12686
- id: A.transaction.id,
12687
- hash: await A.workflowManager.getStateHash()
12689
+ const s = y.getShadowGraphqlClient(), l = await Promise.all(
12690
+ n.map(async (u) => ({
12691
+ id: u.transaction.id,
12692
+ hash: await u.workflowManager.getStateHash()
12688
12693
  }))
12689
- ), c = da(s, 100), d = [];
12690
- for (const A of c) {
12691
- const u = await o.query({
12694
+ ), d = da(l, 100), A = [];
12695
+ for (const u of d) {
12696
+ const h = await s.query({
12692
12697
  query: jr,
12693
12698
  variables: {
12694
- transactions: A
12699
+ transactions: u
12695
12700
  },
12696
12701
  fetchPolicy: "no-cache",
12697
12702
  errorPolicy: "all"
12698
12703
  });
12699
- if (u.errors && u.errors.length > 0)
12700
- return s.map((h) => h.id);
12701
- d.push(...u.data?.transactionConfirmWorkflowStates ?? []);
12704
+ if (h.errors && h.errors.length > 0)
12705
+ return l.map((g) => g.id);
12706
+ A.push(...h.data?.transactionConfirmWorkflowStates ?? []);
12702
12707
  }
12703
- return d;
12708
+ return A;
12704
12709
  })(), i = await Promise.all(
12705
- n.map(async (o) => await wl(
12706
- o.workflowManager,
12707
- o.workflow,
12708
- o.layouts,
12709
- o.getReducerState,
12710
- o.transaction,
12711
- o.workflowSelections,
12712
- o.designName,
12710
+ n.map(async (s) => await wl(
12711
+ s.workflowManager,
12712
+ s.workflow,
12713
+ s.layouts,
12714
+ s.getReducerState,
12715
+ s.transaction,
12716
+ s.workflowSelections,
12717
+ s.designName,
12713
12718
  t ?? (() => Promise.resolve(void 0)),
12714
- o.workflowMetadata,
12715
- a.includes(o.transaction.id)
12719
+ s.workflowMetadata,
12720
+ a.includes(s.transaction.id)
12716
12721
  ))
12717
- ), r = await pl(i.map((o) => o.designDetails));
12718
- if (!r)
12722
+ ), r = n[0].workflowManager.getClient(), o = await pl(
12723
+ i.map((s) => s.designDetails),
12724
+ r
12725
+ );
12726
+ if (!o)
12719
12727
  throw new Error("Failed to create designs");
12720
- return r.map((o, s) => {
12721
- const l = n[s], c = i[s], d = o.transaction;
12728
+ return o.map((s, l) => {
12729
+ const c = n[l], d = i[l], A = s.transaction;
12722
12730
  return Cl(
12723
- d,
12724
- l.product,
12725
- l.workflow,
12726
- c.cartSelectionsWithPrices,
12727
- o.sku,
12728
- c.cartMetadata,
12729
- d.previewImageLink,
12730
- o.processExecution?.id
12731
+ A,
12732
+ c.product,
12733
+ c.workflow,
12734
+ d.cartSelectionsWithPrices,
12735
+ s.sku,
12736
+ d.cartMetadata,
12737
+ A.previewImageLink,
12738
+ s.processExecution?.id
12731
12739
  );
12732
12740
  });
12733
12741
  };
@@ -16150,7 +16158,7 @@ class Od {
16150
16158
  } catch (a) {
16151
16159
  throw console.error(a), new gt("Critical - Unable to synchronize workflow state with server.");
16152
16160
  }
16153
- }, this.options = t, this.options.applicationKey && nr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 34.0.3"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16161
+ }, this.options = t, this.options.applicationKey && nr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 34.1.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16154
16162
  }
16155
16163
  configure(t) {
16156
16164
  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 && rr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);