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