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