@spiffcommerce/core 34.0.3 → 34.1.0-beta.7a56a636-d7cf-54ee-8dfc-5407b655bd46

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`
@@ -4185,6 +4186,7 @@ const Y = new Or(), Un = C`
4185
4186
  externalCartProductId
4186
4187
  externalCartProductVariantId
4187
4188
  id
4189
+ bundleIndex
4188
4190
  completed
4189
4191
  lastSyncedAt
4190
4192
  priceModifierTotal
@@ -12494,25 +12496,29 @@ function Te(n) {
12494
12496
  const pl = async (n, t) => {
12495
12497
  const e = {};
12496
12498
  try {
12497
- if (!t) throw new Error();
12499
+ if (t) {
12500
+ const r = await t.loggedInBearerToken();
12501
+ e.Authorization = `Bearer ${r}`;
12502
+ } else
12503
+ throw new Error();
12498
12504
  } 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}`);
12505
+ const s = Object.entries(localStorage).find(([c, d]) => c.startsWith("CognitoIdentityServiceProvider") && c.endsWith("idToken"))?.[0] || "", l = localStorage.getItem(s);
12506
+ l && !Te(l) && (e.Authorization = `Bearer ${l}`);
12501
12507
  }
12502
- return (await y.getShadowGraphqlClient().mutate({
12508
+ return (await t.getIntegration()).partner.beta && (e["X-Spiff-Beta"] = "true"), (await y.getShadowGraphqlClient().mutate({
12503
12509
  mutation: ml,
12504
12510
  errorPolicy: "all",
12505
12511
  fetchPolicy: "no-cache",
12506
12512
  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
12513
+ inputs: n.map((r) => ({
12514
+ name: r.name,
12515
+ layouts: r.layouts,
12516
+ workflowId: r.workflowId,
12517
+ transactionId: r.transactionId,
12518
+ previewImage: r.previewImage,
12519
+ useThreeDimPreview: r.useThreeDimPreview,
12520
+ metadata: r.metadata,
12521
+ selectedVariants: r.selectedVariants
12516
12522
  }))
12517
12523
  },
12518
12524
  context: {
@@ -12676,58 +12682,61 @@ const pl = async (n, t) => {
12676
12682
  };
12677
12683
  }, hi = async (n, t) => {
12678
12684
  await Promise.all(
12679
- n.map(async (o) => {
12680
- await o.workflowManager.outstandingRequestsPromise();
12685
+ n.map(async (s) => {
12686
+ await s.workflowManager.outstandingRequestsPromise();
12681
12687
  })
12682
12688
  );
12683
12689
  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()
12690
+ const s = y.getShadowGraphqlClient(), l = await Promise.all(
12691
+ n.map(async (u) => ({
12692
+ id: u.transaction.id,
12693
+ hash: await u.workflowManager.getStateHash()
12688
12694
  }))
12689
- ), c = da(s, 100), d = [];
12690
- for (const A of c) {
12691
- const u = await o.query({
12695
+ ), d = da(l, 100), A = [];
12696
+ for (const u of d) {
12697
+ const h = await s.query({
12692
12698
  query: jr,
12693
12699
  variables: {
12694
- transactions: A
12700
+ transactions: u
12695
12701
  },
12696
12702
  fetchPolicy: "no-cache",
12697
12703
  errorPolicy: "all"
12698
12704
  });
12699
- if (u.errors && u.errors.length > 0)
12700
- return s.map((h) => h.id);
12701
- d.push(...u.data?.transactionConfirmWorkflowStates ?? []);
12705
+ if (h.errors && h.errors.length > 0)
12706
+ return l.map((g) => g.id);
12707
+ A.push(...h.data?.transactionConfirmWorkflowStates ?? []);
12702
12708
  }
12703
- return d;
12709
+ return A;
12704
12710
  })(), 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,
12711
+ n.map(async (s) => await wl(
12712
+ s.workflowManager,
12713
+ s.workflow,
12714
+ s.layouts,
12715
+ s.getReducerState,
12716
+ s.transaction,
12717
+ s.workflowSelections,
12718
+ s.designName,
12713
12719
  t ?? (() => Promise.resolve(void 0)),
12714
- o.workflowMetadata,
12715
- a.includes(o.transaction.id)
12720
+ s.workflowMetadata,
12721
+ a.includes(s.transaction.id)
12716
12722
  ))
12717
- ), r = await pl(i.map((o) => o.designDetails));
12718
- if (!r)
12723
+ ), r = n[0].workflowManager.getClient(), o = await pl(
12724
+ i.map((s) => s.designDetails),
12725
+ r
12726
+ );
12727
+ if (!o)
12719
12728
  throw new Error("Failed to create designs");
12720
- return r.map((o, s) => {
12721
- const l = n[s], c = i[s], d = o.transaction;
12729
+ return o.map((s, l) => {
12730
+ const c = n[l], d = i[l], A = s.transaction;
12722
12731
  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
12732
+ A,
12733
+ c.product,
12734
+ c.workflow,
12735
+ d.cartSelectionsWithPrices,
12736
+ s.sku,
12737
+ d.cartMetadata,
12738
+ A.previewImageLink,
12739
+ s.processExecution?.id
12731
12740
  );
12732
12741
  });
12733
12742
  };
@@ -13075,6 +13084,9 @@ class bl {
13075
13084
  getBundle() {
13076
13085
  return this.bundle;
13077
13086
  }
13087
+ getBundleIndex() {
13088
+ return this.transaction.bundleIndex;
13089
+ }
13078
13090
  setBundle(t) {
13079
13091
  this.bundle = t;
13080
13092
  }
@@ -15270,7 +15282,11 @@ class dn {
15270
15282
  this.workflowExperiences[t] = this.workflowExperiences[e], this.workflowExperiences[e] = a, await this.updateTransactionOrder();
15271
15283
  }
15272
15284
  getWorkflowExperiences() {
15273
- return [...this.workflowExperiences];
15285
+ const t = [...this.workflowExperiences], e = (a, i) => {
15286
+ const r = a.getBundleIndex(), o = i.getBundleIndex();
15287
+ return r === void 0 || o === void 0 ? 0 : r < o ? -1 : 1;
15288
+ };
15289
+ return t.sort(e), t;
15274
15290
  }
15275
15291
  async sortWorkflowExperiences(t) {
15276
15292
  this.workflowExperiences = this.workflowExperiences.sort(t), await this.updateTransactionOrder();
@@ -16150,7 +16166,7 @@ class Od {
16150
16166
  } catch (a) {
16151
16167
  throw console.error(a), new gt("Critical - Unable to synchronize workflow state with server.");
16152
16168
  }
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("------------------------");
16169
+ }, this.options = t, this.options.applicationKey && nr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 34.1.0-beta.3fb0da60-1da5-5e84-b959-ca75a31ba2e9"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
16154
16170
  }
16155
16171
  configure(t) {
16156
16172
  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);