@spiffcommerce/core 22.4.6 → 22.4.8
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 +0 -6
- package/dist/index.js +46 -64
- package/dist/index.umd.cjs +18 -21
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ declare class OptionService {
|
|
|
15
15
|
getOption(id: string): Promise<undefined | OptionResource>;
|
|
16
16
|
getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
|
|
17
17
|
getDefaultVariant(option: OptionResource): VariantResource | undefined;
|
|
18
|
-
getDisplayImageSource: (variant?: VariantResource) => undefined | string;
|
|
19
18
|
/**
|
|
20
19
|
* Returns the first variant marked as selected. This is used by most steps.
|
|
21
20
|
*/
|
|
@@ -473,11 +472,6 @@ declare class Variant {
|
|
|
473
472
|
* @returns The URL for a thumbnail resource configured on this variant.
|
|
474
473
|
*/
|
|
475
474
|
getThumbnail(): string | undefined;
|
|
476
|
-
/**
|
|
477
|
-
* @returns The URL for the display image configured on this variant. Can be used for things like size charts.
|
|
478
|
-
* @deprecated To be removed in a future version, Please use getThumbnail() instead
|
|
479
|
-
*/
|
|
480
|
-
getDisplayImage(): string | undefined;
|
|
481
475
|
/**
|
|
482
476
|
* @returns When this variant is configured to have a color, this will return the hex value for that color.
|
|
483
477
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHttpLink as vA, InMemoryCache as HA, ApolloClient as UA, from as kA, gql as f } from "@apollo/client/core";
|
|
2
|
-
import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as GA, modifySVGColors as bA, svgToDataUrl as JA, GroupCommand as
|
|
2
|
+
import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as GA, modifySVGColors as bA, svgToDataUrl as JA, GroupCommand as U, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as TA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as ve, fetchAsString as _, DeleteElementCommand as Ae, generateDefaultRectangleFrameSvg as ft, GetSVGDimensions as OA, patternImageDataCache as Ft, fetchAsArrayBuffer as LA, findElement as He, modifySVGWithElementProperties as zA, IllustrationColorCommand as et, IllustrationCacheCommand as KA, getFontMetrics as jA, getPatternImageData as tt, FontAlignmentCommand as VA, FontColorCommand as WA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as Ne, FontSourceCommand as yt, loadFont as gt, TextChangeCommand as XA, FontSizeCommand as qA, createElementNS as ZA, createElement as fe, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as Mt, CommandContext as $A, createCanvas as Ue, getSvgElement as Lt, LayoutRenderingPurpose as zt, renderPapyrusComponentAsString as Kt, loadImage as jt, getDomParser as Vt, toBase64 as St, getVariant as _A, generateFrameSVG as ea, getDefaultVariant as Le, domParser as Wt, sanitizeSvgTree as Xt, traverse as ta, xmlSerializer as qt, CreateLayoutCommand as Aa, AspectType as $, rehydrateSerializedLayout as ne } from "@spiffcommerce/papyrus";
|
|
3
3
|
import { AspectType as ys, AssetType as Ms, BringForwardCommand as Ss, BringToBackCommand as Ys, BringToFrontCommand as Ps, CanvasCommand as xs, CommandContext as Ns, CreateElementCommand as Rs, CreateLayoutCommand as vs, DeleteElementCommand as Hs, FontAlignmentCommand as Us, FontColorCommand as ks, FontSizeCommand as Gs, FontSourceCommand as bs, GroupCommand as Js, LayoutElementFactory as Ts, LayoutElementType as Os, MoveCommand as Ls, ResizeCommand as zs, RotateCommand as Ks, SendBackwardsCommand as js, StepAspectType as Vs, StepType as Ws, TextChangeCommand as Xs, UnitOfMeasurement as qs, UpdateImageSourceCommand as Zs, dataUrlFromExternalUrl as $s, determineCorrectFontSizeAndLines as _s, findElement as eo, frameDataCache as to, generate as Ao, generateSVGWithUnknownColors as ao, getAttributesFromArrayBuffer as no, getAxisAlignedBoundingBox as io, getFrameData as so, getSvgElement as oo, loadFont as ro, patternImageDataCache as co, registerFetchImplementation as go, registerWindowImplementation as lo, rehydrateSerializedLayout as Bo, setCanvasModule as Co, svgToDataUrl as wo } from "@spiffcommerce/papyrus";
|
|
4
4
|
import { setContext as aa } from "@apollo/client/link/context";
|
|
5
5
|
import { onError as na } from "@apollo/client/link/error";
|
|
@@ -648,7 +648,7 @@ class K {
|
|
|
648
648
|
Y.setMap(Nt, e);
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
|
-
const
|
|
651
|
+
const k = new Da();
|
|
652
652
|
class Ia {
|
|
653
653
|
constructor() {
|
|
654
654
|
this.cache = {}, this.disabled = !1;
|
|
@@ -699,9 +699,6 @@ const Qe = new Ia(), iA = f`
|
|
|
699
699
|
asset {
|
|
700
700
|
...AssetFields
|
|
701
701
|
}
|
|
702
|
-
displayImage {
|
|
703
|
-
...AssetFields
|
|
704
|
-
}
|
|
705
702
|
thumbnail {
|
|
706
703
|
...AssetFields
|
|
707
704
|
}
|
|
@@ -740,8 +737,8 @@ const Qe = new Ia(), iA = f`
|
|
|
740
737
|
});
|
|
741
738
|
return e.data.options.forEach((t) => {
|
|
742
739
|
var A, a;
|
|
743
|
-
(A = t.defaultVariant) != null && A.asset &&
|
|
744
|
-
n.asset &&
|
|
740
|
+
(A = t.defaultVariant) != null && A.asset && k.cacheAsset(t.defaultVariant.asset), t.colorProfile && k.cacheAsset(t.colorProfile), (a = t.variants) == null || a.forEach((n) => {
|
|
741
|
+
n.asset && k.cacheAsset(n.asset), n.thumbnail && k.cacheAsset(n.thumbnail), n.material && k.cacheMaterial(n.material);
|
|
745
742
|
});
|
|
746
743
|
}), e.data.options;
|
|
747
744
|
}, ya = async (c, e) => (await e).find((A) => A.id === c), Ma = async (c) => {
|
|
@@ -755,14 +752,7 @@ const Qe = new Ia(), iA = f`
|
|
|
755
752
|
};
|
|
756
753
|
class Sa {
|
|
757
754
|
constructor() {
|
|
758
|
-
this.
|
|
759
|
-
var t;
|
|
760
|
-
if (e) {
|
|
761
|
-
const A = (t = e.displayImage) == null ? void 0 : t.fileLink;
|
|
762
|
-
if (A)
|
|
763
|
-
return A;
|
|
764
|
-
}
|
|
765
|
-
}, this.getSelectedVariant = (e, t) => {
|
|
755
|
+
this.getSelectedVariant = (e, t) => {
|
|
766
756
|
var A;
|
|
767
757
|
if (!(!e || t.length === 0))
|
|
768
758
|
return (A = e.variants) == null ? void 0 : A.find((a) => a.id === t[0]);
|
|
@@ -1565,7 +1555,7 @@ class BA {
|
|
|
1565
1555
|
* Disabling processing will not cancel any active promises.
|
|
1566
1556
|
*/
|
|
1567
1557
|
set enabled(e) {
|
|
1568
|
-
!this.isEnabled && e && !this.activePromise && (this.activePromise = this.dequeue()), this.isEnabled = e;
|
|
1558
|
+
!this.isEnabled && e && !this.activePromise && this.getRemainingQueueSize() > 0 && (this.activePromise = this.dequeue()), this.isEnabled = e;
|
|
1569
1559
|
}
|
|
1570
1560
|
/**
|
|
1571
1561
|
* @returns Returns true when work is being actively processed by this queue.
|
|
@@ -1804,7 +1794,7 @@ class Xa {
|
|
|
1804
1794
|
const i = this.workflowManager.getCommandDispatcher();
|
|
1805
1795
|
this.targetElements.forEach((s, o) => {
|
|
1806
1796
|
i(
|
|
1807
|
-
new
|
|
1797
|
+
new U([
|
|
1808
1798
|
new Ot(s, t, e[o]),
|
|
1809
1799
|
new TA(
|
|
1810
1800
|
s,
|
|
@@ -2062,7 +2052,7 @@ class Za {
|
|
|
2062
2052
|
B
|
|
2063
2053
|
);
|
|
2064
2054
|
});
|
|
2065
|
-
return { command: new
|
|
2055
|
+
return { command: new U(o), followup: async () => {
|
|
2066
2056
|
} };
|
|
2067
2057
|
}
|
|
2068
2058
|
}
|
|
@@ -4823,7 +4813,7 @@ class An {
|
|
|
4823
4813
|
const n = t.getWorkflowExperience().getBundle();
|
|
4824
4814
|
if (n && e.globalPropertyAspectConfigurations) {
|
|
4825
4815
|
const i = n.getGlobalPropertyStateManager(), s = e.globalPropertyAspectConfigurations[0], o = i.getAspectStorage(s.aspectName);
|
|
4826
|
-
o && o.originalAssetKey && (a = (await
|
|
4816
|
+
o && o.originalAssetKey && (a = (await k.getLocalOrFromServer(o.originalAssetKey)).fileLink);
|
|
4827
4817
|
}
|
|
4828
4818
|
if (e.option && e.option.variants && e.option.variants.length > 0) {
|
|
4829
4819
|
const i = e.option, s = j.getDefaultVariant(i);
|
|
@@ -4922,11 +4912,11 @@ class An {
|
|
|
4922
4912
|
new CA(
|
|
4923
4913
|
async () => {
|
|
4924
4914
|
var C;
|
|
4925
|
-
const B = (C = (await
|
|
4915
|
+
const B = (C = (await k.getFromServer(t.key || "")).versions) == null ? void 0 : C.find((d) => d.name === "svg");
|
|
4926
4916
|
return B ? (await fetch(B.link)).status === 200 : !1;
|
|
4927
4917
|
},
|
|
4928
4918
|
() => {
|
|
4929
|
-
|
|
4919
|
+
k.getLocalOrFromServer(t.key || "").then((g) => {
|
|
4930
4920
|
this.loadPatternFromAsset(g, e, A, a).then(
|
|
4931
4921
|
r
|
|
4932
4922
|
);
|
|
@@ -5124,7 +5114,7 @@ class An {
|
|
|
5124
5114
|
})
|
|
5125
5115
|
), g = r.map((C) => C.command), B = r.map((C) => C.removeExistingCommands).flat();
|
|
5126
5116
|
return {
|
|
5127
|
-
command: new
|
|
5117
|
+
command: new U([...g, ...B]),
|
|
5128
5118
|
followup: async () => {
|
|
5129
5119
|
n && n(!1), await a.setSelectionsAndElements(
|
|
5130
5120
|
e.stepName,
|
|
@@ -5295,7 +5285,7 @@ class an {
|
|
|
5295
5285
|
r.push(new et(B, l, C));
|
|
5296
5286
|
r.push(new KA(B, s, o));
|
|
5297
5287
|
}
|
|
5298
|
-
return new
|
|
5288
|
+
return new U(r);
|
|
5299
5289
|
}
|
|
5300
5290
|
async changeColors(e, t, A, a, n) {
|
|
5301
5291
|
var C, d;
|
|
@@ -5375,7 +5365,7 @@ class an {
|
|
|
5375
5365
|
return I.toLowerCase() === ((D = h.color) == null ? void 0 : D.toLowerCase()) ? h.name : I;
|
|
5376
5366
|
});
|
|
5377
5367
|
})), n.updateMetadata(e.stepName, { colors: E }), {
|
|
5378
|
-
command: new
|
|
5368
|
+
command: new U(d),
|
|
5379
5369
|
followup: async () => {
|
|
5380
5370
|
await n.setSelectionsAndElements(
|
|
5381
5371
|
e.stepName,
|
|
@@ -5622,7 +5612,7 @@ class on {
|
|
|
5622
5612
|
), {
|
|
5623
5613
|
id: d,
|
|
5624
5614
|
region: l,
|
|
5625
|
-
command: new
|
|
5615
|
+
command: new U(u)
|
|
5626
5616
|
};
|
|
5627
5617
|
};
|
|
5628
5618
|
if (i.length > 0) {
|
|
@@ -5633,7 +5623,7 @@ class on {
|
|
|
5633
5623
|
return r(d, C.region, C.id);
|
|
5634
5624
|
}).filter((C) => !!C).filter((C) => !!C).map((C) => C && C.command);
|
|
5635
5625
|
return {
|
|
5636
|
-
command: new
|
|
5626
|
+
command: new U(l),
|
|
5637
5627
|
followup: async () => {
|
|
5638
5628
|
}
|
|
5639
5629
|
};
|
|
@@ -5642,7 +5632,7 @@ class on {
|
|
|
5642
5632
|
(C) => r(s.svgPrint(t, C), C)
|
|
5643
5633
|
), l = B.filter((C) => !!C).map((C) => C && C.command);
|
|
5644
5634
|
return {
|
|
5645
|
-
command: new
|
|
5635
|
+
command: new U(l),
|
|
5646
5636
|
followup: async () => {
|
|
5647
5637
|
const C = B.filter((d) => d).map((d) => d && { id: d.id, region: d.region });
|
|
5648
5638
|
await A.setSelectionsAndElements(
|
|
@@ -5750,7 +5740,7 @@ class rn {
|
|
|
5750
5740
|
};
|
|
5751
5741
|
}, g = e.data.regions.map(r);
|
|
5752
5742
|
return {
|
|
5753
|
-
command: new
|
|
5743
|
+
command: new U([...o, ...g.map((B) => B.command)]),
|
|
5754
5744
|
followup: async () => {
|
|
5755
5745
|
await A.setSelectionsAndElements(
|
|
5756
5746
|
e.stepName,
|
|
@@ -5845,7 +5835,7 @@ class gn {
|
|
|
5845
5835
|
throw new z(o);
|
|
5846
5836
|
return new et(s.id, this.shapeFillId, e);
|
|
5847
5837
|
}).filter((s) => !!s);
|
|
5848
|
-
A.getCommandDispatcher()(new
|
|
5838
|
+
A.getCommandDispatcher()(new U(i)), A.updateStorage(t.stepName, { colour: e });
|
|
5849
5839
|
}
|
|
5850
5840
|
async init(e, t, A) {
|
|
5851
5841
|
const a = e.option;
|
|
@@ -5918,7 +5908,7 @@ class gn {
|
|
|
5918
5908
|
return new et(B.id, this.shapeFillId, d);
|
|
5919
5909
|
}, g = A.map(r).filter((B) => !!B);
|
|
5920
5910
|
return {
|
|
5921
|
-
command: new
|
|
5911
|
+
command: new U(g),
|
|
5922
5912
|
followup: async () => {
|
|
5923
5913
|
await a.setSelectionsAndElements(
|
|
5924
5914
|
e.stepName,
|
|
@@ -5981,7 +5971,7 @@ class gn {
|
|
|
5981
5971
|
};
|
|
5982
5972
|
}, g = e.data.regions.map(r), B = g.filter((C) => !!C).map((C) => C == null ? void 0 : C.command), l = g.filter((C) => !!C).map((C) => ({ id: C.id, region: C.region }));
|
|
5983
5973
|
return {
|
|
5984
|
-
command: new
|
|
5974
|
+
command: new U(B),
|
|
5985
5975
|
followup: async () => {
|
|
5986
5976
|
await a.setSelectionsAndElements(
|
|
5987
5977
|
e.stepName,
|
|
@@ -6234,7 +6224,7 @@ class dn {
|
|
|
6234
6224
|
}
|
|
6235
6225
|
return !A.data.curved && t.length > 0 && !Array.from(B.values()).every((C) => C) ? (s.errors.push({ localizationKey: "workflow.steps.text.doesNotFit" }), s) : (a.updateStorage(A.stepName, { text: e }), a.updateMetadata(A.stepName, {
|
|
6236
6226
|
text: i
|
|
6237
|
-
}), n.defaultCleared && a.setMandatoryFulfilled(A.stepName, !0), s.command = new
|
|
6227
|
+
}), n.defaultCleared && a.setMandatoryFulfilled(A.stepName, !0), s.command = new U(r), s);
|
|
6238
6228
|
}
|
|
6239
6229
|
async selectVariant(e, t, A, a, n) {
|
|
6240
6230
|
const i = await this.selectVariantCommand(
|
|
@@ -6278,7 +6268,7 @@ class dn {
|
|
|
6278
6268
|
E,
|
|
6279
6269
|
async () => {
|
|
6280
6270
|
t.updateMetadata(e.stepName, { color: w, text: u }), t.updateStorage(e.stepName, { text: u, inputText: u });
|
|
6281
|
-
const I = s.map((m) => new yt(m.id, d)), D = new
|
|
6271
|
+
const I = s.map((m) => new yt(m.id, d)), D = new U(I);
|
|
6282
6272
|
t.getCommandDispatcher()(D);
|
|
6283
6273
|
}
|
|
6284
6274
|
);
|
|
@@ -6344,7 +6334,7 @@ class dn {
|
|
|
6344
6334
|
s
|
|
6345
6335
|
);
|
|
6346
6336
|
return C && l.push(C), {
|
|
6347
|
-
command: new
|
|
6337
|
+
command: new U(l),
|
|
6348
6338
|
followup: async () => {
|
|
6349
6339
|
n.markUpdateCompleted(r), await n.setSelectionsAndElements(e.stepName, [t], a);
|
|
6350
6340
|
}
|
|
@@ -6375,7 +6365,7 @@ class dn {
|
|
|
6375
6365
|
d.push(...w);
|
|
6376
6366
|
}
|
|
6377
6367
|
return C && d.push(C), {
|
|
6378
|
-
command: new
|
|
6368
|
+
command: new U(d),
|
|
6379
6369
|
followup: async () => {
|
|
6380
6370
|
n.markUpdateCompleted(r);
|
|
6381
6371
|
}
|
|
@@ -6489,7 +6479,7 @@ class dn {
|
|
|
6489
6479
|
const o = new qA(A, e);
|
|
6490
6480
|
n.push(o);
|
|
6491
6481
|
}
|
|
6492
|
-
return new
|
|
6482
|
+
return new U(n);
|
|
6493
6483
|
}
|
|
6494
6484
|
/**
|
|
6495
6485
|
* @deprecated
|
|
@@ -6542,7 +6532,7 @@ class dn {
|
|
|
6542
6532
|
)
|
|
6543
6533
|
);
|
|
6544
6534
|
}
|
|
6545
|
-
return new
|
|
6535
|
+
return new U(h);
|
|
6546
6536
|
}
|
|
6547
6537
|
}
|
|
6548
6538
|
const V = new dn();
|
|
@@ -8162,7 +8152,7 @@ class Mn {
|
|
|
8162
8152
|
this.storage[s.stepName] = s.storage || {};
|
|
8163
8153
|
}), this.allScenes = await za(e);
|
|
8164
8154
|
const a = oe(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: n, commands: i } = await this.stepElementsForIntroducedSilentSteps(a, !!this.reloadedState);
|
|
8165
|
-
this.commandContext.apply(new
|
|
8155
|
+
this.commandContext.apply(new U(i), !0), this.stepElements = { ...this.stepElements, ...n }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && t();
|
|
8166
8156
|
}
|
|
8167
8157
|
getWorkflowExperience() {
|
|
8168
8158
|
return this.experience;
|
|
@@ -8600,7 +8590,7 @@ class Mn {
|
|
|
8600
8590
|
(m = Q == null ? void 0 : Q.frameService) == null || m.setTargetElements(A.map((p) => p.id));
|
|
8601
8591
|
}
|
|
8602
8592
|
const w = l.map((Q) => new Ae(Q.id)), u = new Mt(this.constructSerializableWorkflow()), h = [...d, ...w, u];
|
|
8603
|
-
h.length > 0 && this.commandContext.apply(new
|
|
8593
|
+
h.length > 0 && this.commandContext.apply(new U(h), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
8604
8594
|
const I = this.getInvalidModelVariants(), D = this.modelContainer;
|
|
8605
8595
|
if (D) {
|
|
8606
8596
|
const Q = I.map(
|
|
@@ -8682,7 +8672,7 @@ class Mn {
|
|
|
8682
8672
|
throw new Error(`Step initialization failed: ${o.reason}`);
|
|
8683
8673
|
return o.value;
|
|
8684
8674
|
}), i = n.filter((o) => !!o && !!o.command).map((o) => o.command), s = n.filter((o) => !!o && !!o.followup).map((o) => o.followup);
|
|
8685
|
-
i && i.length > 0 && this.commandContext.apply(new
|
|
8675
|
+
i && i.length > 0 && this.commandContext.apply(new U(i), !0);
|
|
8686
8676
|
for (const o of s)
|
|
8687
8677
|
await o();
|
|
8688
8678
|
s.length > 0 && await this.ensureStepsAreLoaded(), this.onInitChange();
|
|
@@ -8795,14 +8785,6 @@ class Z {
|
|
|
8795
8785
|
const e = (n = (a = (A = this.variantData.thumbnail) == null ? void 0 : A.versions) == null ? void 0 : a.find((s) => s.name === "thumbnail")) == null ? void 0 : n.link, t = (i = this.variantData.thumbnail) == null ? void 0 : i.fileLink;
|
|
8796
8786
|
return e || t;
|
|
8797
8787
|
}
|
|
8798
|
-
/**
|
|
8799
|
-
* @returns The URL for the display image configured on this variant. Can be used for things like size charts.
|
|
8800
|
-
* @deprecated To be removed in a future version, Please use getThumbnail() instead
|
|
8801
|
-
*/
|
|
8802
|
-
getDisplayImage() {
|
|
8803
|
-
var e, t, A;
|
|
8804
|
-
return (A = (t = (e = this.variantData.displayImage) == null ? void 0 : e.versions) == null ? void 0 : t.find((a) => a.name === "medium")) == null ? void 0 : A.link;
|
|
8805
|
-
}
|
|
8806
8788
|
/**
|
|
8807
8789
|
* @returns When this variant is configured to have a color, this will return the hex value for that color.
|
|
8808
8790
|
*/
|
|
@@ -9679,7 +9661,7 @@ const Jn = async (c) => {
|
|
|
9679
9661
|
let Q = await s(d, a.id);
|
|
9680
9662
|
if (Q) {
|
|
9681
9663
|
const M = await (await fetch(Q)).blob();
|
|
9682
|
-
Q = (await
|
|
9664
|
+
Q = (await k.uploadAsset(
|
|
9683
9665
|
{ name: `${a.id}-preview-image.png`, blob: M },
|
|
9684
9666
|
_e.Image,
|
|
9685
9667
|
!0,
|
|
@@ -10952,9 +10934,9 @@ const Qs = (c, e) => {
|
|
|
10952
10934
|
serializableWorkflow: { steps: [] },
|
|
10953
10935
|
layouts: {}
|
|
10954
10936
|
};
|
|
10955
|
-
a = new
|
|
10937
|
+
a = new U(t.map((o) => new Aa(o))).apply(a);
|
|
10956
10938
|
const i = await ni(c, e, t, A);
|
|
10957
|
-
return new
|
|
10939
|
+
return new U(i).apply(a);
|
|
10958
10940
|
}, ci = f`
|
|
10959
10941
|
${ge}
|
|
10960
10942
|
fragment ProductFields on Product {
|
|
@@ -11401,7 +11383,7 @@ class Fi extends pt {
|
|
|
11401
11383
|
const t = await this.getOriginalImage();
|
|
11402
11384
|
if (!t)
|
|
11403
11385
|
throw new Error("You must supply an image selection before attempting to remove the background.");
|
|
11404
|
-
const A = this.bundle.getGlobalPropertyStateManager(), a = await
|
|
11386
|
+
const A = this.bundle.getGlobalPropertyStateManager(), a = await k.removeBackgroundFromAsset(t), i = {
|
|
11405
11387
|
...A.getAspectStorage(this.property.name),
|
|
11406
11388
|
backgroundRemovedAssetKey: a.key,
|
|
11407
11389
|
useOriginalAsset: !e
|
|
@@ -11421,7 +11403,7 @@ class Fi extends pt {
|
|
|
11421
11403
|
async getImage() {
|
|
11422
11404
|
const e = this.getStateValue();
|
|
11423
11405
|
if (e)
|
|
11424
|
-
return
|
|
11406
|
+
return k.getLocalOrFromServer(e);
|
|
11425
11407
|
}
|
|
11426
11408
|
/**
|
|
11427
11409
|
* Retrieves the original, unmodified image selection, if one exists.
|
|
@@ -11430,7 +11412,7 @@ class Fi extends pt {
|
|
|
11430
11412
|
async getOriginalImage() {
|
|
11431
11413
|
const e = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);
|
|
11432
11414
|
if (e != null && e.originalAssetKey)
|
|
11433
|
-
return
|
|
11415
|
+
return k.getLocalOrFromServer(e.originalAssetKey);
|
|
11434
11416
|
}
|
|
11435
11417
|
/**
|
|
11436
11418
|
* Retrieves the version of the image selection that has the background removed, if one exists.
|
|
@@ -11439,7 +11421,7 @@ class Fi extends pt {
|
|
|
11439
11421
|
async getBackgroundRemovedImage() {
|
|
11440
11422
|
const e = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);
|
|
11441
11423
|
if (e != null && e.backgroundRemovedAssetKey)
|
|
11442
|
-
return
|
|
11424
|
+
return k.getLocalOrFromServer(e.backgroundRemovedAssetKey);
|
|
11443
11425
|
}
|
|
11444
11426
|
getUseOriginalImage() {
|
|
11445
11427
|
var e;
|
|
@@ -11475,7 +11457,7 @@ class Fi extends pt {
|
|
|
11475
11457
|
const t = this.getStateValue();
|
|
11476
11458
|
if (!t)
|
|
11477
11459
|
return;
|
|
11478
|
-
const A = await
|
|
11460
|
+
const A = await k.getLocalOrFromServer(t);
|
|
11479
11461
|
if (!A)
|
|
11480
11462
|
return;
|
|
11481
11463
|
const a = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);
|
|
@@ -13507,8 +13489,8 @@ const bi = f`
|
|
|
13507
13489
|
return A.forEach((n) => {
|
|
13508
13490
|
n.steps.forEach((i) => {
|
|
13509
13491
|
var s, o, r;
|
|
13510
|
-
delete i.data.__typename, (s = i.option) != null && s.id && ((o = i.option.defaultVariant) != null && o.asset &&
|
|
13511
|
-
g.asset &&
|
|
13492
|
+
delete i.data.__typename, (s = i.option) != null && s.id && ((o = i.option.defaultVariant) != null && o.asset && k.cacheAsset(i.option.defaultVariant.asset), i.option.colorProfile && k.cacheAsset(i.option.colorProfile), (r = i.option.variants) == null || r.forEach((g) => {
|
|
13493
|
+
g.asset && k.cacheAsset(g.asset), g.thumbnail && k.cacheAsset(g.thumbnail), g.material && k.cacheMaterial(g.material);
|
|
13512
13494
|
}), Qe.set({ id: i.option.id }, Promise.resolve(i.option)));
|
|
13513
13495
|
}), n.finalizeStepConfig || (n.finalizeStepConfig = {}), n.finalizeStepConfig.termsMarkdown = n.partner.termsMarkdown;
|
|
13514
13496
|
}), A;
|
|
@@ -13553,7 +13535,7 @@ class es {
|
|
|
13553
13535
|
} catch (A) {
|
|
13554
13536
|
throw console.error(A), new H("Critical - Unable to synchronize workflow state with server.");
|
|
13555
13537
|
}
|
|
13556
|
-
}, this.initialized = !1, this.options = e, this.options.applicationKey && ca(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.4.
|
|
13538
|
+
}, this.initialized = !1, this.options = e, this.options.applicationKey && ca(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.4.8"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
13557
13539
|
}
|
|
13558
13540
|
/** @deprecated Use `configure` instead */
|
|
13559
13541
|
configureUrls(e, t, A) {
|
|
@@ -13567,7 +13549,7 @@ class es {
|
|
|
13567
13549
|
* and the Spiff Commerce platform.
|
|
13568
13550
|
*/
|
|
13569
13551
|
getAssetManager() {
|
|
13570
|
-
return
|
|
13552
|
+
return k;
|
|
13571
13553
|
}
|
|
13572
13554
|
getCurrencyCode() {
|
|
13573
13555
|
if (this.currencyCode === void 0)
|
|
@@ -14566,7 +14548,7 @@ class As extends X {
|
|
|
14566
14548
|
const t = await this.getOriginalImageSelection();
|
|
14567
14549
|
if (!t)
|
|
14568
14550
|
throw new Error("You must supply an image selection before attempting to remove the background.");
|
|
14569
|
-
const A = await
|
|
14551
|
+
const A = await k.removeBackgroundFromAsset(t);
|
|
14570
14552
|
e && await te.selectImage(this.step, A, this.manager, !1);
|
|
14571
14553
|
const a = ((n = this.manager.getStepStorage(this.step.stepName)) == null ? void 0 : n.framePatternData) || {};
|
|
14572
14554
|
return this.manager.updateStorage(this.step.stepName, {
|
|
@@ -14625,13 +14607,13 @@ class As extends X {
|
|
|
14625
14607
|
var t, A;
|
|
14626
14608
|
const e = (A = (t = this.manager.getStepStorage(this.step.stepName)) == null ? void 0 : t.framePatternData) == null ? void 0 : A.originalAssetKey;
|
|
14627
14609
|
if (e)
|
|
14628
|
-
return
|
|
14610
|
+
return k.getLocalOrFromServer(e);
|
|
14629
14611
|
}
|
|
14630
14612
|
async getBackgroundRemovedImageSelection() {
|
|
14631
14613
|
var t, A;
|
|
14632
14614
|
const e = (A = (t = this.manager.getStepStorage(this.step.stepName)) == null ? void 0 : t.framePatternData) == null ? void 0 : A.backgroundRemovedAssetKey;
|
|
14633
14615
|
if (e)
|
|
14634
|
-
return
|
|
14616
|
+
return k.getLocalOrFromServer(e);
|
|
14635
14617
|
}
|
|
14636
14618
|
hasOriginalImageSelection() {
|
|
14637
14619
|
var e, t;
|
|
@@ -14753,7 +14735,7 @@ export {
|
|
|
14753
14735
|
Z as Variant,
|
|
14754
14736
|
Vn as WorkflowExperienceEventType,
|
|
14755
14737
|
Se as WorkflowExperienceImpl,
|
|
14756
|
-
|
|
14738
|
+
k as assetService,
|
|
14757
14739
|
tn as browserColorToHex,
|
|
14758
14740
|
Ln as createDesign,
|
|
14759
14741
|
$s as dataUrlFromExternalUrl,
|