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