@spiffcommerce/core 26.41.1-beta.27edcea8-a794-5873-ba48-38f5bed94c71 → 26.41.1-beta.438429d5-5f9e-5e1d-a155-533cd98103a3
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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +233 -231
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { split as Ze } from "unicode-default-word-boundary";
|
|
|
20
20
|
import cn from "lodash.debounce";
|
|
21
21
|
import "fs";
|
|
22
22
|
import "path";
|
|
23
|
-
var fe = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(fe || {}), et = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(et || {}), P = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(P || {}), wr = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(wr || {}), Wt = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(Wt || {}), T = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(T || {}), yr = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(yr || {}), Sr = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Sr || {}),
|
|
23
|
+
var fe = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(fe || {}), et = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(et || {}), P = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(P || {}), wr = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(wr || {}), Wt = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(Wt || {}), T = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(T || {}), yr = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(yr || {}), Sr = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Sr || {}), Er = /* @__PURE__ */ ((r) => (r.Hub = "Hub", r.Shopify = "Shopify", r))(Er || {}), ha = /* @__PURE__ */ ((r) => (r.BackgroundRemover = "BackgroundRemover", r.ConversionAccelerator = "Conversion Accelerator", r.ProcessBuilder = "ProcessBuilder", r))(ha || {}), vr = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(vr || {}), Ce = /* @__PURE__ */ ((r) => (r.Owner = "Owner", r.Approver = "Approver", r.Editor = "Editor", r.Viewer = "Viewer", r))(Ce || {}), Mt = /* @__PURE__ */ ((r) => (r.Autosize = "Autosize", r.Traditional = "Traditional", r))(Mt || {}), j = /* @__PURE__ */ ((r) => (r[r.North = 0] = "North", r[r.Northeast = 1] = "Northeast", r[r.East = 2] = "East", r[r.Southeast = 3] = "Southeast", r[r.South = 4] = "South", r[r.Southwest = 5] = "Southwest", r[r.West = 6] = "West", r[r.Northwest = 7] = "Northwest", r))(j || {}), Br = /* @__PURE__ */ ((r) => (r.Pixel = "px", r.Millimeter = "mm", r.Centimeter = "cm", r))(Br || {});
|
|
24
24
|
class dn extends Error {
|
|
25
25
|
constructor(t) {
|
|
26
26
|
super(t), this.name = this.constructor.name;
|
|
@@ -41,7 +41,7 @@ class q extends Jt {
|
|
|
41
41
|
super(`Panel not Found: ${t.panelId}`), this.panelId = (t == null ? void 0 : t.panelId) || "N/A";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
class
|
|
44
|
+
class Et extends Jt {
|
|
45
45
|
constructor(t) {
|
|
46
46
|
super(`Asset not found for variant: ${t.name}`), this.variant = t;
|
|
47
47
|
}
|
|
@@ -162,7 +162,7 @@ let ta, ea;
|
|
|
162
162
|
function Sc(r) {
|
|
163
163
|
ta = r;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Ec(r) {
|
|
166
166
|
ea = r;
|
|
167
167
|
}
|
|
168
168
|
function Kt() {
|
|
@@ -257,7 +257,7 @@ const An = /* @__PURE__ */ new Map(), Ta = /* @__PURE__ */ new Map(), Na = /* @_
|
|
|
257
257
|
}
|
|
258
258
|
const e = t();
|
|
259
259
|
return e || "image/svg+xml";
|
|
260
|
-
},
|
|
260
|
+
}, vc = async (r) => {
|
|
261
261
|
const t = await un(r), e = An.get(r) || xe(t);
|
|
262
262
|
return await Nr(new Blob([t], { type: e }));
|
|
263
263
|
}, Mr = (r) => {
|
|
@@ -347,8 +347,8 @@ class Vr {
|
|
|
347
347
|
const f = window.__SENTRY__.hub;
|
|
348
348
|
if (f) {
|
|
349
349
|
const C = f.traceHeaders();
|
|
350
|
-
Object.entries(C).forEach(([w,
|
|
351
|
-
l[w] =
|
|
350
|
+
Object.entries(C).forEach(([w, E]) => {
|
|
351
|
+
l[w] = E;
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
354
|
}
|
|
@@ -3340,16 +3340,16 @@ const se = (r) => {
|
|
|
3340
3340
|
}
|
|
3341
3341
|
});
|
|
3342
3342
|
});
|
|
3343
|
-
},
|
|
3343
|
+
}, En = (r) => bt().serializeToString(r), Ca = (r, t, e, a, n) => {
|
|
3344
3344
|
const i = yn(r);
|
|
3345
3345
|
if (!i)
|
|
3346
3346
|
throw new Error("Failed to read SVG.");
|
|
3347
|
-
return ti(i, t, e), Sn(i, a, n),
|
|
3347
|
+
return ti(i, t, e), Sn(i, a, n), En(i);
|
|
3348
3348
|
}, wa = (r, t, e) => {
|
|
3349
3349
|
const a = yn(r);
|
|
3350
3350
|
if (!a)
|
|
3351
3351
|
throw new Error("Failed to read SVG.");
|
|
3352
|
-
return Sn(a, t, e),
|
|
3352
|
+
return Sn(a, t, e), En(a);
|
|
3353
3353
|
}, ei = (r) => {
|
|
3354
3354
|
const t = /<svg.*<\/svg>/s, e = r.match(t) || [], a = (e == null ? void 0 : e.length) > 0 ? e[0] : "";
|
|
3355
3355
|
return dt().parseFromString(a, "image/svg+xml");
|
|
@@ -3716,7 +3716,7 @@ class ci {
|
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
|
-
const Rt = "persistentAssets",
|
|
3719
|
+
const Rt = "persistentAssets", vn = class Ct {
|
|
3720
3720
|
/**
|
|
3721
3721
|
* Add a new asset to persistence
|
|
3722
3722
|
* @param asset The asset to add.
|
|
@@ -3767,8 +3767,8 @@ const Rt = "persistentAssets", En = class Ct {
|
|
|
3767
3767
|
Ct.callbacks.forEach((t) => t());
|
|
3768
3768
|
}
|
|
3769
3769
|
};
|
|
3770
|
-
|
|
3771
|
-
let It =
|
|
3770
|
+
vn.callbacks = [];
|
|
3771
|
+
let It = vn;
|
|
3772
3772
|
const Ua = "bgrmPersistentAssets";
|
|
3773
3773
|
class Y {
|
|
3774
3774
|
static has(t) {
|
|
@@ -4423,14 +4423,14 @@ const _ = new gi(), bn = y`
|
|
|
4423
4423
|
` : ""}
|
|
4424
4424
|
}
|
|
4425
4425
|
}
|
|
4426
|
-
`,
|
|
4426
|
+
`, Ei = (r) => y`
|
|
4427
4427
|
${Fn(r)}
|
|
4428
4428
|
query GetIntegrationProducts($ids: [String!]!) {
|
|
4429
4429
|
integrationProducts(ids: $ids) {
|
|
4430
4430
|
...IntegrationProductFields
|
|
4431
4431
|
}
|
|
4432
4432
|
}
|
|
4433
|
-
`,
|
|
4433
|
+
`, vi = (r) => y`
|
|
4434
4434
|
${Fn(r)}
|
|
4435
4435
|
query GetIntegrationProductFromExternalIds($externalIntegrationId: String!, $externalProductId: String!) {
|
|
4436
4436
|
integrationProductFromExternalIds(
|
|
@@ -5320,14 +5320,14 @@ const Q = () => {
|
|
|
5320
5320
|
width: u
|
|
5321
5321
|
}) => {
|
|
5322
5322
|
var B;
|
|
5323
|
-
const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = Q(), C = a.purpose === Wt.FreeDesign && /* @__PURE__ */ x("defs", { children: /* @__PURE__ */ x("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ x("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (B = a.colorProfiles) == null ? void 0 : B.map((
|
|
5323
|
+
const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = Q(), C = a.purpose === Wt.FreeDesign && /* @__PURE__ */ x("defs", { children: /* @__PURE__ */ x("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ x("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (B = a.colorProfiles) == null ? void 0 : B.map((v, I) => (
|
|
5324
5324
|
/* @ts-ignore */
|
|
5325
|
-
/* @__PURE__ */ x("color-profile", { name:
|
|
5326
|
-
)),
|
|
5327
|
-
...
|
|
5325
|
+
/* @__PURE__ */ x("color-profile", { name: v.name, xlinkHref: v.key, children: " " }, I)
|
|
5326
|
+
)), E = n.map((v) => ({
|
|
5327
|
+
...v,
|
|
5328
5328
|
_renderingConfiguration: a,
|
|
5329
5329
|
mask: l ? `url(#viewmask-${f})` : void 0
|
|
5330
|
-
})), S =
|
|
5330
|
+
})), S = va(E);
|
|
5331
5331
|
return /* @__PURE__ */ ct(
|
|
5332
5332
|
"svg",
|
|
5333
5333
|
{
|
|
@@ -5364,7 +5364,7 @@ const Q = () => {
|
|
|
5364
5364
|
{
|
|
5365
5365
|
id: "element-group",
|
|
5366
5366
|
clipPath: a.purpose === Wt.FreeDesign ? "url(#viewboxClip)" : void 0,
|
|
5367
|
-
children: S.map((
|
|
5367
|
+
children: S.map((v) => On(v)).filter((v) => !!v)
|
|
5368
5368
|
}
|
|
5369
5369
|
),
|
|
5370
5370
|
l && /* @__PURE__ */ x(
|
|
@@ -5406,10 +5406,10 @@ const Q = () => {
|
|
|
5406
5406
|
}
|
|
5407
5407
|
);
|
|
5408
5408
|
}, Pc = (r, t, e, a, n) => {
|
|
5409
|
-
const i = pt(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, C = u * d + m * A, w = h * d + g * A,
|
|
5409
|
+
const i = pt(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, C = u * d + m * A, w = h * d + g * A, E = Math.max(Math.abs(p), Math.abs(f)), S = Math.max(Math.abs(C), Math.abs(w));
|
|
5410
5410
|
return {
|
|
5411
|
-
minX: l -
|
|
5412
|
-
maxX: l +
|
|
5411
|
+
minX: l - E,
|
|
5412
|
+
maxX: l + E,
|
|
5413
5413
|
minY: c - S,
|
|
5414
5414
|
maxY: c + S
|
|
5415
5415
|
};
|
|
@@ -5507,7 +5507,7 @@ const Q = () => {
|
|
|
5507
5507
|
) });
|
|
5508
5508
|
}, Tn = (r) => {
|
|
5509
5509
|
var l;
|
|
5510
|
-
const t = `spiff-group-clip-${r.id}`, e = r.rotation || 0, a = pt(e), n = Math.cos(a), i = -Math.sin(a), s =
|
|
5510
|
+
const t = `spiff-group-clip-${r.id}`, e = r.rotation || 0, a = pt(e), n = Math.cos(a), i = -Math.sin(a), s = va(r.children);
|
|
5511
5511
|
return /* @__PURE__ */ ct(zt, { children: [
|
|
5512
5512
|
/* @__PURE__ */ x("defs", { children: (() => /* @__PURE__ */ x("clipPath", { id: t, preserveAspectRatio: "none", children: r.clipPath ? /* @__PURE__ */ x("path", { d: r.clipPath }) : /* @__PURE__ */ x("rect", { x: 0, y: 0, width: r.width, height: r.height }) }))() }),
|
|
5513
5513
|
/* @__PURE__ */ ct(
|
|
@@ -5569,8 +5569,8 @@ const Q = () => {
|
|
|
5569
5569
|
/* @__PURE__ */ x("feFuncB", { type: "discrete", tableValues: n() })
|
|
5570
5570
|
] })
|
|
5571
5571
|
] }) }) }), s = r.rotation || 0, o = pt(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
|
|
5572
|
-
var w,
|
|
5573
|
-
const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((
|
|
5572
|
+
var w, E, S, B, v, I, D, F, k, N;
|
|
5573
|
+
const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((E = r.pattern) == null ? void 0 : E.y) || 0, h = ((S = r.pattern) == null ? void 0 : S.width) || 0, m = ((B = r.pattern) == null ? void 0 : B.height) || 0, g = ((v = r.pattern) == null ? void 0 : v.scaleX) || 1, p = ((I = r.pattern) == null ? void 0 : I.scaleY) || 1, f = ((D = r.pattern) == null ? void 0 : D.rotation) || 0;
|
|
5574
5574
|
return [(F = r.pattern) != null && F.svg ? {
|
|
5575
5575
|
id: `${t}-contents`,
|
|
5576
5576
|
type: T.Illustration,
|
|
@@ -5685,7 +5685,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5685
5685
|
return Le.get(r);
|
|
5686
5686
|
const e = (async () => {
|
|
5687
5687
|
try {
|
|
5688
|
-
return
|
|
5688
|
+
return vt(r).getFont();
|
|
5689
5689
|
} catch {
|
|
5690
5690
|
if (ji(r)) {
|
|
5691
5691
|
const a = mn(r), n = Xe(a);
|
|
@@ -5700,7 +5700,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5700
5700
|
}, Hi = (r) => {
|
|
5701
5701
|
const t = mn(r), e = Xe(t);
|
|
5702
5702
|
return ia(r, e), e;
|
|
5703
|
-
},
|
|
5703
|
+
}, vt = (r) => {
|
|
5704
5704
|
const t = Nn.get(r);
|
|
5705
5705
|
if (t)
|
|
5706
5706
|
return t;
|
|
@@ -5716,8 +5716,8 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5716
5716
|
var m, g, p;
|
|
5717
5717
|
if (h.type === "font-face" && h.declarations) {
|
|
5718
5718
|
const f = (m = h.declarations.find(
|
|
5719
|
-
(
|
|
5720
|
-
)) == null ? void 0 : m.value, C = (g = h.declarations.find((
|
|
5719
|
+
(E) => E.property === "font-family"
|
|
5720
|
+
)) == null ? void 0 : m.value, C = (g = h.declarations.find((E) => E.property === "src")) == null ? void 0 : g.value, w = (p = C == null ? void 0 : C.match(/'(https.*?)'/)) == null ? void 0 : p[1];
|
|
5721
5721
|
f && w && n.set(f, w);
|
|
5722
5722
|
}
|
|
5723
5723
|
});
|
|
@@ -5729,18 +5729,18 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5729
5729
|
0,
|
|
5730
5730
|
0,
|
|
5731
5731
|
parseInt(u.getAttribute("font-size") ?? "72")
|
|
5732
|
-
),
|
|
5732
|
+
), E = w.getBoundingBox().x2 - w.getBoundingBox().x1;
|
|
5733
5733
|
let S = 0;
|
|
5734
5734
|
const B = A.getAttribute("text-anchor");
|
|
5735
|
-
B === "middle" ? S =
|
|
5736
|
-
const
|
|
5735
|
+
B === "middle" ? S = E / 2 : B === "end" && (S = E);
|
|
5736
|
+
const v = g.getPath(
|
|
5737
5737
|
A.innerHTML,
|
|
5738
5738
|
parseFloat(A.getAttribute("x") ?? "0") - S,
|
|
5739
5739
|
parseFloat(A.getAttribute("y") ?? "0"),
|
|
5740
5740
|
parseInt(u.getAttribute("font-size") ?? "72")
|
|
5741
5741
|
);
|
|
5742
|
-
|
|
5743
|
-
const I =
|
|
5742
|
+
v.fill = p, v.stroke = f, v.strokeWidth = parseFloat(C ?? "0");
|
|
5743
|
+
const I = v.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
|
|
5744
5744
|
h.appendChild(F);
|
|
5745
5745
|
}
|
|
5746
5746
|
return e.querySelectorAll("text").forEach((d) => d.remove()), bt().serializeToString(a);
|
|
@@ -5801,7 +5801,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5801
5801
|
return Math.min(A, d);
|
|
5802
5802
|
}, Yi = (r, t, e, a) => {
|
|
5803
5803
|
var c;
|
|
5804
|
-
const n =
|
|
5804
|
+
const n = vt(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
|
|
5805
5805
|
if (!e)
|
|
5806
5806
|
return La(t, r, t.fontSize, s, n, a);
|
|
5807
5807
|
let o;
|
|
@@ -5822,9 +5822,9 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5822
5822
|
fontSize: qi(o, n, i, t.width, t.height, a)
|
|
5823
5823
|
} : La(t, r, t.fontSize, s, n, a);
|
|
5824
5824
|
}, Ji = (r, t, e, a, n) => {
|
|
5825
|
-
const s =
|
|
5825
|
+
const s = vt(t.assetUrl).getFont();
|
|
5826
5826
|
let o = { ...r };
|
|
5827
|
-
const l = { ...r }, c = Qn(a, e / s.unitsPerEm,
|
|
5827
|
+
const l = { ...r }, c = Qn(a, e / s.unitsPerEm, vt(t.assetUrl));
|
|
5828
5828
|
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 && _i(a, a).every(([d, A]) => d === A) && (o = l)), o;
|
|
5829
5829
|
}, Ve = 1, ht = (r, t, e) => {
|
|
5830
5830
|
let a = 0;
|
|
@@ -5853,7 +5853,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
|
|
|
5853
5853
|
stripControlCharacters: !0,
|
|
5854
5854
|
vertical: !1,
|
|
5855
5855
|
uppercase: !1
|
|
5856
|
-
},
|
|
5856
|
+
}, Ee = (r, t = Va) => {
|
|
5857
5857
|
const e = { ...Va, ...t };
|
|
5858
5858
|
let a = r || "";
|
|
5859
5859
|
return e.stripControlCharacters && (a = a.replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, "")), e.uppercase && (a = a.toUpperCase()), e.vertical && (a = a.split("").join(`
|
|
@@ -6095,7 +6095,7 @@ class ns {
|
|
|
6095
6095
|
layout: t,
|
|
6096
6096
|
elements: e
|
|
6097
6097
|
},
|
|
6098
|
-
getComponentWithProps: (a) =>
|
|
6098
|
+
getComponentWithProps: (a) => Ea(t, e, a)
|
|
6099
6099
|
};
|
|
6100
6100
|
}
|
|
6101
6101
|
initialize(t, e) {
|
|
@@ -6120,7 +6120,7 @@ class ns {
|
|
|
6120
6120
|
return { ...t, transaction: e.apply(a) };
|
|
6121
6121
|
}
|
|
6122
6122
|
}
|
|
6123
|
-
const On = (r) => r.type === T.Image ? /* @__PURE__ */ x(Mn, { ...r }, r.id) : r.type === T.Frame ? /* @__PURE__ */ x(Gi, { ...r }, r.id) : r.type === T.Illustration ? /* @__PURE__ */ x(as, { ...r }, r.id) : r.type === T.Textbox ? /* @__PURE__ */ x(Zi, { ...r }, r.id) : r.type === T.Group ? /* @__PURE__ */ x(Tn, { ...r }, r.id) : null,
|
|
6123
|
+
const On = (r) => r.type === T.Image ? /* @__PURE__ */ x(Mn, { ...r }, r.id) : r.type === T.Frame ? /* @__PURE__ */ x(Gi, { ...r }, r.id) : r.type === T.Illustration ? /* @__PURE__ */ x(as, { ...r }, r.id) : r.type === T.Textbox ? /* @__PURE__ */ x(Zi, { ...r }, r.id) : r.type === T.Group ? /* @__PURE__ */ x(Tn, { ...r }, r.id) : null, Ea = (r, t, e) => {
|
|
6124
6124
|
const a = e.renderingConfiguration, n = a != null && a.removeExcludedElements ? t.filter((i) => !i.excludeFromExport) : t;
|
|
6125
6125
|
return /* @__PURE__ */ x(
|
|
6126
6126
|
zi,
|
|
@@ -6151,7 +6151,7 @@ const On = (r) => r.type === T.Image ? /* @__PURE__ */ x(Mn, { ...r }, r.id) : r
|
|
|
6151
6151
|
}
|
|
6152
6152
|
);
|
|
6153
6153
|
};
|
|
6154
|
-
function
|
|
6154
|
+
function va(r) {
|
|
6155
6155
|
return r.sort((t, e) => {
|
|
6156
6156
|
const a = t.layer || 0, n = e.layer || 0;
|
|
6157
6157
|
if (a < n)
|
|
@@ -6355,7 +6355,7 @@ const te = (r) => {
|
|
|
6355
6355
|
}
|
|
6356
6356
|
if (e && t === T.Textbox && (a != null && a.text) && (a != null && a.fontScale)) {
|
|
6357
6357
|
await Nt(e);
|
|
6358
|
-
const l =
|
|
6358
|
+
const l = vt(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
|
|
6359
6359
|
o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
|
|
6360
6360
|
}
|
|
6361
6361
|
return o;
|
|
@@ -6409,7 +6409,7 @@ class Lc {
|
|
|
6409
6409
|
const { configuration: a, fontSrc: n, designInputStep: i } = e, s = await Nt(n), o = {
|
|
6410
6410
|
assetUrl: n,
|
|
6411
6411
|
name: s.names.fullName.en
|
|
6412
|
-
}, l = (i == null ? void 0 : i.text) || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d =
|
|
6412
|
+
}, l = (i == null ? void 0 : i.text) || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = Ee(c, {
|
|
6413
6413
|
vertical: a.vertical,
|
|
6414
6414
|
uppercase: a.uppercase
|
|
6415
6415
|
}), A = e.region || await Ut(t, T.Textbox, n, {
|
|
@@ -6527,7 +6527,7 @@ const L = (r, t) => K(r, t).elements.find((n) => n.id === r), K = (r, t) => {
|
|
|
6527
6527
|
throw new V();
|
|
6528
6528
|
return e;
|
|
6529
6529
|
}, X = (r, t) => {
|
|
6530
|
-
const e = [...t.elements.filter((n) => n.id !== r.id), r], a =
|
|
6530
|
+
const e = [...t.elements.filter((n) => n.id !== r.id), r], a = va(e);
|
|
6531
6531
|
return {
|
|
6532
6532
|
layout: t.layout,
|
|
6533
6533
|
elements: a,
|
|
@@ -7427,14 +7427,14 @@ class hs {
|
|
|
7427
7427
|
}
|
|
7428
7428
|
}
|
|
7429
7429
|
const Gn = new hs();
|
|
7430
|
-
class
|
|
7430
|
+
class ve {
|
|
7431
7431
|
constructor() {
|
|
7432
7432
|
this.frameSourceSvg = async (t, e) => {
|
|
7433
7433
|
if (!t)
|
|
7434
7434
|
return sa(e);
|
|
7435
7435
|
const a = t.asset;
|
|
7436
7436
|
if (!a)
|
|
7437
|
-
throw new
|
|
7437
|
+
throw new Et(t);
|
|
7438
7438
|
const n = a.fileLink;
|
|
7439
7439
|
if (n)
|
|
7440
7440
|
return at(n, !0);
|
|
@@ -7541,7 +7541,7 @@ class Ee {
|
|
|
7541
7541
|
}
|
|
7542
7542
|
selectImage(t, e, a, n = !0) {
|
|
7543
7543
|
var l;
|
|
7544
|
-
const i =
|
|
7544
|
+
const i = ve.patternSource(e), s = (l = a.getStepStorage(t.stepName)) == null ? void 0 : l.framePatternSrc;
|
|
7545
7545
|
if (s && s === i)
|
|
7546
7546
|
return Promise.resolve();
|
|
7547
7547
|
a.setEditedStatus(t.stepName, !0);
|
|
@@ -7723,7 +7723,7 @@ class Ee {
|
|
|
7723
7723
|
p,
|
|
7724
7724
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
|
7725
7725
|
t.data.forceImageCover
|
|
7726
|
-
) : void 0,
|
|
7726
|
+
) : void 0, E = f ? {
|
|
7727
7727
|
id: Q(),
|
|
7728
7728
|
src: f.src,
|
|
7729
7729
|
x: (w == null ? void 0 : w.x) || 0,
|
|
@@ -7733,13 +7733,13 @@ class Ee {
|
|
|
7733
7733
|
scaleX: (w == null ? void 0 : w.zoom) || 1,
|
|
7734
7734
|
scaleY: (w == null ? void 0 : w.zoom) || 1,
|
|
7735
7735
|
rotation: 0
|
|
7736
|
-
} : void 0, S = Q(),
|
|
7737
|
-
if (!
|
|
7736
|
+
} : void 0, S = Q(), v = n.getLayouts().find((I) => I.panelId === m.panelId);
|
|
7737
|
+
if (!v)
|
|
7738
7738
|
throw new q(m);
|
|
7739
7739
|
return {
|
|
7740
|
-
command: this.getCreateElementCommand(S, m,
|
|
7740
|
+
command: this.getCreateElementCommand(S, m, v, {
|
|
7741
7741
|
frameData: p,
|
|
7742
|
-
pattern:
|
|
7742
|
+
pattern: E,
|
|
7743
7743
|
disablePlaceholder: t.data.disablePlaceholder,
|
|
7744
7744
|
stepName: t.stepName
|
|
7745
7745
|
}),
|
|
@@ -7786,7 +7786,7 @@ class Ee {
|
|
|
7786
7786
|
}
|
|
7787
7787
|
async loadPatternFromAsset(t, e, a, n) {
|
|
7788
7788
|
var c, d;
|
|
7789
|
-
const i =
|
|
7789
|
+
const i = ve.patternSource(t), s = a.markUpdatePending(), o = (c = a.getWorkflowExperience().getStepById(e.stepName)) == null ? void 0 : c.frameService;
|
|
7790
7790
|
if (!o)
|
|
7791
7791
|
throw a.markUpdateCompleted(s), new Error("Frame service unavailable, cannot load pattern!");
|
|
7792
7792
|
try {
|
|
@@ -7813,7 +7813,7 @@ class Ee {
|
|
|
7813
7813
|
), this.validateColorCount(e, a);
|
|
7814
7814
|
}
|
|
7815
7815
|
}
|
|
7816
|
-
const wt = new
|
|
7816
|
+
const wt = new ve();
|
|
7817
7817
|
class ms {
|
|
7818
7818
|
async getIllustrationBody(t) {
|
|
7819
7819
|
return new Promise((e) => {
|
|
@@ -7984,7 +7984,7 @@ class ms {
|
|
|
7984
7984
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
|
7985
7985
|
const o = e.asset;
|
|
7986
7986
|
if (!o)
|
|
7987
|
-
throw new
|
|
7987
|
+
throw new Et(e);
|
|
7988
7988
|
const l = o.fileLink;
|
|
7989
7989
|
if (!l)
|
|
7990
7990
|
throw new jt(o);
|
|
@@ -7992,10 +7992,10 @@ class ms {
|
|
|
7992
7992
|
const w = i.getLayouts().find((S) => S.panelId === C.panelId);
|
|
7993
7993
|
if (!w)
|
|
7994
7994
|
throw new q(C);
|
|
7995
|
-
const
|
|
7995
|
+
const E = Q();
|
|
7996
7996
|
return {
|
|
7997
|
-
regionElement: { id:
|
|
7998
|
-
command: this.getCreateElementCommand(
|
|
7997
|
+
regionElement: { id: E, region: C },
|
|
7998
|
+
command: this.getCreateElementCommand(E, C, w, {
|
|
7999
7999
|
stepName: t.stepName,
|
|
8000
8000
|
src: l,
|
|
8001
8001
|
objectURL: d,
|
|
@@ -8007,13 +8007,13 @@ class ms {
|
|
|
8007
8007
|
const p = t.data.colorOption;
|
|
8008
8008
|
return p && ((f = p.variants) == null || f.forEach((C) => {
|
|
8009
8009
|
g = g.map((w) => {
|
|
8010
|
-
var
|
|
8011
|
-
return w.toLowerCase() === ((
|
|
8010
|
+
var E;
|
|
8011
|
+
return w.toLowerCase() === ((E = C.color) == null ? void 0 : E.toLowerCase()) ? C.name : w;
|
|
8012
8012
|
});
|
|
8013
8013
|
})), i.updateMetadata(t.stepName, { colors: g }), {
|
|
8014
8014
|
command: new $(m),
|
|
8015
8015
|
followup: async () => {
|
|
8016
|
-
var w,
|
|
8016
|
+
var w, E;
|
|
8017
8017
|
await i.setSelectionsAndElements(
|
|
8018
8018
|
t.stepName,
|
|
8019
8019
|
[e],
|
|
@@ -8025,21 +8025,21 @@ class ms {
|
|
|
8025
8025
|
const C = ((w = o.assetConfiguration) == null ? void 0 : w.defaultColorVariants) || [];
|
|
8026
8026
|
if (C.length !== 0) {
|
|
8027
8027
|
const S = {};
|
|
8028
|
-
(((
|
|
8028
|
+
(((E = o.assetConfiguration) == null ? void 0 : E.channelNumbers) || []).forEach((v) => {
|
|
8029
8029
|
var D;
|
|
8030
|
-
const I = C.find((F) => F.channelNumber ===
|
|
8031
|
-
I && (S[`${
|
|
8030
|
+
const I = C.find((F) => F.channelNumber === v.number);
|
|
8031
|
+
I && (S[`${v.id.replace(/\W/g, "")}`] = { browserValue: ((D = I == null ? void 0 : I.variant) == null ? void 0 : D.color) || "" });
|
|
8032
8032
|
}), await this.changeColors(
|
|
8033
8033
|
t,
|
|
8034
|
-
u.map((
|
|
8034
|
+
u.map((v) => v.regionElement),
|
|
8035
8035
|
i,
|
|
8036
8036
|
() => i.getCommandContext().getAllLayouts(),
|
|
8037
8037
|
new Map(Object.entries(S))
|
|
8038
8038
|
);
|
|
8039
8039
|
}
|
|
8040
8040
|
if (t.data.colorPickerEnabled) {
|
|
8041
|
-
const S = await this.availableColors(t, i) || [], B = Object.keys(c.colors),
|
|
8042
|
-
if (
|
|
8041
|
+
const S = await this.availableColors(t, i) || [], B = Object.keys(c.colors), v = S.length === 1 && B.length === 1;
|
|
8042
|
+
if (v) {
|
|
8043
8043
|
const I = S[0], D = B[0];
|
|
8044
8044
|
await this.changeColors(
|
|
8045
8045
|
t,
|
|
@@ -8049,7 +8049,7 @@ class ms {
|
|
|
8049
8049
|
/* @__PURE__ */ new Map([[D, I.variant.color]])
|
|
8050
8050
|
);
|
|
8051
8051
|
}
|
|
8052
|
-
!
|
|
8052
|
+
!v && C.length === 0 && await this.changeColors(
|
|
8053
8053
|
t,
|
|
8054
8054
|
u.map((I) => I.regionElement),
|
|
8055
8055
|
i,
|
|
@@ -8122,7 +8122,7 @@ class gs {
|
|
|
8122
8122
|
n(!0);
|
|
8123
8123
|
const s = e.material;
|
|
8124
8124
|
if (!s)
|
|
8125
|
-
throw n(!1), new
|
|
8125
|
+
throw n(!1), new Et(e);
|
|
8126
8126
|
return {
|
|
8127
8127
|
command: void 0,
|
|
8128
8128
|
followup: async () => {
|
|
@@ -8177,7 +8177,7 @@ class ps {
|
|
|
8177
8177
|
if (h && t.option) {
|
|
8178
8178
|
const g = (m = A.asset) == null ? void 0 : m.fileLink;
|
|
8179
8179
|
if (!g)
|
|
8180
|
-
throw new
|
|
8180
|
+
throw new Et(A);
|
|
8181
8181
|
await h.applyModelVariant(
|
|
8182
8182
|
t.stepName || "",
|
|
8183
8183
|
{
|
|
@@ -8202,7 +8202,7 @@ class ps {
|
|
|
8202
8202
|
n(!0);
|
|
8203
8203
|
const i = (s = e.asset) == null ? void 0 : s.fileLink;
|
|
8204
8204
|
if (!i)
|
|
8205
|
-
throw new
|
|
8205
|
+
throw new Et(e);
|
|
8206
8206
|
return {
|
|
8207
8207
|
command: void 0,
|
|
8208
8208
|
followup: async () => {
|
|
@@ -8382,7 +8382,7 @@ class Cs {
|
|
|
8382
8382
|
async selectVariantCommand(t, e, a, n) {
|
|
8383
8383
|
const i = e.asset;
|
|
8384
8384
|
if (!i)
|
|
8385
|
-
throw new
|
|
8385
|
+
throw new Et(e);
|
|
8386
8386
|
const s = i == null ? void 0 : i.fileLink;
|
|
8387
8387
|
if (!s)
|
|
8388
8388
|
return console.error("No URL for picture!"), null;
|
|
@@ -8688,7 +8688,7 @@ class Ss {
|
|
|
8688
8688
|
);
|
|
8689
8689
|
}
|
|
8690
8690
|
}
|
|
8691
|
-
const
|
|
8691
|
+
const Es = new Ss(), He = (r, t, e, a, n) => {
|
|
8692
8692
|
if (t.some((d) => d == null))
|
|
8693
8693
|
throw new Error(`Failed to autosize lines: ${t.join(", ")}`);
|
|
8694
8694
|
let i = t.map((d) => d.split(`
|
|
@@ -8717,7 +8717,7 @@ const vs = new Ss(), He = (r, t, e, a, n) => {
|
|
|
8717
8717
|
return [null, null];
|
|
8718
8718
|
}, ge = (r, t, e, a, n) => {
|
|
8719
8719
|
let i, s;
|
|
8720
|
-
const o =
|
|
8720
|
+
const o = vt(t.assetUrl), l = o.getFont();
|
|
8721
8721
|
if (n.size) {
|
|
8722
8722
|
const u = r / l.unitsPerEm;
|
|
8723
8723
|
return [i, s] = He(e, a, r, u, o), [n.size, i, s];
|
|
@@ -8738,7 +8738,7 @@ class Be extends Error {
|
|
|
8738
8738
|
super(t), Object.setPrototypeOf(this, new.target.prototype), this.name = Be.name;
|
|
8739
8739
|
}
|
|
8740
8740
|
}
|
|
8741
|
-
const
|
|
8741
|
+
const vs = ["‘", "’", "“", "”", `
|
|
8742
8742
|
`];
|
|
8743
8743
|
class be extends Error {
|
|
8744
8744
|
constructor(t) {
|
|
@@ -8752,9 +8752,9 @@ class Bs {
|
|
|
8752
8752
|
/(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
|
|
8753
8753
|
""
|
|
8754
8754
|
);
|
|
8755
|
-
const n = [], i = e ?
|
|
8755
|
+
const n = [], i = e ? vt(e.assetUrl) : void 0;
|
|
8756
8756
|
if (i) {
|
|
8757
|
-
const s = a.split("").filter((l) => !
|
|
8757
|
+
const s = a.split("").filter((l) => !vs.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
|
|
8758
8758
|
for (let l = 0; l < o.length; l++)
|
|
8759
8759
|
o[l].name === ".notdef" && n.push(String.fromCharCode(s.charCodeAt(l)));
|
|
8760
8760
|
}
|
|
@@ -8956,7 +8956,7 @@ class Bs {
|
|
|
8956
8956
|
}
|
|
8957
8957
|
getProcessedInput(t, e, a) {
|
|
8958
8958
|
const n = a ? t : this.injectReplaceableText(t, e);
|
|
8959
|
-
return
|
|
8959
|
+
return Ee(n, {
|
|
8960
8960
|
vertical: e.vertical,
|
|
8961
8961
|
uppercase: e.uppercase
|
|
8962
8962
|
});
|
|
@@ -9032,8 +9032,8 @@ class Bs {
|
|
|
9032
9032
|
g,
|
|
9033
9033
|
async () => {
|
|
9034
9034
|
e.updateMetadata(t.stepName, { color: p, text: f }), e.updateStorage(t.stepName, { text: f, inputText: f });
|
|
9035
|
-
const w = o.map((S) => new ja(S.id, m)),
|
|
9036
|
-
e.getCommandDispatcher()(
|
|
9035
|
+
const w = o.map((S) => new ja(S.id, m)), E = new $(w);
|
|
9036
|
+
e.getCommandDispatcher()(E);
|
|
9037
9037
|
}
|
|
9038
9038
|
);
|
|
9039
9039
|
const { command: C } = H.updateInputText(
|
|
@@ -9072,7 +9072,7 @@ class Bs {
|
|
|
9072
9072
|
async fontDataFromVariant(t) {
|
|
9073
9073
|
const e = t.asset;
|
|
9074
9074
|
if (!e)
|
|
9075
|
-
throw new
|
|
9075
|
+
throw new Et(t);
|
|
9076
9076
|
const a = e.fileLink;
|
|
9077
9077
|
if (!a)
|
|
9078
9078
|
throw new jt(e);
|
|
@@ -9181,7 +9181,7 @@ class Bs {
|
|
|
9181
9181
|
colorProfileAssetKey: (g = p.colorProfile) == null ? void 0 : g.key
|
|
9182
9182
|
});
|
|
9183
9183
|
}
|
|
9184
|
-
const C = await this.getDefaultColor(a), w = C || "#000000",
|
|
9184
|
+
const C = await this.getDefaultColor(a), w = C || "#000000", E = {
|
|
9185
9185
|
stepRegion: A,
|
|
9186
9186
|
stepName: t,
|
|
9187
9187
|
align: this.textAlign(a),
|
|
@@ -9205,41 +9205,41 @@ class Bs {
|
|
|
9205
9205
|
curved: a.curved,
|
|
9206
9206
|
paths: a.paths,
|
|
9207
9207
|
fillSpotColorDefinition: f
|
|
9208
|
-
}, S = [], B = /* @__PURE__ */ new Map(),
|
|
9209
|
-
if (!
|
|
9208
|
+
}, S = [], B = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
9209
|
+
if (!E.fontData)
|
|
9210
9210
|
throw new z("Failed to resolve font data for text.");
|
|
9211
9211
|
const [I, D] = ge(
|
|
9212
|
-
|
|
9213
|
-
|
|
9212
|
+
E.fontSize,
|
|
9213
|
+
E.fontData,
|
|
9214
9214
|
{
|
|
9215
|
-
left:
|
|
9216
|
-
top:
|
|
9217
|
-
width:
|
|
9218
|
-
height:
|
|
9219
|
-
rotation:
|
|
9215
|
+
left: E.x,
|
|
9216
|
+
top: E.y,
|
|
9217
|
+
width: E.width,
|
|
9218
|
+
height: E.height,
|
|
9219
|
+
rotation: E.rotation,
|
|
9220
9220
|
panelId: ""
|
|
9221
9221
|
},
|
|
9222
9222
|
[l],
|
|
9223
9223
|
{ size: a.size, minSize: a.minSize, maxSize: a.maxSize }
|
|
9224
9224
|
);
|
|
9225
|
-
B.set(
|
|
9225
|
+
B.set(E.id, I), v.set(E.id, D);
|
|
9226
9226
|
const F = a.curved || a.vertical ? l : (D || []).join(`
|
|
9227
9227
|
`);
|
|
9228
9228
|
S.push(
|
|
9229
|
-
this.generateTextChangeCommandsForRegion(I, a,
|
|
9229
|
+
this.generateTextChangeCommandsForRegion(I, a, E.id, F)
|
|
9230
9230
|
);
|
|
9231
|
-
const k = new G(
|
|
9231
|
+
const k = new G(E, h);
|
|
9232
9232
|
return {
|
|
9233
9233
|
regionElement: { id: m, region: A },
|
|
9234
9234
|
commands: [k, ...S],
|
|
9235
|
-
newElement:
|
|
9235
|
+
newElement: E,
|
|
9236
9236
|
fontData: n
|
|
9237
9237
|
};
|
|
9238
9238
|
} catch (p) {
|
|
9239
9239
|
throw console.log(p), new Be("Error adding font to region");
|
|
9240
9240
|
}
|
|
9241
9241
|
}, d = await Promise.all(a.regions.map(c)).catch((A) => {
|
|
9242
|
-
throw A instanceof Be ? (
|
|
9242
|
+
throw A instanceof Be ? (Es.setLatestToast("Failed to load font.", Qe.Error), A) : A instanceof be ? A : new Error(A);
|
|
9243
9243
|
});
|
|
9244
9244
|
return await s.setSelectionsAndElements(
|
|
9245
9245
|
t,
|
|
@@ -9267,29 +9267,29 @@ class Bs {
|
|
|
9267
9267
|
*/
|
|
9268
9268
|
async changeInputTextWithRegion(t, e, a, n, i, s, o, l, c, d) {
|
|
9269
9269
|
const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = s.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
9270
|
-
for (const
|
|
9271
|
-
if (
|
|
9270
|
+
for (const E of h)
|
|
9271
|
+
if (E.region) {
|
|
9272
9272
|
const [S, B] = ge(
|
|
9273
9273
|
e,
|
|
9274
9274
|
a,
|
|
9275
|
-
|
|
9275
|
+
E.region,
|
|
9276
9276
|
[u],
|
|
9277
9277
|
{ size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
|
|
9278
9278
|
);
|
|
9279
|
-
m.set(
|
|
9279
|
+
m.set(E.id, S), g.set(E.id, B);
|
|
9280
9280
|
}
|
|
9281
9281
|
const f = (() => {
|
|
9282
9282
|
if (t.data && t.data.maxLength && u.length > t.data.maxLength)
|
|
9283
9283
|
return d && d(!0), { info: "0" };
|
|
9284
|
-
const
|
|
9284
|
+
const E = s.getProfanities(), S = Ze(u.toLowerCase());
|
|
9285
9285
|
for (const B of S)
|
|
9286
|
-
for (const
|
|
9287
|
-
const I = v
|
|
9286
|
+
for (const v in E) {
|
|
9287
|
+
const I = E[v].toLowerCase().replace(/\s/g, "");
|
|
9288
9288
|
if (B === I)
|
|
9289
9289
|
return l(!0), { error: "Blocked profanity." };
|
|
9290
9290
|
}
|
|
9291
9291
|
return !t.data.vertical && !t.data.allowNewlines && (u.includes(`
|
|
9292
|
-
`) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((
|
|
9292
|
+
`) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((v) => v) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - u.length).toString() });
|
|
9293
9293
|
})();
|
|
9294
9294
|
if (f.error) {
|
|
9295
9295
|
c(f.error);
|
|
@@ -9301,14 +9301,14 @@ class Bs {
|
|
|
9301
9301
|
text: this.injectReplaceableText(A, t.data)
|
|
9302
9302
|
}), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
|
|
9303
9303
|
const C = [];
|
|
9304
|
-
for (const
|
|
9305
|
-
const S = t.data.curved ? u : (g.get(
|
|
9304
|
+
for (const E of h) {
|
|
9305
|
+
const S = t.data.curved ? u : (g.get(E.id) || []).join(`
|
|
9306
9306
|
`);
|
|
9307
9307
|
C.push(
|
|
9308
9308
|
this.generateTextChangeCommandsForRegion(
|
|
9309
|
-
m.get(
|
|
9309
|
+
m.get(E.id) || 1,
|
|
9310
9310
|
t.data,
|
|
9311
|
-
|
|
9311
|
+
E.id,
|
|
9312
9312
|
S
|
|
9313
9313
|
)
|
|
9314
9314
|
);
|
|
@@ -9475,14 +9475,14 @@ class Ts extends bs {
|
|
|
9475
9475
|
const a = Hi(Is), i = t !== "" ? ((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
|
|
9476
9476
|
const w = tt("g");
|
|
9477
9477
|
w.classList.add("module-text-group");
|
|
9478
|
-
const
|
|
9479
|
-
w.appendChild(
|
|
9478
|
+
const E = tt("defs");
|
|
9479
|
+
w.appendChild(E), E.appendChild(Ds(0, 2, 2, "shadow"));
|
|
9480
9480
|
const S = tt("path");
|
|
9481
|
-
S.setAttribute("d", d), S.setAttribute("stroke", "black"), S.setAttribute("stroke-width", "3"),
|
|
9481
|
+
S.setAttribute("d", d), S.setAttribute("stroke", "black"), S.setAttribute("stroke-width", "3"), E.appendChild(S);
|
|
9482
9482
|
const B = tt("g");
|
|
9483
9483
|
B.classList.add("module-layer0"), w.appendChild(B), B.setAttribute("filter", "url(#shadow)"), B.innerHTML = S.outerHTML;
|
|
9484
|
-
const
|
|
9485
|
-
|
|
9484
|
+
const v = tt("g");
|
|
9485
|
+
v.classList.add("module-layer1"), w.appendChild(v), v.setAttribute("stroke-width", "3"), v.setAttribute("stroke", "rgb(45,41,38)"), v.setAttribute("fill", "rgb(45,41,38)"), v.setAttribute("transform", "translate(0.5,0)"), v.innerHTML = o;
|
|
9486
9486
|
const I = tt("g");
|
|
9487
9487
|
I.classList.add("module-layer2"), w.appendChild(I), I.setAttribute("fill", "rgb(255,209,0)"), I.setAttribute("transform", "translate(1,-0.1)"), I.innerHTML = o;
|
|
9488
9488
|
const D = tt("g");
|
|
@@ -10191,9 +10191,9 @@ class uo {
|
|
|
10191
10191
|
var S;
|
|
10192
10192
|
if (!this.previewService)
|
|
10193
10193
|
return;
|
|
10194
|
-
const w = this.getCommandContext().getAllLayouts(),
|
|
10195
|
-
if (
|
|
10196
|
-
for (const [, B] of
|
|
10194
|
+
const w = this.getCommandContext().getAllLayouts(), E = (S = this.getLayoutPreviewService()) == null ? void 0 : S.getAll();
|
|
10195
|
+
if (E)
|
|
10196
|
+
for (const [, B] of E)
|
|
10197
10197
|
B.render(w);
|
|
10198
10198
|
}, this.experience = t, this.client = e, this.updateTransaction = o, this.graphQlClient = l, this.commandContext = s, this.reloadedState = h, this.transaction = c, this.readOnly = m, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = n, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer = g, this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, this.validationErrors = { steps: /* @__PURE__ */ new Map() }, this.confirmCallbacks = [], this.editedCallbacks = [], this.elementsCallbacks = [], this.informationResultCallbacks = [], this.initCallbacks = [], this.mandatoryCallbacks = [], this.makingAdjustmentsCallback = [], this.metadataCallbacks = [], this.selectionCallbacks = [], this.stepSpecificStorageCallbacks = {}, this.storageCallbacks = [], this.validationCallbacks = [], this.recipientCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = u, this.isReloadedTransaction = p, this.workflow.steps.forEach((w) => {
|
|
10199
10199
|
this.stepTags[w.stepName] = w.tags ?? [];
|
|
@@ -10758,11 +10758,11 @@ class uo {
|
|
|
10758
10758
|
this.stepSelections = {
|
|
10759
10759
|
...this.stepSelections,
|
|
10760
10760
|
[t]: { selectedVariants: e }
|
|
10761
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((B,
|
|
10761
|
+
}, this.selectionCost = Object.values(this.stepSelections).reduce((B, v) => B + v.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, D) => I + D, 0), 0), this.workflow.steps.forEach((B) => {
|
|
10762
10762
|
yt(B, this.stepSelections) || (this.stepInitialised[B.stepName] = !1, delete this.stepMetadata[B.stepName], delete this.stepSelections[B.stepName], delete this.storage[B.stepName]);
|
|
10763
10763
|
});
|
|
10764
10764
|
const s = this.allScenes, o = Dt(s, i), l = Dt(s, this.stepSelections), c = o.map((B) => B.silentSteps).flat(), A = l.map((B) => B.silentSteps).flat().filter(
|
|
10765
|
-
(B) => !c.some((
|
|
10765
|
+
(B) => !c.some((v) => v.stepName === B.stepName)
|
|
10766
10766
|
);
|
|
10767
10767
|
c.forEach((B) => {
|
|
10768
10768
|
yt(B, this.stepSelections) || (this.stepInitialised[B.stepName] = !1);
|
|
@@ -10776,15 +10776,15 @@ class uo {
|
|
|
10776
10776
|
const g = this.workflow.steps.find((B) => B.stepName === t);
|
|
10777
10777
|
if ((g == null ? void 0 : g.type) === P.Frame) {
|
|
10778
10778
|
const B = (S = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : S.frameService;
|
|
10779
|
-
B == null || B.setTargetElements(a.map((
|
|
10779
|
+
B == null || B.setTargetElements(a.map((v) => v.id));
|
|
10780
10780
|
}
|
|
10781
10781
|
const p = u.map((B) => new Bt(B.id)), f = new Wa(this.constructSerializableWorkflow()), C = [...m, ...p, f];
|
|
10782
10782
|
C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
10783
|
-
const w = this.getInvalidModelVariants(),
|
|
10784
|
-
if (
|
|
10783
|
+
const w = this.getInvalidModelVariants(), E = this.modelContainer;
|
|
10784
|
+
if (E) {
|
|
10785
10785
|
const B = w.map(
|
|
10786
|
-
(
|
|
10787
|
-
|
|
10786
|
+
(v) => E.applyModelVariant(
|
|
10787
|
+
v,
|
|
10788
10788
|
{
|
|
10789
10789
|
contextService: this.getLayoutPreviewService()
|
|
10790
10790
|
},
|
|
@@ -11560,7 +11560,7 @@ class So extends it {
|
|
|
11560
11560
|
);
|
|
11561
11561
|
}
|
|
11562
11562
|
}
|
|
11563
|
-
class
|
|
11563
|
+
class Eo extends it {
|
|
11564
11564
|
constructor(t, e, a) {
|
|
11565
11565
|
super(t, e, a);
|
|
11566
11566
|
}
|
|
@@ -11632,7 +11632,7 @@ class le {
|
|
|
11632
11632
|
case P.Frame:
|
|
11633
11633
|
return new Nl(t, e, t.getStepTags(e.stepName));
|
|
11634
11634
|
case P.Module:
|
|
11635
|
-
return new
|
|
11635
|
+
return new Eo(t, e, t.getStepTags(e.stepName));
|
|
11636
11636
|
default:
|
|
11637
11637
|
throw new z(`Step type ${e.type} not yet supported in Core SDK`);
|
|
11638
11638
|
}
|
|
@@ -11663,7 +11663,7 @@ const _n = y`
|
|
|
11663
11663
|
externalProductVariantId
|
|
11664
11664
|
}
|
|
11665
11665
|
}
|
|
11666
|
-
`,
|
|
11666
|
+
`, vo = y`
|
|
11667
11667
|
${_n}
|
|
11668
11668
|
mutation CreateDesign(
|
|
11669
11669
|
$name: String!
|
|
@@ -11728,7 +11728,7 @@ const bo = async (r, t) => {
|
|
|
11728
11728
|
c && !Ie(c) && (e.Authorization = `Bearer ${c}`);
|
|
11729
11729
|
}
|
|
11730
11730
|
return (i = (await b.getShadowGraphqlClient().mutate({
|
|
11731
|
-
mutation:
|
|
11731
|
+
mutation: vo,
|
|
11732
11732
|
errorPolicy: "all",
|
|
11733
11733
|
fetchPolicy: "no-cache",
|
|
11734
11734
|
variables: {
|
|
@@ -11906,10 +11906,10 @@ const bo = async (r, t) => {
|
|
|
11906
11906
|
return [F, k];
|
|
11907
11907
|
}, [C] = await f(!0), w = Object.fromEntries(
|
|
11908
11908
|
Object.keys(C).map((D) => [D, C[D].map((F) => F.id)])
|
|
11909
|
-
), [
|
|
11910
|
-
Object.keys(
|
|
11909
|
+
), [E] = await f(!1), S = Object.fromEntries(
|
|
11910
|
+
Object.keys(E).map((D) => [
|
|
11911
11911
|
D,
|
|
11912
|
-
|
|
11912
|
+
E[D].map((F) => F.id)
|
|
11913
11913
|
])
|
|
11914
11914
|
);
|
|
11915
11915
|
let B = await o(m, n.id);
|
|
@@ -12255,9 +12255,9 @@ class Qo {
|
|
|
12255
12255
|
}
|
|
12256
12256
|
let i = 2048;
|
|
12257
12257
|
e && e <= 2048 && (i = e);
|
|
12258
|
-
const s = gt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((
|
|
12258
|
+
const s = gt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((E) => {
|
|
12259
12259
|
var S;
|
|
12260
|
-
return ((S =
|
|
12260
|
+
return ((S = E.layoutState) == null ? void 0 : S.layout.panelId) === (c == null ? void 0 : c.name);
|
|
12261
12261
|
}) || o[0], A = d.layoutState.layout.previewRegion ? {
|
|
12262
12262
|
x: d.layoutState.layout.previewRegion.left,
|
|
12263
12263
|
y: d.layoutState.layout.previewRegion.top,
|
|
@@ -12271,7 +12271,7 @@ class Qo {
|
|
|
12271
12271
|
}, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
|
|
12272
12272
|
if (!h)
|
|
12273
12273
|
throw new De("Failed to obtain 2D context for preview image creation");
|
|
12274
|
-
const m =
|
|
12274
|
+
const m = Ea(u.layoutState.layout, u.layoutState.elements, {
|
|
12275
12275
|
renderingConfiguration: {
|
|
12276
12276
|
purpose: Wt.Print,
|
|
12277
12277
|
region: { left: A.x, top: A.y, width: A.width, height: A.height }
|
|
@@ -12672,7 +12672,7 @@ const Ro = [
|
|
|
12672
12672
|
const n = e.data, i = a.option;
|
|
12673
12673
|
if (!i)
|
|
12674
12674
|
return console.error(`No option for step ${a.stepName}.`), [];
|
|
12675
|
-
const s = ((S = i.variants) == null ? void 0 : S.find((
|
|
12675
|
+
const s = ((S = i.variants) == null ? void 0 : S.find((v) => v.id === n.illustrationVariantId)) || te(i);
|
|
12676
12676
|
if (!s)
|
|
12677
12677
|
return console.error(`No variant with ID: ${n.illustrationVariantId}`), [];
|
|
12678
12678
|
if (!s.asset)
|
|
@@ -12686,32 +12686,32 @@ const Ro = [
|
|
|
12686
12686
|
return console.error("Failed to read SVG."), [];
|
|
12687
12687
|
fa(m);
|
|
12688
12688
|
const g = {};
|
|
12689
|
-
kt(m, (
|
|
12690
|
-
Ro.includes(
|
|
12691
|
-
const I =
|
|
12689
|
+
kt(m, (v) => {
|
|
12690
|
+
Ro.includes(v.tagName) && !v.attributes.getNamedItem("fill") && v.setAttribute("fill", "#000000");
|
|
12691
|
+
const I = v.attributes.getNamedItem("fill");
|
|
12692
12692
|
if (I && I.value !== "none") {
|
|
12693
12693
|
const F = I.value, N = `spiff-fill-${F.replace(/\W/g, "")}`;
|
|
12694
|
-
|
|
12694
|
+
v.classList.add(N), g[N] = { browserValue: F };
|
|
12695
12695
|
}
|
|
12696
|
-
const D =
|
|
12696
|
+
const D = v.attributes.getNamedItem("stroke");
|
|
12697
12697
|
if (D && D.value !== "none") {
|
|
12698
12698
|
const F = D.value, N = `spiff-stroke-${F.replace(/\W/g, "")}`;
|
|
12699
|
-
|
|
12699
|
+
v.classList.add(N), g[N] = { browserValue: F };
|
|
12700
12700
|
}
|
|
12701
12701
|
});
|
|
12702
12702
|
const f = bt().serializeToString(m), C = n.colors;
|
|
12703
12703
|
if (C) {
|
|
12704
|
-
for (const [
|
|
12704
|
+
for (const [v, I] of Object.entries(g))
|
|
12705
12705
|
for (const D of Object.keys(C))
|
|
12706
12706
|
if (I.browserValue === D) {
|
|
12707
|
-
g[
|
|
12707
|
+
g[v] = { browserValue: C[D] };
|
|
12708
12708
|
break;
|
|
12709
12709
|
}
|
|
12710
12710
|
}
|
|
12711
|
-
const w = (
|
|
12712
|
-
const I = r.find((F) => F.panelId ===
|
|
12711
|
+
const w = (v) => {
|
|
12712
|
+
const I = r.find((F) => F.panelId === v.panelId);
|
|
12713
12713
|
if (!I)
|
|
12714
|
-
throw new q(
|
|
12714
|
+
throw new q(v);
|
|
12715
12715
|
const D = Q();
|
|
12716
12716
|
return new G(
|
|
12717
12717
|
{
|
|
@@ -12719,22 +12719,22 @@ const Ro = [
|
|
|
12719
12719
|
id: D,
|
|
12720
12720
|
svg: f,
|
|
12721
12721
|
type: T.Illustration,
|
|
12722
|
-
y:
|
|
12723
|
-
x:
|
|
12724
|
-
rotation:
|
|
12725
|
-
width:
|
|
12726
|
-
height:
|
|
12727
|
-
layer:
|
|
12728
|
-
layerIndex:
|
|
12729
|
-
immutable:
|
|
12722
|
+
y: v.top,
|
|
12723
|
+
x: v.left,
|
|
12724
|
+
rotation: v.rotation,
|
|
12725
|
+
width: v.width,
|
|
12726
|
+
height: v.height,
|
|
12727
|
+
layer: v.layer,
|
|
12728
|
+
layerIndex: v.layerIndex,
|
|
12729
|
+
immutable: v.immutable
|
|
12730
12730
|
},
|
|
12731
12731
|
I
|
|
12732
12732
|
);
|
|
12733
|
-
},
|
|
12733
|
+
}, E = a.data.regions;
|
|
12734
12734
|
try {
|
|
12735
|
-
return
|
|
12736
|
-
} catch (
|
|
12737
|
-
return console.error(
|
|
12735
|
+
return E.map(w);
|
|
12736
|
+
} catch (v) {
|
|
12737
|
+
return console.error(v), [];
|
|
12738
12738
|
}
|
|
12739
12739
|
}, Lo = async (r, t, e) => {
|
|
12740
12740
|
const a = await Jn(e.data.module), n = t.data, i = (o, l) => {
|
|
@@ -12938,7 +12938,7 @@ const Ro = [
|
|
|
12938
12938
|
const p = a.option;
|
|
12939
12939
|
if (!p)
|
|
12940
12940
|
return;
|
|
12941
|
-
const f = ((w = p.variants) == null ? void 0 : w.find((
|
|
12941
|
+
const f = ((w = p.variants) == null ? void 0 : w.find((E) => E.id === i.fontVariantId)) || te(p);
|
|
12942
12942
|
if (!f || !f.asset)
|
|
12943
12943
|
return;
|
|
12944
12944
|
t[a.stepName] = { selectedVariants: [f] };
|
|
@@ -12954,7 +12954,7 @@ const Ro = [
|
|
|
12954
12954
|
assetUrl: p,
|
|
12955
12955
|
name: f.names.fullName.en
|
|
12956
12956
|
};
|
|
12957
|
-
})(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u =
|
|
12957
|
+
})(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = Ee(A, {
|
|
12958
12958
|
vertical: a.data.vertical,
|
|
12959
12959
|
uppercase: a.data.uppercase
|
|
12960
12960
|
}), h = async (p) => {
|
|
@@ -12990,12 +12990,12 @@ const Ro = [
|
|
|
12990
12990
|
y: p.top
|
|
12991
12991
|
};
|
|
12992
12992
|
if (d) {
|
|
12993
|
-
const [w,
|
|
12993
|
+
const [w, E] = ge(
|
|
12994
12994
|
a.data.size || s,
|
|
12995
12995
|
d,
|
|
12996
12996
|
p,
|
|
12997
12997
|
[
|
|
12998
|
-
|
|
12998
|
+
Ee(u, {
|
|
12999
12999
|
vertical: a.data.vertical,
|
|
13000
13000
|
uppercase: a.data.uppercase
|
|
13001
13001
|
})
|
|
@@ -13011,7 +13011,7 @@ const Ro = [
|
|
|
13011
13011
|
{
|
|
13012
13012
|
...C,
|
|
13013
13013
|
fontSize: w,
|
|
13014
|
-
text: C.curved ? C.text : (
|
|
13014
|
+
text: C.curved ? C.text : (E || []).join(`
|
|
13015
13015
|
`)
|
|
13016
13016
|
},
|
|
13017
13017
|
f
|
|
@@ -13231,7 +13231,7 @@ class _o extends xn {
|
|
|
13231
13231
|
l = g.width, c = g.height;
|
|
13232
13232
|
} else
|
|
13233
13233
|
l = i.width, c = i.height;
|
|
13234
|
-
const d =
|
|
13234
|
+
const d = Ea(t.layoutState.layout, e, {
|
|
13235
13235
|
renderingConfiguration: { purpose: Wt.ThreeD }
|
|
13236
13236
|
}), A = hn(d), u = await ua.from(this.ctx, A, {
|
|
13237
13237
|
anonymousCrossOrigin: !0,
|
|
@@ -14273,7 +14273,7 @@ class er {
|
|
|
14273
14273
|
let A = !1;
|
|
14274
14274
|
const u = c.subscribe({
|
|
14275
14275
|
next(h) {
|
|
14276
|
-
var g, p, f, C, w,
|
|
14276
|
+
var g, p, f, C, w, E;
|
|
14277
14277
|
if (A || h.partial && (!h.data.productCollections || h.data.productCollections.length === 0 || !((g = h.data.productCollections[0].productCollectionProductsFeed) != null && g.items) || ((p = h.data.productCollections[0].productCollectionProductsFeed) == null ? void 0 : p.items.length) === 0))
|
|
14278
14278
|
return;
|
|
14279
14279
|
o.abort(), A = !0, u.unsubscribe();
|
|
@@ -14281,7 +14281,7 @@ class er {
|
|
|
14281
14281
|
d({
|
|
14282
14282
|
items: m,
|
|
14283
14283
|
// Clone items because it could be cached data (immutable)
|
|
14284
|
-
total: ((
|
|
14284
|
+
total: ((E = (w = h.data.productCollections) == null ? void 0 : w[0].productCollectionProductsFeed) == null ? void 0 : E.total) ?? 0
|
|
14285
14285
|
});
|
|
14286
14286
|
},
|
|
14287
14287
|
error() {
|
|
@@ -15544,11 +15544,11 @@ const Ae = y`
|
|
|
15544
15544
|
}
|
|
15545
15545
|
}
|
|
15546
15546
|
}
|
|
15547
|
-
`,
|
|
15547
|
+
`, El = y`
|
|
15548
15548
|
mutation CustomerGenerateVerificationCode($emailAddress: String!) {
|
|
15549
15549
|
customerGenerateVerificationCode(emailAddress: $emailAddress)
|
|
15550
15550
|
}
|
|
15551
|
-
`,
|
|
15551
|
+
`, vl = y`
|
|
15552
15552
|
mutation CustomerVerifyCode($emailAddress: String!, $verificationCode: String!) {
|
|
15553
15553
|
customerVerifyCode(emailAddress: $emailAddress, verificationCode: $verificationCode) {
|
|
15554
15554
|
id
|
|
@@ -15693,7 +15693,7 @@ class ed {
|
|
|
15693
15693
|
} catch (a) {
|
|
15694
15694
|
throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
|
|
15695
15695
|
}
|
|
15696
|
-
}, this.options = t, this.options.applicationKey && Qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.41.1-beta.
|
|
15696
|
+
}, this.options = t, this.options.applicationKey && Qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.41.1-beta.27edcea8-a794-5873-ba48-38f5bed94c71"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
15697
15697
|
}
|
|
15698
15698
|
configure(t) {
|
|
15699
15699
|
mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.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 && Or(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();
|
|
@@ -15796,13 +15796,13 @@ class ed {
|
|
|
15796
15796
|
if (p && await this.authenticateCustomerId(p)) {
|
|
15797
15797
|
const C = ((h = (u = this.customer) == null ? void 0 : u.bundleStakeholders) == null ? void 0 : h.find(
|
|
15798
15798
|
(w) => {
|
|
15799
|
-
var
|
|
15800
|
-
return (S = (
|
|
15799
|
+
var E, S;
|
|
15800
|
+
return (S = (E = w.bundle) == null ? void 0 : E.transactions) == null ? void 0 : S.some((B) => B.id === t);
|
|
15801
15801
|
}
|
|
15802
15802
|
)) || ((g = (m = this.customer) == null ? void 0 : m.stakeholders) == null ? void 0 : g.find(
|
|
15803
15803
|
(w) => {
|
|
15804
|
-
var
|
|
15805
|
-
return ((
|
|
15804
|
+
var E;
|
|
15805
|
+
return ((E = w.transaction) == null ? void 0 : E.id) === t;
|
|
15806
15806
|
}
|
|
15807
15807
|
));
|
|
15808
15808
|
if (C)
|
|
@@ -15919,7 +15919,7 @@ class ed {
|
|
|
15919
15919
|
*/
|
|
15920
15920
|
async generateVerificationCode(t) {
|
|
15921
15921
|
await b.getShadowGraphqlClient().mutate({
|
|
15922
|
-
mutation:
|
|
15922
|
+
mutation: El,
|
|
15923
15923
|
variables: {
|
|
15924
15924
|
emailAddress: t
|
|
15925
15925
|
}
|
|
@@ -15934,7 +15934,7 @@ class ed {
|
|
|
15934
15934
|
async verifyCode(t, e) {
|
|
15935
15935
|
var i, s;
|
|
15936
15936
|
const n = (i = (await b.getShadowGraphqlClient().mutate({
|
|
15937
|
-
mutation:
|
|
15937
|
+
mutation: vl,
|
|
15938
15938
|
errorPolicy: "all",
|
|
15939
15939
|
fetchPolicy: "no-cache",
|
|
15940
15940
|
variables: {
|
|
@@ -16023,20 +16023,21 @@ class ed {
|
|
|
16023
16023
|
const t = localStorage.getItem("last-refreshed-cognito-tokens"), e = localStorage.getItem("cognito-tokens"), a = localStorage.getItem("cognito-email");
|
|
16024
16024
|
if (!t || !e || !a)
|
|
16025
16025
|
return;
|
|
16026
|
-
const n = JSON.parse(e);
|
|
16027
|
-
if (
|
|
16028
|
-
new
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16026
|
+
const n = JSON.parse(e), i = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
16027
|
+
if (!n.ExpiresIn || n.ExpiresIn < i - parseInt(t))
|
|
16028
|
+
if ((await new ne({ region: this.userPoolRegion }).send(
|
|
16029
|
+
new Re({
|
|
16030
|
+
AuthFlow: "REFRESH_TOKEN_AUTH",
|
|
16031
|
+
ClientId: this.userPoolClientId,
|
|
16032
|
+
AuthParameters: {
|
|
16033
|
+
REFRESH_TOKEN: n.RefreshToken || ""
|
|
16034
|
+
}
|
|
16035
|
+
})
|
|
16036
|
+
)).AuthenticationResult)
|
|
16037
|
+
localStorage.setItem("last-refreshed-cognito-tokens", `${(/* @__PURE__ */ new Date()).getTime() / 1e3}`);
|
|
16038
|
+
else
|
|
16039
|
+
throw this.logOut(), new Error("Failed to refresh tokens.");
|
|
16040
|
+
const o = (await b.getShadowGraphqlClient().query({
|
|
16040
16041
|
query: Ae,
|
|
16041
16042
|
errorPolicy: "all",
|
|
16042
16043
|
fetchPolicy: "no-cache",
|
|
@@ -16044,28 +16045,29 @@ class ed {
|
|
|
16044
16045
|
emailAddress: a
|
|
16045
16046
|
}
|
|
16046
16047
|
})).data.customer;
|
|
16047
|
-
if (!
|
|
16048
|
+
if (!o.id)
|
|
16048
16049
|
throw new Error("Failed to get customer.");
|
|
16049
|
-
this.customer =
|
|
16050
|
+
this.customer = o;
|
|
16050
16051
|
}
|
|
16051
16052
|
// Get a Cognito bearer token from local storage, attempting to refresh if it's old.
|
|
16052
16053
|
async loggedInBearerToken() {
|
|
16053
16054
|
const t = localStorage.getItem("last-refreshed-cognito-tokens"), e = localStorage.getItem("cognito-tokens");
|
|
16054
16055
|
if (!t || !e)
|
|
16055
16056
|
throw new Error("No token data in storage.");
|
|
16056
|
-
const a = JSON.parse(e);
|
|
16057
|
-
if (
|
|
16058
|
-
new
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16057
|
+
const a = JSON.parse(e), n = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
16058
|
+
if (!a.ExpiresIn || a.ExpiresIn < n - parseInt(t))
|
|
16059
|
+
if ((await new ne({ region: this.userPoolRegion }).send(
|
|
16060
|
+
new Re({
|
|
16061
|
+
AuthFlow: "REFRESH_TOKEN_AUTH",
|
|
16062
|
+
ClientId: this.userPoolClientId,
|
|
16063
|
+
AuthParameters: {
|
|
16064
|
+
REFRESH_TOKEN: a.RefreshToken || ""
|
|
16065
|
+
}
|
|
16066
|
+
})
|
|
16067
|
+
)).AuthenticationResult)
|
|
16068
|
+
localStorage.setItem("last-refreshed-cognito-tokens", `${(/* @__PURE__ */ new Date()).getTime() / 1e3}`);
|
|
16069
|
+
else
|
|
16070
|
+
throw this.logOut(), new Error("Failed to refresh tokens.");
|
|
16069
16071
|
if (!a.AccessToken)
|
|
16070
16072
|
throw new Error("No bearer token in storage.");
|
|
16071
16073
|
return a.AccessToken;
|
|
@@ -16117,7 +16119,7 @@ class ed {
|
|
|
16117
16119
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
16118
16120
|
*/
|
|
16119
16121
|
async getExistingBundle(t, e, a, n) {
|
|
16120
|
-
var h, m, g, p, f, C, w,
|
|
16122
|
+
var h, m, g, p, f, C, w, E, S, B, v;
|
|
16121
16123
|
const i = M.getMap("bundleOwnerIds"), s = i == null ? void 0 : i.get(t), o = {};
|
|
16122
16124
|
try {
|
|
16123
16125
|
const I = await this.loggedInBearerToken();
|
|
@@ -16142,11 +16144,11 @@ class ed {
|
|
|
16142
16144
|
});
|
|
16143
16145
|
if (!((f = c.data) != null && f.bundles) || ((C = c.data) == null ? void 0 : C.bundles.length) === 0 || !((w = c.data) != null && w.bundles[0]))
|
|
16144
16146
|
throw new Error(`Unable to find bundle: ${t}`);
|
|
16145
|
-
const d = (
|
|
16147
|
+
const d = (E = c.data) == null ? void 0 : E.bundles[0], A = M.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
16146
16148
|
A.set(d.id, d.partner.id), M.setMap("bundlePartnerIds", A);
|
|
16147
16149
|
const u = new Je(this, d, e, a, s, {
|
|
16148
16150
|
additionalHeaders: (S = n == null ? void 0 : n.graphql) == null ? void 0 : S.additionalHeaders,
|
|
16149
|
-
eagerFetchProducts: (
|
|
16151
|
+
eagerFetchProducts: (v = (B = n == null ? void 0 : n.graphql) == null ? void 0 : B.productCollection) == null ? void 0 : v.eagerFetchProducts,
|
|
16150
16152
|
existingGlobalPropertyState: c.data.globalPropertyState,
|
|
16151
16153
|
readonly: n == null ? void 0 : n.readonly
|
|
16152
16154
|
});
|
|
@@ -16159,13 +16161,13 @@ class ed {
|
|
|
16159
16161
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
16160
16162
|
*/
|
|
16161
16163
|
async duplicateBundle(t, e, a, n) {
|
|
16162
|
-
var h, m, g, p, f, C, w,
|
|
16164
|
+
var h, m, g, p, f, C, w, E;
|
|
16163
16165
|
const i = (h = M.getMap("bundleOwnerIds")) == null ? void 0 : h.get(t), s = {};
|
|
16164
16166
|
try {
|
|
16165
16167
|
const S = await this.loggedInBearerToken();
|
|
16166
16168
|
s.Authorization = `Bearer ${S}`;
|
|
16167
16169
|
} catch {
|
|
16168
|
-
const
|
|
16170
|
+
const v = ((m = Object.entries(localStorage).find(([D, F]) => D.startsWith("CognitoIdentityServiceProvider") && D.endsWith("idToken"))) == null ? void 0 : m[0]) || "", I = localStorage.getItem(v);
|
|
16169
16171
|
I && !Ie(I) && (s.Authorization = `Bearer ${I}`);
|
|
16170
16172
|
}
|
|
16171
16173
|
const o = {
|
|
@@ -16193,7 +16195,7 @@ class ed {
|
|
|
16193
16195
|
const A = M.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
|
|
16194
16196
|
A.set(c.id, c.bundleOwnerId), M.setMap("bundleOwnerIds", A);
|
|
16195
16197
|
const u = new Je(this, c, void 0, void 0, c.bundleOwnerId, {
|
|
16196
|
-
eagerFetchProducts: (
|
|
16198
|
+
eagerFetchProducts: (E = (w = n == null ? void 0 : n.graphql) == null ? void 0 : w.productCollection) == null ? void 0 : E.eagerFetchProducts,
|
|
16197
16199
|
existingGlobalPropertyState: c.globalPropertyState
|
|
16198
16200
|
});
|
|
16199
16201
|
return await u.getInitializationPromise(), u;
|
|
@@ -16270,16 +16272,16 @@ class ed {
|
|
|
16270
16272
|
var D, F, k;
|
|
16271
16273
|
if (S.length === 0)
|
|
16272
16274
|
return [];
|
|
16273
|
-
const B = S.map((N) => N.option.transactionId),
|
|
16275
|
+
const B = S.map((N) => N.option.transactionId), v = await a.query({
|
|
16274
16276
|
query: fi,
|
|
16275
16277
|
variables: {
|
|
16276
16278
|
ids: B
|
|
16277
16279
|
},
|
|
16278
16280
|
errorPolicy: "all",
|
|
16279
16281
|
fetchPolicy: "no-cache"
|
|
16280
|
-
}), I =
|
|
16282
|
+
}), I = v.data.transactions;
|
|
16281
16283
|
if (I.length !== S.length) {
|
|
16282
|
-
const N = ((F = (D =
|
|
16284
|
+
const N = ((F = (D = v.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
|
|
16283
16285
|
throw new ut(`Not all transactions were found: ${N}`);
|
|
16284
16286
|
}
|
|
16285
16287
|
return !this.activeIntegration && ((k = I[0].integrationProduct) != null && k.integration) && (this.activeIntegration = Promise.resolve(I[0].integrationProduct.integration)), I.map((N, nt) => {
|
|
@@ -16311,12 +16313,12 @@ class ed {
|
|
|
16311
16313
|
},
|
|
16312
16314
|
errorPolicy: "all",
|
|
16313
16315
|
fetchPolicy: "no-cache"
|
|
16314
|
-
}),
|
|
16315
|
-
if (!
|
|
16316
|
+
}), v = (I = B.data) == null ? void 0 : I.transactionCreateMany;
|
|
16317
|
+
if (!v || v.length === 0) {
|
|
16316
16318
|
const k = ((F = (D = B.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
|
|
16317
16319
|
throw new ut(`Failed to create transactions: ${k}`);
|
|
16318
16320
|
}
|
|
16319
|
-
return
|
|
16321
|
+
return v.map((k, N) => ({
|
|
16320
16322
|
transaction: k,
|
|
16321
16323
|
workflowId: k.workflowId,
|
|
16322
16324
|
readOnly: !1,
|
|
@@ -16329,7 +16331,7 @@ class ed {
|
|
|
16329
16331
|
...d.map(i)
|
|
16330
16332
|
])).flat(), u = [...new Set(A.map((S) => S.workflowId))], h = await nr(u, e), m = new Map(h.map((S) => [S.id, S])), g = M.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (S) => {
|
|
16331
16333
|
var Z;
|
|
16332
|
-
const { transaction: B, workflowId:
|
|
16334
|
+
const { transaction: B, workflowId: v, readOnly: I, index: D } = S, F = m.get(v), k = t[D];
|
|
16333
16335
|
!g.get(B.id) && B.transactionOwnerId && g.set(B.id, B.transactionOwnerId);
|
|
16334
16336
|
const N = g.get(B.id) || void 0, nt = new bl({
|
|
16335
16337
|
onMutate: () => ({ context: { transactionOwnerId: N, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId } }),
|
|
@@ -16367,10 +16369,10 @@ class ed {
|
|
|
16367
16369
|
}), f = await Promise.all(p);
|
|
16368
16370
|
M.setMap("transactionOwnerIds", g);
|
|
16369
16371
|
const w = f.sort((S, B) => S.index - B.index).map(async (S) => {
|
|
16370
|
-
const { experienceOptions: B, options:
|
|
16371
|
-
return await I.getWorkflowManager().getInitializationPromise(),
|
|
16372
|
-
}),
|
|
16373
|
-
return
|
|
16372
|
+
const { experienceOptions: B, options: v } = S, I = new Qo(this, B);
|
|
16373
|
+
return await I.getWorkflowManager().getInitializationPromise(), v.type !== "transaction" && this.customer && await I.attachCustomerDetails({ email: this.customer.emailAddress }), I;
|
|
16374
|
+
}), E = await Promise.all(w);
|
|
16375
|
+
return E.forEach((S) => S.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), E;
|
|
16374
16376
|
}
|
|
16375
16377
|
storeCustomer(t) {
|
|
16376
16378
|
const e = M.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
|
|
@@ -16379,7 +16381,7 @@ class ed {
|
|
|
16379
16381
|
async getIntegrationProductById(t, e) {
|
|
16380
16382
|
var s, o;
|
|
16381
16383
|
const i = (s = (await b.getShadowGraphqlClient().query({
|
|
16382
|
-
query:
|
|
16384
|
+
query: Ei(e),
|
|
16383
16385
|
variables: {
|
|
16384
16386
|
ids: [t]
|
|
16385
16387
|
},
|
|
@@ -16393,7 +16395,7 @@ class ed {
|
|
|
16393
16395
|
async getIntegrationProductFromExternalIds(t, e, a) {
|
|
16394
16396
|
var o;
|
|
16395
16397
|
const s = (o = (await b.getShadowGraphqlClient().query({
|
|
16396
|
-
query:
|
|
16398
|
+
query: vi(a),
|
|
16397
16399
|
variables: {
|
|
16398
16400
|
externalProductId: e,
|
|
16399
16401
|
externalIntegrationId: t
|
|
@@ -17533,7 +17535,7 @@ export {
|
|
|
17533
17535
|
_l as AddressValidationResultConfirmationLevel,
|
|
17534
17536
|
Zc as ArrayInput,
|
|
17535
17537
|
et as AspectType,
|
|
17536
|
-
|
|
17538
|
+
Et as AssetNotFoundError,
|
|
17537
17539
|
fe as AssetType,
|
|
17538
17540
|
qc as BringForwardCommand,
|
|
17539
17541
|
Hc as BringToBackCommand,
|
|
@@ -17566,7 +17568,7 @@ export {
|
|
|
17566
17568
|
Qe as InformationMessageType,
|
|
17567
17569
|
yo as InformationStepHandle,
|
|
17568
17570
|
_a as IntegrationProduct,
|
|
17569
|
-
|
|
17571
|
+
Er as IntegrationType,
|
|
17570
17572
|
Lc as LayoutElementFactory,
|
|
17571
17573
|
T as LayoutElementType,
|
|
17572
17574
|
q as LayoutNotFoundError,
|
|
@@ -17575,7 +17577,7 @@ export {
|
|
|
17575
17577
|
ye as MisconfigurationError,
|
|
17576
17578
|
sd as MockWorkflowManager,
|
|
17577
17579
|
go as ModelStepHandle,
|
|
17578
|
-
|
|
17580
|
+
Eo as ModuleStepHandle,
|
|
17579
17581
|
Vc as MoveCommand,
|
|
17580
17582
|
ar as ObjectInput,
|
|
17581
17583
|
wl as ObjectInputType,
|
|
@@ -17583,7 +17585,7 @@ export {
|
|
|
17583
17585
|
we as OptionNotFoundError,
|
|
17584
17586
|
Ft as ParseError,
|
|
17585
17587
|
po as PictureStepHandle,
|
|
17586
|
-
|
|
17588
|
+
vr as ProductCameraRig,
|
|
17587
17589
|
er as ProductCollection,
|
|
17588
17590
|
ll as ProductCollectionProductSortKey,
|
|
17589
17591
|
Gt as ProductWorkflow,
|
|
@@ -17621,7 +17623,7 @@ export {
|
|
|
17621
17623
|
$c as cmPerPixel,
|
|
17622
17624
|
Do as createDesign,
|
|
17623
17625
|
Qc as currentDirection,
|
|
17624
|
-
|
|
17626
|
+
vc as dataUrlFromExternalUrl,
|
|
17625
17627
|
Ye as designService,
|
|
17626
17628
|
ge as determineCorrectFontSizeAndLines,
|
|
17627
17629
|
Gn as digitalContentStepService,
|
|
@@ -17655,7 +17657,7 @@ export {
|
|
|
17655
17657
|
kc as getPointOfRotation,
|
|
17656
17658
|
_c as getProductCollections,
|
|
17657
17659
|
Nc as getSEPoint,
|
|
17658
|
-
|
|
17660
|
+
Ea as getSvgElement,
|
|
17659
17661
|
fd as getTemplateBundles,
|
|
17660
17662
|
pd as getTemplateTransactions,
|
|
17661
17663
|
ad as getTransaction,
|
|
@@ -17686,7 +17688,7 @@ export {
|
|
|
17686
17688
|
qn as pictureStepService,
|
|
17687
17689
|
Bc as pmsToRgb,
|
|
17688
17690
|
Yn as questionStepService,
|
|
17689
|
-
|
|
17691
|
+
Ec as registerFetchImplementation,
|
|
17690
17692
|
Sc as registerWindowImplementation,
|
|
17691
17693
|
Ga as rehydrateSerializedLayout,
|
|
17692
17694
|
Hr as rgbToPms,
|
|
@@ -17702,7 +17704,7 @@ export {
|
|
|
17702
17704
|
Un as svgStringDimensions,
|
|
17703
17705
|
ma as svgToDataUrl,
|
|
17704
17706
|
H as textStepService,
|
|
17705
|
-
|
|
17707
|
+
Es as toast,
|
|
17706
17708
|
yd as validateWorkflowExperienceRecipient,
|
|
17707
17709
|
Sd as validateWorkflowExperienceRecipients,
|
|
17708
17710
|
bt as xmlSerializer
|