@spiffcommerce/core 32.3.1 → 32.4.0-beta.02fb8112-9c0b-55b0-b7eb-873793f6a97a
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 +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +312 -296
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -337,20 +337,20 @@ class Kr {
|
|
337
337
|
d = await this.spiffClient.loggedInBearerToken();
|
338
338
|
} catch {
|
339
339
|
}
|
340
|
-
const A = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken,
|
340
|
+
const A = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken, p = s.applicationKey ?? c.applicationKey, g = s.bundleOwnerId;
|
341
341
|
try {
|
342
342
|
if (window && window.__SENTRY__) {
|
343
343
|
const f = window.__SENTRY__.hub;
|
344
344
|
if (f) {
|
345
345
|
const S = f.traceHeaders();
|
346
|
-
Object.entries(S).forEach(([
|
347
|
-
l[
|
346
|
+
Object.entries(S).forEach(([B, I]) => {
|
347
|
+
l[B] = I;
|
348
348
|
});
|
349
349
|
}
|
350
350
|
}
|
351
351
|
} catch {
|
352
352
|
}
|
353
|
-
return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m),
|
353
|
+
return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m), p && (l["X-Application-Key"] = p), g && (l.bundleOwnerId = g), l["Allow-Moonlight-Redirect"] = "true", {
|
354
354
|
headers: l
|
355
355
|
};
|
356
356
|
}), a = gr(({ operation: i, graphQLErrors: s, networkError: o }) => {
|
@@ -5342,7 +5342,7 @@ const M = () => {
|
|
5342
5342
|
viewBox: A,
|
5343
5343
|
width: u
|
5344
5344
|
}) => {
|
5345
|
-
const h = e || 0, m = 2 * (l?.scale || 1),
|
5345
|
+
const h = e || 0, m = 2 * (l?.scale || 1), p = A || { x: 0, y: 0, width: u, height: i }, g = `${p.x} ${p.y} ${p.width} ${p.height}`, f = M(), S = a.purpose === jt.FreeDesign && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ D("rect", { width: p.width, height: p.height, rx: h }) }) }), B = a.colorProfiles?.map((E, P) => (
|
5346
5346
|
/* @ts-ignore */
|
5347
5347
|
/* @__PURE__ */ D("color-profile", { name: E.name, xlinkHref: E.key, children: " " }, P)
|
5348
5348
|
)), I = r.map((E) => ({
|
@@ -5367,16 +5367,16 @@ const M = () => {
|
|
5367
5367
|
maxHeight: s,
|
5368
5368
|
position: c
|
5369
5369
|
},
|
5370
|
-
viewBox:
|
5370
|
+
viewBox: g,
|
5371
5371
|
children: [
|
5372
|
-
|
5372
|
+
B,
|
5373
5373
|
S,
|
5374
5374
|
!!n && /* @__PURE__ */ D(
|
5375
5375
|
"rect",
|
5376
5376
|
{
|
5377
5377
|
id: "layout-background",
|
5378
|
-
width:
|
5379
|
-
height:
|
5378
|
+
width: p.width,
|
5379
|
+
height: p.height,
|
5380
5380
|
fill: n,
|
5381
5381
|
rx: h
|
5382
5382
|
}
|
@@ -5406,10 +5406,10 @@ const M = () => {
|
|
5406
5406
|
/* @__PURE__ */ D(
|
5407
5407
|
"rect",
|
5408
5408
|
{
|
5409
|
-
x:
|
5410
|
-
y:
|
5411
|
-
width:
|
5412
|
-
height:
|
5409
|
+
x: p.x,
|
5410
|
+
y: p.y,
|
5411
|
+
width: p.width,
|
5412
|
+
height: p.height,
|
5413
5413
|
fill: "black"
|
5414
5414
|
}
|
5415
5415
|
),
|
@@ -5428,7 +5428,7 @@ const M = () => {
|
|
5428
5428
|
}
|
5429
5429
|
);
|
5430
5430
|
}, Yc = (n, t, e, a, r) => {
|
5431
|
-
const i = ft(r), s = e / 2, o = a / 2, l = n + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o,
|
5431
|
+
const i = ft(r), s = e / 2, o = a / 2, l = n + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, p = o, g = u * A - m * d, f = h * A - p * d, S = u * d + m * A, B = h * d + p * A, I = Math.max(Math.abs(g), Math.abs(f)), C = Math.max(Math.abs(S), Math.abs(B));
|
5432
5432
|
return {
|
5433
5433
|
minX: l - I,
|
5434
5434
|
maxX: l + I,
|
@@ -5590,15 +5590,15 @@ const M = () => {
|
|
5590
5590
|
/* @__PURE__ */ D("feFuncB", { type: "discrete", tableValues: r() })
|
5591
5591
|
] })
|
5592
5592
|
] }) }) }), s = n.rotation || 0, o = ft(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
|
5593
|
-
const A = n.pattern?.x || 0, u = n.pattern?.y || 0, h = n.pattern?.width || 0, m = n.pattern?.height || 0,
|
5593
|
+
const A = n.pattern?.x || 0, u = n.pattern?.y || 0, h = n.pattern?.width || 0, m = n.pattern?.height || 0, p = n.pattern?.scaleX || 1, g = n.pattern?.scaleY || 1, f = n.pattern?.rotation || 0;
|
5594
5594
|
return [n.pattern?.svg ? {
|
5595
5595
|
id: `${t}-contents`,
|
5596
5596
|
type: x.Illustration,
|
5597
5597
|
x: A,
|
5598
5598
|
y: u,
|
5599
5599
|
rotation: f,
|
5600
|
-
width: h *
|
5601
|
-
height: m *
|
5600
|
+
width: h * p,
|
5601
|
+
height: m * g,
|
5602
5602
|
src: a(),
|
5603
5603
|
svg: n.pattern?.svg,
|
5604
5604
|
colors: n.pattern?.colors
|
@@ -5608,8 +5608,8 @@ const M = () => {
|
|
5608
5608
|
x: A,
|
5609
5609
|
y: u,
|
5610
5610
|
rotation: f,
|
5611
|
-
width: h *
|
5612
|
-
height: m *
|
5611
|
+
width: h * p,
|
5612
|
+
height: m * g,
|
5613
5613
|
src: a()
|
5614
5614
|
}];
|
5615
5615
|
};
|
@@ -5733,31 +5733,31 @@ const as = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5733
5733
|
dn(d.innerHTML).stylesheet?.rules.forEach((u) => {
|
5734
5734
|
if (u.type === "font-face" && u.declarations) {
|
5735
5735
|
const h = u.declarations.find(
|
5736
|
-
(
|
5737
|
-
)?.value,
|
5738
|
-
h &&
|
5736
|
+
(g) => g.property === "font-family"
|
5737
|
+
)?.value, p = u.declarations.find((g) => g.property === "src")?.value?.match(/'(https.*?)'/)?.[1];
|
5738
|
+
h && p && r.set(h, p);
|
5739
5739
|
}
|
5740
5740
|
});
|
5741
5741
|
});
|
5742
5742
|
const s = e.querySelectorAll("tspan");
|
5743
5743
|
for (let d = 0; d < s.length; d++) {
|
5744
|
-
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"),
|
5744
|
+
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await Nt(r.get(m)), g = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"), B = p.getPath(
|
5745
5745
|
A.innerHTML,
|
5746
5746
|
0,
|
5747
5747
|
0,
|
5748
5748
|
parseInt(u.getAttribute("font-size") ?? "72")
|
5749
|
-
), I =
|
5749
|
+
), I = B.getBoundingBox().x2 - B.getBoundingBox().x1;
|
5750
5750
|
let C = 0;
|
5751
5751
|
const E = A.getAttribute("text-anchor");
|
5752
5752
|
E === "middle" ? C = I / 2 : E === "end" && (C = I);
|
5753
|
-
const P =
|
5753
|
+
const P = p.getPath(
|
5754
5754
|
A.innerHTML,
|
5755
5755
|
parseFloat(A.getAttribute("x") ?? "0") - C,
|
5756
5756
|
parseFloat(A.getAttribute("y") ?? "0"),
|
5757
5757
|
parseInt(u.getAttribute("font-size") ?? "72")
|
5758
5758
|
);
|
5759
|
-
P.fill =
|
5760
|
-
const
|
5759
|
+
P.fill = g, P.stroke = f, P.strokeWidth = parseFloat(S ?? "0");
|
5760
|
+
const b = P.toSVG(2), Q = t.parseFromString(b, "image/svg+xml").firstElementChild;
|
5761
5761
|
h.appendChild(Q);
|
5762
5762
|
}
|
5763
5763
|
return e.querySelectorAll("text").forEach((d) => d.remove()), It().serializeToString(a);
|
@@ -5804,8 +5804,8 @@ const as = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5804
5804
|
l = Math.max(l, mt(d, e, a));
|
5805
5805
|
let u = c + 1, h = !0;
|
5806
5806
|
for (; u < s.length && h; ) {
|
5807
|
-
const m = s[u],
|
5808
|
-
|
5807
|
+
const m = s[u], p = mt(`${A.join(" ")} ${m}`, e, a);
|
5808
|
+
p <= t ? (A.push(m), l = Math.max(l, p), u++) : h = !1;
|
5809
5809
|
}
|
5810
5810
|
o.push(A.join(" ")), c = u;
|
5811
5811
|
}
|
@@ -5964,12 +5964,12 @@ const ds = (n) => {
|
|
5964
5964
|
},
|
5965
5965
|
stroke: A,
|
5966
5966
|
strokeWidth: u,
|
5967
|
-
children: n.curved ? /* @__PURE__ */ D(us, { text: c, curvedPathId: i, align: n.align }) : d.map((m,
|
5967
|
+
children: n.curved ? /* @__PURE__ */ D(us, { text: c, curvedPathId: i, align: n.align }) : d.map((m, p) => /* @__PURE__ */ D(
|
5968
5968
|
As,
|
5969
5969
|
{
|
5970
5970
|
align: n.vertical ? "center" : n.align,
|
5971
5971
|
fontSize: n.fontSize,
|
5972
|
-
thisLineIdx:
|
5972
|
+
thisLineIdx: p,
|
5973
5973
|
amountLines: d.length,
|
5974
5974
|
text: m,
|
5975
5975
|
textboxHeight: n.height,
|
@@ -5979,7 +5979,7 @@ const ds = (n) => {
|
|
5979
5979
|
verticalAlign: n.verticalAlign,
|
5980
5980
|
fontData: n.fontData
|
5981
5981
|
},
|
5982
|
-
|
5982
|
+
p
|
5983
5983
|
))
|
5984
5984
|
}
|
5985
5985
|
) }) })
|
@@ -6342,7 +6342,7 @@ const ne = (n) => {
|
|
6342
6342
|
fetch: rt
|
6343
6343
|
}), u = s.getAttribute("width"), h = s.getAttribute("height"), m = 2048;
|
6344
6344
|
if (h && u) {
|
6345
|
-
const
|
6345
|
+
const p = parseFloat(h), f = parseFloat(u) / p;
|
6346
6346
|
f > 1 ? A.resize(m, m / f) : A.resize(m * f, m);
|
6347
6347
|
} else
|
6348
6348
|
A.resize(m, m);
|
@@ -6366,7 +6366,7 @@ const ne = (n) => {
|
|
6366
6366
|
if (e && t === x.Illustration) {
|
6367
6367
|
const l = await ot(await Wn(e)), u = dt().parseFromString(l.svg, "image/svg+xml").firstElementChild.getAttribute("viewBox");
|
6368
6368
|
if (!u) throw new Error("SVG missing viewBox.");
|
6369
|
-
const h = o.height, m = u.split(" "),
|
6369
|
+
const h = o.height, m = u.split(" "), p = parseFloat(m[2]) || 1, g = parseFloat(m[3]) || 1, f = p / g;
|
6370
6370
|
o.height = o.width / f, o.top += (h - o.height) / 2;
|
6371
6371
|
}
|
6372
6372
|
if (e && t === x.Image) {
|
@@ -7366,18 +7366,18 @@ class bs {
|
|
7366
7366
|
}
|
7367
7367
|
async regenerateQRCode(t, e, a, r) {
|
7368
7368
|
const i = async () => {
|
7369
|
-
const h = (await Ie([e]))[0], m = h?.versions?.find((
|
7369
|
+
const h = (await Ie([e]))[0], m = h?.versions?.find((p) => p.name === "mpeg4")?.link;
|
7370
7370
|
return { asset: h, link: m };
|
7371
7371
|
}, s = await new Promise((h, m) => {
|
7372
7372
|
new Hn(
|
7373
7373
|
async () => !!(await i()).link,
|
7374
7374
|
async () => {
|
7375
|
-
const
|
7376
|
-
if (!
|
7377
|
-
throw new Yt(
|
7375
|
+
const p = await i();
|
7376
|
+
if (!p.link || !p.link)
|
7377
|
+
throw new Yt(p.asset);
|
7378
7378
|
h({
|
7379
7379
|
rel: "mpeg4",
|
7380
|
-
href:
|
7380
|
+
href: p.link
|
7381
7381
|
});
|
7382
7382
|
},
|
7383
7383
|
() => {
|
@@ -7712,18 +7712,18 @@ class Fe {
|
|
7712
7712
|
i && i(!0);
|
7713
7713
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
7714
7714
|
t.data.regions.map(async (h, m) => {
|
7715
|
-
const
|
7716
|
-
p,
|
7715
|
+
const p = await Ue(l[m]), g = o.getImageData(), f = a.map((P) => new Bt(P.id)), S = g ? Ba(
|
7717
7716
|
g,
|
7717
|
+
p,
|
7718
7718
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
7719
7719
|
t.data.forceImageCover
|
7720
|
-
) : void 0,
|
7720
|
+
) : void 0, B = g ? {
|
7721
7721
|
id: M(),
|
7722
|
-
src:
|
7722
|
+
src: g.src,
|
7723
7723
|
x: S?.x || 0,
|
7724
7724
|
y: S?.y || 0,
|
7725
|
-
width:
|
7726
|
-
height:
|
7725
|
+
width: g.width,
|
7726
|
+
height: g.height,
|
7727
7727
|
scaleX: S?.zoom || 1,
|
7728
7728
|
scaleY: S?.zoom || 1,
|
7729
7729
|
rotation: 0
|
@@ -7732,8 +7732,8 @@ class Fe {
|
|
7732
7732
|
throw new Y(h);
|
7733
7733
|
return {
|
7734
7734
|
command: this.getCreateElementCommand(I, h, E, {
|
7735
|
-
frameData:
|
7736
|
-
pattern:
|
7735
|
+
frameData: p,
|
7736
|
+
pattern: B,
|
7737
7737
|
disablePlaceholder: t.data.disablePlaceholder,
|
7738
7738
|
stepName: t.stepName
|
7739
7739
|
}),
|
@@ -7924,12 +7924,12 @@ class Bs {
|
|
7924
7924
|
r().map((h) => h.layoutState)
|
7925
7925
|
), o = { ...s.colors }, l = {};
|
7926
7926
|
Object.entries(o).forEach(([h, m]) => {
|
7927
|
-
const
|
7928
|
-
|
7927
|
+
const p = { browserValue: m.browserValue, pmsValue: m.pmsValue }, g = m.spotColor;
|
7928
|
+
g && (p.spotColor = { profileName: g.profileName, namedColor: g.namedColor }), l[h] = p;
|
7929
7929
|
});
|
7930
7930
|
for (const [h, m] of i.entries()) {
|
7931
|
-
const
|
7932
|
-
o[h] = { browserValue:
|
7931
|
+
const p = typeof m == "string" ? m : m.browserValue, g = typeof m == "string" ? void 0 : m.pmsValue;
|
7932
|
+
o[h] = { browserValue: p, spotColor: o[h]?.spotColor, pmsValue: g }, l[h] = { browserValue: p };
|
7933
7933
|
}
|
7934
7934
|
let c = Array.from(Object.values(o)).map((h) => h.browserValue);
|
7935
7935
|
const d = t.data.colorOption;
|
@@ -7972,10 +7972,10 @@ class Bs {
|
|
7972
7972
|
const S = i.getLayouts().find((I) => I.panelId === f.panelId);
|
7973
7973
|
if (!S)
|
7974
7974
|
throw new Y(f);
|
7975
|
-
const
|
7975
|
+
const B = M();
|
7976
7976
|
return {
|
7977
|
-
regionElement: { id:
|
7978
|
-
command: this.getCreateElementCommand(
|
7977
|
+
regionElement: { id: B, region: f },
|
7978
|
+
command: this.getCreateElementCommand(B, f, S, {
|
7979
7979
|
stepName: t.stepName,
|
7980
7980
|
src: l,
|
7981
7981
|
objectURL: d,
|
@@ -7983,11 +7983,11 @@ class Bs {
|
|
7983
7983
|
})
|
7984
7984
|
};
|
7985
7985
|
}, u = t.data.regions.map(A), m = [...u.map((f) => f.command), ...s];
|
7986
|
-
let
|
7987
|
-
const
|
7988
|
-
return
|
7989
|
-
|
7990
|
-
}), i.updateMetadata(t.stepName, { colors:
|
7986
|
+
let p = Array.from(Object.values(c.colors)).map((f) => f.browserValue);
|
7987
|
+
const g = t.data.colorOption;
|
7988
|
+
return g && g.variants?.forEach((f) => {
|
7989
|
+
p = p.map((S) => S.toLowerCase() === f.color?.toLowerCase() ? f.name : S);
|
7990
|
+
}), i.updateMetadata(t.stepName, { colors: p }), {
|
7991
7991
|
command: new R(m),
|
7992
7992
|
followup: async () => {
|
7993
7993
|
await i.setSelectionsAndElements(
|
@@ -8013,9 +8013,9 @@ class Bs {
|
|
8013
8013
|
);
|
8014
8014
|
}
|
8015
8015
|
if (t.data.colorPickerEnabled) {
|
8016
|
-
const S = await this.availableColors(t, i) || [],
|
8016
|
+
const S = await this.availableColors(t, i) || [], B = Object.keys(c.colors), I = S.length === 1 && B.length === 1;
|
8017
8017
|
if (I) {
|
8018
|
-
const C = S[0], E =
|
8018
|
+
const C = S[0], E = B[0];
|
8019
8019
|
await this.changeColors(
|
8020
8020
|
t,
|
8021
8021
|
u.map((P) => P.regionElement),
|
@@ -8071,8 +8071,8 @@ class Is {
|
|
8071
8071
|
async () => {
|
8072
8072
|
const h = e.getModelContainer();
|
8073
8073
|
if (h) {
|
8074
|
-
const m = t.data.targetMaterials.map((
|
8075
|
-
|
8074
|
+
const m = t.data.targetMaterials.map((p) => h.applyMaterialVariant(
|
8075
|
+
p,
|
8076
8076
|
l.id || "",
|
8077
8077
|
A || {}
|
8078
8078
|
));
|
@@ -8227,11 +8227,11 @@ class Ds {
|
|
8227
8227
|
return console.error("Missing configuration."), null;
|
8228
8228
|
a.updateStorage(t.stepName, { text: e }), a.updateMetadata(t.stepName, { text: e });
|
8229
8229
|
const c = (d, A, u) => {
|
8230
|
-
const h = u || M(),
|
8231
|
-
if (!
|
8230
|
+
const h = u || M(), p = a.getLayouts().find((f) => f.panelId === A.panelId);
|
8231
|
+
if (!p)
|
8232
8232
|
return console.error(`Can not find layout for region: ${A.panelId}`), null;
|
8233
|
-
const
|
8234
|
-
return u &&
|
8233
|
+
const g = [];
|
8234
|
+
return u && g.push(new Bt(h)), g.push(
|
8235
8235
|
new z(
|
8236
8236
|
{
|
8237
8237
|
stepRegion: A,
|
@@ -8249,12 +8249,12 @@ class Ds {
|
|
8249
8249
|
layerIndex: A.layerIndex,
|
8250
8250
|
immutable: A.immutable
|
8251
8251
|
},
|
8252
|
-
|
8252
|
+
p
|
8253
8253
|
)
|
8254
8254
|
), {
|
8255
8255
|
id: h,
|
8256
8256
|
region: A,
|
8257
|
-
command: new R(
|
8257
|
+
command: new R(g)
|
8258
8258
|
};
|
8259
8259
|
};
|
8260
8260
|
if (i.length > 0) {
|
@@ -8353,7 +8353,7 @@ class Fs {
|
|
8353
8353
|
return console.error("No URL for picture!"), null;
|
8354
8354
|
r(!0), t.mandatory && a.setMandatoryFulfilled(t.stepName, !1);
|
8355
8355
|
const l = a.getRegionElements(t.stepName).map((A) => new Bt(A.id)), c = (A) => {
|
8356
|
-
const h = a.getLayouts().find((
|
8356
|
+
const h = a.getLayouts().find((p) => p.panelId === A.panelId);
|
8357
8357
|
if (!h)
|
8358
8358
|
throw new Y(A);
|
8359
8359
|
const m = M();
|
@@ -8551,7 +8551,7 @@ class ks {
|
|
8551
8551
|
const h = i.find((S) => S.panelId === u.panelId);
|
8552
8552
|
if (!h)
|
8553
8553
|
throw new Y(u);
|
8554
|
-
const m = o(),
|
8554
|
+
const m = o(), p = `
|
8555
8555
|
<svg
|
8556
8556
|
xmlns="http://www.w3.org/2000/svg"
|
8557
8557
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
@@ -8571,8 +8571,8 @@ class ks {
|
|
8571
8571
|
fill="${m}"
|
8572
8572
|
/>
|
8573
8573
|
</svg>
|
8574
|
-
`,
|
8575
|
-
|
8574
|
+
`, g = {};
|
8575
|
+
g[this.shapeFillId] = { browserValue: m };
|
8576
8576
|
const f = M();
|
8577
8577
|
return {
|
8578
8578
|
id: f,
|
@@ -8581,9 +8581,9 @@ class ks {
|
|
8581
8581
|
{
|
8582
8582
|
stepRegion: u,
|
8583
8583
|
stepName: t.stepName,
|
8584
|
-
colors:
|
8584
|
+
colors: g,
|
8585
8585
|
id: f,
|
8586
|
-
svg:
|
8586
|
+
svg: p,
|
8587
8587
|
type: x.Illustration,
|
8588
8588
|
y: u.top,
|
8589
8589
|
x: u.left,
|
@@ -8654,12 +8654,12 @@ const Ts = new Ms(), Ke = (n, t, e, a, r) => {
|
|
8654
8654
|
const A = Math.max(...o);
|
8655
8655
|
if (A <= n.width)
|
8656
8656
|
return [i, A];
|
8657
|
-
const u = o.reduce((
|
8658
|
-
let m = !1,
|
8659
|
-
for (; !m &&
|
8660
|
-
|
8661
|
-
const
|
8662
|
-
f[0] <= n.width && (i = [...i.slice(0, u), ...
|
8657
|
+
const u = o.reduce((g, f, S, B) => f > B[g] ? S : g, 0), h = i[u];
|
8658
|
+
let m = !1, p = h.length;
|
8659
|
+
for (; !m && p > -1; ) {
|
8660
|
+
p = h.lastIndexOf(" ", p - 1);
|
8661
|
+
const g = [h.slice(0, p), h.slice(p + 1)], f = g.map((B) => mt(B, a, r));
|
8662
|
+
f[0] <= n.width && (i = [...i.slice(0, u), ...g, ...i.slice(u + 1)], o = [
|
8663
8663
|
...o.slice(0, u),
|
8664
8664
|
...f,
|
8665
8665
|
...o.slice(u + 1)
|
@@ -8749,11 +8749,11 @@ class Qs {
|
|
8749
8749
|
let A = t.data.defaultText || "";
|
8750
8750
|
const u = e.getWorkflowExperience().getBundle();
|
8751
8751
|
if (u && t.globalPropertyAspectConfigurations) {
|
8752
|
-
const
|
8753
|
-
(
|
8752
|
+
const p = u.getGlobalPropertyConfiguration()?.aspects?.find(
|
8753
|
+
(g) => g.type === U.Text && t.globalPropertyAspectConfigurations?.map((f) => f.aspectName).includes(g.name)
|
8754
8754
|
);
|
8755
|
-
if (
|
8756
|
-
const f = u.getGlobalPropertyStateManager().getAspect(
|
8755
|
+
if (p) {
|
8756
|
+
const f = u.getGlobalPropertyStateManager().getAspect(p.name);
|
8757
8757
|
f && (A = f);
|
8758
8758
|
}
|
8759
8759
|
}
|
@@ -8932,9 +8932,9 @@ class Qs {
|
|
8932
8932
|
{ size: a.data.size, minSize: a.data.minSize, maxSize: a.data.maxSize }
|
8933
8933
|
);
|
8934
8934
|
d.set(u.id, h), A.set(u.id, m);
|
8935
|
-
const
|
8935
|
+
const p = a.data.curved ? o : (m || []).join(`
|
8936
8936
|
`);
|
8937
|
-
c.push(this.generateTextChangeCommandsForRegion(h, a.data, u.id,
|
8937
|
+
c.push(this.generateTextChangeCommandsForRegion(h, a.data, u.id, p));
|
8938
8938
|
}
|
8939
8939
|
return !a.data.curved && e.length > 0 && !Array.from(A.values()).every((h) => h) ? (l.errorData || (l.errorData = {}), l.errorData.doesNotFit = !0, l) : (r.updateStorage(a.stepName, { text: t }), r.updateMetadata(a.stepName, {
|
8940
8940
|
text: o
|
@@ -8973,16 +8973,16 @@ class Qs {
|
|
8973
8973
|
if (l && c) {
|
8974
8974
|
const d = l.variants?.find((A) => A.id === c);
|
8975
8975
|
if (d) {
|
8976
|
-
const A = await this.fontDataFromVariant(d), u = o.map((
|
8976
|
+
const A = await this.fontDataFromVariant(d), u = o.map((g) => ({ id: g.id, region: g.stepRegion })), h = r.storage?.color;
|
8977
8977
|
let m = r.storage?.text;
|
8978
|
-
const
|
8979
|
-
if (
|
8980
|
-
const f =
|
8981
|
-
(S) => S.type === U.Text && t.globalPropertyAspectConfigurations?.map((
|
8978
|
+
const p = e.getWorkflowExperience().getBundle();
|
8979
|
+
if (p && t.globalPropertyAspectConfigurations) {
|
8980
|
+
const f = p.getGlobalPropertyConfiguration()?.aspects?.find(
|
8981
|
+
(S) => S.type === U.Text && t.globalPropertyAspectConfigurations?.map((B) => B.aspectName).includes(S.name)
|
8982
8982
|
);
|
8983
8983
|
if (f) {
|
8984
|
-
const
|
8985
|
-
|
8984
|
+
const B = p.getGlobalPropertyStateManager().getAspect(f.name);
|
8985
|
+
B && (m = B);
|
8986
8986
|
}
|
8987
8987
|
}
|
8988
8988
|
if (await e.setSelectionsAndElements(
|
@@ -8991,15 +8991,15 @@ class Qs {
|
|
8991
8991
|
u,
|
8992
8992
|
async () => {
|
8993
8993
|
e.updateMetadata(t.stepName, { color: h, text: m }), e.updateStorage(t.stepName, { text: m, inputText: m });
|
8994
|
-
const
|
8994
|
+
const g = o.map((S) => new ja(S.id, A)), f = new R(g);
|
8995
8995
|
e.getCommandDispatcher()(f);
|
8996
8996
|
}
|
8997
8997
|
), o.length === 0 && l) {
|
8998
|
-
const
|
8999
|
-
if (
|
8998
|
+
const g = j.getDefaultVariant(l);
|
8999
|
+
if (g) {
|
9000
9000
|
const f = await this.selectVariantCommand(
|
9001
9001
|
t,
|
9002
|
-
|
9002
|
+
g,
|
9003
9003
|
{ text: m },
|
9004
9004
|
[],
|
9005
9005
|
e,
|
@@ -9011,13 +9011,13 @@ class Qs {
|
|
9011
9011
|
e.getCommandDispatcher()(f.command);
|
9012
9012
|
}
|
9013
9013
|
} else {
|
9014
|
-
const { command:
|
9014
|
+
const { command: g } = G.updateInputText(
|
9015
9015
|
m || "",
|
9016
9016
|
o,
|
9017
9017
|
t,
|
9018
9018
|
e
|
9019
9019
|
);
|
9020
|
-
|
9020
|
+
g && e.getCommandDispatcher()(g);
|
9021
9021
|
}
|
9022
9022
|
}
|
9023
9023
|
}
|
@@ -9033,7 +9033,7 @@ class Qs {
|
|
9033
9033
|
if (o.length === 0 && l) {
|
9034
9034
|
const m = j.getDefaultVariant(l);
|
9035
9035
|
if (m) {
|
9036
|
-
const
|
9036
|
+
const p = await this.selectVariantCommand(
|
9037
9037
|
t,
|
9038
9038
|
m,
|
9039
9039
|
{ text: h },
|
@@ -9044,7 +9044,7 @@ class Qs {
|
|
9044
9044
|
() => {
|
9045
9045
|
}
|
9046
9046
|
);
|
9047
|
-
e.getCommandDispatcher()(
|
9047
|
+
e.getCommandDispatcher()(p.command);
|
9048
9048
|
}
|
9049
9049
|
} else {
|
9050
9050
|
const { command: m } = G.updateInputText(
|
@@ -9094,16 +9094,16 @@ class Qs {
|
|
9094
9094
|
async selectVariantCommand(t, e, a, r, i, s, o, l, c) {
|
9095
9095
|
const d = i.markUpdatePending(), A = await this.fontDataFromVariant(e);
|
9096
9096
|
if (r.length > 0) {
|
9097
|
-
const u = r.map((
|
9097
|
+
const u = r.map((p) => new ja(p.id, A));
|
9098
9098
|
if (l) {
|
9099
|
-
const
|
9100
|
-
u.push(...
|
9099
|
+
const p = r.map((g) => new Ye(g.id, l));
|
9100
|
+
u.push(...p);
|
9101
9101
|
}
|
9102
9102
|
if (c) {
|
9103
|
-
const
|
9104
|
-
(
|
9103
|
+
const p = r.map(
|
9104
|
+
(g) => new Je(g.id, c, t.data.strokeThickness)
|
9105
9105
|
);
|
9106
|
-
u.push(...
|
9106
|
+
u.push(...p);
|
9107
9107
|
}
|
9108
9108
|
const h = await this.changeInputTextWithRegion(
|
9109
9109
|
t,
|
@@ -9140,18 +9140,18 @@ class Qs {
|
|
9140
9140
|
a?.customiseAllText ?? !1,
|
9141
9141
|
s,
|
9142
9142
|
o
|
9143
|
-
), m = u.flatMap((
|
9143
|
+
), m = u.flatMap((g) => g.commands);
|
9144
9144
|
if (l) {
|
9145
|
-
const
|
9145
|
+
const g = u.map(
|
9146
9146
|
(f) => new Ye(f.regionElement.id, l)
|
9147
9147
|
);
|
9148
|
-
m.push(...
|
9148
|
+
m.push(...g);
|
9149
9149
|
}
|
9150
9150
|
if (c) {
|
9151
|
-
const
|
9151
|
+
const g = r.map(
|
9152
9152
|
(f) => new Je(f.id, c, t.data.strokeThickness)
|
9153
9153
|
);
|
9154
|
-
m.push(...
|
9154
|
+
m.push(...g);
|
9155
9155
|
}
|
9156
9156
|
return h && m.push(h), {
|
9157
9157
|
command: new R(m),
|
@@ -9173,26 +9173,26 @@ class Qs {
|
|
9173
9173
|
if (!a || !a.regions)
|
9174
9174
|
throw new Error("Step data not supplied");
|
9175
9175
|
const o = i.text || a.defaultText || "", l = Ft(o, s), c = this.getProcessedInput(l, a, !1), d = async (u) => {
|
9176
|
-
const m = s.getLayouts().find((
|
9176
|
+
const m = s.getLayouts().find((g) => g.panelId === u.panelId), p = M();
|
9177
9177
|
try {
|
9178
9178
|
if (!m)
|
9179
9179
|
throw new ke("Failed to find layout for region: " + u.panelId);
|
9180
|
-
const
|
9180
|
+
const g = a.colorOption;
|
9181
9181
|
let f;
|
9182
|
-
if (
|
9183
|
-
const tt =
|
9184
|
-
f = this.createTextFillSpotColor(
|
9185
|
-
colorProfileAssetKey:
|
9182
|
+
if (g && g.variants) {
|
9183
|
+
const tt = g.variants.find((et) => et.id === g.defaultVariant?.id) || g.variants[0];
|
9184
|
+
f = this.createTextFillSpotColor(g, tt), s.updateStorage(t, {
|
9185
|
+
colorProfileAssetKey: g.colorProfile?.key
|
9186
9186
|
});
|
9187
9187
|
}
|
9188
|
-
const S = await this.getDefaultColor(a),
|
9188
|
+
const S = await this.getDefaultColor(a), B = S || "#000000", I = {
|
9189
9189
|
stepRegion: u,
|
9190
9190
|
stepName: t,
|
9191
9191
|
align: this.textAlign(a),
|
9192
|
-
fill: i.color ? i.color :
|
9192
|
+
fill: i.color ? i.color : B,
|
9193
9193
|
fontSize: a.size || _e,
|
9194
9194
|
fontData: r,
|
9195
|
-
id:
|
9195
|
+
id: p,
|
9196
9196
|
layer: u.layer,
|
9197
9197
|
layerIndex: u.layerIndex,
|
9198
9198
|
rotation: u.rotation,
|
@@ -9211,7 +9211,7 @@ class Qs {
|
|
9211
9211
|
fillSpotColorDefinition: f
|
9212
9212
|
}, C = [], E = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
|
9213
9213
|
if (!I.fontData) throw new V("Failed to resolve font data for text.");
|
9214
|
-
const [
|
9214
|
+
const [b, F] = Ce(
|
9215
9215
|
I.fontSize,
|
9216
9216
|
I.fontData,
|
9217
9217
|
{
|
@@ -9225,21 +9225,21 @@ class Qs {
|
|
9225
9225
|
[c],
|
9226
9226
|
{ size: a.size, minSize: a.minSize, maxSize: a.maxSize }
|
9227
9227
|
);
|
9228
|
-
E.set(I.id,
|
9228
|
+
E.set(I.id, b), P.set(I.id, F);
|
9229
9229
|
const Q = a.curved || a.vertical ? c : (F || []).join(`
|
9230
9230
|
`);
|
9231
9231
|
C.push(
|
9232
|
-
this.generateTextChangeCommandsForRegion(
|
9232
|
+
this.generateTextChangeCommandsForRegion(b, a, I.id, Q)
|
9233
9233
|
);
|
9234
9234
|
const T = new z(I, m);
|
9235
9235
|
return {
|
9236
|
-
regionElement: { id:
|
9236
|
+
regionElement: { id: p, region: u },
|
9237
9237
|
commands: [T, ...C],
|
9238
9238
|
newElement: I,
|
9239
9239
|
fontData: r
|
9240
9240
|
};
|
9241
|
-
} catch (
|
9242
|
-
throw console.log(
|
9241
|
+
} catch (g) {
|
9242
|
+
throw console.log(g), new xe("Error adding font to region");
|
9243
9243
|
}
|
9244
9244
|
}, A = await Promise.all(a.regions.map(d)).catch((u) => {
|
9245
9245
|
throw u instanceof xe ? (Ts.setLatestToast("Failed to load font.", Le.Error), u) : u instanceof ke ? u : new Error(u);
|
@@ -9269,7 +9269,7 @@ class Qs {
|
|
9269
9269
|
* @deprecated
|
9270
9270
|
*/
|
9271
9271
|
async changeInputTextWithRegion(t, e, a, r, i, s, o, l, c, d) {
|
9272
|
-
const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = Ft(A, s), h = this.getProcessedInput(u, t.data, o), m = s.getRegionElements(t.stepName),
|
9272
|
+
const A = (r || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = Ft(A, s), h = this.getProcessedInput(u, t.data, o), m = s.getRegionElements(t.stepName), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
9273
9273
|
for (const C of m)
|
9274
9274
|
if (C.region) {
|
9275
9275
|
const [E, P] = Ce(
|
@@ -9279,20 +9279,20 @@ class Qs {
|
|
9279
9279
|
[h],
|
9280
9280
|
{ size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
|
9281
9281
|
);
|
9282
|
-
|
9282
|
+
p.set(C.id, E), g.set(C.id, P);
|
9283
9283
|
}
|
9284
9284
|
const S = (() => {
|
9285
9285
|
if (t.data && t.data.maxLength && h.length > t.data.maxLength)
|
9286
9286
|
return d && d(!0), { info: "0" };
|
9287
9287
|
const C = s.getProfanities(), E = na(h.toLowerCase());
|
9288
9288
|
for (const P of E)
|
9289
|
-
for (const
|
9290
|
-
const F = C[
|
9289
|
+
for (const b in C) {
|
9290
|
+
const F = C[b].toLowerCase().replace(/\s/g, "");
|
9291
9291
|
if (P === F)
|
9292
9292
|
return l(!0), { error: "Blocked profanity." };
|
9293
9293
|
}
|
9294
9294
|
return !t.data.vertical && !t.data.allowNewlines && (h.includes(`
|
9295
|
-
`) || h.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(
|
9295
|
+
`) || h.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((b) => b) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - h.length).toString() });
|
9296
9296
|
})();
|
9297
9297
|
if (S.error) {
|
9298
9298
|
c(S.error);
|
@@ -9303,20 +9303,20 @@ class Qs {
|
|
9303
9303
|
s.updateStorage(t.stepName, { text: A }), s.updateMetadata(t.stepName, {
|
9304
9304
|
text: this.injectReplaceableText(A, t.data)
|
9305
9305
|
}), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
|
9306
|
-
const
|
9306
|
+
const B = [];
|
9307
9307
|
for (const C of m) {
|
9308
|
-
const E = t.data.curved ? h : (
|
9308
|
+
const E = t.data.curved ? h : (g.get(C.id) || []).join(`
|
9309
9309
|
`);
|
9310
|
-
|
9310
|
+
B.push(
|
9311
9311
|
this.generateTextChangeCommandsForRegion(
|
9312
|
-
|
9312
|
+
p.get(C.id) || 1,
|
9313
9313
|
t.data,
|
9314
9314
|
C.id,
|
9315
9315
|
E
|
9316
9316
|
)
|
9317
9317
|
);
|
9318
9318
|
}
|
9319
|
-
return new R(
|
9319
|
+
return new R(B);
|
9320
9320
|
}
|
9321
9321
|
}
|
9322
9322
|
const G = new Qs();
|
@@ -9475,35 +9475,35 @@ class Ws extends Rs {
|
|
9475
9475
|
return this.svgElement(t, e);
|
9476
9476
|
}
|
9477
9477
|
svgElement(t, e) {
|
9478
|
-
const a = ns(Os), i = t !== "" ? ((
|
9479
|
-
const
|
9480
|
-
|
9478
|
+
const a = ns(Os), i = t !== "" ? ((B) => B.charAt(0).toUpperCase() + B.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
|
9479
|
+
const B = at("g");
|
9480
|
+
B.classList.add("module-text-group");
|
9481
9481
|
const I = at("defs");
|
9482
|
-
|
9482
|
+
B.appendChild(I), I.appendChild(Us(0, 2, 2, "shadow"));
|
9483
9483
|
const C = at("path");
|
9484
9484
|
C.setAttribute("d", d), C.setAttribute("stroke", "black"), C.setAttribute("stroke-width", "3"), I.appendChild(C);
|
9485
9485
|
const E = at("g");
|
9486
|
-
E.classList.add("module-layer0"),
|
9486
|
+
E.classList.add("module-layer0"), B.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = C.outerHTML;
|
9487
9487
|
const P = at("g");
|
9488
|
-
P.classList.add("module-layer1"),
|
9489
|
-
const
|
9490
|
-
|
9488
|
+
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;
|
9489
|
+
const b = at("g");
|
9490
|
+
b.classList.add("module-layer2"), B.appendChild(b), b.setAttribute("fill", "rgb(255,209,0)"), b.setAttribute("transform", "translate(1,-0.1)"), b.innerHTML = o;
|
9491
9491
|
const F = at("g");
|
9492
|
-
return F.classList.add("module-layer3"),
|
9492
|
+
return F.classList.add("module-layer3"), B.appendChild(F), F.setAttribute("fill", "white"), F.innerHTML = o, new Gs(B).transform(([T, tt]) => [T, tt + (c / 2 - T) ** 2 / (c * 6)]), B;
|
9493
9493
|
}, u = at("g");
|
9494
9494
|
u.classList.add("module-root");
|
9495
9495
|
const h = at("defs");
|
9496
9496
|
u.appendChild(h);
|
9497
9497
|
const m = at("g");
|
9498
9498
|
m.classList.add("module-bounds"), u.appendChild(m);
|
9499
|
-
const
|
9500
|
-
|
9501
|
-
const
|
9502
|
-
|
9499
|
+
const p = $s(e.height, e.width);
|
9500
|
+
p.setAttribute("opacity", "0"), m.appendChild(p);
|
9501
|
+
const g = at("g");
|
9502
|
+
g.classList.add("module-text-enclosure"), u.appendChild(g);
|
9503
9503
|
const f = A();
|
9504
|
-
|
9504
|
+
g.appendChild(f);
|
9505
9505
|
const S = yr(d);
|
9506
|
-
return Vs(
|
9506
|
+
return Vs(g, S, e.height, e.width, 0.35, 0.65), Ls(u.outerHTML);
|
9507
9507
|
}
|
9508
9508
|
}
|
9509
9509
|
async function Zn(n) {
|
@@ -10247,19 +10247,19 @@ class _a extends Mn {
|
|
10247
10247
|
}
|
10248
10248
|
}
|
10249
10249
|
class Bo {
|
10250
|
-
constructor(t, e, a, r, i, s, o, l, c, d, A, u, h, m = !1,
|
10250
|
+
constructor(t, e, a, r, i, s, o, l, c, d, A, u, h, m = !1, p, g = !1, f = !1, S = !1) {
|
10251
10251
|
this.workflowStatePromiseQueue = new Tn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
|
10252
10252
|
if (!this.previewService) return;
|
10253
|
-
const
|
10253
|
+
const B = this.getCommandContext().getAllLayouts(), I = this.getLayoutPreviewService()?.getAll();
|
10254
10254
|
if (I)
|
10255
10255
|
for (const [, C] of I)
|
10256
|
-
C.render(
|
10257
|
-
}, 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 = r, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer =
|
10258
|
-
this.stepTags[
|
10256
|
+
C.render(B);
|
10257
|
+
}, 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 = r, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer = p, 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 = g, this.workflow.steps.forEach((B) => {
|
10258
|
+
this.stepTags[B.stepName] = B.tags ?? [];
|
10259
10259
|
}), S && (this.workflowStatePromiseQueue.enabled = !1), this.initializationPromise = this.initializeDefaultWorkflowState(a), this.initializationPromise.then(() => {
|
10260
10260
|
this.initialized = !0;
|
10261
|
-
}), this.initializationPromise.catch((
|
10262
|
-
throw console.error(
|
10261
|
+
}), this.initializationPromise.catch((B) => {
|
10262
|
+
throw console.error(B), this.initialized = !1, new Error("Workflow initialization failed due to an error. See console.");
|
10263
10263
|
}), this.initializationPromise.finally(
|
10264
10264
|
() => this.getCommandContext().registerStateCallback(() => {
|
10265
10265
|
this.updateStateWithServer(), this.renderLayouts();
|
@@ -10273,7 +10273,7 @@ class Bo {
|
|
10273
10273
|
a.type === we.FirstName ? e[r] = t?.firstName : a.type === we.LastName ? e[r] = t?.lastName : a.type === we.Custom && (a.customFieldIndex === 1 ? e[r] = t?.customField1 : a.customFieldIndex === 2 ? e[r] = t?.customField2 : a.customFieldIndex === 3 ? e[r] = t?.customField3 : a.customFieldIndex === 4 ? e[r] = t?.customField4 : a.customFieldIndex === 5 && (e[r] = t?.customField5));
|
10274
10274
|
}), e;
|
10275
10275
|
}
|
10276
|
-
async updateRecipient(t, e, a, r, i, s, o, l, c, d, A, u, h, m,
|
10276
|
+
async updateRecipient(t, e, a, r, i, s, o, l, c, d, A, u, h, m, p, g, f) {
|
10277
10277
|
if (this.transaction.recipient?.id)
|
10278
10278
|
this.transaction.recipient = {
|
10279
10279
|
id: this.transaction.recipient.id,
|
@@ -10291,8 +10291,8 @@ class Bo {
|
|
10291
10291
|
customField1: u ?? this.transaction.recipient.customField1,
|
10292
10292
|
customField2: h ?? this.transaction.recipient.customField2,
|
10293
10293
|
customField3: m ?? this.transaction.recipient.customField3,
|
10294
|
-
customField4:
|
10295
|
-
customField5:
|
10294
|
+
customField4: p ?? this.transaction.recipient.customField4,
|
10295
|
+
customField5: g ?? this.transaction.recipient.customField5,
|
10296
10296
|
conversionConfigurationId: f || this.transaction.recipient.conversionConfigurationId
|
10297
10297
|
}, await this.graphQlClient().mutate({
|
10298
10298
|
mutation: So,
|
@@ -10314,8 +10314,8 @@ class Bo {
|
|
10314
10314
|
customField1: u || this.transaction.recipient.customField1,
|
10315
10315
|
customField2: h || this.transaction.recipient.customField2,
|
10316
10316
|
customField3: m || this.transaction.recipient.customField3,
|
10317
|
-
customField4:
|
10318
|
-
customField5:
|
10317
|
+
customField4: p || this.transaction.recipient.customField4,
|
10318
|
+
customField5: g || this.transaction.recipient.customField5,
|
10319
10319
|
conversionConfigurationId: f || this.transaction.recipient.conversionConfigurationId
|
10320
10320
|
}
|
10321
10321
|
});
|
@@ -10339,8 +10339,8 @@ class Bo {
|
|
10339
10339
|
customField1: u,
|
10340
10340
|
customField2: h,
|
10341
10341
|
customField3: m,
|
10342
|
-
customField4:
|
10343
|
-
customField5:
|
10342
|
+
customField4: p,
|
10343
|
+
customField5: g,
|
10344
10344
|
conversionConfigurationId: f
|
10345
10345
|
}
|
10346
10346
|
});
|
@@ -10360,8 +10360,8 @@ class Bo {
|
|
10360
10360
|
customField1: u,
|
10361
10361
|
customField2: h,
|
10362
10362
|
customField3: m,
|
10363
|
-
customField4:
|
10364
|
-
customField5:
|
10363
|
+
customField4: p,
|
10364
|
+
customField5: g,
|
10365
10365
|
conversionConfigurationId: f
|
10366
10366
|
}, await this.graphQlClient().mutate({
|
10367
10367
|
mutation: vo,
|
@@ -10403,7 +10403,7 @@ class Bo {
|
|
10403
10403
|
this.storage[o.stepName] = o.storage || {};
|
10404
10404
|
}), await this.fetchConversionConfiguration(), this.allScenes = await Ji(t);
|
10405
10405
|
const r = yt(this.allScenes, this.stepSelections).map((o) => o.silentSteps).flat(), { stepElements: i, commands: s } = await this.stepElementsForIntroducedSilentSteps(r, !!this.reloadedState);
|
10406
|
-
this.commandContext.apply(new R(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(),
|
10406
|
+
this.commandContext.apply(new R(s), !0), this.stepElements = { ...this.stepElements, ...i }, await this.ensureStepsAreLoaded(), this.isReloadedTransaction || this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
10407
10407
|
}
|
10408
10408
|
getWorkflowExperience() {
|
10409
10409
|
return this.experience;
|
@@ -10857,7 +10857,7 @@ class Bo {
|
|
10857
10857
|
this.stepSelections = {
|
10858
10858
|
...this.stepSelections,
|
10859
10859
|
[t]: { selectedVariants: e }
|
10860
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((C, E) => C + E.selectedVariants.map((P) => P.priceModifier || 0).reduce((P,
|
10860
|
+
}, 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) => {
|
10861
10861
|
vt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1, delete this.stepMetadata[C.stepName], delete this.stepSelections[C.stepName], delete this.storage[C.stepName]);
|
10862
10862
|
});
|
10863
10863
|
const s = this.allScenes, o = yt(s, i), l = yt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), A = l.map((C) => C.silentSteps).flat().filter(
|
@@ -10872,13 +10872,13 @@ class Bo {
|
|
10872
10872
|
...h,
|
10873
10873
|
[t]: a
|
10874
10874
|
}, this.removeElements(u);
|
10875
|
-
const
|
10876
|
-
|
10877
|
-
const
|
10875
|
+
const p = this.workflow.steps.find((C) => C.stepName === t);
|
10876
|
+
p?.type === v.Frame && this.getWorkflowExperience().getStepById(p.stepName)?.frameService?.setTargetElements(a.map((E) => E.id));
|
10877
|
+
const g = u.map((C) => new Bt(C.id)), f = new Ha(this.constructSerializableWorkflow()), S = [...m, ...g, f];
|
10878
10878
|
S.length > 0 && this.commandContext.apply(new R(S), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
10879
|
-
const
|
10879
|
+
const B = this.getInvalidModelVariants(), I = this.modelContainer;
|
10880
10880
|
if (I) {
|
10881
|
-
const C =
|
10881
|
+
const C = B.map(
|
10882
10882
|
(E) => I.applyModelVariant(
|
10883
10883
|
E,
|
10884
10884
|
{
|
@@ -11940,7 +11940,7 @@ const $o = async (n, t) => {
|
|
11940
11940
|
T.errors && console.log("Server Error:", et.message);
|
11941
11941
|
}), null) : tt ?? null;
|
11942
11942
|
})() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await n.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
|
11943
|
-
const u = n.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h,
|
11943
|
+
const u = n.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, p = l && Xa(l, t, !0), g = l && Xa(l, t, !1), f = async (b) => {
|
11944
11944
|
const F = {};
|
11945
11945
|
let Q = 0;
|
11946
11946
|
if (Object.keys(i).length > 0)
|
@@ -11948,7 +11948,7 @@ const $o = async (n, t) => {
|
|
11948
11948
|
const tt = i[T], et = t.steps.find((W) => W.stepName === T);
|
11949
11949
|
for (let W = 0; W < tt.selections.length; ++W) {
|
11950
11950
|
const q = tt.selections[W];
|
11951
|
-
if (et && (!
|
11951
|
+
if (et && (!b || et.option && (et.option.variants || []).length > 1 && !et.data.hideSelectionInCart && !et.data.hideSelectionsInCart)) {
|
11952
11952
|
const wt = et.stepTitle;
|
11953
11953
|
F[wt] ? F[wt].push({
|
11954
11954
|
id: q.id || "",
|
@@ -11966,19 +11966,19 @@ const $o = async (n, t) => {
|
|
11966
11966
|
}
|
11967
11967
|
}
|
11968
11968
|
return [F, Q];
|
11969
|
-
}, [S] = await f(!0),
|
11970
|
-
Object.keys(S).map((
|
11969
|
+
}, [S] = await f(!0), B = Object.fromEntries(
|
11970
|
+
Object.keys(S).map((b) => [b, S[b].map((F) => F.id)])
|
11971
11971
|
), [I] = await f(!1), C = Object.fromEntries(
|
11972
|
-
Object.keys(I).map((
|
11973
|
-
|
11974
|
-
I[
|
11972
|
+
Object.keys(I).map((b) => [
|
11973
|
+
b,
|
11974
|
+
I[b].map((F) => F.id)
|
11975
11975
|
])
|
11976
11976
|
);
|
11977
11977
|
let E = await o(m, r.id);
|
11978
11978
|
if (E) {
|
11979
|
-
const
|
11979
|
+
const b = await (await rt(E)).blob();
|
11980
11980
|
E = (await O.uploadAsset(
|
11981
|
-
{ name: `${r.id}-preview-image.png`, blob:
|
11981
|
+
{ name: `${r.id}-preview-image.png`, blob: b },
|
11982
11982
|
ve.Image,
|
11983
11983
|
!0,
|
11984
11984
|
!1
|
@@ -11986,7 +11986,7 @@ const $o = async (n, t) => {
|
|
11986
11986
|
}
|
11987
11987
|
return {
|
11988
11988
|
designDetails: (() => {
|
11989
|
-
const
|
11989
|
+
const b = {
|
11990
11990
|
name: s,
|
11991
11991
|
layouts: e.map((F) => ({
|
11992
11992
|
index: F.index,
|
@@ -11997,22 +11997,22 @@ const $o = async (n, t) => {
|
|
11997
11997
|
useThreeDimPreview: !!m,
|
11998
11998
|
previewImage: E
|
11999
11999
|
};
|
12000
|
-
if (
|
12000
|
+
if (g) {
|
12001
12001
|
const F = [];
|
12002
|
-
for (const [Q, T] of Object.entries(
|
12002
|
+
for (const [Q, T] of Object.entries(g))
|
12003
12003
|
F.push({ key: Q, value: T });
|
12004
|
-
|
12004
|
+
b.metadata = F;
|
12005
12005
|
}
|
12006
|
-
if (
|
12006
|
+
if (B) {
|
12007
12007
|
const F = [];
|
12008
12008
|
for (const [Q, T] of Object.entries(C))
|
12009
12009
|
F.push({ key: Q, ids: T });
|
12010
|
-
|
12010
|
+
b.selectedVariants = F;
|
12011
12011
|
}
|
12012
|
-
return
|
12012
|
+
return b;
|
12013
12013
|
})(),
|
12014
12014
|
cartSelectionsWithPrices: S,
|
12015
|
-
cartMetadata:
|
12015
|
+
cartMetadata: p
|
12016
12016
|
};
|
12017
12017
|
}, Vo = async (n, t, e, a, r, i, s, o, l, c, d) => {
|
12018
12018
|
l("workflow.steps.finish.finalize.buildingLayouts");
|
@@ -12028,19 +12028,19 @@ const $o = async (n, t) => {
|
|
12028
12028
|
d
|
12029
12029
|
);
|
12030
12030
|
l("workflow.steps.finish.finalize.creatingDesign");
|
12031
|
-
const m = await $o(A),
|
12031
|
+
const m = await $o(A), p = m?.transaction?.previewImageLink;
|
12032
12032
|
if (!m?.transaction)
|
12033
12033
|
throw new Error("Failed to create design");
|
12034
12034
|
l("workflow.steps.finish.finalize.updatingTransaction");
|
12035
|
-
const
|
12035
|
+
const g = m.transaction;
|
12036
12036
|
return er(
|
12037
|
-
|
12037
|
+
g,
|
12038
12038
|
r,
|
12039
12039
|
t,
|
12040
12040
|
u,
|
12041
12041
|
m?.sku,
|
12042
12042
|
h,
|
12043
|
-
|
12043
|
+
p,
|
12044
12044
|
m?.processExecution?.id
|
12045
12045
|
);
|
12046
12046
|
}, zo = async (n, t, e) => {
|
@@ -12315,7 +12315,7 @@ class Yo {
|
|
12315
12315
|
}
|
12316
12316
|
let i = 2048;
|
12317
12317
|
e && e <= 2048 && (i = e);
|
12318
|
-
const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((
|
12318
|
+
const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((B) => B.layoutState?.layout.panelId === c?.name) || o[0], A = d.layoutState.layout.previewRegion ? {
|
12319
12319
|
x: d.layoutState.layout.previewRegion.left,
|
12320
12320
|
y: d.layoutState.layout.previewRegion.top,
|
12321
12321
|
width: d.layoutState.layout.previewRegion.width,
|
@@ -12328,14 +12328,14 @@ class Yo {
|
|
12328
12328
|
}, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
|
12329
12329
|
if (!h)
|
12330
12330
|
throw new Te("Failed to obtain 2D context for preview image creation");
|
12331
|
-
const m = this.workflowManager.getTemplatingContext(),
|
12331
|
+
const m = this.workflowManager.getTemplatingContext(), p = Ea(u.layoutState.layout, u.layoutState.elements, {
|
12332
12332
|
renderingConfiguration: {
|
12333
12333
|
purpose: jt.Print,
|
12334
12334
|
region: { left: A.x, top: A.y, width: A.width, height: A.height },
|
12335
12335
|
templatingContext: m
|
12336
12336
|
}
|
12337
|
-
}),
|
12338
|
-
await (await ma.from(h,
|
12337
|
+
}), g = fn(p);
|
12338
|
+
await (await ma.from(h, g, {
|
12339
12339
|
anonymousCrossOrigin: !0,
|
12340
12340
|
ignoreDimensions: !1,
|
12341
12341
|
createCanvas: pt,
|
@@ -12437,12 +12437,12 @@ class Yo {
|
|
12437
12437
|
A !== void 0 && (A.forEach((u) => d.add(JSON.stringify(u))), o.forEach((u) => {
|
12438
12438
|
const h = u.getRaw().globalPropertyAspectConfigurations;
|
12439
12439
|
h !== void 0 && h.forEach((m) => {
|
12440
|
-
const
|
12441
|
-
if (
|
12440
|
+
const p = l(m), g = d.has(JSON.stringify(m));
|
12441
|
+
if (g && p?.getType() === "Option") {
|
12442
12442
|
const f = u.getCurrentVariant();
|
12443
12443
|
if (!f) return;
|
12444
12444
|
c.selectVariant(f), d.delete(JSON.stringify(m));
|
12445
|
-
} else if (
|
12445
|
+
} else if (g && p?.getType() === "Text") {
|
12446
12446
|
const f = u.getText();
|
12447
12447
|
c.setText(f), d.delete(JSON.stringify(m));
|
12448
12448
|
}
|
@@ -12701,13 +12701,13 @@ const Jo = (n) => {
|
|
12701
12701
|
const a = t.data, r = e.data.baseUrl, i = a.assetUrl.replace("localhost", "localstack"), s = r.slice(0, 4) === "http" ? "" : "https://", o = new URL(s + r);
|
12702
12702
|
o.searchParams.append("video", $a(JSON.stringify([{ href: i }]))), o.pathname = o.pathname + (o.pathname.slice(-1) === "/" ? "" : "/");
|
12703
12703
|
const l = o.toString(), d = `data:image/svg+xml;base64,${$a(await An(l, { type: "svg" }))}`, A = (h) => {
|
12704
|
-
const m = n.find((
|
12704
|
+
const m = n.find((g) => g.panelId === h.panelId);
|
12705
12705
|
if (!m)
|
12706
12706
|
throw new Y(h);
|
12707
|
-
const
|
12707
|
+
const p = M();
|
12708
12708
|
return new z(
|
12709
12709
|
{
|
12710
|
-
id:
|
12710
|
+
id: p,
|
12711
12711
|
src: d,
|
12712
12712
|
type: x.Image,
|
12713
12713
|
y: h.top,
|
@@ -12730,7 +12730,7 @@ const Jo = (n) => {
|
|
12730
12730
|
const o = gs(r, a.option);
|
12731
12731
|
o && (t[a.stepName] = { selectedVariants: [o] });
|
12732
12732
|
const l = async (c) => {
|
12733
|
-
const d = await zn(c, o?.asset?.fileLink), A = await Ue(d), u = M(), h = n.find((
|
12733
|
+
const d = await zn(c, o?.asset?.fileLink), A = await Ue(d), u = M(), h = n.find((p) => p.panelId === c.panelId);
|
12734
12734
|
if (!h)
|
12735
12735
|
throw new Y(c);
|
12736
12736
|
const m = Ba(
|
@@ -12798,37 +12798,37 @@ const Jo = (n) => {
|
|
12798
12798
|
if (!m)
|
12799
12799
|
return console.error("Failed to read SVG."), [];
|
12800
12800
|
wa(m);
|
12801
|
-
const
|
12801
|
+
const p = {};
|
12802
12802
|
kt(m, (C) => {
|
12803
12803
|
_o.includes(C.tagName) && !C.attributes.getNamedItem("fill") && C.setAttribute("fill", "#000000");
|
12804
12804
|
const E = C.attributes.getNamedItem("fill");
|
12805
12805
|
if (E && E.value !== "none") {
|
12806
|
-
const
|
12807
|
-
C.classList.add(Q),
|
12806
|
+
const b = E.value, Q = `spiff-fill-${b.replace(/\W/g, "")}`;
|
12807
|
+
C.classList.add(Q), p[Q] = { browserValue: b };
|
12808
12808
|
}
|
12809
12809
|
const P = C.attributes.getNamedItem("stroke");
|
12810
12810
|
if (P && P.value !== "none") {
|
12811
|
-
const
|
12812
|
-
C.classList.add(Q),
|
12811
|
+
const b = P.value, Q = `spiff-stroke-${b.replace(/\W/g, "")}`;
|
12812
|
+
C.classList.add(Q), p[Q] = { browserValue: b };
|
12813
12813
|
}
|
12814
12814
|
});
|
12815
12815
|
const f = It().serializeToString(m), S = r.colors;
|
12816
12816
|
if (S) {
|
12817
|
-
for (const [C, E] of Object.entries(
|
12817
|
+
for (const [C, E] of Object.entries(p))
|
12818
12818
|
for (const P of Object.keys(S))
|
12819
12819
|
if (E.browserValue === P) {
|
12820
|
-
|
12820
|
+
p[C] = { browserValue: S[P] };
|
12821
12821
|
break;
|
12822
12822
|
}
|
12823
12823
|
}
|
12824
|
-
const
|
12825
|
-
const E = n.find((
|
12824
|
+
const B = (C) => {
|
12825
|
+
const E = n.find((b) => b.panelId === C.panelId);
|
12826
12826
|
if (!E)
|
12827
12827
|
throw new Y(C);
|
12828
12828
|
const P = M();
|
12829
12829
|
return new z(
|
12830
12830
|
{
|
12831
|
-
colors:
|
12831
|
+
colors: p,
|
12832
12832
|
id: P,
|
12833
12833
|
svg: f,
|
12834
12834
|
type: x.Illustration,
|
@@ -12845,7 +12845,7 @@ const Jo = (n) => {
|
|
12845
12845
|
);
|
12846
12846
|
}, I = a.data.regions;
|
12847
12847
|
try {
|
12848
|
-
return I.map(
|
12848
|
+
return I.map(B);
|
12849
12849
|
} catch (C) {
|
12850
12850
|
return console.error(C), [];
|
12851
12851
|
}
|
@@ -12929,7 +12929,7 @@ const Jo = (n) => {
|
|
12929
12929
|
return console.error(`No variant with ID: ${r.colorVariantId}`), [];
|
12930
12930
|
t[a.stepName] = { selectedVariants: [s] };
|
12931
12931
|
const o = (c) => {
|
12932
|
-
const d = n.find((
|
12932
|
+
const d = n.find((p) => p.panelId === c.panelId);
|
12933
12933
|
if (!d)
|
12934
12934
|
throw new Y(c);
|
12935
12935
|
const A = `
|
@@ -13041,11 +13041,11 @@ const Jo = (n) => {
|
|
13041
13041
|
}
|
13042
13042
|
return a;
|
13043
13043
|
}, il = async (n, t, e, a) => {
|
13044
|
-
const r = [], i = e.data, s = 30, o = (
|
13045
|
-
const
|
13046
|
-
if (!
|
13044
|
+
const r = [], i = e.data, s = 30, o = (g) => g.vertical ? "center" : g.textAlign || "center", l = () => {
|
13045
|
+
const g = a.option;
|
13046
|
+
if (!g)
|
13047
13047
|
return;
|
13048
|
-
const f =
|
13048
|
+
const f = g.variants?.find((B) => B.id === i.fontVariantId) || ne(g);
|
13049
13049
|
if (!f || !f.asset)
|
13050
13050
|
return;
|
13051
13051
|
t[a.stepName] = { selectedVariants: [f] };
|
@@ -13053,23 +13053,23 @@ const Jo = (n) => {
|
|
13053
13053
|
if (S)
|
13054
13054
|
return S;
|
13055
13055
|
}, d = await (async () => {
|
13056
|
-
const
|
13057
|
-
if (!
|
13056
|
+
const g = l();
|
13057
|
+
if (!g)
|
13058
13058
|
return;
|
13059
|
-
const f = await Nt(
|
13059
|
+
const f = await Nt(g);
|
13060
13060
|
return {
|
13061
|
-
assetUrl:
|
13061
|
+
assetUrl: g,
|
13062
13062
|
name: f.names.fullName.en
|
13063
13063
|
};
|
13064
13064
|
})(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = De(A, {
|
13065
13065
|
vertical: a.data.vertical,
|
13066
13066
|
uppercase: a.data.uppercase
|
13067
|
-
}), h = async (
|
13068
|
-
const f =
|
13067
|
+
}), h = async (g) => {
|
13068
|
+
const f = g.colorOption;
|
13069
13069
|
return f ? j.getDefaultVariant(f)?.color : void 0;
|
13070
|
-
}, m = i.color || await h(a.data),
|
13071
|
-
for (const
|
13072
|
-
const f = n.find((
|
13070
|
+
}, m = i.color || await h(a.data), p = a.data.regions;
|
13071
|
+
for (const g of p) {
|
13072
|
+
const f = n.find((B) => B.panelId === g.panelId);
|
13073
13073
|
if (!f)
|
13074
13074
|
continue;
|
13075
13075
|
const S = {
|
@@ -13080,24 +13080,24 @@ const Jo = (n) => {
|
|
13080
13080
|
fill: i.color || m || "#000000",
|
13081
13081
|
fontData: d,
|
13082
13082
|
fontSize: a.data.size || s,
|
13083
|
-
height:
|
13084
|
-
layer:
|
13085
|
-
layerIndex:
|
13083
|
+
height: g.height,
|
13084
|
+
layer: g.layer,
|
13085
|
+
layerIndex: g.layerIndex,
|
13086
13086
|
paths: a.data.paths,
|
13087
|
-
rotation:
|
13087
|
+
rotation: g.rotation,
|
13088
13088
|
text: u,
|
13089
13089
|
type: x.Textbox,
|
13090
13090
|
vertical: a.data.vertical,
|
13091
13091
|
verticalAlign: a.data.verticalAlign || "middle",
|
13092
|
-
width:
|
13093
|
-
x:
|
13094
|
-
y:
|
13092
|
+
width: g.width,
|
13093
|
+
x: g.left,
|
13094
|
+
y: g.top
|
13095
13095
|
};
|
13096
13096
|
if (d) {
|
13097
|
-
const [
|
13097
|
+
const [B, I] = Ce(
|
13098
13098
|
a.data.size || s,
|
13099
13099
|
d,
|
13100
|
-
|
13100
|
+
g,
|
13101
13101
|
[
|
13102
13102
|
De(u, {
|
13103
13103
|
vertical: a.data.vertical,
|
@@ -13114,7 +13114,7 @@ const Jo = (n) => {
|
|
13114
13114
|
new z(
|
13115
13115
|
{
|
13116
13116
|
...S,
|
13117
|
-
fontSize:
|
13117
|
+
fontSize: B,
|
13118
13118
|
text: S.curved ? S.text : (I || []).join(`
|
13119
13119
|
`)
|
13120
13120
|
},
|
@@ -13343,8 +13343,8 @@ class ul extends Mn {
|
|
13343
13343
|
if (this.nonPOTSupport) {
|
13344
13344
|
const m = s / o;
|
13345
13345
|
a / r < m ? (l = s, c = r * (s / a)) : (l = a * (o / r), c = o);
|
13346
|
-
const
|
13347
|
-
l =
|
13346
|
+
const g = this.resizeFit({ width: l, height: c });
|
13347
|
+
l = g.width, c = g.height;
|
13348
13348
|
} else
|
13349
13349
|
l = i.width, c = i.height;
|
13350
13350
|
const d = this.getWorkflowManager?.()?.getTemplatingContext(), A = Ea(t.layoutState.layout, e, {
|
@@ -13935,6 +13935,12 @@ class yl {
|
|
13935
13935
|
console.log("Setting global property state to new state."), this.globalPropertyState = Ae(o), this.recalculateMandatoryStates();
|
13936
13936
|
}), this.onGlobalPropertyStateChange = r;
|
13937
13937
|
}
|
13938
|
+
async clearAspects(t) {
|
13939
|
+
if (!this.globalPropertyState)
|
13940
|
+
throw new Error("Global property state not initialized");
|
13941
|
+
const e = this.globalPropertyState.aspects;
|
13942
|
+
this.globalPropertyState.aspects = e.filter((a) => !t.includes(a.name)), console.log(`LOG: after the clear there are ${this.globalPropertyState.aspects.length} aspects`);
|
13943
|
+
}
|
13938
13944
|
recalculateMandatoryStates() {
|
13939
13945
|
this.mandatoryFulfilledAspects = rr(this.globalPropertyState);
|
13940
13946
|
}
|
@@ -14047,6 +14053,7 @@ class yl {
|
|
14047
14053
|
async updateGlobalPropertyState() {
|
14048
14054
|
if (!this.globalPropertyState)
|
14049
14055
|
throw new Error("Global property state not initialized");
|
14056
|
+
console.log(`LOG: updating ${this.globalPropertyState.aspects.length} aspects`), console.trace();
|
14050
14057
|
const t = await y.getShadowGraphqlClient().mutate({
|
14051
14058
|
mutation: Hs,
|
14052
14059
|
variables: {
|
@@ -14423,15 +14430,15 @@ class ir {
|
|
14423
14430
|
return new Promise((u) => {
|
14424
14431
|
let h = !1;
|
14425
14432
|
const m = A.subscribe({
|
14426
|
-
next(
|
14427
|
-
if (h ||
|
14433
|
+
next(p) {
|
14434
|
+
if (h || p.partial && (!p.data.productCollections || p.data.productCollections.length === 0 || !p.data.productCollections[0].productCollectionProductsFeed?.items || p.data.productCollections[0].productCollectionProductsFeed?.items.length === 0))
|
14428
14435
|
return;
|
14429
14436
|
c.abort(), h = !0, m.unsubscribe();
|
14430
|
-
const
|
14437
|
+
const g = p.data.productCollections?.[0].productCollectionProductsFeed?.items.filter((f) => !!f.product).map((f) => new ue(Et(f))) || [];
|
14431
14438
|
u({
|
14432
|
-
items:
|
14439
|
+
items: g,
|
14433
14440
|
// Clone items because it could be cached data (immutable)
|
14434
|
-
total:
|
14441
|
+
total: p.data.productCollections?.[0].productCollectionProductsFeed?.total ?? 0
|
14435
14442
|
});
|
14436
14443
|
},
|
14437
14444
|
error() {
|
@@ -14743,9 +14750,9 @@ class Ze {
|
|
14743
14750
|
A ? this.globalPropertyHandleService.getHandles().then((u) => {
|
14744
14751
|
const h = u.map((m) => {
|
14745
14752
|
if (m.getType() === U.ColorOption || m.getType() === U.Option) {
|
14746
|
-
const
|
14747
|
-
if (!A.aspects.find((f) => f.name ===
|
14748
|
-
return
|
14753
|
+
const p = m;
|
14754
|
+
if (!A.aspects.find((f) => f.name === p.getName()))
|
14755
|
+
return p.initDefaultVariant();
|
14749
14756
|
}
|
14750
14757
|
});
|
14751
14758
|
Promise.all(h).then(c).catch(d);
|
@@ -14911,7 +14918,7 @@ class Ze {
|
|
14911
14918
|
}
|
14912
14919
|
}
|
14913
14920
|
} finally {
|
14914
|
-
this.updatesLocked = !1, this.onGlobalPropertiesChanged(void 0, this.globalPropertyStateManager.getGlobalPropertyState());
|
14921
|
+
this.updatesLocked = !1, console.log(`LOG: finally ${this.globalPropertyStateManager.getGlobalPropertyState()?.aspects?.length}`), this.onGlobalPropertiesChanged(void 0, this.globalPropertyStateManager.getGlobalPropertyState());
|
14915
14922
|
}
|
14916
14923
|
}
|
14917
14924
|
getGlobalPropertyStateManager() {
|
@@ -14941,7 +14948,7 @@ class Ze {
|
|
14941
14948
|
), d = [...new Set(o.map((u) => u.number))];
|
14942
14949
|
if (d.length > c)
|
14943
14950
|
for (const u of d) {
|
14944
|
-
const h = this.getGlobalPropertyStateManager(), m = l.find((
|
14951
|
+
const h = this.getGlobalPropertyStateManager(), m = l.find((p) => p.channelNumber === u);
|
14945
14952
|
m && await h.setAspect(r, m.variant.id || "", void 0, m.channelNumber);
|
14946
14953
|
}
|
14947
14954
|
}
|
@@ -15374,14 +15381,19 @@ class Ze {
|
|
15374
15381
|
return;
|
15375
15382
|
const a = await this.globalPropertyHandleService.getHandles(), r = this.globalPropertyHandleService.applyConditionsFromState(a, t), i = this.globalPropertyHandleService.applyConditionsFromState(a, e);
|
15376
15383
|
this.checkConditionalHandlesChanged(r, i), this.checkMandatoryHandlesChanged(t, i);
|
15377
|
-
const s =
|
15378
|
-
|
15379
|
-
|
15380
|
-
|
15381
|
-
|
15384
|
+
const s = this.getGlobalPropertyStateManager();
|
15385
|
+
let o = [];
|
15386
|
+
for (const c of a)
|
15387
|
+
i.find((d) => d.getName() == c.getName()) || (o = [...o, c.getName()]);
|
15388
|
+
await s.clearAspects(o);
|
15389
|
+
const l = a.map((c) => {
|
15390
|
+
if (c.getType() === U.ColorOption || c.getType() === U.Option) {
|
15391
|
+
const d = c;
|
15392
|
+
if (!e.aspects.find((u) => u.name === d.getName()))
|
15393
|
+
return d.initDefaultVariant();
|
15382
15394
|
}
|
15383
15395
|
});
|
15384
|
-
await Promise.all(
|
15396
|
+
await Promise.all(l), await Promise.all(i.map((c) => c.applyGlobalState()));
|
15385
15397
|
}
|
15386
15398
|
checkConditionalHandlesChanged(t, e) {
|
15387
15399
|
(() => {
|
@@ -15999,7 +16011,7 @@ class Ed {
|
|
15999
16011
|
} catch (a) {
|
16000
16012
|
throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
|
16001
16013
|
}
|
16002
|
-
}, this.options = t, this.options.applicationKey && Wr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.
|
16014
|
+
}, this.options = t, this.options.applicationKey && Wr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.4.0-beta.d49482af-c4b5-57e7-b3e1-1af196d81c48"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
16003
16015
|
}
|
16004
16016
|
configure(t) {
|
16005
16017
|
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 && Hr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
@@ -16318,8 +16330,8 @@ class Ed {
|
|
16318
16330
|
const h = await this.loggedInBearerToken();
|
16319
16331
|
o.Authorization = `Bearer ${h}`;
|
16320
16332
|
} catch {
|
16321
|
-
const
|
16322
|
-
|
16333
|
+
const p = Object.entries(localStorage).find(([f, S]) => f.startsWith("CognitoIdentityServiceProvider") && f.endsWith("idToken"))?.[0] || "", g = localStorage.getItem(p);
|
16334
|
+
g && !Wt(g) && (o.Authorization = `Bearer ${g}`);
|
16323
16335
|
}
|
16324
16336
|
const l = {
|
16325
16337
|
bundleOwnerId: s,
|
@@ -16359,8 +16371,8 @@ class Ed {
|
|
16359
16371
|
const u = await this.loggedInBearerToken();
|
16360
16372
|
s.Authorization = `Bearer ${u}`;
|
16361
16373
|
} catch {
|
16362
|
-
const m = Object.entries(localStorage).find(([
|
16363
|
-
|
16374
|
+
const m = Object.entries(localStorage).find(([g, f]) => g.startsWith("CognitoIdentityServiceProvider") && g.endsWith("idToken"))?.[0] || "", p = localStorage.getItem(m);
|
16375
|
+
p && !Wt(p) && (s.Authorization = `Bearer ${p}`);
|
16364
16376
|
}
|
16365
16377
|
const o = {
|
16366
16378
|
bundleOwnerId: i,
|
@@ -16468,12 +16480,12 @@ class Ed {
|
|
16468
16480
|
},
|
16469
16481
|
errorPolicy: "all",
|
16470
16482
|
fetchPolicy: "no-cache"
|
16471
|
-
}),
|
16472
|
-
if (
|
16483
|
+
}), b = P.data.transactions;
|
16484
|
+
if (b.length !== C.length) {
|
16473
16485
|
const F = P.errors?.[0]?.message || "Unknown error";
|
16474
16486
|
throw new ht(`Not all transactions were found: ${F}`);
|
16475
16487
|
}
|
16476
|
-
return !this.activeIntegration &&
|
16488
|
+
return !this.activeIntegration && b[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(b[0].integrationProduct.integration)), b.map((F, Q) => ({
|
16477
16489
|
transaction: F,
|
16478
16490
|
workflowId: F.workflowId,
|
16479
16491
|
readOnly: C.find((T) => T.option.transactionId === F.id)?.option.readOnly ?? !1,
|
@@ -16485,13 +16497,15 @@ class Ed {
|
|
16485
16497
|
const E = await a.mutate({
|
16486
16498
|
mutation: Bi,
|
16487
16499
|
variables: {
|
16488
|
-
inputs: C.map((
|
16489
|
-
integrationProductId:
|
16490
|
-
externalIntegrationId:
|
16491
|
-
externalProductId:
|
16492
|
-
workflowId:
|
16493
|
-
designName:
|
16494
|
-
claim: !0
|
16500
|
+
inputs: C.map((b) => ({
|
16501
|
+
integrationProductId: b.option.type === "integration" ? b.option.integrationProductId : void 0,
|
16502
|
+
externalIntegrationId: b.option.type === "external" ? b.option.externalIntegrationId : void 0,
|
16503
|
+
externalProductId: b.option.type === "external" ? b.option.externalProductId : void 0,
|
16504
|
+
workflowId: b.option.workflowId,
|
16505
|
+
designName: b.option.designName,
|
16506
|
+
claim: !0,
|
16507
|
+
quantity: b.option.type === "integration" ? b.option.quantity : void 0,
|
16508
|
+
recipient: b.option.type === "integration" ? b.option.recipient : void 0
|
16495
16509
|
})),
|
16496
16510
|
marketplaceThemeInstallId: this.marketplaceThemeInstallId,
|
16497
16511
|
marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
|
@@ -16500,22 +16514,22 @@ class Ed {
|
|
16500
16514
|
fetchPolicy: "no-cache"
|
16501
16515
|
}), P = E.data?.transactionCreateMany;
|
16502
16516
|
if (!P || P.length === 0) {
|
16503
|
-
const
|
16504
|
-
throw new ht(`Failed to create transactions: ${
|
16517
|
+
const b = E.errors?.[0]?.message || "Unknown error";
|
16518
|
+
throw new ht(`Failed to create transactions: ${b}`);
|
16505
16519
|
}
|
16506
|
-
return P.map((
|
16507
|
-
transaction:
|
16508
|
-
workflowId:
|
16520
|
+
return P.map((b, F) => ({
|
16521
|
+
transaction: b,
|
16522
|
+
workflowId: b.workflowId,
|
16509
16523
|
readOnly: !1,
|
16510
16524
|
index: C[F].index
|
16511
16525
|
}));
|
16512
16526
|
}, s = t.map((C, E) => ({ option: C, index: E })), o = s.filter((C) => C.option.type === "transaction"), l = s.filter(
|
16513
16527
|
(C) => C.option.type === "integration" || C.option.type === "external"
|
16514
|
-
), c = Ma(o,
|
16515
|
-
...
|
16516
|
-
...
|
16517
|
-
])).flat(),
|
16518
|
-
const { transaction: E, workflowId: P, readOnly:
|
16528
|
+
), c = 50, d = Ma(o, c), A = Ma(l, c), u = (await Promise.all([
|
16529
|
+
...d.map(r),
|
16530
|
+
...A.map(i)
|
16531
|
+
])).flat(), h = [...new Set(u.map((C) => C.workflowId))], m = await or(h, e), p = new Map(m.map((C) => [C.id, C])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), f = u.map(async (C) => {
|
16532
|
+
const { transaction: E, workflowId: P, readOnly: b, index: F } = C, Q = p.get(P), T = t[F];
|
16519
16533
|
!g.get(E.id) && E.transactionOwnerId && g.set(E.id, E.transactionOwnerId);
|
16520
16534
|
const tt = g.get(E.id) || void 0, et = new Ll({
|
16521
16535
|
onMutate: () => ({ context: { transactionOwnerId: tt, bundleOwnerId: e?.bundleOwnerId } }),
|
@@ -16525,21 +16539,21 @@ class Ed {
|
|
16525
16539
|
transaction: E,
|
16526
16540
|
layouts: [],
|
16527
16541
|
singleVariantsRenderable: T?.workflowConfiguration?.singleVariantsRenderable,
|
16528
|
-
stateMutationFunc:
|
16542
|
+
stateMutationFunc: b ? async () => {
|
16529
16543
|
throw new V("State mutation is forbidden in read only mode!");
|
16530
16544
|
} : async (q) => this.updateTransactionState({
|
16531
16545
|
...q,
|
16532
16546
|
context: { transactionOwnerId: tt, bundleOwnerId: e?.bundleOwnerId }
|
16533
16547
|
}),
|
16534
16548
|
graphQlClient: () => et,
|
16535
|
-
readOnly:
|
16549
|
+
readOnly: b,
|
16536
16550
|
workflow: Q,
|
16537
16551
|
isReloadedTransaction: T.type === "transaction"
|
16538
16552
|
};
|
16539
16553
|
if (T.type === "transaction" && E.workflowState) {
|
16540
16554
|
const q = JSON.parse(E.workflowState);
|
16541
16555
|
W.layouts = Object.values(q.layouts || {}).map((wt) => wt.layout), await qa(q), W.reloadedState = q;
|
16542
|
-
} else if (!
|
16556
|
+
} else if (!b && T.workflowState) {
|
16543
16557
|
const q = JSON.parse(T.workflowState);
|
16544
16558
|
W.layouts = Object.values(q.layouts || {}).map((wt) => wt.layout), await qa(q), W.reloadedState = q;
|
16545
16559
|
} else
|
@@ -16550,13 +16564,15 @@ class Ed {
|
|
16550
16564
|
return W.renderableContextService = new ll(
|
16551
16565
|
W.layouts
|
16552
16566
|
), W.delayWorkflowStateSync = !0, { experienceOptions: W, index: F, options: T };
|
16553
|
-
}),
|
16567
|
+
}), S = await Promise.all(f);
|
16554
16568
|
k.setMap("transactionOwnerIds", g);
|
16555
|
-
const
|
16556
|
-
|
16557
|
-
|
16558
|
-
|
16559
|
-
|
16569
|
+
const B = S.sort((C, E) => C.index - E.index);
|
16570
|
+
let I = [];
|
16571
|
+
for (const C of B) {
|
16572
|
+
const { experienceOptions: E, options: P } = C, b = new Yo(this, E);
|
16573
|
+
await b.getWorkflowManager().getInitializationPromise(), P.type !== "transaction" && this.customer && await b.attachCustomerDetails({ email: this.customer.emailAddress }), I = [...I, b], b.getWorkflowManager().setWorkflowStateSyncEnabled(!0);
|
16574
|
+
}
|
16575
|
+
return I;
|
16560
16576
|
}
|
16561
16577
|
storeCustomer(t) {
|
16562
16578
|
const e = k.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
|
@@ -16918,7 +16934,7 @@ class Fd {
|
|
16918
16934
|
traversableScenes() {
|
16919
16935
|
throw new Error("Method not implemented.");
|
16920
16936
|
}
|
16921
|
-
updateRecipient(t, e, a, r, i, s, o, l, c, d, A, u, h, m,
|
16937
|
+
updateRecipient(t, e, a, r, i, s, o, l, c, d, A, u, h, m, p, g, f) {
|
16922
16938
|
throw new Error("Method not implemented.");
|
16923
16939
|
}
|
16924
16940
|
approveTransaction(t) {
|