@spiffcommerce/core 31.2.4 → 31.3.0-beta.8aeade77-41a6-54bd-82fd-d7fdbf2014de
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/CHANGELOG.md +7 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +36 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +365 -356
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -336,12 +336,12 @@ class jr {
|
|
336
336
|
d = await this.spiffClient.loggedInBearerToken();
|
337
337
|
} catch {
|
338
338
|
}
|
339
|
-
const A = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken,
|
339
|
+
const A = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken, g = s.applicationKey ?? c.applicationKey, p = s.bundleOwnerId;
|
340
340
|
try {
|
341
341
|
if (window && window.__SENTRY__) {
|
342
|
-
const
|
343
|
-
if (
|
344
|
-
const S =
|
342
|
+
const f = window.__SENTRY__.hub;
|
343
|
+
if (f) {
|
344
|
+
const S = f.traceHeaders();
|
345
345
|
Object.entries(S).forEach(([b, I]) => {
|
346
346
|
l[b] = I;
|
347
347
|
});
|
@@ -349,7 +349,7 @@ class jr {
|
|
349
349
|
}
|
350
350
|
} catch {
|
351
351
|
}
|
352
|
-
return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m),
|
352
|
+
return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m), g && (l["X-Application-Key"] = g), p && (l.bundleOwnerId = p), l["Allow-Moonlight-Redirect"] = "true", {
|
353
353
|
headers: l
|
354
354
|
};
|
355
355
|
}), a = ur(({ operation: i, graphQLErrors: s, networkError: o }) => {
|
@@ -5339,14 +5339,14 @@ const M = () => {
|
|
5339
5339
|
viewBox: A,
|
5340
5340
|
width: u
|
5341
5341
|
}) => {
|
5342
|
-
const h = e || 0, m = 2 * (l?.scale || 1),
|
5342
|
+
const h = e || 0, m = 2 * (l?.scale || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = M(), S = a.purpose === Ht.FreeDesign && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ D("rect", { width: g.width, height: g.height, rx: h }) }) }), b = a.colorProfiles?.map((E, P) => (
|
5343
5343
|
/* @ts-ignore */
|
5344
5344
|
/* @__PURE__ */ D("color-profile", { name: E.name, xlinkHref: E.key, children: " " }, P)
|
5345
5345
|
)), I = n.map((E) => ({
|
5346
5346
|
...E,
|
5347
5347
|
_renderingConfiguration: a,
|
5348
|
-
mask: l ? `url(#viewmask-${
|
5349
|
-
})),
|
5348
|
+
mask: l ? `url(#viewmask-${f})` : void 0
|
5349
|
+
})), C = Sa(I);
|
5350
5350
|
return /* @__PURE__ */ ct(
|
5351
5351
|
"svg",
|
5352
5352
|
{
|
@@ -5364,7 +5364,7 @@ const M = () => {
|
|
5364
5364
|
maxHeight: s,
|
5365
5365
|
position: c
|
5366
5366
|
},
|
5367
|
-
viewBox:
|
5367
|
+
viewBox: p,
|
5368
5368
|
children: [
|
5369
5369
|
b,
|
5370
5370
|
S,
|
@@ -5372,8 +5372,8 @@ const M = () => {
|
|
5372
5372
|
"rect",
|
5373
5373
|
{
|
5374
5374
|
id: "layout-background",
|
5375
|
-
width:
|
5376
|
-
height:
|
5375
|
+
width: g.width,
|
5376
|
+
height: g.height,
|
5377
5377
|
fill: r,
|
5378
5378
|
rx: h
|
5379
5379
|
}
|
@@ -5383,7 +5383,7 @@ const M = () => {
|
|
5383
5383
|
{
|
5384
5384
|
id: "element-group",
|
5385
5385
|
clipPath: a.purpose === Ht.FreeDesign ? "url(#viewboxClip)" : void 0,
|
5386
|
-
children:
|
5386
|
+
children: C.map((E) => $n(E)).filter((E) => !!E)
|
5387
5387
|
}
|
5388
5388
|
),
|
5389
5389
|
l && /* @__PURE__ */ D(
|
@@ -5399,14 +5399,14 @@ const M = () => {
|
|
5399
5399
|
strokeDasharray: `${m * 2} ${m}`
|
5400
5400
|
}
|
5401
5401
|
),
|
5402
|
-
l && /* @__PURE__ */ ct("mask", { id: `viewmask-${
|
5402
|
+
l && /* @__PURE__ */ ct("mask", { id: `viewmask-${f}`, children: [
|
5403
5403
|
/* @__PURE__ */ D(
|
5404
5404
|
"rect",
|
5405
5405
|
{
|
5406
|
-
x:
|
5407
|
-
y:
|
5408
|
-
width:
|
5409
|
-
height:
|
5406
|
+
x: g.x,
|
5407
|
+
y: g.y,
|
5408
|
+
width: g.width,
|
5409
|
+
height: g.height,
|
5410
5410
|
fill: "black"
|
5411
5411
|
}
|
5412
5412
|
),
|
@@ -5425,12 +5425,12 @@ const M = () => {
|
|
5425
5425
|
}
|
5426
5426
|
);
|
5427
5427
|
}, Uc = (r, t, e, a, n) => {
|
5428
|
-
const i = ft(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,
|
5428
|
+
const i = ft(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, S = u * d + m * A, b = h * d + g * A, I = Math.max(Math.abs(p), Math.abs(f)), C = Math.max(Math.abs(S), Math.abs(b));
|
5429
5429
|
return {
|
5430
5430
|
minX: l - I,
|
5431
5431
|
maxX: l + I,
|
5432
|
-
minY: c -
|
5433
|
-
maxY: c +
|
5432
|
+
minY: c - C,
|
5433
|
+
maxY: c + C
|
5434
5434
|
};
|
5435
5435
|
}, Lc = (r, t, e) => {
|
5436
5436
|
const a = Math.sqrt(Math.pow(t.x - r.x, 2) + Math.pow(t.y - r.y, 2)), n = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), i = Math.sqrt(Math.pow(e.x - r.x, 2) + Math.pow(e.y - r.y, 2));
|
@@ -5587,15 +5587,15 @@ const M = () => {
|
|
5587
5587
|
/* @__PURE__ */ D("feFuncB", { type: "discrete", tableValues: n() })
|
5588
5588
|
] })
|
5589
5589
|
] }) }) }), s = r.rotation || 0, o = ft(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
|
5590
|
-
const A = r.pattern?.x || 0, u = r.pattern?.y || 0, h = r.pattern?.width || 0, m = r.pattern?.height || 0,
|
5590
|
+
const A = r.pattern?.x || 0, u = r.pattern?.y || 0, h = r.pattern?.width || 0, m = r.pattern?.height || 0, g = r.pattern?.scaleX || 1, p = r.pattern?.scaleY || 1, f = r.pattern?.rotation || 0;
|
5591
5591
|
return [r.pattern?.svg ? {
|
5592
5592
|
id: `${t}-contents`,
|
5593
5593
|
type: x.Illustration,
|
5594
5594
|
x: A,
|
5595
5595
|
y: u,
|
5596
|
-
rotation:
|
5597
|
-
width: h *
|
5598
|
-
height: m *
|
5596
|
+
rotation: f,
|
5597
|
+
width: h * g,
|
5598
|
+
height: m * p,
|
5599
5599
|
src: a(),
|
5600
5600
|
svg: r.pattern?.svg,
|
5601
5601
|
colors: r.pattern?.colors
|
@@ -5604,9 +5604,9 @@ const M = () => {
|
|
5604
5604
|
type: x.Image,
|
5605
5605
|
x: A,
|
5606
5606
|
y: u,
|
5607
|
-
rotation:
|
5608
|
-
width: h *
|
5609
|
-
height: m *
|
5607
|
+
rotation: f,
|
5608
|
+
width: h * g,
|
5609
|
+
height: m * p,
|
5610
5610
|
src: a()
|
5611
5611
|
}];
|
5612
5612
|
};
|
@@ -5730,30 +5730,30 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", ze = /* @_
|
|
5730
5730
|
on(d.innerHTML).stylesheet?.rules.forEach((u) => {
|
5731
5731
|
if (u.type === "font-face" && u.declarations) {
|
5732
5732
|
const h = u.declarations.find(
|
5733
|
-
(
|
5734
|
-
)?.value,
|
5735
|
-
h &&
|
5733
|
+
(p) => p.property === "font-family"
|
5734
|
+
)?.value, g = u.declarations.find((p) => p.property === "src")?.value?.match(/'(https.*?)'/)?.[1];
|
5735
|
+
h && g && n.set(h, g);
|
5736
5736
|
}
|
5737
5737
|
});
|
5738
5738
|
});
|
5739
5739
|
const s = e.querySelectorAll("tspan");
|
5740
5740
|
for (let d = 0; d < s.length; d++) {
|
5741
|
-
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"),
|
5741
|
+
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), g = await Nt(n.get(m)), p = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"), b = g.getPath(
|
5742
5742
|
A.innerHTML,
|
5743
5743
|
0,
|
5744
5744
|
0,
|
5745
5745
|
parseInt(u.getAttribute("font-size") ?? "72")
|
5746
5746
|
), I = b.getBoundingBox().x2 - b.getBoundingBox().x1;
|
5747
|
-
let
|
5747
|
+
let C = 0;
|
5748
5748
|
const E = A.getAttribute("text-anchor");
|
5749
|
-
E === "middle" ?
|
5750
|
-
const P =
|
5749
|
+
E === "middle" ? C = I / 2 : E === "end" && (C = I);
|
5750
|
+
const P = g.getPath(
|
5751
5751
|
A.innerHTML,
|
5752
|
-
parseFloat(A.getAttribute("x") ?? "0") -
|
5752
|
+
parseFloat(A.getAttribute("x") ?? "0") - C,
|
5753
5753
|
parseFloat(A.getAttribute("y") ?? "0"),
|
5754
5754
|
parseInt(u.getAttribute("font-size") ?? "72")
|
5755
5755
|
);
|
5756
|
-
P.fill =
|
5756
|
+
P.fill = p, P.stroke = f, P.strokeWidth = parseFloat(S ?? "0");
|
5757
5757
|
const B = P.toSVG(2), Q = t.parseFromString(B, "image/svg+xml").firstElementChild;
|
5758
5758
|
h.appendChild(Q);
|
5759
5759
|
}
|
@@ -5801,8 +5801,8 @@ const Xi = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", ze = /* @_
|
|
5801
5801
|
l = Math.max(l, mt(d, e, a));
|
5802
5802
|
let u = c + 1, h = !0;
|
5803
5803
|
for (; u < s.length && h; ) {
|
5804
|
-
const m = s[u],
|
5805
|
-
|
5804
|
+
const m = s[u], g = mt(`${A.join(" ")} ${m}`, e, a);
|
5805
|
+
g <= t ? (A.push(m), l = Math.max(l, g), u++) : h = !1;
|
5806
5806
|
}
|
5807
5807
|
o.push(A.join(" ")), c = u;
|
5808
5808
|
}
|
@@ -5903,7 +5903,9 @@ function On(r, t) {
|
|
5903
5903
|
}
|
5904
5904
|
const ss = (r) => {
|
5905
5905
|
const e = (r.rotation || 0) * Math.PI / 180, a = Math.cos(e), n = -Math.sin(e), i = `text-path-${r.id}`, s = `text-fill-${r.id}`, o = r.x + (r.curved ? 0 : r.width / 2), l = r.y + (r.curved ? 0 : r.height / 2), c = On(r.text || "", r._renderingConfiguration?.templatingContext), d = c.split(`
|
5906
|
-
`)
|
5906
|
+
`);
|
5907
|
+
console.log({ text: c, config: r._renderingConfiguration?.templatingContext });
|
5908
|
+
const A = r.strokeColor?.browserValue && r.strokeThickness ? r.strokeColor?.browserValue : void 0, u = r.strokeColor?.browserValue && r.strokeThickness ? r.strokeThickness : void 0;
|
5907
5909
|
if (r.curved && !r.paths || !r.fontData)
|
5908
5910
|
return null;
|
5909
5911
|
const h = () => r.textFillImage ? `url("#${s}")` : r._renderingConfiguration?.spotColors && r.fillSpotColorDefinition ? `${r.fill} ${wn(r.fillSpotColorDefinition)}` : r.fill;
|
@@ -5961,12 +5963,12 @@ const ss = (r) => {
|
|
5961
5963
|
},
|
5962
5964
|
stroke: A,
|
5963
5965
|
strokeWidth: u,
|
5964
|
-
children: r.curved ? /* @__PURE__ */ D(ls, { text: c, curvedPathId: i, align: r.align }) : d.map((m,
|
5966
|
+
children: r.curved ? /* @__PURE__ */ D(ls, { text: c, curvedPathId: i, align: r.align }) : d.map((m, g) => /* @__PURE__ */ D(
|
5965
5967
|
os,
|
5966
5968
|
{
|
5967
5969
|
align: r.vertical ? "center" : r.align,
|
5968
5970
|
fontSize: r.fontSize,
|
5969
|
-
thisLineIdx:
|
5971
|
+
thisLineIdx: g,
|
5970
5972
|
amountLines: d.length,
|
5971
5973
|
text: m,
|
5972
5974
|
textboxHeight: r.height,
|
@@ -5976,7 +5978,7 @@ const ss = (r) => {
|
|
5976
5978
|
verticalAlign: r.verticalAlign,
|
5977
5979
|
fontData: r.fontData
|
5978
5980
|
},
|
5979
|
-
|
5981
|
+
g
|
5980
5982
|
))
|
5981
5983
|
}
|
5982
5984
|
) }) })
|
@@ -6339,8 +6341,8 @@ const ne = (r) => {
|
|
6339
6341
|
fetch: rt
|
6340
6342
|
}), u = s.getAttribute("width"), h = s.getAttribute("height"), m = 2048;
|
6341
6343
|
if (h && u) {
|
6342
|
-
const
|
6343
|
-
|
6344
|
+
const g = parseFloat(h), f = parseFloat(u) / g;
|
6345
|
+
f > 1 ? A.resize(m, m / f) : A.resize(m * f, m);
|
6344
6346
|
} else
|
6345
6347
|
A.resize(m, m);
|
6346
6348
|
return await A.render(), await t(c);
|
@@ -6363,8 +6365,8 @@ const ne = (r) => {
|
|
6363
6365
|
if (e && t === x.Illustration) {
|
6364
6366
|
const l = await ot(await Vn(e)), u = dt().parseFromString(l.svg, "image/svg+xml").firstElementChild.getAttribute("viewBox");
|
6365
6367
|
if (!u) throw new Error("SVG missing viewBox.");
|
6366
|
-
const h = o.height, m = u.split(" "),
|
6367
|
-
o.height = o.width /
|
6368
|
+
const h = o.height, m = u.split(" "), g = parseFloat(m[2]) || 1, p = parseFloat(m[3]) || 1, f = g / p;
|
6369
|
+
o.height = o.width / f, o.top += (h - o.height) / 2;
|
6368
6370
|
}
|
6369
6371
|
if (e && t === x.Image) {
|
6370
6372
|
const l = o.height, c = await Me(e), d = await Ne(c), A = d.width / d.height;
|
@@ -7363,18 +7365,18 @@ class ys {
|
|
7363
7365
|
}
|
7364
7366
|
async regenerateQRCode(t, e, a, n) {
|
7365
7367
|
const i = async () => {
|
7366
|
-
const h = (await be([e]))[0], m = h?.versions?.find((
|
7368
|
+
const h = (await be([e]))[0], m = h?.versions?.find((g) => g.name === "mpeg4")?.link;
|
7367
7369
|
return { asset: h, link: m };
|
7368
7370
|
}, s = await new Promise((h, m) => {
|
7369
7371
|
new Gn(
|
7370
7372
|
async () => !!(await i()).link,
|
7371
7373
|
async () => {
|
7372
|
-
const
|
7373
|
-
if (!
|
7374
|
-
throw new Yt(
|
7374
|
+
const g = await i();
|
7375
|
+
if (!g.link || !g.link)
|
7376
|
+
throw new Yt(g.asset);
|
7375
7377
|
h({
|
7376
7378
|
rel: "mpeg4",
|
7377
|
-
href:
|
7379
|
+
href: g.link
|
7378
7380
|
});
|
7379
7381
|
},
|
7380
7382
|
() => {
|
@@ -7709,18 +7711,18 @@ class Pe {
|
|
7709
7711
|
i && i(!0);
|
7710
7712
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
7711
7713
|
t.data.regions.map(async (h, m) => {
|
7712
|
-
const
|
7713
|
-
g,
|
7714
|
+
const g = await Oe(l[m]), p = o.getImageData(), f = a.map((P) => new bt(P.id)), S = p ? va(
|
7714
7715
|
p,
|
7716
|
+
g,
|
7715
7717
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
7716
7718
|
t.data.forceImageCover
|
7717
|
-
) : void 0, b =
|
7719
|
+
) : void 0, b = p ? {
|
7718
7720
|
id: M(),
|
7719
|
-
src:
|
7721
|
+
src: p.src,
|
7720
7722
|
x: S?.x || 0,
|
7721
7723
|
y: S?.y || 0,
|
7722
|
-
width:
|
7723
|
-
height:
|
7724
|
+
width: p.width,
|
7725
|
+
height: p.height,
|
7724
7726
|
scaleX: S?.zoom || 1,
|
7725
7727
|
scaleY: S?.zoom || 1,
|
7726
7728
|
rotation: 0
|
@@ -7729,7 +7731,7 @@ class Pe {
|
|
7729
7731
|
throw new Y(h);
|
7730
7732
|
return {
|
7731
7733
|
command: this.getCreateElementCommand(I, h, E, {
|
7732
|
-
frameData:
|
7734
|
+
frameData: g,
|
7733
7735
|
pattern: b,
|
7734
7736
|
disablePlaceholder: t.data.disablePlaceholder,
|
7735
7737
|
stepName: t.stepName
|
@@ -7738,7 +7740,7 @@ class Pe {
|
|
7738
7740
|
id: I,
|
7739
7741
|
region: h
|
7740
7742
|
},
|
7741
|
-
removeExistingCommands:
|
7743
|
+
removeExistingCommands: f
|
7742
7744
|
};
|
7743
7745
|
})
|
7744
7746
|
), A = d.map((h) => h.command), u = d.map((h) => h.removeExistingCommands).flat();
|
@@ -7921,12 +7923,12 @@ class Ss {
|
|
7921
7923
|
n().map((h) => h.layoutState)
|
7922
7924
|
), o = { ...s.colors }, l = {};
|
7923
7925
|
Object.entries(o).forEach(([h, m]) => {
|
7924
|
-
const
|
7925
|
-
|
7926
|
+
const g = { browserValue: m.browserValue, pmsValue: m.pmsValue }, p = m.spotColor;
|
7927
|
+
p && (g.spotColor = { profileName: p.profileName, namedColor: p.namedColor }), l[h] = g;
|
7926
7928
|
});
|
7927
7929
|
for (const [h, m] of i.entries()) {
|
7928
|
-
const
|
7929
|
-
o[h] = { browserValue:
|
7930
|
+
const g = typeof m == "string" ? m : m.browserValue, p = typeof m == "string" ? void 0 : m.pmsValue;
|
7931
|
+
o[h] = { browserValue: g, spotColor: o[h]?.spotColor, pmsValue: p }, l[h] = { browserValue: g };
|
7930
7932
|
}
|
7931
7933
|
let c = Array.from(Object.values(o)).map((h) => h.browserValue);
|
7932
7934
|
const d = t.data.colorOption;
|
@@ -7957,7 +7959,7 @@ class Ss {
|
|
7957
7959
|
if (!t.data || !t.data.regions)
|
7958
7960
|
throw new Ee(t, "Missing regions.");
|
7959
7961
|
n(!0);
|
7960
|
-
const s = a.map((
|
7962
|
+
const s = a.map((f) => new bt(f.id));
|
7961
7963
|
t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
|
7962
7964
|
const o = e.asset;
|
7963
7965
|
if (!o)
|
@@ -7965,26 +7967,26 @@ class Ss {
|
|
7965
7967
|
const l = o.fileLink;
|
7966
7968
|
if (!l)
|
7967
7969
|
throw new Yt(o);
|
7968
|
-
const c = await ot(await this.getIllustrationBody(l)), d = await _t(c.svg), A = (
|
7969
|
-
const S = i.getLayouts().find((I) => I.panelId ===
|
7970
|
+
const c = await ot(await this.getIllustrationBody(l)), d = await _t(c.svg), A = (f) => {
|
7971
|
+
const S = i.getLayouts().find((I) => I.panelId === f.panelId);
|
7970
7972
|
if (!S)
|
7971
|
-
throw new Y(
|
7973
|
+
throw new Y(f);
|
7972
7974
|
const b = M();
|
7973
7975
|
return {
|
7974
|
-
regionElement: { id: b, region:
|
7975
|
-
command: this.getCreateElementCommand(b,
|
7976
|
+
regionElement: { id: b, region: f },
|
7977
|
+
command: this.getCreateElementCommand(b, f, S, {
|
7976
7978
|
stepName: t.stepName,
|
7977
7979
|
src: l,
|
7978
7980
|
objectURL: d,
|
7979
7981
|
svg: c
|
7980
7982
|
})
|
7981
7983
|
};
|
7982
|
-
}, u = t.data.regions.map(A), m = [...u.map((
|
7983
|
-
let
|
7984
|
-
const
|
7985
|
-
return
|
7986
|
-
|
7987
|
-
}), i.updateMetadata(t.stepName, { colors:
|
7984
|
+
}, u = t.data.regions.map(A), m = [...u.map((f) => f.command), ...s];
|
7985
|
+
let g = Array.from(Object.values(c.colors)).map((f) => f.browserValue);
|
7986
|
+
const p = t.data.colorOption;
|
7987
|
+
return p && p.variants?.forEach((f) => {
|
7988
|
+
g = g.map((S) => S.toLowerCase() === f.color?.toLowerCase() ? f.name : S);
|
7989
|
+
}), i.updateMetadata(t.stepName, { colors: g }), {
|
7988
7990
|
command: new R(m),
|
7989
7991
|
followup: async () => {
|
7990
7992
|
await i.setSelectionsAndElements(
|
@@ -7995,12 +7997,12 @@ class Ss {
|
|
7995
7997
|
i.setMandatoryFulfilled(t.stepName, !0), n(!1);
|
7996
7998
|
}
|
7997
7999
|
);
|
7998
|
-
const
|
7999
|
-
if (
|
8000
|
+
const f = o.assetConfiguration?.defaultColorVariants || [];
|
8001
|
+
if (f.length !== 0) {
|
8000
8002
|
const S = {};
|
8001
8003
|
(o.assetConfiguration?.channelNumbers || []).forEach((I) => {
|
8002
|
-
const
|
8003
|
-
|
8004
|
+
const C = f.find((E) => E.channelNumber === I.number);
|
8005
|
+
C && (S[`${I.id.replace(/\W/g, "")}`] = { browserValue: C?.variant?.color || "" });
|
8004
8006
|
}), await this.changeColors(
|
8005
8007
|
t,
|
8006
8008
|
u.map((I) => I.regionElement),
|
@@ -8012,18 +8014,18 @@ class Ss {
|
|
8012
8014
|
if (t.data.colorPickerEnabled) {
|
8013
8015
|
const S = await this.availableColors(t, i) || [], b = Object.keys(c.colors), I = S.length === 1 && b.length === 1;
|
8014
8016
|
if (I) {
|
8015
|
-
const
|
8017
|
+
const C = S[0], E = b[0];
|
8016
8018
|
await this.changeColors(
|
8017
8019
|
t,
|
8018
8020
|
u.map((P) => P.regionElement),
|
8019
8021
|
i,
|
8020
8022
|
() => i.getCommandContext().getAllLayouts(),
|
8021
|
-
/* @__PURE__ */ new Map([[E,
|
8023
|
+
/* @__PURE__ */ new Map([[E, C.variant.color]])
|
8022
8024
|
);
|
8023
8025
|
}
|
8024
|
-
!I &&
|
8026
|
+
!I && f.length === 0 && await this.changeColors(
|
8025
8027
|
t,
|
8026
|
-
u.map((
|
8028
|
+
u.map((C) => C.regionElement),
|
8027
8029
|
i,
|
8028
8030
|
() => i.getCommandContext().getAllLayouts(),
|
8029
8031
|
/* @__PURE__ */ new Map()
|
@@ -8068,8 +8070,8 @@ class vs {
|
|
8068
8070
|
async () => {
|
8069
8071
|
const h = e.getModelContainer();
|
8070
8072
|
if (h) {
|
8071
|
-
const m = t.data.targetMaterials.map((
|
8072
|
-
|
8073
|
+
const m = t.data.targetMaterials.map((g) => h.applyMaterialVariant(
|
8074
|
+
g,
|
8073
8075
|
l.id || "",
|
8074
8076
|
A || {}
|
8075
8077
|
));
|
@@ -8224,11 +8226,11 @@ class bs {
|
|
8224
8226
|
return console.error("Missing configuration."), null;
|
8225
8227
|
a.updateStorage(t.stepName, { text: e }), a.updateMetadata(t.stepName, { text: e });
|
8226
8228
|
const c = (d, A, u) => {
|
8227
|
-
const h = u || M(),
|
8228
|
-
if (!
|
8229
|
+
const h = u || M(), g = a.getLayouts().find((f) => f.panelId === A.panelId);
|
8230
|
+
if (!g)
|
8229
8231
|
return console.error(`Can not find layout for region: ${A.panelId}`), null;
|
8230
|
-
const
|
8231
|
-
return u &&
|
8232
|
+
const p = [];
|
8233
|
+
return u && p.push(new bt(h)), p.push(
|
8232
8234
|
new z(
|
8233
8235
|
{
|
8234
8236
|
stepRegion: A,
|
@@ -8246,12 +8248,12 @@ class bs {
|
|
8246
8248
|
layerIndex: A.layerIndex,
|
8247
8249
|
immutable: A.immutable
|
8248
8250
|
},
|
8249
|
-
|
8251
|
+
g
|
8250
8252
|
)
|
8251
8253
|
), {
|
8252
8254
|
id: h,
|
8253
8255
|
region: A,
|
8254
|
-
command: new R(
|
8256
|
+
command: new R(p)
|
8255
8257
|
};
|
8256
8258
|
};
|
8257
8259
|
if (i.length > 0) {
|
@@ -8350,7 +8352,7 @@ class Bs {
|
|
8350
8352
|
return console.error("No URL for picture!"), null;
|
8351
8353
|
n(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
|
8352
8354
|
const l = a.getRegionElements(t.stepName).map((A) => new bt(A.id)), c = (A) => {
|
8353
|
-
const h = a.getLayouts().find((
|
8355
|
+
const h = a.getLayouts().find((g) => g.panelId === A.panelId);
|
8354
8356
|
if (!h)
|
8355
8357
|
throw new Y(A);
|
8356
8358
|
const m = M();
|
@@ -8548,7 +8550,7 @@ class Ps {
|
|
8548
8550
|
const h = i.find((S) => S.panelId === u.panelId);
|
8549
8551
|
if (!h)
|
8550
8552
|
throw new Y(u);
|
8551
|
-
const m = o(),
|
8553
|
+
const m = o(), g = `
|
8552
8554
|
<svg
|
8553
8555
|
xmlns="http://www.w3.org/2000/svg"
|
8554
8556
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
@@ -8568,19 +8570,19 @@ class Ps {
|
|
8568
8570
|
fill="${m}"
|
8569
8571
|
/>
|
8570
8572
|
</svg>
|
8571
|
-
`,
|
8572
|
-
|
8573
|
-
const
|
8573
|
+
`, p = {};
|
8574
|
+
p[this.shapeFillId] = { browserValue: m };
|
8575
|
+
const f = M();
|
8574
8576
|
return {
|
8575
|
-
id:
|
8577
|
+
id: f,
|
8576
8578
|
region: u,
|
8577
8579
|
command: new z(
|
8578
8580
|
{
|
8579
8581
|
stepRegion: u,
|
8580
8582
|
stepName: t.stepName,
|
8581
|
-
colors:
|
8582
|
-
id:
|
8583
|
-
svg:
|
8583
|
+
colors: p,
|
8584
|
+
id: f,
|
8585
|
+
svg: g,
|
8584
8586
|
type: x.Illustration,
|
8585
8587
|
y: u.top,
|
8586
8588
|
x: u.left,
|
@@ -8651,14 +8653,14 @@ const Fs = new Ds(), Ye = (r, t, e, a, n) => {
|
|
8651
8653
|
const A = Math.max(...o);
|
8652
8654
|
if (A <= r.width)
|
8653
8655
|
return [i, A];
|
8654
|
-
const u = o.reduce((
|
8655
|
-
let m = !1,
|
8656
|
-
for (; !m &&
|
8657
|
-
|
8658
|
-
const
|
8659
|
-
|
8656
|
+
const u = o.reduce((p, f, S, b) => f > b[p] ? S : p, 0), h = i[u];
|
8657
|
+
let m = !1, g = h.length;
|
8658
|
+
for (; !m && g > -1; ) {
|
8659
|
+
g = h.lastIndexOf(" ", g - 1);
|
8660
|
+
const p = [h.slice(0, g), h.slice(g + 1)], f = p.map((b) => mt(b, a, n));
|
8661
|
+
f[0] <= r.width && (i = [...i.slice(0, u), ...p, ...i.slice(u + 1)], o = [
|
8660
8662
|
...o.slice(0, u),
|
8661
|
-
...
|
8663
|
+
...f,
|
8662
8664
|
...o.slice(u + 1)
|
8663
8665
|
], s += 1, m = !0);
|
8664
8666
|
}
|
@@ -8746,12 +8748,12 @@ class ks {
|
|
8746
8748
|
let A = t.data.defaultText || "";
|
8747
8749
|
const u = e.getWorkflowExperience().getBundle();
|
8748
8750
|
if (u && t.globalPropertyAspectConfigurations) {
|
8749
|
-
const
|
8750
|
-
(
|
8751
|
+
const g = u.getGlobalPropertyConfiguration()?.aspects?.find(
|
8752
|
+
(p) => p.type === L.Text && t.globalPropertyAspectConfigurations?.map((f) => f.aspectName).includes(p.name)
|
8751
8753
|
);
|
8752
|
-
if (
|
8753
|
-
const
|
8754
|
-
|
8754
|
+
if (g) {
|
8755
|
+
const f = u.getGlobalPropertyStateManager().getAspect(g.name);
|
8756
|
+
f && (A = f);
|
8755
8757
|
}
|
8756
8758
|
}
|
8757
8759
|
e.updateStorage(t.stepName, {
|
@@ -8929,9 +8931,9 @@ class ks {
|
|
8929
8931
|
{ size: a.data.size, minSize: a.data.minSize, maxSize: a.data.maxSize }
|
8930
8932
|
);
|
8931
8933
|
d.set(u.id, h), A.set(u.id, m);
|
8932
|
-
const
|
8934
|
+
const g = a.data.curved ? s : (m || []).join(`
|
8933
8935
|
`);
|
8934
|
-
c.push(this.generateTextChangeCommandsForRegion(h, a.data, u.id,
|
8936
|
+
c.push(this.generateTextChangeCommandsForRegion(h, a.data, u.id, g));
|
8935
8937
|
}
|
8936
8938
|
return !a.data.curved && e.length > 0 && !Array.from(A.values()).every((h) => h) ? (l.errorData || (l.errorData = {}), l.errorData.doesNotFit = !0, l) : (n.updateStorage(a.stepName, { text: t }), n.updateMetadata(a.stepName, {
|
8937
8939
|
text: s
|
@@ -8970,15 +8972,15 @@ class ks {
|
|
8970
8972
|
if (l && c) {
|
8971
8973
|
const d = l.variants?.find((A) => A.id === c);
|
8972
8974
|
if (d) {
|
8973
|
-
const A = await this.fontDataFromVariant(d), u = o.map((
|
8975
|
+
const A = await this.fontDataFromVariant(d), u = o.map((p) => ({ id: p.id, region: p.stepRegion })), h = n.storage?.color;
|
8974
8976
|
let m = n.storage?.text;
|
8975
|
-
const
|
8976
|
-
if (
|
8977
|
-
const
|
8977
|
+
const g = e.getWorkflowExperience().getBundle();
|
8978
|
+
if (g && t.globalPropertyAspectConfigurations) {
|
8979
|
+
const f = g.getGlobalPropertyConfiguration()?.aspects?.find(
|
8978
8980
|
(S) => S.type === L.Text && t.globalPropertyAspectConfigurations?.map((b) => b.aspectName).includes(S.name)
|
8979
8981
|
);
|
8980
|
-
if (
|
8981
|
-
const b =
|
8982
|
+
if (f) {
|
8983
|
+
const b = g.getGlobalPropertyStateManager().getAspect(f.name);
|
8982
8984
|
b && (m = b);
|
8983
8985
|
}
|
8984
8986
|
}
|
@@ -8988,15 +8990,15 @@ class ks {
|
|
8988
8990
|
u,
|
8989
8991
|
async () => {
|
8990
8992
|
e.updateMetadata(t.stepName, { color: h, text: m }), e.updateStorage(t.stepName, { text: m, inputText: m });
|
8991
|
-
const
|
8992
|
-
e.getCommandDispatcher()(
|
8993
|
+
const p = o.map((S) => new Wa(S.id, A)), f = new R(p);
|
8994
|
+
e.getCommandDispatcher()(f);
|
8993
8995
|
}
|
8994
8996
|
), o.length === 0 && l) {
|
8995
|
-
const
|
8996
|
-
if (
|
8997
|
-
const
|
8997
|
+
const p = H.getDefaultVariant(l);
|
8998
|
+
if (p) {
|
8999
|
+
const f = await this.selectVariantCommand(
|
8998
9000
|
t,
|
8999
|
-
|
9001
|
+
p,
|
9000
9002
|
{ text: m },
|
9001
9003
|
[],
|
9002
9004
|
e,
|
@@ -9005,16 +9007,16 @@ class ks {
|
|
9005
9007
|
() => {
|
9006
9008
|
}
|
9007
9009
|
);
|
9008
|
-
e.getCommandDispatcher()(
|
9010
|
+
e.getCommandDispatcher()(f.command);
|
9009
9011
|
}
|
9010
9012
|
} else {
|
9011
|
-
const { command:
|
9013
|
+
const { command: p } = G.updateInputText(
|
9012
9014
|
m || "",
|
9013
9015
|
o,
|
9014
9016
|
t,
|
9015
9017
|
e
|
9016
9018
|
);
|
9017
|
-
|
9019
|
+
p && e.getCommandDispatcher()(p);
|
9018
9020
|
}
|
9019
9021
|
}
|
9020
9022
|
}
|
@@ -9030,7 +9032,7 @@ class ks {
|
|
9030
9032
|
if (o.length === 0 && l) {
|
9031
9033
|
const m = H.getDefaultVariant(l);
|
9032
9034
|
if (m) {
|
9033
|
-
const
|
9035
|
+
const g = await this.selectVariantCommand(
|
9034
9036
|
t,
|
9035
9037
|
m,
|
9036
9038
|
{ text: h },
|
@@ -9041,7 +9043,7 @@ class ks {
|
|
9041
9043
|
() => {
|
9042
9044
|
}
|
9043
9045
|
);
|
9044
|
-
e.getCommandDispatcher()(
|
9046
|
+
e.getCommandDispatcher()(g.command);
|
9045
9047
|
}
|
9046
9048
|
} else {
|
9047
9049
|
const { command: m } = G.updateInputText(
|
@@ -9091,16 +9093,16 @@ class ks {
|
|
9091
9093
|
async selectVariantCommand(t, e, a, n, i, s, o, l, c) {
|
9092
9094
|
const d = i.markUpdatePending(), A = await this.fontDataFromVariant(e);
|
9093
9095
|
if (n.length > 0) {
|
9094
|
-
const u = n.map((
|
9096
|
+
const u = n.map((g) => new Wa(g.id, A));
|
9095
9097
|
if (l) {
|
9096
|
-
const
|
9097
|
-
u.push(...
|
9098
|
+
const g = n.map((p) => new je(p.id, l));
|
9099
|
+
u.push(...g);
|
9098
9100
|
}
|
9099
9101
|
if (c) {
|
9100
|
-
const
|
9101
|
-
(
|
9102
|
+
const g = n.map(
|
9103
|
+
(p) => new He(p.id, c, t.data.strokeThickness)
|
9102
9104
|
);
|
9103
|
-
u.push(...
|
9105
|
+
u.push(...g);
|
9104
9106
|
}
|
9105
9107
|
const h = await this.changeInputTextWithRegion(
|
9106
9108
|
t,
|
@@ -9137,18 +9139,18 @@ class ks {
|
|
9137
9139
|
a?.customiseAllText ?? !1,
|
9138
9140
|
s,
|
9139
9141
|
o
|
9140
|
-
), m = u.flatMap((
|
9142
|
+
), m = u.flatMap((p) => p.commands);
|
9141
9143
|
if (l) {
|
9142
|
-
const
|
9143
|
-
(
|
9144
|
+
const p = u.map(
|
9145
|
+
(f) => new je(f.regionElement.id, l)
|
9144
9146
|
);
|
9145
|
-
m.push(...
|
9147
|
+
m.push(...p);
|
9146
9148
|
}
|
9147
9149
|
if (c) {
|
9148
|
-
const
|
9149
|
-
(
|
9150
|
+
const p = n.map(
|
9151
|
+
(f) => new He(f.id, c, t.data.strokeThickness)
|
9150
9152
|
);
|
9151
|
-
m.push(...
|
9153
|
+
m.push(...p);
|
9152
9154
|
}
|
9153
9155
|
return h && m.push(h), {
|
9154
9156
|
command: new R(m),
|
@@ -9170,16 +9172,16 @@ class ks {
|
|
9170
9172
|
if (!a || !a.regions)
|
9171
9173
|
throw new Error("Step data not supplied");
|
9172
9174
|
const o = i.text || a.defaultText || "", l = this.getProcessedInput(o, a, !1), c = Ft(l, s), d = async (u) => {
|
9173
|
-
const m = s.getLayouts().find((
|
9175
|
+
const m = s.getLayouts().find((p) => p.panelId === u.panelId), g = M();
|
9174
9176
|
try {
|
9175
9177
|
if (!m)
|
9176
9178
|
throw new Fe("Failed to find layout for region: " + u.panelId);
|
9177
|
-
const
|
9178
|
-
let
|
9179
|
-
if (
|
9180
|
-
const tt =
|
9181
|
-
|
9182
|
-
colorProfileAssetKey:
|
9179
|
+
const p = a.colorOption;
|
9180
|
+
let f;
|
9181
|
+
if (p && p.variants) {
|
9182
|
+
const tt = p.variants.find((et) => et.id === p.defaultVariant?.id) || p.variants[0];
|
9183
|
+
f = this.createTextFillSpotColor(p, tt), s.updateStorage(t, {
|
9184
|
+
colorProfileAssetKey: p.colorProfile?.key
|
9183
9185
|
});
|
9184
9186
|
}
|
9185
9187
|
const S = await this.getDefaultColor(a), b = S || "#000000", I = {
|
@@ -9189,7 +9191,7 @@ class ks {
|
|
9189
9191
|
fill: i.color ? i.color : b,
|
9190
9192
|
fontSize: a.size || Je,
|
9191
9193
|
fontData: n,
|
9192
|
-
id:
|
9194
|
+
id: g,
|
9193
9195
|
layer: u.layer,
|
9194
9196
|
layerIndex: u.layerIndex,
|
9195
9197
|
rotation: u.rotation,
|
@@ -9205,8 +9207,8 @@ class ks {
|
|
9205
9207
|
verticalAlign: a.verticalAlign || "middle",
|
9206
9208
|
curved: a.curved,
|
9207
9209
|
paths: a.paths,
|
9208
|
-
fillSpotColorDefinition:
|
9209
|
-
},
|
9210
|
+
fillSpotColorDefinition: f
|
9211
|
+
}, C = [], E = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
|
9210
9212
|
if (!I.fontData) throw new V("Failed to resolve font data for text.");
|
9211
9213
|
const [B, F] = fe(
|
9212
9214
|
I.fontSize,
|
@@ -9225,18 +9227,18 @@ class ks {
|
|
9225
9227
|
E.set(I.id, B), P.set(I.id, F);
|
9226
9228
|
const Q = a.curved || a.vertical ? l : (F || []).join(`
|
9227
9229
|
`);
|
9228
|
-
|
9230
|
+
C.push(
|
9229
9231
|
this.generateTextChangeCommandsForRegion(B, a, I.id, Q)
|
9230
9232
|
);
|
9231
9233
|
const T = new z(I, m);
|
9232
9234
|
return {
|
9233
|
-
regionElement: { id:
|
9234
|
-
commands: [T, ...
|
9235
|
+
regionElement: { id: g, region: u },
|
9236
|
+
commands: [T, ...C],
|
9235
9237
|
newElement: I,
|
9236
9238
|
fontData: n
|
9237
9239
|
};
|
9238
|
-
} catch (
|
9239
|
-
throw console.log(
|
9240
|
+
} catch (p) {
|
9241
|
+
throw console.log(p), new De("Error adding font to region");
|
9240
9242
|
}
|
9241
9243
|
}, A = await Promise.all(a.regions.map(d)).catch((u) => {
|
9242
9244
|
throw u instanceof De ? (Fs.setLatestToast("Failed to load font.", $e.Error), u) : u instanceof Fe ? u : new Error(u);
|
@@ -9266,30 +9268,30 @@ class ks {
|
|
9266
9268
|
* @deprecated
|
9267
9269
|
*/
|
9268
9270
|
async changeInputTextWithRegion(t, e, a, n, i, s, o, l, c, d) {
|
9269
|
-
const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = Ft(u, s), m = s.getRegionElements(t.stepName),
|
9270
|
-
for (const
|
9271
|
-
if (
|
9271
|
+
const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = Ft(u, s), m = s.getRegionElements(t.stepName), g = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
9272
|
+
for (const C of m)
|
9273
|
+
if (C.region) {
|
9272
9274
|
const [E, P] = fe(
|
9273
9275
|
e,
|
9274
9276
|
a,
|
9275
|
-
|
9277
|
+
C.region,
|
9276
9278
|
[h],
|
9277
9279
|
{ size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
|
9278
9280
|
);
|
9279
|
-
|
9281
|
+
g.set(C.id, E), p.set(C.id, P);
|
9280
9282
|
}
|
9281
9283
|
const S = (() => {
|
9282
9284
|
if (t.data && t.data.maxLength && h.length > t.data.maxLength)
|
9283
9285
|
return d && d(!0), { info: "0" };
|
9284
|
-
const
|
9286
|
+
const C = s.getProfanities(), E = ea(u.toLowerCase());
|
9285
9287
|
for (const P of E)
|
9286
|
-
for (const B in
|
9287
|
-
const F =
|
9288
|
+
for (const B in C) {
|
9289
|
+
const F = C[B].toLowerCase().replace(/\s/g, "");
|
9288
9290
|
if (P === F)
|
9289
9291
|
return l(!0), { error: "Blocked profanity." };
|
9290
9292
|
}
|
9291
9293
|
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(
|
9294
|
+
`) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(p.values()).every((B) => B) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - h.length).toString() });
|
9293
9295
|
})();
|
9294
9296
|
if (S.error) {
|
9295
9297
|
c(S.error);
|
@@ -9301,14 +9303,14 @@ class ks {
|
|
9301
9303
|
text: this.injectReplaceableText(A, t.data)
|
9302
9304
|
}), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
|
9303
9305
|
const b = [];
|
9304
|
-
for (const
|
9305
|
-
const E = t.data.curved ? u : (
|
9306
|
+
for (const C of m) {
|
9307
|
+
const E = t.data.curved ? u : (p.get(C.id) || []).join(`
|
9306
9308
|
`);
|
9307
9309
|
b.push(
|
9308
9310
|
this.generateTextChangeCommandsForRegion(
|
9309
|
-
|
9311
|
+
g.get(C.id) || 1,
|
9310
9312
|
t.data,
|
9311
|
-
|
9313
|
+
C.id,
|
9312
9314
|
E
|
9313
9315
|
)
|
9314
9316
|
);
|
@@ -9477,10 +9479,10 @@ class Ls extends Ms {
|
|
9477
9479
|
b.classList.add("module-text-group");
|
9478
9480
|
const I = at("defs");
|
9479
9481
|
b.appendChild(I), I.appendChild(Qs(0, 2, 2, "shadow"));
|
9480
|
-
const
|
9481
|
-
|
9482
|
+
const C = at("path");
|
9483
|
+
C.setAttribute("d", d), C.setAttribute("stroke", "black"), C.setAttribute("stroke-width", "3"), I.appendChild(C);
|
9482
9484
|
const E = at("g");
|
9483
|
-
E.classList.add("module-layer0"), b.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML =
|
9485
|
+
E.classList.add("module-layer0"), b.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = C.outerHTML;
|
9484
9486
|
const P = at("g");
|
9485
9487
|
P.classList.add("module-layer1"), b.appendChild(P), P.setAttribute("stroke-width", "3"), P.setAttribute("stroke", "rgb(45,41,38)"), P.setAttribute("fill", "rgb(45,41,38)"), P.setAttribute("transform", "translate(0.5,0)"), P.innerHTML = o;
|
9486
9488
|
const B = at("g");
|
@@ -9493,14 +9495,14 @@ class Ls extends Ms {
|
|
9493
9495
|
u.appendChild(h);
|
9494
9496
|
const m = at("g");
|
9495
9497
|
m.classList.add("module-bounds"), u.appendChild(m);
|
9496
|
-
const
|
9497
|
-
|
9498
|
-
const
|
9499
|
-
|
9500
|
-
const
|
9501
|
-
|
9498
|
+
const g = Ns(e.height, e.width);
|
9499
|
+
g.setAttribute("opacity", "0"), m.appendChild(g);
|
9500
|
+
const p = at("g");
|
9501
|
+
p.classList.add("module-text-enclosure"), u.appendChild(p);
|
9502
|
+
const f = A();
|
9503
|
+
p.appendChild(f);
|
9502
9504
|
const S = fr(d);
|
9503
|
-
return Os(
|
9505
|
+
return Os(p, S, e.height, e.width, 0.35, 0.65), Rs(u.outerHTML);
|
9504
9506
|
}
|
9505
9507
|
}
|
9506
9508
|
async function Kn(r) {
|
@@ -9567,7 +9569,7 @@ const re = w`
|
|
9567
9569
|
variables: {
|
9568
9570
|
bundleId: r
|
9569
9571
|
}
|
9570
|
-
})).data.globalPropertyState, Ws = w`
|
9572
|
+
})).data.globalPropertyState, Ws = (r) => w`
|
9571
9573
|
${Qe}
|
9572
9574
|
fragment ProductFields on Product {
|
9573
9575
|
id
|
@@ -9599,7 +9601,7 @@ const re = w`
|
|
9599
9601
|
preloadImageUrl
|
9600
9602
|
sku
|
9601
9603
|
skuCode
|
9602
|
-
workflows {
|
9604
|
+
workflows${r ? "(filters: $productWorkflowFilters)" : ""} {
|
9603
9605
|
id
|
9604
9606
|
index
|
9605
9607
|
friendlyName
|
@@ -9612,8 +9614,8 @@ const re = w`
|
|
9612
9614
|
name
|
9613
9615
|
}
|
9614
9616
|
}
|
9615
|
-
`, ba = w`
|
9616
|
-
${Ws}
|
9617
|
+
`, ba = (r) => w`
|
9618
|
+
${Ws(r)}
|
9617
9619
|
fragment ProductCollectionProductFields on ProductCollectionProduct {
|
9618
9620
|
id
|
9619
9621
|
productId
|
@@ -9622,8 +9624,8 @@ const re = w`
|
|
9622
9624
|
...ProductFields
|
9623
9625
|
}
|
9624
9626
|
}
|
9625
|
-
`, ie = (r) => w`
|
9626
|
-
${r ? ba : ""}
|
9627
|
+
`, ie = (r, t = !1) => w`
|
9628
|
+
${r ? ba(t) : ""}
|
9627
9629
|
fragment ProductCollectionFields on ProductCollection {
|
9628
9630
|
id
|
9629
9631
|
name
|
@@ -9811,7 +9813,7 @@ const re = w`
|
|
9811
9813
|
}
|
9812
9814
|
}
|
9813
9815
|
`, Hs = w`
|
9814
|
-
${ba}
|
9816
|
+
${ba(!1)}
|
9815
9817
|
query GetProductCollectionProducts($id: String!, $productIds: [String!]) {
|
9816
9818
|
productCollections(ids: [$id], productIds: $productIds) {
|
9817
9819
|
id
|
@@ -9844,12 +9846,13 @@ const re = w`
|
|
9844
9846
|
}
|
9845
9847
|
}
|
9846
9848
|
`, Js = w`
|
9847
|
-
${ba}
|
9849
|
+
${ba(!0)}
|
9848
9850
|
query GetProductCollectionForProductsFeed(
|
9849
9851
|
$id: String!
|
9850
9852
|
$limit: Int
|
9851
9853
|
$offset: Int
|
9852
|
-
$
|
9854
|
+
$productFilters: ProductCollectionProductFilterInput
|
9855
|
+
$productWorkflowFilters: MetafieldFilterListInput
|
9853
9856
|
$tags: ProductCollectionProductTagFilterInput
|
9854
9857
|
$sortKey: ProductCollectionProductSortKey
|
9855
9858
|
$sortDescending: Boolean
|
@@ -9858,7 +9861,8 @@ const re = w`
|
|
9858
9861
|
productCollections(ids: [$id]) {
|
9859
9862
|
id
|
9860
9863
|
productCollectionProductsFeed(
|
9861
|
-
filters: $
|
9864
|
+
filters: $productFilters
|
9865
|
+
workflowFilters: $productWorkflowFilters
|
9862
9866
|
tags: $tags
|
9863
9867
|
limit: $limit
|
9864
9868
|
offset: $offset
|
@@ -10238,14 +10242,14 @@ class Ya extends Fn {
|
|
10238
10242
|
}
|
10239
10243
|
}
|
10240
10244
|
class yo {
|
10241
|
-
constructor(t, e, a, n, i, s, o, l, c, d, A, u, h, m = !1,
|
10245
|
+
constructor(t, e, a, n, i, s, o, l, c, d, A, u, h, m = !1, g, p = !1, f = !1, S = !1) {
|
10242
10246
|
this.workflowStatePromiseQueue = new xn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
|
10243
10247
|
if (!this.previewService) return;
|
10244
10248
|
const b = this.getCommandContext().getAllLayouts(), I = this.getLayoutPreviewService()?.getAll();
|
10245
10249
|
if (I)
|
10246
|
-
for (const [,
|
10247
|
-
|
10248
|
-
}, 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 =
|
10250
|
+
for (const [, C] of I)
|
10251
|
+
C.render(b);
|
10252
|
+
}, 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.renderableContextService?.setWorkflowManager(this), this.isReloadedTransaction = p, this.workflow.steps.forEach((b) => {
|
10249
10253
|
this.stepTags[b.stepName] = b.tags ?? [];
|
10250
10254
|
}), S && (this.workflowStatePromiseQueue.enabled = !1), this.initializationPromise = this.initializeDefaultWorkflowState(a), this.initializationPromise.then(() => {
|
10251
10255
|
this.initialized = !0;
|
@@ -10264,7 +10268,7 @@ class yo {
|
|
10264
10268
|
a.type === Ce.FirstName ? e[n] = t?.firstName : a.type === Ce.LastName ? e[n] = t?.lastName : a.type === Ce.Custom && (a.customFieldIndex === 1 ? e[n] = t?.customField1 : a.customFieldIndex === 2 ? e[n] = t?.customField2 : a.customFieldIndex === 3 ? e[n] = t?.customField3 : a.customFieldIndex === 4 ? e[n] = t?.customField4 : a.customFieldIndex === 5 && (e[n] = t?.customField5));
|
10265
10269
|
}), e;
|
10266
10270
|
}
|
10267
|
-
async updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m,
|
10271
|
+
async updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m, g, p, f) {
|
10268
10272
|
if (this.transaction.recipient?.id)
|
10269
10273
|
this.transaction.recipient = {
|
10270
10274
|
id: this.transaction.recipient.id,
|
@@ -10282,9 +10286,9 @@ class yo {
|
|
10282
10286
|
customField1: u || this.transaction.recipient.customField1,
|
10283
10287
|
customField2: h || this.transaction.recipient.customField2,
|
10284
10288
|
customField3: m || this.transaction.recipient.customField3,
|
10285
|
-
customField4:
|
10286
|
-
customField5:
|
10287
|
-
conversionConfigurationId:
|
10289
|
+
customField4: g || this.transaction.recipient.customField4,
|
10290
|
+
customField5: p || this.transaction.recipient.customField5,
|
10291
|
+
conversionConfigurationId: f || this.transaction.recipient.conversionConfigurationId
|
10288
10292
|
}, await this.graphQlClient().mutate({
|
10289
10293
|
mutation: fo,
|
10290
10294
|
errorPolicy: "all",
|
@@ -10305,9 +10309,9 @@ class yo {
|
|
10305
10309
|
customField1: u || this.transaction.recipient.customField1,
|
10306
10310
|
customField2: h || this.transaction.recipient.customField2,
|
10307
10311
|
customField3: m || this.transaction.recipient.customField3,
|
10308
|
-
customField4:
|
10309
|
-
customField5:
|
10310
|
-
conversionConfigurationId:
|
10312
|
+
customField4: g || this.transaction.recipient.customField4,
|
10313
|
+
customField5: p || this.transaction.recipient.customField5,
|
10314
|
+
conversionConfigurationId: f || this.transaction.recipient.conversionConfigurationId
|
10311
10315
|
}
|
10312
10316
|
});
|
10313
10317
|
else {
|
@@ -10330,9 +10334,9 @@ class yo {
|
|
10330
10334
|
customField1: u,
|
10331
10335
|
customField2: h,
|
10332
10336
|
customField3: m,
|
10333
|
-
customField4:
|
10334
|
-
customField5:
|
10335
|
-
conversionConfigurationId:
|
10337
|
+
customField4: g,
|
10338
|
+
customField5: p,
|
10339
|
+
conversionConfigurationId: f
|
10336
10340
|
}
|
10337
10341
|
});
|
10338
10342
|
this.transaction.recipient = {
|
@@ -10351,9 +10355,9 @@ class yo {
|
|
10351
10355
|
customField1: u,
|
10352
10356
|
customField2: h,
|
10353
10357
|
customField3: m,
|
10354
|
-
customField4:
|
10355
|
-
customField5:
|
10356
|
-
conversionConfigurationId:
|
10358
|
+
customField4: g,
|
10359
|
+
customField5: p,
|
10360
|
+
conversionConfigurationId: f
|
10357
10361
|
}, await this.graphQlClient().mutate({
|
10358
10362
|
mutation: Co,
|
10359
10363
|
errorPolicy: "all",
|
@@ -10845,14 +10849,14 @@ class yo {
|
|
10845
10849
|
this.stepSelections = {
|
10846
10850
|
...this.stepSelections,
|
10847
10851
|
[t]: { selectedVariants: e }
|
10848
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((
|
10849
|
-
St(
|
10852
|
+
}, this.selectionCost = Object.values(this.stepSelections).reduce((C, E) => C + E.selectedVariants.map((P) => P.priceModifier || 0).reduce((P, B) => P + B, 0), 0), this.workflow.steps.forEach((C) => {
|
10853
|
+
St(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1, delete this.stepMetadata[C.stepName], delete this.stepSelections[C.stepName], delete this.storage[C.stepName]);
|
10850
10854
|
});
|
10851
|
-
const s = this.allScenes, o = Pt(s, i), l = Pt(s, this.stepSelections), c = o.map((
|
10852
|
-
(
|
10855
|
+
const s = this.allScenes, o = Pt(s, i), l = Pt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), A = l.map((C) => C.silentSteps).flat().filter(
|
10856
|
+
(C) => !c.some((E) => E.stepName === C.stepName)
|
10853
10857
|
);
|
10854
|
-
c.forEach((
|
10855
|
-
St(
|
10858
|
+
c.forEach((C) => {
|
10859
|
+
St(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1);
|
10856
10860
|
});
|
10857
10861
|
const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(A, !1);
|
10858
10862
|
this.stepElements = {
|
@@ -10860,13 +10864,13 @@ class yo {
|
|
10860
10864
|
...h,
|
10861
10865
|
[t]: a
|
10862
10866
|
}, this.removeElements(u);
|
10863
|
-
const
|
10864
|
-
|
10865
|
-
const
|
10867
|
+
const g = this.workflow.steps.find((C) => C.stepName === t);
|
10868
|
+
g?.type === v.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((E) => E.id));
|
10869
|
+
const p = u.map((C) => new bt(C.id)), f = new Ga(this.constructSerializableWorkflow()), S = [...m, ...p, f];
|
10866
10870
|
S.length > 0 && this.commandContext.apply(new R(S), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
10867
10871
|
const b = this.getInvalidModelVariants(), I = this.modelContainer;
|
10868
10872
|
if (I) {
|
10869
|
-
const
|
10873
|
+
const C = b.map(
|
10870
10874
|
(E) => I.applyModelVariant(
|
10871
10875
|
E,
|
10872
10876
|
{
|
@@ -10875,7 +10879,7 @@ class yo {
|
|
10875
10879
|
!1
|
10876
10880
|
)
|
10877
10881
|
);
|
10878
|
-
await Promise.all(
|
10882
|
+
await Promise.all(C);
|
10879
10883
|
}
|
10880
10884
|
await this.onSelectionChange(), n && await n();
|
10881
10885
|
}
|
@@ -11921,7 +11925,7 @@ const To = async (r, t) => {
|
|
11921
11925
|
T.errors && console.log("Server Error:", et.message);
|
11922
11926
|
}), null) : tt ?? null;
|
11923
11927
|
})() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await r.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
|
11924
|
-
const u = r.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h,
|
11928
|
+
const u = r.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l && Ja(l, t, !0), p = l && Ja(l, t, !1), f = async (B) => {
|
11925
11929
|
const F = {};
|
11926
11930
|
let Q = 0;
|
11927
11931
|
if (Object.keys(i).length > 0)
|
@@ -11947,9 +11951,9 @@ const To = async (r, t) => {
|
|
11947
11951
|
}
|
11948
11952
|
}
|
11949
11953
|
return [F, Q];
|
11950
|
-
}, [S] = await
|
11954
|
+
}, [S] = await f(!0), b = Object.fromEntries(
|
11951
11955
|
Object.keys(S).map((B) => [B, S[B].map((F) => F.id)])
|
11952
|
-
), [I] = await
|
11956
|
+
), [I] = await f(!1), C = Object.fromEntries(
|
11953
11957
|
Object.keys(I).map((B) => [
|
11954
11958
|
B,
|
11955
11959
|
I[B].map((F) => F.id)
|
@@ -11978,22 +11982,22 @@ const To = async (r, t) => {
|
|
11978
11982
|
useThreeDimPreview: !!m,
|
11979
11983
|
previewImage: E
|
11980
11984
|
};
|
11981
|
-
if (
|
11985
|
+
if (p) {
|
11982
11986
|
const F = [];
|
11983
|
-
for (const [Q, T] of Object.entries(
|
11987
|
+
for (const [Q, T] of Object.entries(p))
|
11984
11988
|
F.push({ key: Q, value: T });
|
11985
11989
|
B.metadata = F;
|
11986
11990
|
}
|
11987
11991
|
if (b) {
|
11988
11992
|
const F = [];
|
11989
|
-
for (const [Q, T] of Object.entries(
|
11993
|
+
for (const [Q, T] of Object.entries(C))
|
11990
11994
|
F.push({ key: Q, ids: T });
|
11991
11995
|
B.selectedVariants = F;
|
11992
11996
|
}
|
11993
11997
|
return B;
|
11994
11998
|
})(),
|
11995
11999
|
cartSelectionsWithPrices: S,
|
11996
|
-
cartMetadata:
|
12000
|
+
cartMetadata: g
|
11997
12001
|
};
|
11998
12002
|
}, Ro = async (r, t, e, a, n, i, s, o, l, c, d) => {
|
11999
12003
|
l("workflow.steps.finish.finalize.buildingLayouts");
|
@@ -12009,19 +12013,19 @@ const To = async (r, t) => {
|
|
12009
12013
|
d
|
12010
12014
|
);
|
12011
12015
|
l("workflow.steps.finish.finalize.creatingDesign");
|
12012
|
-
const m = await To(A),
|
12016
|
+
const m = await To(A), g = m?.transaction?.previewImageLink;
|
12013
12017
|
if (!m?.transaction)
|
12014
12018
|
throw new Error("Failed to create design");
|
12015
12019
|
l("workflow.steps.finish.finalize.updatingTransaction");
|
12016
|
-
const
|
12020
|
+
const p = m.transaction;
|
12017
12021
|
return Xn(
|
12018
|
-
|
12022
|
+
p,
|
12019
12023
|
n,
|
12020
12024
|
t,
|
12021
12025
|
u,
|
12022
12026
|
m?.sku,
|
12023
12027
|
h,
|
12024
|
-
|
12028
|
+
g,
|
12025
12029
|
m?.processExecution?.id
|
12026
12030
|
);
|
12027
12031
|
}, Oo = async (r, t, e) => {
|
@@ -12306,14 +12310,14 @@ class Go {
|
|
12306
12310
|
}, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
|
12307
12311
|
if (!h)
|
12308
12312
|
throw new ke("Failed to obtain 2D context for preview image creation");
|
12309
|
-
const m = this.workflowManager.getTemplatingContext(),
|
12313
|
+
const m = this.workflowManager.getTemplatingContext(), g = ya(u.layoutState.layout, u.layoutState.elements, {
|
12310
12314
|
renderingConfiguration: {
|
12311
12315
|
purpose: Ht.Print,
|
12312
12316
|
region: { left: A.x, top: A.y, width: A.width, height: A.height },
|
12313
12317
|
templatingContext: m
|
12314
12318
|
}
|
12315
|
-
}),
|
12316
|
-
await (await Aa.from(h,
|
12319
|
+
}), p = mn(g);
|
12320
|
+
await (await Aa.from(h, p, {
|
12317
12321
|
anonymousCrossOrigin: !0,
|
12318
12322
|
ignoreDimensions: !1,
|
12319
12323
|
createCanvas: pt,
|
@@ -12415,14 +12419,14 @@ class Go {
|
|
12415
12419
|
A !== void 0 && (A.forEach((u) => d.add(JSON.stringify(u))), o.forEach((u) => {
|
12416
12420
|
const h = u.getRaw().globalPropertyAspectConfigurations;
|
12417
12421
|
h !== void 0 && h.forEach((m) => {
|
12418
|
-
const
|
12419
|
-
if (
|
12420
|
-
const
|
12421
|
-
if (!
|
12422
|
-
c.selectVariant(
|
12423
|
-
} else if (
|
12424
|
-
const
|
12425
|
-
c.setText(
|
12422
|
+
const g = l(m), p = d.has(JSON.stringify(m));
|
12423
|
+
if (p && g?.getType() === "Option") {
|
12424
|
+
const f = u.getCurrentVariant();
|
12425
|
+
if (!f) return;
|
12426
|
+
c.selectVariant(f), d.delete(JSON.stringify(m));
|
12427
|
+
} else if (p && g?.getType() === "Text") {
|
12428
|
+
const f = u.getText();
|
12429
|
+
c.setText(f), d.delete(JSON.stringify(m));
|
12426
12430
|
}
|
12427
12431
|
});
|
12428
12432
|
}));
|
@@ -12679,13 +12683,13 @@ const Wo = (r) => {
|
|
12679
12683
|
const a = t.data, n = e.data.baseUrl, i = a.assetUrl.replace("localhost", "localstack"), s = n.slice(0, 4) === "http" ? "" : "https://", o = new URL(s + n);
|
12680
12684
|
o.searchParams.append("video", Qa(JSON.stringify([{ href: i }]))), o.pathname = o.pathname + (o.pathname.slice(-1) === "/" ? "" : "/");
|
12681
12685
|
const l = o.toString(), d = `data:image/svg+xml;base64,${Qa(await ln(l, { type: "svg" }))}`, A = (h) => {
|
12682
|
-
const m = r.find((
|
12686
|
+
const m = r.find((p) => p.panelId === h.panelId);
|
12683
12687
|
if (!m)
|
12684
12688
|
throw new Y(h);
|
12685
|
-
const
|
12689
|
+
const g = M();
|
12686
12690
|
return new z(
|
12687
12691
|
{
|
12688
|
-
id:
|
12692
|
+
id: g,
|
12689
12693
|
src: d,
|
12690
12694
|
type: x.Image,
|
12691
12695
|
y: h.top,
|
@@ -12708,7 +12712,7 @@ const Wo = (r) => {
|
|
12708
12712
|
const o = As(n, a.option);
|
12709
12713
|
o && (t[a.stepName] = { selectedVariants: [o] });
|
12710
12714
|
const l = async (c) => {
|
12711
|
-
const d = await Un(c, o?.asset?.fileLink), A = await Oe(d), u = M(), h = r.find((
|
12715
|
+
const d = await Un(c, o?.asset?.fileLink), A = await Oe(d), u = M(), h = r.find((g) => g.panelId === c.panelId);
|
12712
12716
|
if (!h)
|
12713
12717
|
throw new Y(c);
|
12714
12718
|
const m = va(
|
@@ -12763,7 +12767,7 @@ const Wo = (r) => {
|
|
12763
12767
|
const n = e.data, i = a.option;
|
12764
12768
|
if (!i)
|
12765
12769
|
return console.error(`No option for step ${a.stepName}.`), [];
|
12766
|
-
const s = i.variants?.find((
|
12770
|
+
const s = i.variants?.find((C) => C.id === n.illustrationVariantId) || ne(i);
|
12767
12771
|
if (!s)
|
12768
12772
|
return console.error(`No variant with ID: ${n.illustrationVariantId}`), [];
|
12769
12773
|
if (!s.asset)
|
@@ -12776,56 +12780,56 @@ const Wo = (r) => {
|
|
12776
12780
|
if (!m)
|
12777
12781
|
return console.error("Failed to read SVG."), [];
|
12778
12782
|
pa(m);
|
12779
|
-
const
|
12780
|
-
kt(m, (
|
12781
|
-
jo.includes(
|
12782
|
-
const E =
|
12783
|
+
const g = {};
|
12784
|
+
kt(m, (C) => {
|
12785
|
+
jo.includes(C.tagName) && !C.attributes.getNamedItem("fill") && C.setAttribute("fill", "#000000");
|
12786
|
+
const E = C.attributes.getNamedItem("fill");
|
12783
12787
|
if (E && E.value !== "none") {
|
12784
12788
|
const B = E.value, Q = `spiff-fill-${B.replace(/\W/g, "")}`;
|
12785
|
-
|
12789
|
+
C.classList.add(Q), g[Q] = { browserValue: B };
|
12786
12790
|
}
|
12787
|
-
const P =
|
12791
|
+
const P = C.attributes.getNamedItem("stroke");
|
12788
12792
|
if (P && P.value !== "none") {
|
12789
12793
|
const B = P.value, Q = `spiff-stroke-${B.replace(/\W/g, "")}`;
|
12790
|
-
|
12794
|
+
C.classList.add(Q), g[Q] = { browserValue: B };
|
12791
12795
|
}
|
12792
12796
|
});
|
12793
|
-
const
|
12797
|
+
const f = Bt().serializeToString(m), S = n.colors;
|
12794
12798
|
if (S) {
|
12795
|
-
for (const [
|
12799
|
+
for (const [C, E] of Object.entries(g))
|
12796
12800
|
for (const P of Object.keys(S))
|
12797
12801
|
if (E.browserValue === P) {
|
12798
|
-
|
12802
|
+
g[C] = { browserValue: S[P] };
|
12799
12803
|
break;
|
12800
12804
|
}
|
12801
12805
|
}
|
12802
|
-
const b = (
|
12803
|
-
const E = r.find((B) => B.panelId ===
|
12806
|
+
const b = (C) => {
|
12807
|
+
const E = r.find((B) => B.panelId === C.panelId);
|
12804
12808
|
if (!E)
|
12805
|
-
throw new Y(
|
12809
|
+
throw new Y(C);
|
12806
12810
|
const P = M();
|
12807
12811
|
return new z(
|
12808
12812
|
{
|
12809
|
-
colors:
|
12813
|
+
colors: g,
|
12810
12814
|
id: P,
|
12811
|
-
svg:
|
12815
|
+
svg: f,
|
12812
12816
|
type: x.Illustration,
|
12813
|
-
y:
|
12814
|
-
x:
|
12815
|
-
rotation:
|
12816
|
-
width:
|
12817
|
-
height:
|
12818
|
-
layer:
|
12819
|
-
layerIndex:
|
12820
|
-
immutable:
|
12817
|
+
y: C.top,
|
12818
|
+
x: C.left,
|
12819
|
+
rotation: C.rotation,
|
12820
|
+
width: C.width,
|
12821
|
+
height: C.height,
|
12822
|
+
layer: C.layer,
|
12823
|
+
layerIndex: C.layerIndex,
|
12824
|
+
immutable: C.immutable
|
12821
12825
|
},
|
12822
12826
|
E
|
12823
12827
|
);
|
12824
12828
|
}, I = a.data.regions;
|
12825
12829
|
try {
|
12826
12830
|
return I.map(b);
|
12827
|
-
} catch (
|
12828
|
-
return console.error(
|
12831
|
+
} catch (C) {
|
12832
|
+
return console.error(C), [];
|
12829
12833
|
}
|
12830
12834
|
}, Ko = async (r, t, e) => {
|
12831
12835
|
const a = await Kn(e.data.module), n = t.data, i = (o, l) => {
|
@@ -12907,7 +12911,7 @@ const Wo = (r) => {
|
|
12907
12911
|
return console.error(`No variant with ID: ${n.colorVariantId}`), [];
|
12908
12912
|
t[a.stepName] = { selectedVariants: [s] };
|
12909
12913
|
const o = (c) => {
|
12910
|
-
const d = r.find((
|
12914
|
+
const d = r.find((g) => g.panelId === c.panelId);
|
12911
12915
|
if (!d)
|
12912
12916
|
throw new Y(c);
|
12913
12917
|
const A = `
|
@@ -12986,10 +12990,10 @@ const Wo = (r) => {
|
|
12986
12990
|
}
|
12987
12991
|
else {
|
12988
12992
|
const c = await nt(i, !0), d = (A) => {
|
12989
|
-
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "",
|
12990
|
-
if (!
|
12993
|
+
const u = /<svg.*?<\/svg>/s, h = A.match(u) || [], m = h?.length > 0 ? h[0] : "", f = dt().parseFromString(m, "image/svg+xml").firstElementChild;
|
12994
|
+
if (!f)
|
12991
12995
|
throw new Dt("Failed to read SVG.");
|
12992
|
-
return pa(
|
12996
|
+
return pa(f), Bt().serializeToString(f);
|
12993
12997
|
};
|
12994
12998
|
l.forEach((A) => {
|
12995
12999
|
const u = r.find((m) => m.panelId === A.panelId);
|
@@ -13019,36 +13023,36 @@ const Wo = (r) => {
|
|
13019
13023
|
}
|
13020
13024
|
return a;
|
13021
13025
|
}, tl = async (r, t, e, a) => {
|
13022
|
-
const n = [], i = e.data, s = 30, o = (
|
13023
|
-
const
|
13024
|
-
if (!
|
13026
|
+
const n = [], i = e.data, s = 30, o = (p) => p.vertical ? "center" : p.textAlign || "center", l = () => {
|
13027
|
+
const p = a.option;
|
13028
|
+
if (!p)
|
13025
13029
|
return;
|
13026
|
-
const
|
13027
|
-
if (!
|
13030
|
+
const f = p.variants?.find((b) => b.id === i.fontVariantId) || ne(p);
|
13031
|
+
if (!f || !f.asset)
|
13028
13032
|
return;
|
13029
|
-
t[a.stepName] = { selectedVariants: [
|
13030
|
-
const S =
|
13033
|
+
t[a.stepName] = { selectedVariants: [f] };
|
13034
|
+
const S = f.asset.fileLink;
|
13031
13035
|
if (S)
|
13032
13036
|
return S;
|
13033
13037
|
}, d = await (async () => {
|
13034
|
-
const
|
13035
|
-
if (!
|
13038
|
+
const p = l();
|
13039
|
+
if (!p)
|
13036
13040
|
return;
|
13037
|
-
const
|
13041
|
+
const f = await Nt(p);
|
13038
13042
|
return {
|
13039
|
-
assetUrl:
|
13040
|
-
name:
|
13043
|
+
assetUrl: p,
|
13044
|
+
name: f.names.fullName.en
|
13041
13045
|
};
|
13042
13046
|
})(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = Ie(A, {
|
13043
13047
|
vertical: a.data.vertical,
|
13044
13048
|
uppercase: a.data.uppercase
|
13045
|
-
}), h = async (
|
13046
|
-
const
|
13047
|
-
return
|
13048
|
-
}, m = i.color || await h(a.data),
|
13049
|
-
for (const
|
13050
|
-
const
|
13051
|
-
if (!
|
13049
|
+
}), h = async (p) => {
|
13050
|
+
const f = p.colorOption;
|
13051
|
+
return f ? H.getDefaultVariant(f)?.color : void 0;
|
13052
|
+
}, m = i.color || await h(a.data), g = a.data.regions;
|
13053
|
+
for (const p of g) {
|
13054
|
+
const f = r.find((b) => b.panelId === p.panelId);
|
13055
|
+
if (!f)
|
13052
13056
|
continue;
|
13053
13057
|
const S = {
|
13054
13058
|
stepName: e.name,
|
@@ -13058,24 +13062,24 @@ const Wo = (r) => {
|
|
13058
13062
|
fill: i.color || m || "#000000",
|
13059
13063
|
fontData: d,
|
13060
13064
|
fontSize: a.data.size || s,
|
13061
|
-
height:
|
13062
|
-
layer:
|
13063
|
-
layerIndex:
|
13065
|
+
height: p.height,
|
13066
|
+
layer: p.layer,
|
13067
|
+
layerIndex: p.layerIndex,
|
13064
13068
|
paths: a.data.paths,
|
13065
|
-
rotation:
|
13069
|
+
rotation: p.rotation,
|
13066
13070
|
text: u,
|
13067
13071
|
type: x.Textbox,
|
13068
13072
|
vertical: a.data.vertical,
|
13069
13073
|
verticalAlign: a.data.verticalAlign || "middle",
|
13070
|
-
width:
|
13071
|
-
x:
|
13072
|
-
y:
|
13074
|
+
width: p.width,
|
13075
|
+
x: p.left,
|
13076
|
+
y: p.top
|
13073
13077
|
};
|
13074
13078
|
if (d) {
|
13075
13079
|
const [b, I] = fe(
|
13076
13080
|
a.data.size || s,
|
13077
13081
|
d,
|
13078
|
-
|
13082
|
+
p,
|
13079
13083
|
[
|
13080
13084
|
Ie(u, {
|
13081
13085
|
vertical: a.data.vertical,
|
@@ -13096,11 +13100,11 @@ const Wo = (r) => {
|
|
13096
13100
|
text: S.curved ? S.text : (I || []).join(`
|
13097
13101
|
`)
|
13098
13102
|
},
|
13099
|
-
|
13103
|
+
f
|
13100
13104
|
)
|
13101
13105
|
);
|
13102
13106
|
} else
|
13103
|
-
n.push(new z(S,
|
13107
|
+
n.push(new z(S, f));
|
13104
13108
|
}
|
13105
13109
|
return n;
|
13106
13110
|
}, el = (r, t) => r.conditions ? r.conditions.every((e) => {
|
@@ -13321,8 +13325,8 @@ class ol extends Fn {
|
|
13321
13325
|
if (this.nonPOTSupport) {
|
13322
13326
|
const m = s / o;
|
13323
13327
|
a / n < m ? (l = s, c = n * (s / a)) : (l = a * (o / n), c = o);
|
13324
|
-
const
|
13325
|
-
l =
|
13328
|
+
const p = this.resizeFit({ width: l, height: c });
|
13329
|
+
l = p.width, c = p.height;
|
13326
13330
|
} else
|
13327
13331
|
l = i.width, c = i.height;
|
13328
13332
|
const d = this.getWorkflowManager?.()?.getTemplatingContext(), A = ya(t.layoutState.layout, e, {
|
@@ -14332,31 +14336,36 @@ class ar {
|
|
14332
14336
|
* Fetches a paginated feed of products.
|
14333
14337
|
* @param offset The zero-based start index.
|
14334
14338
|
* @param limit The maximum number of products to return.
|
14335
|
-
* @param
|
14339
|
+
* @param productFilters Optional product metafields to filter the products by.
|
14336
14340
|
* @param tags Optional object of tag filters to apply.
|
14337
14341
|
* @param sortKey Optional field of the products to sort by.
|
14338
14342
|
* @param sortDescending Optional boolean to indicate if the sort should be in descending order.
|
14339
14343
|
* @param quickSearch Optional string to filter products by name.
|
14344
|
+
* @param workflowFilters Optional workflow metafields to filter the products and their workflows by.
|
14340
14345
|
* @returns
|
14341
14346
|
*/
|
14342
|
-
async fetchProductsFeed(t, e, a, n, i, s, o) {
|
14347
|
+
async fetchProductsFeed(t, e, a, n, i, s, o, l) {
|
14343
14348
|
if (this.fullFetched) {
|
14344
|
-
const
|
14349
|
+
const u = await (a ? this.filterProducts(a) : this.fetchProducts());
|
14345
14350
|
return {
|
14346
|
-
total:
|
14347
|
-
items:
|
14351
|
+
total: u.length,
|
14352
|
+
items: u.slice(t, t + e)
|
14348
14353
|
};
|
14349
14354
|
}
|
14350
|
-
const
|
14355
|
+
const c = new AbortController(), { signal: d } = c, A = y.getShadowGraphqlClient().watchQuery({
|
14351
14356
|
query: Js,
|
14352
14357
|
variables: {
|
14353
14358
|
id: this.getId(),
|
14354
14359
|
limit: e,
|
14355
14360
|
offset: t,
|
14356
|
-
|
14361
|
+
productFilters: a ? {
|
14357
14362
|
link: "And",
|
14358
14363
|
metafields: a
|
14359
14364
|
} : void 0,
|
14365
|
+
productWorkflowFilters: l ? {
|
14366
|
+
link: "And",
|
14367
|
+
metafields: l
|
14368
|
+
} : void 0,
|
14360
14369
|
tags: n ? {
|
14361
14370
|
include: n.include ?? [],
|
14362
14371
|
exclude: n.exclude ?? []
|
@@ -14370,26 +14379,26 @@ class ar {
|
|
14370
14379
|
returnPartialData: !0,
|
14371
14380
|
context: {
|
14372
14381
|
fetchOptions: {
|
14373
|
-
signal:
|
14382
|
+
signal: d
|
14374
14383
|
}
|
14375
14384
|
}
|
14376
14385
|
});
|
14377
|
-
return new Promise((
|
14378
|
-
let
|
14379
|
-
const
|
14380
|
-
next(
|
14381
|
-
if (
|
14386
|
+
return new Promise((u) => {
|
14387
|
+
let h = !1;
|
14388
|
+
const m = A.subscribe({
|
14389
|
+
next(g) {
|
14390
|
+
if (h || g.partial && (!g.data.productCollections || g.data.productCollections.length === 0 || !g.data.productCollections[0].productCollectionProductsFeed?.items || g.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
|
14382
14391
|
return;
|
14383
|
-
|
14384
|
-
const p =
|
14385
|
-
|
14392
|
+
c.abort(), h = !0, m.unsubscribe();
|
14393
|
+
const p = g.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new Ae(vt(f))) || [];
|
14394
|
+
u({
|
14386
14395
|
items: p,
|
14387
14396
|
// Clone items because it could be cached data (immutable)
|
14388
|
-
total:
|
14397
|
+
total: g.data.productCollections?.[0].productCollectionProductsFeed?.total ?? 0
|
14389
14398
|
});
|
14390
14399
|
},
|
14391
14400
|
error() {
|
14392
|
-
|
14401
|
+
h || (h = !0, m.unsubscribe(), u({ items: [], total: 0 }));
|
14393
14402
|
}
|
14394
14403
|
});
|
14395
14404
|
});
|
@@ -14697,9 +14706,9 @@ class _e {
|
|
14697
14706
|
A ? this.globalPropertyHandleService.getHandles().then((u) => {
|
14698
14707
|
const h = u.map((m) => {
|
14699
14708
|
if (m.getType() === L.ColorOption || m.getType() === L.Option) {
|
14700
|
-
const
|
14701
|
-
if (!A.aspects.find((
|
14702
|
-
return
|
14709
|
+
const g = m;
|
14710
|
+
if (!A.aspects.find((f) => f.name === g.getName()))
|
14711
|
+
return g.initDefaultVariant();
|
14703
14712
|
}
|
14704
14713
|
});
|
14705
14714
|
Promise.all(h).then(c).catch(d);
|
@@ -14895,7 +14904,7 @@ class _e {
|
|
14895
14904
|
), d = [...new Set(o.map((u) => u.number))];
|
14896
14905
|
if (d.length > c)
|
14897
14906
|
for (const u of d) {
|
14898
|
-
const h = this.getGlobalPropertyStateManager(), m = l.find((
|
14907
|
+
const h = this.getGlobalPropertyStateManager(), m = l.find((g) => g.channelNumber === u);
|
14899
14908
|
m && await h.setAspect(n, m.variant.id || "", void 0, m.channelNumber);
|
14900
14909
|
}
|
14901
14910
|
}
|
@@ -15955,7 +15964,7 @@ class md {
|
|
15955
15964
|
} catch (a) {
|
15956
15965
|
throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
|
15957
15966
|
}
|
15958
|
-
}, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.
|
15967
|
+
}, this.options = t, this.options.applicationKey && Lr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 31.3.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
15959
15968
|
}
|
15960
15969
|
configure(t) {
|
15961
15970
|
gt.setHubUrl(t.hubUrl), gt.setServerUrl(t.serverUrl), gt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && zr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
@@ -16274,8 +16283,8 @@ class md {
|
|
16274
16283
|
const h = await this.loggedInBearerToken();
|
16275
16284
|
o.Authorization = `Bearer ${h}`;
|
16276
16285
|
} catch {
|
16277
|
-
const
|
16278
|
-
|
16286
|
+
const g = Object.entries(localStorage).find(([f, S]) => f.startsWith("CognitoIdentityServiceProvider") && f.endsWith("idToken"))?.[0] || "", p = localStorage.getItem(g);
|
16287
|
+
p && !Wt(p) && (o.Authorization = `Bearer ${p}`);
|
16279
16288
|
}
|
16280
16289
|
const l = {
|
16281
16290
|
bundleOwnerId: s,
|
@@ -16315,8 +16324,8 @@ class md {
|
|
16315
16324
|
const u = await this.loggedInBearerToken();
|
16316
16325
|
s.Authorization = `Bearer ${u}`;
|
16317
16326
|
} catch {
|
16318
|
-
const m = Object.entries(localStorage).find(([
|
16319
|
-
|
16327
|
+
const m = Object.entries(localStorage).find(([p, f]) => p.startsWith("CognitoIdentityServiceProvider") && p.endsWith("idToken"))?.[0] || "", g = localStorage.getItem(m);
|
16328
|
+
g && !Wt(g) && (s.Authorization = `Bearer ${g}`);
|
16320
16329
|
}
|
16321
16330
|
const o = {
|
16322
16331
|
bundleOwnerId: i,
|
@@ -16414,10 +16423,10 @@ class md {
|
|
16414
16423
|
async getWorkflowExperiences(t, e) {
|
16415
16424
|
if (t.length === 0)
|
16416
16425
|
throw new ht("No options provided!");
|
16417
|
-
const a = y.getShadowGraphqlClient(), n = async (
|
16418
|
-
if (
|
16426
|
+
const a = y.getShadowGraphqlClient(), n = async (C) => {
|
16427
|
+
if (C.length === 0)
|
16419
16428
|
return [];
|
16420
|
-
const E =
|
16429
|
+
const E = C.map((F) => F.option.transactionId), P = await a.query({
|
16421
16430
|
query: vi,
|
16422
16431
|
variables: {
|
16423
16432
|
ids: E
|
@@ -16425,23 +16434,23 @@ class md {
|
|
16425
16434
|
errorPolicy: "all",
|
16426
16435
|
fetchPolicy: "no-cache"
|
16427
16436
|
}), B = P.data.transactions;
|
16428
|
-
if (B.length !==
|
16437
|
+
if (B.length !== C.length) {
|
16429
16438
|
const F = P.errors?.[0]?.message || "Unknown error";
|
16430
16439
|
throw new ht(`Not all transactions were found: ${F}`);
|
16431
16440
|
}
|
16432
16441
|
return !this.activeIntegration && B[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(B[0].integrationProduct.integration)), B.map((F, Q) => ({
|
16433
16442
|
transaction: F,
|
16434
16443
|
workflowId: F.workflowId,
|
16435
|
-
readOnly:
|
16436
|
-
index:
|
16444
|
+
readOnly: C.find((T) => T.option.transactionId === F.id)?.option.readOnly ?? !1,
|
16445
|
+
index: C[Q].index
|
16437
16446
|
}));
|
16438
|
-
}, i = async (
|
16439
|
-
if (
|
16447
|
+
}, i = async (C) => {
|
16448
|
+
if (C.length === 0)
|
16440
16449
|
return [];
|
16441
16450
|
const E = await a.mutate({
|
16442
16451
|
mutation: Si,
|
16443
16452
|
variables: {
|
16444
|
-
inputs:
|
16453
|
+
inputs: C.map((B) => ({
|
16445
16454
|
integrationProductId: B.option.type === "integration" ? B.option.integrationProductId : void 0,
|
16446
16455
|
externalIntegrationId: B.option.type === "external" ? B.option.externalIntegrationId : void 0,
|
16447
16456
|
externalProductId: B.option.type === "external" ? B.option.externalProductId : void 0,
|
@@ -16463,17 +16472,17 @@ class md {
|
|
16463
16472
|
transaction: B,
|
16464
16473
|
workflowId: B.workflowId,
|
16465
16474
|
readOnly: !1,
|
16466
|
-
index:
|
16475
|
+
index: C[F].index
|
16467
16476
|
}));
|
16468
|
-
}, s = t.map((
|
16469
|
-
(
|
16477
|
+
}, s = t.map((C, E) => ({ option: C, index: E })), o = s.filter((C) => C.option.type === "transaction"), l = s.filter(
|
16478
|
+
(C) => C.option.type === "integration" || C.option.type === "external"
|
16470
16479
|
), c = Fa(o, 10), d = Fa(l, 10), A = (await Promise.all([
|
16471
16480
|
...c.map(n),
|
16472
16481
|
...d.map(i)
|
16473
|
-
])).flat(), u = [...new Set(A.map((
|
16474
|
-
const { transaction: E, workflowId: P, readOnly: B, index: F } =
|
16475
|
-
!
|
16476
|
-
const tt =
|
16482
|
+
])).flat(), u = [...new Set(A.map((C) => C.workflowId))], h = await rr(u, e), m = new Map(h.map((C) => [C.id, C])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (C) => {
|
16483
|
+
const { transaction: E, workflowId: P, readOnly: B, index: F } = C, Q = m.get(P), T = t[F];
|
16484
|
+
!g.get(E.id) && E.transactionOwnerId && g.set(E.id, E.transactionOwnerId);
|
16485
|
+
const tt = g.get(E.id) || void 0, et = new Tl({
|
16477
16486
|
onMutate: () => ({ context: { transactionOwnerId: tt, bundleOwnerId: e?.bundleOwnerId } }),
|
16478
16487
|
onQuery: () => ({ context: { transactionOwnerId: tt, bundleOwnerId: e?.bundleOwnerId } })
|
16479
16488
|
}), W = {
|
@@ -16506,13 +16515,13 @@ class md {
|
|
16506
16515
|
return W.renderableContextService = new nl(
|
16507
16516
|
W.layouts
|
16508
16517
|
), W.delayWorkflowStateSync = !0, { experienceOptions: W, index: F, options: T };
|
16509
|
-
}),
|
16510
|
-
k.setMap("transactionOwnerIds",
|
16511
|
-
const b =
|
16512
|
-
const { experienceOptions: E, options: P } =
|
16518
|
+
}), f = await Promise.all(p);
|
16519
|
+
k.setMap("transactionOwnerIds", g);
|
16520
|
+
const b = f.sort((C, E) => C.index - E.index).map(async (C) => {
|
16521
|
+
const { experienceOptions: E, options: P } = C, B = new Go(this, E);
|
16513
16522
|
return await B.getWorkflowManager().getInitializationPromise(), P.type !== "transaction" && this.customer && await B.attachCustomerDetails({ email: this.customer.emailAddress }), B;
|
16514
16523
|
}), I = await Promise.all(b);
|
16515
|
-
return I.forEach((
|
16524
|
+
return I.forEach((C) => C.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), I;
|
16516
16525
|
}
|
16517
16526
|
storeCustomer(t) {
|
16518
16527
|
const e = k.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
|
@@ -16860,7 +16869,7 @@ class Gl {
|
|
16860
16869
|
}
|
16861
16870
|
}
|
16862
16871
|
class wd {
|
16863
|
-
updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m,
|
16872
|
+
updateRecipient(t, e, a, n, i, s, o, l, c, d, A, u, h, m, g, p, f) {
|
16864
16873
|
throw new Error("Method not implemented.");
|
16865
16874
|
}
|
16866
16875
|
approveTransaction(t) {
|