@spiffcommerce/core 26.38.0-beta.ed5fb9b2-fb14-550c-8a8f-6d7e87487a8f → 26.38.0-beta.f1ade417-8ebc-5b59-89d7-49e43b4ff28f
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 +123 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -102
- 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();
|
|
@@ -347,9 +347,8 @@ class $r {
|
|
|
347
347
|
headers: l
|
|
348
348
|
};
|
|
349
349
|
}), a = cr(({ operation: i, graphQLErrors: s, networkError: o }) => {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
o && !((A = (d = c == null ? void 0 : c.fetchOptions) == null ? void 0 : d.signal) != null && A.aborted) && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
|
|
350
|
+
const l = s || [];
|
|
351
|
+
o && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
|
|
353
352
|
}), n = Ar();
|
|
354
353
|
return new ir({
|
|
355
354
|
link: sr([n, a, e, t]),
|
|
@@ -3329,7 +3328,7 @@ const ie = (r) => {
|
|
|
3329
3328
|
}
|
|
3330
3329
|
});
|
|
3331
3330
|
});
|
|
3332
|
-
}, yn = (r) =>
|
|
3331
|
+
}, yn = (r) => Bt().serializeToString(r), ga = (r, t, e, a, n) => {
|
|
3333
3332
|
const i = Cn(r);
|
|
3334
3333
|
if (!i)
|
|
3335
3334
|
throw new Error("Failed to read SVG.");
|
|
@@ -3361,7 +3360,7 @@ const ie = (r) => {
|
|
|
3361
3360
|
s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
|
|
3362
3361
|
}
|
|
3363
3362
|
});
|
|
3364
|
-
const i =
|
|
3363
|
+
const i = Bt().serializeToString(e);
|
|
3365
3364
|
return {
|
|
3366
3365
|
colors: a,
|
|
3367
3366
|
svg: i
|
|
@@ -3610,7 +3609,7 @@ class si {
|
|
|
3610
3609
|
d.lengthComputable && a(d.loaded * 100 / d.total);
|
|
3611
3610
|
}, c.onload = () => {
|
|
3612
3611
|
const d = s.assetResponse.asset;
|
|
3613
|
-
|
|
3612
|
+
bt.add(s.assetResponse.asset), o(d);
|
|
3614
3613
|
}, c.onerror = l, this.postProcessFileUpload(t, s.mimeType).then((d) => c.send(d.blob)).catch(l);
|
|
3615
3614
|
}), this.cacheAsset(s.assetResponse.asset), s.assetResponse.asset;
|
|
3616
3615
|
}
|
|
@@ -3642,7 +3641,7 @@ class si {
|
|
|
3642
3641
|
});
|
|
3643
3642
|
if (this.bgrmProcessCache.delete(e), !((o = (s = i.data) == null ? void 0 : s.assetRemoveBackground) != null && o.key))
|
|
3644
3643
|
throw new Error("Failed to remove background from image");
|
|
3645
|
-
return
|
|
3644
|
+
return bt.add(i.data.assetRemoveBackground), Y.add(e, i.data.assetRemoveBackground.key), this.cache.set(
|
|
3646
3645
|
i.data.assetRemoveBackground.key,
|
|
3647
3646
|
Promise.resolve(i.data.assetRemoveBackground)
|
|
3648
3647
|
), i.data.assetRemoveBackground;
|
|
@@ -3650,16 +3649,16 @@ class si {
|
|
|
3650
3649
|
return this.bgrmProcessCache.set(e, n), n;
|
|
3651
3650
|
}
|
|
3652
3651
|
removePersistedAsset(t) {
|
|
3653
|
-
|
|
3652
|
+
bt.remove(t), Y.delete(t), Y.deleteForBgRemovedKey(t);
|
|
3654
3653
|
}
|
|
3655
3654
|
getPersistedAssets() {
|
|
3656
|
-
return
|
|
3655
|
+
return bt.list();
|
|
3657
3656
|
}
|
|
3658
3657
|
registerPersistedAssetListener(t) {
|
|
3659
|
-
|
|
3658
|
+
bt.addCallback(t);
|
|
3660
3659
|
}
|
|
3661
3660
|
unRegisterPersistedAssetListener(t) {
|
|
3662
|
-
|
|
3661
|
+
bt.removeCallback(t);
|
|
3663
3662
|
}
|
|
3664
3663
|
isRaster(t) {
|
|
3665
3664
|
return !(t.type === "image/svg+xml" || t.type === "application/pdf" || t.type === "application/postscript");
|
|
@@ -3668,9 +3667,9 @@ class si {
|
|
|
3668
3667
|
if (e === "image/svg+xml") {
|
|
3669
3668
|
const a = await t.blob.text(), s = new window.DOMParser().parseFromString(a, "image/svg+xml").documentElement;
|
|
3670
3669
|
if (!s)
|
|
3671
|
-
throw new
|
|
3670
|
+
throw new Pt("Failed to read SVG.");
|
|
3672
3671
|
Kr(s);
|
|
3673
|
-
const l =
|
|
3672
|
+
const l = Bt().serializeToString(s);
|
|
3674
3673
|
return {
|
|
3675
3674
|
name: t.name,
|
|
3676
3675
|
blob: new Blob([l], { type: "image/svg+xml" })
|
|
@@ -3757,7 +3756,7 @@ const Rt = "persistentAssets", Sn = class Ct {
|
|
|
3757
3756
|
}
|
|
3758
3757
|
};
|
|
3759
3758
|
Sn.callbacks = [];
|
|
3760
|
-
let
|
|
3759
|
+
let bt = Sn;
|
|
3761
3760
|
const Ra = "bgrmPersistentAssets";
|
|
3762
3761
|
class Y {
|
|
3763
3762
|
static has(t) {
|
|
@@ -5198,9 +5197,9 @@ const _ = new ui(), En = y`
|
|
|
5198
5197
|
silentSteps: r.silentSteps.filter((a) => yt(a, t))
|
|
5199
5198
|
};
|
|
5200
5199
|
return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
|
|
5201
|
-
},
|
|
5200
|
+
}, Dt = (r, t) => r.map((e) => Oi(e, t)).filter((e) => e !== null), $i = async (r, t, e = !1) => {
|
|
5202
5201
|
var s;
|
|
5203
|
-
const a =
|
|
5202
|
+
const a = Dt(r, t), n = [];
|
|
5204
5203
|
for (const o of a)
|
|
5205
5204
|
for (const l of o.renderableSteps) {
|
|
5206
5205
|
const c = (((s = l.option) == null ? void 0 : s.variants) || []).length;
|
|
@@ -5423,7 +5422,7 @@ const N = () => {
|
|
|
5423
5422
|
}), xc = (r, t, e, a) => ({
|
|
5424
5423
|
x: r.x + ((t == null ? void 0 : t.x) + (t == null ? void 0 : t.width)) * e,
|
|
5425
5424
|
y: r.y + ((t == null ? void 0 : t.y) + (t == null ? void 0 : t.height)) * a
|
|
5426
|
-
}),
|
|
5425
|
+
}), It = (r) => {
|
|
5427
5426
|
switch (r) {
|
|
5428
5427
|
case j.North:
|
|
5429
5428
|
return j.East;
|
|
@@ -5442,7 +5441,7 @@ const N = () => {
|
|
|
5442
5441
|
case j.Southwest:
|
|
5443
5442
|
return j.Northwest;
|
|
5444
5443
|
}
|
|
5445
|
-
}, 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 }) => {
|
|
5446
5445
|
const a = pt(r.rotation), n = {
|
|
5447
5446
|
x: t.x + r.x * e.x,
|
|
5448
5447
|
y: t.x + r.y * e.y
|
|
@@ -5674,7 +5673,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5674
5673
|
return Oe.get(r);
|
|
5675
5674
|
const e = (async () => {
|
|
5676
5675
|
try {
|
|
5677
|
-
return
|
|
5676
|
+
return vt(r).getFont();
|
|
5678
5677
|
} catch {
|
|
5679
5678
|
if (zi(r)) {
|
|
5680
5679
|
const a = un(r), n = Je(a);
|
|
@@ -5689,7 +5688,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5689
5688
|
}, Gi = (r) => {
|
|
5690
5689
|
const t = un(r), e = Je(t);
|
|
5691
5690
|
return aa(r, e), e;
|
|
5692
|
-
},
|
|
5691
|
+
}, vt = (r) => {
|
|
5693
5692
|
const t = Mn.get(r);
|
|
5694
5693
|
if (t)
|
|
5695
5694
|
return t;
|
|
@@ -5732,7 +5731,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5732
5731
|
const I = B.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
|
|
5733
5732
|
h.appendChild(F);
|
|
5734
5733
|
}
|
|
5735
|
-
return e.querySelectorAll("text").forEach((d) => d.remove()),
|
|
5734
|
+
return e.querySelectorAll("text").forEach((d) => d.remove()), Bt().serializeToString(a);
|
|
5736
5735
|
}, we = (r, t, e, a) => Math.max(qi(r.join(`
|
|
5737
5736
|
`), e, a), t), Oa = (r, t, e, a, n, i) => {
|
|
5738
5737
|
const s = (i || Ca) * n.getApproximateHeight(), o = t.split(`
|
|
@@ -5790,7 +5789,7 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5790
5789
|
return Math.min(A, d);
|
|
5791
5790
|
}, ji = (r, t, e, a) => {
|
|
5792
5791
|
var c;
|
|
5793
|
-
const n =
|
|
5792
|
+
const n = vt(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
|
|
5794
5793
|
if (!e)
|
|
5795
5794
|
return Oa(t, r, t.fontSize, s, n, a);
|
|
5796
5795
|
let o;
|
|
@@ -5811,9 +5810,9 @@ const zi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5811
5810
|
fontSize: Wi(o, n, i, t.width, t.height, a)
|
|
5812
5811
|
} : Oa(t, r, t.fontSize, s, n, a);
|
|
5813
5812
|
}, Hi = (r, t, e, a, n) => {
|
|
5814
|
-
const s =
|
|
5813
|
+
const s = vt(t.assetUrl).getFont();
|
|
5815
5814
|
let o = { ...r };
|
|
5816
|
-
const l = { ...r }, c = Tn(a, e / s.unitsPerEm,
|
|
5815
|
+
const l = { ...r }, c = Tn(a, e / s.unitsPerEm, vt(t.assetUrl));
|
|
5817
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;
|
|
5818
5817
|
}, $e = 1, ht = (r, t, e) => {
|
|
5819
5818
|
let a = 0;
|
|
@@ -6301,7 +6300,7 @@ const te = (r) => {
|
|
|
6301
6300
|
const s = dt().parseFromString(r, "image/svg+xml").firstElementChild;
|
|
6302
6301
|
if (!s)
|
|
6303
6302
|
throw new Error("Failed to read SVG");
|
|
6304
|
-
const l =
|
|
6303
|
+
const l = Bt().serializeToString(s), c = gt(), d = c.getContext("2d"), A = await ca.from(d, l, {
|
|
6305
6304
|
anonymousCrossOrigin: !0,
|
|
6306
6305
|
ignoreDimensions: !1,
|
|
6307
6306
|
createCanvas: gt,
|
|
@@ -6344,7 +6343,7 @@ const te = (r) => {
|
|
|
6344
6343
|
}
|
|
6345
6344
|
if (e && t === T.Textbox && (a != null && a.text) && (a != null && a.fontScale)) {
|
|
6346
6345
|
await Qt(e);
|
|
6347
|
-
const l =
|
|
6346
|
+
const l = vt(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
|
|
6348
6347
|
o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
|
|
6349
6348
|
}
|
|
6350
6349
|
return o;
|
|
@@ -6757,7 +6756,7 @@ class G extends O {
|
|
|
6757
6756
|
return a !== void 0 ? a + 1 : 0;
|
|
6758
6757
|
}
|
|
6759
6758
|
}
|
|
6760
|
-
class
|
|
6759
|
+
class Et extends O {
|
|
6761
6760
|
constructor(t) {
|
|
6762
6761
|
super(), this.id = t;
|
|
6763
6762
|
}
|
|
@@ -7365,7 +7364,7 @@ class ds {
|
|
|
7365
7364
|
40
|
|
7366
7365
|
);
|
|
7367
7366
|
});
|
|
7368
|
-
t.forEach((h) => a.getCommandDispatcher()(new
|
|
7367
|
+
t.forEach((h) => a.getCommandDispatcher()(new Et(h.id)));
|
|
7369
7368
|
const o = n.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", l = new URL(o + n.data.baseUrl);
|
|
7370
7369
|
l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
|
|
7371
7370
|
const c = l.toString();
|
|
@@ -7423,7 +7422,7 @@ class Se {
|
|
|
7423
7422
|
return na(e);
|
|
7424
7423
|
const a = t.asset;
|
|
7425
7424
|
if (!a)
|
|
7426
|
-
throw new
|
|
7425
|
+
throw new St(t);
|
|
7427
7426
|
const n = a.fileLink;
|
|
7428
7427
|
if (n)
|
|
7429
7428
|
return at(n, !0);
|
|
@@ -7707,7 +7706,7 @@ class Se {
|
|
|
7707
7706
|
i && i(!0);
|
|
7708
7707
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
|
7709
7708
|
t.data.regions.map(async (m, g) => {
|
|
7710
|
-
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(
|
|
7711
7710
|
f,
|
|
7712
7711
|
p,
|
|
7713
7712
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
|
@@ -7969,11 +7968,11 @@ class As {
|
|
|
7969
7968
|
if (!t.data || !t.data.regions)
|
|
7970
7969
|
throw new Ce(t, "Missing regions.");
|
|
7971
7970
|
n(!0);
|
|
7972
|
-
const s = a.map((C) => new
|
|
7971
|
+
const s = a.map((C) => new Et(C.id));
|
|
7973
7972
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
|
7974
7973
|
const o = e.asset;
|
|
7975
7974
|
if (!o)
|
|
7976
|
-
throw new
|
|
7975
|
+
throw new St(e);
|
|
7977
7976
|
const l = o.fileLink;
|
|
7978
7977
|
if (!l)
|
|
7979
7978
|
throw new jt(o);
|
|
@@ -8111,7 +8110,7 @@ class us {
|
|
|
8111
8110
|
n(!0);
|
|
8112
8111
|
const s = e.material;
|
|
8113
8112
|
if (!s)
|
|
8114
|
-
throw n(!1), new
|
|
8113
|
+
throw n(!1), new St(e);
|
|
8115
8114
|
return {
|
|
8116
8115
|
command: void 0,
|
|
8117
8116
|
followup: async () => {
|
|
@@ -8166,7 +8165,7 @@ class hs {
|
|
|
8166
8165
|
if (h && t.option) {
|
|
8167
8166
|
const g = (m = A.asset) == null ? void 0 : m.fileLink;
|
|
8168
8167
|
if (!g)
|
|
8169
|
-
throw new
|
|
8168
|
+
throw new St(A);
|
|
8170
8169
|
await h.applyModelVariant(
|
|
8171
8170
|
t.stepName || "",
|
|
8172
8171
|
{
|
|
@@ -8191,7 +8190,7 @@ class hs {
|
|
|
8191
8190
|
n(!0);
|
|
8192
8191
|
const i = (s = e.asset) == null ? void 0 : s.fileLink;
|
|
8193
8192
|
if (!i)
|
|
8194
|
-
throw new
|
|
8193
|
+
throw new St(e);
|
|
8195
8194
|
return {
|
|
8196
8195
|
command: void 0,
|
|
8197
8196
|
followup: async () => {
|
|
@@ -8254,7 +8253,7 @@ class ms {
|
|
|
8254
8253
|
if (!p)
|
|
8255
8254
|
return console.error(`Can not find layout for region: ${u.panelId}`), null;
|
|
8256
8255
|
const f = [];
|
|
8257
|
-
return h && f.push(new
|
|
8256
|
+
return h && f.push(new Et(m)), f.push(
|
|
8258
8257
|
new G(
|
|
8259
8258
|
{
|
|
8260
8259
|
stepRegion: u,
|
|
@@ -8371,12 +8370,12 @@ class gs {
|
|
|
8371
8370
|
async selectVariantCommand(t, e, a, n) {
|
|
8372
8371
|
const i = e.asset;
|
|
8373
8372
|
if (!i)
|
|
8374
|
-
throw new
|
|
8373
|
+
throw new St(e);
|
|
8375
8374
|
const s = i == null ? void 0 : i.fileLink;
|
|
8376
8375
|
if (!s)
|
|
8377
8376
|
return console.error("No URL for picture!"), null;
|
|
8378
8377
|
n(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
|
|
8379
|
-
const l = a.getRegionElements(t.stepName).map((A) => new
|
|
8378
|
+
const l = a.getRegionElements(t.stepName).map((A) => new Et(A.id)), c = (A) => {
|
|
8380
8379
|
const h = a.getLayouts().find((g) => g.panelId === A.panelId);
|
|
8381
8380
|
if (!h)
|
|
8382
8381
|
throw new q(A);
|
|
@@ -8706,7 +8705,7 @@ const ws = new Cs(), Ge = (r, t, e, a, n) => {
|
|
|
8706
8705
|
return [null, null];
|
|
8707
8706
|
}, he = (r, t, e, a, n) => {
|
|
8708
8707
|
let i, s;
|
|
8709
|
-
const o =
|
|
8708
|
+
const o = vt(t.assetUrl), l = o.getFont();
|
|
8710
8709
|
if (n.size) {
|
|
8711
8710
|
const u = r / l.unitsPerEm;
|
|
8712
8711
|
return [i, s] = Ge(e, a, r, u, o), [n.size, i, s];
|
|
@@ -8741,7 +8740,7 @@ class Ss {
|
|
|
8741
8740
|
/(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
|
|
8742
8741
|
""
|
|
8743
8742
|
);
|
|
8744
|
-
const n = [], i = e ?
|
|
8743
|
+
const n = [], i = e ? vt(e.assetUrl) : void 0;
|
|
8745
8744
|
if (i) {
|
|
8746
8745
|
const s = a.split("").filter((l) => !ys.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
|
|
8747
8746
|
for (let l = 0; l < o.length; l++)
|
|
@@ -9061,7 +9060,7 @@ class Ss {
|
|
|
9061
9060
|
async fontDataFromVariant(t) {
|
|
9062
9061
|
const e = t.asset;
|
|
9063
9062
|
if (!e)
|
|
9064
|
-
throw new
|
|
9063
|
+
throw new St(t);
|
|
9065
9064
|
const a = e.fileLink;
|
|
9066
9065
|
if (!a)
|
|
9067
9066
|
throw new jt(e);
|
|
@@ -9383,7 +9382,7 @@ class Fs {
|
|
|
9383
9382
|
u = (A * 100 | 0) / 100;
|
|
9384
9383
|
break;
|
|
9385
9384
|
default:
|
|
9386
|
-
throw new
|
|
9385
|
+
throw new Pt("Failed to encode path.");
|
|
9387
9386
|
}
|
|
9388
9387
|
l || s.push(" "), s.push(u), l = !1;
|
|
9389
9388
|
}
|
|
@@ -9397,12 +9396,12 @@ class Fs {
|
|
|
9397
9396
|
for (e.lastIndex = 0; i = e.exec(t); ) {
|
|
9398
9397
|
const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = Wa[s];
|
|
9399
9398
|
if (o.length < c.length)
|
|
9400
|
-
throw new
|
|
9399
|
+
throw new Pt(
|
|
9401
9400
|
`Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
|
|
9402
9401
|
);
|
|
9403
9402
|
if (c.length > 0) {
|
|
9404
9403
|
if (o.length % c.length !== 0)
|
|
9405
|
-
throw new
|
|
9404
|
+
throw new Pt(
|
|
9406
9405
|
`Path type "${s}" given ${o.length} arguments, not divisible by ${c.length}`
|
|
9407
9406
|
);
|
|
9408
9407
|
for (let d = 0; d < o.length / c.length; d++) {
|
|
@@ -9427,7 +9426,7 @@ class Fs {
|
|
|
9427
9426
|
if (o in i && l in i) {
|
|
9428
9427
|
const c = [i[o], i[l]], d = e(c);
|
|
9429
9428
|
if (d.length < 2)
|
|
9430
|
-
throw new
|
|
9429
|
+
throw new Pt("Transformer must return at least 2 points.");
|
|
9431
9430
|
i[o] = d[0], i[l] = d[1];
|
|
9432
9431
|
}
|
|
9433
9432
|
}
|
|
@@ -10262,7 +10261,7 @@ class lo {
|
|
|
10262
10261
|
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((o) => {
|
|
10263
10262
|
this.storage[o.stepName] = o.storage || {};
|
|
10264
10263
|
}), this.allScenes = await Ni(t);
|
|
10265
|
-
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);
|
|
10266
10265
|
this.commandContext.apply(new $(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
|
10267
10266
|
}
|
|
10268
10267
|
getWorkflowExperience() {
|
|
@@ -10468,7 +10467,7 @@ class lo {
|
|
|
10468
10467
|
},
|
|
10469
10468
|
{ refocusCamera: e }
|
|
10470
10469
|
);
|
|
10471
|
-
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) => {
|
|
10472
10471
|
var c, d, A;
|
|
10473
10472
|
if (!((c = s.option) != null && c.id)) {
|
|
10474
10473
|
console.error(`Failed to read option id from step: ${s.stepName}`);
|
|
@@ -10580,7 +10579,7 @@ class lo {
|
|
|
10580
10579
|
const t = this.getCommandContext().getState();
|
|
10581
10580
|
if (!t)
|
|
10582
10581
|
throw new z("Attempted to serialize state before it was initialized.");
|
|
10583
|
-
const e =
|
|
10582
|
+
const e = Ft(t.transaction), a = this.dehydrateState(e);
|
|
10584
10583
|
return JSON.stringify(a);
|
|
10585
10584
|
}
|
|
10586
10585
|
/**
|
|
@@ -10713,7 +10712,7 @@ class lo {
|
|
|
10713
10712
|
async reset() {
|
|
10714
10713
|
this.commandContext.getAllLayouts().forEach(
|
|
10715
10714
|
(e) => e.layoutState.elements.forEach((a) => {
|
|
10716
|
-
this.getCommandDispatcher()(new
|
|
10715
|
+
this.getCommandDispatcher()(new Et(a.id));
|
|
10717
10716
|
})
|
|
10718
10717
|
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
|
10719
10718
|
}
|
|
@@ -10726,7 +10725,7 @@ class lo {
|
|
|
10726
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) => {
|
|
10727
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]);
|
|
10728
10727
|
});
|
|
10729
|
-
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(
|
|
10730
10729
|
(E) => !c.some((B) => B.stepName === E.stepName)
|
|
10731
10730
|
);
|
|
10732
10731
|
c.forEach((E) => {
|
|
@@ -10743,7 +10742,7 @@ class lo {
|
|
|
10743
10742
|
const E = (S = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : S.frameService;
|
|
10744
10743
|
E == null || E.setTargetElements(a.map((B) => B.id));
|
|
10745
10744
|
}
|
|
10746
|
-
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];
|
|
10747
10746
|
C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
10748
10747
|
const w = this.getInvalidModelVariants(), v = this.modelContainer;
|
|
10749
10748
|
if (v) {
|
|
@@ -10761,7 +10760,7 @@ class lo {
|
|
|
10761
10760
|
await this.onSelectionChange(), n && await n();
|
|
10762
10761
|
}
|
|
10763
10762
|
async ensureStepsAreLoaded() {
|
|
10764
|
-
const e =
|
|
10763
|
+
const e = Dt(this.allScenes, this.stepSelections).map((l) => l.renderableSteps), a = [], n = e.flat();
|
|
10765
10764
|
for (const l of n)
|
|
10766
10765
|
if (!this.stepInitialised[l.stepName])
|
|
10767
10766
|
switch (this.stepInitialised[l.stepName] = !0, l.type) {
|
|
@@ -12411,7 +12410,7 @@ class Mo {
|
|
|
12411
12410
|
}
|
|
12412
12411
|
async copy() {
|
|
12413
12412
|
var s;
|
|
12414
|
-
const t =
|
|
12413
|
+
const t = Ft(this.getCommandContext().getState());
|
|
12415
12414
|
if (!t)
|
|
12416
12415
|
throw new z("Internal state is undefined! Cannot copy experience!");
|
|
12417
12416
|
const e = JSON.stringify(t.transaction), a = this.getWorkflowManager().getWorkflow(), n = (s = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : s.id;
|
|
@@ -12644,7 +12643,7 @@ const To = [
|
|
|
12644
12643
|
B.classList.add(Q), g[Q] = { browserValue: F };
|
|
12645
12644
|
}
|
|
12646
12645
|
});
|
|
12647
|
-
const f =
|
|
12646
|
+
const f = Bt().serializeToString(m), C = n.colors;
|
|
12648
12647
|
if (C) {
|
|
12649
12648
|
for (const [B, I] of Object.entries(g))
|
|
12650
12649
|
for (const P of Object.keys(C))
|
|
@@ -12847,8 +12846,8 @@ const To = [
|
|
|
12847
12846
|
const c = await at(i, !0), d = (A) => {
|
|
12848
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;
|
|
12849
12848
|
if (!f)
|
|
12850
|
-
throw new
|
|
12851
|
-
return ma(f),
|
|
12849
|
+
throw new Pt("Failed to read SVG.");
|
|
12850
|
+
return ma(f), Bt().serializeToString(f);
|
|
12852
12851
|
};
|
|
12853
12852
|
l.forEach((A) => {
|
|
12854
12853
|
const u = r.find((m) => m.panelId === A.panelId);
|
|
@@ -13105,7 +13104,7 @@ class qo {
|
|
|
13105
13104
|
* Actions to perform when a static render event is fired for this canvas.
|
|
13106
13105
|
*/
|
|
13107
13106
|
async render(t) {
|
|
13108
|
-
const e =
|
|
13107
|
+
const e = Ft(t);
|
|
13109
13108
|
this.lastRequestedRenderArguments = e;
|
|
13110
13109
|
const a = this.getStaticContext();
|
|
13111
13110
|
if (!a) {
|
|
@@ -13773,7 +13772,7 @@ class tl {
|
|
|
13773
13772
|
}
|
|
13774
13773
|
async setGlobalPropertyState(t) {
|
|
13775
13774
|
this.globalPropertyState || await this.initPromise;
|
|
13776
|
-
const e =
|
|
13775
|
+
const e = Ft(this.globalPropertyState);
|
|
13777
13776
|
this.globalPropertyState = { ...t, id: e.id }, await this.updateGlobalPropertyState(), await this.onGlobalPropertyStateChange(e, this.globalPropertyState);
|
|
13778
13777
|
}
|
|
13779
13778
|
getAspect(t, e) {
|
|
@@ -13797,7 +13796,7 @@ class tl {
|
|
|
13797
13796
|
const i = this.configuration.aspects.find((l) => l.name === t);
|
|
13798
13797
|
if (!i)
|
|
13799
13798
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
|
13800
|
-
const s =
|
|
13799
|
+
const s = Ft(this.globalPropertyState), o = this.globalPropertyState.aspects.filter((l) => l.name === t);
|
|
13801
13800
|
if (o.length > 0)
|
|
13802
13801
|
if (n) {
|
|
13803
13802
|
const l = o.find((c) => c.channel === n);
|
|
@@ -13838,7 +13837,7 @@ class tl {
|
|
|
13838
13837
|
const n = this.configuration.aspects.find((o) => o.name === t);
|
|
13839
13838
|
if (!n)
|
|
13840
13839
|
throw new Error(`Failed to find configuration aspect with name: ${t}`);
|
|
13841
|
-
const i =
|
|
13840
|
+
const i = Ft(this.globalPropertyState), s = this.globalPropertyState.aspects.filter((o) => o.name === t);
|
|
13842
13841
|
if (s.length > 0)
|
|
13843
13842
|
if (a) {
|
|
13844
13843
|
const o = s.find((l) => l.channel === a);
|
|
@@ -14181,14 +14180,15 @@ class Zn {
|
|
|
14181
14180
|
* @returns
|
|
14182
14181
|
*/
|
|
14183
14182
|
async fetchProductsFeed(t, e, a, n, i, s) {
|
|
14183
|
+
var c, d, A, u, h, m;
|
|
14184
14184
|
if (this.fullFetched) {
|
|
14185
|
-
const
|
|
14185
|
+
const g = await (a ? this.filterProducts(a) : this.fetchProducts());
|
|
14186
14186
|
return {
|
|
14187
|
-
total:
|
|
14188
|
-
items:
|
|
14187
|
+
total: g.length,
|
|
14188
|
+
items: g.slice(t, t + e)
|
|
14189
14189
|
};
|
|
14190
14190
|
}
|
|
14191
|
-
const o =
|
|
14191
|
+
const o = await b.getShadowGraphqlClient().query({
|
|
14192
14192
|
query: $s,
|
|
14193
14193
|
variables: {
|
|
14194
14194
|
id: this.getId(),
|
|
@@ -14207,36 +14207,12 @@ class Zn {
|
|
|
14207
14207
|
},
|
|
14208
14208
|
errorPolicy: "all",
|
|
14209
14209
|
fetchPolicy: "cache-first",
|
|
14210
|
-
returnPartialData: !0
|
|
14211
|
-
context: {
|
|
14212
|
-
fetchOptions: {
|
|
14213
|
-
signal: l
|
|
14214
|
-
}
|
|
14215
|
-
}
|
|
14216
|
-
});
|
|
14217
|
-
return new Promise((d) => {
|
|
14218
|
-
let A, u = !1;
|
|
14219
|
-
c.subscribe({
|
|
14220
|
-
start(h) {
|
|
14221
|
-
u ? (h.closed && h.unsubscribe(), o.abort()) : A = h;
|
|
14222
|
-
},
|
|
14223
|
-
next(h) {
|
|
14224
|
-
var g, p, f, C;
|
|
14225
|
-
if (h.partial && !h.data.productCollections || h.data.productCollections.length === 0)
|
|
14226
|
-
return;
|
|
14227
|
-
o.abort(), u = !0, A && !A.closed && A.unsubscribe();
|
|
14228
|
-
const m = ((p = (g = h.data.productCollections) == null ? void 0 : g[0].productCollectionProductsFeed) == null ? void 0 : p.items.filter((w) => !!w.product).map((w) => new le(w))) || [];
|
|
14229
|
-
d({
|
|
14230
|
-
items: St(m),
|
|
14231
|
-
// Clone items because it could be cached data (immutable)
|
|
14232
|
-
total: ((C = (f = h.data.productCollections) == null ? void 0 : f[0].productCollectionProductsFeed) == null ? void 0 : C.total) ?? 0
|
|
14233
|
-
});
|
|
14234
|
-
},
|
|
14235
|
-
error() {
|
|
14236
|
-
u || (u = !0, A && !A.closed && A.unsubscribe(), d({ items: [], total: 0 }));
|
|
14237
|
-
}
|
|
14238
|
-
});
|
|
14210
|
+
returnPartialData: !0
|
|
14239
14211
|
});
|
|
14212
|
+
return {
|
|
14213
|
+
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))) || [],
|
|
14214
|
+
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
|
|
14215
|
+
};
|
|
14240
14216
|
}
|
|
14241
14217
|
getTransformCollection() {
|
|
14242
14218
|
if (this.collection.transformCollection)
|
|
@@ -15624,7 +15600,7 @@ class _c {
|
|
|
15624
15600
|
} catch (a) {
|
|
15625
15601
|
throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
|
|
15626
15602
|
}
|
|
15627
|
-
}, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0-beta.
|
|
15603
|
+
}, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0-beta.086120bb-2716-5d55-859d-f71980f25fb6"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
15628
15604
|
}
|
|
15629
15605
|
configure(t) {
|
|
15630
15606
|
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();
|
|
@@ -17333,7 +17309,7 @@ export {
|
|
|
17333
17309
|
Yl as AddressValidationResultConfirmationLevel,
|
|
17334
17310
|
Jc as ArrayInput,
|
|
17335
17311
|
et as AspectType,
|
|
17336
|
-
|
|
17312
|
+
St as AssetNotFoundError,
|
|
17337
17313
|
ge as AssetType,
|
|
17338
17314
|
Gc as BringForwardCommand,
|
|
17339
17315
|
zc as BringToBackCommand,
|
|
@@ -17347,7 +17323,7 @@ export {
|
|
|
17347
17323
|
Ll as ConversionLocation,
|
|
17348
17324
|
G as CreateElementCommand,
|
|
17349
17325
|
Un as CreateLayoutCommand,
|
|
17350
|
-
|
|
17326
|
+
Et as DeleteElementCommand,
|
|
17351
17327
|
Co as DigitalContentStepHandle,
|
|
17352
17328
|
Ko as FileUploadGlobalPropertyHandle,
|
|
17353
17329
|
ce as FlowExecutionNodeResult,
|
|
@@ -17381,7 +17357,7 @@ export {
|
|
|
17381
17357
|
pl as ObjectInputType,
|
|
17382
17358
|
Xn as OptionGlobalPropertyHandle,
|
|
17383
17359
|
fe as OptionNotFoundError,
|
|
17384
|
-
|
|
17360
|
+
Pt as ParseError,
|
|
17385
17361
|
ho as PictureStepHandle,
|
|
17386
17362
|
yr as ProductCameraRig,
|
|
17387
17363
|
Zn as ProductCollection,
|
|
@@ -17505,6 +17481,6 @@ export {
|
|
|
17505
17481
|
ws as toast,
|
|
17506
17482
|
pd as validateWorkflowExperienceRecipient,
|
|
17507
17483
|
fd as validateWorkflowExperienceRecipients,
|
|
17508
|
-
|
|
17484
|
+
Bt as xmlSerializer
|
|
17509
17485
|
};
|
|
17510
17486
|
//# sourceMappingURL=index.mjs.map
|