@spiffcommerce/core 26.38.0-beta.f7be796e-77fe-56a9-b635-19a1193f5fc6 → 26.38.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.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -93
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { orientation as ur } from "exifr/dist/mini.umd.cjs";
|
|
|
7
7
|
import { parse as nn } from "css";
|
|
8
8
|
import hr from "fuse.js";
|
|
9
9
|
import { Pith as ca } from "pith";
|
|
10
|
-
import
|
|
10
|
+
import Ft from "lodash.clonedeep";
|
|
11
11
|
import { toString as rn } from "qrcode";
|
|
12
12
|
import mr from "svg-path-bbox";
|
|
13
13
|
import { parse as Je } from "opentype.js";
|
|
@@ -40,7 +40,7 @@ class q extends Jt {
|
|
|
40
40
|
super(`Panel not Found: ${t.panelId}`), this.panelId = (t == null ? void 0 : t.panelId) || "N/A";
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class St extends Jt {
|
|
44
44
|
constructor(t) {
|
|
45
45
|
super(`Asset not found for variant: ${t.name}`), this.variant = t;
|
|
46
46
|
}
|
|
@@ -65,7 +65,7 @@ class z extends be {
|
|
|
65
65
|
super(`Unhandled Behavior Encountered: ${t}`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class Pt extends be {
|
|
69
69
|
constructor(t) {
|
|
70
70
|
super(`Parsing Error: ${t}`);
|
|
71
71
|
}
|
|
@@ -224,7 +224,7 @@ const cn = /* @__PURE__ */ new Map(), xa = /* @__PURE__ */ new Map(), ka = /* @_
|
|
|
224
224
|
const n = a.load();
|
|
225
225
|
return Qe.set(t, n), n;
|
|
226
226
|
}
|
|
227
|
-
},
|
|
227
|
+
}, Bt = () => {
|
|
228
228
|
if (Tt([typeof XMLSerializer]))
|
|
229
229
|
return new XMLSerializer();
|
|
230
230
|
const r = Kt();
|
|
@@ -3328,7 +3328,7 @@ const ie = (r) => {
|
|
|
3328
3328
|
}
|
|
3329
3329
|
});
|
|
3330
3330
|
});
|
|
3331
|
-
}, yn = (r) =>
|
|
3331
|
+
}, yn = (r) => Bt().serializeToString(r), ga = (r, t, e, a, n) => {
|
|
3332
3332
|
const i = Cn(r);
|
|
3333
3333
|
if (!i)
|
|
3334
3334
|
throw new Error("Failed to read SVG.");
|
|
@@ -3360,7 +3360,7 @@ const ie = (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 = Bt().serializeToString(e);
|
|
3364
3364
|
return {
|
|
3365
3365
|
colors: a,
|
|
3366
3366
|
svg: i
|
|
@@ -3609,7 +3609,7 @@ class si {
|
|
|
3609
3609
|
d.lengthComputable && a(d.loaded * 100 / d.total);
|
|
3610
3610
|
}, c.onload = () => {
|
|
3611
3611
|
const d = s.assetResponse.asset;
|
|
3612
|
-
|
|
3612
|
+
bt.add(s.assetResponse.asset), o(d);
|
|
3613
3613
|
}, c.onerror = l, this.postProcessFileUpload(t, s.mimeType).then((d) => c.send(d.blob)).catch(l);
|
|
3614
3614
|
}), this.cacheAsset(s.assetResponse.asset), s.assetResponse.asset;
|
|
3615
3615
|
}
|
|
@@ -3641,7 +3641,7 @@ class si {
|
|
|
3641
3641
|
});
|
|
3642
3642
|
if (this.bgrmProcessCache.delete(e), !((o = (s = i.data) == null ? void 0 : s.assetRemoveBackground) != null && o.key))
|
|
3643
3643
|
throw new Error("Failed to remove background from image");
|
|
3644
|
-
return
|
|
3644
|
+
return bt.add(i.data.assetRemoveBackground), Y.add(e, i.data.assetRemoveBackground.key), this.cache.set(
|
|
3645
3645
|
i.data.assetRemoveBackground.key,
|
|
3646
3646
|
Promise.resolve(i.data.assetRemoveBackground)
|
|
3647
3647
|
), i.data.assetRemoveBackground;
|
|
@@ -3649,16 +3649,16 @@ class si {
|
|
|
3649
3649
|
return this.bgrmProcessCache.set(e, n), n;
|
|
3650
3650
|
}
|
|
3651
3651
|
removePersistedAsset(t) {
|
|
3652
|
-
|
|
3652
|
+
bt.remove(t), Y.delete(t), Y.deleteForBgRemovedKey(t);
|
|
3653
3653
|
}
|
|
3654
3654
|
getPersistedAssets() {
|
|
3655
|
-
return
|
|
3655
|
+
return bt.list();
|
|
3656
3656
|
}
|
|
3657
3657
|
registerPersistedAssetListener(t) {
|
|
3658
|
-
|
|
3658
|
+
bt.addCallback(t);
|
|
3659
3659
|
}
|
|
3660
3660
|
unRegisterPersistedAssetListener(t) {
|
|
3661
|
-
|
|
3661
|
+
bt.removeCallback(t);
|
|
3662
3662
|
}
|
|
3663
3663
|
isRaster(t) {
|
|
3664
3664
|
return !(t.type === "image/svg+xml" || t.type === "application/pdf" || t.type === "application/postscript");
|
|
@@ -3667,9 +3667,9 @@ class si {
|
|
|
3667
3667
|
if (e === "image/svg+xml") {
|
|
3668
3668
|
const a = await t.blob.text(), s = new window.DOMParser().parseFromString(a, "image/svg+xml").documentElement;
|
|
3669
3669
|
if (!s)
|
|
3670
|
-
throw new
|
|
3670
|
+
throw new Pt("Failed to read SVG.");
|
|
3671
3671
|
Kr(s);
|
|
3672
|
-
const l =
|
|
3672
|
+
const l = Bt().serializeToString(s);
|
|
3673
3673
|
return {
|
|
3674
3674
|
name: t.name,
|
|
3675
3675
|
blob: new Blob([l], { type: "image/svg+xml" })
|
|
@@ -3756,7 +3756,7 @@ const Rt = "persistentAssets", Sn = class Ct {
|
|
|
3756
3756
|
}
|
|
3757
3757
|
};
|
|
3758
3758
|
Sn.callbacks = [];
|
|
3759
|
-
let
|
|
3759
|
+
let bt = Sn;
|
|
3760
3760
|
const Ra = "bgrmPersistentAssets";
|
|
3761
3761
|
class Y {
|
|
3762
3762
|
static has(t) {
|
|
@@ -5197,9 +5197,9 @@ const _ = new ui(), En = y`
|
|
|
5197
5197
|
silentSteps: r.silentSteps.filter((a) => yt(a, t))
|
|
5198
5198
|
};
|
|
5199
5199
|
return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
|
|
5200
|
-
},
|
|
5200
|
+
}, Dt = (r, t) => r.map((e) => Oi(e, t)).filter((e) => e !== null), $i = async (r, t, e = !1) => {
|
|
5201
5201
|
var s;
|
|
5202
|
-
const a =
|
|
5202
|
+
const a = Dt(r, t), n = [];
|
|
5203
5203
|
for (const o of a)
|
|
5204
5204
|
for (const l of o.renderableSteps) {
|
|
5205
5205
|
const c = (((s = l.option) == null ? void 0 : s.variants) || []).length;
|
|
@@ -5422,7 +5422,7 @@ const N = () => {
|
|
|
5422
5422
|
}), xc = (r, t, e, a) => ({
|
|
5423
5423
|
x: r.x + ((t == null ? void 0 : t.x) + (t == null ? void 0 : t.width)) * e,
|
|
5424
5424
|
y: r.y + ((t == null ? void 0 : t.y) + (t == null ? void 0 : t.height)) * a
|
|
5425
|
-
}),
|
|
5425
|
+
}), It = (r) => {
|
|
5426
5426
|
switch (r) {
|
|
5427
5427
|
case j.North:
|
|
5428
5428
|
return j.East;
|
|
@@ -5441,7 +5441,7 @@ const N = () => {
|
|
|
5441
5441
|
case j.Southwest:
|
|
5442
5442
|
return j.Northwest;
|
|
5443
5443
|
}
|
|
5444
|
-
}, kc = (r, t) => t > 45 && t <= 135 ?
|
|
5444
|
+
}, kc = (r, t) => t > 45 && t <= 135 ? It(r) : t > 135 && t <= 225 ? It(It(r)) : t > 225 && t <= 315 ? It(It(It(r))) : r, Mc = (r, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
|
|
5445
5445
|
const a = pt(r.rotation), n = {
|
|
5446
5446
|
x: t.x + r.x * e.x,
|
|
5447
5447
|
y: t.x + r.y * e.y
|
|
@@ -5673,7 +5673,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5673
5673
|
return Oe.get(r);
|
|
5674
5674
|
const e = (async () => {
|
|
5675
5675
|
try {
|
|
5676
|
-
return
|
|
5676
|
+
return vt(r).getFont();
|
|
5677
5677
|
} catch {
|
|
5678
5678
|
if (zi(r)) {
|
|
5679
5679
|
const a = un(r), n = Je(a);
|
|
@@ -5688,7 +5688,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5688
5688
|
}, Gi = (r) => {
|
|
5689
5689
|
const t = un(r), e = Je(t);
|
|
5690
5690
|
return aa(r, e), e;
|
|
5691
|
-
},
|
|
5691
|
+
}, vt = (r) => {
|
|
5692
5692
|
const t = Mn.get(r);
|
|
5693
5693
|
if (t)
|
|
5694
5694
|
return t;
|
|
@@ -5731,7 +5731,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5731
5731
|
const I = B.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
|
|
5732
5732
|
h.appendChild(F);
|
|
5733
5733
|
}
|
|
5734
|
-
return e.querySelectorAll("text").forEach((d) => d.remove()),
|
|
5734
|
+
return e.querySelectorAll("text").forEach((d) => d.remove()), Bt().serializeToString(a);
|
|
5735
5735
|
}, we = (r, t, e, a) => Math.max(qi(r.join(`
|
|
5736
5736
|
`), e, a), t), Oa = (r, t, e, a, n, i) => {
|
|
5737
5737
|
const s = (i || Ca) * n.getApproximateHeight(), o = t.split(`
|
|
@@ -5789,7 +5789,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5789
5789
|
return Math.min(A, d);
|
|
5790
5790
|
}, ji = (r, t, e, a) => {
|
|
5791
5791
|
var c;
|
|
5792
|
-
const n =
|
|
5792
|
+
const n = vt(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
|
|
5793
5793
|
if (!e)
|
|
5794
5794
|
return Oa(t, r, t.fontSize, s, n, a);
|
|
5795
5795
|
let o;
|
|
@@ -5810,9 +5810,9 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5810
5810
|
fontSize: Wi(o, n, i, t.width, t.height, a)
|
|
5811
5811
|
} : Oa(t, r, t.fontSize, s, n, a);
|
|
5812
5812
|
}, Hi = (r, t, e, a, n) => {
|
|
5813
|
-
const s =
|
|
5813
|
+
const s = vt(t.assetUrl).getFont();
|
|
5814
5814
|
let o = { ...r };
|
|
5815
|
-
const l = { ...r }, c = Tn(a, e / s.unitsPerEm,
|
|
5815
|
+
const l = { ...r }, c = Tn(a, e / s.unitsPerEm, vt(t.assetUrl));
|
|
5816
5816
|
return c && c < o.width && (l.width = c, n === "left" ? (l.left += Math.sin(o.rotation * Math.PI / 360) * (o.width - c), l.top += Math.sin(o.rotation * Math.PI / 180) * (c - o.width) / 2) : n === "right" ? l.left += o.width - c : l.left += (o.width - c) / 2, a && Yi(a, a).every(([d, A]) => d === A) && (o = l)), o;
|
|
5817
5817
|
}, $e = 1, ht = (r, t, e) => {
|
|
5818
5818
|
let a = 0;
|
|
@@ -6300,7 +6300,7 @@ const te = (r) => {
|
|
|
6300
6300
|
const s = dt().parseFromString(r, "image/svg+xml").firstElementChild;
|
|
6301
6301
|
if (!s)
|
|
6302
6302
|
throw new Error("Failed to read SVG");
|
|
6303
|
-
const l =
|
|
6303
|
+
const l = Bt().serializeToString(s), c = gt(), d = c.getContext("2d"), A = await ca.from(d, l, {
|
|
6304
6304
|
anonymousCrossOrigin: !0,
|
|
6305
6305
|
ignoreDimensions: !1,
|
|
6306
6306
|
createCanvas: gt,
|
|
@@ -6343,7 +6343,7 @@ const te = (r) => {
|
|
|
6343
6343
|
}
|
|
6344
6344
|
if (e && t === T.Textbox && (a != null && a.text) && (a != null && a.fontScale)) {
|
|
6345
6345
|
await Qt(e);
|
|
6346
|
-
const l =
|
|
6346
|
+
const l = vt(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
|
|
6347
6347
|
o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
|
|
6348
6348
|
}
|
|
6349
6349
|
return o;
|
|
@@ -6756,7 +6756,7 @@ class G extends O {
|
|
|
6756
6756
|
return a !== void 0 ? a + 1 : 0;
|
|
6757
6757
|
}
|
|
6758
6758
|
}
|
|
6759
|
-
class
|
|
6759
|
+
class Et extends O {
|
|
6760
6760
|
constructor(t) {
|
|
6761
6761
|
super(), this.id = t;
|
|
6762
6762
|
}
|
|
@@ -7364,7 +7364,7 @@ class ds {
|
|
|
7364
7364
|
40
|
|
7365
7365
|
);
|
|
7366
7366
|
});
|
|
7367
|
-
t.forEach((h) => a.getCommandDispatcher()(new
|
|
7367
|
+
t.forEach((h) => a.getCommandDispatcher()(new Et(h.id)));
|
|
7368
7368
|
const o = n.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", l = new URL(o + n.data.baseUrl);
|
|
7369
7369
|
l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
|
|
7370
7370
|
const c = l.toString();
|
|
@@ -7422,7 +7422,7 @@ class Se {
|
|
|
7422
7422
|
return na(e);
|
|
7423
7423
|
const a = t.asset;
|
|
7424
7424
|
if (!a)
|
|
7425
|
-
throw new
|
|
7425
|
+
throw new St(t);
|
|
7426
7426
|
const n = a.fileLink;
|
|
7427
7427
|
if (n)
|
|
7428
7428
|
return at(n, !0);
|
|
@@ -7706,7 +7706,7 @@ class Se {
|
|
|
7706
7706
|
i && i(!0);
|
|
7707
7707
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
|
7708
7708
|
t.data.regions.map(async (m, g) => {
|
|
7709
|
-
const p = await Me(l[g]), f = o.getImageData(), C = a.map((I) => new
|
|
7709
|
+
const p = await Me(l[g]), f = o.getImageData(), C = a.map((I) => new Et(I.id)), w = f ? Sa(
|
|
7710
7710
|
f,
|
|
7711
7711
|
p,
|
|
7712
7712
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
|
@@ -7968,11 +7968,11 @@ class As {
|
|
|
7968
7968
|
if (!t.data || !t.data.regions)
|
|
7969
7969
|
throw new Ce(t, "Missing regions.");
|
|
7970
7970
|
n(!0);
|
|
7971
|
-
const s = a.map((C) => new
|
|
7971
|
+
const s = a.map((C) => new Et(C.id));
|
|
7972
7972
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
|
7973
7973
|
const o = e.asset;
|
|
7974
7974
|
if (!o)
|
|
7975
|
-
throw new
|
|
7975
|
+
throw new St(e);
|
|
7976
7976
|
const l = o.fileLink;
|
|
7977
7977
|
if (!l)
|
|
7978
7978
|
throw new jt(o);
|
|
@@ -8110,7 +8110,7 @@ class us {
|
|
|
8110
8110
|
n(!0);
|
|
8111
8111
|
const s = e.material;
|
|
8112
8112
|
if (!s)
|
|
8113
|
-
throw n(!1), new
|
|
8113
|
+
throw n(!1), new St(e);
|
|
8114
8114
|
return {
|
|
8115
8115
|
command: void 0,
|
|
8116
8116
|
followup: async () => {
|
|
@@ -8165,7 +8165,7 @@ class hs {
|
|
|
8165
8165
|
if (h && t.option) {
|
|
8166
8166
|
const g = (m = A.asset) == null ? void 0 : m.fileLink;
|
|
8167
8167
|
if (!g)
|
|
8168
|
-
throw new
|
|
8168
|
+
throw new St(A);
|
|
8169
8169
|
await h.applyModelVariant(
|
|
8170
8170
|
t.stepName || "",
|
|
8171
8171
|
{
|
|
@@ -8190,7 +8190,7 @@ class hs {
|
|
|
8190
8190
|
n(!0);
|
|
8191
8191
|
const i = (s = e.asset) == null ? void 0 : s.fileLink;
|
|
8192
8192
|
if (!i)
|
|
8193
|
-
throw new
|
|
8193
|
+
throw new St(e);
|
|
8194
8194
|
return {
|
|
8195
8195
|
command: void 0,
|
|
8196
8196
|
followup: async () => {
|
|
@@ -8253,7 +8253,7 @@ class ms {
|
|
|
8253
8253
|
if (!p)
|
|
8254
8254
|
return console.error(`Can not find layout for region: ${u.panelId}`), null;
|
|
8255
8255
|
const f = [];
|
|
8256
|
-
return h && f.push(new
|
|
8256
|
+
return h && f.push(new Et(m)), f.push(
|
|
8257
8257
|
new G(
|
|
8258
8258
|
{
|
|
8259
8259
|
stepRegion: u,
|
|
@@ -8370,12 +8370,12 @@ class gs {
|
|
|
8370
8370
|
async selectVariantCommand(t, e, a, n) {
|
|
8371
8371
|
const i = e.asset;
|
|
8372
8372
|
if (!i)
|
|
8373
|
-
throw new
|
|
8373
|
+
throw new St(e);
|
|
8374
8374
|
const s = i == null ? void 0 : i.fileLink;
|
|
8375
8375
|
if (!s)
|
|
8376
8376
|
return console.error("No URL for picture!"), null;
|
|
8377
8377
|
n(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
|
|
8378
|
-
const l = a.getRegionElements(t.stepName).map((A) => new
|
|
8378
|
+
const l = a.getRegionElements(t.stepName).map((A) => new Et(A.id)), c = (A) => {
|
|
8379
8379
|
const h = a.getLayouts().find((g) => g.panelId === A.panelId);
|
|
8380
8380
|
if (!h)
|
|
8381
8381
|
throw new q(A);
|
|
@@ -8705,7 +8705,7 @@ const ws = new Cs(), Ge = (r, t, e, a, n) => {
|
|
|
8705
8705
|
return [null, null];
|
|
8706
8706
|
}, he = (r, t, e, a, n) => {
|
|
8707
8707
|
let i, s;
|
|
8708
|
-
const o =
|
|
8708
|
+
const o = vt(t.assetUrl), l = o.getFont();
|
|
8709
8709
|
if (n.size) {
|
|
8710
8710
|
const u = r / l.unitsPerEm;
|
|
8711
8711
|
return [i, s] = Ge(e, a, r, u, o), [n.size, i, s];
|
|
@@ -8740,7 +8740,7 @@ class Ss {
|
|
|
8740
8740
|
/(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
|
|
8741
8741
|
""
|
|
8742
8742
|
);
|
|
8743
|
-
const n = [], i = e ?
|
|
8743
|
+
const n = [], i = e ? vt(e.assetUrl) : void 0;
|
|
8744
8744
|
if (i) {
|
|
8745
8745
|
const s = a.split("").filter((l) => !ys.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
|
|
8746
8746
|
for (let l = 0; l < o.length; l++)
|
|
@@ -9060,7 +9060,7 @@ class Ss {
|
|
|
9060
9060
|
async fontDataFromVariant(t) {
|
|
9061
9061
|
const e = t.asset;
|
|
9062
9062
|
if (!e)
|
|
9063
|
-
throw new
|
|
9063
|
+
throw new St(t);
|
|
9064
9064
|
const a = e.fileLink;
|
|
9065
9065
|
if (!a)
|
|
9066
9066
|
throw new jt(e);
|
|
@@ -9382,7 +9382,7 @@ class Fs {
|
|
|
9382
9382
|
u = (A * 100 | 0) / 100;
|
|
9383
9383
|
break;
|
|
9384
9384
|
default:
|
|
9385
|
-
throw new
|
|
9385
|
+
throw new Pt("Failed to encode path.");
|
|
9386
9386
|
}
|
|
9387
9387
|
l || s.push(" "), s.push(u), l = !1;
|
|
9388
9388
|
}
|
|
@@ -9396,12 +9396,12 @@ class Fs {
|
|
|
9396
9396
|
for (e.lastIndex = 0; i = e.exec(t); ) {
|
|
9397
9397
|
const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = Wa[s];
|
|
9398
9398
|
if (o.length < c.length)
|
|
9399
|
-
throw new
|
|
9399
|
+
throw new Pt(
|
|
9400
9400
|
`Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
|
|
9401
9401
|
);
|
|
9402
9402
|
if (c.length > 0) {
|
|
9403
9403
|
if (o.length % c.length !== 0)
|
|
9404
|
-
throw new
|
|
9404
|
+
throw new Pt(
|
|
9405
9405
|
`Path type "${s}" given ${o.length} arguments, not divisible by ${c.length}`
|
|
9406
9406
|
);
|
|
9407
9407
|
for (let d = 0; d < o.length / c.length; d++) {
|
|
@@ -9426,7 +9426,7 @@ class Fs {
|
|
|
9426
9426
|
if (o in i && l in i) {
|
|
9427
9427
|
const c = [i[o], i[l]], d = e(c);
|
|
9428
9428
|
if (d.length < 2)
|
|
9429
|
-
throw new
|
|
9429
|
+
throw new Pt("Transformer must return at least 2 points.");
|
|
9430
9430
|
i[o] = d[0], i[l] = d[1];
|
|
9431
9431
|
}
|
|
9432
9432
|
}
|
|
@@ -10261,7 +10261,7 @@ class lo {
|
|
|
10261
10261
|
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
|
|
10262
10262
|
this.storage[o.stepName] = o.storage || {};
|
|
10263
10263
|
}), this.allScenes = await Ni(t);
|
|
10264
|
-
const n =
|
|
10264
|
+
const n = Dt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
|
|
10265
10265
|
this.commandContext.apply(new $(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
|
10266
10266
|
}
|
|
10267
10267
|
getWorkflowExperience() {
|
|
@@ -10467,7 +10467,7 @@ class lo {
|
|
|
10467
10467
|
},
|
|
10468
10468
|
{ refocusCamera: e }
|
|
10469
10469
|
);
|
|
10470
|
-
this.setModelContainer(a),
|
|
10470
|
+
this.setModelContainer(a), Dt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === D.Model || s.type === D.Material).forEach((s) => {
|
|
10471
10471
|
var c, d, A;
|
|
10472
10472
|
if (!((c = s.option) != null && c.id)) {
|
|
10473
10473
|
console.error(`Failed to read option id from step: ${s.stepName}`);
|
|
@@ -10579,7 +10579,7 @@ class lo {
|
|
|
10579
10579
|
const t = this.getCommandContext().getState();
|
|
10580
10580
|
if (!t)
|
|
10581
10581
|
throw new z("Attempted to serialize state before it was initialized.");
|
|
10582
|
-
const e =
|
|
10582
|
+
const e = Ft(t.transaction), a = this.dehydrateState(e);
|
|
10583
10583
|
return JSON.stringify(a);
|
|
10584
10584
|
}
|
|
10585
10585
|
/**
|
|
@@ -10712,7 +10712,7 @@ class lo {
|
|
|
10712
10712
|
async reset() {
|
|
10713
10713
|
this.commandContext.getAllLayouts().forEach(
|
|
10714
10714
|
(e) => e.layoutState.elements.forEach((a) => {
|
|
10715
|
-
this.getCommandDispatcher()(new
|
|
10715
|
+
this.getCommandDispatcher()(new Et(a.id));
|
|
10716
10716
|
})
|
|
10717
10717
|
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
|
10718
10718
|
}
|
|
@@ -10725,7 +10725,7 @@ class lo {
|
|
|
10725
10725
|
}, this.selectionCost = Object.values(this.stepSelections).reduce((E, B) => E + B.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, P) => I + P, 0), 0), this.workflow.steps.forEach((E) => {
|
|
10726
10726
|
yt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
|
|
10727
10727
|
});
|
|
10728
|
-
const s = this.allScenes, o =
|
|
10728
|
+
const s = this.allScenes, o = Dt(s, i), l = Dt(s, this.stepSelections), c = o.map((E) => E.silentSteps).flat(), A = l.map((E) => E.silentSteps).flat().filter(
|
|
10729
10729
|
(E) => !c.some((B) => B.stepName === E.stepName)
|
|
10730
10730
|
);
|
|
10731
10731
|
c.forEach((E) => {
|
|
@@ -10742,7 +10742,7 @@ class lo {
|
|
|
10742
10742
|
const E = (S = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : S.frameService;
|
|
10743
10743
|
E == null || E.setTargetElements(a.map((B) => B.id));
|
|
10744
10744
|
}
|
|
10745
|
-
const p = u.map((E) => new
|
|
10745
|
+
const p = u.map((E) => new Et(E.id)), f = new Va(this.constructSerializableWorkflow()), C = [...m, ...p, f];
|
|
10746
10746
|
C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
10747
10747
|
const w = this.getInvalidModelVariants(), v = this.modelContainer;
|
|
10748
10748
|
if (v) {
|
|
@@ -10760,7 +10760,7 @@ class lo {
|
|
|
10760
10760
|
await this.onSelectionChange(), n && await n();
|
|
10761
10761
|
}
|
|
10762
10762
|
async ensureStepsAreLoaded() {
|
|
10763
|
-
const e =
|
|
10763
|
+
const e = Dt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
|
|
10764
10764
|
for (const l of n)
|
|
10765
10765
|
if (!this.stepInitialised[l.stepName])
|
|
10766
10766
|
switch (this.stepInitialised[l.stepName] = !0, l.type) {
|
|
@@ -12410,7 +12410,7 @@ class Mo {
|
|
|
12410
12410
|
}
|
|
12411
12411
|
async copy() {
|
|
12412
12412
|
var s;
|
|
12413
|
-
const t =
|
|
12413
|
+
const t = Ft(this.getCommandContext().getState());
|
|
12414
12414
|
if (!t)
|
|
12415
12415
|
throw new z("Internal state is undefined! Cannot copy experience!");
|
|
12416
12416
|
const e = JSON.stringify(t.transaction), a = this.getWorkflowManager().getWorkflow(), n = (s = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : s.id;
|
|
@@ -12643,7 +12643,7 @@ const To = [
|
|
|
12643
12643
|
B.classList.add(Q), g[Q] = { browserValue: F };
|
|
12644
12644
|
}
|
|
12645
12645
|
});
|
|
12646
|
-
const f =
|
|
12646
|
+
const f = Bt().serializeToString(m), C = n.colors;
|
|
12647
12647
|
if (C) {
|
|
12648
12648
|
for (const [B, I] of Object.entries(g))
|
|
12649
12649
|
for (const P of Object.keys(C))
|
|
@@ -12846,8 +12846,8 @@ const To = [
|
|
|
12846
12846
|
const c = await at(i, !0), d = (A) => {
|
|
12847
12847
|
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = (h == null ? void 0 : h.length) > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
|
|
12848
12848
|
if (!f)
|
|
12849
|
-
throw new
|
|
12850
|
-
return ma(f),
|
|
12849
|
+
throw new Pt("Failed to read SVG.");
|
|
12850
|
+
return ma(f), Bt().serializeToString(f);
|
|
12851
12851
|
};
|
|
12852
12852
|
l.forEach((A) => {
|
|
12853
12853
|
const u = r.find((m) => m.panelId === A.panelId);
|
|
@@ -13104,7 +13104,7 @@ class qo {
|
|
|
13104
13104
|
* Actions to perform when a static render event is fired for this canvas.
|
|
13105
13105
|
*/
|
|
13106
13106
|
async render(t) {
|
|
13107
|
-
const e =
|
|
13107
|
+
const e = Ft(t);
|
|
13108
13108
|
this.lastRequestedRenderArguments = e;
|
|
13109
13109
|
const a = this.getStaticContext();
|
|
13110
13110
|
if (!a) {
|
|
@@ -13772,7 +13772,7 @@ class tl {
|
|
|
13772
13772
|
}
|
|
13773
13773
|
async setGlobalPropertyState(t) {
|
|
13774
13774
|
this.globalPropertyState || await this.initPromise;
|
|
13775
|
-
const e =
|
|
13775
|
+
const e = Ft(this.globalPropertyState);
|
|
13776
13776
|
this.globalPropertyState = { ...t, id: e.id }, await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
|
|
13777
13777
|
}
|
|
13778
13778
|
getAspect(t, e) {
|
|
@@ -13796,7 +13796,7 @@ class tl {
|
|
|
13796
13796
|
const i = this.configuration.aspects.find((l) => l.name === t);
|
|
13797
13797
|
if (!i)
|
|
13798
13798
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
|
13799
|
-
const s =
|
|
13799
|
+
const s = Ft(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
|
|
13800
13800
|
if (o.length > 0)
|
|
13801
13801
|
if (n) {
|
|
13802
13802
|
const l = o.find((c) => c.channel === n);
|
|
@@ -13837,7 +13837,7 @@ class tl {
|
|
|
13837
13837
|
const n = this.configuration.aspects.find((o) => o.name === t);
|
|
13838
13838
|
if (!n)
|
|
13839
13839
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
|
13840
|
-
const i =
|
|
13840
|
+
const i = Ft(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
|
|
13841
13841
|
if (s.length > 0)
|
|
13842
13842
|
if (a) {
|
|
13843
13843
|
const o = s.find((l) => l.channel === a);
|
|
@@ -14180,14 +14180,15 @@ class Zn {
|
|
|
14180
14180
|
* @returns
|
|
14181
14181
|
*/
|
|
14182
14182
|
async fetchProductsFeed(t, e, a, n, i, s) {
|
|
14183
|
+
var c, d, A, u, h, m;
|
|
14183
14184
|
if (this.fullFetched) {
|
|
14184
|
-
const
|
|
14185
|
+
const g = await (a ? this.filterProducts(a) : this.fetchProducts());
|
|
14185
14186
|
return {
|
|
14186
|
-
total:
|
|
14187
|
-
items:
|
|
14187
|
+
total: g.length,
|
|
14188
|
+
items: g.slice(t, t + e)
|
|
14188
14189
|
};
|
|
14189
14190
|
}
|
|
14190
|
-
const o = b.getShadowGraphqlClient().
|
|
14191
|
+
const o = await b.getShadowGraphqlClient().query({
|
|
14191
14192
|
query: $s,
|
|
14192
14193
|
variables: {
|
|
14193
14194
|
id: this.getId(),
|
|
@@ -14204,30 +14205,12 @@ class Zn {
|
|
|
14204
14205
|
sortKey: i,
|
|
14205
14206
|
sortDescending: s
|
|
14206
14207
|
},
|
|
14207
|
-
errorPolicy: "all"
|
|
14208
|
-
fetchPolicy: "cache-first",
|
|
14209
|
-
returnPartialData: !0
|
|
14210
|
-
});
|
|
14211
|
-
return new Promise((l) => {
|
|
14212
|
-
let c, d = !1;
|
|
14213
|
-
o.subscribe({
|
|
14214
|
-
start(A) {
|
|
14215
|
-
d ? A.unsubscribe() : c = A;
|
|
14216
|
-
},
|
|
14217
|
-
next(A) {
|
|
14218
|
-
var h, m, g, p;
|
|
14219
|
-
d = !0, c && c.unsubscribe();
|
|
14220
|
-
const u = ((m = (h = A.data.productCollections) == null ? void 0 : h[0].productCollectionProductsFeed) == null ? void 0 : m.items.filter((f) => !!f.product).map((f) => new le(f))) || [];
|
|
14221
|
-
l({
|
|
14222
|
-
items: St(u),
|
|
14223
|
-
total: ((p = (g = A.data.productCollections) == null ? void 0 : g[0].productCollectionProductsFeed) == null ? void 0 : p.total) ?? 0
|
|
14224
|
-
});
|
|
14225
|
-
},
|
|
14226
|
-
error() {
|
|
14227
|
-
d = !0, c && c.unsubscribe(), l({ items: [], total: 0 });
|
|
14228
|
-
}
|
|
14229
|
-
});
|
|
14208
|
+
errorPolicy: "all"
|
|
14230
14209
|
});
|
|
14210
|
+
return {
|
|
14211
|
+
items: ((A = (d = (c = o == null ? void 0 : o.data) == null ? void 0 : c.productCollections) == null ? void 0 : d[0].productCollectionProductsFeed) == null ? void 0 : A.items.filter((g) => !!g.product).map((g) => new le(g))) || [],
|
|
14212
|
+
total: ((m = (h = (u = o == null ? void 0 : o.data) == null ? void 0 : u.productCollections) == null ? void 0 : h[0].productCollectionProductsFeed) == null ? void 0 : m.total) ?? 0
|
|
14213
|
+
};
|
|
14231
14214
|
}
|
|
14232
14215
|
getTransformCollection() {
|
|
14233
14216
|
if (this.collection.transformCollection)
|
|
@@ -15615,7 +15598,7 @@ class _c {
|
|
|
15615
15598
|
} catch (a) {
|
|
15616
15599
|
throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
|
|
15617
15600
|
}
|
|
15618
|
-
}, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0
|
|
15601
|
+
}, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
15619
15602
|
}
|
|
15620
15603
|
configure(t) {
|
|
15621
15604
|
mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, t.bearerAuthenticationToken && Qr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();
|
|
@@ -17324,7 +17307,7 @@ export {
|
|
|
17324
17307
|
Yl as AddressValidationResultConfirmationLevel,
|
|
17325
17308
|
Jc as ArrayInput,
|
|
17326
17309
|
et as AspectType,
|
|
17327
|
-
|
|
17310
|
+
St as AssetNotFoundError,
|
|
17328
17311
|
ge as AssetType,
|
|
17329
17312
|
Gc as BringForwardCommand,
|
|
17330
17313
|
zc as BringToBackCommand,
|
|
@@ -17338,7 +17321,7 @@ export {
|
|
|
17338
17321
|
Ll as ConversionLocation,
|
|
17339
17322
|
G as CreateElementCommand,
|
|
17340
17323
|
Un as CreateLayoutCommand,
|
|
17341
|
-
|
|
17324
|
+
Et as DeleteElementCommand,
|
|
17342
17325
|
Co as DigitalContentStepHandle,
|
|
17343
17326
|
Ko as FileUploadGlobalPropertyHandle,
|
|
17344
17327
|
ce as FlowExecutionNodeResult,
|
|
@@ -17372,7 +17355,7 @@ export {
|
|
|
17372
17355
|
pl as ObjectInputType,
|
|
17373
17356
|
Xn as OptionGlobalPropertyHandle,
|
|
17374
17357
|
fe as OptionNotFoundError,
|
|
17375
|
-
|
|
17358
|
+
Pt as ParseError,
|
|
17376
17359
|
ho as PictureStepHandle,
|
|
17377
17360
|
yr as ProductCameraRig,
|
|
17378
17361
|
Zn as ProductCollection,
|
|
@@ -17496,6 +17479,6 @@ export {
|
|
|
17496
17479
|
ws as toast,
|
|
17497
17480
|
pd as validateWorkflowExperienceRecipient,
|
|
17498
17481
|
fd as validateWorkflowExperienceRecipients,
|
|
17499
|
-
|
|
17482
|
+
Bt as xmlSerializer
|
|
17500
17483
|
};
|
|
17501
17484
|
//# sourceMappingURL=index.mjs.map
|