@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.d.ts +10 -0
- package/dist/index.js +106 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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 (
|
|
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
|
|
12500
|
-
|
|
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((
|
|
12508
|
-
name:
|
|
12509
|
-
layouts:
|
|
12510
|
-
workflowId:
|
|
12511
|
-
transactionId:
|
|
12512
|
-
previewImage:
|
|
12513
|
-
useThreeDimPreview:
|
|
12514
|
-
metadata:
|
|
12515
|
-
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 (
|
|
12680
|
-
await
|
|
12685
|
+
n.map(async (s) => {
|
|
12686
|
+
await s.workflowManager.outstandingRequestsPromise();
|
|
12681
12687
|
})
|
|
12682
12688
|
);
|
|
12683
12689
|
const a = await (async () => {
|
|
12684
|
-
const
|
|
12685
|
-
n.map(async (
|
|
12686
|
-
id:
|
|
12687
|
-
hash: await
|
|
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
|
-
),
|
|
12690
|
-
for (const
|
|
12691
|
-
const
|
|
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:
|
|
12700
|
+
transactions: u
|
|
12695
12701
|
},
|
|
12696
12702
|
fetchPolicy: "no-cache",
|
|
12697
12703
|
errorPolicy: "all"
|
|
12698
12704
|
});
|
|
12699
|
-
if (
|
|
12700
|
-
return
|
|
12701
|
-
|
|
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
|
|
12709
|
+
return A;
|
|
12704
12710
|
})(), i = await Promise.all(
|
|
12705
|
-
n.map(async (
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
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
|
-
|
|
12715
|
-
a.includes(
|
|
12720
|
+
s.workflowMetadata,
|
|
12721
|
+
a.includes(s.transaction.id)
|
|
12716
12722
|
))
|
|
12717
|
-
), r =
|
|
12718
|
-
|
|
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
|
|
12721
|
-
const
|
|
12729
|
+
return o.map((s, l) => {
|
|
12730
|
+
const c = n[l], d = i[l], A = s.transaction;
|
|
12722
12731
|
return Cl(
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
|
|
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
|
-
|
|
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.
|
|
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);
|