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