@spiffcommerce/core 21.9.0-alpha.6 → 21.9.0-alpha.7
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.js +30 -16
- package/dist/index.umd.cjs +12 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8136,14 +8136,7 @@ class Xn extends gt {
|
|
|
8136
8136
|
backgroundRemovedAssetKey: a.key,
|
|
8137
8137
|
useOriginalAsset: !e
|
|
8138
8138
|
}, o = [e ? A.setAspect(this.property.name, a.key, i) : A.setAspectStorage(this.property.name, i)];
|
|
8139
|
-
|
|
8140
|
-
const r = async () => {
|
|
8141
|
-
const B = this.getSharedSteps().map((l) => l.selectImage(a, !1));
|
|
8142
|
-
await Promise.all(B);
|
|
8143
|
-
};
|
|
8144
|
-
o.push(r());
|
|
8145
|
-
}
|
|
8146
|
-
return await Promise.all(o), this.updateSharedStepStorage(i), a;
|
|
8139
|
+
return e && o.push(this.applyImageSelection(a, void 0, !1)), await Promise.all(o), this.updateSharedStepStorage(i), a;
|
|
8147
8140
|
}
|
|
8148
8141
|
/**
|
|
8149
8142
|
* Returns `true` if the state has an image assigned, otherwise `false`.
|
|
@@ -8183,22 +8176,43 @@ class Xn extends gt {
|
|
|
8183
8176
|
return ((e = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)) == null ? void 0 : e.useOriginalAsset) ?? !1;
|
|
8184
8177
|
}
|
|
8185
8178
|
async setUseOriginalImage(e) {
|
|
8186
|
-
const t = this.
|
|
8187
|
-
|
|
8179
|
+
const t = await this.getOriginalImage();
|
|
8180
|
+
if (!t)
|
|
8181
|
+
throw new Error("You must select an image before calling setUseOriginalImage");
|
|
8182
|
+
const A = this.bundle.getGlobalPropertyStateManager(), a = A.getAspectStorage(this.property.name);
|
|
8183
|
+
if ((a == null ? void 0 : a.useOriginalAsset) === e)
|
|
8184
|
+
return;
|
|
8185
|
+
const n = {
|
|
8186
|
+
...a,
|
|
8188
8187
|
useOriginalAsset: e
|
|
8189
|
-
};
|
|
8190
|
-
|
|
8188
|
+
}, i = [A.setAspectStorage(this.property.name, n)];
|
|
8189
|
+
if (e)
|
|
8190
|
+
i.push(this.applyImageSelection(t, void 0, !1));
|
|
8191
|
+
else {
|
|
8192
|
+
const s = async () => {
|
|
8193
|
+
const o = await this.getBackgroundRemovedImage();
|
|
8194
|
+
if (!o)
|
|
8195
|
+
throw new Error(
|
|
8196
|
+
"You must call removeBackgroundFromImage before attempting to use that version of the image."
|
|
8197
|
+
);
|
|
8198
|
+
this.applyImageSelection(o, void 0, !1);
|
|
8199
|
+
};
|
|
8200
|
+
i.push(s());
|
|
8201
|
+
}
|
|
8202
|
+
this.updateSharedStepStorage(n);
|
|
8191
8203
|
}
|
|
8192
8204
|
async applyGlobalState(e) {
|
|
8193
8205
|
const t = this.getStateValue();
|
|
8194
8206
|
if (!t)
|
|
8195
8207
|
return Promise.resolve();
|
|
8196
8208
|
const A = await v.getLocalOrFromServer(t);
|
|
8197
|
-
|
|
8209
|
+
if (!A)
|
|
8210
|
+
return Promise.resolve();
|
|
8211
|
+
await this.applyImageSelection(A, e);
|
|
8198
8212
|
}
|
|
8199
|
-
async applyImageSelection(e, t) {
|
|
8200
|
-
const
|
|
8201
|
-
await Promise.all(
|
|
8213
|
+
async applyImageSelection(e, t, A = !0) {
|
|
8214
|
+
const n = this.getSharedSteps(t).map((i) => i.selectImage(e, A));
|
|
8215
|
+
await Promise.all(n);
|
|
8202
8216
|
}
|
|
8203
8217
|
updateSharedStepStorage(e) {
|
|
8204
8218
|
this.bundle.getWorkflowExperiences().forEach(
|