@spiffcommerce/core 31.3.0 → 31.4.0-beta.5fa2c8d1-12a9-57f7-90b0-7e4a963b36e7
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -7,7 +7,7 @@ import { orientation as gr } from "exifr/dist/mini.umd.cjs";
|
|
7
7
|
import { parse as on } from "css";
|
8
8
|
import pr from "fuse.js";
|
9
9
|
import { Pith as Aa } from "pith";
|
10
|
-
import
|
10
|
+
import Et from "lodash.clonedeep";
|
11
11
|
import { toString as ln } from "qrcode";
|
12
12
|
import fr from "svg-path-bbox";
|
13
13
|
import { parse as ta } from "opentype.js";
|
@@ -44,7 +44,7 @@ class Y extends Xt {
|
|
44
44
|
super(`Panel not Found: ${t.panelId}`), this.panelId = t?.panelId || "N/A";
|
45
45
|
}
|
46
46
|
}
|
47
|
-
class
|
47
|
+
class bt extends Xt {
|
48
48
|
constructor(t) {
|
49
49
|
super(`Asset not found for variant: ${t.name}`), this.variant = t;
|
50
50
|
}
|
@@ -225,7 +225,7 @@ const un = /* @__PURE__ */ new Map(), Ta = /* @__PURE__ */ new Map(), Na = /* @_
|
|
225
225
|
const n = a.load();
|
226
226
|
return Ue.set(t, n), n;
|
227
227
|
}
|
228
|
-
},
|
228
|
+
}, It = () => {
|
229
229
|
if (Tt([typeof XMLSerializer]))
|
230
230
|
return new XMLSerializer();
|
231
231
|
const r = Zt();
|
@@ -3328,7 +3328,7 @@ const le = (r) => {
|
|
3328
3328
|
}
|
3329
3329
|
});
|
3330
3330
|
});
|
3331
|
-
}, vn = (r) =>
|
3331
|
+
}, vn = (r) => It().serializeToString(r), fa = (r, t, e, a, n) => {
|
3332
3332
|
const i = yn(r);
|
3333
3333
|
if (!i)
|
3334
3334
|
throw new Error("Failed to read SVG.");
|
@@ -3360,7 +3360,7 @@ const le = (r) => {
|
|
3360
3360
|
s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
|
3361
3361
|
}
|
3362
3362
|
});
|
3363
|
-
const i =
|
3363
|
+
const i = It().serializeToString(e);
|
3364
3364
|
return {
|
3365
3365
|
colors: a,
|
3366
3366
|
svg: i
|
@@ -3661,7 +3661,7 @@ class mi {
|
|
3661
3661
|
const a = await t.blob.text(), s = new window.DOMParser().parseFromString(a, "image/svg+xml").documentElement;
|
3662
3662
|
if (!s) throw new Dt("Failed to read SVG.");
|
3663
3663
|
ri(s);
|
3664
|
-
const l =
|
3664
|
+
const l = It().serializeToString(s);
|
3665
3665
|
return {
|
3666
3666
|
name: t.name,
|
3667
3667
|
blob: new Blob([l], { type: "image/svg+xml" })
|
@@ -5097,6 +5097,7 @@ const H = new yi(), bn = w`
|
|
5097
5097
|
}
|
5098
5098
|
assetType
|
5099
5099
|
multiLine
|
5100
|
+
limit
|
5100
5101
|
items
|
5101
5102
|
fields
|
5102
5103
|
schema
|
@@ -5213,7 +5214,7 @@ const H = new yi(), bn = w`
|
|
5213
5214
|
],
|
5214
5215
|
silentSteps: []
|
5215
5216
|
}), t;
|
5216
|
-
}, ji = (r, t) => t.find((e) => e.stepNames.includes(r)),
|
5217
|
+
}, ji = (r, t) => t.find((e) => e.stepNames.includes(r)), vt = (r, t) => (r.conditions || []).every((e) => {
|
5217
5218
|
const a = t[e.targetStepName];
|
5218
5219
|
if (a && a.selectedVariants) {
|
5219
5220
|
const n = a.selectedVariants;
|
@@ -5226,12 +5227,12 @@ const H = new yi(), bn = w`
|
|
5226
5227
|
const e = {
|
5227
5228
|
name: r.name,
|
5228
5229
|
title: r.title,
|
5229
|
-
renderableSteps: r.renderableSteps.filter((a) =>
|
5230
|
-
silentSteps: r.silentSteps.filter((a) =>
|
5230
|
+
renderableSteps: r.renderableSteps.filter((a) => vt(a, t)),
|
5231
|
+
silentSteps: r.silentSteps.filter((a) => vt(a, t))
|
5231
5232
|
};
|
5232
5233
|
return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
|
5233
|
-
},
|
5234
|
-
const a =
|
5234
|
+
}, yt = (r, t) => r.map((e) => Hi(e, t)).filter((e) => e !== null), Yi = async (r, t, e = !1) => {
|
5235
|
+
const a = yt(r, t), n = [];
|
5235
5236
|
for (const s of a)
|
5236
5237
|
for (const o of s.renderableSteps) {
|
5237
5238
|
const l = (o.option?.variants || []).length;
|
@@ -5453,7 +5454,7 @@ const M = () => {
|
|
5453
5454
|
}), jc = (r, t, e, a) => ({
|
5454
5455
|
x: r.x + (t?.x + t?.width) * e,
|
5455
5456
|
y: r.y + (t?.y + t?.height) * a
|
5456
|
-
}),
|
5457
|
+
}), Pt = (r) => {
|
5457
5458
|
switch (r) {
|
5458
5459
|
case j.North:
|
5459
5460
|
return j.East;
|
@@ -5472,7 +5473,7 @@ const M = () => {
|
|
5472
5473
|
case j.Southwest:
|
5473
5474
|
return j.Northwest;
|
5474
5475
|
}
|
5475
|
-
}, Hc = (r, t) => t > 45 && t <= 135 ?
|
5476
|
+
}, Hc = (r, t) => t > 45 && t <= 135 ? Pt(r) : t > 135 && t <= 225 ? Pt(Pt(r)) : t > 225 && t <= 315 ? Pt(Pt(Pt(r))) : r, Yc = (r, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
|
5476
5477
|
const a = ft(r.rotation), n = {
|
5477
5478
|
x: t.x + r.x * e.x,
|
5478
5479
|
y: t.x + r.y * e.y
|
@@ -5757,7 +5758,7 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", ze = /* @_
|
|
5757
5758
|
const B = P.toSVG(2), Q = t.parseFromString(B, "image/svg+xml").firstElementChild;
|
5758
5759
|
h.appendChild(Q);
|
5759
5760
|
}
|
5760
|
-
return e.querySelectorAll("text").forEach((d) => d.remove()),
|
5761
|
+
return e.querySelectorAll("text").forEach((d) => d.remove()), It().serializeToString(a);
|
5761
5762
|
}, Be = (r, t, e, a) => Math.max(ns(r.join(`
|
5762
5763
|
`), e, a), t), Ua = (r, t, e, a, n, i) => {
|
5763
5764
|
const s = (i || Rn) * n.getApproximateHeight(), o = t.split(`
|
@@ -6330,7 +6331,7 @@ const ne = (r) => {
|
|
6330
6331
|
const s = dt().parseFromString(r, "image/svg+xml").firstElementChild;
|
6331
6332
|
if (!s)
|
6332
6333
|
throw new Error("Failed to read SVG");
|
6333
|
-
const l =
|
6334
|
+
const l = It().serializeToString(s), c = pt(), d = c.getContext("2d"), A = await Aa.from(d, l, {
|
6334
6335
|
anonymousCrossOrigin: !0,
|
6335
6336
|
ignoreDimensions: !1,
|
6336
6337
|
createCanvas: pt,
|
@@ -6781,7 +6782,7 @@ class z extends N {
|
|
6781
6782
|
return a !== void 0 ? a + 1 : 0;
|
6782
6783
|
}
|
6783
6784
|
}
|
6784
|
-
class
|
6785
|
+
class Bt extends N {
|
6785
6786
|
constructor(t) {
|
6786
6787
|
super(), this.id = t;
|
6787
6788
|
}
|
@@ -7384,7 +7385,7 @@ class ys {
|
|
7384
7385
|
40
|
7385
7386
|
);
|
7386
7387
|
});
|
7387
|
-
t.forEach((h) => a.getCommandDispatcher()(new
|
7388
|
+
t.forEach((h) => a.getCommandDispatcher()(new Bt(h.id)));
|
7388
7389
|
const o = n.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", l = new URL(o + n.data.baseUrl);
|
7389
7390
|
l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
|
7390
7391
|
const c = l.toString();
|
@@ -7442,7 +7443,7 @@ class Pe {
|
|
7442
7443
|
return oa(e);
|
7443
7444
|
const a = t.asset;
|
7444
7445
|
if (!a)
|
7445
|
-
throw new
|
7446
|
+
throw new bt(t);
|
7446
7447
|
const n = a.fileLink;
|
7447
7448
|
if (n)
|
7448
7449
|
return nt(n, !0);
|
@@ -7709,7 +7710,7 @@ class Pe {
|
|
7709
7710
|
i && i(!0);
|
7710
7711
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
7711
7712
|
t.data.regions.map(async (h, m) => {
|
7712
|
-
const g = await Oe(l[m]), p = o.getImageData(), f = a.map((P) => new
|
7713
|
+
const g = await Oe(l[m]), p = o.getImageData(), f = a.map((P) => new Bt(P.id)), S = p ? va(
|
7713
7714
|
p,
|
7714
7715
|
g,
|
7715
7716
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
@@ -7800,7 +7801,7 @@ class Pe {
|
|
7800
7801
|
), this.validateColorCount(e, a);
|
7801
7802
|
}
|
7802
7803
|
}
|
7803
|
-
const
|
7804
|
+
const St = new Pe();
|
7804
7805
|
class Ss {
|
7805
7806
|
async getIllustrationBody(t) {
|
7806
7807
|
return new Promise((e) => {
|
@@ -7957,11 +7958,11 @@ class Ss {
|
|
7957
7958
|
if (!t.data || !t.data.regions)
|
7958
7959
|
throw new Ee(t, "Missing regions.");
|
7959
7960
|
n(!0);
|
7960
|
-
const s = a.map((f) => new
|
7961
|
+
const s = a.map((f) => new Bt(f.id));
|
7961
7962
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
7962
7963
|
const o = e.asset;
|
7963
7964
|
if (!o)
|
7964
|
-
throw new
|
7965
|
+
throw new bt(e);
|
7965
7966
|
const l = o.fileLink;
|
7966
7967
|
if (!l)
|
7967
7968
|
throw new Yt(o);
|
@@ -8092,7 +8093,7 @@ class vs {
|
|
8092
8093
|
n(!0);
|
8093
8094
|
const s = e.material;
|
8094
8095
|
if (!s)
|
8095
|
-
throw n(!1), new
|
8096
|
+
throw n(!1), new bt(e);
|
8096
8097
|
return {
|
8097
8098
|
command: void 0,
|
8098
8099
|
followup: async () => {
|
@@ -8143,7 +8144,7 @@ class Es {
|
|
8143
8144
|
const u = e.getModelContainer();
|
8144
8145
|
if (u && t.option) {
|
8145
8146
|
const h = d.asset?.fileLink;
|
8146
|
-
if (!h) throw new
|
8147
|
+
if (!h) throw new bt(d);
|
8147
8148
|
await u.applyModelVariant(
|
8148
8149
|
t.stepName || "",
|
8149
8150
|
{
|
@@ -8167,7 +8168,7 @@ class Es {
|
|
8167
8168
|
n(!0);
|
8168
8169
|
const i = e.asset?.fileLink;
|
8169
8170
|
if (!i)
|
8170
|
-
throw new
|
8171
|
+
throw new bt(e);
|
8171
8172
|
return {
|
8172
8173
|
command: void 0,
|
8173
8174
|
followup: async () => {
|
@@ -8228,7 +8229,7 @@ class bs {
|
|
8228
8229
|
if (!g)
|
8229
8230
|
return console.error(`Can not find layout for region: ${A.panelId}`), null;
|
8230
8231
|
const p = [];
|
8231
|
-
return u && p.push(new
|
8232
|
+
return u && p.push(new Bt(h)), p.push(
|
8232
8233
|
new z(
|
8233
8234
|
{
|
8234
8235
|
stepRegion: A,
|
@@ -8344,12 +8345,12 @@ class Bs {
|
|
8344
8345
|
async selectVariantCommand(t, e, a, n) {
|
8345
8346
|
const i = e.asset;
|
8346
8347
|
if (!i)
|
8347
|
-
throw new
|
8348
|
+
throw new bt(e);
|
8348
8349
|
const s = i?.fileLink;
|
8349
8350
|
if (!s)
|
8350
8351
|
return console.error("No URL for picture!"), null;
|
8351
8352
|
n(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
|
8352
|
-
const l = a.getRegionElements(t.stepName).map((A) => new
|
8353
|
+
const l = a.getRegionElements(t.stepName).map((A) => new Bt(A.id)), c = (A) => {
|
8353
8354
|
const h = a.getLayouts().find((g) => g.panelId === A.panelId);
|
8354
8355
|
if (!h)
|
8355
8356
|
throw new Y(A);
|
@@ -9078,7 +9079,7 @@ class ks {
|
|
9078
9079
|
async fontDataFromVariant(t) {
|
9079
9080
|
const e = t.asset;
|
9080
9081
|
if (!e)
|
9081
|
-
throw new
|
9082
|
+
throw new bt(t);
|
9082
9083
|
const a = e.fileLink;
|
9083
9084
|
if (!a)
|
9084
9085
|
throw new Yt(e);
|
@@ -10395,7 +10396,7 @@ class yo {
|
|
10395
10396
|
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
|
10396
10397
|
this.storage[o.stepName] = o.storage || {};
|
10397
10398
|
}), await this.fetchConversionConfiguration(), this.allScenes = await qi(t);
|
10398
|
-
const n =
|
10399
|
+
const n = yt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
|
10399
10400
|
this.commandContext.apply(new R(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
10400
10401
|
}
|
10401
10402
|
getWorkflowExperience() {
|
@@ -10567,6 +10568,9 @@ class yo {
|
|
10567
10568
|
setMandatoryFulfilled(t, e) {
|
10568
10569
|
this.mandatorySteps[t] !== e && (this.mandatorySteps = { ...this.mandatorySteps, [t]: e }, this.onMandatoryChange());
|
10569
10570
|
}
|
10571
|
+
getMandatoryUnfulfilledSteps() {
|
10572
|
+
return yt(this.allScenes, this.stepSelections).flatMap((i) => i.renderableSteps).filter((i) => i.mandatory).filter((i) => !this.mandatorySteps[i.stepName]).map((i) => i.stepName);
|
10573
|
+
}
|
10570
10574
|
setStepError(t, e, a) {
|
10571
10575
|
let n = !1;
|
10572
10576
|
if (!this.validationErrors.steps.has(t) && a)
|
@@ -10600,7 +10604,7 @@ class yo {
|
|
10600
10604
|
},
|
10601
10605
|
{ refocusCamera: e }
|
10602
10606
|
);
|
10603
|
-
this.setModelContainer(a),
|
10607
|
+
this.setModelContainer(a), yt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === v.Model || s.type === v.Material).forEach((s) => {
|
10604
10608
|
if (!s.option?.id) {
|
10605
10609
|
console.error(`Failed to read option id from step: ${s.stepName}`);
|
10606
10610
|
return;
|
@@ -10707,7 +10711,7 @@ class yo {
|
|
10707
10711
|
const t = this.getCommandContext().getState();
|
10708
10712
|
if (!t)
|
10709
10713
|
throw new V("Attempted to serialize state before it was initialized.");
|
10710
|
-
const e =
|
10714
|
+
const e = Et(t.transaction), a = this.dehydrateState(e);
|
10711
10715
|
return JSON.stringify(a);
|
10712
10716
|
}
|
10713
10717
|
/**
|
@@ -10743,12 +10747,12 @@ class yo {
|
|
10743
10747
|
this.stepElements = e(this.stepElements, t);
|
10744
10748
|
}
|
10745
10749
|
getInvalidCanvasRegions() {
|
10746
|
-
return this.workflow.steps.reduce((t, e) => (
|
10750
|
+
return this.workflow.steps.reduce((t, e) => (vt(e, this.stepSelections) || this.stepElements[e.stepName] && this.stepElements[e.stepName].forEach(
|
10747
10751
|
(a) => t.push(a)
|
10748
10752
|
), t), []);
|
10749
10753
|
}
|
10750
10754
|
getInvalidModelVariants() {
|
10751
|
-
return this.workflow.steps.reduce((t, e) => (e.type === v.Model && !
|
10755
|
+
return this.workflow.steps.reduce((t, e) => (e.type === v.Model && !vt(e, this.stepSelections) && t.push(e.stepName), t), []);
|
10752
10756
|
}
|
10753
10757
|
async stepElementsForIntroducedSilentSteps(t, e) {
|
10754
10758
|
const a = this.product;
|
@@ -10838,7 +10842,7 @@ class yo {
|
|
10838
10842
|
async reset() {
|
10839
10843
|
this.commandContext.getAllLayouts().forEach(
|
10840
10844
|
(e) => e.layoutState.elements.forEach((a) => {
|
10841
|
-
this.getCommandDispatcher()(new
|
10845
|
+
this.getCommandDispatcher()(new Bt(a.id));
|
10842
10846
|
})
|
10843
10847
|
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
10844
10848
|
}
|
@@ -10848,13 +10852,13 @@ class yo {
|
|
10848
10852
|
...this.stepSelections,
|
10849
10853
|
[t]: { selectedVariants: e }
|
10850
10854
|
}, this.selectionCost = Object.values(this.stepSelections).reduce((C, E) => C + E.selectedVariants.map((P) => P.priceModifier || 0).reduce((P, B) => P + B, 0), 0), this.workflow.steps.forEach((C) => {
|
10851
|
-
|
10855
|
+
vt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1, delete this.stepMetadata[C.stepName], delete this.stepSelections[C.stepName], delete this.storage[C.stepName]);
|
10852
10856
|
});
|
10853
|
-
const s = this.allScenes, o =
|
10857
|
+
const s = this.allScenes, o = yt(s, i), l = yt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), A = l.map((C) => C.silentSteps).flat().filter(
|
10854
10858
|
(C) => !c.some((E) => E.stepName === C.stepName)
|
10855
10859
|
);
|
10856
10860
|
c.forEach((C) => {
|
10857
|
-
|
10861
|
+
vt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1);
|
10858
10862
|
});
|
10859
10863
|
const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(A, !1);
|
10860
10864
|
this.stepElements = {
|
@@ -10864,7 +10868,7 @@ class yo {
|
|
10864
10868
|
}, this.removeElements(u);
|
10865
10869
|
const g = this.workflow.steps.find((C) => C.stepName === t);
|
10866
10870
|
g?.type === v.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((E) => E.id));
|
10867
|
-
const p = u.map((C) => new
|
10871
|
+
const p = u.map((C) => new Bt(C.id)), f = new Ga(this.constructSerializableWorkflow()), S = [...m, ...p, f];
|
10868
10872
|
S.length > 0 && this.commandContext.apply(new R(S), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
10869
10873
|
const b = this.getInvalidModelVariants(), I = this.modelContainer;
|
10870
10874
|
if (I) {
|
@@ -10882,7 +10886,7 @@ class yo {
|
|
10882
10886
|
await this.onSelectionChange(), n && await n();
|
10883
10887
|
}
|
10884
10888
|
async ensureStepsAreLoaded() {
|
10885
|
-
const e =
|
10889
|
+
const e = yt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
|
10886
10890
|
for (const l of n)
|
10887
10891
|
if (!this.stepInitialised[l.stepName])
|
10888
10892
|
switch (this.stepInitialised[l.stepName] = !0, l.type) {
|
@@ -10896,7 +10900,7 @@ class yo {
|
|
10896
10900
|
);
|
10897
10901
|
break;
|
10898
10902
|
case v.Frame:
|
10899
|
-
a.push(
|
10903
|
+
a.push(St.init(l, this, this.reloadedState));
|
10900
10904
|
break;
|
10901
10905
|
case v.Illustration:
|
10902
10906
|
a.push(
|
@@ -12341,7 +12345,7 @@ class Go {
|
|
12341
12345
|
getStepsConditionallyActive() {
|
12342
12346
|
return this.getScenes().flatMap(
|
12343
12347
|
(t) => this.getStepsByScene(t).filter(
|
12344
|
-
(e) =>
|
12348
|
+
(e) => vt(e.getRaw(), this.getWorkflowManager().getStepSelections())
|
12345
12349
|
)
|
12346
12350
|
);
|
12347
12351
|
}
|
@@ -12492,7 +12496,7 @@ class Go {
|
|
12492
12496
|
return await Ke.addDesign(n), n;
|
12493
12497
|
}
|
12494
12498
|
async copy() {
|
12495
|
-
const t =
|
12499
|
+
const t = Et(this.getCommandContext().getState());
|
12496
12500
|
if (!t) throw new V("Internal state is undefined! Cannot copy experience!");
|
12497
12501
|
const e = JSON.stringify(t.transaction), a = this.getWorkflowManager().getWorkflow(), n = this.getWorkflowManager().getTransaction().integrationProduct?.id;
|
12498
12502
|
if (!n) throw new V("Integration product id is undefined!");
|
@@ -12792,7 +12796,7 @@ const Wo = (r) => {
|
|
12792
12796
|
C.classList.add(Q), g[Q] = { browserValue: B };
|
12793
12797
|
}
|
12794
12798
|
});
|
12795
|
-
const f =
|
12799
|
+
const f = It().serializeToString(m), S = n.colors;
|
12796
12800
|
if (S) {
|
12797
12801
|
for (const [C, E] of Object.entries(g))
|
12798
12802
|
for (const P of Object.keys(S))
|
@@ -12991,7 +12995,7 @@ const Wo = (r) => {
|
|
12991
12995
|
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
|
12992
12996
|
if (!f)
|
12993
12997
|
throw new Dt("Failed to read SVG.");
|
12994
|
-
return pa(f),
|
12998
|
+
return pa(f), It().serializeToString(f);
|
12995
12999
|
};
|
12996
13000
|
l.forEach((A) => {
|
12997
13001
|
const u = r.find((m) => m.panelId === A.panelId);
|
@@ -13256,7 +13260,7 @@ class sl {
|
|
13256
13260
|
* Actions to perform when a static render event is fired for this canvas.
|
13257
13261
|
*/
|
13258
13262
|
async render(t) {
|
13259
|
-
const e =
|
13263
|
+
const e = Et(t);
|
13260
13264
|
this.lastRequestedRenderArguments = e;
|
13261
13265
|
const a = this.getStaticContext();
|
13262
13266
|
if (!a) {
|
@@ -13916,7 +13920,7 @@ class hl {
|
|
13916
13920
|
}
|
13917
13921
|
async setGlobalPropertyState(t) {
|
13918
13922
|
this.globalPropertyState || await this.initPromise;
|
13919
|
-
const e =
|
13923
|
+
const e = Et(this.globalPropertyState);
|
13920
13924
|
this.globalPropertyState = { ...t, id: e.id }, this.recalculateMandatoryStates(), await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
|
13921
13925
|
}
|
13922
13926
|
getAspectMandatoryFulfilled(t) {
|
@@ -13943,7 +13947,7 @@ class hl {
|
|
13943
13947
|
if (!i)
|
13944
13948
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
13945
13949
|
this.mandatoryFulfilledAspects.set(t, e !== "");
|
13946
|
-
const s =
|
13950
|
+
const s = Et(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
|
13947
13951
|
if (o.length > 0)
|
13948
13952
|
if (n) {
|
13949
13953
|
const l = o.find((c) => c.channel === n);
|
@@ -13986,7 +13990,7 @@ class hl {
|
|
13986
13990
|
const n = this.configuration.aspects.find((o) => o.name === t);
|
13987
13991
|
if (!n)
|
13988
13992
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
13989
|
-
const i =
|
13993
|
+
const i = Et(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
|
13990
13994
|
if (s.length > 0)
|
13991
13995
|
if (a) {
|
13992
13996
|
const o = s.find((l) => l.channel === a);
|
@@ -14388,7 +14392,7 @@ class ar {
|
|
14388
14392
|
if (h || g.partial && (!g.data.productCollections || g.data.productCollections.length === 0 || !g.data.productCollections[0].productCollectionProductsFeed?.items || g.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
|
14389
14393
|
return;
|
14390
14394
|
c.abort(), h = !0, m.unsubscribe();
|
14391
|
-
const p = g.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new Ae(
|
14395
|
+
const p = g.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new Ae(Et(f))) || [];
|
14392
14396
|
u({
|
14393
14397
|
items: p,
|
14394
14398
|
// Clone items because it could be cached data (immutable)
|
@@ -15962,7 +15966,7 @@ class md {
|
|
15962
15966
|
} catch (a) {
|
15963
15967
|
throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
|
15964
15968
|
}
|
15965
|
-
}, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.
|
15969
|
+
}, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.4.0-beta.c4e503af-360f-5779-8464-b409180b3fde"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
15966
15970
|
}
|
15967
15971
|
configure(t) {
|
15968
15972
|
gt.setHubUrl(t.hubUrl), gt.setServerUrl(t.serverUrl), gt.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 && zr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
@@ -16867,6 +16871,9 @@ class Gl {
|
|
16867
16871
|
}
|
16868
16872
|
}
|
16869
16873
|
class wd {
|
16874
|
+
traversableScenes() {
|
16875
|
+
throw new Error("Method not implemented.");
|
16876
|
+
}
|
16870
16877
|
updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m, g, p, f) {
|
16871
16878
|
throw new Error("Method not implemented.");
|
16872
16879
|
}
|
@@ -17037,7 +17044,7 @@ class ql extends Z {
|
|
17037
17044
|
}
|
17038
17045
|
selectVariant(t) {
|
17039
17046
|
const e = this.manager.getRegionElements(this.step.stepName);
|
17040
|
-
return
|
17047
|
+
return St.selectVariant(
|
17041
17048
|
this.step,
|
17042
17049
|
t.getResource(),
|
17043
17050
|
e,
|
@@ -17057,7 +17064,7 @@ class ql extends Z {
|
|
17057
17064
|
* @param [recalculateOffsets=true] Optional: Recalculates the offsets of the image inside the frame. Default: `true`.
|
17058
17065
|
*/
|
17059
17066
|
async selectImage(t, e = !0, a = !0) {
|
17060
|
-
if (await
|
17067
|
+
if (await St.selectImage(this.step, t, this.manager, a), e) {
|
17061
17068
|
const n = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
|
17062
17069
|
this.manager.updateStorage(this.step.stepName, {
|
17063
17070
|
framePatternData: {
|
@@ -17095,7 +17102,7 @@ class ql extends Z {
|
|
17095
17102
|
if (!e)
|
17096
17103
|
throw new Error("You must supply an image selection before attempting to remove the background.");
|
17097
17104
|
const a = await O.removeBackgroundFromAsset(e);
|
17098
|
-
t && await
|
17105
|
+
t && await St.selectImage(this.step, a, this.manager, !1);
|
17099
17106
|
const n = this.manager.getStepStorage(this.step.stepName)?.framePatternData || {};
|
17100
17107
|
return this.manager.updateStorage(this.step.stepName, {
|
17101
17108
|
framePatternData: {
|
@@ -17106,7 +17113,7 @@ class ql extends Z {
|
|
17106
17113
|
}), a;
|
17107
17114
|
}
|
17108
17115
|
changeColors(t) {
|
17109
|
-
|
17116
|
+
St.changeColors(this.step, this.manager, t);
|
17110
17117
|
}
|
17111
17118
|
getImageData() {
|
17112
17119
|
if (this.frameService)
|
@@ -17116,7 +17123,7 @@ class ql extends Z {
|
|
17116
17123
|
return this.step.data.colorOption;
|
17117
17124
|
}
|
17118
17125
|
getAvailableColors() {
|
17119
|
-
return this.step.data.colorPickerEnabled ?
|
17126
|
+
return this.step.data.colorPickerEnabled ? St.availableColors(this.step, this.manager) : Promise.resolve([]);
|
17120
17127
|
}
|
17121
17128
|
isColorPickerEnabled() {
|
17122
17129
|
return this.step.data.colorPickerEnabled ?? !1;
|
@@ -17129,7 +17136,7 @@ class ql extends Z {
|
|
17129
17136
|
return this.step.data.maxColors;
|
17130
17137
|
}
|
17131
17138
|
getUniqueColorCount() {
|
17132
|
-
return
|
17139
|
+
return St.getUniqueColorCount(this.step, this.manager);
|
17133
17140
|
}
|
17134
17141
|
getCurrentFrameStep(t, e, a, n) {
|
17135
17142
|
return n && n.length > 1 && t === void 0 ? "SelectFrame" : e || a || this.getImageData() ? "Position" : "SelectImage";
|
@@ -17631,7 +17638,7 @@ export {
|
|
17631
17638
|
oc as AddressValidationResultConfirmationLevel,
|
17632
17639
|
ud as ArrayInput,
|
17633
17640
|
L as AspectType,
|
17634
|
-
|
17641
|
+
bt as AssetNotFoundError,
|
17635
17642
|
ye as AssetType,
|
17636
17643
|
id as BringForwardCommand,
|
17637
17644
|
rd as BringToBackCommand,
|
@@ -17647,7 +17654,7 @@ export {
|
|
17647
17654
|
zn as CreateLayoutCommand,
|
17648
17655
|
Rl as CurrencyContext,
|
17649
17656
|
Ql as CurrencyService,
|
17650
|
-
|
17657
|
+
Bt as DeleteElementCommand,
|
17651
17658
|
Fo as DigitalContentStepHandle,
|
17652
17659
|
cl as FileUploadGlobalPropertyHandle,
|
17653
17660
|
ue as FlowExecutionNodeResult,
|
@@ -17733,7 +17740,7 @@ export {
|
|
17733
17740
|
$ as findElement,
|
17734
17741
|
$c as findPmsColors,
|
17735
17742
|
Vt as frameDataCache,
|
17736
|
-
|
17743
|
+
St as frameStepService,
|
17737
17744
|
M as generate,
|
17738
17745
|
al as generateCommands,
|
17739
17746
|
ot as generateSVGWithUnknownColors,
|
@@ -17806,6 +17813,6 @@ export {
|
|
17806
17813
|
Fs as toast,
|
17807
17814
|
Td as validateWorkflowExperienceRecipient,
|
17808
17815
|
Nd as validateWorkflowExperienceRecipients,
|
17809
|
-
|
17816
|
+
It as xmlSerializer
|
17810
17817
|
};
|
17811
17818
|
//# sourceMappingURL=index.mjs.map
|