@spiffcommerce/core 32.4.0-beta.31f8a4dd-4f9f-572b-8792-9d8d6243c25e → 32.4.0-beta.73ca5bed-eecb-5ae1-8a2c-f8c10430e8a2
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 +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -24,7 +24,7 @@ import hn from "lodash.debounce";
|
|
24
24
|
import "fs";
|
25
25
|
import "path";
|
26
26
|
import Pr from "lodash.omit";
|
27
|
-
var ve = /* @__PURE__ */ ((n) => (n.Data = "Data", n.Font = "Font", n.Frame = "Frame", n.Illustration = "Illustration", n.Image = "Image", n.Model = "Model", n.Material = "Material", n.Color = "Color", n.QuestionnaireCollateral = "QuestionnaireCollateral", n.RequestCollateral = "RequestCollateral", n.SignupCollateral = "SignupCollateral", n.Video = "Video", n.ColorProfile = "ColorProfile", n.Environment = "Environment", n))(ve || {}), L = /* @__PURE__ */ ((n) => (n.FileUpload = "FileUpload", n.Option = "Option", n.ColorOption = "ColorOption", n.Text = "Text", n))(L || {}), E = /* @__PURE__ */ ((n) => (n.Information = "Information", n.Bulk = "Bulk", n.DigitalContent = "DigitalContent", n.Finish = "Finish", n.Frame = "Frame", n.Illustration = "Illustration", n.Introduction = "Introduction", n.Material = "Material", n.Model = "Model", n.Module = "Module", n.Picture = "Picture", n.Photo = "Photo", n.ProductOverlay = "ProductOverlay", n.Question = "Question", n.Shape = "Shape", n.SilentIllustration = "SilentIllustration", n.Text = "Text", n))(E || {}), Dr = /* @__PURE__ */ ((n) => (n.Color = "Color", n.Colors = "Colors", n.Selection = "Selection", n.Selections = "Selections", n.Text = "Text", n.Upload = "Upload", n))(Dr || {}), Ht = /* @__PURE__ */ ((n) => (n.ThreeD = "ThreeD", n.FreeDesign = "FreeDesign", n.Print = "Print", n))(Ht || {}), x = /* @__PURE__ */ ((n) => (n.Frame = "frame", n.Group = "group", n.Image = "image", n.Pattern = "pattern", n.Illustration = "illustration", n.Textbox = "textbox", n))(x || {}), Fr = /* @__PURE__ */ ((n) => (n.Default = "Default", n.FirstTransaction = "FirstTransaction", n.OneToOne = "OneToOne", n))(Fr || {}), mn = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Failed = "Failed", n.Validated = "Validated", n.Overridden = "Overridden", n))(mn || {}), xr = /* @__PURE__ */ ((n) => (n.Hyperlink = "Hyperlink", n.Edit = "Edit", n.Approve = "Approve", n))(xr || {}), kr = /* @__PURE__ */ ((n) => (n.Hub = "Hub", n.Shopify = "Shopify", n))(kr || {}), ga = /* @__PURE__ */ ((n) => (n.BackgroundRemover = "BackgroundRemover", n.ConversionAccelerator = "Conversion Accelerator", n.ProcessBuilder = "ProcessBuilder", n))(ga || {}), Mr = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(Mr || {}), Ee = /* @__PURE__ */ ((n) => (n.Owner = "Owner", n.Approver = "Approver", n.Editor = "Editor", n.Viewer = "Viewer", n))(Ee || {}),
|
27
|
+
var ve = /* @__PURE__ */ ((n) => (n.Data = "Data", n.Font = "Font", n.Frame = "Frame", n.Illustration = "Illustration", n.Image = "Image", n.Model = "Model", n.Material = "Material", n.Color = "Color", n.QuestionnaireCollateral = "QuestionnaireCollateral", n.RequestCollateral = "RequestCollateral", n.SignupCollateral = "SignupCollateral", n.Video = "Video", n.ColorProfile = "ColorProfile", n.Environment = "Environment", n))(ve || {}), L = /* @__PURE__ */ ((n) => (n.FileUpload = "FileUpload", n.Option = "Option", n.ColorOption = "ColorOption", n.Text = "Text", n))(L || {}), E = /* @__PURE__ */ ((n) => (n.Information = "Information", n.Bulk = "Bulk", n.DigitalContent = "DigitalContent", n.Finish = "Finish", n.Frame = "Frame", n.Illustration = "Illustration", n.Introduction = "Introduction", n.Material = "Material", n.Model = "Model", n.Module = "Module", n.Picture = "Picture", n.Photo = "Photo", n.ProductOverlay = "ProductOverlay", n.Question = "Question", n.Shape = "Shape", n.SilentIllustration = "SilentIllustration", n.Text = "Text", n))(E || {}), Dr = /* @__PURE__ */ ((n) => (n.Color = "Color", n.Colors = "Colors", n.Selection = "Selection", n.Selections = "Selections", n.Text = "Text", n.Upload = "Upload", n))(Dr || {}), Ht = /* @__PURE__ */ ((n) => (n.ThreeD = "ThreeD", n.FreeDesign = "FreeDesign", n.Print = "Print", n))(Ht || {}), x = /* @__PURE__ */ ((n) => (n.Frame = "frame", n.Group = "group", n.Image = "image", n.Pattern = "pattern", n.Illustration = "illustration", n.Textbox = "textbox", n))(x || {}), Fr = /* @__PURE__ */ ((n) => (n.Default = "Default", n.FirstTransaction = "FirstTransaction", n.OneToOne = "OneToOne", n))(Fr || {}), mn = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Failed = "Failed", n.Validated = "Validated", n.Overridden = "Overridden", n))(mn || {}), xr = /* @__PURE__ */ ((n) => (n.Hyperlink = "Hyperlink", n.Edit = "Edit", n.Approve = "Approve", n))(xr || {}), kr = /* @__PURE__ */ ((n) => (n.Hub = "Hub", n.Shopify = "Shopify", n))(kr || {}), ga = /* @__PURE__ */ ((n) => (n.BackgroundRemover = "BackgroundRemover", n.ConversionAccelerator = "Conversion Accelerator", n.ProcessBuilder = "ProcessBuilder", n))(ga || {}), Mr = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(Mr || {}), Ee = /* @__PURE__ */ ((n) => (n.Owner = "Owner", n.Approver = "Approver", n.Editor = "Editor", n.Viewer = "Viewer", n))(Ee || {}), xt = /* @__PURE__ */ ((n) => (n.Autosize = "Autosize", n.Traditional = "Traditional", n))(xt || {}), W = /* @__PURE__ */ ((n) => (n[n.North = 0] = "North", n[n.Northeast = 1] = "Northeast", n[n.East = 2] = "East", n[n.Southeast = 3] = "Southeast", n[n.South = 4] = "South", n[n.Southwest = 5] = "Southwest", n[n.West = 6] = "West", n[n.Northwest = 7] = "Northwest", n))(W || {}), Tr = /* @__PURE__ */ ((n) => (n.Pixel = "px", n.Millimeter = "mm", n.Centimeter = "cm", n))(Tr || {});
|
28
28
|
class gn extends Error {
|
29
29
|
constructor(t) {
|
30
30
|
super(t), this.name = this.constructor.name;
|
@@ -70,7 +70,7 @@ class N extends Me {
|
|
70
70
|
super(`Unhandled Behavior Encountered: ${t}`);
|
71
71
|
}
|
72
72
|
}
|
73
|
-
class
|
73
|
+
class Bt extends Me {
|
74
74
|
constructor(t) {
|
75
75
|
super(`Parsing Error: ${t}`);
|
76
76
|
}
|
@@ -197,17 +197,17 @@ const pn = /* @__PURE__ */ new Map(), Ra = /* @__PURE__ */ new Map(), Oa = /* @_
|
|
197
197
|
if (t) return t;
|
198
198
|
const a = (async () => await (await nt(n)).text())();
|
199
199
|
return Oa.set(n, a), a;
|
200
|
-
},
|
201
|
-
if (
|
200
|
+
}, kt = (n) => n.every((t) => t !== "undefined"), se = (n) => kt([typeof document]) ? document.createElement(n) : Xt().document.createElement(n), $r = (n, t) => {
|
201
|
+
if (kt([typeof document]))
|
202
202
|
return document.createElementNS(n, t);
|
203
203
|
const a = Xt().document.createElement(t);
|
204
204
|
return a.setAttribute("xmlns", n), a;
|
205
205
|
}, dt = () => {
|
206
|
-
if (
|
206
|
+
if (kt([typeof DOMParser]))
|
207
207
|
return new DOMParser();
|
208
208
|
const n = Xt();
|
209
209
|
return new n.DOMParser();
|
210
|
-
}, Ur = () =>
|
210
|
+
}, Ur = () => kt([typeof DOMParser]) ? DOMParser : Xt().DOMParser, Ne = (n, t) => new Promise((e, a) => {
|
211
211
|
t ? fn(n).then(e).catch(a) : nt(n).then((r) => {
|
212
212
|
r.arrayBuffer().then(e).catch(a);
|
213
213
|
}).catch((r) => {
|
@@ -218,7 +218,7 @@ const pn = /* @__PURE__ */ new Map(), Ra = /* @__PURE__ */ new Map(), Oa = /* @_
|
|
218
218
|
r.text().then(e).catch(a);
|
219
219
|
}).catch(a);
|
220
220
|
}), Cn = (n) => fr(n), Ve = /* @__PURE__ */ new Map(), Lr = async (n, t) => {
|
221
|
-
if (
|
221
|
+
if (kt([typeof FontFace])) {
|
222
222
|
if (Ve.has(t))
|
223
223
|
return Ve.get(t);
|
224
224
|
const e = n.names.fullName.en, a = new FontFace(e, `url(${t})`);
|
@@ -226,8 +226,8 @@ const pn = /* @__PURE__ */ new Map(), Ra = /* @__PURE__ */ new Map(), Oa = /* @_
|
|
226
226
|
const r = a.load();
|
227
227
|
return Ve.set(t, r), r;
|
228
228
|
}
|
229
|
-
},
|
230
|
-
if (
|
229
|
+
}, bt = () => {
|
230
|
+
if (kt([typeof XMLSerializer]))
|
231
231
|
return new XMLSerializer();
|
232
232
|
const n = Xt();
|
233
233
|
return new n.XMLSerializer();
|
@@ -1808,7 +1808,7 @@ const Xr = (n) => new Promise((t) => {
|
|
1808
1808
|
"Black 5 C",
|
1809
1809
|
"Black 6 C",
|
1810
1810
|
"Black 7 C"
|
1811
|
-
],
|
1811
|
+
], Dt = [
|
1812
1812
|
"FEDD00",
|
1813
1813
|
"FFD700",
|
1814
1814
|
"FE5000",
|
@@ -3150,17 +3150,17 @@ const Xr = (n) => new Promise((t) => {
|
|
3150
3150
|
"3E2B2E",
|
3151
3151
|
"101820",
|
3152
3152
|
"3D3935"
|
3153
|
-
], Ge =
|
3153
|
+
], Ge = Dt.map((n) => [
|
3154
3154
|
parseInt(n.substring(0, 2), 16),
|
3155
3155
|
parseInt(n.substring(2, 4), 16),
|
3156
3156
|
parseInt(n.substring(4, 6), 16)
|
3157
3157
|
]);
|
3158
3158
|
function jc(n) {
|
3159
3159
|
const t = Yt.indexOf(n);
|
3160
|
-
return t >= 0 ?
|
3160
|
+
return t >= 0 ? Dt[t] : "";
|
3161
3161
|
}
|
3162
3162
|
function ai(n) {
|
3163
|
-
const t =
|
3163
|
+
const t = Dt.indexOf(n);
|
3164
3164
|
return t >= 0 ? Yt[t] : "";
|
3165
3165
|
}
|
3166
3166
|
function Yc(n, t = 64) {
|
@@ -3172,16 +3172,16 @@ function Yc(n, t = 64) {
|
|
3172
3172
|
});
|
3173
3173
|
const i = parseInt(n.substring(0, 2), 16), s = parseInt(n.substring(2, 4), 16), o = parseInt(n.substring(4, 6), 16);
|
3174
3174
|
let l, c, d;
|
3175
|
-
for (let A = 0; A <
|
3175
|
+
for (let A = 0; A < Dt.length; A++) {
|
3176
3176
|
l = Ge[A][0], c = Ge[A][1], d = Ge[A][2];
|
3177
3177
|
const u = Math.sqrt(Math.pow(i - l, 2) + Math.pow(s - c, 2) + Math.pow(o - d, 2));
|
3178
3178
|
a.push(u);
|
3179
3179
|
}
|
3180
3180
|
for (let A = 0; A < a.length; A++)
|
3181
|
-
a[A] <= t && !e.some((u) => u.pms === Yt[A]) && e.push({ pms: Yt[A], hex:
|
3181
|
+
a[A] <= t && !e.some((u) => u.pms === Yt[A]) && e.push({ pms: Yt[A], hex: Dt[A], distance: a[A] });
|
3182
3182
|
return e.sort((A, u) => A.distance - u.distance);
|
3183
3183
|
}
|
3184
|
-
const ni = Yt.map((n, t) => ({ pms: n, hex:
|
3184
|
+
const ni = Yt.map((n, t) => ({ pms: n, hex: Dt[t] })), ri = new yr(ni, { keys: ["pms"] });
|
3185
3185
|
function Jc(n, t) {
|
3186
3186
|
return ri.search(n, t ? { limit: t } : void 0);
|
3187
3187
|
}
|
@@ -3238,8 +3238,8 @@ const le = (n) => {
|
|
3238
3238
|
"textPath",
|
3239
3239
|
"tref",
|
3240
3240
|
"tspan"
|
3241
|
-
], oi = ["fill", "stroke"],
|
3242
|
-
t(n), n.children.length > 0 && Array.from(n.children).forEach((e) =>
|
3241
|
+
], oi = ["fill", "stroke"], Ft = (n, t) => {
|
3242
|
+
t(n), n.children.length > 0 && Array.from(n.children).forEach((e) => Ft(e, t));
|
3243
3243
|
}, li = (n, t) => {
|
3244
3244
|
try {
|
3245
3245
|
return n.matches(t);
|
@@ -3249,7 +3249,7 @@ const le = (n) => {
|
|
3249
3249
|
}, wa = (n, t = !1) => {
|
3250
3250
|
!t && n.setAttribute("preserveAspectRatio", "none");
|
3251
3251
|
const e = [];
|
3252
|
-
|
3252
|
+
Ft(n, (a) => {
|
3253
3253
|
if (a.tagName === "script") {
|
3254
3254
|
a.remove();
|
3255
3255
|
return;
|
@@ -3275,7 +3275,7 @@ const le = (n) => {
|
|
3275
3275
|
}
|
3276
3276
|
}), i.length > 0 ? a.setAttribute("style", i.join(";")) : a.removeAttribute("style");
|
3277
3277
|
}
|
3278
|
-
}),
|
3278
|
+
}), Ft(n, (a) => {
|
3279
3279
|
e.forEach((r) => {
|
3280
3280
|
r.selectors?.forEach((i) => {
|
3281
3281
|
li(a, i) && r.declarations?.forEach((s) => {
|
@@ -3291,7 +3291,7 @@ const le = (n) => {
|
|
3291
3291
|
}, bn = (n) => dt().parseFromString(n, "image/svg+xml").firstElementChild, di = (n, t, e) => {
|
3292
3292
|
n.setAttribute("height", `${e}px`), n.setAttribute("width", `${t}px`);
|
3293
3293
|
}, In = (n, t, e) => {
|
3294
|
-
|
3294
|
+
Ft(n, (a) => {
|
3295
3295
|
const r = a.attributes.getNamedItem("fill");
|
3296
3296
|
r && r.value !== "none" && a.classList.forEach((s) => {
|
3297
3297
|
if (s.startsWith("spiff-fill")) {
|
@@ -3329,7 +3329,7 @@ const le = (n) => {
|
|
3329
3329
|
}
|
3330
3330
|
});
|
3331
3331
|
});
|
3332
|
-
}, Bn = (n) =>
|
3332
|
+
}, Bn = (n) => bt().serializeToString(n), ya = (n, t, e, a, r) => {
|
3333
3333
|
const i = bn(n);
|
3334
3334
|
if (!i)
|
3335
3335
|
throw new Error("Failed to read SVG.");
|
@@ -3348,7 +3348,7 @@ const le = (n) => {
|
|
3348
3348
|
throw new Error("Failed to read SVG.");
|
3349
3349
|
wa(e);
|
3350
3350
|
const a = {};
|
3351
|
-
|
3351
|
+
Ft(e, (s) => {
|
3352
3352
|
si.includes(s.tagName) && !s.attributes.getNamedItem("fill") && s.setAttribute("fill", "black");
|
3353
3353
|
const o = s.attributes.getNamedItem("fill");
|
3354
3354
|
if (o && o.value !== "none" && !o.value.startsWith("url(")) {
|
@@ -3361,7 +3361,7 @@ const le = (n) => {
|
|
3361
3361
|
s.classList.add(A), s.setAttribute("stroke", c.browserValue), a[d] = c;
|
3362
3362
|
}
|
3363
3363
|
});
|
3364
|
-
const i =
|
3364
|
+
const i = bt().serializeToString(e);
|
3365
3365
|
return {
|
3366
3366
|
colors: a,
|
3367
3367
|
svg: i
|
@@ -3660,9 +3660,9 @@ class wi {
|
|
3660
3660
|
async postProcessFileUpload(t, e) {
|
3661
3661
|
if (e === "image/svg+xml") {
|
3662
3662
|
const a = await t.blob.text(), s = new window.DOMParser().parseFromString(a, "image/svg+xml").documentElement;
|
3663
|
-
if (!s) throw new
|
3663
|
+
if (!s) throw new Bt("Failed to read SVG.");
|
3664
3664
|
ci(s);
|
3665
|
-
const l =
|
3665
|
+
const l = bt().serializeToString(s);
|
3666
3666
|
return {
|
3667
3667
|
name: t.name,
|
3668
3668
|
blob: new Blob([l], { type: "image/svg+xml" })
|
@@ -5456,7 +5456,7 @@ const M = () => {
|
|
5456
5456
|
}), nd = (n, t, e, a) => ({
|
5457
5457
|
x: n.x + (t?.x + t?.width) * e,
|
5458
5458
|
y: n.y + (t?.y + t?.height) * a
|
5459
|
-
}),
|
5459
|
+
}), It = (n) => {
|
5460
5460
|
switch (n) {
|
5461
5461
|
case W.North:
|
5462
5462
|
return W.East;
|
@@ -5475,7 +5475,7 @@ const M = () => {
|
|
5475
5475
|
case W.Southwest:
|
5476
5476
|
return W.Northwest;
|
5477
5477
|
}
|
5478
|
-
}, rd = (n, t) => t > 45 && t <= 135 ?
|
5478
|
+
}, rd = (n, t) => t > 45 && t <= 135 ? It(n) : t > 135 && t <= 225 ? It(It(n)) : t > 225 && t <= 315 ? It(It(It(n))) : n, id = (n, t = { x: 0, y: 0 }, e = { x: 1, y: 1 }) => {
|
5479
5479
|
const a = ft(n.rotation), r = {
|
5480
5480
|
x: t.x + n.x * e.x,
|
5481
5481
|
y: t.x + n.y * e.y
|
@@ -5699,7 +5699,7 @@ class as {
|
|
5699
5699
|
}), a - r;
|
5700
5700
|
}
|
5701
5701
|
}
|
5702
|
-
const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @__PURE__ */ new Map(),
|
5702
|
+
const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @__PURE__ */ new Map(), Mt = async (n) => {
|
5703
5703
|
if (We.has(n))
|
5704
5704
|
return We.get(n);
|
5705
5705
|
const e = (async () => {
|
@@ -5741,7 +5741,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5741
5741
|
});
|
5742
5742
|
const s = e.querySelectorAll("tspan");
|
5743
5743
|
for (let d = 0; d < s.length; d++) {
|
5744
|
-
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await
|
5744
|
+
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await Mt(r.get(m)), g = u.getAttribute("fill"), f = u.getAttribute("stroke"), C = u.getAttribute("stroke-width"), I = p.getPath(
|
5745
5745
|
A.innerHTML,
|
5746
5746
|
0,
|
5747
5747
|
0,
|
@@ -5760,7 +5760,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5760
5760
|
const b = B.toSVG(2), R = t.parseFromString(b, "image/svg+xml").firstElementChild;
|
5761
5761
|
h.appendChild(R);
|
5762
5762
|
}
|
5763
|
-
return e.querySelectorAll("text").forEach((d) => d.remove()),
|
5763
|
+
return e.querySelectorAll("text").forEach((d) => d.remove()), bt().serializeToString(a);
|
5764
5764
|
}, Pe = (n, t, e, a) => Math.max(ls(n.join(`
|
5765
5765
|
`), e, a), t), za = (n, t, e, a, r, i) => {
|
5766
5766
|
const s = (i || Ln) * r.getApproximateHeight(), o = t.split(`
|
@@ -5877,7 +5877,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5877
5877
|
}, cs = (n, t) => n.map((e, a) => [e, t[a]]), ds = (n = "center", t = !1) => t ? "center" : n, Un = (n) => n === "left" ? "start" : n === "right" ? "end" : "middle", ae = (n, t, e) => n.fontData ? {
|
5878
5878
|
...n,
|
5879
5879
|
...(() => {
|
5880
|
-
if (n.algorithm ===
|
5880
|
+
if (n.algorithm === xt.Traditional) {
|
5881
5881
|
const r = ss(t, n, e, n.lineHeight);
|
5882
5882
|
return {
|
5883
5883
|
text: r.lines.join(`
|
@@ -5893,7 +5893,7 @@ const ns = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5893
5893
|
};
|
5894
5894
|
})()
|
5895
5895
|
} : n, Ln = 1.1;
|
5896
|
-
function
|
5896
|
+
function Pt(n, t) {
|
5897
5897
|
return Vn(n, t.getTemplatingContext());
|
5898
5898
|
}
|
5899
5899
|
function Vn(n, t) {
|
@@ -6333,7 +6333,7 @@ const ne = (n) => {
|
|
6333
6333
|
const s = dt().parseFromString(n, "image/svg+xml").firstElementChild;
|
6334
6334
|
if (!s)
|
6335
6335
|
throw new Error("Failed to read SVG");
|
6336
|
-
const l =
|
6336
|
+
const l = bt().serializeToString(s), c = pt(), d = c.getContext("2d"), A = await ma.from(d, l, {
|
6337
6337
|
anonymousCrossOrigin: !0,
|
6338
6338
|
ignoreDimensions: !1,
|
6339
6339
|
createCanvas: pt,
|
@@ -6374,7 +6374,7 @@ const ne = (n) => {
|
|
6374
6374
|
o.height = o.width / A, o.top += (l - o.height) / 2;
|
6375
6375
|
}
|
6376
6376
|
if (e && t === x.Textbox && a?.text && a?.fontScale) {
|
6377
|
-
await
|
6377
|
+
await Mt(e);
|
6378
6378
|
const l = Ct(e), c = mt(a.text, a?.fontScale, l);
|
6379
6379
|
o.width = Math.min(c, r.width * 0.85), o.left = r.x + r.width / 2 - o.width / 2;
|
6380
6380
|
}
|
@@ -6425,7 +6425,7 @@ class cd {
|
|
6425
6425
|
};
|
6426
6426
|
}
|
6427
6427
|
static async getTextbox(t, e) {
|
6428
|
-
const { configuration: a, fontSrc: r, designInputStep: i } = e, s = await
|
6428
|
+
const { configuration: a, fontSrc: r, designInputStep: i } = e, s = await Mt(r), o = {
|
6429
6429
|
assetUrl: r,
|
6430
6430
|
name: s.names.fullName.en
|
6431
6431
|
}, l = i?.text || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = De(c, {
|
@@ -6452,7 +6452,7 @@ class cd {
|
|
6452
6452
|
rotation: A.rotation,
|
6453
6453
|
vertical: a.vertical,
|
6454
6454
|
verticalAlign: a.verticalAlign || "middle",
|
6455
|
-
algorithm:
|
6455
|
+
algorithm: xt.Traditional,
|
6456
6456
|
fontSize: a.size || Math.max(Math.round(A.height * 0.025), 1),
|
6457
6457
|
text: d,
|
6458
6458
|
input: l
|
@@ -6598,7 +6598,7 @@ const U = (n, t) => J(n, t).elements.find((r) => r.id === n), J = (n, t) => {
|
|
6598
6598
|
);
|
6599
6599
|
for (let s = 0; s < i.length; ++s) {
|
6600
6600
|
const o = i[s];
|
6601
|
-
o.fontData?.assetUrl && await
|
6601
|
+
o.fontData?.assetUrl && await Mt(o.fontData.assetUrl);
|
6602
6602
|
}
|
6603
6603
|
}
|
6604
6604
|
};
|
@@ -6686,7 +6686,7 @@ class ud extends Q {
|
|
6686
6686
|
const s = a;
|
6687
6687
|
s.scaleX = s.scaleX * this.width / e.width, s.scaleY = s.scaleY * this.height / e.height;
|
6688
6688
|
} else if (e.type === "textbox") {
|
6689
|
-
const s = a, o = (!s.algorithm || s.algorithm ===
|
6689
|
+
const s = a, o = (!s.algorithm || s.algorithm === xt.Autosize ? s.text : s.input) ?? "";
|
6690
6690
|
a = ae(s, o, e);
|
6691
6691
|
}
|
6692
6692
|
const r = J(e.id, Object.values(t.layouts)), i = _(a, r);
|
@@ -6784,7 +6784,7 @@ class z extends Q {
|
|
6784
6784
|
return a !== void 0 ? a + 1 : 0;
|
6785
6785
|
}
|
6786
6786
|
}
|
6787
|
-
class
|
6787
|
+
class Tt extends Q {
|
6788
6788
|
constructor(t) {
|
6789
6789
|
super(), this.id = t;
|
6790
6790
|
}
|
@@ -6864,7 +6864,7 @@ class Cs extends Q {
|
|
6864
6864
|
const a = {
|
6865
6865
|
...e,
|
6866
6866
|
fontSize: this.size
|
6867
|
-
}, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm ===
|
6867
|
+
}, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === xt.Autosize ? e.text : e.input) ?? "", s = _(ae(a, i), r);
|
6868
6868
|
return {
|
6869
6869
|
...t,
|
6870
6870
|
layouts: {
|
@@ -6886,7 +6886,7 @@ class ja extends Q {
|
|
6886
6886
|
const a = {
|
6887
6887
|
...e,
|
6888
6888
|
fontData: this.fontData
|
6889
|
-
}, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm ===
|
6889
|
+
}, r = J(e.id, Object.values(t.layouts)), i = (!e.algorithm || e.algorithm === xt.Autosize ? e.text : e.input) ?? "", s = _(ae(a, i), r);
|
6890
6890
|
return {
|
6891
6891
|
...t,
|
6892
6892
|
layouts: {
|
@@ -7387,7 +7387,7 @@ class Is {
|
|
7387
7387
|
40
|
7388
7388
|
);
|
7389
7389
|
});
|
7390
|
-
t.forEach((h) => a.getCommandDispatcher()(new
|
7390
|
+
t.forEach((h) => a.getCommandDispatcher()(new Tt(h.id)));
|
7391
7391
|
const o = r.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", l = new URL(o + r.data.baseUrl);
|
7392
7392
|
l.searchParams.append("video", btoa(JSON.stringify([s]))), l.pathname = l.pathname + (l.pathname.slice(-1) === "/" ? "" : "/");
|
7393
7393
|
const c = l.toString();
|
@@ -7712,7 +7712,7 @@ class Fe {
|
|
7712
7712
|
i && i(!0);
|
7713
7713
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
7714
7714
|
t.data.regions.map(async (h, m) => {
|
7715
|
-
const p = await $e(l[m]), g = o.getImageData(), f = a.map((B) => new
|
7715
|
+
const p = await $e(l[m]), g = o.getImageData(), f = a.map((B) => new Tt(B.id)), C = g ? Ia(
|
7716
7716
|
g,
|
7717
7717
|
p,
|
7718
7718
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
@@ -7960,7 +7960,7 @@ class Bs {
|
|
7960
7960
|
if (!t.data || !t.data.regions)
|
7961
7961
|
throw new Ie(t, "Missing regions.");
|
7962
7962
|
r(!0);
|
7963
|
-
const s = a.map((f) => new
|
7963
|
+
const s = a.map((f) => new Tt(f.id));
|
7964
7964
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
7965
7965
|
const o = e.asset;
|
7966
7966
|
if (!o)
|
@@ -8231,7 +8231,7 @@ class Fs {
|
|
8231
8231
|
if (!p)
|
8232
8232
|
return console.error(`Can not find layout for region: ${A.panelId}`), null;
|
8233
8233
|
const g = [];
|
8234
|
-
return u && g.push(new
|
8234
|
+
return u && g.push(new Tt(h)), g.push(
|
8235
8235
|
new z(
|
8236
8236
|
{
|
8237
8237
|
stepRegion: A,
|
@@ -8352,7 +8352,7 @@ class xs {
|
|
8352
8352
|
if (!s)
|
8353
8353
|
return console.error("No URL for picture!"), null;
|
8354
8354
|
r(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
|
8355
|
-
const l = a.getRegionElements(t.stepName).map((A) => new
|
8355
|
+
const l = a.getRegionElements(t.stepName).map((A) => new Tt(A.id)), c = (A) => {
|
8356
8356
|
const h = a.getLayouts().find((p) => p.panelId === A.panelId);
|
8357
8357
|
if (!h)
|
8358
8358
|
throw new H(A);
|
@@ -8913,7 +8913,7 @@ class Rs {
|
|
8913
8913
|
});
|
8914
8914
|
}
|
8915
8915
|
updateInputText(t, e, a, r) {
|
8916
|
-
const i = r.getStepStorage(a.stepName), s =
|
8916
|
+
const i = r.getStepStorage(a.stepName), s = Pt(t, r), o = this.getProcessedInput(s, a.data, i?.customiseAllText ?? !1), l = {
|
8917
8917
|
command: void 0,
|
8918
8918
|
helperData: {},
|
8919
8919
|
errorData: this.getErrorsForText(t, o, a, r)
|
@@ -9085,7 +9085,7 @@ class Rs {
|
|
9085
9085
|
const a = e.fileLink;
|
9086
9086
|
if (!a)
|
9087
9087
|
throw new jt(e);
|
9088
|
-
const r = await
|
9088
|
+
const r = await Mt(a);
|
9089
9089
|
return {
|
9090
9090
|
assetUrl: a,
|
9091
9091
|
name: r.names.fullName.en
|
@@ -9172,7 +9172,7 @@ class Rs {
|
|
9172
9172
|
async createTextboxRegions(t, e, a, r, i, s) {
|
9173
9173
|
if (!a || !a.regions)
|
9174
9174
|
throw new Error("Step data not supplied");
|
9175
|
-
const o = i.text || a.defaultText || "", l =
|
9175
|
+
const o = i.text || a.defaultText || "", l = Pt(o, s), c = this.getProcessedInput(l, a, !1), d = async (u) => {
|
9176
9176
|
const m = s.getLayouts().find((g) => g.panelId === u.panelId), p = M();
|
9177
9177
|
try {
|
9178
9178
|
if (!m)
|
@@ -9269,7 +9269,7 @@ class Rs {
|
|
9269
9269
|
* @deprecated
|
9270
9270
|
*/
|
9271
9271
|
async changeInputTextWithRegion(t, e, a, r, i, s, o, l, c, d) {
|
9272
|
-
const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u =
|
9272
|
+
const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = Pt(A, s), h = this.getProcessedInput(u, t.data, o), m = s.getRegionElements(t.stepName), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
9273
9273
|
for (const y of m)
|
9274
9274
|
if (y.region) {
|
9275
9275
|
const [S, B] = Ce(
|
@@ -9397,7 +9397,7 @@ class Ws {
|
|
9397
9397
|
u = (A * 100 | 0) / 100;
|
9398
9398
|
break;
|
9399
9399
|
default:
|
9400
|
-
throw new
|
9400
|
+
throw new Bt("Failed to encode path.");
|
9401
9401
|
}
|
9402
9402
|
l || s.push(" "), s.push(u), l = !1;
|
9403
9403
|
}
|
@@ -9411,12 +9411,12 @@ class Ws {
|
|
9411
9411
|
for (e.lastIndex = 0; i = e.exec(t); ) {
|
9412
9412
|
const s = i[1].toLowerCase(), o = (i[2].match(a) || []).map(parseFloat), l = s === i[1], c = Ja[s];
|
9413
9413
|
if (o.length < c.length)
|
9414
|
-
throw new
|
9414
|
+
throw new Bt(
|
9415
9415
|
`Path type "${s}" given ${o.length} arguments, expected ${c.length}.`
|
9416
9416
|
);
|
9417
9417
|
if (c.length > 0) {
|
9418
9418
|
if (o.length % c.length !== 0)
|
9419
|
-
throw new
|
9419
|
+
throw new Bt(
|
9420
9420
|
`Path type "${s}" given ${o.length} arguments, not divisible by ${c.length}`
|
9421
9421
|
);
|
9422
9422
|
for (let d = 0; d < o.length / c.length; d++) {
|
@@ -9441,7 +9441,7 @@ class Ws {
|
|
9441
9441
|
if (o in i && l in i) {
|
9442
9442
|
const c = [i[o], i[l]], d = e(c);
|
9443
9443
|
if (d.length < 2)
|
9444
|
-
throw new
|
9444
|
+
throw new Bt("Transformer must return at least 2 points.");
|
9445
9445
|
i[o] = d[0], i[l] = d[1];
|
9446
9446
|
}
|
9447
9447
|
}
|
@@ -9625,7 +9625,7 @@ const Hs = [
|
|
9625
9625
|
return console.error("Failed to read SVG."), [];
|
9626
9626
|
wa(m);
|
9627
9627
|
const p = {};
|
9628
|
-
|
9628
|
+
Ft(m, (y) => {
|
9629
9629
|
Hs.includes(y.tagName) && !y.attributes.getNamedItem("fill") && y.setAttribute("fill", "#000000");
|
9630
9630
|
const S = y.attributes.getNamedItem("fill");
|
9631
9631
|
if (S && S.value !== "none") {
|
@@ -9638,7 +9638,7 @@ const Hs = [
|
|
9638
9638
|
y.classList.add(R), p[R] = { browserValue: b };
|
9639
9639
|
}
|
9640
9640
|
});
|
9641
|
-
const f =
|
9641
|
+
const f = bt().serializeToString(m), C = r.colors;
|
9642
9642
|
if (C) {
|
9643
9643
|
for (const [y, S] of Object.entries(p))
|
9644
9644
|
for (const B of Object.keys(C))
|
@@ -9836,8 +9836,8 @@ const Hs = [
|
|
9836
9836
|
const c = await at(i, !0), d = (A) => {
|
9837
9837
|
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
|
9838
9838
|
if (!f)
|
9839
|
-
throw new
|
9840
|
-
return wa(f),
|
9839
|
+
throw new Bt("Failed to read SVG.");
|
9840
|
+
return wa(f), bt().serializeToString(f);
|
9841
9841
|
};
|
9842
9842
|
l.forEach((A) => {
|
9843
9843
|
const u = n.find((m) => m.panelId === A.panelId);
|
@@ -9882,7 +9882,7 @@ const Hs = [
|
|
9882
9882
|
const g = l();
|
9883
9883
|
if (!g)
|
9884
9884
|
return;
|
9885
|
-
const f = await
|
9885
|
+
const f = await Mt(g);
|
9886
9886
|
return {
|
9887
9887
|
assetUrl: g,
|
9888
9888
|
name: f.names.fullName.en
|
@@ -10970,7 +10970,7 @@ class Go {
|
|
10970
10970
|
this.workflowStatePromiseQueue = new Nn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.setWorkflow = async (u) => {
|
10971
10971
|
this.reloadedState ? this.layouts = Object.values(this.reloadedState.layouts || {}).map((h) => h.layout) : u ? this.layouts = zo(this.experience.getTransaction(), u) : this.layouts = [], this.commandContext.initialize(this.layouts, this.reloadedState), this.renderableContextService = new no(this.layouts), this.renderableContextService.setWorkflowManager(this), u.steps.forEach((h) => {
|
10972
10972
|
this.stepTags[h.stepName] = h.tags ?? [];
|
10973
|
-
}), this.initializationPromise = this.initializeDefaultWorkflowState(u), this.initializationPromise.then(() => {
|
10973
|
+
}), this.reset(), this.initializationPromise = this.initializeDefaultWorkflowState(u), this.initializationPromise.then(() => {
|
10974
10974
|
this.initialized = !0;
|
10975
10975
|
}), this.initializationPromise.catch((h) => {
|
10976
10976
|
throw console.error(h), this.initialized = !1, new Error("Workflow initialization failed due to an error. See console.");
|
@@ -11552,11 +11552,7 @@ class Go {
|
|
11552
11552
|
});
|
11553
11553
|
}
|
11554
11554
|
async reset() {
|
11555
|
-
this.
|
11556
|
-
(e) => e.layoutState.elements.forEach((a) => {
|
11557
|
-
this.getCommandDispatcher()(new bt(a.id));
|
11558
|
-
})
|
11559
|
-
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
11555
|
+
this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
11560
11556
|
}
|
11561
11557
|
async setSelectionsAndElements(t, e, a, r) {
|
11562
11558
|
const i = this.experience.getWorkflow();
|
@@ -11582,7 +11578,7 @@ class Go {
|
|
11582
11578
|
}, this.removeElements(h);
|
11583
11579
|
const g = i.steps.find((S) => S.stepName === t);
|
11584
11580
|
g?.type === E.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((B) => B.id));
|
11585
|
-
const f = h.map((S) => new
|
11581
|
+
const f = h.map((S) => new Tt(S.id)), C = new Ha(this.constructSerializableWorkflow()), I = [...p, ...f, C];
|
11586
11582
|
I.length > 0 && this.commandContext.apply(new O(I), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
11587
11583
|
const P = this.getInvalidModelVariants(), y = this.modelContainer;
|
11588
11584
|
if (y) {
|
@@ -12208,7 +12204,7 @@ class Ko extends X {
|
|
12208
12204
|
const e = {
|
12209
12205
|
input: t,
|
12210
12206
|
helperData: {}
|
12211
|
-
}, a = G.findLayoutElements(this.manager, this.step), r = G.filterUnsupportedCharacters(t, a[0]?.fontData), i =
|
12207
|
+
}, a = G.findLayoutElements(this.manager, this.step), r = G.filterUnsupportedCharacters(t, a[0]?.fontData), i = Pt(r, this.manager).length, s = !!this.step.data && !!this.step.data.maxLength && i > this.step.data.maxLength;
|
12212
12208
|
s || (e.input = r);
|
12213
12209
|
const o = a.length <= 0, l = o ? { inputText: r, text: r } : { inputText: r };
|
12214
12210
|
this.manager.updateStorage(this.step.stepName, l);
|
@@ -12284,7 +12280,7 @@ class Ko extends X {
|
|
12284
12280
|
const t = this.step.data.maxLength;
|
12285
12281
|
if (t === void 0)
|
12286
12282
|
return;
|
12287
|
-
const e =
|
12283
|
+
const e = Pt(this.getText(), this.manager);
|
12288
12284
|
return t - e.length;
|
12289
12285
|
}
|
12290
12286
|
setCustomColor(t) {
|
@@ -12365,7 +12361,7 @@ class Zo extends X {
|
|
12365
12361
|
const t = this.step.data.maxLength;
|
12366
12362
|
if (t === void 0)
|
12367
12363
|
return;
|
12368
|
-
const e =
|
12364
|
+
const e = Pt(this.getText(), this.manager);
|
12369
12365
|
return t - e.length;
|
12370
12366
|
}
|
12371
12367
|
/**
|
@@ -13091,7 +13087,7 @@ class hl {
|
|
13091
13087
|
return this.workflow;
|
13092
13088
|
}
|
13093
13089
|
async setWorkflow(t) {
|
13094
|
-
this.
|
13090
|
+
this.workflow = t, await this.workflowManager.setWorkflow(t);
|
13095
13091
|
}
|
13096
13092
|
async attachAddress(t, e, a, r, i, s) {
|
13097
13093
|
await this.graphQlClient().mutate({
|
@@ -16135,7 +16131,7 @@ class bd {
|
|
16135
16131
|
} catch (a) {
|
16136
16132
|
throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
|
16137
16133
|
}
|
16138
|
-
}, this.options = t, this.options.applicationKey && qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.4.0-beta.
|
16134
|
+
}, this.options = t, this.options.applicationKey && qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.4.0-beta.31f8a4dd-4f9f-572b-8792-9d8d6243c25e"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
16139
16135
|
}
|
16140
16136
|
configure(t) {
|
16141
16137
|
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 && jr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Ut.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
@@ -17848,7 +17844,7 @@ export {
|
|
17848
17844
|
Hn as CreateLayoutCommand,
|
17849
17845
|
Hl as CurrencyContext,
|
17850
17846
|
ql as CurrencyService,
|
17851
|
-
|
17847
|
+
Tt as DeleteElementCommand,
|
17852
17848
|
Xo as DigitalContentStepHandle,
|
17853
17849
|
fl as FileUploadGlobalPropertyHandle,
|
17854
17850
|
he as FlowExecutionNodeResult,
|
@@ -17882,7 +17878,7 @@ export {
|
|
17882
17878
|
Ul as ObjectInputType,
|
17883
17879
|
rr as OptionGlobalPropertyHandle,
|
17884
17880
|
be as OptionNotFoundError,
|
17885
|
-
|
17881
|
+
Bt as ParseError,
|
17886
17882
|
jo as PictureStepHandle,
|
17887
17883
|
Mr as ProductCameraRig,
|
17888
17884
|
sr as ProductCollection,
|
@@ -17904,7 +17900,7 @@ export {
|
|
17904
17900
|
Dr as StepAspectType,
|
17905
17901
|
X as StepHandle,
|
17906
17902
|
E as StepType,
|
17907
|
-
|
17903
|
+
xt as TextAlgorithm,
|
17908
17904
|
vs as TextChangeCommand,
|
17909
17905
|
Cl as TextGlobalPropertyHandle,
|
17910
17906
|
vd as TextInput,
|
@@ -17972,7 +17968,7 @@ export {
|
|
17972
17968
|
v as graphQlManager,
|
17973
17969
|
fe as illustrationStepService,
|
17974
17970
|
Xc as isCloseToValue,
|
17975
|
-
|
17971
|
+
Mt as loadFont,
|
17976
17972
|
Yc as matchHexToPms,
|
17977
17973
|
Jn as materialStepService,
|
17978
17974
|
Pl as metafieldManager,
|
@@ -18009,6 +18005,6 @@ export {
|
|
18009
18005
|
Ns as toast,
|
18010
18006
|
Wd as validateWorkflowExperienceRecipient,
|
18011
18007
|
qd as validateWorkflowExperienceRecipients,
|
18012
|
-
|
18008
|
+
bt as xmlSerializer
|
18013
18009
|
};
|
18014
18010
|
//# sourceMappingURL=index.mjs.map
|