@spiffcommerce/core 22.7.4 → 22.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +880 -868
- package/dist/index.umd.cjs +13 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHttpLink as RA, InMemoryCache as HA, ApolloClient as UA, from as kA, gql as f } from "@apollo/client/core";
|
|
2
|
-
import { fetch as ot, getAttributesFromArrayBuffer as Ot, AssetType as _e, StepType as y, getFrameData as rt, frameDataCache as GA, modifySVGColors as bA, svgToDataUrl as JA, GroupCommand as U, UpdateFramePattern as Lt, UpdateFrameThresholdSettingsCommand as TA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as L, generateSVGWithUnknownColors as Le, svgObjectURL as Re, fetchAsString as _, DeleteElementCommand as ne, generateDefaultRectangleFrameSvg as Ft, GetSVGDimensions as OA, patternImageDataCache as yt, fetchAsArrayBuffer as LA, findElement as He, modifySVGWithElementProperties as zA, IllustrationColorCommand as et, IllustrationCacheCommand as KA, getFontMetrics as jA, getPatternImageData as tt, FontAlignmentCommand as VA, FontColorCommand as WA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as Ne, FontSourceCommand as Mt, loadFont as gt, TextChangeCommand as XA, FontSizeCommand as qA, createElementNS as ZA, createElement as fe, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as St, CommandContext as $A, createCanvas as Ue, getSvgElement as zt, LayoutRenderingPurpose as Kt, renderPapyrusComponentAsString as jt, loadImage as Vt, getDomParser as Wt, toBase64 as Yt, getVariant as _A, generateFrameSVG as ea, getDefaultVariant as ze, domParser as Xt, sanitizeSvgTree as qt, traverse as ta, xmlSerializer as Zt, CreateLayoutCommand as Aa, AspectType as $, rehydrateSerializedLayout as
|
|
3
|
-
import { AspectType as
|
|
2
|
+
import { fetch as ot, getAttributesFromArrayBuffer as Ot, AssetType as _e, StepType as y, getFrameData as rt, frameDataCache as GA, modifySVGColors as bA, svgToDataUrl as JA, GroupCommand as U, UpdateFramePattern as Lt, UpdateFrameThresholdSettingsCommand as TA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as L, generateSVGWithUnknownColors as Le, svgObjectURL as Re, fetchAsString as _, DeleteElementCommand as ne, generateDefaultRectangleFrameSvg as Ft, GetSVGDimensions as OA, patternImageDataCache as yt, fetchAsArrayBuffer as LA, findElement as He, modifySVGWithElementProperties as zA, IllustrationColorCommand as et, IllustrationCacheCommand as KA, getFontMetrics as jA, getPatternImageData as tt, FontAlignmentCommand as VA, FontColorCommand as WA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as Ne, FontSourceCommand as Mt, loadFont as gt, TextChangeCommand as XA, FontSizeCommand as qA, createElementNS as ZA, createElement as fe, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as St, CommandContext as $A, createCanvas as Ue, getSvgElement as zt, LayoutRenderingPurpose as Kt, renderPapyrusComponentAsString as jt, loadImage as Vt, getDomParser as Wt, toBase64 as Yt, getVariant as _A, generateFrameSVG as ea, getDefaultVariant as ze, domParser as Xt, sanitizeSvgTree as qt, traverse as ta, xmlSerializer as Zt, CreateLayoutCommand as Aa, AspectType as $, rehydrateSerializedLayout as se } from "@spiffcommerce/papyrus";
|
|
3
|
+
import { AspectType as Ys, AssetType as Ps, BringForwardCommand as xs, BringToBackCommand as Ns, BringToFrontCommand as vs, CanvasCommand as Rs, CommandContext as Hs, CreateElementCommand as Us, CreateLayoutCommand as ks, DeleteElementCommand as Gs, FontAlignmentCommand as bs, FontColorCommand as Js, FontSizeCommand as Ts, FontSourceCommand as Os, GroupCommand as Ls, LayoutElementFactory as zs, LayoutElementType as Ks, MoveCommand as js, ResizeCommand as Vs, RotateCommand as Ws, SendBackwardsCommand as Xs, StepAspectType as qs, StepType as Zs, TextChangeCommand as $s, UnitOfMeasurement as _s, UpdateImageSourceCommand as eo, dataUrlFromExternalUrl as to, determineCorrectFontSizeAndLines as Ao, findElement as ao, frameDataCache as no, generate as io, generateSVGWithUnknownColors as so, getAttributesFromArrayBuffer as oo, getAxisAlignedBoundingBox as ro, getFrameData as co, getSvgElement as go, loadFont as lo, patternImageDataCache as Bo, registerFetchImplementation as Co, registerWindowImplementation as wo, rehydrateSerializedLayout as Eo, setCanvasModule as ho, svgToDataUrl as uo } from "@spiffcommerce/papyrus";
|
|
4
4
|
import { setContext as aa } from "@apollo/client/link/context";
|
|
5
5
|
import { onError as na } from "@apollo/client/link/error";
|
|
6
6
|
import { Pith as $t } from "pith";
|
|
@@ -8,7 +8,7 @@ import _t from "lodash.debounce";
|
|
|
8
8
|
import eA from "lodash.isequal";
|
|
9
9
|
import he from "lodash.clonedeep";
|
|
10
10
|
import { toString as tA } from "qrcode";
|
|
11
|
-
import
|
|
11
|
+
import ia from "fuse.js";
|
|
12
12
|
import { split as at } from "unicode-default-word-boundary";
|
|
13
13
|
import Bt from "svg-path-bbox";
|
|
14
14
|
import Pt from "lodash.chunk";
|
|
@@ -32,7 +32,7 @@ class z extends De {
|
|
|
32
32
|
super(`Panel not Found: ${e.panelId}`), this.panelId = (e == null ? void 0 : e.panelId) || "N/A";
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class ie extends De {
|
|
36
36
|
constructor(e) {
|
|
37
37
|
super(`Asset not found for variant: ${e.name}`), this.variant = e;
|
|
38
38
|
}
|
|
@@ -72,7 +72,7 @@ class je extends Ke {
|
|
|
72
72
|
super(`Resource Generation Failed: ${e}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
class
|
|
75
|
+
class sa {
|
|
76
76
|
get(e) {
|
|
77
77
|
return localStorage.getItem(e) || void 0;
|
|
78
78
|
}
|
|
@@ -117,7 +117,7 @@ class xt {
|
|
|
117
117
|
}
|
|
118
118
|
const oa = () => {
|
|
119
119
|
try {
|
|
120
|
-
return localStorage ? new
|
|
120
|
+
return localStorage ? new sa() : new xt();
|
|
121
121
|
} catch {
|
|
122
122
|
return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."), new xt();
|
|
123
123
|
}
|
|
@@ -186,8 +186,8 @@ class Ca {
|
|
|
186
186
|
const e = RA({
|
|
187
187
|
uri: `${q.getServerUrl()}/graphql`,
|
|
188
188
|
fetch: ot
|
|
189
|
-
}), t = aa(async (
|
|
190
|
-
const { headers: o } =
|
|
189
|
+
}), t = aa(async (i, s) => {
|
|
190
|
+
const { headers: o } = s, r = o || {}, c = await da(), B = s.bearer ?? c.bearer, l = s.partnerId ?? c.partnerId, d = s.activeIntegration ?? c.activeIntegration, C = s.transactionOwnerId, w = s.customerToken ?? c.customerToken, E = s.applicationKey ?? c.applicationKey, u = s.bundleOwnerId;
|
|
191
191
|
try {
|
|
192
192
|
if (window && window.__SENTRY__) {
|
|
193
193
|
const h = window.__SENTRY__.hub;
|
|
@@ -203,17 +203,17 @@ class Ca {
|
|
|
203
203
|
return B && (r.Authorization = `Bearer ${B}`), l && (r.partnerId = l), d && (r.activeIntegration = d), C && (r.transactionOwnerId = C), w && (r.customerToken = w), E && (r["X-Application-Key"] = E), u && (r.bundleOwnerId = u), {
|
|
204
204
|
headers: r
|
|
205
205
|
};
|
|
206
|
-
}), A = na(({ operation:
|
|
207
|
-
const r =
|
|
208
|
-
o && console.log("GraphQL Network error"), r.forEach(() => console.log("GraphQL Error: " +
|
|
206
|
+
}), A = na(({ operation: i, graphQLErrors: s, networkError: o }) => {
|
|
207
|
+
const r = s || [];
|
|
208
|
+
o && console.log("GraphQL Network error"), r.forEach(() => console.log("GraphQL Error: " + i.operationName));
|
|
209
209
|
});
|
|
210
210
|
function a() {
|
|
211
211
|
return {
|
|
212
|
-
read(
|
|
213
|
-
return
|
|
212
|
+
read(i = null) {
|
|
213
|
+
return i;
|
|
214
214
|
},
|
|
215
|
-
merge(
|
|
216
|
-
return
|
|
215
|
+
merge(i, s) {
|
|
216
|
+
return s || i || null;
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
}
|
|
@@ -377,8 +377,8 @@ const x = new Ca(), wa = f`
|
|
|
377
377
|
ids: g
|
|
378
378
|
}
|
|
379
379
|
})).data.materials, pa = async (g, e, t, A, a) => {
|
|
380
|
-
var
|
|
381
|
-
return (
|
|
380
|
+
var i;
|
|
381
|
+
return (i = (await x.getShadowGraphqlClient().mutate({
|
|
382
382
|
mutation: ua,
|
|
383
383
|
errorPolicy: "all",
|
|
384
384
|
fetchPolicy: "no-cache",
|
|
@@ -389,16 +389,16 @@ const x = new Ca(), wa = f`
|
|
|
389
389
|
anonymous: A,
|
|
390
390
|
temporary: a
|
|
391
391
|
}
|
|
392
|
-
})).data) == null ? void 0 :
|
|
392
|
+
})).data) == null ? void 0 : i.assetCreate;
|
|
393
393
|
};
|
|
394
394
|
class Da {
|
|
395
395
|
constructor() {
|
|
396
396
|
this.cache = /* @__PURE__ */ new Map(), this.bgrmProcessCache = /* @__PURE__ */ new Map(), this.materialCache = /* @__PURE__ */ new Map(), this.loadImageAsFileInfo = async (e) => {
|
|
397
|
-
const t = await e.arrayBuffer(), A = await Ot(t), a = (n,
|
|
398
|
-
const
|
|
399
|
-
for (let r = 0; r <
|
|
400
|
-
o.push(
|
|
401
|
-
return new Blob([new Uint8Array(o)], { type:
|
|
397
|
+
const t = await e.arrayBuffer(), A = await Ot(t), a = (n, i) => {
|
|
398
|
+
const s = atob(n.split(",")[1]), o = [];
|
|
399
|
+
for (let r = 0; r < s.length; r++)
|
|
400
|
+
o.push(s.charCodeAt(r));
|
|
401
|
+
return new Blob([new Uint8Array(o)], { type: i });
|
|
402
402
|
};
|
|
403
403
|
return {
|
|
404
404
|
name: e.name.substring(e.name.lastIndexOf("/") + 1),
|
|
@@ -466,18 +466,18 @@ class Da {
|
|
|
466
466
|
* The asset will be stored via the persistence service for future access, if available.
|
|
467
467
|
*/
|
|
468
468
|
async uploadAssetWithProgress(e, t, A, a, n) {
|
|
469
|
-
const
|
|
470
|
-
if (!
|
|
469
|
+
const i = await this.dispatchCreateAssetRequest(e, t, a, n);
|
|
470
|
+
if (!i)
|
|
471
471
|
throw new Error("Failed to create asset.");
|
|
472
|
-
return await new Promise((
|
|
472
|
+
return await new Promise((s, o) => {
|
|
473
473
|
const r = new XMLHttpRequest();
|
|
474
|
-
r.open("PUT",
|
|
474
|
+
r.open("PUT", i.assetResponse.uploadUrl, !0), r.setRequestHeader("Content-Type", i.mimeType), r.setRequestHeader("Cache-Control", "public,max-age=31536000,immutable"), r.upload.onprogress = (c) => {
|
|
475
475
|
c.lengthComputable && A(c.loaded * 100 / c.total);
|
|
476
476
|
}, r.onload = () => {
|
|
477
|
-
const c =
|
|
478
|
-
oe.add(
|
|
477
|
+
const c = i.assetResponse.asset;
|
|
478
|
+
oe.add(i.assetResponse.asset), s(c);
|
|
479
479
|
}, r.onerror = o, r.send(e.blob);
|
|
480
|
-
}), this.cacheAsset(
|
|
480
|
+
}), this.cacheAsset(i.assetResponse.asset), i.assetResponse.asset;
|
|
481
481
|
}
|
|
482
482
|
async uploadAsset(e, t, A, a) {
|
|
483
483
|
return this.uploadAssetWithProgress(e, t, () => {
|
|
@@ -505,7 +505,7 @@ class Da {
|
|
|
505
505
|
return this.bgrmProcessCache.set(t, n), n;
|
|
506
506
|
}
|
|
507
507
|
const a = (async () => {
|
|
508
|
-
var
|
|
508
|
+
var i, s;
|
|
509
509
|
const n = await x.getShadowGraphqlClient().mutate({
|
|
510
510
|
mutation: Qa,
|
|
511
511
|
fetchPolicy: "no-cache",
|
|
@@ -514,7 +514,7 @@ class Da {
|
|
|
514
514
|
key: t
|
|
515
515
|
}
|
|
516
516
|
});
|
|
517
|
-
if (this.bgrmProcessCache.delete(t), !((
|
|
517
|
+
if (this.bgrmProcessCache.delete(t), !((s = (i = n.data) == null ? void 0 : i.assetRemoveBackground) != null && s.key))
|
|
518
518
|
throw new Error("Failed to remove background from image");
|
|
519
519
|
return oe.add(n.data.assetRemoveBackground), K.add(t, n.data.assetRemoveBackground.key), this.cache.set(
|
|
520
520
|
n.data.assetRemoveBackground.key,
|
|
@@ -541,10 +541,10 @@ class Da {
|
|
|
541
541
|
* @param assetType The type of asset we're expecting to upload
|
|
542
542
|
*/
|
|
543
543
|
async dispatchCreateAssetRequest(e, t, A, a) {
|
|
544
|
-
const n = e.blob.type ? e.blob.type : this.guessMIME(e.name),
|
|
545
|
-
if (
|
|
544
|
+
const n = e.blob.type ? e.blob.type : this.guessMIME(e.name), i = await pa(e.name, t, n, A, a);
|
|
545
|
+
if (i)
|
|
546
546
|
return {
|
|
547
|
-
assetResponse:
|
|
547
|
+
assetResponse: i,
|
|
548
548
|
mimeType: n
|
|
549
549
|
};
|
|
550
550
|
}
|
|
@@ -562,7 +562,7 @@ class Da {
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
const Be = "persistentAssets",
|
|
565
|
+
const Be = "persistentAssets", iA = class te {
|
|
566
566
|
/**
|
|
567
567
|
* Add a new asset to persistence
|
|
568
568
|
* @param asset The asset to add.
|
|
@@ -613,8 +613,8 @@ const Be = "persistentAssets", sA = class te {
|
|
|
613
613
|
te.callbacks.forEach((e) => e());
|
|
614
614
|
}
|
|
615
615
|
};
|
|
616
|
-
|
|
617
|
-
let oe =
|
|
616
|
+
iA.callbacks = [];
|
|
617
|
+
let oe = iA;
|
|
618
618
|
const vt = "bgrmPersistentAssets";
|
|
619
619
|
class K {
|
|
620
620
|
static has(e) {
|
|
@@ -680,7 +680,7 @@ class Ia {
|
|
|
680
680
|
this.disabled = e;
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
|
-
const Qe = new Ia(),
|
|
683
|
+
const Qe = new Ia(), sA = f`
|
|
684
684
|
fragment OptionFields on Option {
|
|
685
685
|
id
|
|
686
686
|
name
|
|
@@ -720,7 +720,7 @@ const Qe = new Ia(), iA = f`
|
|
|
720
720
|
`, fa = f`
|
|
721
721
|
${Ie(!1)}
|
|
722
722
|
${Ct}
|
|
723
|
-
${
|
|
723
|
+
${sA}
|
|
724
724
|
query GetOptions($ids: [String]!) {
|
|
725
725
|
options(ids: $ids) {
|
|
726
726
|
...OptionFields
|
|
@@ -742,12 +742,12 @@ const Qe = new Ia(), iA = f`
|
|
|
742
742
|
});
|
|
743
743
|
}), e.data.options;
|
|
744
744
|
}, ya = async (g, e) => (await e).find((A) => A.id === g), Ma = async (g) => {
|
|
745
|
-
const e = g.map((
|
|
745
|
+
const e = g.map((i) => Qe.get({ id: i })), t = g.filter((i, s) => e[s] === void 0);
|
|
746
746
|
if (t.length === 0)
|
|
747
747
|
return Promise.all(e);
|
|
748
748
|
const A = Fa(t), a = t.map(
|
|
749
|
-
(
|
|
750
|
-
), n = e.filter((
|
|
749
|
+
(i) => Qe.set({ id: i }, ya(i, A))
|
|
750
|
+
), n = e.filter((i) => i !== void 0);
|
|
751
751
|
return await Promise.all(n.concat(a));
|
|
752
752
|
};
|
|
753
753
|
class Sa {
|
|
@@ -773,13 +773,13 @@ class Sa {
|
|
|
773
773
|
var a, n;
|
|
774
774
|
const t = e.thumbnail;
|
|
775
775
|
if (t) {
|
|
776
|
-
const
|
|
777
|
-
return (
|
|
776
|
+
const i = (a = t.versions) == null ? void 0 : a.find((o) => o.name === "thumbnail"), s = t.fileLink;
|
|
777
|
+
return (i == null ? void 0 : i.link) || s;
|
|
778
778
|
}
|
|
779
779
|
const A = e.asset;
|
|
780
780
|
if (A) {
|
|
781
|
-
const
|
|
782
|
-
return (
|
|
781
|
+
const i = (n = A.versions) == null ? void 0 : n.find((o) => o.name === "thumbnail"), s = A.fileLink;
|
|
782
|
+
return (i == null ? void 0 : i.link) || s;
|
|
783
783
|
}
|
|
784
784
|
return e.material ? e.material.id : "";
|
|
785
785
|
}
|
|
@@ -1458,7 +1458,7 @@ const Ja = f`
|
|
|
1458
1458
|
silentSteps: de.includes(A.type) ? [A] : []
|
|
1459
1459
|
});
|
|
1460
1460
|
else {
|
|
1461
|
-
const n = e.find((
|
|
1461
|
+
const n = e.find((i) => i.name === a.name);
|
|
1462
1462
|
n ? de.includes(A.type) ? n.silentSteps.push(A) : n.renderableSteps.push(A) : e.push({
|
|
1463
1463
|
name: a.name,
|
|
1464
1464
|
title: a.name,
|
|
@@ -1491,7 +1491,7 @@ const Ja = f`
|
|
|
1491
1491
|
if (A && A.selectedVariants) {
|
|
1492
1492
|
const a = A.selectedVariants;
|
|
1493
1493
|
return t.requiredVariantSelections.some(
|
|
1494
|
-
(n) => a.find((
|
|
1494
|
+
(n) => a.find((i) => i.id === n) !== void 0
|
|
1495
1495
|
);
|
|
1496
1496
|
}
|
|
1497
1497
|
return !1;
|
|
@@ -1504,18 +1504,18 @@ const Ja = f`
|
|
|
1504
1504
|
};
|
|
1505
1505
|
return t.silentSteps.length === 0 && t.renderableSteps.length === 0 ? null : t;
|
|
1506
1506
|
}, ce = (g, e) => g.map((t) => ja(t, e)).filter((t) => t !== null), Va = async (g, e, t = !1) => {
|
|
1507
|
-
var
|
|
1507
|
+
var i;
|
|
1508
1508
|
const A = ce(g, e), a = [];
|
|
1509
|
-
for (const
|
|
1510
|
-
for (const o of
|
|
1511
|
-
const r = (((
|
|
1509
|
+
for (const s of A)
|
|
1510
|
+
for (const o of s.renderableSteps) {
|
|
1511
|
+
const r = (((i = o.option) == null ? void 0 : i.variants) || []).length;
|
|
1512
1512
|
o.silent || (o.type === y.Model || o.type === y.Material || o.type === y.Picture || o.type === y.Shape ? (r > 1 || t) && a.push(o.stepName) : a.push(o.stepName));
|
|
1513
1513
|
}
|
|
1514
|
-
const n = A.filter((
|
|
1514
|
+
const n = A.filter((s) => s.renderableSteps.filter(
|
|
1515
1515
|
(r) => a.includes(r.stepName)
|
|
1516
1516
|
).length > 0);
|
|
1517
|
-
for (const
|
|
1518
|
-
|
|
1517
|
+
for (const s of n)
|
|
1518
|
+
s.renderableSteps = s.renderableSteps.filter(
|
|
1519
1519
|
(o) => a.includes(o.stepName)
|
|
1520
1520
|
);
|
|
1521
1521
|
return n;
|
|
@@ -1598,13 +1598,13 @@ class dA {
|
|
|
1598
1598
|
function Wa(g, e, t, A) {
|
|
1599
1599
|
const a = t.width * g.zoom, n = t.height * g.zoom;
|
|
1600
1600
|
if (A) {
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1603
|
-
const r = t.width *
|
|
1604
|
-
return
|
|
1601
|
+
const s = g, o = Math.max(e.width / t.width, e.height / t.height);
|
|
1602
|
+
s.zoom = Math.max(o, g.zoom);
|
|
1603
|
+
const r = t.width * s.zoom, c = t.height * s.zoom;
|
|
1604
|
+
return s.x = ye(g.x, e.width - r, 0), s.y = ye(g.y, e.height - c, 0), s;
|
|
1605
1605
|
}
|
|
1606
|
-
const
|
|
1607
|
-
return
|
|
1606
|
+
const i = g;
|
|
1607
|
+
return i.x = ye(i.x, -a, e.width), i.y = ye(i.y, -n, e.height), i;
|
|
1608
1608
|
}
|
|
1609
1609
|
function ye(g, e, t) {
|
|
1610
1610
|
return Math.min(Math.max(g, e), t);
|
|
@@ -1630,12 +1630,12 @@ class Xa {
|
|
|
1630
1630
|
const a = A;
|
|
1631
1631
|
if (a.currentFrameSources) {
|
|
1632
1632
|
let n = !1;
|
|
1633
|
-
for (let
|
|
1634
|
-
const
|
|
1635
|
-
eA(o, r) || (this.frameData || (this.frameData = new Array(a.currentFrameSources.length)), this.frameData[
|
|
1633
|
+
for (let i = 0; i < a.currentFrameSources.length; i++) {
|
|
1634
|
+
const s = a.currentFrameSources[i], o = await rt(s), r = this.frameData ? this.frameData[i] : void 0;
|
|
1635
|
+
eA(o, r) || (this.frameData || (this.frameData = new Array(a.currentFrameSources.length)), this.frameData[i] = o, n = !0);
|
|
1636
1636
|
}
|
|
1637
1637
|
n && (this.onFrameDataChangeListeners.forEach(
|
|
1638
|
-
(
|
|
1638
|
+
(i) => i(this.frameData)
|
|
1639
1639
|
), this.frameData && this.imageData && (this.recalculateOffsets(this.imageData), this.updateOffsets(this.offsets), this.recalculateZoomLimits(this.imageData, this.frameData)));
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
@@ -1713,15 +1713,15 @@ class Xa {
|
|
|
1713
1713
|
setZoom(e, t, A, a) {
|
|
1714
1714
|
if (this.imageData && this.offsets && this.frameData) {
|
|
1715
1715
|
(!this.offsets || this.offsets.length !== this.frameData.length) && (this.offsets = new Array(this.frameData.length));
|
|
1716
|
-
const n = this.frameData.map((
|
|
1717
|
-
const o = (t[
|
|
1716
|
+
const n = this.frameData.map((i, s) => {
|
|
1717
|
+
const o = (t[s] - this.offsets[s].x) / this.offsets[s].zoom, r = (A[s] - this.offsets[s].y) / this.offsets[s].zoom, c = t[s] - o * e[s], B = A[s] - r * e[s];
|
|
1718
1718
|
return {
|
|
1719
1719
|
x: c,
|
|
1720
1720
|
y: B,
|
|
1721
|
-
zoom: this.imageData.width * e[
|
|
1721
|
+
zoom: this.imageData.width * e[s] / this.imageData.width
|
|
1722
1722
|
};
|
|
1723
1723
|
});
|
|
1724
|
-
this.updateOffsets(n, a), this.onZoomChangeListeners.forEach((
|
|
1724
|
+
this.updateOffsets(n, a), this.onZoomChangeListeners.forEach((i) => i(e));
|
|
1725
1725
|
}
|
|
1726
1726
|
}
|
|
1727
1727
|
/**
|
|
@@ -1747,12 +1747,12 @@ class Xa {
|
|
|
1747
1747
|
throw new b(
|
|
1748
1748
|
"Frame data and offsets are not the same length. This is a bug. Please report it."
|
|
1749
1749
|
);
|
|
1750
|
-
if (!this.offsets.some((
|
|
1750
|
+
if (!this.offsets.some((i, s) => !(e[s].x === i.x && e[s].y === i.y && e[s].zoom === i.zoom)) && !A) {
|
|
1751
1751
|
t && t();
|
|
1752
1752
|
return;
|
|
1753
1753
|
}
|
|
1754
|
-
(!this.offsets || this.offsets.length !== this.frameData.length) && (this.offsets = new Array(this.frameData.length)), this.frameData.forEach((
|
|
1755
|
-
this.offsets[
|
|
1754
|
+
(!this.offsets || this.offsets.length !== this.frameData.length) && (this.offsets = new Array(this.frameData.length)), this.frameData.forEach((i, s) => {
|
|
1755
|
+
this.offsets[s] = Wa(e[s], i, this.imageData, this.forceImageCover);
|
|
1756
1756
|
}), this._debouncedUpdateFrameOffsets(
|
|
1757
1757
|
this.offsets,
|
|
1758
1758
|
a,
|
|
@@ -1787,17 +1787,17 @@ class Xa {
|
|
|
1787
1787
|
* @param onComplete A callback when the operation is completed.
|
|
1788
1788
|
*/
|
|
1789
1789
|
updateFrameOffsets(e, t, A, a, n) {
|
|
1790
|
-
if (!A || A.length === 0 || A.some((
|
|
1790
|
+
if (!A || A.length === 0 || A.some((s) => !s))
|
|
1791
1791
|
throw new b("Frame data not set. This is a bug");
|
|
1792
1792
|
if (!this.workflowManager)
|
|
1793
1793
|
throw new b("No workflow manager set, cannot update offsets.");
|
|
1794
|
-
const
|
|
1795
|
-
this.targetElements.forEach((
|
|
1796
|
-
|
|
1794
|
+
const i = this.workflowManager.getCommandDispatcher();
|
|
1795
|
+
this.targetElements.forEach((s, o) => {
|
|
1796
|
+
i(
|
|
1797
1797
|
new U([
|
|
1798
|
-
new Lt(
|
|
1798
|
+
new Lt(s, t, e[o]),
|
|
1799
1799
|
new TA(
|
|
1800
|
-
|
|
1800
|
+
s,
|
|
1801
1801
|
a.useThreshold,
|
|
1802
1802
|
a.invertThreshold,
|
|
1803
1803
|
a.threshold,
|
|
@@ -1833,14 +1833,14 @@ class Ht {
|
|
|
1833
1833
|
const n = this.layouts.find((l) => l.panelId === a.panelId);
|
|
1834
1834
|
if (!n)
|
|
1835
1835
|
throw new z(a);
|
|
1836
|
-
let
|
|
1836
|
+
let i = "";
|
|
1837
1837
|
if (this.configuration.type === y.ProductOverlay) {
|
|
1838
1838
|
let l = "";
|
|
1839
|
-
if ((o = this.product) != null && o.overlayImageUrl && (l = this.product.overlayImageUrl),
|
|
1839
|
+
if ((o = this.product) != null && o.overlayImageUrl && (l = this.product.overlayImageUrl), i = l, !l)
|
|
1840
1840
|
throw new Ge(this.configuration, "Couldn't find an asset for product overlay step");
|
|
1841
1841
|
}
|
|
1842
|
-
const
|
|
1843
|
-
if (
|
|
1842
|
+
const s = this.evaluateAssetType();
|
|
1843
|
+
if (s === G.Image) {
|
|
1844
1844
|
const l = this.configuration.type === y.SilentIllustration ? (r = this.configuration.data.asset) == null ? void 0 : r.fileLink : (c = this.product) == null ? void 0 : c.overlayImageUrl;
|
|
1845
1845
|
if (!l)
|
|
1846
1846
|
throw new Error("Undefined raster silent step source");
|
|
@@ -1848,7 +1848,7 @@ class Ht {
|
|
|
1848
1848
|
stepName: this.configuration.stepName,
|
|
1849
1849
|
id: J(),
|
|
1850
1850
|
src: l,
|
|
1851
|
-
type:
|
|
1851
|
+
type: s,
|
|
1852
1852
|
y: a.top,
|
|
1853
1853
|
x: a.left,
|
|
1854
1854
|
width: a.width,
|
|
@@ -1869,7 +1869,7 @@ class Ht {
|
|
|
1869
1869
|
command: new L(d, n)
|
|
1870
1870
|
};
|
|
1871
1871
|
} else {
|
|
1872
|
-
const l = this.configuration.type === y.SilentIllustration ? (B = this.configuration.data.asset) == null ? void 0 : B.fileLink :
|
|
1872
|
+
const l = this.configuration.type === y.SilentIllustration ? (B = this.configuration.data.asset) == null ? void 0 : B.fileLink : i, C = await Le(await (async () => new Promise((E, u) => {
|
|
1873
1873
|
if (!l) {
|
|
1874
1874
|
u("Undefined vector silent step source");
|
|
1875
1875
|
return;
|
|
@@ -1884,7 +1884,7 @@ class Ht {
|
|
|
1884
1884
|
src: l,
|
|
1885
1885
|
svg: C.svg,
|
|
1886
1886
|
colors: C.colors,
|
|
1887
|
-
type:
|
|
1887
|
+
type: s,
|
|
1888
1888
|
y: a.top,
|
|
1889
1889
|
x: a.left,
|
|
1890
1890
|
width: a.width,
|
|
@@ -1987,7 +1987,7 @@ class Za {
|
|
|
1987
1987
|
var w, E;
|
|
1988
1988
|
const d = (await nt([t]))[0], C = (E = (w = d == null ? void 0 : d.versions) == null ? void 0 : w.find((u) => u.name === "mpeg4")) == null ? void 0 : E.link;
|
|
1989
1989
|
return { asset: d, link: C };
|
|
1990
|
-
},
|
|
1990
|
+
}, i = await new Promise((d, C) => {
|
|
1991
1991
|
new CA(
|
|
1992
1992
|
async () => !!(await n()).link,
|
|
1993
1993
|
async () => {
|
|
@@ -2007,8 +2007,8 @@ class Za {
|
|
|
2007
2007
|
);
|
|
2008
2008
|
});
|
|
2009
2009
|
e.forEach((d) => A.getCommandDispatcher()(new ne(d.id)));
|
|
2010
|
-
const
|
|
2011
|
-
o.searchParams.append("video", btoa(JSON.stringify([
|
|
2010
|
+
const s = a.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", o = new URL(s + a.data.baseUrl);
|
|
2011
|
+
o.searchParams.append("video", btoa(JSON.stringify([i]))), o.pathname = o.pathname + (o.pathname.slice(-1) === "/" ? "" : "/");
|
|
2012
2012
|
const r = o.toString();
|
|
2013
2013
|
if (r.length >= 2e3)
|
|
2014
2014
|
throw new je("Cannot create QR code, URL too long.");
|
|
@@ -2019,7 +2019,7 @@ class Za {
|
|
|
2019
2019
|
return l && (l.command && A.getCommandDispatcher()(l.command), l.followup && await l.followup()), await A.setSelectionsAndElements(a.stepName, [], B, async () => {
|
|
2020
2020
|
A.updateStorage(a.stepName, {
|
|
2021
2021
|
videoShortUrl: c,
|
|
2022
|
-
videoUrl:
|
|
2022
|
+
videoUrl: i.href
|
|
2023
2023
|
});
|
|
2024
2024
|
}), c;
|
|
2025
2025
|
}
|
|
@@ -2028,7 +2028,7 @@ class Za {
|
|
|
2028
2028
|
return e.data.regions.map(t);
|
|
2029
2029
|
}
|
|
2030
2030
|
async command(e, t, A, a) {
|
|
2031
|
-
const n = A.getLayouts(),
|
|
2031
|
+
const n = A.getLayouts(), s = `data:image/svg+xml;base64,${btoa(await tA(e, { type: "svg" }))}`, o = t.map((r) => {
|
|
2032
2032
|
const c = r.region, B = n.find((l) => l.panelId === (c == null ? void 0 : c.panelId));
|
|
2033
2033
|
if (!B && c)
|
|
2034
2034
|
throw new z(c);
|
|
@@ -2041,7 +2041,7 @@ class Za {
|
|
|
2041
2041
|
stepRegion: c,
|
|
2042
2042
|
stepName: a,
|
|
2043
2043
|
id: r.id,
|
|
2044
|
-
src:
|
|
2044
|
+
src: s,
|
|
2045
2045
|
type: G.Image,
|
|
2046
2046
|
y: c.top,
|
|
2047
2047
|
x: c.left,
|
|
@@ -4745,7 +4745,7 @@ const wA = new Za(), me = [
|
|
|
4745
4745
|
parseInt(g.substring(2, 4), 16),
|
|
4746
4746
|
parseInt(g.substring(4, 6), 16)
|
|
4747
4747
|
]);
|
|
4748
|
-
function
|
|
4748
|
+
function Qs(g) {
|
|
4749
4749
|
const e = me.indexOf(g);
|
|
4750
4750
|
return e >= 0 ? ge[e] : "";
|
|
4751
4751
|
}
|
|
@@ -4753,26 +4753,26 @@ function $a(g) {
|
|
|
4753
4753
|
const e = ge.indexOf(g);
|
|
4754
4754
|
return e >= 0 ? me[e] : "";
|
|
4755
4755
|
}
|
|
4756
|
-
function
|
|
4756
|
+
function ms(g, e = 64) {
|
|
4757
4757
|
const t = [], A = [], a = $a(g);
|
|
4758
4758
|
a && t.push({
|
|
4759
4759
|
pms: a,
|
|
4760
4760
|
hex: g,
|
|
4761
4761
|
distance: 0
|
|
4762
4762
|
});
|
|
4763
|
-
const n = parseInt(g.substring(0, 2), 16),
|
|
4763
|
+
const n = parseInt(g.substring(0, 2), 16), i = parseInt(g.substring(2, 4), 16), s = parseInt(g.substring(4, 6), 16);
|
|
4764
4764
|
let o, r, c;
|
|
4765
4765
|
for (let B = 0; B < ge.length; B++) {
|
|
4766
4766
|
o = We[B][0], r = We[B][1], c = We[B][2];
|
|
4767
|
-
const l = Math.sqrt(Math.pow(n - o, 2) + Math.pow(
|
|
4767
|
+
const l = Math.sqrt(Math.pow(n - o, 2) + Math.pow(i - r, 2) + Math.pow(s - c, 2));
|
|
4768
4768
|
A.push(l);
|
|
4769
4769
|
}
|
|
4770
4770
|
for (let B = 0; B < A.length; B++)
|
|
4771
4771
|
A[B] <= e && !t.some((l) => l.pms === me[B]) && t.push({ pms: me[B], hex: ge[B], distance: A[B] });
|
|
4772
4772
|
return t.sort((B, l) => B.distance - l.distance);
|
|
4773
4773
|
}
|
|
4774
|
-
const _a = me.map((g, e) => ({ pms: g, hex: ge[e] })), en = new
|
|
4775
|
-
function
|
|
4774
|
+
const _a = me.map((g, e) => ({ pms: g, hex: ge[e] })), en = new ia(_a, { keys: ["pms"] });
|
|
4775
|
+
function ps(g, e) {
|
|
4776
4776
|
return en.search(g, e ? { limit: e } : void 0);
|
|
4777
4777
|
}
|
|
4778
4778
|
let Ce = null;
|
|
@@ -4798,7 +4798,7 @@ class An {
|
|
|
4798
4798
|
return Ft(t);
|
|
4799
4799
|
const A = e.asset;
|
|
4800
4800
|
if (!A)
|
|
4801
|
-
throw new
|
|
4801
|
+
throw new ie(e);
|
|
4802
4802
|
const a = A.fileLink;
|
|
4803
4803
|
if (a)
|
|
4804
4804
|
return _(a, !0);
|
|
@@ -4812,14 +4812,14 @@ class An {
|
|
|
4812
4812
|
let a;
|
|
4813
4813
|
const n = t.getWorkflowExperience().getBundle();
|
|
4814
4814
|
if (n && e.globalPropertyAspectConfigurations) {
|
|
4815
|
-
const
|
|
4815
|
+
const i = n.getGlobalPropertyStateManager(), s = e.globalPropertyAspectConfigurations[0], o = i.getAspectStorage(s.aspectName);
|
|
4816
4816
|
o && o.originalAssetKey && (a = (await k.getLocalOrFromServer(o.originalAssetKey)).fileLink);
|
|
4817
4817
|
}
|
|
4818
4818
|
if (e.option && e.option.variants && e.option.variants.length > 0) {
|
|
4819
|
-
const
|
|
4820
|
-
return
|
|
4819
|
+
const i = e.option, s = V.getDefaultVariant(i);
|
|
4820
|
+
return s ? this.selectVariantCommand(
|
|
4821
4821
|
e,
|
|
4822
|
-
|
|
4822
|
+
s,
|
|
4823
4823
|
[],
|
|
4824
4824
|
t,
|
|
4825
4825
|
void 0,
|
|
@@ -4902,12 +4902,12 @@ class An {
|
|
|
4902
4902
|
}
|
|
4903
4903
|
selectImage(e, t, A, a = !0) {
|
|
4904
4904
|
var o;
|
|
4905
|
-
const n = this.patternSource(t),
|
|
4906
|
-
if (
|
|
4905
|
+
const n = this.patternSource(t), i = (o = A.getStepStorage(e.stepName)) == null ? void 0 : o.framePatternSrc;
|
|
4906
|
+
if (i && i === n)
|
|
4907
4907
|
return Promise.resolve();
|
|
4908
4908
|
A.setEditedStatus(e.stepName, !0);
|
|
4909
|
-
const
|
|
4910
|
-
return
|
|
4909
|
+
const s = t.fileLink || "";
|
|
4910
|
+
return s.endsWith(".pdf") || s.endsWith(".eps") || s.endsWith(".ai") ? new Promise((r) => {
|
|
4911
4911
|
A.addPoller(
|
|
4912
4912
|
new CA(
|
|
4913
4913
|
async () => {
|
|
@@ -4930,14 +4930,14 @@ class An {
|
|
|
4930
4930
|
}) : this.loadPatternFromAsset(t, e, A, a);
|
|
4931
4931
|
}
|
|
4932
4932
|
async selectVariant(e, t, A, a, n) {
|
|
4933
|
-
const
|
|
4933
|
+
const i = await this.selectVariantCommand(
|
|
4934
4934
|
e,
|
|
4935
4935
|
t,
|
|
4936
4936
|
A,
|
|
4937
4937
|
a,
|
|
4938
4938
|
n
|
|
4939
4939
|
);
|
|
4940
|
-
|
|
4940
|
+
i && (i.command && a.getCommandDispatcher()(i.command), i.followup && await i.followup());
|
|
4941
4941
|
}
|
|
4942
4942
|
getCreateElementCommand(e, t, A, a) {
|
|
4943
4943
|
return new L(
|
|
@@ -4970,7 +4970,7 @@ class An {
|
|
|
4970
4970
|
}
|
|
4971
4971
|
async loadPatternFromString(e, t, A = !0, a = void 0, n) {
|
|
4972
4972
|
if (e.endsWith("svg")) {
|
|
4973
|
-
const
|
|
4973
|
+
const i = await OA(e), s = i.width, o = i.height, r = await _(e);
|
|
4974
4974
|
if (n) {
|
|
4975
4975
|
const l = r.match(/<(image|linearGradient|radialGradient)(\s|>|\/>)/gim);
|
|
4976
4976
|
if (l && l.length > 0)
|
|
@@ -4980,19 +4980,19 @@ class An {
|
|
|
4980
4980
|
}
|
|
4981
4981
|
const c = await Le(r), B = {
|
|
4982
4982
|
src: e,
|
|
4983
|
-
width:
|
|
4983
|
+
width: s,
|
|
4984
4984
|
height: o,
|
|
4985
|
-
aspect:
|
|
4985
|
+
aspect: s / o,
|
|
4986
4986
|
svg: c.svg,
|
|
4987
4987
|
colors: a ?? c.colors
|
|
4988
4988
|
};
|
|
4989
4989
|
yt.set(e, B), t.setPatternData(B, A);
|
|
4990
4990
|
} else {
|
|
4991
|
-
const
|
|
4991
|
+
const i = await LA(e, !0), s = await Ot(i), o = {
|
|
4992
4992
|
src: e,
|
|
4993
|
-
width:
|
|
4994
|
-
height:
|
|
4995
|
-
aspect:
|
|
4993
|
+
width: s.width,
|
|
4994
|
+
height: s.height,
|
|
4995
|
+
aspect: s.width / s.height,
|
|
4996
4996
|
svg: void 0,
|
|
4997
4997
|
colors: void 0
|
|
4998
4998
|
};
|
|
@@ -5000,9 +5000,9 @@ class An {
|
|
|
5000
5000
|
}
|
|
5001
5001
|
}
|
|
5002
5002
|
changeColors(e, t, A) {
|
|
5003
|
-
var
|
|
5004
|
-
const a = (
|
|
5005
|
-
if (!a || !((
|
|
5003
|
+
var i, s;
|
|
5004
|
+
const a = (i = t.getStepSpecificServices(e.stepName)) == null ? void 0 : i.frameService;
|
|
5005
|
+
if (!a || !((s = a.getImageData()) != null && s.svg)) {
|
|
5006
5006
|
console.warn("changeColors was called without an SVG being assigned to a frame step");
|
|
5007
5007
|
return;
|
|
5008
5008
|
}
|
|
@@ -5018,11 +5018,11 @@ class An {
|
|
|
5018
5018
|
), this.validateColorCount(e, t);
|
|
5019
5019
|
}
|
|
5020
5020
|
getUniqueColorCount(e, t) {
|
|
5021
|
-
var
|
|
5022
|
-
const A = (
|
|
5021
|
+
var i, s;
|
|
5022
|
+
const A = (i = t.getStepSpecificServices(e.stepName)) == null ? void 0 : i.frameService;
|
|
5023
5023
|
if (!A)
|
|
5024
5024
|
return 0;
|
|
5025
|
-
const a = ((
|
|
5025
|
+
const a = ((s = A.getImageData()) == null ? void 0 : s.colors) ?? {}, n = [];
|
|
5026
5026
|
for (const o in a) {
|
|
5027
5027
|
const r = a[o];
|
|
5028
5028
|
if (r.pmsValue) {
|
|
@@ -5050,16 +5050,16 @@ class An {
|
|
|
5050
5050
|
});
|
|
5051
5051
|
for (const [c, B] of A.entries())
|
|
5052
5052
|
a[c] = { browserValue: B.browserValue, pmsValue: B.pmsValue }, n[c] = B;
|
|
5053
|
-
let
|
|
5054
|
-
const
|
|
5055
|
-
return
|
|
5056
|
-
|
|
5053
|
+
let i = Array.from(Object.values(a)).map((c) => c.browserValue);
|
|
5054
|
+
const s = t.data.colorOption;
|
|
5055
|
+
return s && ((r = s.variants) == null || r.forEach((c) => {
|
|
5056
|
+
i = i.map((B) => {
|
|
5057
5057
|
var l;
|
|
5058
5058
|
return B.toLowerCase() === ((l = c.color) == null ? void 0 : l.toLowerCase()) ? c.name : B;
|
|
5059
5059
|
});
|
|
5060
5060
|
})), {
|
|
5061
5061
|
newColors: a,
|
|
5062
|
-
metadataColors:
|
|
5062
|
+
metadataColors: i,
|
|
5063
5063
|
storageColors: n
|
|
5064
5064
|
};
|
|
5065
5065
|
}
|
|
@@ -5071,10 +5071,10 @@ class An {
|
|
|
5071
5071
|
A > 0 && this.getUniqueColorCount(e, t) > A ? "workflow.steps.frame.tooManyColors" : void 0
|
|
5072
5072
|
);
|
|
5073
5073
|
}
|
|
5074
|
-
async selectVariantCommand(e, t, A, a, n,
|
|
5074
|
+
async selectVariantCommand(e, t, A, a, n, i) {
|
|
5075
5075
|
var l;
|
|
5076
|
-
const
|
|
5077
|
-
if (!
|
|
5076
|
+
const s = (l = a.getStepSpecificServices(e.stepName)) == null ? void 0 : l.frameService;
|
|
5077
|
+
if (!s)
|
|
5078
5078
|
throw new Error("Frame service unavailable, cannot load pattern!");
|
|
5079
5079
|
const o = await Promise.all(
|
|
5080
5080
|
e.data.regions.map((d) => this.frameSourceSvg(t, d))
|
|
@@ -5082,7 +5082,7 @@ class An {
|
|
|
5082
5082
|
n && n(!0);
|
|
5083
5083
|
const r = await Promise.all(
|
|
5084
5084
|
e.data.regions.map(async (d, C) => {
|
|
5085
|
-
const w = await rt(o[C]), E =
|
|
5085
|
+
const w = await rt(o[C]), E = s.getImageData(), u = A.map((I) => new ne(I.id)), h = E ? ct(E, w) : void 0, D = E ? {
|
|
5086
5086
|
id: J(),
|
|
5087
5087
|
src: E.src,
|
|
5088
5088
|
x: (h == null ? void 0 : h.x) || 0,
|
|
@@ -5122,13 +5122,13 @@ class An {
|
|
|
5122
5122
|
[...r.map((d) => d.regionEl)],
|
|
5123
5123
|
async () => {
|
|
5124
5124
|
var d;
|
|
5125
|
-
if (a.updateStorage(e.stepName, { currentFrameSources: o }),
|
|
5125
|
+
if (a.updateStorage(e.stepName, { currentFrameSources: o }), i) {
|
|
5126
5126
|
const C = (d = a.getStepSpecificServices(
|
|
5127
5127
|
e.stepName
|
|
5128
5128
|
)) == null ? void 0 : d.frameService;
|
|
5129
5129
|
if (!C)
|
|
5130
5130
|
throw new Error("Frame service unavailable, cannot load pattern!");
|
|
5131
|
-
await this.loadPatternFromString(
|
|
5131
|
+
await this.loadPatternFromString(i, C, !0);
|
|
5132
5132
|
}
|
|
5133
5133
|
}
|
|
5134
5134
|
);
|
|
@@ -5150,29 +5150,29 @@ class An {
|
|
|
5150
5150
|
}
|
|
5151
5151
|
async loadPatternFromAsset(e, t, A, a) {
|
|
5152
5152
|
var r, c;
|
|
5153
|
-
const n = this.patternSource(e),
|
|
5154
|
-
if (!
|
|
5155
|
-
throw A.markUpdateCompleted(
|
|
5153
|
+
const n = this.patternSource(e), i = A.markUpdatePending(), s = (r = A.getStepSpecificServices(t.stepName)) == null ? void 0 : r.frameService;
|
|
5154
|
+
if (!s)
|
|
5155
|
+
throw A.markUpdateCompleted(i), new Error("Frame service unavailable, cannot load pattern!");
|
|
5156
5156
|
try {
|
|
5157
5157
|
await this.loadPatternFromString(
|
|
5158
5158
|
n,
|
|
5159
|
-
|
|
5159
|
+
s,
|
|
5160
5160
|
a,
|
|
5161
5161
|
void 0,
|
|
5162
5162
|
t.data.colorPickerEnabled && !!t.data.maxColors && t.data.maxColors > 0
|
|
5163
5163
|
);
|
|
5164
5164
|
} catch (B) {
|
|
5165
|
-
throw A.markUpdateCompleted(
|
|
5165
|
+
throw A.markUpdateCompleted(i), B;
|
|
5166
5166
|
}
|
|
5167
5167
|
const o = this.calculateColorMetadata(
|
|
5168
|
-
|
|
5168
|
+
s,
|
|
5169
5169
|
t,
|
|
5170
|
-
new Map(Object.entries(((c =
|
|
5170
|
+
new Map(Object.entries(((c = s.getImageData()) == null ? void 0 : c.colors) ?? {}))
|
|
5171
5171
|
);
|
|
5172
5172
|
A.updateMetadata(t.stepName, { image: n, colors: o.metadataColors }), A.updateStorage(t.stepName, {
|
|
5173
5173
|
framePatternSrc: n,
|
|
5174
5174
|
colors: o.storageColors
|
|
5175
|
-
}), A.markUpdateCompleted(
|
|
5175
|
+
}), A.markUpdateCompleted(i), A.setMandatoryFulfilled(t.stepName, !0), A.setInformationResults(
|
|
5176
5176
|
A.getInformationResults().filter((B) => B.stepID === t.stepName)
|
|
5177
5177
|
), this.validateColorCount(t, A);
|
|
5178
5178
|
}
|
|
@@ -5241,13 +5241,13 @@ class an {
|
|
|
5241
5241
|
const a = t.getSerializedStep(
|
|
5242
5242
|
e.stepName,
|
|
5243
5243
|
A.serializableWorkflow.steps
|
|
5244
|
-
),
|
|
5244
|
+
), s = Object.values(A.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === e.stepName), o = e.option;
|
|
5245
5245
|
if (a != null && a.selectedVariants) {
|
|
5246
5246
|
const c = a.selectedVariants[0].id;
|
|
5247
5247
|
if (o && c) {
|
|
5248
5248
|
const B = (r = o.variants) == null ? void 0 : r.find((l) => l.id === c);
|
|
5249
5249
|
if (B) {
|
|
5250
|
-
const l =
|
|
5250
|
+
const l = s.map((d) => ({ id: d.id, region: d.stepRegion }));
|
|
5251
5251
|
await t.setSelectionsAndElements(
|
|
5252
5252
|
e.stepName,
|
|
5253
5253
|
[B],
|
|
@@ -5276,14 +5276,14 @@ class an {
|
|
|
5276
5276
|
}
|
|
5277
5277
|
async changeColorsCommand(e, t, A, a, n) {
|
|
5278
5278
|
var c;
|
|
5279
|
-
const
|
|
5279
|
+
const i = {};
|
|
5280
5280
|
for (const [B, l] of n.entries())
|
|
5281
|
-
|
|
5282
|
-
const
|
|
5281
|
+
i[B] = { browserValue: l, spotColor: (c = i[B]) == null ? void 0 : c.spotColor };
|
|
5282
|
+
const s = zA(e, t, A, i), o = await Re(s), r = [];
|
|
5283
5283
|
for (const B of a) {
|
|
5284
5284
|
for (const [l, d] of n.entries())
|
|
5285
5285
|
r.push(new et(B, l, d));
|
|
5286
|
-
r.push(new KA(B,
|
|
5286
|
+
r.push(new KA(B, s, o));
|
|
5287
5287
|
}
|
|
5288
5288
|
return new U(r);
|
|
5289
5289
|
}
|
|
@@ -5291,17 +5291,17 @@ class an {
|
|
|
5291
5291
|
var d, C;
|
|
5292
5292
|
if (t.length === 0)
|
|
5293
5293
|
return;
|
|
5294
|
-
const
|
|
5294
|
+
const i = He(
|
|
5295
5295
|
t[0].id,
|
|
5296
5296
|
a().map((w) => w.layoutState)
|
|
5297
|
-
),
|
|
5298
|
-
Object.entries(
|
|
5297
|
+
), s = { ...i.colors }, o = {};
|
|
5298
|
+
Object.entries(s).forEach(([w, E]) => {
|
|
5299
5299
|
const u = { browserValue: E.browserValue }, h = E.spotColor;
|
|
5300
5300
|
h && (u.spotColor = { profileName: h.profileName, namedColor: h.namedColor }), o[w] = u;
|
|
5301
5301
|
});
|
|
5302
5302
|
for (const [w, E] of n.entries())
|
|
5303
|
-
|
|
5304
|
-
let r = Array.from(Object.values(
|
|
5303
|
+
s[w] = { browserValue: E, spotColor: (d = s[w]) == null ? void 0 : d.spotColor }, o[w] = { browserValue: E };
|
|
5304
|
+
let r = Array.from(Object.values(s)).map((w) => w.browserValue);
|
|
5305
5305
|
const c = e.data.colorOption;
|
|
5306
5306
|
c && ((C = c.variants) == null || C.forEach((w) => {
|
|
5307
5307
|
r = r.map((E) => {
|
|
@@ -5310,14 +5310,14 @@ class an {
|
|
|
5310
5310
|
});
|
|
5311
5311
|
})), A.updateMetadata(e.stepName, { colors: r });
|
|
5312
5312
|
const B = /* @__PURE__ */ new Map();
|
|
5313
|
-
if (Object.entries(
|
|
5313
|
+
if (Object.entries(s).forEach(([w, E]) => {
|
|
5314
5314
|
B.set(w, E.browserValue);
|
|
5315
|
-
}), !
|
|
5315
|
+
}), !i.svg)
|
|
5316
5316
|
throw new Error("Colors changed before SVG loaded. This should never happen!");
|
|
5317
5317
|
const l = await this.changeColorsCommand(
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5318
|
+
i.svg,
|
|
5319
|
+
i.width,
|
|
5320
|
+
i.height,
|
|
5321
5321
|
t.map((w) => w.id),
|
|
5322
5322
|
B
|
|
5323
5323
|
);
|
|
@@ -5326,22 +5326,22 @@ class an {
|
|
|
5326
5326
|
}), A.getCommandDispatcher()(l);
|
|
5327
5327
|
}
|
|
5328
5328
|
async selectVariant(e, t, A, a, n) {
|
|
5329
|
-
const
|
|
5330
|
-
|
|
5329
|
+
const i = await this.selectVariantCommand(e, t, A, a, n);
|
|
5330
|
+
i && (i.command && n.getCommandDispatcher()(i.command), i.followup && await i.followup());
|
|
5331
5331
|
}
|
|
5332
5332
|
async selectVariantCommand(e, t, A, a, n) {
|
|
5333
5333
|
var u;
|
|
5334
5334
|
if (!e.data || !e.data.regions)
|
|
5335
5335
|
throw new Ge(e, "Missing regions.");
|
|
5336
5336
|
a(!0);
|
|
5337
|
-
const
|
|
5337
|
+
const i = A.map((h) => new ne(h.id));
|
|
5338
5338
|
e.mandatory && n.setMandatoryFulfilled(e.stepName, !1);
|
|
5339
|
-
const
|
|
5340
|
-
if (!
|
|
5341
|
-
throw new
|
|
5342
|
-
const o =
|
|
5339
|
+
const s = t.asset;
|
|
5340
|
+
if (!s)
|
|
5341
|
+
throw new ie(t);
|
|
5342
|
+
const o = s.fileLink;
|
|
5343
5343
|
if (!o)
|
|
5344
|
-
throw new ue(
|
|
5344
|
+
throw new ue(s);
|
|
5345
5345
|
const r = await Le(await this.getIllustrationBody(o)), c = await Re(r.svg), B = (h) => {
|
|
5346
5346
|
const D = n.getLayouts().find((p) => p.panelId === h.panelId);
|
|
5347
5347
|
if (!D)
|
|
@@ -5356,7 +5356,7 @@ class an {
|
|
|
5356
5356
|
svg: r
|
|
5357
5357
|
})
|
|
5358
5358
|
};
|
|
5359
|
-
}, l = e.data.regions.map(B), C = [...l.map((h) => h.command), ...
|
|
5359
|
+
}, l = e.data.regions.map(B), C = [...l.map((h) => h.command), ...i];
|
|
5360
5360
|
let w = Array.from(Object.values(r.colors)).map((h) => h.browserValue);
|
|
5361
5361
|
const E = e.data.colorOption;
|
|
5362
5362
|
return E && ((u = E.variants) == null || u.forEach((h) => {
|
|
@@ -5418,7 +5418,7 @@ class nn {
|
|
|
5418
5418
|
const a = t.getSerializedStep(
|
|
5419
5419
|
e.stepName,
|
|
5420
5420
|
A.serializableWorkflow.steps
|
|
5421
|
-
),
|
|
5421
|
+
), s = Object.values(A.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === e.stepName), o = e.option;
|
|
5422
5422
|
if (!o)
|
|
5423
5423
|
throw new ke(e);
|
|
5424
5424
|
if (a != null && a.selectedVariants) {
|
|
@@ -5426,7 +5426,7 @@ class nn {
|
|
|
5426
5426
|
if (c) {
|
|
5427
5427
|
const B = (r = o.variants) == null ? void 0 : r.find((l) => l.id === c);
|
|
5428
5428
|
if (B) {
|
|
5429
|
-
const l = B.material, d =
|
|
5429
|
+
const l = B.material, d = s.map((C) => ({ id: C.id, region: C.stepRegion }));
|
|
5430
5430
|
await t.setSelectionsAndElements(
|
|
5431
5431
|
e.stepName,
|
|
5432
5432
|
[B],
|
|
@@ -5456,16 +5456,16 @@ class nn {
|
|
|
5456
5456
|
async selectVariantLambda(e, t, A, a) {
|
|
5457
5457
|
const n = A.getModelContainer();
|
|
5458
5458
|
a(!0);
|
|
5459
|
-
const
|
|
5460
|
-
if (!
|
|
5461
|
-
throw a(!1), new
|
|
5459
|
+
const i = t.material;
|
|
5460
|
+
if (!i)
|
|
5461
|
+
throw a(!1), new ie(t);
|
|
5462
5462
|
return {
|
|
5463
5463
|
command: void 0,
|
|
5464
5464
|
followup: async () => {
|
|
5465
5465
|
await A.setSelectionsAndElements(e.stepName, [t], [], async () => {
|
|
5466
5466
|
try {
|
|
5467
|
-
n && e.data.targetMaterials.forEach((
|
|
5468
|
-
e.option && n.applyMaterialVariant(
|
|
5467
|
+
n && e.data.targetMaterials.forEach((s) => {
|
|
5468
|
+
e.option && n.applyMaterialVariant(s, e.option.id || "", i);
|
|
5469
5469
|
}), A.setMandatoryFulfilled(e.stepName, !0);
|
|
5470
5470
|
} finally {
|
|
5471
5471
|
a(!1);
|
|
@@ -5496,13 +5496,13 @@ class sn {
|
|
|
5496
5496
|
const a = t.getSerializedStep(
|
|
5497
5497
|
e.stepName,
|
|
5498
5498
|
A.serializableWorkflow.steps
|
|
5499
|
-
),
|
|
5499
|
+
), s = Object.values(A.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === e.stepName), o = e.option;
|
|
5500
5500
|
if (a != null && a.selectedVariants) {
|
|
5501
5501
|
const c = a.selectedVariants[0].id;
|
|
5502
5502
|
if (o && c) {
|
|
5503
5503
|
const B = (r = o.variants) == null ? void 0 : r.find((l) => l.id === c);
|
|
5504
5504
|
if (B) {
|
|
5505
|
-
const l =
|
|
5505
|
+
const l = s.map((d) => ({ id: d.id, region: d.stepRegion }));
|
|
5506
5506
|
await t.setSelectionsAndElements(
|
|
5507
5507
|
e.stepName,
|
|
5508
5508
|
[B],
|
|
@@ -5513,7 +5513,7 @@ class sn {
|
|
|
5513
5513
|
if (d && e.option) {
|
|
5514
5514
|
const w = (C = B.asset) == null ? void 0 : C.fileLink;
|
|
5515
5515
|
if (!w)
|
|
5516
|
-
throw new
|
|
5516
|
+
throw new ie(B);
|
|
5517
5517
|
await d.applyModelVariant(
|
|
5518
5518
|
e.stepName || "",
|
|
5519
5519
|
{
|
|
@@ -5534,18 +5534,18 @@ class sn {
|
|
|
5534
5534
|
n && (n.command && A.getCommandDispatcher()(n.command), n.followup && await n.followup());
|
|
5535
5535
|
}
|
|
5536
5536
|
async selectVariantLambda(e, t, A, a) {
|
|
5537
|
-
var
|
|
5537
|
+
var i;
|
|
5538
5538
|
a(!0);
|
|
5539
|
-
const n = (
|
|
5539
|
+
const n = (i = t.asset) == null ? void 0 : i.fileLink;
|
|
5540
5540
|
if (!n)
|
|
5541
|
-
throw new
|
|
5541
|
+
throw new ie(t);
|
|
5542
5542
|
return {
|
|
5543
5543
|
command: void 0,
|
|
5544
5544
|
followup: async () => {
|
|
5545
5545
|
await A.setSelectionsAndElements(e.stepName, [t], [], async () => {
|
|
5546
5546
|
try {
|
|
5547
|
-
const
|
|
5548
|
-
|
|
5547
|
+
const s = A.getModelContainer();
|
|
5548
|
+
s && await s.applyModelVariant(
|
|
5549
5549
|
e.stepName,
|
|
5550
5550
|
{
|
|
5551
5551
|
model: n,
|
|
@@ -5582,13 +5582,13 @@ class on {
|
|
|
5582
5582
|
});
|
|
5583
5583
|
}
|
|
5584
5584
|
async changeText(e, t, A, a, n) {
|
|
5585
|
-
const
|
|
5586
|
-
|
|
5585
|
+
const i = await this.changeTextCommand(e, t, A, a, n);
|
|
5586
|
+
i && (i.command && A.getCommandDispatcher()(i.command), i.followup && await i.followup());
|
|
5587
5587
|
}
|
|
5588
5588
|
async changeTextCommand(e, t, A, a, n) {
|
|
5589
5589
|
var c;
|
|
5590
|
-
const
|
|
5591
|
-
if (!
|
|
5590
|
+
const i = A.getRegionElements(e.stepName), s = (c = A.getStepSpecificServices(e.stepName)) == null ? void 0 : c.module;
|
|
5591
|
+
if (!s)
|
|
5592
5592
|
return console.error("Missing module."), null;
|
|
5593
5593
|
const o = A.getProfanities();
|
|
5594
5594
|
if (!this.validateInput(e, t, o, n))
|
|
@@ -5627,11 +5627,11 @@ class on {
|
|
|
5627
5627
|
command: new U(u)
|
|
5628
5628
|
};
|
|
5629
5629
|
};
|
|
5630
|
-
if (
|
|
5631
|
-
const l =
|
|
5630
|
+
if (i.length > 0) {
|
|
5631
|
+
const l = i.map((d) => {
|
|
5632
5632
|
if (!d.region)
|
|
5633
5633
|
return null;
|
|
5634
|
-
const C =
|
|
5634
|
+
const C = s.svgPrint(t, d.region);
|
|
5635
5635
|
return r(C, d.region, d.id);
|
|
5636
5636
|
}).filter((d) => !!d).filter((d) => !!d).map((d) => d && d.command);
|
|
5637
5637
|
return {
|
|
@@ -5641,7 +5641,7 @@ class on {
|
|
|
5641
5641
|
};
|
|
5642
5642
|
} else {
|
|
5643
5643
|
const B = e.data.regions.map(
|
|
5644
|
-
(d) => r(
|
|
5644
|
+
(d) => r(s.svgPrint(t, d), d)
|
|
5645
5645
|
), l = B.filter((d) => !!d).map((d) => d && d.command);
|
|
5646
5646
|
return {
|
|
5647
5647
|
command: new U(l),
|
|
@@ -5658,17 +5658,17 @@ class on {
|
|
|
5658
5658
|
}
|
|
5659
5659
|
validateInput(e, t, A, a) {
|
|
5660
5660
|
if (e.data && e.data.maxLength) {
|
|
5661
|
-
const
|
|
5662
|
-
if (t.length >
|
|
5661
|
+
const i = e.data.maxLength;
|
|
5662
|
+
if (t.length > i)
|
|
5663
5663
|
return a("Too many characters."), !1;
|
|
5664
5664
|
}
|
|
5665
5665
|
if (!/^$|^[a-zA-Z0-9 ]+$/.test(t))
|
|
5666
5666
|
return a("Unsupported characters."), !1;
|
|
5667
5667
|
const n = at(t.toLowerCase());
|
|
5668
|
-
for (const
|
|
5669
|
-
for (const
|
|
5670
|
-
const o = A[
|
|
5671
|
-
if (
|
|
5668
|
+
for (const i of n)
|
|
5669
|
+
for (const s in A) {
|
|
5670
|
+
const o = A[s].toLowerCase().replace(/\s/g, "");
|
|
5671
|
+
if (i === o)
|
|
5672
5672
|
return a("Blocked profanity."), !1;
|
|
5673
5673
|
}
|
|
5674
5674
|
return a(""), !0;
|
|
@@ -5692,13 +5692,13 @@ class rn {
|
|
|
5692
5692
|
const a = t.getSerializedStep(
|
|
5693
5693
|
e.stepName,
|
|
5694
5694
|
A.serializableWorkflow.steps
|
|
5695
|
-
),
|
|
5695
|
+
), s = Object.values(A.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === e.stepName), o = e.option;
|
|
5696
5696
|
if (a != null && a.selectedVariants) {
|
|
5697
5697
|
const c = a.selectedVariants[0].id;
|
|
5698
5698
|
if (o && c) {
|
|
5699
5699
|
const B = (r = o.variants) == null ? void 0 : r.find((l) => l.id === c);
|
|
5700
5700
|
if (B) {
|
|
5701
|
-
const l =
|
|
5701
|
+
const l = s.map((d) => ({ id: d.id, region: d.stepRegion }));
|
|
5702
5702
|
await t.setSelectionsAndElements(
|
|
5703
5703
|
e.stepName,
|
|
5704
5704
|
[B],
|
|
@@ -5718,9 +5718,9 @@ class rn {
|
|
|
5718
5718
|
async selectVariantCommand(e, t, A, a) {
|
|
5719
5719
|
const n = t.asset;
|
|
5720
5720
|
if (!n)
|
|
5721
|
-
throw new
|
|
5722
|
-
const
|
|
5723
|
-
if (!
|
|
5721
|
+
throw new ie(t);
|
|
5722
|
+
const i = n == null ? void 0 : n.fileLink;
|
|
5723
|
+
if (!i)
|
|
5724
5724
|
return console.error("No URL for picture!"), null;
|
|
5725
5725
|
a(!0), e.mandatory && A.setMandatoryFulfilled(e.stepName, !1);
|
|
5726
5726
|
const o = A.getRegionElements(e.stepName).map((B) => new ne(B.id)), r = (B) => {
|
|
@@ -5735,7 +5735,7 @@ class rn {
|
|
|
5735
5735
|
stepName: e.stepName,
|
|
5736
5736
|
stepRegion: B,
|
|
5737
5737
|
id: C,
|
|
5738
|
-
src:
|
|
5738
|
+
src: i,
|
|
5739
5739
|
type: G.Image,
|
|
5740
5740
|
y: B.top,
|
|
5741
5741
|
x: B.left,
|
|
@@ -5777,25 +5777,25 @@ class cn {
|
|
|
5777
5777
|
else {
|
|
5778
5778
|
const n = a.variants;
|
|
5779
5779
|
if (V.getDefaultVariant(a)) {
|
|
5780
|
-
const
|
|
5780
|
+
const s = n == null ? void 0 : n.find((o) => {
|
|
5781
5781
|
var r;
|
|
5782
5782
|
return o.id === ((r = a.defaultVariant) == null ? void 0 : r.id);
|
|
5783
5783
|
});
|
|
5784
|
-
return this.selectVariantLambda(e, (
|
|
5784
|
+
return this.selectVariantLambda(e, (s == null ? void 0 : s.id) || "", t);
|
|
5785
5785
|
}
|
|
5786
5786
|
}
|
|
5787
5787
|
return null;
|
|
5788
5788
|
}
|
|
5789
5789
|
async reload(e, t, A) {
|
|
5790
|
-
var
|
|
5790
|
+
var i;
|
|
5791
5791
|
const a = t.getSerializedStep(
|
|
5792
5792
|
e.stepName,
|
|
5793
5793
|
A.serializableWorkflow.steps
|
|
5794
5794
|
), n = e.option;
|
|
5795
5795
|
if (a != null && a.selectedVariants) {
|
|
5796
|
-
const
|
|
5797
|
-
if (n &&
|
|
5798
|
-
const o = (
|
|
5796
|
+
const s = a.selectedVariants[0].id;
|
|
5797
|
+
if (n && s) {
|
|
5798
|
+
const o = (i = n.variants) == null ? void 0 : i.find((r) => r.id === s);
|
|
5799
5799
|
o && await t.setSelectionsAndElements(e.stepName, [o], []);
|
|
5800
5800
|
}
|
|
5801
5801
|
}
|
|
@@ -5812,13 +5812,13 @@ class cn {
|
|
|
5812
5812
|
const n = a.variants;
|
|
5813
5813
|
if (!n)
|
|
5814
5814
|
return null;
|
|
5815
|
-
const
|
|
5816
|
-
if (!
|
|
5815
|
+
const i = n.length > 1 ? n.find((s) => s.id === t) : n[0];
|
|
5816
|
+
if (!i)
|
|
5817
5817
|
throw new Error("Failed to find selected variant in step variants, this should never happen!");
|
|
5818
5818
|
return {
|
|
5819
5819
|
command: void 0,
|
|
5820
5820
|
followup: async () => {
|
|
5821
|
-
await A.setSelectionsAndElements(e.stepName, [
|
|
5821
|
+
await A.setSelectionsAndElements(e.stepName, [i], [], async () => {
|
|
5822
5822
|
A.setMandatoryFulfilled(e.stepName, !0);
|
|
5823
5823
|
});
|
|
5824
5824
|
}
|
|
@@ -5841,13 +5841,13 @@ class gn {
|
|
|
5841
5841
|
}))) || [] : [];
|
|
5842
5842
|
}
|
|
5843
5843
|
setCustomColor(e, t, A) {
|
|
5844
|
-
const a = A.getLayouts(),
|
|
5845
|
-
const o =
|
|
5844
|
+
const a = A.getLayouts(), i = (A.getRegionElements(t.stepName) || []).map((s) => {
|
|
5845
|
+
const o = s.region;
|
|
5846
5846
|
if (!a.find((c) => c.panelId === (o == null ? void 0 : o.panelId)))
|
|
5847
5847
|
throw new z(o);
|
|
5848
|
-
return new et(
|
|
5849
|
-
}).filter((
|
|
5850
|
-
A.getCommandDispatcher()(new U(
|
|
5848
|
+
return new et(s.id, this.shapeFillId, e);
|
|
5849
|
+
}).filter((s) => !!s);
|
|
5850
|
+
A.getCommandDispatcher()(new U(i)), A.updateStorage(t.stepName, { colour: e });
|
|
5851
5851
|
}
|
|
5852
5852
|
async init(e, t, A) {
|
|
5853
5853
|
const a = e.option;
|
|
@@ -5879,13 +5879,13 @@ class gn {
|
|
|
5879
5879
|
const a = t.getSerializedStep(
|
|
5880
5880
|
e.stepName,
|
|
5881
5881
|
A.serializableWorkflow.steps
|
|
5882
|
-
),
|
|
5882
|
+
), s = Object.values(A.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === e.stepName), o = e.option;
|
|
5883
5883
|
if (a != null && a.selectedVariants) {
|
|
5884
5884
|
const c = a.selectedVariants[0].id;
|
|
5885
5885
|
if (o && c) {
|
|
5886
5886
|
const B = (r = o.variants) == null ? void 0 : r.find((l) => l.id === c);
|
|
5887
5887
|
if (B) {
|
|
5888
|
-
const l =
|
|
5888
|
+
const l = s.map((d) => ({ id: d.id, region: d.stepRegion }));
|
|
5889
5889
|
await t.setSelectionsAndElements(
|
|
5890
5890
|
e.stepName,
|
|
5891
5891
|
[B],
|
|
@@ -5903,10 +5903,10 @@ class gn {
|
|
|
5903
5903
|
}
|
|
5904
5904
|
async selectVariantCommand(e, t, A, a) {
|
|
5905
5905
|
var o;
|
|
5906
|
-
const n = a.getLayouts(),
|
|
5906
|
+
const n = a.getLayouts(), i = (o = a.getStepStorage(e.stepName)) == null ? void 0 : o.colour, s = () => {
|
|
5907
5907
|
var r, c;
|
|
5908
5908
|
if (((r = t.variant) == null ? void 0 : r.color) === "#custom")
|
|
5909
|
-
return
|
|
5909
|
+
return i || "#FFFFFF";
|
|
5910
5910
|
if ((c = t.variant) != null && c.color)
|
|
5911
5911
|
return t.variant.color;
|
|
5912
5912
|
throw new Error("Failed to resolve color for shape step.");
|
|
@@ -5916,7 +5916,7 @@ class gn {
|
|
|
5916
5916
|
const l = B.region;
|
|
5917
5917
|
if (!n.find((w) => w.panelId === (l == null ? void 0 : l.panelId)))
|
|
5918
5918
|
throw new z(l);
|
|
5919
|
-
const C =
|
|
5919
|
+
const C = s();
|
|
5920
5920
|
return new et(B.id, this.shapeFillId, C);
|
|
5921
5921
|
}, c = A.map(r).filter((B) => !!B);
|
|
5922
5922
|
return {
|
|
@@ -5926,7 +5926,7 @@ class gn {
|
|
|
5926
5926
|
e.stepName,
|
|
5927
5927
|
t.variant ? [t.variant] : [],
|
|
5928
5928
|
A
|
|
5929
|
-
), a.updateStorage(e.stepName, { colour:
|
|
5929
|
+
), a.updateStorage(e.stepName, { colour: s() });
|
|
5930
5930
|
}
|
|
5931
5931
|
};
|
|
5932
5932
|
} else {
|
|
@@ -5934,7 +5934,7 @@ class gn {
|
|
|
5934
5934
|
const C = n.find((D) => D.panelId === d.panelId);
|
|
5935
5935
|
if (!C)
|
|
5936
5936
|
throw new z(d);
|
|
5937
|
-
const w =
|
|
5937
|
+
const w = s(), E = `
|
|
5938
5938
|
<svg
|
|
5939
5939
|
xmlns="http://www.w3.org/2000/svg"
|
|
5940
5940
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
@@ -5990,7 +5990,7 @@ class gn {
|
|
|
5990
5990
|
t.variant ? [t.variant] : [],
|
|
5991
5991
|
l,
|
|
5992
5992
|
async () => {
|
|
5993
|
-
a.updateStorage(e.stepName, { colour:
|
|
5993
|
+
a.updateStorage(e.stepName, { colour: s() });
|
|
5994
5994
|
}
|
|
5995
5995
|
);
|
|
5996
5996
|
}
|
|
@@ -6046,18 +6046,18 @@ class Cn {
|
|
|
6046
6046
|
);
|
|
6047
6047
|
const a = [], n = t ? jA(t.assetUrl) : void 0;
|
|
6048
6048
|
if (n) {
|
|
6049
|
-
const
|
|
6050
|
-
for (let o = 0; o <
|
|
6051
|
-
|
|
6049
|
+
const i = A.split("").filter((o) => !dn.includes(o)).join(""), s = i.split("").map((o) => n.getFont().charToGlyph(o));
|
|
6050
|
+
for (let o = 0; o < s.length; o++)
|
|
6051
|
+
s[o].name === ".notdef" && a.push(String.fromCharCode(i.charCodeAt(o)));
|
|
6052
6052
|
}
|
|
6053
|
-
for (let
|
|
6054
|
-
A = A.replaceAll(a[
|
|
6053
|
+
for (let i = 0; i < a.length; i++)
|
|
6054
|
+
A = A.replaceAll(a[i], "");
|
|
6055
6055
|
return A;
|
|
6056
6056
|
}, this.textAlign = (e) => e.vertical ? "center" : e.textAlign || "center", this.getErrorsForText = (e, t, A) => {
|
|
6057
6057
|
const a = [];
|
|
6058
6058
|
t.data && t.data.maxLength && e.length > t.data.maxLength && a.push({ localizationKey: "workflow.steps.text.characterLimit" });
|
|
6059
|
-
const n = A.getProfanities(),
|
|
6060
|
-
for (const o of
|
|
6059
|
+
const n = A.getProfanities(), i = at(e.toLowerCase());
|
|
6060
|
+
for (const o of i)
|
|
6061
6061
|
for (const r in n) {
|
|
6062
6062
|
const c = n[r].toLowerCase().replace(/\s/g, "");
|
|
6063
6063
|
if (o === c) {
|
|
@@ -6070,7 +6070,7 @@ class Cn {
|
|
|
6070
6070
|
};
|
|
6071
6071
|
}
|
|
6072
6072
|
async init(e, t, A) {
|
|
6073
|
-
var n,
|
|
6073
|
+
var n, i, s;
|
|
6074
6074
|
const a = e.option;
|
|
6075
6075
|
if (!a)
|
|
6076
6076
|
return null;
|
|
@@ -6086,11 +6086,11 @@ class Cn {
|
|
|
6086
6086
|
t.updateStorage(e.stepName, {
|
|
6087
6087
|
text: e.data.defaultText || "",
|
|
6088
6088
|
inputText: e.data.defaultText || "",
|
|
6089
|
-
color: ((
|
|
6089
|
+
color: ((i = await this.getDefaultColorVariant(e.data)) == null ? void 0 : i.color) || await this.getDefaultColor(e.data),
|
|
6090
6090
|
fillImage: B
|
|
6091
6091
|
}), t.updateMetadata(e.stepName, {
|
|
6092
6092
|
text: e.data.defaultText || "",
|
|
6093
|
-
color: ((
|
|
6093
|
+
color: ((s = await this.getDefaultColorVariant(e.data)) == null ? void 0 : s.name) || await this.getDefaultColor(e.data),
|
|
6094
6094
|
fillImage: o == null ? void 0 : o.name
|
|
6095
6095
|
});
|
|
6096
6096
|
const l = V.getDefaultVariant(a);
|
|
@@ -6125,10 +6125,10 @@ class Cn {
|
|
|
6125
6125
|
return t;
|
|
6126
6126
|
const A = e.data.colorOption;
|
|
6127
6127
|
if (A) {
|
|
6128
|
-
const n = ((a = A.variants) == null ? void 0 : a.map((
|
|
6129
|
-
fill:
|
|
6130
|
-
stroke:
|
|
6131
|
-
variant:
|
|
6128
|
+
const n = ((a = A.variants) == null ? void 0 : a.map((i) => ({
|
|
6129
|
+
fill: i.color,
|
|
6130
|
+
stroke: i.color,
|
|
6131
|
+
variant: i
|
|
6132
6132
|
}))) || [];
|
|
6133
6133
|
return this.cachedColors.set(e.stepName, n), n;
|
|
6134
6134
|
}
|
|
@@ -6138,9 +6138,9 @@ class Cn {
|
|
|
6138
6138
|
if (!e.data || !e.data.regions)
|
|
6139
6139
|
return;
|
|
6140
6140
|
const n = a.getCommandDispatcher();
|
|
6141
|
-
for (const
|
|
6142
|
-
const
|
|
6143
|
-
n(
|
|
6141
|
+
for (const i of A) {
|
|
6142
|
+
const s = new VA(i.id, t);
|
|
6143
|
+
n(s);
|
|
6144
6144
|
}
|
|
6145
6145
|
}
|
|
6146
6146
|
async changeFillColor(e, t, A, a) {
|
|
@@ -6149,17 +6149,17 @@ class Cn {
|
|
|
6149
6149
|
return;
|
|
6150
6150
|
const n = a.getCommandDispatcher();
|
|
6151
6151
|
t.variant ? a.updateMetadata(e.stepName, { color: t.variant.name }) : a.updateMetadata(e.stepName, { color: t.fill });
|
|
6152
|
-
const
|
|
6153
|
-
|
|
6152
|
+
const i = e.data.colorOption, s = i ? this.createTextFillSpotColor(i, t.variant) : void 0;
|
|
6153
|
+
i ? a.updateStorage(e.stepName, {
|
|
6154
6154
|
color: t.fill,
|
|
6155
|
-
colorProfileAssetKey: (o =
|
|
6155
|
+
colorProfileAssetKey: (o = i.colorProfile) == null ? void 0 : o.key
|
|
6156
6156
|
}) : a.updateStorage(e.stepName, {
|
|
6157
6157
|
color: t.fill
|
|
6158
6158
|
});
|
|
6159
6159
|
for (const r of A) {
|
|
6160
6160
|
if (!t.fill)
|
|
6161
6161
|
throw new Error("Fill not set on new color selection!");
|
|
6162
|
-
const c = new WA(r.id, t.fill,
|
|
6162
|
+
const c = new WA(r.id, t.fill, s);
|
|
6163
6163
|
n(c);
|
|
6164
6164
|
}
|
|
6165
6165
|
}
|
|
@@ -6167,17 +6167,17 @@ class Cn {
|
|
|
6167
6167
|
var A, a;
|
|
6168
6168
|
const t = e.data.imageFillOption;
|
|
6169
6169
|
if (t) {
|
|
6170
|
-
const n = ((a = (A = t.variants) == null ? void 0 : A.map((
|
|
6171
|
-
var
|
|
6172
|
-
return (
|
|
6173
|
-
})) == null ? void 0 : a.filter((
|
|
6170
|
+
const n = ((a = (A = t.variants) == null ? void 0 : A.map((i) => {
|
|
6171
|
+
var s;
|
|
6172
|
+
return (s = i.asset) == null ? void 0 : s.fileLink;
|
|
6173
|
+
})) == null ? void 0 : a.filter((i) => !!i)) || [];
|
|
6174
6174
|
return Promise.all(
|
|
6175
|
-
n.map(async (
|
|
6176
|
-
const
|
|
6175
|
+
n.map(async (i) => {
|
|
6176
|
+
const s = await tt(i);
|
|
6177
6177
|
return {
|
|
6178
|
-
src:
|
|
6179
|
-
width:
|
|
6180
|
-
height:
|
|
6178
|
+
src: i,
|
|
6179
|
+
width: s.width,
|
|
6180
|
+
height: s.height,
|
|
6181
6181
|
scale: e.data.imageFillScale || 1
|
|
6182
6182
|
};
|
|
6183
6183
|
})
|
|
@@ -6186,14 +6186,14 @@ class Cn {
|
|
|
6186
6186
|
return Promise.resolve([]);
|
|
6187
6187
|
}
|
|
6188
6188
|
async changeFillImage(e, t, A, a) {
|
|
6189
|
-
var
|
|
6189
|
+
var s, o;
|
|
6190
6190
|
if (!e.data || !e.data.regions)
|
|
6191
6191
|
return;
|
|
6192
|
-
const n = a.getCommandDispatcher(),
|
|
6192
|
+
const n = a.getCommandDispatcher(), i = (o = (s = e.option) == null ? void 0 : s.variants) == null ? void 0 : o.find((r) => {
|
|
6193
6193
|
var c;
|
|
6194
6194
|
return ((c = r.asset) == null ? void 0 : c.fileLink) === t.src;
|
|
6195
6195
|
});
|
|
6196
|
-
a.updateMetadata(e.stepName, { fillImage:
|
|
6196
|
+
a.updateMetadata(e.stepName, { fillImage: i == null ? void 0 : i.name }), a.updateStorage(e.stepName, {
|
|
6197
6197
|
fillImage: t
|
|
6198
6198
|
});
|
|
6199
6199
|
for (const r of A) {
|
|
@@ -6209,15 +6209,15 @@ class Cn {
|
|
|
6209
6209
|
});
|
|
6210
6210
|
}
|
|
6211
6211
|
updateInputText(e, t, A, a) {
|
|
6212
|
-
const n = a.getStepStorage(A.stepName),
|
|
6212
|
+
const n = a.getStepStorage(A.stepName), i = this.getProcessedInput(e, A.data, !!n.customiseAllText), s = {
|
|
6213
6213
|
command: void 0,
|
|
6214
6214
|
helperText: "",
|
|
6215
6215
|
errors: this.getErrorsForText(e, A, a)
|
|
6216
6216
|
};
|
|
6217
|
-
if (
|
|
6218
|
-
return
|
|
6219
|
-
const o = (A.data.maxLength -
|
|
6220
|
-
|
|
6217
|
+
if (s.errors.length > 0)
|
|
6218
|
+
return s.helperText = s.errors[0].localizationKey, s;
|
|
6219
|
+
const o = (A.data.maxLength - i.length).toString();
|
|
6220
|
+
s.helperText = `${o} characters remaining`;
|
|
6221
6221
|
const r = [], c = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
|
|
6222
6222
|
for (const l of t) {
|
|
6223
6223
|
if (!l.fontData)
|
|
@@ -6226,20 +6226,20 @@ class Cn {
|
|
|
6226
6226
|
l.fontSize,
|
|
6227
6227
|
l.fontData,
|
|
6228
6228
|
{ left: l.x, top: l.y, width: l.width, height: l.height, rotation: l.rotation, panelId: "" },
|
|
6229
|
-
[
|
|
6229
|
+
[i],
|
|
6230
6230
|
{ size: A.data.size, minSize: A.data.minSize, maxSize: A.data.maxSize }
|
|
6231
6231
|
);
|
|
6232
6232
|
c.set(l.id, d), B.set(l.id, C);
|
|
6233
|
-
const w = A.data.curved ?
|
|
6233
|
+
const w = A.data.curved ? i : (C || []).join(`
|
|
6234
6234
|
`);
|
|
6235
6235
|
r.push(this.generateTextChangeCommandsForRegion(d, A.data, l.id, w));
|
|
6236
6236
|
}
|
|
6237
|
-
return !A.data.curved && t.length > 0 && !Array.from(B.values()).every((d) => d) ? (
|
|
6238
|
-
text:
|
|
6239
|
-
}), (n.defaultCleared || !A.data.deleteDefaultOnFocus) && a.setMandatoryFulfilled(A.stepName, !0),
|
|
6237
|
+
return !A.data.curved && t.length > 0 && !Array.from(B.values()).every((d) => d) ? (s.errors.push({ localizationKey: "workflow.steps.text.doesNotFit" }), s) : (a.updateStorage(A.stepName, { text: e }), a.updateMetadata(A.stepName, {
|
|
6238
|
+
text: i
|
|
6239
|
+
}), (n.defaultCleared || !A.data.deleteDefaultOnFocus) && a.setMandatoryFulfilled(A.stepName, !0), s.command = new U(r), s);
|
|
6240
6240
|
}
|
|
6241
6241
|
async selectVariant(e, t, A, a, n) {
|
|
6242
|
-
const
|
|
6242
|
+
const i = await this.selectVariantCommand(
|
|
6243
6243
|
e,
|
|
6244
6244
|
t,
|
|
6245
6245
|
A.getStepStorage(e.stepName) || {},
|
|
@@ -6248,16 +6248,16 @@ class Cn {
|
|
|
6248
6248
|
a,
|
|
6249
6249
|
n
|
|
6250
6250
|
);
|
|
6251
|
-
|
|
6251
|
+
i && (i.command && A.getCommandDispatcher()(i.command), i.followup && await i.followup());
|
|
6252
6252
|
}
|
|
6253
6253
|
createTextFillSpotColor(e, t) {
|
|
6254
6254
|
const A = e.colorProfile;
|
|
6255
6255
|
if (A) {
|
|
6256
|
-
const a = (A.name || "").replace(/\s/g, "-"), n = a.lastIndexOf("/"),
|
|
6256
|
+
const a = (A.name || "").replace(/\s/g, "-"), n = a.lastIndexOf("/"), s = a.slice(n + 1).slice(0, -4);
|
|
6257
6257
|
if (!t.namedColor)
|
|
6258
6258
|
throw new Error("variant named color not set!");
|
|
6259
6259
|
return {
|
|
6260
|
-
profileName:
|
|
6260
|
+
profileName: s,
|
|
6261
6261
|
namedColor: t.namedColor
|
|
6262
6262
|
};
|
|
6263
6263
|
}
|
|
@@ -6267,26 +6267,26 @@ class Cn {
|
|
|
6267
6267
|
const a = t.getSerializedStep(
|
|
6268
6268
|
e.stepName,
|
|
6269
6269
|
A.serializableWorkflow.steps
|
|
6270
|
-
),
|
|
6270
|
+
), s = Object.values(A.layouts).map((l) => l.elements).flat().filter((l) => l.stepName === e.stepName), o = e.option;
|
|
6271
6271
|
if (a != null && a.selectedVariants) {
|
|
6272
6272
|
const l = a.selectedVariants[0].id;
|
|
6273
6273
|
if (o && l) {
|
|
6274
6274
|
const d = (r = o.variants) == null ? void 0 : r.find((C) => C.id === l);
|
|
6275
6275
|
if (d) {
|
|
6276
|
-
const C = await this.fontDataFromVariant(d), w =
|
|
6276
|
+
const C = await this.fontDataFromVariant(d), w = s.map((D) => ({ id: D.id, region: D.stepRegion })), E = (c = a.storage) == null ? void 0 : c.color, u = (B = a.storage) == null ? void 0 : B.text;
|
|
6277
6277
|
await t.setSelectionsAndElements(
|
|
6278
6278
|
e.stepName,
|
|
6279
6279
|
[d],
|
|
6280
6280
|
w,
|
|
6281
6281
|
async () => {
|
|
6282
6282
|
t.updateMetadata(e.stepName, { color: E, text: u }), t.updateStorage(e.stepName, { text: u, inputText: u });
|
|
6283
|
-
const D =
|
|
6283
|
+
const D = s.map((p) => new Mt(p.id, C)), m = new U(D);
|
|
6284
6284
|
t.getCommandDispatcher()(m);
|
|
6285
6285
|
}
|
|
6286
6286
|
);
|
|
6287
6287
|
const { command: h } = j.updateInputText(
|
|
6288
6288
|
u || "",
|
|
6289
|
-
|
|
6289
|
+
s,
|
|
6290
6290
|
e,
|
|
6291
6291
|
t
|
|
6292
6292
|
);
|
|
@@ -6315,7 +6315,7 @@ class Cn {
|
|
|
6315
6315
|
async fontDataFromVariant(e) {
|
|
6316
6316
|
const t = e.asset;
|
|
6317
6317
|
if (!t)
|
|
6318
|
-
throw new
|
|
6318
|
+
throw new ie(e);
|
|
6319
6319
|
const A = t.fileLink;
|
|
6320
6320
|
if (!A)
|
|
6321
6321
|
throw new ue(t);
|
|
@@ -6325,7 +6325,7 @@ class Cn {
|
|
|
6325
6325
|
name: a.names.fullName.en
|
|
6326
6326
|
};
|
|
6327
6327
|
}
|
|
6328
|
-
async selectVariantCommand(e, t, A, a, n,
|
|
6328
|
+
async selectVariantCommand(e, t, A, a, n, i, s, o) {
|
|
6329
6329
|
var B;
|
|
6330
6330
|
const r = n.markUpdatePending(), c = await this.fontDataFromVariant(t);
|
|
6331
6331
|
if (a.length > 0) {
|
|
@@ -6342,8 +6342,8 @@ class Cn {
|
|
|
6342
6342
|
A,
|
|
6343
6343
|
n,
|
|
6344
6344
|
!!A.customiseAllText,
|
|
6345
|
-
|
|
6346
|
-
|
|
6345
|
+
i,
|
|
6346
|
+
s
|
|
6347
6347
|
);
|
|
6348
6348
|
return d && l.push(d), {
|
|
6349
6349
|
command: new U(l),
|
|
@@ -6367,8 +6367,8 @@ class Cn {
|
|
|
6367
6367
|
A,
|
|
6368
6368
|
n,
|
|
6369
6369
|
!!A.customiseAllText,
|
|
6370
|
-
|
|
6371
|
-
|
|
6370
|
+
i,
|
|
6371
|
+
s
|
|
6372
6372
|
), C = l.flatMap((E) => E.commands);
|
|
6373
6373
|
if (o) {
|
|
6374
6374
|
const E = l.map(
|
|
@@ -6392,12 +6392,12 @@ class Cn {
|
|
|
6392
6392
|
injectReplaceableText(e, t) {
|
|
6393
6393
|
return t.replaceableText ? t.replaceableText.replace("{{}}", e) : e;
|
|
6394
6394
|
}
|
|
6395
|
-
async createTextboxRegions(e, t, A, a, n,
|
|
6395
|
+
async createTextboxRegions(e, t, A, a, n, i) {
|
|
6396
6396
|
if (!A || !A.regions)
|
|
6397
6397
|
throw new Error("Step data not supplied");
|
|
6398
|
-
const
|
|
6398
|
+
const s = n.text || A.defaultText || "", o = this.getProcessedInput(s, A, !1), r = async (B) => {
|
|
6399
6399
|
var w;
|
|
6400
|
-
const d =
|
|
6400
|
+
const d = i.getLayouts().find((E) => E.panelId === B.panelId), C = J();
|
|
6401
6401
|
try {
|
|
6402
6402
|
if (!d)
|
|
6403
6403
|
throw new Te("Failed to find layout for region: " + B.panelId);
|
|
@@ -6408,7 +6408,7 @@ class Cn {
|
|
|
6408
6408
|
var R;
|
|
6409
6409
|
return T.id === ((R = E.defaultVariant) == null ? void 0 : R.id);
|
|
6410
6410
|
}) || E.variants[0];
|
|
6411
|
-
u = this.createTextFillSpotColor(E, S),
|
|
6411
|
+
u = this.createTextFillSpotColor(E, S), i.updateStorage(e, {
|
|
6412
6412
|
colorProfileAssetKey: (w = E.colorProfile) == null ? void 0 : w.key
|
|
6413
6413
|
});
|
|
6414
6414
|
}
|
|
@@ -6424,7 +6424,7 @@ class Cn {
|
|
|
6424
6424
|
layerIndex: B.layerIndex,
|
|
6425
6425
|
rotation: B.rotation,
|
|
6426
6426
|
text: o,
|
|
6427
|
-
input:
|
|
6427
|
+
input: s,
|
|
6428
6428
|
type: G.Textbox,
|
|
6429
6429
|
vertical: A.vertical,
|
|
6430
6430
|
x: B.left,
|
|
@@ -6472,22 +6472,22 @@ class Cn {
|
|
|
6472
6472
|
}, c = await Promise.all(A.regions.map(r)).catch((B) => {
|
|
6473
6473
|
throw B instanceof Je ? (Bn.setLatestToast("Failed to load font.", pe.Error), B) : B instanceof Te ? B : new Error(B);
|
|
6474
6474
|
});
|
|
6475
|
-
return await
|
|
6475
|
+
return await i.setSelectionsAndElements(
|
|
6476
6476
|
e,
|
|
6477
6477
|
[t],
|
|
6478
6478
|
c.map((B) => B.regionElement),
|
|
6479
6479
|
async () => {
|
|
6480
|
-
|
|
6481
|
-
text:
|
|
6482
|
-
}),
|
|
6483
|
-
text:
|
|
6480
|
+
i.updateMetadata(e, {
|
|
6481
|
+
text: s
|
|
6482
|
+
}), i.updateStorage(e, {
|
|
6483
|
+
text: s
|
|
6484
6484
|
});
|
|
6485
6485
|
}
|
|
6486
6486
|
), c;
|
|
6487
6487
|
}
|
|
6488
6488
|
generateTextChangeCommandsForRegion(e, t, A, a) {
|
|
6489
|
-
const n = [],
|
|
6490
|
-
if (n.push(
|
|
6489
|
+
const n = [], i = new XA(A, a);
|
|
6490
|
+
if (n.push(i), !t.size) {
|
|
6491
6491
|
const o = new qA(A, e);
|
|
6492
6492
|
n.push(o);
|
|
6493
6493
|
}
|
|
@@ -6496,8 +6496,8 @@ class Cn {
|
|
|
6496
6496
|
/**
|
|
6497
6497
|
* @deprecated
|
|
6498
6498
|
*/
|
|
6499
|
-
async changeInputTextWithRegion(e, t, A, a, n,
|
|
6500
|
-
const B = (a || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), l = this.getProcessedInput(B, e.data,
|
|
6499
|
+
async changeInputTextWithRegion(e, t, A, a, n, i, s, o, r, c) {
|
|
6500
|
+
const B = (a || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), l = this.getProcessedInput(B, e.data, s), d = i.getRegionElements(e.stepName), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
|
|
6501
6501
|
for (const m of d)
|
|
6502
6502
|
if (m.region) {
|
|
6503
6503
|
const [p, Q] = Ne(
|
|
@@ -6512,7 +6512,7 @@ class Cn {
|
|
|
6512
6512
|
const u = (() => {
|
|
6513
6513
|
if (e.data && e.data.maxLength && l.length > e.data.maxLength)
|
|
6514
6514
|
return c && c(!0), { info: "0" };
|
|
6515
|
-
const m =
|
|
6515
|
+
const m = i.getProfanities(), p = at(l.toLowerCase());
|
|
6516
6516
|
for (const Q of p)
|
|
6517
6517
|
for (const I in m) {
|
|
6518
6518
|
const F = m[I].toLowerCase().replace(/\s/g, "");
|
|
@@ -6528,9 +6528,9 @@ class Cn {
|
|
|
6528
6528
|
}
|
|
6529
6529
|
if (r(`${u.info} characters remaining` || ""), c)
|
|
6530
6530
|
return;
|
|
6531
|
-
|
|
6531
|
+
i.updateStorage(e.stepName, { text: B }), i.updateMetadata(e.stepName, {
|
|
6532
6532
|
text: this.injectReplaceableText(B, e.data)
|
|
6533
|
-
}), (n.defaultCleared || !e.data.deleteDefaultOnFocus) &&
|
|
6533
|
+
}), (n.defaultCleared || !e.data.deleteDefaultOnFocus) && i.setMandatoryFulfilled(e.stepName, !0);
|
|
6534
6534
|
const h = [];
|
|
6535
6535
|
for (const m of d) {
|
|
6536
6536
|
const p = e.data.curved ? l : (w.get(m.id) || []).join(`
|
|
@@ -7838,16 +7838,16 @@ const IA = (g, e, t, A) => {
|
|
|
7838
7838
|
a.setAttribute("id", A), a.setAttribute("height", "200%"), a.setAttribute("width", "200%"), a.setAttribute("x", "-50%"), a.setAttribute("y", "-50%");
|
|
7839
7839
|
const n = fe("feOffset");
|
|
7840
7840
|
a.appendChild(n), n.setAttribute("result", "offOut"), n.setAttribute("in", "SourceAlpha"), n.setAttribute("dx", `${g}`), n.setAttribute("dy", `${e}`);
|
|
7841
|
-
const
|
|
7842
|
-
a.appendChild(
|
|
7843
|
-
const
|
|
7844
|
-
return a.appendChild(
|
|
7841
|
+
const i = fe("feGaussianBlur");
|
|
7842
|
+
a.appendChild(i), i.setAttribute("result", "blurOut"), i.setAttribute("in", "offOut"), i.setAttribute("stdDeviation", `${t}`);
|
|
7843
|
+
const s = fe("feBlend");
|
|
7844
|
+
return a.appendChild(s), s.setAttribute("in", "SourceGraphic"), s.setAttribute("in2", "blurOut"), s.setAttribute("mode", "normal"), a;
|
|
7845
7845
|
}, fA = (g) => {
|
|
7846
7846
|
let e = g;
|
|
7847
7847
|
return e = e.replace(/feoffset/gi, "feOffset"), e = e.replace(/fegaussianblur/gi, "feGaussianBlur"), e = e.replace(/feblend/gi, "feBlend"), e = e.replace(/lineargradient/gi, "linearGradient"), e = e.replace(/stddeviation/gi, "stdDeviation"), e;
|
|
7848
7848
|
};
|
|
7849
7849
|
function ut(g, e, t, A, a, n) {
|
|
7850
|
-
const
|
|
7850
|
+
const i = a || 1, s = n || 1, o = {
|
|
7851
7851
|
x: e[0],
|
|
7852
7852
|
y: e[1],
|
|
7853
7853
|
width: e[2] - e[0],
|
|
@@ -7855,7 +7855,7 @@ function ut(g, e, t, A, a, n) {
|
|
|
7855
7855
|
};
|
|
7856
7856
|
if (o.width <= 0)
|
|
7857
7857
|
return;
|
|
7858
|
-
const r = mn(o.height, o.width, t *
|
|
7858
|
+
const r = mn(o.height, o.width, t * i, A * s), c = (A - r * o.width) / 2 - r * o.x, B = (t - r * o.height) / 2 - r * o.y;
|
|
7859
7859
|
g.setAttribute("transform", `translate(${c} ${B}) scale(${r} ${r})`);
|
|
7860
7860
|
}
|
|
7861
7861
|
function mn(g, e, t, A) {
|
|
@@ -7890,10 +7890,10 @@ class Qt {
|
|
|
7890
7890
|
encodePath(e) {
|
|
7891
7891
|
let t = "";
|
|
7892
7892
|
const a = (n) => {
|
|
7893
|
-
const
|
|
7894
|
-
let o = t !==
|
|
7893
|
+
const i = [], s = n.relative ? n.type : n.type.toUpperCase();
|
|
7894
|
+
let o = t !== s;
|
|
7895
7895
|
const r = kt[n.type];
|
|
7896
|
-
o && (
|
|
7896
|
+
o && (i.push(s), t = s);
|
|
7897
7897
|
for (const c of r) {
|
|
7898
7898
|
const B = n[c];
|
|
7899
7899
|
let l;
|
|
@@ -7907,9 +7907,9 @@ class Qt {
|
|
|
7907
7907
|
default:
|
|
7908
7908
|
throw new we("Failed to encode path.");
|
|
7909
7909
|
}
|
|
7910
|
-
o ||
|
|
7910
|
+
o || i.push(" "), i.push(l), o = !1;
|
|
7911
7911
|
}
|
|
7912
|
-
return
|
|
7912
|
+
return i.join("");
|
|
7913
7913
|
};
|
|
7914
7914
|
return e.map(a).join("");
|
|
7915
7915
|
}
|
|
@@ -7917,24 +7917,24 @@ class Qt {
|
|
|
7917
7917
|
const t = /([mzlhvcsqta])([^mzlhvcsqta]*)/gi, A = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi, a = [];
|
|
7918
7918
|
let n;
|
|
7919
7919
|
for (t.lastIndex = 0; n = t.exec(e); ) {
|
|
7920
|
-
const
|
|
7921
|
-
if (
|
|
7920
|
+
const i = n[1].toLowerCase(), s = (n[2].match(A) || []).map(parseFloat), o = i === n[1], r = kt[i];
|
|
7921
|
+
if (s.length < r.length)
|
|
7922
7922
|
throw new we(
|
|
7923
|
-
`Path type "${
|
|
7923
|
+
`Path type "${i}" given ${s.length} arguments, expected ${r.length}.`
|
|
7924
7924
|
);
|
|
7925
7925
|
if (r.length > 0) {
|
|
7926
|
-
if (
|
|
7926
|
+
if (s.length % r.length !== 0)
|
|
7927
7927
|
throw new we(
|
|
7928
|
-
`Path type "${
|
|
7928
|
+
`Path type "${i}" given ${s.length} arguments, not divisible by ${r.length}`
|
|
7929
7929
|
);
|
|
7930
|
-
for (let c = 0; c <
|
|
7931
|
-
const B = { type:
|
|
7930
|
+
for (let c = 0; c < s.length / r.length; c++) {
|
|
7931
|
+
const B = { type: i, relative: o };
|
|
7932
7932
|
for (let l = 0; l < r.length; l++)
|
|
7933
|
-
B[r[l]] =
|
|
7933
|
+
B[r[l]] = s[c * r.length + l];
|
|
7934
7934
|
a.push(B);
|
|
7935
7935
|
}
|
|
7936
7936
|
} else
|
|
7937
|
-
a.push({ type:
|
|
7937
|
+
a.push({ type: i, relative: o });
|
|
7938
7938
|
}
|
|
7939
7939
|
return a;
|
|
7940
7940
|
}
|
|
@@ -7944,13 +7944,13 @@ class Qt {
|
|
|
7944
7944
|
["x2", "y2"],
|
|
7945
7945
|
["x", "y"]
|
|
7946
7946
|
], a = (n) => {
|
|
7947
|
-
for (let
|
|
7948
|
-
const [
|
|
7949
|
-
if (
|
|
7950
|
-
const r = [n[
|
|
7947
|
+
for (let i = 0; i < A.length; i++) {
|
|
7948
|
+
const [s, o] = A[i];
|
|
7949
|
+
if (s in n && o in n) {
|
|
7950
|
+
const r = [n[s], n[o]], c = t(r);
|
|
7951
7951
|
if (c.length < 2)
|
|
7952
7952
|
throw new we("Transformer must return at least 2 points.");
|
|
7953
|
-
n[
|
|
7953
|
+
n[s] = c[0], n[o] = c[1];
|
|
7954
7954
|
}
|
|
7955
7955
|
}
|
|
7956
7956
|
return n;
|
|
@@ -7960,8 +7960,8 @@ class Qt {
|
|
|
7960
7960
|
transformPath(e, t) {
|
|
7961
7961
|
const A = [];
|
|
7962
7962
|
for (let a = 0; a < e.length; a++) {
|
|
7963
|
-
const n = JSON.parse(JSON.stringify(e[a])),
|
|
7964
|
-
Array.isArray(
|
|
7963
|
+
const n = JSON.parse(JSON.stringify(e[a])), i = t(n);
|
|
7964
|
+
Array.isArray(i) ? A.push(...i) : i && A.push(i);
|
|
7965
7965
|
}
|
|
7966
7966
|
return A;
|
|
7967
7967
|
}
|
|
@@ -7983,11 +7983,11 @@ class pn extends Et {
|
|
|
7983
7983
|
return this.svg(e);
|
|
7984
7984
|
}
|
|
7985
7985
|
svg(e) {
|
|
7986
|
-
const t = lt(wn), a = e !== "" ? ((
|
|
7986
|
+
const t = lt(wn), a = e !== "" ? ((i) => i.charAt(0).toUpperCase() + i.substr(1).toLowerCase())(e) : "", n = t.getPath(a, 0, 72, 72);
|
|
7987
7987
|
return this.brandSvg(n, En);
|
|
7988
7988
|
}
|
|
7989
7989
|
brandSvg(e, t) {
|
|
7990
|
-
const A = e.toSVG(2), a = e.getBoundingBox(), n = a.x2 - a.x1,
|
|
7990
|
+
const A = e.toSVG(2), a = e.getBoundingBox(), n = a.x2 - a.x1, i = e.toPathData(3), s = () => {
|
|
7991
7991
|
const p = v("g"), Q = v("defs");
|
|
7992
7992
|
p.appendChild(Q), Q.appendChild(IA(3, 7, 4, "shadow"));
|
|
7993
7993
|
const I = v("g");
|
|
@@ -8009,9 +8009,9 @@ class pn extends Et {
|
|
|
8009
8009
|
u.setAttribute("opacity", "0"), E.appendChild(u);
|
|
8010
8010
|
const h = v("g");
|
|
8011
8011
|
E.appendChild(h);
|
|
8012
|
-
const D =
|
|
8012
|
+
const D = s();
|
|
8013
8013
|
h.appendChild(D);
|
|
8014
|
-
const m = Bt(
|
|
8014
|
+
const m = Bt(i);
|
|
8015
8015
|
return ut(h, m, l, d), fA(o.outerHTML);
|
|
8016
8016
|
}
|
|
8017
8017
|
}
|
|
@@ -8027,11 +8027,11 @@ class In extends Et {
|
|
|
8027
8027
|
return this.svg(e);
|
|
8028
8028
|
}
|
|
8029
8029
|
svg(e) {
|
|
8030
|
-
const t = lt(Dn), a = e !== "" ? ((o) => o.charAt(0).toUpperCase() + o.substr(1).toLowerCase())(e) : "", n = t.getPath(a, 0, 72, 72),
|
|
8031
|
-
return this.brandSvg(n,
|
|
8030
|
+
const t = lt(Dn), a = e !== "" ? ((o) => o.charAt(0).toUpperCase() + o.substr(1).toLowerCase())(e) : "", n = t.getPath(a, 0, 72, 72), i = e.length < this.shortLength, s = i ? this.backgroundShortSvg : this.backgroundSvg;
|
|
8031
|
+
return this.brandSvg(n, s, i);
|
|
8032
8032
|
}
|
|
8033
8033
|
brandSvg(e, t, A) {
|
|
8034
|
-
const a = e.toSVG(2), n = e.getBoundingBox(),
|
|
8034
|
+
const a = e.toSVG(2), n = e.getBoundingBox(), i = n.y2 - n.y1, s = n.x2 - n.x1, o = e.toPathData(3), r = () => {
|
|
8035
8035
|
const I = v("g"), F = v("g");
|
|
8036
8036
|
I.appendChild(F), F.setAttribute("stroke", "#5C1A0D"), F.setAttribute("stroke-width", "4"), F.setAttribute("transform", "translate(1,1)"), F.innerHTML = a;
|
|
8037
8037
|
const M = v("g");
|
|
@@ -8039,10 +8039,10 @@ class In extends Et {
|
|
|
8039
8039
|
const Y = v("g");
|
|
8040
8040
|
I.appendChild(Y), Y.setAttribute("fill", "white"), Y.innerHTML = a;
|
|
8041
8041
|
const N = new Qt(I);
|
|
8042
|
-
return N.transform(([S, T]) => [S, T + ((
|
|
8042
|
+
return N.transform(([S, T]) => [S, T + ((s - S) * T) ** 2 / (s * 5e4)]), N.transform(([S, T]) => [
|
|
8043
8043
|
S,
|
|
8044
|
-
T + (
|
|
8045
|
-
]), N.transform(([S, T]) => [S - (
|
|
8044
|
+
T + (s / 3 - S) ** 2 / s * this.indicator(S < s / 3)
|
|
8045
|
+
]), N.transform(([S, T]) => [S - (i - T) * (s - S) / 800, T]), I;
|
|
8046
8046
|
}, [c, B, l] = pA(t);
|
|
8047
8047
|
if (!c)
|
|
8048
8048
|
return "";
|
|
@@ -8075,7 +8075,7 @@ class Fn extends Et {
|
|
|
8075
8075
|
return this.svgElement(e, t);
|
|
8076
8076
|
}
|
|
8077
8077
|
svgElement(e, t) {
|
|
8078
|
-
const A = lt(fn), n = e !== "" ? ((D) => D.charAt(0).toUpperCase() + D.substr(1).toLowerCase())(e) : "",
|
|
8078
|
+
const A = lt(fn), n = e !== "" ? ((D) => D.charAt(0).toUpperCase() + D.substr(1).toLowerCase())(e) : "", i = A.getPath(n, 0, 72, 72), s = i.toSVG(2), o = i.getBoundingBox(), r = o.x2 - o.x1, c = i.toPathData(3), B = () => {
|
|
8079
8079
|
const D = v("g");
|
|
8080
8080
|
D.classList.add("module-text-group");
|
|
8081
8081
|
const m = v("defs");
|
|
@@ -8085,11 +8085,11 @@ class Fn extends Et {
|
|
|
8085
8085
|
const Q = v("g");
|
|
8086
8086
|
Q.classList.add("module-layer0"), D.appendChild(Q), Q.setAttribute("filter", "url(#shadow)"), Q.innerHTML = p.outerHTML;
|
|
8087
8087
|
const I = v("g");
|
|
8088
|
-
I.classList.add("module-layer1"), D.appendChild(I), I.setAttribute("stroke-width", "3"), I.setAttribute("stroke", "rgb(45,41,38)"), I.setAttribute("fill", "rgb(45,41,38)"), I.setAttribute("transform", "translate(0.5,0)"), I.innerHTML =
|
|
8088
|
+
I.classList.add("module-layer1"), D.appendChild(I), I.setAttribute("stroke-width", "3"), I.setAttribute("stroke", "rgb(45,41,38)"), I.setAttribute("fill", "rgb(45,41,38)"), I.setAttribute("transform", "translate(0.5,0)"), I.innerHTML = s;
|
|
8089
8089
|
const F = v("g");
|
|
8090
|
-
F.classList.add("module-layer2"), D.appendChild(F), F.setAttribute("fill", "rgb(255,209,0)"), F.setAttribute("transform", "translate(1,-0.1)"), F.innerHTML =
|
|
8090
|
+
F.classList.add("module-layer2"), D.appendChild(F), F.setAttribute("fill", "rgb(255,209,0)"), F.setAttribute("transform", "translate(1,-0.1)"), F.innerHTML = s;
|
|
8091
8091
|
const M = v("g");
|
|
8092
|
-
return M.classList.add("module-layer3"), D.appendChild(M), M.setAttribute("fill", "white"), M.innerHTML =
|
|
8092
|
+
return M.classList.add("module-layer3"), D.appendChild(M), M.setAttribute("fill", "white"), M.innerHTML = s, new Qt(D).transform(([N, S]) => [N, S + (r / 2 - N) ** 2 / (r * 6)]), D;
|
|
8093
8093
|
}, l = v("g");
|
|
8094
8094
|
l.classList.add("module-root");
|
|
8095
8095
|
const d = v("defs");
|
|
@@ -8132,7 +8132,7 @@ class Gt extends BA {
|
|
|
8132
8132
|
}
|
|
8133
8133
|
}
|
|
8134
8134
|
class Mn {
|
|
8135
|
-
constructor(e, t, A, a, n,
|
|
8135
|
+
constructor(e, t, A, a, n, i, s, o, r, c, B, l, d, C = !1, w, E = !1, u = !1, h = !1) {
|
|
8136
8136
|
this.workflowStatePromiseQueue = new dA(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
|
|
8137
8137
|
var p;
|
|
8138
8138
|
if (!this.previewService)
|
|
@@ -8141,7 +8141,7 @@ class Mn {
|
|
|
8141
8141
|
if (m)
|
|
8142
8142
|
for (const [, Q] of m)
|
|
8143
8143
|
Q.render(D);
|
|
8144
|
-
}, this.experience = e, this.client = t, this.updateTransaction =
|
|
8144
|
+
}, this.experience = e, this.client = t, this.updateTransaction = s, this.commandContext = i, this.reloadedState = d, this.transaction = o, this.readOnly = C, this.singleVariantsRenderable = u, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = A, this.stepSpecificServices = {}, this.profanityFilter = a, this.pollers = [], this.allScenes = [], this.layouts = n, this.product = r, this.previewService = B, this.modelContainer = w, 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.currentAdjustingStepId = "", this.renderableContextService = l, this.isReloadedTransaction = E, this.stepTags = c, h && (this.workflowStatePromiseQueue.enabled = !1), this.initializationPromise = this.initializeDefaultWorkflowState(A), this.initializationPromise.then(() => {
|
|
8145
8145
|
this.initialized = !0;
|
|
8146
8146
|
}), this.initializationPromise.catch((D) => {
|
|
8147
8147
|
throw console.error(D), this.initialized = !1, new Error("Workflow initialization failed due to an error. See console.");
|
|
@@ -8154,17 +8154,17 @@ class Mn {
|
|
|
8154
8154
|
async initializeDefaultWorkflowState(e) {
|
|
8155
8155
|
const t = () => {
|
|
8156
8156
|
var c, B;
|
|
8157
|
-
const
|
|
8158
|
-
if (!
|
|
8157
|
+
const s = this.workflow.finalizeStepConfig;
|
|
8158
|
+
if (!s)
|
|
8159
8159
|
return;
|
|
8160
|
-
const o =
|
|
8160
|
+
const o = s.lookAtAnimation, r = s.modelAnimation;
|
|
8161
8161
|
o && ((c = this.previewService) == null || c.executeCameraAnimation(o)), r && ((B = this.modelContainer) == null || B.executeAnimation(r));
|
|
8162
8162
|
};
|
|
8163
|
-
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((
|
|
8164
|
-
this.storage[
|
|
8163
|
+
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((s) => {
|
|
8164
|
+
this.storage[s.stepName] = s.storage || {};
|
|
8165
8165
|
}), this.allScenes = await za(e);
|
|
8166
|
-
const a = ce(this.allScenes, this.stepSelections).map((
|
|
8167
|
-
this.commandContext.apply(new U(
|
|
8166
|
+
const a = ce(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: n, commands: i } = await this.stepElementsForIntroducedSilentSteps(a, !!this.reloadedState);
|
|
8167
|
+
this.commandContext.apply(new U(i), !0), this.stepElements = { ...this.stepElements, ...n }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && t();
|
|
8168
8168
|
}
|
|
8169
8169
|
getWorkflowExperience() {
|
|
8170
8170
|
return this.experience;
|
|
@@ -8363,29 +8363,29 @@ class Mn {
|
|
|
8363
8363
|
},
|
|
8364
8364
|
{ refocusCamera: t }
|
|
8365
8365
|
);
|
|
8366
|
-
this.setModelContainer(A), ce(this.allScenes, this.stepSelections).filter((
|
|
8366
|
+
this.setModelContainer(A), ce(this.allScenes, this.stepSelections).filter((i) => i).map((i) => i.renderableSteps).flat().filter((i) => i.type === y.Model || i.type === y.Material).forEach((i) => {
|
|
8367
8367
|
var r, c, B;
|
|
8368
|
-
if (!((r =
|
|
8369
|
-
console.error(`Failed to read option id from step: ${
|
|
8368
|
+
if (!((r = i.option) != null && r.id)) {
|
|
8369
|
+
console.error(`Failed to read option id from step: ${i.stepName}`);
|
|
8370
8370
|
return;
|
|
8371
8371
|
}
|
|
8372
|
-
const
|
|
8373
|
-
if (
|
|
8372
|
+
const s = ((c = this.stepSelections[i.stepName]) == null ? void 0 : c.selectedVariants) || [];
|
|
8373
|
+
if (s.length === 0)
|
|
8374
8374
|
return;
|
|
8375
|
-
const o =
|
|
8376
|
-
if (
|
|
8375
|
+
const o = s[0];
|
|
8376
|
+
if (i.type === y.Model) {
|
|
8377
8377
|
if (!this.modelContainer)
|
|
8378
8378
|
throw new b(
|
|
8379
8379
|
"We should always have a model container when injecting a preview!"
|
|
8380
8380
|
);
|
|
8381
8381
|
const l = (B = o.asset) == null ? void 0 : B.fileLink;
|
|
8382
8382
|
if (!l) {
|
|
8383
|
-
console.error(`Failed to read model url from variant: ${o.id} for step: ${
|
|
8383
|
+
console.error(`Failed to read model url from variant: ${o.id} for step: ${i.stepName}`);
|
|
8384
8384
|
return;
|
|
8385
8385
|
}
|
|
8386
|
-
const d =
|
|
8386
|
+
const d = i.data;
|
|
8387
8387
|
this.modelContainer.applyModelVariant(
|
|
8388
|
-
|
|
8388
|
+
i.stepName,
|
|
8389
8389
|
{
|
|
8390
8390
|
model: l,
|
|
8391
8391
|
contextService: this.getLayoutPreviewService()
|
|
@@ -8395,15 +8395,15 @@ class Mn {
|
|
|
8395
8395
|
} else {
|
|
8396
8396
|
const l = o.material;
|
|
8397
8397
|
if (!l) {
|
|
8398
|
-
console.error(`Failed to read material from variant: ${o.id} for step: ${
|
|
8398
|
+
console.error(`Failed to read material from variant: ${o.id} for step: ${i.stepName}`);
|
|
8399
8399
|
return;
|
|
8400
8400
|
}
|
|
8401
|
-
|
|
8401
|
+
i.data.targetMaterials.forEach((C) => {
|
|
8402
8402
|
if (!this.modelContainer)
|
|
8403
8403
|
throw new b(
|
|
8404
8404
|
"We should always have a model container when injecting a preview!"
|
|
8405
8405
|
);
|
|
8406
|
-
this.modelContainer.applyMaterialVariant(C,
|
|
8406
|
+
this.modelContainer.applyMaterialVariant(C, i.option.id, l);
|
|
8407
8407
|
});
|
|
8408
8408
|
}
|
|
8409
8409
|
}), await A.getInitializationPromise(), this.renderLayouts();
|
|
@@ -8431,10 +8431,10 @@ class Mn {
|
|
|
8431
8431
|
const e = [];
|
|
8432
8432
|
return this.allScenes.forEach((t) => {
|
|
8433
8433
|
t.renderableSteps.forEach((A) => {
|
|
8434
|
-
var n,
|
|
8434
|
+
var n, i;
|
|
8435
8435
|
const a = { stepName: A.stepName };
|
|
8436
|
-
a.storage = this.storage[A.stepName], a.selectedVariants = (
|
|
8437
|
-
(
|
|
8436
|
+
a.storage = this.storage[A.stepName], a.selectedVariants = (i = (n = this.stepSelections[A.stepName]) == null ? void 0 : n.selectedVariants) == null ? void 0 : i.map(
|
|
8437
|
+
(s) => ({ id: s.id, priceModifier: s.priceModifier })
|
|
8438
8438
|
), e.push(a);
|
|
8439
8439
|
});
|
|
8440
8440
|
}), { steps: e };
|
|
@@ -8493,12 +8493,12 @@ class Mn {
|
|
|
8493
8493
|
}, this.onMetadataChange();
|
|
8494
8494
|
}
|
|
8495
8495
|
removeElements(e) {
|
|
8496
|
-
const t = (A, a) => Object.keys(A).reduce((n,
|
|
8497
|
-
const
|
|
8496
|
+
const t = (A, a) => Object.keys(A).reduce((n, i) => {
|
|
8497
|
+
const s = [...A[i] || []];
|
|
8498
8498
|
return a.forEach((o) => {
|
|
8499
|
-
const r =
|
|
8500
|
-
r > -1 &&
|
|
8501
|
-
}), n[
|
|
8499
|
+
const r = s.findIndex((c) => c.id === o.id);
|
|
8500
|
+
r > -1 && s.splice(r, 1);
|
|
8501
|
+
}), n[i] = s, n;
|
|
8502
8502
|
}, {});
|
|
8503
8503
|
this.stepElements = t(this.stepElements, e);
|
|
8504
8504
|
}
|
|
@@ -8529,16 +8529,16 @@ class Mn {
|
|
|
8529
8529
|
return Promise.reject("Unknown silent step. This is a bug");
|
|
8530
8530
|
}, n = e.filter(
|
|
8531
8531
|
(r) => !this.stepInitialised[r.stepName]
|
|
8532
|
-
),
|
|
8532
|
+
), i = {
|
|
8533
8533
|
stepElements: {},
|
|
8534
8534
|
commands: []
|
|
8535
|
-
},
|
|
8535
|
+
}, s = [];
|
|
8536
8536
|
for (const r of n)
|
|
8537
|
-
this.markStepsAsInitialised([r.stepName]), t ||
|
|
8538
|
-
const o = await Promise.all(
|
|
8537
|
+
this.markStepsAsInitialised([r.stepName]), t || s.push(a(r, this.layouts, A));
|
|
8538
|
+
const o = await Promise.all(s);
|
|
8539
8539
|
for (const r of o)
|
|
8540
|
-
|
|
8541
|
-
return
|
|
8540
|
+
i.stepElements[r.step.stepName] = r.results.map((c) => c.regionElement), i.commands = [...i.commands, ...r.results.map((c) => c.command)];
|
|
8541
|
+
return i;
|
|
8542
8542
|
}
|
|
8543
8543
|
getStepStorage(e) {
|
|
8544
8544
|
return this.storage[e];
|
|
@@ -8590,7 +8590,7 @@ class Mn {
|
|
|
8590
8590
|
}, this.selectionCost = Object.values(this.stepSelections).reduce((Q, I) => Q + I.selectedVariants.map((F) => F.priceModifier || 0).reduce((F, M) => F + M, 0), 0), this.workflow.steps.forEach((Q) => {
|
|
8591
8591
|
ae(Q, this.stepSelections) || (this.stepInitialised[Q.stepName] = !1, delete this.stepMetadata[Q.stepName], delete this.stepSelections[Q.stepName], delete this.storage[Q.stepName]);
|
|
8592
8592
|
});
|
|
8593
|
-
const
|
|
8593
|
+
const i = this.allScenes, s = ce(i, n), o = ce(i, this.stepSelections), r = s.map((Q) => Q.silentSteps).flat(), B = o.map((Q) => Q.silentSteps).flat().filter(
|
|
8594
8594
|
(Q) => !r.some((I) => I.stepName === Q.stepName)
|
|
8595
8595
|
);
|
|
8596
8596
|
r.forEach((Q) => {
|
|
@@ -8689,11 +8689,11 @@ class Mn {
|
|
|
8689
8689
|
if (o.status === "rejected")
|
|
8690
8690
|
throw new Error(`Step initialization failed: ${o.reason}`);
|
|
8691
8691
|
return o.value;
|
|
8692
|
-
}),
|
|
8693
|
-
|
|
8694
|
-
for (const o of
|
|
8692
|
+
}), i = n.filter((o) => !!o && !!o.command).map((o) => o.command), s = n.filter((o) => !!o && !!o.followup).map((o) => o.followup);
|
|
8693
|
+
i && i.length > 0 && this.commandContext.apply(new U(i), !0);
|
|
8694
|
+
for (const o of s)
|
|
8695
8695
|
await o();
|
|
8696
|
-
|
|
8696
|
+
s.length > 0 && await this.ensureStepsAreLoaded(), this.onInitChange();
|
|
8697
8697
|
}
|
|
8698
8698
|
onConfirmChange() {
|
|
8699
8699
|
this.confirmCallbacks.forEach((e) => e(this.confirmedDesign));
|
|
@@ -8799,8 +8799,8 @@ class Z {
|
|
|
8799
8799
|
* @returns The URL for a thumbnail resource configured on this variant.
|
|
8800
8800
|
*/
|
|
8801
8801
|
getThumbnail() {
|
|
8802
|
-
var A, a, n,
|
|
8803
|
-
const e = (n = (a = (A = this.variantData.thumbnail) == null ? void 0 : A.versions) == null ? void 0 : a.find((
|
|
8802
|
+
var A, a, n, i;
|
|
8803
|
+
const e = (n = (a = (A = this.variantData.thumbnail) == null ? void 0 : A.versions) == null ? void 0 : a.find((s) => s.name === "thumbnail")) == null ? void 0 : n.link, t = (i = this.variantData.thumbnail) == null ? void 0 : i.fileLink;
|
|
8804
8804
|
return e || t;
|
|
8805
8805
|
}
|
|
8806
8806
|
/**
|
|
@@ -8828,7 +8828,7 @@ class Z {
|
|
|
8828
8828
|
return this.variantData.enabled;
|
|
8829
8829
|
}
|
|
8830
8830
|
}
|
|
8831
|
-
const yA = class
|
|
8831
|
+
const yA = class it {
|
|
8832
8832
|
constructor(e, t, A) {
|
|
8833
8833
|
this.manager = e, this.step = t, this.tags = A;
|
|
8834
8834
|
}
|
|
@@ -8838,13 +8838,13 @@ const yA = class st {
|
|
|
8838
8838
|
* @param value The new value
|
|
8839
8839
|
*/
|
|
8840
8840
|
setUpdateState(e) {
|
|
8841
|
-
|
|
8841
|
+
it.updateState.set(`${this.step.stepName}-${this.manager.getTransaction().id}`, e);
|
|
8842
8842
|
}
|
|
8843
8843
|
/**
|
|
8844
8844
|
* @returns Gets the current update state of this step. All step handles for this step will see this value.
|
|
8845
8845
|
*/
|
|
8846
8846
|
getUpdateState() {
|
|
8847
|
-
return !!
|
|
8847
|
+
return !!it.updateState.get(`${this.step.stepName}-${this.manager.getTransaction().id}`);
|
|
8848
8848
|
}
|
|
8849
8849
|
/**
|
|
8850
8850
|
* Gets the currently selected variant, or undefined if no variant is selected.
|
|
@@ -9217,8 +9217,8 @@ class Rn extends X {
|
|
|
9217
9217
|
* @param shouldCustomizeAll When true the user can configure the entire text string.
|
|
9218
9218
|
*/
|
|
9219
9219
|
setFullTextCustomization(e) {
|
|
9220
|
-
var
|
|
9221
|
-
const t = ((
|
|
9220
|
+
var i;
|
|
9221
|
+
const t = ((i = this.manager.getStepStorage(this.step.stepName)) == null ? void 0 : i.inputText) || "", A = this.step.data.replaceableText !== void 0 ? this.step.data.replaceableText.replace("{{}}", t) : t, a = e ? A : this.step.data.defaultText;
|
|
9222
9222
|
return this.manager.updateStorage(this.step.stepName, {
|
|
9223
9223
|
customiseAllText: e,
|
|
9224
9224
|
text: a,
|
|
@@ -9235,10 +9235,10 @@ class Rn extends X {
|
|
|
9235
9235
|
input: e
|
|
9236
9236
|
}, A = j.findLayoutElements(this.manager, this.step), a = j.filterUnsupportedCharacters(e, (d = A[0]) == null ? void 0 : d.fontData);
|
|
9237
9237
|
!!this.step.data && !!this.step.data.maxLength && a.length > this.step.data.maxLength || (t.input = a);
|
|
9238
|
-
const
|
|
9239
|
-
if (this.manager.updateStorage(this.step.stepName,
|
|
9238
|
+
const i = A.length <= 0, s = i ? { inputText: a, text: a } : { inputText: a };
|
|
9239
|
+
if (this.manager.updateStorage(this.step.stepName, s), this.manager.updateMetadata(this.step.stepName, {
|
|
9240
9240
|
text: a
|
|
9241
|
-
}),
|
|
9241
|
+
}), i)
|
|
9242
9242
|
return t;
|
|
9243
9243
|
const { command: o, errors: r, helperText: c } = j.updateInputText(
|
|
9244
9244
|
a,
|
|
@@ -9434,7 +9434,7 @@ class Me {
|
|
|
9434
9434
|
case y.Model:
|
|
9435
9435
|
return new Pn(e, t, e.getStepTags(t.stepName));
|
|
9436
9436
|
case y.Frame:
|
|
9437
|
-
return new
|
|
9437
|
+
return new is(e, t, e.getStepTags(t.stepName));
|
|
9438
9438
|
case y.Module:
|
|
9439
9439
|
return new kn(e, t, e.getStepTags(t.stepName));
|
|
9440
9440
|
default:
|
|
@@ -9519,9 +9519,9 @@ function mt(g) {
|
|
|
9519
9519
|
return Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) >= e;
|
|
9520
9520
|
}
|
|
9521
9521
|
const Jn = async (g) => {
|
|
9522
|
-
var
|
|
9523
|
-
const t = ((
|
|
9524
|
-
return A && !mt(A) && (a.Authorization = `Bearer ${A}`), (
|
|
9522
|
+
var i, s;
|
|
9523
|
+
const t = ((i = Object.entries(localStorage).find(([o, r]) => o.startsWith("CognitoIdentityServiceProvider") && o.endsWith("idToken"))) == null ? void 0 : i[0]) || "", A = localStorage.getItem(t), a = {};
|
|
9524
|
+
return A && !mt(A) && (a.Authorization = `Bearer ${A}`), (s = (await x.getShadowGraphqlClient().mutate({
|
|
9525
9525
|
mutation: Gn,
|
|
9526
9526
|
errorPolicy: "all",
|
|
9527
9527
|
fetchPolicy: "no-cache",
|
|
@@ -9538,11 +9538,11 @@ const Jn = async (g) => {
|
|
|
9538
9538
|
context: {
|
|
9539
9539
|
headers: a
|
|
9540
9540
|
}
|
|
9541
|
-
})).data) == null ? void 0 :
|
|
9541
|
+
})).data) == null ? void 0 : s.designCreate;
|
|
9542
9542
|
}, Tn = async (g) => {
|
|
9543
|
-
var
|
|
9544
|
-
const t = ((
|
|
9545
|
-
return A && !mt(A) && (a.Authorization = `Bearer ${A}`), (
|
|
9543
|
+
var i, s;
|
|
9544
|
+
const t = ((i = Object.entries(localStorage).find(([o, r]) => o.startsWith("CognitoIdentityServiceProvider") && o.endsWith("idToken"))) == null ? void 0 : i[0]) || "", A = localStorage.getItem(t), a = {};
|
|
9545
|
+
return A && !mt(A) && (a.Authorization = `Bearer ${A}`), (s = (await x.getShadowGraphqlClient().mutate({
|
|
9546
9546
|
mutation: bn,
|
|
9547
9547
|
errorPolicy: "all",
|
|
9548
9548
|
fetchPolicy: "no-cache",
|
|
@@ -9561,39 +9561,39 @@ const Jn = async (g) => {
|
|
|
9561
9561
|
context: {
|
|
9562
9562
|
headers: a
|
|
9563
9563
|
}
|
|
9564
|
-
})).data) == null ? void 0 :
|
|
9565
|
-
},
|
|
9564
|
+
})).data) == null ? void 0 : s.designCreateMany;
|
|
9565
|
+
}, st = (g, e, t) => {
|
|
9566
9566
|
const A = (n) => {
|
|
9567
|
-
const
|
|
9567
|
+
const i = {};
|
|
9568
9568
|
if (n.type === "Frame") {
|
|
9569
|
-
const
|
|
9570
|
-
if (!
|
|
9571
|
-
return
|
|
9572
|
-
|
|
9569
|
+
const s = g[n.stepName], o = n.data;
|
|
9570
|
+
if (!s || !s.image || o.hideImageInCart && t)
|
|
9571
|
+
return i;
|
|
9572
|
+
i[`${n.stepTitle} image`] = s.image;
|
|
9573
9573
|
}
|
|
9574
9574
|
if (n.type === "Illustration") {
|
|
9575
|
-
const
|
|
9576
|
-
if (!
|
|
9577
|
-
return
|
|
9578
|
-
if (
|
|
9579
|
-
const r =
|
|
9580
|
-
|
|
9575
|
+
const s = g[n.stepName], o = n.data;
|
|
9576
|
+
if (!s || o.hideColorsInCart && t || !s.colors)
|
|
9577
|
+
return i;
|
|
9578
|
+
if (s.colors.length > 0) {
|
|
9579
|
+
const r = s.colors.join(", ").toUpperCase();
|
|
9580
|
+
i[`${n.stepTitle} colors`] = r;
|
|
9581
9581
|
}
|
|
9582
9582
|
}
|
|
9583
9583
|
if (n.type === "Module") {
|
|
9584
|
-
const
|
|
9585
|
-
if (!
|
|
9586
|
-
return
|
|
9587
|
-
|
|
9584
|
+
const s = g[n.stepName], o = n.data;
|
|
9585
|
+
if (!s || s.text === void 0 || s.text === null || o.hideTextInCart && t)
|
|
9586
|
+
return i;
|
|
9587
|
+
i[`${n.stepTitle} text`] = s.text;
|
|
9588
9588
|
}
|
|
9589
9589
|
if (n.type === "Text") {
|
|
9590
|
-
const
|
|
9591
|
-
if (!
|
|
9592
|
-
return
|
|
9590
|
+
const s = g[n.stepName];
|
|
9591
|
+
if (!s)
|
|
9592
|
+
return i;
|
|
9593
9593
|
const o = n.data;
|
|
9594
|
-
(!o.hideTextInCart || !t &&
|
|
9594
|
+
(!o.hideTextInCart || !t && s.text !== void 0 && s.text !== null) && (i[`${n.stepTitle} text`] = s.text), s.color && (!o.hideColorInCart || !t) && (i[`${n.stepTitle} color`] = s.color);
|
|
9595
9595
|
}
|
|
9596
|
-
return
|
|
9596
|
+
return i;
|
|
9597
9597
|
}, a = {};
|
|
9598
9598
|
return e.steps.forEach((n) => {
|
|
9599
9599
|
Object.assign(a, A(n));
|
|
@@ -9601,9 +9601,9 @@ const Jn = async (g) => {
|
|
|
9601
9601
|
}, On = (g, e, t, A) => {
|
|
9602
9602
|
const a = {};
|
|
9603
9603
|
let n = {};
|
|
9604
|
-
t ? n =
|
|
9605
|
-
const
|
|
9606
|
-
for (const o of
|
|
9604
|
+
t ? n = st(t, e, !1) : A && (n = A);
|
|
9605
|
+
const s = e.steps.map((o) => o.stepTitle).filter((o, r, c) => c.indexOf(o) == r);
|
|
9606
|
+
for (const o of s) {
|
|
9607
9607
|
if (Object.keys(g).includes(o)) {
|
|
9608
9608
|
const r = g[o], c = e.steps.find((B) => B.stepTitle === o);
|
|
9609
9609
|
a[`${c == null ? void 0 : c.stepTitle} selection`] = {
|
|
@@ -9618,7 +9618,7 @@ const Jn = async (g) => {
|
|
|
9618
9618
|
});
|
|
9619
9619
|
}
|
|
9620
9620
|
return a;
|
|
9621
|
-
}, SA = (g, e, t, A, a, n,
|
|
9621
|
+
}, SA = (g, e, t, A, a, n, i, s) => {
|
|
9622
9622
|
var C, w;
|
|
9623
9623
|
const o = e.basePrice || 0, r = g.priceModifierTotal || 0, c = On(A, t, void 0, n), l = (P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(g.id), d = {
|
|
9624
9624
|
additionalExternalProductId: (C = g.integrationProduct) == null ? void 0 : C.additionalExternalProductId,
|
|
@@ -9631,9 +9631,9 @@ const Jn = async (g) => {
|
|
|
9631
9631
|
exportedData: c,
|
|
9632
9632
|
externalCartProductId: g.externalCartProductId,
|
|
9633
9633
|
externalCartProductVariantId: g.externalCartProductVariantId,
|
|
9634
|
-
lineItemImageUrl:
|
|
9634
|
+
lineItemImageUrl: i || "",
|
|
9635
9635
|
optionsCost: r,
|
|
9636
|
-
processExecutionId:
|
|
9636
|
+
processExecutionId: s,
|
|
9637
9637
|
quantity: g.quantity,
|
|
9638
9638
|
transactionId: g.id,
|
|
9639
9639
|
transactionOwnerId: l,
|
|
@@ -9642,7 +9642,7 @@ const Jn = async (g) => {
|
|
|
9642
9642
|
workflowViewerReadOnlyLink: g.workflowViewerReadOnlyLink || ""
|
|
9643
9643
|
};
|
|
9644
9644
|
return n && (d.metadata = n), A && (d.selectedVariants = A), a && (d.sku = a), d;
|
|
9645
|
-
}, YA = async (g, e, t, A, a, n,
|
|
9645
|
+
}, YA = async (g, e, t, A, a, n, i, s, o, r) => {
|
|
9646
9646
|
var F;
|
|
9647
9647
|
await (async () => {
|
|
9648
9648
|
var R;
|
|
@@ -9662,7 +9662,7 @@ const Jn = async (g) => {
|
|
|
9662
9662
|
S.errors && console.log("Server Error:", W.message);
|
|
9663
9663
|
}), null) : T ?? null;
|
|
9664
9664
|
})() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(A())), await g.updateStateWithServerImmediate(A), console.log("Server state is undefined @ Workflow completion"));
|
|
9665
|
-
const l = g.getPreviewService(), d = (F = e == null ? void 0 : e.finalizeStepConfig) == null ? void 0 : F.lookAtAnimation, C = l && e.showModelOnFinishStep && !!d, w = o &&
|
|
9665
|
+
const l = g.getPreviewService(), d = (F = e == null ? void 0 : e.finalizeStepConfig) == null ? void 0 : F.lookAtAnimation, C = l && e.showModelOnFinishStep && !!d, w = o && st(o, e, !0), E = o && st(o, e, !1), u = async (M) => {
|
|
9666
9666
|
const Y = {};
|
|
9667
9667
|
let N = 0;
|
|
9668
9668
|
if (Object.keys(n).length > 0)
|
|
@@ -9696,7 +9696,7 @@ const Jn = async (g) => {
|
|
|
9696
9696
|
m[M].map((Y) => Y.id)
|
|
9697
9697
|
])
|
|
9698
9698
|
);
|
|
9699
|
-
let Q = await
|
|
9699
|
+
let Q = await s(C, a.id);
|
|
9700
9700
|
if (Q) {
|
|
9701
9701
|
const M = await (await fetch(Q)).blob();
|
|
9702
9702
|
Q = (await k.uploadAsset(
|
|
@@ -9709,7 +9709,7 @@ const Jn = async (g) => {
|
|
|
9709
9709
|
return {
|
|
9710
9710
|
designDetails: (() => {
|
|
9711
9711
|
const M = {
|
|
9712
|
-
name:
|
|
9712
|
+
name: i,
|
|
9713
9713
|
layouts: t.map((Y) => ({
|
|
9714
9714
|
index: Y.index,
|
|
9715
9715
|
panelId: Y.panelId
|
|
@@ -9736,7 +9736,7 @@ const Jn = async (g) => {
|
|
|
9736
9736
|
cartSelectionsWithPrices: h,
|
|
9737
9737
|
cartMetadata: w
|
|
9738
9738
|
};
|
|
9739
|
-
}, Ln = async (g, e, t, A, a, n,
|
|
9739
|
+
}, Ln = async (g, e, t, A, a, n, i, s, o, r, c) => {
|
|
9740
9740
|
var u, h;
|
|
9741
9741
|
o("workflow.steps.finish.finalize.buildingLayouts");
|
|
9742
9742
|
const { designDetails: B, cartSelectionsWithPrices: l, cartMetadata: d } = await YA(
|
|
@@ -9745,8 +9745,8 @@ const Jn = async (g) => {
|
|
|
9745
9745
|
t,
|
|
9746
9746
|
A,
|
|
9747
9747
|
n,
|
|
9748
|
-
s,
|
|
9749
9748
|
i,
|
|
9749
|
+
s,
|
|
9750
9750
|
r,
|
|
9751
9751
|
c
|
|
9752
9752
|
);
|
|
@@ -9768,8 +9768,8 @@ const Jn = async (g) => {
|
|
|
9768
9768
|
);
|
|
9769
9769
|
}, zn = async (g, e, t) => {
|
|
9770
9770
|
e("workflow.steps.finish.finalize.buildingLayouts"), await Promise.all(
|
|
9771
|
-
g.map(async (
|
|
9772
|
-
await
|
|
9771
|
+
g.map(async (s) => {
|
|
9772
|
+
await s.workflowManager.outstandingRequestsPromise();
|
|
9773
9773
|
})
|
|
9774
9774
|
);
|
|
9775
9775
|
const a = await (async () => {
|
|
@@ -9784,36 +9784,36 @@ const Jn = async (g) => {
|
|
|
9784
9784
|
o.errors && console.log("Server Error:", c.message);
|
|
9785
9785
|
}), null) : (r = o.data) != null && r.transactions ? o.data.transactions.map((c) => c.workflowState ?? null) : null;
|
|
9786
9786
|
})(), n = await Promise.all(
|
|
9787
|
-
g.map(async (
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9787
|
+
g.map(async (s, o) => await YA(
|
|
9788
|
+
s.workflowManager,
|
|
9789
|
+
s.workflow,
|
|
9790
|
+
s.layouts,
|
|
9791
|
+
s.getReducerState,
|
|
9792
|
+
s.transaction,
|
|
9793
|
+
s.workflowSelections,
|
|
9794
|
+
s.designName,
|
|
9795
9795
|
t ?? (() => Promise.resolve(void 0)),
|
|
9796
|
-
|
|
9796
|
+
s.workflowMetadata,
|
|
9797
9797
|
a ? a[o] : void 0
|
|
9798
9798
|
))
|
|
9799
9799
|
);
|
|
9800
9800
|
e("workflow.steps.finish.finalize.creatingDesign");
|
|
9801
|
-
const
|
|
9802
|
-
if (!
|
|
9801
|
+
const i = await Tn(n.map((s) => s.designDetails));
|
|
9802
|
+
if (!i)
|
|
9803
9803
|
throw new Error("Failed to create designs");
|
|
9804
|
-
return e("workflow.steps.finish.finalize.updatingTransaction"),
|
|
9804
|
+
return e("workflow.steps.finish.finalize.updatingTransaction"), i.map((s, o) => {
|
|
9805
9805
|
var l;
|
|
9806
|
-
const r = g[o], c = n[o], B =
|
|
9806
|
+
const r = g[o], c = n[o], B = s.transaction;
|
|
9807
9807
|
return SA(
|
|
9808
9808
|
B,
|
|
9809
9809
|
r.product,
|
|
9810
9810
|
r.workflow,
|
|
9811
9811
|
c.cartSelectionsWithPrices,
|
|
9812
|
-
|
|
9812
|
+
s.sku,
|
|
9813
9813
|
c.cartMetadata,
|
|
9814
9814
|
//lineItemImageLink,
|
|
9815
9815
|
void 0,
|
|
9816
|
-
(l =
|
|
9816
|
+
(l = s.processExecution) == null ? void 0 : l.id
|
|
9817
9817
|
);
|
|
9818
9818
|
});
|
|
9819
9819
|
};
|
|
@@ -9907,16 +9907,16 @@ class Se {
|
|
|
9907
9907
|
await qe.getSavedDesignByTransaction(
|
|
9908
9908
|
this.getWorkflowManager().getTransaction().id
|
|
9909
9909
|
) && this.save();
|
|
9910
|
-
}, 2500), this.getCanvasObjectURLAsync = async (n) => new Promise((
|
|
9910
|
+
}, 2500), this.getCanvasObjectURLAsync = async (n) => new Promise((i, s) => {
|
|
9911
9911
|
try {
|
|
9912
9912
|
n.toBlob((o) => {
|
|
9913
9913
|
if (o) {
|
|
9914
9914
|
const r = URL.createObjectURL(o);
|
|
9915
|
-
|
|
9915
|
+
i(r);
|
|
9916
9916
|
}
|
|
9917
9917
|
});
|
|
9918
9918
|
} catch (o) {
|
|
9919
|
-
|
|
9919
|
+
s(o);
|
|
9920
9920
|
}
|
|
9921
9921
|
}), !t.workflow)
|
|
9922
9922
|
throw new Error("No Workflow ID provided.");
|
|
@@ -9949,16 +9949,16 @@ class Se {
|
|
|
9949
9949
|
t.singleVariantsRenderable,
|
|
9950
9950
|
t.delayWorkflowStateSync
|
|
9951
9951
|
), this.workflowManager.addSelectionCallback((n) => {
|
|
9952
|
-
const
|
|
9953
|
-
const o =
|
|
9952
|
+
const i = n.traversableScenes.map((s) => {
|
|
9953
|
+
const o = s.renderableSteps.map((r) => r.stepName);
|
|
9954
9954
|
return {
|
|
9955
|
-
id:
|
|
9956
|
-
title:
|
|
9955
|
+
id: s.name,
|
|
9956
|
+
title: s.title,
|
|
9957
9957
|
renderableSteps: o,
|
|
9958
|
-
workflowScene:
|
|
9958
|
+
workflowScene: s
|
|
9959
9959
|
};
|
|
9960
9960
|
});
|
|
9961
|
-
this.renderableScenes =
|
|
9961
|
+
this.renderableScenes = i, this.renderableSceneCallbacks.forEach((s) => s(i));
|
|
9962
9962
|
}), this.currentPriceBreak = this.priceBreakToBeApplied();
|
|
9963
9963
|
}
|
|
9964
9964
|
getBundle() {
|
|
@@ -9989,10 +9989,10 @@ class Se {
|
|
|
9989
9989
|
}
|
|
9990
9990
|
let n = 2048;
|
|
9991
9991
|
t && t <= 2048 && (n = t);
|
|
9992
|
-
const
|
|
9992
|
+
const i = Ue(n, n), s = this.commandContext.getAllLayouts(), o = A.defaultPreviewPanelIndex || 0, r = A.panels[o], c = s.find((m) => {
|
|
9993
9993
|
var p;
|
|
9994
9994
|
return ((p = m.layoutState) == null ? void 0 : p.layout.panelId) === (r == null ? void 0 : r.name);
|
|
9995
|
-
}) ||
|
|
9995
|
+
}) || s[0], B = c.layoutState.layout.previewRegion ? {
|
|
9996
9996
|
x: c.layoutState.layout.previewRegion.left,
|
|
9997
9997
|
y: c.layoutState.layout.previewRegion.top,
|
|
9998
9998
|
width: c.layoutState.layout.previewRegion.width,
|
|
@@ -10002,7 +10002,7 @@ class Se {
|
|
|
10002
10002
|
y: 0,
|
|
10003
10003
|
width: c.layoutState.layout.width,
|
|
10004
10004
|
height: c.layoutState.layout.height
|
|
10005
|
-
}, l = this.commandContext.getLayoutById(c.layoutState.layout.id), d =
|
|
10005
|
+
}, l = this.commandContext.getLayoutById(c.layoutState.layout.id), d = i.getContext("2d");
|
|
10006
10006
|
if (!d)
|
|
10007
10007
|
throw new je("Failed to obtain 2D context for preview image creation");
|
|
10008
10008
|
const C = zt(l.layoutState.layout, l.layoutState.elements, {
|
|
@@ -10019,8 +10019,8 @@ class Se {
|
|
|
10019
10019
|
DOMParser: Wt(),
|
|
10020
10020
|
fetch: ot
|
|
10021
10021
|
})).render();
|
|
10022
|
-
const u = await this.getCanvasObjectURLAsync(
|
|
10023
|
-
return
|
|
10022
|
+
const u = await this.getCanvasObjectURLAsync(i);
|
|
10023
|
+
return i.toDataURL(u);
|
|
10024
10024
|
}
|
|
10025
10025
|
getStepById(e) {
|
|
10026
10026
|
const t = this.getWorkflowManager().getWorkflow().steps.find((n) => n.stepName === e);
|
|
@@ -10053,7 +10053,7 @@ class Se {
|
|
|
10053
10053
|
const t = this.getWorkflowManager().getWorkflowSelections();
|
|
10054
10054
|
let A = 0;
|
|
10055
10055
|
return Object.values(t).forEach((a) => {
|
|
10056
|
-
A += a.selections.reduce((n,
|
|
10056
|
+
A += a.selections.reduce((n, i) => n + (i.priceModifier || 0), 0);
|
|
10057
10057
|
}), this.getPriceSubUnitsAfterPriceBreaks(A, e);
|
|
10058
10058
|
}
|
|
10059
10059
|
getBasePriceSubunits(e, t) {
|
|
@@ -10110,10 +10110,10 @@ class Se {
|
|
|
10110
10110
|
);
|
|
10111
10111
|
}
|
|
10112
10112
|
async copySelectionsViaGlobalConfiguration(e, t, A) {
|
|
10113
|
-
const a = await e.getGlobalProperties(), n = A == null ? void 0 : A.map((r) => r.getId()),
|
|
10114
|
-
|
|
10113
|
+
const a = await e.getGlobalProperties(), n = A == null ? void 0 : A.map((r) => r.getId()), i = this.getSteps().filter((r) => n === void 0 || n.includes(r.getId())), s = t.getSteps(), o = (r) => a.find((c) => c.getRawProperty().name === r.aspectName);
|
|
10114
|
+
i.forEach((r) => {
|
|
10115
10115
|
const c = /* @__PURE__ */ new Set(), B = r.getRaw().globalPropertyAspectConfigurations;
|
|
10116
|
-
B !== void 0 && (B.forEach((l) => c.add(JSON.stringify(l))),
|
|
10116
|
+
B !== void 0 && (B.forEach((l) => c.add(JSON.stringify(l))), s.forEach((l) => {
|
|
10117
10117
|
const d = l.getRaw().globalPropertyAspectConfigurations;
|
|
10118
10118
|
d !== void 0 && d.forEach((C) => {
|
|
10119
10119
|
const w = o(C), E = c.has(JSON.stringify(C));
|
|
@@ -10151,8 +10151,8 @@ class Se {
|
|
|
10151
10151
|
return this.assignCustomerDetails({ emailAddress: e.email });
|
|
10152
10152
|
}
|
|
10153
10153
|
async assignCustomerDetails(e) {
|
|
10154
|
-
var
|
|
10155
|
-
const A = (P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(this.getWorkflowManager().getTransaction().id), n = (o = (
|
|
10154
|
+
var i, s, o;
|
|
10155
|
+
const A = (P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(this.getWorkflowManager().getTransaction().id), n = (o = (s = (i = (await x.getShadowGraphqlClient().mutate({
|
|
10156
10156
|
mutation: jn,
|
|
10157
10157
|
variables: {
|
|
10158
10158
|
id: this.getWorkflowManager().getTransaction().id,
|
|
@@ -10162,7 +10162,7 @@ class Se {
|
|
|
10162
10162
|
context: {
|
|
10163
10163
|
transactionOwnerId: A
|
|
10164
10164
|
}
|
|
10165
|
-
})).data) == null ? void 0 :
|
|
10165
|
+
})).data) == null ? void 0 : i.transactionAddStakeholder) == null ? void 0 : s.stakeholders) == null ? void 0 : o.find(
|
|
10166
10166
|
(r) => {
|
|
10167
10167
|
var c;
|
|
10168
10168
|
return ((c = r.customer) == null ? void 0 : c.emailAddress) === e.emailAddress;
|
|
@@ -10188,8 +10188,8 @@ class Se {
|
|
|
10188
10188
|
var o;
|
|
10189
10189
|
if (e)
|
|
10190
10190
|
return e;
|
|
10191
|
-
const n = this.getWorkflowManager().getTransaction().id,
|
|
10192
|
-
return
|
|
10191
|
+
const n = this.getWorkflowManager().getTransaction().id, s = (o = (await qe.getSavedDesigns()).find((r) => r.transactionId === n)) == null ? void 0 : o.title;
|
|
10192
|
+
return s || "My design";
|
|
10193
10193
|
})(),
|
|
10194
10194
|
thumbnail: await this.createPreviewImage(!1, 256),
|
|
10195
10195
|
transactionId: this.getWorkflowManager().getTransaction().id,
|
|
@@ -10202,11 +10202,11 @@ class Se {
|
|
|
10202
10202
|
return await qe.addDesign(a), a;
|
|
10203
10203
|
}
|
|
10204
10204
|
async copy() {
|
|
10205
|
-
var
|
|
10205
|
+
var s;
|
|
10206
10206
|
const e = he(this.getCommandContext().getState());
|
|
10207
10207
|
if (!e)
|
|
10208
10208
|
throw new b("Internal state is undefined! Cannot copy experience!");
|
|
10209
|
-
const t = JSON.stringify(e.transaction), A = this.getWorkflowManager().getWorkflow(), a = new
|
|
10209
|
+
const t = JSON.stringify(e.transaction), A = this.getWorkflowManager().getWorkflow(), a = new as({}), n = (s = this.getWorkflowManager().getTransaction().integrationProduct) == null ? void 0 : s.id;
|
|
10210
10210
|
if (!n)
|
|
10211
10211
|
throw new b("Integration product id is undefined!");
|
|
10212
10212
|
return await a.initFromIntegrationProduct(n), await a.getWorkflowExperience(A.id, t, void 0);
|
|
@@ -10239,17 +10239,17 @@ class Se {
|
|
|
10239
10239
|
var a;
|
|
10240
10240
|
const e = /* @__PURE__ */ new Map(), t = this.getWorkflowManager().getWorkflowMetadata(), A = this.getWorkflowManager().getWorkflowSelections();
|
|
10241
10241
|
return Object.keys(t).forEach((n) => {
|
|
10242
|
-
const
|
|
10243
|
-
if (!
|
|
10242
|
+
const i = this.workflowManager.getWorkflow().steps.find((o) => o.stepName === n);
|
|
10243
|
+
if (!i)
|
|
10244
10244
|
return;
|
|
10245
|
-
e.has(
|
|
10246
|
-
const
|
|
10247
|
-
Object.keys(
|
|
10248
|
-
e.get(
|
|
10245
|
+
e.has(i.stepTitle) || e.set(i.stepTitle, {});
|
|
10246
|
+
const s = t[n];
|
|
10247
|
+
Object.keys(s).forEach((o) => {
|
|
10248
|
+
e.get(i.stepTitle)[o] = s[o];
|
|
10249
10249
|
});
|
|
10250
10250
|
}), (a = Object.keys(A)) == null || a.forEach((n) => {
|
|
10251
|
-
const
|
|
10252
|
-
|
|
10251
|
+
const i = this.workflowManager.getWorkflow().steps.find((s) => s.stepName === n);
|
|
10252
|
+
i && (e.has(i.stepTitle) || e.set(i.stepTitle, {}), e.get(i.stepTitle).selection = A[n].selections[0].name);
|
|
10253
10253
|
}), e;
|
|
10254
10254
|
}
|
|
10255
10255
|
getQuantity() {
|
|
@@ -10304,9 +10304,9 @@ const Wn = [
|
|
|
10304
10304
|
"tref",
|
|
10305
10305
|
"tspan"
|
|
10306
10306
|
], Xn = async (g, e, t) => {
|
|
10307
|
-
const A = e.data, a = t.data.baseUrl, n = A.assetUrl.replace("localhost", "localstack"),
|
|
10308
|
-
|
|
10309
|
-
const o =
|
|
10307
|
+
const A = e.data, a = t.data.baseUrl, n = A.assetUrl.replace("localhost", "localstack"), i = a.slice(0, 4) === "http" ? "" : "https://", s = new URL(i + a);
|
|
10308
|
+
s.searchParams.append("video", Yt(JSON.stringify([{ href: n }]))), s.pathname = s.pathname + (s.pathname.slice(-1) === "/" ? "" : "/");
|
|
10309
|
+
const o = s.toString(), c = `data:image/svg+xml;base64,${Yt(await tA(o, { type: "svg" }))}`, B = (d) => {
|
|
10310
10310
|
const C = g.find((E) => E.panelId === d.panelId);
|
|
10311
10311
|
if (!C)
|
|
10312
10312
|
throw new z(d);
|
|
@@ -10331,10 +10331,10 @@ const Wn = [
|
|
|
10331
10331
|
return console.error(d), [];
|
|
10332
10332
|
}
|
|
10333
10333
|
}, qn = async (g, e, t, A) => {
|
|
10334
|
-
const a = t.data, n = a.assetUrl,
|
|
10334
|
+
const a = t.data, n = a.assetUrl, i = await tt(n);
|
|
10335
10335
|
try {
|
|
10336
|
-
const
|
|
10337
|
-
|
|
10336
|
+
const s = _A(a, A.option);
|
|
10337
|
+
s && (e[A.stepName] = { selectedVariants: [s] });
|
|
10338
10338
|
const o = async (r) => {
|
|
10339
10339
|
var w;
|
|
10340
10340
|
const c = await ea(
|
|
@@ -10342,11 +10342,11 @@ const Wn = [
|
|
|
10342
10342
|
width: 1,
|
|
10343
10343
|
height: 1
|
|
10344
10344
|
},
|
|
10345
|
-
(w =
|
|
10345
|
+
(w = s == null ? void 0 : s.asset) == null ? void 0 : w.fileLink
|
|
10346
10346
|
), B = await rt(c), l = J(), d = g.find((E) => E.panelId === r.panelId);
|
|
10347
10347
|
if (!d)
|
|
10348
10348
|
throw new z(r);
|
|
10349
|
-
const C = ct(
|
|
10349
|
+
const C = ct(i, B, {
|
|
10350
10350
|
scale: a.scale,
|
|
10351
10351
|
left: a.x,
|
|
10352
10352
|
top: a.y
|
|
@@ -10376,28 +10376,28 @@ const Wn = [
|
|
|
10376
10376
|
},
|
|
10377
10377
|
d
|
|
10378
10378
|
),
|
|
10379
|
-
new Lt(l,
|
|
10379
|
+
new Lt(l, i, C)
|
|
10380
10380
|
];
|
|
10381
10381
|
};
|
|
10382
10382
|
return (await Promise.all(A.data.regions.map((r) => o(r)))).flat();
|
|
10383
|
-
} catch (
|
|
10384
|
-
return console.error(
|
|
10383
|
+
} catch (s) {
|
|
10384
|
+
return console.error(s), [];
|
|
10385
10385
|
}
|
|
10386
10386
|
}, Zn = async (g, e, t, A) => {
|
|
10387
10387
|
var p, Q;
|
|
10388
10388
|
const a = t.data, n = A.option;
|
|
10389
10389
|
if (!n)
|
|
10390
10390
|
return console.error(`No option for step ${A.stepName}.`), [];
|
|
10391
|
-
const
|
|
10392
|
-
if (!
|
|
10391
|
+
const i = ((p = n.variants) == null ? void 0 : p.find((I) => I.id === a.illustrationVariantId)) || ze(n);
|
|
10392
|
+
if (!i)
|
|
10393
10393
|
return console.error(`No variant with ID: ${a.illustrationVariantId}`), [];
|
|
10394
|
-
if (!
|
|
10394
|
+
if (!i.asset)
|
|
10395
10395
|
return console.error(`No asset for variant with ID: ${a.illustrationVariantId}`), [];
|
|
10396
|
-
e[A.stepName] = { selectedVariants: [
|
|
10397
|
-
const
|
|
10398
|
-
if (!
|
|
10396
|
+
e[A.stepName] = { selectedVariants: [i] };
|
|
10397
|
+
const s = (Q = i.asset) == null ? void 0 : Q.fileLink;
|
|
10398
|
+
if (!s)
|
|
10399
10399
|
return console.error(`No asset link for variant with ID: ${a.illustrationVariantId}`), [];
|
|
10400
|
-
const o = await _(
|
|
10400
|
+
const o = await _(s, !0), r = /<svg.*?<\/svg>/s, c = o.match(r) || [], B = (c == null ? void 0 : c.length) > 0 ? c[0] : "", C = Xt().parseFromString(B, "image/svg+xml").firstElementChild;
|
|
10401
10401
|
if (!C)
|
|
10402
10402
|
return console.error("Failed to read SVG."), [];
|
|
10403
10403
|
qt(C);
|
|
@@ -10453,7 +10453,7 @@ const Wn = [
|
|
|
10453
10453
|
return console.error(I), [];
|
|
10454
10454
|
}
|
|
10455
10455
|
}, $n = async (g, e, t) => {
|
|
10456
|
-
const A = await FA(t.data.module), a = e.data, n = (
|
|
10456
|
+
const A = await FA(t.data.module), a = e.data, n = (s, o) => {
|
|
10457
10457
|
const r = g.find((B) => B.panelId === o.panelId);
|
|
10458
10458
|
if (!r)
|
|
10459
10459
|
throw new z(o);
|
|
@@ -10462,7 +10462,7 @@ const Wn = [
|
|
|
10462
10462
|
{
|
|
10463
10463
|
colors: {},
|
|
10464
10464
|
id: c,
|
|
10465
|
-
svg:
|
|
10465
|
+
svg: s,
|
|
10466
10466
|
type: G.Illustration,
|
|
10467
10467
|
y: o.top,
|
|
10468
10468
|
x: o.left,
|
|
@@ -10474,27 +10474,27 @@ const Wn = [
|
|
|
10474
10474
|
},
|
|
10475
10475
|
r
|
|
10476
10476
|
);
|
|
10477
|
-
},
|
|
10477
|
+
}, i = t.data.regions;
|
|
10478
10478
|
try {
|
|
10479
|
-
return
|
|
10480
|
-
(
|
|
10479
|
+
return i.map(
|
|
10480
|
+
(s) => n(A.svgPrint(a.text, s), s)
|
|
10481
10481
|
);
|
|
10482
|
-
} catch (
|
|
10483
|
-
return console.error(
|
|
10482
|
+
} catch (s) {
|
|
10483
|
+
return console.error(s), [];
|
|
10484
10484
|
}
|
|
10485
10485
|
}, _n = async (g, e, t, A) => {
|
|
10486
10486
|
var c, B;
|
|
10487
10487
|
const a = t.data, n = A.option;
|
|
10488
10488
|
if (!n)
|
|
10489
10489
|
return console.error(`No option for step ${A.stepName}.`), [];
|
|
10490
|
-
const
|
|
10491
|
-
if (!
|
|
10490
|
+
const i = ((c = n.variants) == null ? void 0 : c.find((l) => l.id === a.pictureVariantId)) || ze(n);
|
|
10491
|
+
if (!i)
|
|
10492
10492
|
return console.error(`No variant with ID: ${a.pictureVariantId}`), [];
|
|
10493
|
-
if (!
|
|
10493
|
+
if (!i.asset)
|
|
10494
10494
|
return console.error(`No asset for variant with ID: ${a.pictureVariantId}`), [];
|
|
10495
|
-
e[A.stepName] = { selectedVariants: [
|
|
10496
|
-
const
|
|
10497
|
-
if (!
|
|
10495
|
+
e[A.stepName] = { selectedVariants: [i] };
|
|
10496
|
+
const s = (B = i.asset) == null ? void 0 : B.fileLink;
|
|
10497
|
+
if (!s)
|
|
10498
10498
|
return console.error(`No asset link for variant with ID: ${a.pictureVariantId}`), [];
|
|
10499
10499
|
const o = (l) => {
|
|
10500
10500
|
const d = g.find((w) => w.panelId === l.panelId);
|
|
@@ -10504,7 +10504,7 @@ const Wn = [
|
|
|
10504
10504
|
return new L(
|
|
10505
10505
|
{
|
|
10506
10506
|
id: C,
|
|
10507
|
-
src:
|
|
10507
|
+
src: s,
|
|
10508
10508
|
type: G.Image,
|
|
10509
10509
|
y: l.top,
|
|
10510
10510
|
x: l.left,
|
|
@@ -10524,16 +10524,16 @@ const Wn = [
|
|
|
10524
10524
|
} catch (l) {
|
|
10525
10525
|
return console.error(l), [];
|
|
10526
10526
|
}
|
|
10527
|
-
},
|
|
10527
|
+
}, ei = async (g, e, t, A) => {
|
|
10528
10528
|
var r;
|
|
10529
10529
|
const a = t.data, n = A.option;
|
|
10530
10530
|
if (!n)
|
|
10531
10531
|
return console.error(`No option for step ${A.stepName}.`), [];
|
|
10532
|
-
const
|
|
10533
|
-
if (!
|
|
10532
|
+
const i = ((r = n.variants) == null ? void 0 : r.find((c) => c.id === a.colorVariantId)) || ze(n);
|
|
10533
|
+
if (!i)
|
|
10534
10534
|
return console.error(`No variant with ID: ${a.colorVariantId}`), [];
|
|
10535
|
-
e[A.stepName] = { selectedVariants: [
|
|
10536
|
-
const
|
|
10535
|
+
e[A.stepName] = { selectedVariants: [i] };
|
|
10536
|
+
const s = (c) => {
|
|
10537
10537
|
const B = g.find((E) => E.panelId === c.panelId);
|
|
10538
10538
|
if (!B)
|
|
10539
10539
|
throw new z(c);
|
|
@@ -10554,10 +10554,10 @@ const Wn = [
|
|
|
10554
10554
|
width="1"
|
|
10555
10555
|
height="1"
|
|
10556
10556
|
class="spiff-fill-shape"
|
|
10557
|
-
fill="${
|
|
10557
|
+
fill="${i == null ? void 0 : i.color}"
|
|
10558
10558
|
/>
|
|
10559
10559
|
</svg>
|
|
10560
|
-
`, C = { "spiff-fill-shape": { browserValue:
|
|
10560
|
+
`, C = { "spiff-fill-shape": { browserValue: i.color || "#000000" } }, w = J();
|
|
10561
10561
|
return new L(
|
|
10562
10562
|
{
|
|
10563
10563
|
colors: C,
|
|
@@ -10577,16 +10577,16 @@ const Wn = [
|
|
|
10577
10577
|
);
|
|
10578
10578
|
}, o = A.data.regions;
|
|
10579
10579
|
try {
|
|
10580
|
-
return o.map(
|
|
10580
|
+
return o.map(s);
|
|
10581
10581
|
} catch (c) {
|
|
10582
10582
|
return console.error(c), [];
|
|
10583
10583
|
}
|
|
10584
|
-
},
|
|
10584
|
+
}, ti = async (g, e, t) => {
|
|
10585
10585
|
const A = [], n = (() => {
|
|
10586
10586
|
var r, c;
|
|
10587
10587
|
return e.type === y.ProductOverlay ? t || ((r = e.data.asset) == null ? void 0 : r.fileLink) || "" : ((c = e.data.asset) == null ? void 0 : c.fileLink) || "";
|
|
10588
|
-
})(),
|
|
10589
|
-
if (
|
|
10588
|
+
})(), s = (() => n.endsWith(".jpeg") || n.endsWith(".jpg") || n.endsWith(".png") ? G.Image : n.endsWith(".svg") ? G.Illustration : G.Illustration)(), o = e.data.regions;
|
|
10589
|
+
if (s === "image")
|
|
10590
10590
|
try {
|
|
10591
10591
|
o.forEach((r) => {
|
|
10592
10592
|
const c = g.find((l) => l.panelId === r.panelId);
|
|
@@ -10595,7 +10595,7 @@ const Wn = [
|
|
|
10595
10595
|
const B = {
|
|
10596
10596
|
id: J(),
|
|
10597
10597
|
src: n,
|
|
10598
|
-
type:
|
|
10598
|
+
type: s,
|
|
10599
10599
|
y: r.top,
|
|
10600
10600
|
x: r.left,
|
|
10601
10601
|
width: r.width,
|
|
@@ -10631,7 +10631,7 @@ const Wn = [
|
|
|
10631
10631
|
asset_key: n,
|
|
10632
10632
|
svg: c(r),
|
|
10633
10633
|
colors: {},
|
|
10634
|
-
type:
|
|
10634
|
+
type: s,
|
|
10635
10635
|
y: B.top,
|
|
10636
10636
|
x: B.left,
|
|
10637
10637
|
width: B.width,
|
|
@@ -10648,8 +10648,8 @@ const Wn = [
|
|
|
10648
10648
|
});
|
|
10649
10649
|
}
|
|
10650
10650
|
return A;
|
|
10651
|
-
},
|
|
10652
|
-
const a = [], n = t.data,
|
|
10651
|
+
}, Ai = async (g, e, t, A) => {
|
|
10652
|
+
const a = [], n = t.data, i = 30, s = (E) => E.vertical ? "center" : E.textAlign || "center", o = () => {
|
|
10653
10653
|
var D;
|
|
10654
10654
|
const E = A.option;
|
|
10655
10655
|
if (!E)
|
|
@@ -10687,11 +10687,11 @@ const Wn = [
|
|
|
10687
10687
|
const h = {
|
|
10688
10688
|
stepName: t.name,
|
|
10689
10689
|
id: J(),
|
|
10690
|
-
align:
|
|
10690
|
+
align: s(A.data),
|
|
10691
10691
|
curved: A.data.curved,
|
|
10692
10692
|
fill: n.color || C || "#000000",
|
|
10693
10693
|
fontData: c,
|
|
10694
|
-
fontSize: A.data.size ||
|
|
10694
|
+
fontSize: A.data.size || i,
|
|
10695
10695
|
height: E.height,
|
|
10696
10696
|
layer: E.layer,
|
|
10697
10697
|
layerIndex: E.layerIndex,
|
|
@@ -10707,7 +10707,7 @@ const Wn = [
|
|
|
10707
10707
|
};
|
|
10708
10708
|
if (c) {
|
|
10709
10709
|
const [D, m] = Ne(
|
|
10710
|
-
A.data.size ||
|
|
10710
|
+
A.data.size || i,
|
|
10711
10711
|
c,
|
|
10712
10712
|
E,
|
|
10713
10713
|
[
|
|
@@ -10737,30 +10737,30 @@ const Wn = [
|
|
|
10737
10737
|
a.push(new L(h, u));
|
|
10738
10738
|
}
|
|
10739
10739
|
return a;
|
|
10740
|
-
},
|
|
10740
|
+
}, ai = (g, e) => g.conditions ? g.conditions.every((t) => {
|
|
10741
10741
|
const A = e[t.targetStepName];
|
|
10742
10742
|
if (A && A.selectedVariants) {
|
|
10743
10743
|
const a = A.selectedVariants;
|
|
10744
10744
|
return t.requiredVariantSelections.some(
|
|
10745
|
-
(n) => a.find((
|
|
10745
|
+
(n) => a.find((i) => i.id === n) !== void 0
|
|
10746
10746
|
);
|
|
10747
10747
|
}
|
|
10748
10748
|
return !1;
|
|
10749
|
-
}) : !0,
|
|
10749
|
+
}) : !0, ni = async (g, e, t, A) => {
|
|
10750
10750
|
const a = [], n = {};
|
|
10751
|
-
for (const
|
|
10752
|
-
const
|
|
10753
|
-
if (
|
|
10754
|
-
switch (
|
|
10751
|
+
for (const i of g) {
|
|
10752
|
+
const s = e.steps.find((o) => o.stepName === i.name);
|
|
10753
|
+
if (s)
|
|
10754
|
+
switch (s.type) {
|
|
10755
10755
|
case y.DigitalContent:
|
|
10756
10756
|
a.push(
|
|
10757
|
-
...await Xn(t,
|
|
10757
|
+
...await Xn(t, i, s)
|
|
10758
10758
|
);
|
|
10759
10759
|
break;
|
|
10760
10760
|
case y.Frame:
|
|
10761
10761
|
case y.Photo:
|
|
10762
10762
|
a.push(
|
|
10763
|
-
...await qn(t, n,
|
|
10763
|
+
...await qn(t, n, i, s)
|
|
10764
10764
|
);
|
|
10765
10765
|
break;
|
|
10766
10766
|
case y.Illustration:
|
|
@@ -10768,34 +10768,34 @@ const Wn = [
|
|
|
10768
10768
|
...await Zn(
|
|
10769
10769
|
t,
|
|
10770
10770
|
n,
|
|
10771
|
-
|
|
10772
|
-
|
|
10771
|
+
i,
|
|
10772
|
+
s
|
|
10773
10773
|
)
|
|
10774
10774
|
);
|
|
10775
10775
|
break;
|
|
10776
10776
|
case y.Module:
|
|
10777
|
-
a.push(...await $n(t,
|
|
10777
|
+
a.push(...await $n(t, i, s));
|
|
10778
10778
|
break;
|
|
10779
10779
|
case y.Picture:
|
|
10780
10780
|
a.push(
|
|
10781
|
-
...await _n(t, n,
|
|
10781
|
+
...await _n(t, n, i, s)
|
|
10782
10782
|
);
|
|
10783
10783
|
break;
|
|
10784
10784
|
case y.Shape:
|
|
10785
10785
|
a.push(
|
|
10786
|
-
...await
|
|
10786
|
+
...await ei(t, n, i, s)
|
|
10787
10787
|
);
|
|
10788
10788
|
break;
|
|
10789
10789
|
case y.Text:
|
|
10790
10790
|
a.push(
|
|
10791
|
-
...await
|
|
10791
|
+
...await Ai(t, n, i, s)
|
|
10792
10792
|
);
|
|
10793
10793
|
break;
|
|
10794
10794
|
}
|
|
10795
10795
|
}
|
|
10796
|
-
for (const
|
|
10797
|
-
|
|
10798
|
-
...await
|
|
10796
|
+
for (const i of e.steps)
|
|
10797
|
+
i.type !== y.SilentIllustration && i.type !== y.ProductOverlay || ai(i, n) && a.push(
|
|
10798
|
+
...await ti(t, i, A)
|
|
10799
10799
|
);
|
|
10800
10800
|
return a;
|
|
10801
10801
|
};
|
|
@@ -10806,7 +10806,7 @@ class Ye {
|
|
|
10806
10806
|
e.forEach(
|
|
10807
10807
|
(A) => t.set(
|
|
10808
10808
|
A.id,
|
|
10809
|
-
new
|
|
10809
|
+
new oi(A.id, A.name, this, { width: A.width, height: A.height })
|
|
10810
10810
|
)
|
|
10811
10811
|
), this.layouts = t;
|
|
10812
10812
|
}
|
|
@@ -10820,15 +10820,15 @@ class Ye {
|
|
|
10820
10820
|
return this.layouts;
|
|
10821
10821
|
}
|
|
10822
10822
|
}
|
|
10823
|
-
const
|
|
10823
|
+
const ii = () => new Promise((g, e) => {
|
|
10824
10824
|
try {
|
|
10825
10825
|
const A = Ue().getContext("webgl2");
|
|
10826
10826
|
g(!!A);
|
|
10827
10827
|
} catch {
|
|
10828
10828
|
g(!1);
|
|
10829
10829
|
}
|
|
10830
|
-
}),
|
|
10831
|
-
class
|
|
10830
|
+
}), si = ii();
|
|
10831
|
+
class oi {
|
|
10832
10832
|
constructor(e, t, A, a) {
|
|
10833
10833
|
this.hasSetStaticContext = !1, this.interactiveDirty = !1, this.staticCtxDirty = !1, this.lastRequestedRenderArguments = void 0, this.lastCompletedStaticRender = void 0, this.renderQueue = new dA(2), this.id = e, this.name = t, this.service = A, this.panelSize = a;
|
|
10834
10834
|
}
|
|
@@ -10884,10 +10884,10 @@ class os {
|
|
|
10884
10884
|
return;
|
|
10885
10885
|
}
|
|
10886
10886
|
this.renderQueue.enqueue(
|
|
10887
|
-
new
|
|
10887
|
+
new ri(
|
|
10888
10888
|
this.getID(),
|
|
10889
10889
|
A,
|
|
10890
|
-
await
|
|
10890
|
+
await si,
|
|
10891
10891
|
() => {
|
|
10892
10892
|
this.markLastCompletedStaticRender(), this.setStaticContextDirty(!0);
|
|
10893
10893
|
},
|
|
@@ -10896,7 +10896,7 @@ class os {
|
|
|
10896
10896
|
);
|
|
10897
10897
|
}
|
|
10898
10898
|
}
|
|
10899
|
-
class
|
|
10899
|
+
class ri extends BA {
|
|
10900
10900
|
// TODO: Do we need to pass this whole array in?
|
|
10901
10901
|
constructor(e, t, A, a, n) {
|
|
10902
10902
|
super(), this.layoutId = e, this.ctx = t, this.nonPOTSupport = A, this.onRender = a, this.layouts = n;
|
|
@@ -10938,11 +10938,11 @@ class rs extends BA {
|
|
|
10938
10938
|
const e = this.layouts.find((d) => d.layoutState.layout.id === this.layoutId);
|
|
10939
10939
|
if (!e)
|
|
10940
10940
|
return;
|
|
10941
|
-
const t = e.layoutState.elements || [], A = e.layoutState.layout.width, a = e.layoutState.layout.height, n = A === 1 || a === 1 ? { width: 1, height: 1 } : this.getDynamicTextureResolution(),
|
|
10941
|
+
const t = e.layoutState.elements || [], A = e.layoutState.layout.width, a = e.layoutState.layout.height, n = A === 1 || a === 1 ? { width: 1, height: 1 } : this.getDynamicTextureResolution(), i = n.width, s = n.height;
|
|
10942
10942
|
let o, r;
|
|
10943
10943
|
if (this.nonPOTSupport) {
|
|
10944
|
-
const d =
|
|
10945
|
-
A / a < d ? (o =
|
|
10944
|
+
const d = i / s;
|
|
10945
|
+
A / a < d ? (o = i, r = a * (i / A)) : (o = A * (s / a), r = s);
|
|
10946
10946
|
const w = this.resizeFit({ width: o, height: r });
|
|
10947
10947
|
o = w.width, r = w.height;
|
|
10948
10948
|
} else
|
|
@@ -10964,7 +10964,7 @@ class rs extends BA {
|
|
|
10964
10964
|
l.resize(o, r), await l.render(), this.onRender();
|
|
10965
10965
|
}
|
|
10966
10966
|
}
|
|
10967
|
-
const
|
|
10967
|
+
const Ds = (g, e) => {
|
|
10968
10968
|
const t = [];
|
|
10969
10969
|
return g.forEach((A) => {
|
|
10970
10970
|
const a = e.steps.find((n) => n.stepName === A.stepName);
|
|
@@ -10975,15 +10975,15 @@ const Di = (g, e) => {
|
|
|
10975
10975
|
}
|
|
10976
10976
|
});
|
|
10977
10977
|
}), t;
|
|
10978
|
-
},
|
|
10978
|
+
}, Is = async (g, e, t, A) => {
|
|
10979
10979
|
let a = {
|
|
10980
10980
|
serializableWorkflow: { steps: [] },
|
|
10981
10981
|
layouts: {}
|
|
10982
10982
|
};
|
|
10983
10983
|
a = new U(t.map((o) => new Aa(o))).apply(a);
|
|
10984
|
-
const
|
|
10985
|
-
return new U(
|
|
10986
|
-
},
|
|
10984
|
+
const i = await ni(g, e, t, A);
|
|
10985
|
+
return new U(i).apply(a);
|
|
10986
|
+
}, ci = f`
|
|
10987
10987
|
${le}
|
|
10988
10988
|
fragment ProductFields on Product {
|
|
10989
10989
|
id
|
|
@@ -11028,7 +11028,7 @@ const Di = (g, e) => {
|
|
|
11028
11028
|
}
|
|
11029
11029
|
}
|
|
11030
11030
|
`, PA = f`
|
|
11031
|
-
${
|
|
11031
|
+
${ci}
|
|
11032
11032
|
fragment ProductCollectionProductFields on ProductCollectionProduct {
|
|
11033
11033
|
id
|
|
11034
11034
|
productId
|
|
@@ -11082,7 +11082,7 @@ const Di = (g, e) => {
|
|
|
11082
11082
|
}
|
|
11083
11083
|
}
|
|
11084
11084
|
}
|
|
11085
|
-
`,
|
|
11085
|
+
`, gi = (g) => f`
|
|
11086
11086
|
${pt(g)}
|
|
11087
11087
|
query GetBundle($id: String!) {
|
|
11088
11088
|
bundles(ids: [$id]) {
|
|
@@ -11104,7 +11104,7 @@ const Di = (g, e) => {
|
|
|
11104
11104
|
}
|
|
11105
11105
|
}
|
|
11106
11106
|
}
|
|
11107
|
-
`,
|
|
11107
|
+
`, li = f`
|
|
11108
11108
|
query GetBundleStakeholders($id: String!) {
|
|
11109
11109
|
bundles(ids: [$id]) {
|
|
11110
11110
|
id
|
|
@@ -11124,7 +11124,7 @@ const Di = (g, e) => {
|
|
|
11124
11124
|
}
|
|
11125
11125
|
}
|
|
11126
11126
|
}
|
|
11127
|
-
`,
|
|
11127
|
+
`, Bi = f`
|
|
11128
11128
|
query GetBundlesForCustomer($id: String!) {
|
|
11129
11129
|
customers(ids: [$id]) {
|
|
11130
11130
|
bundleStakeholders {
|
|
@@ -11145,7 +11145,7 @@ const Di = (g, e) => {
|
|
|
11145
11145
|
}
|
|
11146
11146
|
}
|
|
11147
11147
|
}
|
|
11148
|
-
`,
|
|
11148
|
+
`, di = f`
|
|
11149
11149
|
${PA}
|
|
11150
11150
|
query GetProductCollectionProducts($id: String!, $productIds: [String!]) {
|
|
11151
11151
|
productCollections(ids: [$id], productIds: $productIds) {
|
|
@@ -11155,10 +11155,20 @@ const Di = (g, e) => {
|
|
|
11155
11155
|
}
|
|
11156
11156
|
}
|
|
11157
11157
|
}
|
|
11158
|
-
`,
|
|
11158
|
+
`, Ci = (g) => f`
|
|
11159
11159
|
${pt(g)}
|
|
11160
|
-
mutation CreateBundle(
|
|
11161
|
-
|
|
11160
|
+
mutation CreateBundle(
|
|
11161
|
+
$collectionId: String
|
|
11162
|
+
$initialMetadata: [MetadataInput!]
|
|
11163
|
+
$marketplaceThemeInstallId: String
|
|
11164
|
+
$marketplaceThemeInstallConfigurationId: String
|
|
11165
|
+
) {
|
|
11166
|
+
bundleCreate(
|
|
11167
|
+
collectionId: $collectionId
|
|
11168
|
+
metadata: $initialMetadata
|
|
11169
|
+
marketplaceThemeInstallId: $marketplaceThemeInstallId
|
|
11170
|
+
marketplaceThemeInstallConfigurationId: $marketplaceThemeInstallConfigurationId
|
|
11171
|
+
) {
|
|
11162
11172
|
id
|
|
11163
11173
|
bundleOwnerId
|
|
11164
11174
|
metadata {
|
|
@@ -11174,25 +11184,25 @@ const Di = (g, e) => {
|
|
|
11174
11184
|
}
|
|
11175
11185
|
}
|
|
11176
11186
|
}
|
|
11177
|
-
`,
|
|
11187
|
+
`, wi = f`
|
|
11178
11188
|
mutation UpdateBundle($id: String!, $name: String, $metadata: [MetadataInput!], $bundleStateData: String) {
|
|
11179
11189
|
bundleUpdate(id: $id, name: $name, metadata: $metadata, bundleStateData: $bundleStateData) {
|
|
11180
11190
|
id
|
|
11181
11191
|
}
|
|
11182
11192
|
}
|
|
11183
|
-
`,
|
|
11193
|
+
`, Ei = f`
|
|
11184
11194
|
mutation BundleAddTransaction($id: String!, $transactionId: String!) {
|
|
11185
11195
|
bundleAddTransaction(id: $id, transactionId: $transactionId) {
|
|
11186
11196
|
id
|
|
11187
11197
|
}
|
|
11188
11198
|
}
|
|
11189
|
-
`,
|
|
11199
|
+
`, hi = f`
|
|
11190
11200
|
mutation BundleAddTransactions($id: String!, $transactionIds: [String!]!, $transactionOwnerIds: [String!]) {
|
|
11191
11201
|
bundleAddTransactions(id: $id, transactionIds: $transactionIds, transactionOwnerIds: $transactionOwnerIds) {
|
|
11192
11202
|
id
|
|
11193
11203
|
}
|
|
11194
11204
|
}
|
|
11195
|
-
`,
|
|
11205
|
+
`, ui = f`
|
|
11196
11206
|
mutation BundleRemoveTransaction(
|
|
11197
11207
|
$id: String!
|
|
11198
11208
|
$transactionId: String!
|
|
@@ -11207,7 +11217,7 @@ const Di = (g, e) => {
|
|
|
11207
11217
|
id
|
|
11208
11218
|
}
|
|
11209
11219
|
}
|
|
11210
|
-
`,
|
|
11220
|
+
`, Qi = f`
|
|
11211
11221
|
mutation BundleRemoveTransactions(
|
|
11212
11222
|
$id: String!
|
|
11213
11223
|
$transactionIds: [String!]!
|
|
@@ -11222,7 +11232,7 @@ const Di = (g, e) => {
|
|
|
11222
11232
|
id
|
|
11223
11233
|
}
|
|
11224
11234
|
}
|
|
11225
|
-
`,
|
|
11235
|
+
`, mi = f`
|
|
11226
11236
|
mutation BundleAddStakeholder($id: String!, $details: CustomerDetailsInput!, $type: String!) {
|
|
11227
11237
|
bundleAddStakeholder(id: $id, details: $details, type: $type) {
|
|
11228
11238
|
id
|
|
@@ -11242,13 +11252,13 @@ const Di = (g, e) => {
|
|
|
11242
11252
|
}
|
|
11243
11253
|
}
|
|
11244
11254
|
}
|
|
11245
|
-
`,
|
|
11255
|
+
`, pi = f`
|
|
11246
11256
|
mutation BundleAddStakeholder($id: String!, $emailAddress: String!) {
|
|
11247
11257
|
bundleRemoveStakeholder(id: $id, emailAddress: $emailAddress) {
|
|
11248
11258
|
id
|
|
11249
11259
|
}
|
|
11250
11260
|
}
|
|
11251
|
-
`,
|
|
11261
|
+
`, Di = f`
|
|
11252
11262
|
mutation BundleUpdateStakeholders($id: String!, $input: [BundleStakeholderInput!]!) {
|
|
11253
11263
|
bundleUpdateStakeholders(id: $id, input: $input) {
|
|
11254
11264
|
id
|
|
@@ -11268,13 +11278,13 @@ const Di = (g, e) => {
|
|
|
11268
11278
|
}
|
|
11269
11279
|
}
|
|
11270
11280
|
}
|
|
11271
|
-
`,
|
|
11281
|
+
`, Ii = f`
|
|
11272
11282
|
mutation BundleUpdateTransactionOrder($id: String!, $transactionIds: [String!]!) {
|
|
11273
11283
|
bundleUpdateTransactionOrder(id: $id, transactionIds: $transactionIds) {
|
|
11274
11284
|
id
|
|
11275
11285
|
}
|
|
11276
11286
|
}
|
|
11277
|
-
`,
|
|
11287
|
+
`, fi = (g) => f`
|
|
11278
11288
|
${pt(g)}
|
|
11279
11289
|
mutation BundleAssignProductCollection($id: String!, $productCollectionId: String!) {
|
|
11280
11290
|
bundleAssignProductCollection(id: $id, collectionId: $productCollectionId) {
|
|
@@ -11285,7 +11295,7 @@ const Di = (g, e) => {
|
|
|
11285
11295
|
}
|
|
11286
11296
|
}
|
|
11287
11297
|
`;
|
|
11288
|
-
class
|
|
11298
|
+
class Fi {
|
|
11289
11299
|
constructor(e) {
|
|
11290
11300
|
this.handleCache = {}, this.bundle = e;
|
|
11291
11301
|
}
|
|
@@ -11329,7 +11339,7 @@ class Fs {
|
|
|
11329
11339
|
async createHandle(e) {
|
|
11330
11340
|
switch (e.type) {
|
|
11331
11341
|
case $.FileUpload:
|
|
11332
|
-
return new
|
|
11342
|
+
return new yi(this.bundle, e);
|
|
11333
11343
|
case $.ColorOption:
|
|
11334
11344
|
return new bt(
|
|
11335
11345
|
this.bundle,
|
|
@@ -11341,7 +11351,7 @@ class Fs {
|
|
|
11341
11351
|
return (t == null ? void 0 : t.type) === "Color" ? new bt(this.bundle, e, t) : new xA(this.bundle, e, t);
|
|
11342
11352
|
}
|
|
11343
11353
|
case $.Text:
|
|
11344
|
-
return new
|
|
11354
|
+
return new Mi(this.bundle, e);
|
|
11345
11355
|
default:
|
|
11346
11356
|
throw new Error("Unhandled Global Property Aspect Type");
|
|
11347
11357
|
}
|
|
@@ -11388,11 +11398,11 @@ class Dt {
|
|
|
11388
11398
|
getSharedSteps(e) {
|
|
11389
11399
|
return (e ?? this.bundle.getWorkflowExperiences()).flatMap(
|
|
11390
11400
|
(a) => a.getStepsConditionallyActive().filter((n) => {
|
|
11391
|
-
var
|
|
11392
|
-
return n.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (
|
|
11393
|
-
(
|
|
11401
|
+
var i;
|
|
11402
|
+
return n.getOverrideGlobalPropertyConfiguration(this.property.type) ? !1 : (i = n.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : i.some(
|
|
11403
|
+
(s) => {
|
|
11394
11404
|
var o, r;
|
|
11395
|
-
return
|
|
11405
|
+
return s.globalPropertyConfigurationId === ((r = (o = this.bundle.getProductCollection()) == null ? void 0 : o.getResource().globalPropertyConfiguration) == null ? void 0 : r.id) && s.aspectName === this.property.name;
|
|
11396
11406
|
}
|
|
11397
11407
|
);
|
|
11398
11408
|
})
|
|
@@ -11402,7 +11412,7 @@ class Dt {
|
|
|
11402
11412
|
return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name);
|
|
11403
11413
|
}
|
|
11404
11414
|
}
|
|
11405
|
-
class
|
|
11415
|
+
class yi extends Dt {
|
|
11406
11416
|
constructor(e, t) {
|
|
11407
11417
|
super(e, t);
|
|
11408
11418
|
}
|
|
@@ -11439,12 +11449,12 @@ class ys extends Dt {
|
|
|
11439
11449
|
const t = await this.getOriginalImage();
|
|
11440
11450
|
if (!t)
|
|
11441
11451
|
throw new Error("You must supply an image selection before attempting to remove the background.");
|
|
11442
|
-
const A = this.bundle.getGlobalPropertyStateManager(), a = await k.removeBackgroundFromAsset(t),
|
|
11452
|
+
const A = this.bundle.getGlobalPropertyStateManager(), a = await k.removeBackgroundFromAsset(t), i = {
|
|
11443
11453
|
...A.getAspectStorage(this.property.name),
|
|
11444
11454
|
backgroundRemovedAssetKey: a.key,
|
|
11445
11455
|
useOriginalAsset: !e
|
|
11446
|
-
}, o = [e ? A.setAspect(this.property.name, a.key,
|
|
11447
|
-
return e && o.push(this.applyImageSelection(a, void 0, !1, !1)), await Promise.all(o), this.updateSharedStepStorage(
|
|
11456
|
+
}, o = [e ? A.setAspect(this.property.name, a.key, i) : A.setAspectStorage(this.property.name, i)];
|
|
11457
|
+
return e && o.push(this.applyImageSelection(a, void 0, !1, !1)), await Promise.all(o), this.updateSharedStepStorage(i), a;
|
|
11448
11458
|
}
|
|
11449
11459
|
/**
|
|
11450
11460
|
* Returns `true` if the state has an image assigned, otherwise `false`.
|
|
@@ -11493,9 +11503,9 @@ class ys extends Dt {
|
|
|
11493
11503
|
const n = {
|
|
11494
11504
|
...a,
|
|
11495
11505
|
useOriginalAsset: e
|
|
11496
|
-
},
|
|
11506
|
+
}, i = e ? a == null ? void 0 : a.originalAssetKey : a == null ? void 0 : a.backgroundRemovedAssetKey, s = [A.setAspect(this.property.name, i || "", n)];
|
|
11497
11507
|
if (e)
|
|
11498
|
-
|
|
11508
|
+
s.push(this.applyImageSelection(t, void 0, !1, !1));
|
|
11499
11509
|
else {
|
|
11500
11510
|
const o = async () => {
|
|
11501
11511
|
const r = await this.getBackgroundRemovedImage();
|
|
@@ -11505,7 +11515,7 @@ class ys extends Dt {
|
|
|
11505
11515
|
);
|
|
11506
11516
|
this.applyImageSelection(r, void 0, !1, !1);
|
|
11507
11517
|
};
|
|
11508
|
-
|
|
11518
|
+
s.push(o());
|
|
11509
11519
|
}
|
|
11510
11520
|
this.updateSharedStepStorage(n);
|
|
11511
11521
|
}
|
|
@@ -11520,30 +11530,30 @@ class ys extends Dt {
|
|
|
11520
11530
|
await this.applyImageSelection(A, e, !1, !0), a ? this.updateSharedStepStorage({ ...a }) : (this.updateSharedStepStorage({ originalAssetKey: t }), await this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name, { originalAssetKey: t }));
|
|
11521
11531
|
}
|
|
11522
11532
|
async applyImageSelection(e, t, A = !0, a = !0) {
|
|
11523
|
-
const
|
|
11524
|
-
const o =
|
|
11533
|
+
const i = this.getSharedSteps(t).map((s) => {
|
|
11534
|
+
const o = s;
|
|
11525
11535
|
if (o.getFrameService())
|
|
11526
11536
|
return o.selectImage(e, A, a);
|
|
11527
11537
|
});
|
|
11528
|
-
await Promise.all(
|
|
11538
|
+
await Promise.all(i);
|
|
11529
11539
|
}
|
|
11530
11540
|
updateSharedStepStorage(e) {
|
|
11531
11541
|
this.bundle.getWorkflowExperiences().forEach(
|
|
11532
11542
|
(A) => A.getSteps().forEach((a) => {
|
|
11533
|
-
var
|
|
11543
|
+
var i;
|
|
11534
11544
|
if (a.getOverrideGlobalPropertyConfiguration(this.property.type))
|
|
11535
11545
|
return;
|
|
11536
|
-
((
|
|
11537
|
-
(
|
|
11546
|
+
((i = a.getRaw().globalPropertyAspectConfigurations) == null ? void 0 : i.some(
|
|
11547
|
+
(s) => {
|
|
11538
11548
|
var o, r;
|
|
11539
|
-
return
|
|
11549
|
+
return s.globalPropertyConfigurationId === ((r = (o = this.bundle.getProductCollection()) == null ? void 0 : o.getResource().globalPropertyConfiguration) == null ? void 0 : r.id) && s.aspectName === this.property.name;
|
|
11540
11550
|
}
|
|
11541
11551
|
)) && A.getWorkflowManager().updateStorage(a.getId(), { framePatternData: e });
|
|
11542
11552
|
})
|
|
11543
11553
|
);
|
|
11544
11554
|
}
|
|
11545
11555
|
}
|
|
11546
|
-
class
|
|
11556
|
+
class Mi extends Dt {
|
|
11547
11557
|
constructor(e, t) {
|
|
11548
11558
|
super(e, t);
|
|
11549
11559
|
}
|
|
@@ -11594,8 +11604,8 @@ class xA extends Dt {
|
|
|
11594
11604
|
} else {
|
|
11595
11605
|
const a = (t = this.optionResource.variants) == null ? void 0 : t.find(
|
|
11596
11606
|
(n) => {
|
|
11597
|
-
var
|
|
11598
|
-
return n.id === ((
|
|
11607
|
+
var i, s;
|
|
11608
|
+
return n.id === ((s = (i = this.optionResource) == null ? void 0 : i.defaultVariant) == null ? void 0 : s.id);
|
|
11599
11609
|
}
|
|
11600
11610
|
);
|
|
11601
11611
|
return a ? new Z(a) : void 0;
|
|
@@ -11630,7 +11640,7 @@ class xA extends Dt {
|
|
|
11630
11640
|
const t = this.getStateValue();
|
|
11631
11641
|
if (!t)
|
|
11632
11642
|
return Promise.resolve();
|
|
11633
|
-
const A = (n = (a = this.optionResource) == null ? void 0 : a.variants) == null ? void 0 : n.find((
|
|
11643
|
+
const A = (n = (a = this.optionResource) == null ? void 0 : a.variants) == null ? void 0 : n.find((i) => i.id === t);
|
|
11634
11644
|
return A ? this.applyVariantSelection(new Z(A), e) : Promise.resolve();
|
|
11635
11645
|
}
|
|
11636
11646
|
async applyVariantSelection(e, t) {
|
|
@@ -11653,15 +11663,15 @@ class bt extends xA {
|
|
|
11653
11663
|
]);
|
|
11654
11664
|
}
|
|
11655
11665
|
async applyGlobalState(e) {
|
|
11656
|
-
var n,
|
|
11666
|
+
var n, i, s;
|
|
11657
11667
|
const t = this.getStateValue();
|
|
11658
11668
|
if (!t)
|
|
11659
11669
|
return Promise.resolve();
|
|
11660
|
-
const A = (
|
|
11670
|
+
const A = (i = (n = this.optionResource) == null ? void 0 : n.variants) == null ? void 0 : i.find((o) => o.id === t);
|
|
11661
11671
|
if (!A)
|
|
11662
11672
|
return Promise.resolve();
|
|
11663
11673
|
await this.applyColorVariant(new Z(A), e);
|
|
11664
|
-
const a = (
|
|
11674
|
+
const a = (s = this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)) == null ? void 0 : s.customColor;
|
|
11665
11675
|
a && this.setCustomColor(a);
|
|
11666
11676
|
}
|
|
11667
11677
|
async applyColorVariant(e, t) {
|
|
@@ -11709,7 +11719,7 @@ const It = f`
|
|
|
11709
11719
|
}
|
|
11710
11720
|
}
|
|
11711
11721
|
}
|
|
11712
|
-
`,
|
|
11722
|
+
`, Si = f`
|
|
11713
11723
|
${It}
|
|
11714
11724
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
11715
11725
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
@@ -11719,7 +11729,7 @@ const It = f`
|
|
|
11719
11729
|
}
|
|
11720
11730
|
}
|
|
11721
11731
|
}
|
|
11722
|
-
`,
|
|
11732
|
+
`, Yi = f`
|
|
11723
11733
|
${It}
|
|
11724
11734
|
mutation UpdateGlobalPropertyState($id: String!, $aspects: [GlobalPropertyStateAspectInput]!) {
|
|
11725
11735
|
globalPropertyStateUpdate(id: $id, aspects: $aspects) {
|
|
@@ -11729,7 +11739,7 @@ const It = f`
|
|
|
11729
11739
|
}
|
|
11730
11740
|
}
|
|
11731
11741
|
}
|
|
11732
|
-
`,
|
|
11742
|
+
`, Pi = f`
|
|
11733
11743
|
${It}
|
|
11734
11744
|
query GetGlobalPropertyState($bundleId: String!) {
|
|
11735
11745
|
globalPropertyState(bundleId: $bundleId) {
|
|
@@ -11740,10 +11750,10 @@ const It = f`
|
|
|
11740
11750
|
}
|
|
11741
11751
|
}
|
|
11742
11752
|
`;
|
|
11743
|
-
class
|
|
11753
|
+
class xi {
|
|
11744
11754
|
constructor(e, t, A, a, n) {
|
|
11745
|
-
this.bundleId = e, this.bundleOwnerId = t, this.configuration = A, this.bundleOptions = n, this.initPromise = this.getOrCreateGlobalPropertyState().then((
|
|
11746
|
-
this.globalPropertyState =
|
|
11755
|
+
this.bundleId = e, this.bundleOwnerId = t, this.configuration = A, this.bundleOptions = n, this.initPromise = this.getOrCreateGlobalPropertyState().then((i) => {
|
|
11756
|
+
this.globalPropertyState = i;
|
|
11747
11757
|
}), this.onGlobalPropertyStateChange = a;
|
|
11748
11758
|
}
|
|
11749
11759
|
setBundleOptions(e) {
|
|
@@ -11779,11 +11789,11 @@ class xs {
|
|
|
11779
11789
|
throw new Error("Global property state not initialized");
|
|
11780
11790
|
if (!this.configuration)
|
|
11781
11791
|
throw new Error("Global property configuration not linked to the state manager.");
|
|
11782
|
-
const a = this.configuration.aspects.find((
|
|
11792
|
+
const a = this.configuration.aspects.find((s) => s.name === e);
|
|
11783
11793
|
if (!a)
|
|
11784
11794
|
throw new Error(`Failed to find configuration aspect with name: ${e}`);
|
|
11785
|
-
const n = he(this.globalPropertyState),
|
|
11786
|
-
|
|
11795
|
+
const n = he(this.globalPropertyState), i = this.globalPropertyState.aspects.find((s) => s.name === e);
|
|
11796
|
+
i ? (i.value = t, A !== void 0 && (i.type = a.type, i.storage = A !== null ? A : void 0)) : this.globalPropertyState.aspects.push({
|
|
11787
11797
|
name: e,
|
|
11788
11798
|
value: t,
|
|
11789
11799
|
...A === void 0 ? {} : { storage: A !== null ? A : void 0, type: a.type }
|
|
@@ -11794,10 +11804,10 @@ class xs {
|
|
|
11794
11804
|
throw new Error("Global property state not initialized");
|
|
11795
11805
|
if (!this.configuration)
|
|
11796
11806
|
throw new Error("Global property configuration not linked to the state manager.");
|
|
11797
|
-
const A = this.configuration.aspects.find((
|
|
11807
|
+
const A = this.configuration.aspects.find((i) => i.name === e);
|
|
11798
11808
|
if (!A)
|
|
11799
11809
|
throw new Error(`Failed to find configuration aspect with name: ${e}`);
|
|
11800
|
-
const a = he(this.globalPropertyState), n = this.globalPropertyState.aspects.find((
|
|
11810
|
+
const a = he(this.globalPropertyState), n = this.globalPropertyState.aspects.find((i) => i.name === e);
|
|
11801
11811
|
n ? (n.storage = t !== null ? t : void 0, n.type = A.type) : this.globalPropertyState.aspects.push({
|
|
11802
11812
|
name: e,
|
|
11803
11813
|
value: "",
|
|
@@ -11810,7 +11820,7 @@ class xs {
|
|
|
11810
11820
|
if (!this.globalPropertyState)
|
|
11811
11821
|
throw new Error("Global property state not initialized");
|
|
11812
11822
|
const e = await x.getShadowGraphqlClient().mutate({
|
|
11813
|
-
mutation:
|
|
11823
|
+
mutation: Yi,
|
|
11814
11824
|
variables: {
|
|
11815
11825
|
id: this.globalPropertyState.id,
|
|
11816
11826
|
aspects: this.globalPropertyState.aspects.map((a) => {
|
|
@@ -11850,7 +11860,7 @@ class xs {
|
|
|
11850
11860
|
async getOrCreateGlobalPropertyState() {
|
|
11851
11861
|
var A, a, n;
|
|
11852
11862
|
const e = await x.getShadowGraphqlClient().query({
|
|
11853
|
-
query:
|
|
11863
|
+
query: Pi,
|
|
11854
11864
|
errorPolicy: "all",
|
|
11855
11865
|
fetchPolicy: "no-cache",
|
|
11856
11866
|
variables: {
|
|
@@ -11866,7 +11876,7 @@ class xs {
|
|
|
11866
11876
|
if (e.data.globalPropertyState && e.data.globalPropertyState.id)
|
|
11867
11877
|
return e.data.globalPropertyState;
|
|
11868
11878
|
const t = await x.getShadowGraphqlClient().mutate({
|
|
11869
|
-
mutation:
|
|
11879
|
+
mutation: Si,
|
|
11870
11880
|
variables: {
|
|
11871
11881
|
bundleId: this.bundleId
|
|
11872
11882
|
},
|
|
@@ -11882,7 +11892,7 @@ class xs {
|
|
|
11882
11892
|
throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`);
|
|
11883
11893
|
}
|
|
11884
11894
|
}
|
|
11885
|
-
class
|
|
11895
|
+
class Ni {
|
|
11886
11896
|
constructor(e) {
|
|
11887
11897
|
this.setState(e);
|
|
11888
11898
|
}
|
|
@@ -11890,11 +11900,11 @@ class Ns {
|
|
|
11890
11900
|
e && (this.state = JSON.parse(e));
|
|
11891
11901
|
}
|
|
11892
11902
|
applyStateToWorkflowExperience(e) {
|
|
11893
|
-
var
|
|
11894
|
-
if (!this.state || !((
|
|
11903
|
+
var i;
|
|
11904
|
+
if (!this.state || !((i = e == null ? void 0 : e.getWorkflowManager()) != null && i.getModelContainer()))
|
|
11895
11905
|
return;
|
|
11896
11906
|
const t = this.state.transactions.find(
|
|
11897
|
-
(
|
|
11907
|
+
(s) => s.transactionId === e.getWorkflowManager().getTransaction().id
|
|
11898
11908
|
);
|
|
11899
11909
|
if (!t)
|
|
11900
11910
|
return;
|
|
@@ -11915,7 +11925,7 @@ class Ns {
|
|
|
11915
11925
|
this.state ? this.state.transactions || (this.state.transactions = []) : this.state = {
|
|
11916
11926
|
transactions: []
|
|
11917
11927
|
};
|
|
11918
|
-
const n = this.state.transactions.find((
|
|
11928
|
+
const n = this.state.transactions.find((i) => i.transactionId === a);
|
|
11919
11929
|
n ? (n.transforms || (n.transforms = {}), n.transforms[t] = A) : this.state.transactions.push({
|
|
11920
11930
|
transactionId: a,
|
|
11921
11931
|
activeTransform: t,
|
|
@@ -11929,11 +11939,11 @@ class Ns {
|
|
|
11929
11939
|
const A = e.getWorkflowManager().getTransaction().id, a = this.state.transactions.find((c) => c.transactionId === A), n = (r = a == null ? void 0 : a.transforms) == null ? void 0 : r[t];
|
|
11930
11940
|
if (!n)
|
|
11931
11941
|
return;
|
|
11932
|
-
const
|
|
11942
|
+
const i = this.flipTransform(
|
|
11933
11943
|
n,
|
|
11934
11944
|
e.getWorkflowManager().getPreviewService()
|
|
11935
|
-
),
|
|
11936
|
-
|
|
11945
|
+
), s = e.getWorkflowManager().getModelContainer();
|
|
11946
|
+
s.position = i.position, s.rotation = i.rotation, s.scale = i.scale, a.activeTransform = t;
|
|
11937
11947
|
}
|
|
11938
11948
|
removeStateForTransaction(e) {
|
|
11939
11949
|
if (!this.state || !this.state.transactions)
|
|
@@ -11965,7 +11975,7 @@ class Ns {
|
|
|
11965
11975
|
};
|
|
11966
11976
|
}
|
|
11967
11977
|
}
|
|
11968
|
-
class
|
|
11978
|
+
class vi {
|
|
11969
11979
|
constructor(e) {
|
|
11970
11980
|
this.fullFetched = !1, this.collection = e;
|
|
11971
11981
|
}
|
|
@@ -11996,7 +12006,7 @@ class vs {
|
|
|
11996
12006
|
if (this.fullFetched)
|
|
11997
12007
|
return this.collection.productCollectionProducts.map((A) => new Ze(A));
|
|
11998
12008
|
const t = await x.getShadowGraphqlClient().query({
|
|
11999
|
-
query:
|
|
12009
|
+
query: di,
|
|
12000
12010
|
variables: {
|
|
12001
12011
|
id: this.getId(),
|
|
12002
12012
|
productIds: e
|
|
@@ -12008,7 +12018,7 @@ class vs {
|
|
|
12008
12018
|
}
|
|
12009
12019
|
getTransformCollection() {
|
|
12010
12020
|
if (this.collection.transformCollection)
|
|
12011
|
-
return new
|
|
12021
|
+
return new Ri(this.collection.transformCollection);
|
|
12012
12022
|
}
|
|
12013
12023
|
/**
|
|
12014
12024
|
* The raw collection resource. This is generally not needed and should be avoided.
|
|
@@ -12043,8 +12053,8 @@ class Ze {
|
|
|
12043
12053
|
getIntegrationByType(e, t) {
|
|
12044
12054
|
const a = (this.product.integrationProducts || []).find((n) => {
|
|
12045
12055
|
var r, c, B;
|
|
12046
|
-
const
|
|
12047
|
-
return
|
|
12056
|
+
const i = (r = n.integration) == null ? void 0 : r.type, s = ((c = n.integration) == null ? void 0 : c.type) === e, o = t ? ((B = n.integration) == null ? void 0 : B.externalIntegrationId) === t : !0;
|
|
12057
|
+
return i && s && o;
|
|
12048
12058
|
});
|
|
12049
12059
|
if (!a)
|
|
12050
12060
|
throw new Error(
|
|
@@ -12110,7 +12120,7 @@ class Ze {
|
|
|
12110
12120
|
* @returns
|
|
12111
12121
|
*/
|
|
12112
12122
|
getBasePrice(e) {
|
|
12113
|
-
var a, n,
|
|
12123
|
+
var a, n, i, s;
|
|
12114
12124
|
const t = this.product.basePrice || 0;
|
|
12115
12125
|
if (!e)
|
|
12116
12126
|
return t;
|
|
@@ -12129,12 +12139,12 @@ class Ze {
|
|
|
12129
12139
|
var r;
|
|
12130
12140
|
return ((r = o.integration) == null ? void 0 : r.externalIntegrationId) === e.externalId;
|
|
12131
12141
|
}
|
|
12132
|
-
) : A = (
|
|
12142
|
+
) : A = (i = this.product.integrationProducts) == null ? void 0 : i.find(
|
|
12133
12143
|
(o) => {
|
|
12134
12144
|
var r;
|
|
12135
12145
|
return ((r = o.integration) == null ? void 0 : r.type) === e.integrationType;
|
|
12136
12146
|
}
|
|
12137
|
-
), (
|
|
12147
|
+
), (s = A == null ? void 0 : A.additionalIntegrationProduct) != null && s.product ? t + (A.additionalIntegrationProduct.product.basePrice || 0) : t;
|
|
12138
12148
|
}
|
|
12139
12149
|
}
|
|
12140
12150
|
class Oe {
|
|
@@ -12161,7 +12171,7 @@ class Oe {
|
|
|
12161
12171
|
return this.workflow.imageUrl;
|
|
12162
12172
|
}
|
|
12163
12173
|
}
|
|
12164
|
-
class
|
|
12174
|
+
class Ri {
|
|
12165
12175
|
constructor(e) {
|
|
12166
12176
|
this.collection = e;
|
|
12167
12177
|
}
|
|
@@ -12181,10 +12191,10 @@ class Rs {
|
|
|
12181
12191
|
* @returns The transforms in this collection.
|
|
12182
12192
|
*/
|
|
12183
12193
|
getTransforms() {
|
|
12184
|
-
return this.collection.transforms.map((e) => new
|
|
12194
|
+
return this.collection.transforms.map((e) => new Hi(e));
|
|
12185
12195
|
}
|
|
12186
12196
|
}
|
|
12187
|
-
class
|
|
12197
|
+
class Hi {
|
|
12188
12198
|
constructor(e) {
|
|
12189
12199
|
this.transform = e;
|
|
12190
12200
|
}
|
|
@@ -12212,15 +12222,15 @@ class Hs {
|
|
|
12212
12222
|
}
|
|
12213
12223
|
}
|
|
12214
12224
|
class Jt {
|
|
12215
|
-
constructor(e, t, A, a, n,
|
|
12216
|
-
var
|
|
12217
|
-
this.eventListeners = /* @__PURE__ */ new Map(), this.workflowExperiences = [], this.client = e, this.id = t.id, this.name = t.name || "", this.ownerId = n, this.metadata = new Map(((
|
|
12225
|
+
constructor(e, t, A, a, n, i) {
|
|
12226
|
+
var s, o, r;
|
|
12227
|
+
this.eventListeners = /* @__PURE__ */ new Map(), this.workflowExperiences = [], this.client = e, this.id = t.id, this.name = t.name || "", this.ownerId = n, this.metadata = new Map(((s = t.metadata) == null ? void 0 : s.map((c) => [c.key, c.value])) || []), this.productCollection = t.productCollection, this.bundleStateManager = new Ni(t.bundleStateData), this.globalPropertyStateManager = new xi(
|
|
12218
12228
|
this.id,
|
|
12219
12229
|
this.ownerId,
|
|
12220
12230
|
(o = this.productCollection) == null ? void 0 : o.globalPropertyConfiguration,
|
|
12221
12231
|
this.checkConditionalHandlesChanged.bind(this),
|
|
12222
|
-
|
|
12223
|
-
), this.globalPropertyHandleService = new
|
|
12232
|
+
i
|
|
12233
|
+
), this.globalPropertyHandleService = new Fi(this), this.setPreviewService(A), this.initializationPromise = Promise.all([
|
|
12224
12234
|
this.loadExistingWorkflowExperiences(((r = t.transactions) == null ? void 0 : r.map((c) => c.id)) || [], a),
|
|
12225
12235
|
this.globalPropertyStateManager.getInitializationPromise()
|
|
12226
12236
|
]), this.initializationPromise.catch((c) => {
|
|
@@ -12288,7 +12298,7 @@ class Jt {
|
|
|
12288
12298
|
return this.workflowExperiences.map((e) => e.getTotalPriceSubunits()).reduce((e, t) => e + t, 0);
|
|
12289
12299
|
}
|
|
12290
12300
|
getProductCollection() {
|
|
12291
|
-
return this.productCollection ? new
|
|
12301
|
+
return this.productCollection ? new vi(this.productCollection) : void 0;
|
|
12292
12302
|
}
|
|
12293
12303
|
async addWorkflowExperience(e) {
|
|
12294
12304
|
e.setBundle(this), await this.appendWorkflowExperience(e), await this.injectExperienceIntoPreviewService(e), await e.getWorkflowManager().getInitializationPromise();
|
|
@@ -12297,16 +12307,16 @@ class Jt {
|
|
|
12297
12307
|
await A.applyGlobalState([e]);
|
|
12298
12308
|
}
|
|
12299
12309
|
async addWorkflowExperiences(e) {
|
|
12300
|
-
const t = e.map((
|
|
12301
|
-
(
|
|
12310
|
+
const t = e.map((s) => s.getWorkflowManager().getTransaction().id), A = t.map(
|
|
12311
|
+
(s) => this.workflowExperiences.find((o) => o.getWorkflowManager().getTransaction().id === s)
|
|
12302
12312
|
);
|
|
12303
|
-
if (A.some((
|
|
12313
|
+
if (A.some((s) => !!s))
|
|
12304
12314
|
throw new Error(
|
|
12305
|
-
"Unable to add transaction to bundle - Already Exists: " + A.filter((
|
|
12315
|
+
"Unable to add transaction to bundle - Already Exists: " + A.filter((s) => !!s).map((s) => s == null ? void 0 : s.getWorkflowManager().getTransaction().id).join(", ")
|
|
12306
12316
|
);
|
|
12307
|
-
const a = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), n = t.map((
|
|
12317
|
+
const a = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), n = t.map((s) => a.get(s));
|
|
12308
12318
|
await x.getShadowGraphqlClient().mutate({
|
|
12309
|
-
mutation:
|
|
12319
|
+
mutation: hi,
|
|
12310
12320
|
variables: {
|
|
12311
12321
|
id: this.id,
|
|
12312
12322
|
transactionIds: t,
|
|
@@ -12315,37 +12325,37 @@ class Jt {
|
|
|
12315
12325
|
context: {
|
|
12316
12326
|
bundleOwnerId: this.ownerId
|
|
12317
12327
|
}
|
|
12318
|
-
}).catch((
|
|
12319
|
-
console.error(
|
|
12328
|
+
}).catch((s) => {
|
|
12329
|
+
console.error(s);
|
|
12320
12330
|
}), this.workflowExperiences.push(...e);
|
|
12321
|
-
const
|
|
12331
|
+
const i = async () => {
|
|
12322
12332
|
for (const o of e)
|
|
12323
12333
|
o.setBundle(this), await this.injectExperienceIntoPreviewService(o);
|
|
12324
12334
|
await Promise.all(e.map((o) => o.getWorkflowManager().getInitializationPromise()));
|
|
12325
|
-
const
|
|
12326
|
-
for (const o of
|
|
12335
|
+
const s = await this.getGlobalProperties();
|
|
12336
|
+
for (const o of s)
|
|
12327
12337
|
await o.applyGlobalState(e);
|
|
12328
12338
|
};
|
|
12329
|
-
await Promise.all([this.updateTransactionOrder(),
|
|
12339
|
+
await Promise.all([this.updateTransactionOrder(), i()]), this.workflowExperiences.forEach((s) => s.checkForPriceBreakChanges());
|
|
12330
12340
|
}
|
|
12331
12341
|
async appendWorkflowExperience(e, t = !0) {
|
|
12332
12342
|
const A = e.getWorkflowManager().getTransaction().id;
|
|
12333
12343
|
if (this.workflowExperiences.find(
|
|
12334
|
-
(
|
|
12344
|
+
(s) => s.getWorkflowManager().getTransaction().id === A
|
|
12335
12345
|
))
|
|
12336
12346
|
throw new Error("Unable to add transaction to bundle - Already Exists!");
|
|
12337
|
-
const
|
|
12347
|
+
const i = (P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(A);
|
|
12338
12348
|
await x.getShadowGraphqlClient().mutate({
|
|
12339
|
-
mutation:
|
|
12349
|
+
mutation: Ei,
|
|
12340
12350
|
variables: {
|
|
12341
12351
|
id: this.id,
|
|
12342
12352
|
transactionId: A
|
|
12343
12353
|
},
|
|
12344
12354
|
context: {
|
|
12345
12355
|
bundleOwnerId: this.ownerId,
|
|
12346
|
-
transactionOwnerId:
|
|
12356
|
+
transactionOwnerId: i
|
|
12347
12357
|
}
|
|
12348
|
-
}), t && (this.workflowExperiences.push(e), this.workflowExperiences.forEach((
|
|
12358
|
+
}), t && (this.workflowExperiences.push(e), this.workflowExperiences.forEach((s) => s.checkForPriceBreakChanges()));
|
|
12349
12359
|
}
|
|
12350
12360
|
async removeWorkflowExperience(e) {
|
|
12351
12361
|
const t = this.workflowExperiences.indexOf(e);
|
|
@@ -12369,12 +12379,12 @@ class Jt {
|
|
|
12369
12379
|
(n) => n.getWorkflowManager().getTransaction().id === t.id
|
|
12370
12380
|
);
|
|
12371
12381
|
a.setBundle(void 0), this.previewService && a.getWorkflowManager().ejectFromPreviewService(), this.bundleStateManager.removeStateForTransaction(t.id), await x.getShadowGraphqlClient().mutate({
|
|
12372
|
-
mutation:
|
|
12382
|
+
mutation: ui,
|
|
12373
12383
|
variables: {
|
|
12374
12384
|
id: this.id,
|
|
12375
12385
|
transactionId: t.id,
|
|
12376
12386
|
name: this.name,
|
|
12377
|
-
metadata: Array.from(this.metadata.entries()).map(([n,
|
|
12387
|
+
metadata: Array.from(this.metadata.entries()).map(([n, i]) => ({ key: n, value: i })),
|
|
12378
12388
|
bundleStateData: this.bundleStateManager.getSerializedState()
|
|
12379
12389
|
},
|
|
12380
12390
|
context: {
|
|
@@ -12401,7 +12411,7 @@ class Jt {
|
|
|
12401
12411
|
A.forEach((a) => a.setBundle(void 0)), [...this.workflowExperiences, ...A].forEach(
|
|
12402
12412
|
(a) => a.checkForPriceBreakChanges()
|
|
12403
12413
|
), this.previewService && A.forEach((a) => a.getWorkflowManager().ejectFromPreviewService()), e.forEach((a) => this.bundleStateManager.removeStateForTransaction(a.id)), await x.getShadowGraphqlClient().mutate({
|
|
12404
|
-
mutation:
|
|
12414
|
+
mutation: Qi,
|
|
12405
12415
|
variables: {
|
|
12406
12416
|
id: this.id,
|
|
12407
12417
|
transactionIds: e.map((a) => a.id),
|
|
@@ -12462,7 +12472,7 @@ class Jt {
|
|
|
12462
12472
|
async addStakeholder(e, t) {
|
|
12463
12473
|
var n;
|
|
12464
12474
|
const A = await x.getShadowGraphqlClient().mutate({
|
|
12465
|
-
mutation:
|
|
12475
|
+
mutation: mi,
|
|
12466
12476
|
variables: {
|
|
12467
12477
|
id: this.id,
|
|
12468
12478
|
details: e,
|
|
@@ -12480,7 +12490,7 @@ class Jt {
|
|
|
12480
12490
|
async removeStakeholder(e) {
|
|
12481
12491
|
var A;
|
|
12482
12492
|
if (!((A = (await x.getShadowGraphqlClient().mutate({
|
|
12483
|
-
mutation:
|
|
12493
|
+
mutation: pi,
|
|
12484
12494
|
variables: {
|
|
12485
12495
|
id: this.id,
|
|
12486
12496
|
emailAddress: e
|
|
@@ -12494,7 +12504,7 @@ class Jt {
|
|
|
12494
12504
|
async updateStakeholders(e) {
|
|
12495
12505
|
var a;
|
|
12496
12506
|
const t = await x.getShadowGraphqlClient().mutate({
|
|
12497
|
-
mutation:
|
|
12507
|
+
mutation: Di,
|
|
12498
12508
|
variables: {
|
|
12499
12509
|
id: this.id,
|
|
12500
12510
|
input: e
|
|
@@ -12510,7 +12520,7 @@ class Jt {
|
|
|
12510
12520
|
}
|
|
12511
12521
|
async getAllStakeholders() {
|
|
12512
12522
|
const e = await x.getShadowGraphqlClient().query({
|
|
12513
|
-
query:
|
|
12523
|
+
query: li,
|
|
12514
12524
|
errorPolicy: "all",
|
|
12515
12525
|
fetchPolicy: "no-cache",
|
|
12516
12526
|
variables: {
|
|
@@ -12546,10 +12556,10 @@ class Jt {
|
|
|
12546
12556
|
e ?? (() => {
|
|
12547
12557
|
}),
|
|
12548
12558
|
t ? (a, n) => {
|
|
12549
|
-
const
|
|
12550
|
-
(
|
|
12559
|
+
const i = this.workflowExperiences.find(
|
|
12560
|
+
(s) => s.getWorkflowManager().getTransaction().id === n
|
|
12551
12561
|
);
|
|
12552
|
-
return
|
|
12562
|
+
return i ? t(i) : (console.warn(
|
|
12553
12563
|
"SpiffCommerce - Bundle create design - Unable to find experience for transaction: " + n
|
|
12554
12564
|
), Promise.resolve(void 0));
|
|
12555
12565
|
} : void 0
|
|
@@ -12578,7 +12588,7 @@ class Jt {
|
|
|
12578
12588
|
async assignProductCollection(e) {
|
|
12579
12589
|
var A, a;
|
|
12580
12590
|
const t = await x.getShadowGraphqlClient().mutate({
|
|
12581
|
-
mutation:
|
|
12591
|
+
mutation: fi(
|
|
12582
12592
|
((A = this.globalPropertyStateManager.getBundleOptions()) == null ? void 0 : A.eagerFetchProducts) ?? !1
|
|
12583
12593
|
),
|
|
12584
12594
|
variables: {
|
|
@@ -12599,7 +12609,7 @@ class Jt {
|
|
|
12599
12609
|
onModelSelectedEvent(e, t) {
|
|
12600
12610
|
if (e && e.metadata && e.metadata instanceof Map && e.metadata.has("workflowManager")) {
|
|
12601
12611
|
const a = e.metadata.get("workflowManager").getTransaction(), n = this.workflowExperiences.find(
|
|
12602
|
-
(
|
|
12612
|
+
(i) => i.getWorkflowManager().getTransaction().id === a.id
|
|
12603
12613
|
);
|
|
12604
12614
|
n && this.fireEvent(t ? "workflow-experience-hover-enter" : "workflow-experience-hover-exit", {
|
|
12605
12615
|
workflowExperience: n
|
|
@@ -12634,7 +12644,7 @@ class Jt {
|
|
|
12634
12644
|
async updateBundle() {
|
|
12635
12645
|
var t;
|
|
12636
12646
|
if (!((t = (await x.getShadowGraphqlClient().mutate({
|
|
12637
|
-
mutation:
|
|
12647
|
+
mutation: wi,
|
|
12638
12648
|
variables: {
|
|
12639
12649
|
id: this.id,
|
|
12640
12650
|
name: this.name,
|
|
@@ -12649,7 +12659,7 @@ class Jt {
|
|
|
12649
12659
|
}
|
|
12650
12660
|
async updateTransactionOrder() {
|
|
12651
12661
|
await x.getShadowGraphqlClient().mutate({
|
|
12652
|
-
mutation:
|
|
12662
|
+
mutation: Ii,
|
|
12653
12663
|
variables: {
|
|
12654
12664
|
id: this.id,
|
|
12655
12665
|
transactionIds: this.workflowExperiences.map((e) => e.getWorkflowManager().getTransaction().id)
|
|
@@ -12664,16 +12674,16 @@ class Jt {
|
|
|
12664
12674
|
if ((() => {
|
|
12665
12675
|
if (a.length !== n.length)
|
|
12666
12676
|
return !0;
|
|
12667
|
-
for (let
|
|
12668
|
-
if (a[
|
|
12677
|
+
for (let s = 0; s < a.length; s++)
|
|
12678
|
+
if (a[s].getName() !== n[s].getName())
|
|
12669
12679
|
return !0;
|
|
12670
12680
|
return !1;
|
|
12671
12681
|
})()) {
|
|
12672
12682
|
this.fireEvent("conditional-global-properties-changed", {
|
|
12673
12683
|
globalProperties: n
|
|
12674
12684
|
});
|
|
12675
|
-
const
|
|
12676
|
-
await Promise.all(
|
|
12685
|
+
const s = n.filter((o) => !a.includes(o));
|
|
12686
|
+
await Promise.all(s.map((o) => o.applyGlobalState()));
|
|
12677
12687
|
}
|
|
12678
12688
|
}
|
|
12679
12689
|
fireEvent(e, t) {
|
|
@@ -12686,14 +12696,14 @@ class Jt {
|
|
|
12686
12696
|
);
|
|
12687
12697
|
}
|
|
12688
12698
|
}
|
|
12689
|
-
const
|
|
12699
|
+
const Ui = f`
|
|
12690
12700
|
mutation processFlowCreate($processFlowId: String!, $inputs: [String]!) {
|
|
12691
12701
|
processExecutionCreate(processFlowId: $processFlowId, inputs: $inputs) {
|
|
12692
12702
|
id
|
|
12693
12703
|
}
|
|
12694
12704
|
}
|
|
12695
12705
|
`;
|
|
12696
|
-
class
|
|
12706
|
+
class ki {
|
|
12697
12707
|
/**
|
|
12698
12708
|
*
|
|
12699
12709
|
* @param id
|
|
@@ -12704,7 +12714,7 @@ class ks {
|
|
|
12704
12714
|
async execute(e, t, A) {
|
|
12705
12715
|
var B, l, d;
|
|
12706
12716
|
const n = (l = (B = (await x.getShadowGraphqlClient().mutate({
|
|
12707
|
-
mutation:
|
|
12717
|
+
mutation: Ui,
|
|
12708
12718
|
variables: {
|
|
12709
12719
|
processFlowId: e,
|
|
12710
12720
|
inputs: [...t.map((C) => C.getValueForTransmission())]
|
|
@@ -12712,13 +12722,13 @@ class ks {
|
|
|
12712
12722
|
})).data) == null ? void 0 : B.processExecutionCreate) == null ? void 0 : l.id;
|
|
12713
12723
|
if (!n)
|
|
12714
12724
|
throw new Error("Failed to create process execution.");
|
|
12715
|
-
function
|
|
12725
|
+
function i(C) {
|
|
12716
12726
|
return new Promise((w) => {
|
|
12717
12727
|
setTimeout(w, C);
|
|
12718
12728
|
});
|
|
12719
12729
|
}
|
|
12720
|
-
let
|
|
12721
|
-
for (; !
|
|
12730
|
+
let s = !1, o = 0, r, c;
|
|
12731
|
+
for (; !s; ) {
|
|
12722
12732
|
r = await x.getShadowGraphqlClient().query({
|
|
12723
12733
|
query: f`
|
|
12724
12734
|
query getProcessFlowExecution($ids: [String]!) {
|
|
@@ -12746,21 +12756,21 @@ class ks {
|
|
|
12746
12756
|
"Execution has failed to complete. See Automation > FLows in Flight on partner account on SpiffCommerce Hub."
|
|
12747
12757
|
);
|
|
12748
12758
|
if (C.completedAt) {
|
|
12749
|
-
|
|
12759
|
+
s = !0, c = new Gi(C);
|
|
12750
12760
|
break;
|
|
12751
12761
|
}
|
|
12752
12762
|
o += 1;
|
|
12753
12763
|
const w = A != null && A.repeats ? A == null ? void 0 : A.repeats : 5;
|
|
12754
12764
|
if (o >= w)
|
|
12755
12765
|
throw new Error("Maximum wait time exceeded for execution result.");
|
|
12756
|
-
await
|
|
12766
|
+
await i(A != null && A.sleepTime ? Math.max(A.sleepTime, 500) : 2e3);
|
|
12757
12767
|
}
|
|
12758
12768
|
if (!c)
|
|
12759
12769
|
throw new Error("Failed to retrieve server response for execution.");
|
|
12760
12770
|
return Promise.resolve(c);
|
|
12761
12771
|
}
|
|
12762
12772
|
}
|
|
12763
|
-
class
|
|
12773
|
+
class Gi {
|
|
12764
12774
|
constructor(e) {
|
|
12765
12775
|
this.execution = e;
|
|
12766
12776
|
}
|
|
@@ -12845,8 +12855,8 @@ class ft {
|
|
|
12845
12855
|
return e.startsWith("[") ? JSON.stringify(JSON.parse(e)) : e;
|
|
12846
12856
|
}
|
|
12847
12857
|
}
|
|
12848
|
-
var
|
|
12849
|
-
class
|
|
12858
|
+
var bi = /* @__PURE__ */ ((g) => (g.Transaction = "Transaction", g.Bundle = "Bundle", g.Product = "Product", g.Variant = "Variant", g.Option = "Option", g.LineItem = "LineItem", g.Asset = "Asset", g))(bi || {});
|
|
12859
|
+
class fs extends ft {
|
|
12850
12860
|
constructor(e) {
|
|
12851
12861
|
super(`"${e}"`);
|
|
12852
12862
|
}
|
|
@@ -12861,7 +12871,7 @@ class NA extends ft {
|
|
|
12861
12871
|
return e.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i);
|
|
12862
12872
|
}
|
|
12863
12873
|
}
|
|
12864
|
-
class
|
|
12874
|
+
class Fs extends ft {
|
|
12865
12875
|
constructor(e) {
|
|
12866
12876
|
super(`[${e.map((t) => t.getRaw()).join(",")}]`);
|
|
12867
12877
|
}
|
|
@@ -12908,7 +12918,7 @@ class Tt {
|
|
|
12908
12918
|
return e.sort((t, A) => (t.index ?? 0) - (A.index ?? 0)).map((t) => new Oe(t));
|
|
12909
12919
|
}
|
|
12910
12920
|
}
|
|
12911
|
-
const
|
|
12921
|
+
const Ji = f`
|
|
12912
12922
|
fragment RegionFields on Region {
|
|
12913
12923
|
width
|
|
12914
12924
|
top
|
|
@@ -12926,7 +12936,7 @@ const Js = f`
|
|
|
12926
12936
|
height
|
|
12927
12937
|
}
|
|
12928
12938
|
}
|
|
12929
|
-
`,
|
|
12939
|
+
`, Ti = f`
|
|
12930
12940
|
fragment LookAtAnimationFields on LookAtAnimation {
|
|
12931
12941
|
latDeg
|
|
12932
12942
|
lonDeg
|
|
@@ -12937,7 +12947,7 @@ const Js = f`
|
|
|
12937
12947
|
z
|
|
12938
12948
|
}
|
|
12939
12949
|
}
|
|
12940
|
-
`,
|
|
12950
|
+
`, Oi = f`
|
|
12941
12951
|
fragment RenderingPipelineConfigurationFields on RenderingPipelineConfiguration {
|
|
12942
12952
|
antiAliasing {
|
|
12943
12953
|
samples
|
|
@@ -13021,21 +13031,21 @@ const Js = f`
|
|
|
13021
13031
|
weight
|
|
13022
13032
|
}
|
|
13023
13033
|
}
|
|
13024
|
-
`,
|
|
13034
|
+
`, Li = f`
|
|
13025
13035
|
fragment ModelAnimationFields on ModelAnimation {
|
|
13026
13036
|
from
|
|
13027
13037
|
to
|
|
13028
13038
|
loop
|
|
13029
13039
|
name
|
|
13030
13040
|
}
|
|
13031
|
-
`,
|
|
13041
|
+
`, zi = (g) => f`
|
|
13032
13042
|
${Ie(g)}
|
|
13033
13043
|
${Ct}
|
|
13034
|
-
${
|
|
13035
|
-
${
|
|
13036
|
-
${
|
|
13037
|
-
${
|
|
13038
|
-
${
|
|
13044
|
+
${sA}
|
|
13045
|
+
${Ji}
|
|
13046
|
+
${Ti}
|
|
13047
|
+
${Oi}
|
|
13048
|
+
${Li}
|
|
13039
13049
|
query GetWorkflows($ids: [String!]!) {
|
|
13040
13050
|
workflows(ids: $ids) {
|
|
13041
13051
|
partner {
|
|
@@ -13424,7 +13434,7 @@ const Js = f`
|
|
|
13424
13434
|
}
|
|
13425
13435
|
}
|
|
13426
13436
|
}
|
|
13427
|
-
`,
|
|
13437
|
+
`, Ki = f`
|
|
13428
13438
|
query GetTransactionForPartner($id: String!) {
|
|
13429
13439
|
transactions(ids: [$id]) {
|
|
13430
13440
|
id
|
|
@@ -13441,7 +13451,7 @@ const Js = f`
|
|
|
13441
13451
|
}
|
|
13442
13452
|
}
|
|
13443
13453
|
}
|
|
13444
|
-
`,
|
|
13454
|
+
`, ji = f`
|
|
13445
13455
|
${Ie(!1)}
|
|
13446
13456
|
query GetWorkflowForTheme($id: String!) {
|
|
13447
13457
|
workflow(id: $id) {
|
|
@@ -13463,7 +13473,7 @@ const Js = f`
|
|
|
13463
13473
|
}
|
|
13464
13474
|
}
|
|
13465
13475
|
}
|
|
13466
|
-
`,
|
|
13476
|
+
`, Vi = f`
|
|
13467
13477
|
query GetCustomer($emailAddress: String!) {
|
|
13468
13478
|
customer(emailAddress: $emailAddress) {
|
|
13469
13479
|
id
|
|
@@ -13473,7 +13483,7 @@ const Js = f`
|
|
|
13473
13483
|
}
|
|
13474
13484
|
}
|
|
13475
13485
|
}
|
|
13476
|
-
`,
|
|
13486
|
+
`, Wi = f`
|
|
13477
13487
|
mutation CustomerCreate($details: CustomerDetailsInput!) {
|
|
13478
13488
|
customerCreate(details: $details) {
|
|
13479
13489
|
id
|
|
@@ -13483,7 +13493,7 @@ const Js = f`
|
|
|
13483
13493
|
}
|
|
13484
13494
|
}
|
|
13485
13495
|
}
|
|
13486
|
-
`,
|
|
13496
|
+
`, Xi = f`
|
|
13487
13497
|
mutation CustomerAuthenticate($loginToken: String!) {
|
|
13488
13498
|
customerAuthenticate(loginToken: $loginToken) {
|
|
13489
13499
|
id
|
|
@@ -13510,11 +13520,11 @@ const Js = f`
|
|
|
13510
13520
|
}
|
|
13511
13521
|
}
|
|
13512
13522
|
}
|
|
13513
|
-
`,
|
|
13523
|
+
`, qi = f`
|
|
13514
13524
|
mutation CustomerGenerateVerificationCode($emailAddress: String!) {
|
|
13515
13525
|
customerGenerateVerificationCode(emailAddress: $emailAddress)
|
|
13516
13526
|
}
|
|
13517
|
-
`,
|
|
13527
|
+
`, Zi = f`
|
|
13518
13528
|
mutation CustomerVerifyCode($emailAddress: String!, $verificationCode: String!) {
|
|
13519
13529
|
customerVerifyCode(emailAddress: $emailAddress, verificationCode: $verificationCode) {
|
|
13520
13530
|
id
|
|
@@ -13542,13 +13552,13 @@ const Js = f`
|
|
|
13542
13552
|
}
|
|
13543
13553
|
}
|
|
13544
13554
|
}
|
|
13545
|
-
`, $
|
|
13555
|
+
`, $i = f`
|
|
13546
13556
|
fragment TagFields on Tag {
|
|
13547
13557
|
id
|
|
13548
13558
|
name
|
|
13549
13559
|
}
|
|
13550
|
-
`,
|
|
13551
|
-
${$
|
|
13560
|
+
`, _i = f`
|
|
13561
|
+
${$i}
|
|
13552
13562
|
query GetManyTags($entityIds: [String!]!) {
|
|
13553
13563
|
tagsMany(entityIds: $entityIds) {
|
|
13554
13564
|
...TagFields
|
|
@@ -13561,19 +13571,19 @@ const Js = f`
|
|
|
13561
13571
|
(n) => n.type === G.Illustration
|
|
13562
13572
|
);
|
|
13563
13573
|
for (let n = 0; n < A.length; ++n) {
|
|
13564
|
-
const
|
|
13565
|
-
|
|
13574
|
+
const i = A[n];
|
|
13575
|
+
i.src && i.svg && (i.cachedObjectURL = await Re(i.svg));
|
|
13566
13576
|
}
|
|
13567
13577
|
const a = g.layouts[t].elements.filter((n) => n.type === G.Textbox);
|
|
13568
13578
|
for (let n = 0; n < a.length; ++n) {
|
|
13569
|
-
const
|
|
13570
|
-
(e =
|
|
13579
|
+
const i = a[n];
|
|
13580
|
+
(e = i.fontData) != null && e.assetUrl && await gt(i.fontData.assetUrl);
|
|
13571
13581
|
}
|
|
13572
13582
|
}
|
|
13573
|
-
},
|
|
13583
|
+
}, es = async (g, e) => {
|
|
13574
13584
|
var a;
|
|
13575
13585
|
const t = await x.getShadowGraphqlClient().query({
|
|
13576
|
-
query:
|
|
13586
|
+
query: zi(((a = e == null ? void 0 : e.assets) == null ? void 0 : a.metadata) || !1),
|
|
13577
13587
|
errorPolicy: "all",
|
|
13578
13588
|
fetchPolicy: "no-cache",
|
|
13579
13589
|
variables: {
|
|
@@ -13583,27 +13593,27 @@ const Js = f`
|
|
|
13583
13593
|
if (A === void 0 || A.length !== g.length)
|
|
13584
13594
|
throw new Error(`Unable to read workflows: ${t.errors ?? "Length mismatch in response"}`);
|
|
13585
13595
|
return A.forEach((n) => {
|
|
13586
|
-
n.steps.forEach((
|
|
13587
|
-
var
|
|
13588
|
-
delete
|
|
13596
|
+
n.steps.forEach((i) => {
|
|
13597
|
+
var s, o, r;
|
|
13598
|
+
delete i.data.__typename, (s = i.option) != null && s.id && ((o = i.option.defaultVariant) != null && o.asset && k.cacheAsset(i.option.defaultVariant.asset), i.option.colorProfile && k.cacheAsset(i.option.colorProfile), (r = i.option.variants) == null || r.forEach((c) => {
|
|
13589
13599
|
c.asset && k.cacheAsset(c.asset), c.thumbnail && k.cacheAsset(c.thumbnail), c.material && k.cacheMaterial(c.material);
|
|
13590
|
-
}), Qe.set({ id:
|
|
13600
|
+
}), Qe.set({ id: i.option.id }, Promise.resolve(i.option)));
|
|
13591
13601
|
}), n.finalizeStepConfig || (n.finalizeStepConfig = {}), n.finalizeStepConfig.termsMarkdown = n.partner.termsMarkdown;
|
|
13592
13602
|
}), A;
|
|
13593
|
-
},
|
|
13603
|
+
}, ts = async (g, e) => {
|
|
13594
13604
|
const A = (await e).find((a) => a.id === g);
|
|
13595
13605
|
if (!A)
|
|
13596
13606
|
throw new Error(`Workflow not found: ${g}`);
|
|
13597
13607
|
return A;
|
|
13598
13608
|
}, vA = async (g, e) => {
|
|
13599
|
-
const t = g.map((
|
|
13609
|
+
const t = g.map((s) => Qe.get({ id: s, options: e })), A = g.filter((s, o) => t[o] === void 0);
|
|
13600
13610
|
if (A.length === 0)
|
|
13601
13611
|
return Promise.all(t);
|
|
13602
|
-
const a =
|
|
13603
|
-
(
|
|
13604
|
-
),
|
|
13605
|
-
return await Promise.all(
|
|
13606
|
-
}, xe = async (g, e) => (await vA([g], e))[0],
|
|
13612
|
+
const a = es(A, e), n = A.map(
|
|
13613
|
+
(s) => Qe.set({ id: s, options: e }, ts(s, a))
|
|
13614
|
+
), i = t.filter((s) => s !== void 0);
|
|
13615
|
+
return await Promise.all(i.concat(n));
|
|
13616
|
+
}, xe = async (g, e) => (await vA([g], e))[0], As = (g) => g.sort((e, t) => e.index - t.index).map((e) => ({
|
|
13607
13617
|
id: J(),
|
|
13608
13618
|
panelId: e.name,
|
|
13609
13619
|
name: e.name,
|
|
@@ -13618,9 +13628,9 @@ const Js = f`
|
|
|
13618
13628
|
editableArea: e.editableArea
|
|
13619
13629
|
})), $e = (g, e) => {
|
|
13620
13630
|
const t = g.workflowState, A = t ? JSON.parse(t) : void 0;
|
|
13621
|
-
return A ? Object.values(A.layouts).map((a) => a.layout) :
|
|
13631
|
+
return A ? Object.values(A.layouts).map((a) => a.layout) : As(e.panels);
|
|
13622
13632
|
};
|
|
13623
|
-
class
|
|
13633
|
+
class as {
|
|
13624
13634
|
constructor(e) {
|
|
13625
13635
|
this.activeIntegration = void 0, this.updateTransactionState = async (t) => {
|
|
13626
13636
|
try {
|
|
@@ -13631,7 +13641,7 @@ class ai {
|
|
|
13631
13641
|
} catch (A) {
|
|
13632
13642
|
throw console.error(A), new H("Critical - Unable to synchronize workflow state with server.");
|
|
13633
13643
|
}
|
|
13634
|
-
}, this.initialized = !1, this.options = e, this.options.applicationKey && ca(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.7.
|
|
13644
|
+
}, this.initialized = !1, this.options = e, this.options.applicationKey && ca(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.7.5"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
13635
13645
|
}
|
|
13636
13646
|
/** @deprecated Use `configure` instead */
|
|
13637
13647
|
configureUrls(e, t, A) {
|
|
@@ -13655,7 +13665,7 @@ class ai {
|
|
|
13655
13665
|
getFlowService() {
|
|
13656
13666
|
if (!ga())
|
|
13657
13667
|
throw new Error("Application key required to use Flow Service.");
|
|
13658
|
-
return new
|
|
13668
|
+
return new ki();
|
|
13659
13669
|
}
|
|
13660
13670
|
async getIntegration() {
|
|
13661
13671
|
if (this.activeIntegration)
|
|
@@ -13690,7 +13700,7 @@ class ai {
|
|
|
13690
13700
|
return Promise.resolve({ success: !0, stakeholderType: be.Owner });
|
|
13691
13701
|
const A = P.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
13692
13702
|
if (A.has(e)) {
|
|
13693
|
-
const
|
|
13703
|
+
const i = A.get(e), o = (P.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map()).get(i);
|
|
13694
13704
|
if (o && await this.authenticateCustomerId(o)) {
|
|
13695
13705
|
const c = (n = (a = this.customer) == null ? void 0 : a.bundleStakeholders) == null ? void 0 : n.find(
|
|
13696
13706
|
(B) => {
|
|
@@ -13720,7 +13730,7 @@ class ai {
|
|
|
13720
13730
|
async authenticateTransactionFromLocalStorage(e) {
|
|
13721
13731
|
var c, B, l, d, C, w;
|
|
13722
13732
|
const t = x.getShadowGraphqlClient(), A = await t.query({
|
|
13723
|
-
query:
|
|
13733
|
+
query: Ki,
|
|
13724
13734
|
errorPolicy: "all",
|
|
13725
13735
|
fetchPolicy: "no-cache",
|
|
13726
13736
|
variables: {
|
|
@@ -13734,12 +13744,12 @@ class ai {
|
|
|
13734
13744
|
throw new Error(`Unable to read transaction: ${e}`);
|
|
13735
13745
|
if (a.isOrdered)
|
|
13736
13746
|
return Promise.resolve({ success: !1, transactionReadOnly: !0 });
|
|
13737
|
-
const
|
|
13738
|
-
if (
|
|
13747
|
+
const i = P.getMap("transactionOwnerIds");
|
|
13748
|
+
if (i != null && i.has(e))
|
|
13739
13749
|
return Promise.resolve({ success: !0, stakeholderType: be.Owner });
|
|
13740
|
-
const
|
|
13741
|
-
if (
|
|
13742
|
-
const E =
|
|
13750
|
+
const s = P.getMap("transactionCustomerIds");
|
|
13751
|
+
if (s != null && s.has(e)) {
|
|
13752
|
+
const E = s.get(e);
|
|
13743
13753
|
if (E && await this.authenticateCustomerId(E)) {
|
|
13744
13754
|
const h = ((d = (l = this.customer) == null ? void 0 : l.bundleStakeholders) == null ? void 0 : d.find(
|
|
13745
13755
|
(D) => {
|
|
@@ -13760,7 +13770,7 @@ class ai {
|
|
|
13760
13770
|
}
|
|
13761
13771
|
}
|
|
13762
13772
|
const r = (await t.query({
|
|
13763
|
-
query:
|
|
13773
|
+
query: ji,
|
|
13764
13774
|
errorPolicy: "all",
|
|
13765
13775
|
variables: {
|
|
13766
13776
|
id: a.workflowId
|
|
@@ -13785,18 +13795,18 @@ class ai {
|
|
|
13785
13795
|
var A, a;
|
|
13786
13796
|
const t = (a = (A = this.customer) == null ? void 0 : A.stakeholders) == null ? void 0 : a.find(
|
|
13787
13797
|
(n) => {
|
|
13788
|
-
var
|
|
13789
|
-
return ((
|
|
13798
|
+
var i;
|
|
13799
|
+
return ((i = n.transaction) == null ? void 0 : i.id) === e;
|
|
13790
13800
|
}
|
|
13791
13801
|
);
|
|
13792
13802
|
if (t)
|
|
13793
13803
|
return t.type;
|
|
13794
13804
|
}
|
|
13795
13805
|
async getOrCreateCustomer(e) {
|
|
13796
|
-
var
|
|
13806
|
+
var i;
|
|
13797
13807
|
this.customer = void 0;
|
|
13798
13808
|
const t = x.getShadowGraphqlClient(), a = (await t.query({
|
|
13799
|
-
query:
|
|
13809
|
+
query: Vi,
|
|
13800
13810
|
errorPolicy: "all",
|
|
13801
13811
|
fetchPolicy: "no-cache",
|
|
13802
13812
|
variables: {
|
|
@@ -13804,8 +13814,8 @@ class ai {
|
|
|
13804
13814
|
}
|
|
13805
13815
|
})).data.customer;
|
|
13806
13816
|
if (!a.id) {
|
|
13807
|
-
const o = (
|
|
13808
|
-
mutation:
|
|
13817
|
+
const o = (i = (await t.mutate({
|
|
13818
|
+
mutation: Wi,
|
|
13809
13819
|
errorPolicy: "all",
|
|
13810
13820
|
fetchPolicy: "no-cache",
|
|
13811
13821
|
variables: {
|
|
@@ -13813,7 +13823,7 @@ class ai {
|
|
|
13813
13823
|
emailAddress: e
|
|
13814
13824
|
}
|
|
13815
13825
|
}
|
|
13816
|
-
})).data) == null ? void 0 :
|
|
13826
|
+
})).data) == null ? void 0 : i.customerCreate;
|
|
13817
13827
|
if (!o)
|
|
13818
13828
|
throw new Error("Unable to create customer.");
|
|
13819
13829
|
return this.storeCustomer(o), this.customer = o, {
|
|
@@ -13829,22 +13839,22 @@ class ai {
|
|
|
13829
13839
|
};
|
|
13830
13840
|
}
|
|
13831
13841
|
async authenticateCustomerId(e) {
|
|
13832
|
-
var
|
|
13842
|
+
var s;
|
|
13833
13843
|
const t = x.getShadowGraphqlClient(), A = P.getMap("customerTokens");
|
|
13834
13844
|
if (!(A != null && A.has(e)))
|
|
13835
13845
|
return !1;
|
|
13836
13846
|
const a = A.get(e);
|
|
13837
13847
|
if (!a)
|
|
13838
13848
|
return !1;
|
|
13839
|
-
const
|
|
13840
|
-
mutation:
|
|
13849
|
+
const i = (s = (await t.mutate({
|
|
13850
|
+
mutation: Xi,
|
|
13841
13851
|
errorPolicy: "all",
|
|
13842
13852
|
fetchPolicy: "no-cache",
|
|
13843
13853
|
variables: {
|
|
13844
13854
|
loginToken: a
|
|
13845
13855
|
}
|
|
13846
|
-
})).data) == null ? void 0 :
|
|
13847
|
-
return
|
|
13856
|
+
})).data) == null ? void 0 : s.customerAuthenticate;
|
|
13857
|
+
return i ? (this.storeCustomer(i), Nt(a), this.customer = i, !0) : !1;
|
|
13848
13858
|
}
|
|
13849
13859
|
/**
|
|
13850
13860
|
* Generates a verification code for the given email address.
|
|
@@ -13852,7 +13862,7 @@ class ai {
|
|
|
13852
13862
|
*/
|
|
13853
13863
|
async generateVerificationCode(e) {
|
|
13854
13864
|
await x.getShadowGraphqlClient().mutate({
|
|
13855
|
-
mutation:
|
|
13865
|
+
mutation: qi,
|
|
13856
13866
|
variables: {
|
|
13857
13867
|
emailAddress: e
|
|
13858
13868
|
}
|
|
@@ -13865,9 +13875,9 @@ class ai {
|
|
|
13865
13875
|
* @returns True if the verification was successful, false otherwise.
|
|
13866
13876
|
*/
|
|
13867
13877
|
async verifyCode(e, t) {
|
|
13868
|
-
var n,
|
|
13878
|
+
var n, i;
|
|
13869
13879
|
const a = (n = (await x.getShadowGraphqlClient().mutate({
|
|
13870
|
-
mutation:
|
|
13880
|
+
mutation: Zi,
|
|
13871
13881
|
errorPolicy: "all",
|
|
13872
13882
|
fetchPolicy: "no-cache",
|
|
13873
13883
|
variables: {
|
|
@@ -13876,10 +13886,10 @@ class ai {
|
|
|
13876
13886
|
}
|
|
13877
13887
|
})).data) == null ? void 0 : n.customerVerifyCode;
|
|
13878
13888
|
if (a != null && a.loginToken) {
|
|
13879
|
-
if (!((
|
|
13889
|
+
if (!((i = a.partner) != null && i.id))
|
|
13880
13890
|
throw new Error(`Unable to find customer: ${e}`);
|
|
13881
|
-
const
|
|
13882
|
-
return
|
|
13891
|
+
const s = P.getMap("customerTokens") || /* @__PURE__ */ new Map();
|
|
13892
|
+
return s.set(a.id, a.loginToken), P.setMap("customerTokens", s), this.storeCustomer(a), Nt(a.loginToken), this.customer = {
|
|
13883
13893
|
...a,
|
|
13884
13894
|
loginToken: void 0
|
|
13885
13895
|
}, !0;
|
|
@@ -13893,19 +13903,21 @@ class ai {
|
|
|
13893
13903
|
async getNewBundle(e, t, A) {
|
|
13894
13904
|
var r, c, B, l, d;
|
|
13895
13905
|
const n = (B = (await x.getShadowGraphqlClient().mutate({
|
|
13896
|
-
mutation:
|
|
13906
|
+
mutation: Ci(((c = (r = A == null ? void 0 : A.graphql) == null ? void 0 : r.productCollection) == null ? void 0 : c.eagerFetchProducts) || !1),
|
|
13897
13907
|
variables: {
|
|
13898
13908
|
collectionId: e,
|
|
13899
|
-
initialMetadata: t ? Object.entries(t).map((C, w) => ({ key: C[0], value: C[1] })) : void 0
|
|
13909
|
+
initialMetadata: t ? Object.entries(t).map((C, w) => ({ key: C[0], value: C[1] })) : void 0,
|
|
13910
|
+
marketplaceThemeInstallId: this.marketplaceThemeInstallId,
|
|
13911
|
+
marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
|
|
13900
13912
|
},
|
|
13901
13913
|
fetchPolicy: "no-cache"
|
|
13902
13914
|
})).data) == null ? void 0 : B.bundleCreate;
|
|
13903
13915
|
if (!(n != null && n.id))
|
|
13904
13916
|
throw new Error("Unable to create bundle");
|
|
13905
|
-
const
|
|
13906
|
-
|
|
13907
|
-
const
|
|
13908
|
-
|
|
13917
|
+
const i = P.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
13918
|
+
i.set(n.id, n.partner.id), P.setMap("bundlePartnerIds", i);
|
|
13919
|
+
const s = P.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
|
|
13920
|
+
s.set(n.id, n.bundleOwnerId), P.setMap("bundleOwnerIds", s);
|
|
13909
13921
|
const o = new Jt(this, n, void 0, void 0, n.bundleOwnerId, {
|
|
13910
13922
|
eagerFetchProducts: (d = (l = A == null ? void 0 : A.graphql) == null ? void 0 : l.productCollection) == null ? void 0 : d.eagerFetchProducts
|
|
13911
13923
|
});
|
|
@@ -13920,14 +13932,14 @@ class ai {
|
|
|
13920
13932
|
*/
|
|
13921
13933
|
async getExistingBundle(e, t, A, a) {
|
|
13922
13934
|
var E, u, h, D, m, p, Q, I, F, M, Y;
|
|
13923
|
-
const n = P.getMap("bundleOwnerIds"),
|
|
13935
|
+
const n = P.getMap("bundleOwnerIds"), i = n == null ? void 0 : n.get(e), o = ((E = Object.entries(localStorage).find(([N, S]) => N.startsWith("CognitoIdentityServiceProvider") && N.endsWith("idToken"))) == null ? void 0 : E[0]) || "", r = localStorage.getItem(o), c = {};
|
|
13924
13936
|
r && !mt(r) && (c.Authorization = `Bearer ${r}`);
|
|
13925
13937
|
const B = {
|
|
13926
|
-
bundleOwnerId:
|
|
13938
|
+
bundleOwnerId: i,
|
|
13927
13939
|
...c,
|
|
13928
13940
|
...(u = a == null ? void 0 : a.graphql) == null ? void 0 : u.additionalHeaders
|
|
13929
13941
|
}, l = await x.getShadowGraphqlClient().query({
|
|
13930
|
-
query:
|
|
13942
|
+
query: gi(((D = (h = a == null ? void 0 : a.graphql) == null ? void 0 : h.productCollection) == null ? void 0 : D.eagerFetchProducts) || !1),
|
|
13931
13943
|
variables: {
|
|
13932
13944
|
id: e
|
|
13933
13945
|
},
|
|
@@ -13940,7 +13952,7 @@ class ai {
|
|
|
13940
13952
|
throw new Error(`Unable to find bundle: ${e}`);
|
|
13941
13953
|
const d = (I = l.data) == null ? void 0 : I.bundles[0], C = P.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
13942
13954
|
C.set(d.id, d.partner.id), P.setMap("bundlePartnerIds", C);
|
|
13943
|
-
const w = new Jt(this, d, t, A,
|
|
13955
|
+
const w = new Jt(this, d, t, A, i, {
|
|
13944
13956
|
additionalHeaders: (F = a == null ? void 0 : a.graphql) == null ? void 0 : F.additionalHeaders,
|
|
13945
13957
|
eagerFetchProducts: (Y = (M = a == null ? void 0 : a.graphql) == null ? void 0 : M.productCollection) == null ? void 0 : Y.eagerFetchProducts
|
|
13946
13958
|
});
|
|
@@ -13955,7 +13967,7 @@ class ai {
|
|
|
13955
13967
|
if (!this.customer)
|
|
13956
13968
|
throw new Error("Customer not authenticated.");
|
|
13957
13969
|
const e = await x.getShadowGraphqlClient().query({
|
|
13958
|
-
query:
|
|
13970
|
+
query: Bi,
|
|
13959
13971
|
variables: {
|
|
13960
13972
|
id: this.customer.id
|
|
13961
13973
|
},
|
|
@@ -13964,24 +13976,24 @@ class ai {
|
|
|
13964
13976
|
if (!((n = e.data) != null && n.customers) || e.data.customers.length === 0)
|
|
13965
13977
|
throw new Error("Unable to find customer.");
|
|
13966
13978
|
const A = e.data.customers[0].bundleStakeholders || [], a = P.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
13967
|
-
return A.forEach((
|
|
13968
|
-
var
|
|
13969
|
-
(
|
|
13979
|
+
return A.forEach((i) => {
|
|
13980
|
+
var s, o;
|
|
13981
|
+
(s = i.bundle) != null && s.id && ((o = i.bundle.partner) != null && o.id) && a.set(i.bundle.id, i.bundle.partner.id);
|
|
13970
13982
|
}), P.setMap("bundlePartnerIds", a), A;
|
|
13971
13983
|
}
|
|
13972
13984
|
async getStepTags(e) {
|
|
13973
13985
|
const t = x.getShadowGraphqlClient();
|
|
13974
13986
|
let A = {};
|
|
13975
|
-
const a = e.steps.map((
|
|
13976
|
-
query:
|
|
13987
|
+
const a = e.steps.map((i) => `${e.id}_${i.stepName}`), n = await t.query({
|
|
13988
|
+
query: _i,
|
|
13977
13989
|
fetchPolicy: "no-cache",
|
|
13978
13990
|
variables: { entityIds: a }
|
|
13979
13991
|
});
|
|
13980
|
-
for (const [
|
|
13981
|
-
const o = n.data.tagsMany[
|
|
13992
|
+
for (const [i, s] of e.steps.entries()) {
|
|
13993
|
+
const o = n.data.tagsMany[i];
|
|
13982
13994
|
A = {
|
|
13983
13995
|
...A,
|
|
13984
|
-
[
|
|
13996
|
+
[s.stepName]: o.map((r) => r.name)
|
|
13985
13997
|
};
|
|
13986
13998
|
}
|
|
13987
13999
|
return A;
|
|
@@ -14052,29 +14064,29 @@ class ai {
|
|
|
14052
14064
|
return { transaction: I, workflow: F, stepTags: M };
|
|
14053
14065
|
}
|
|
14054
14066
|
throw new H("No workflow ID provided.");
|
|
14055
|
-
}, { transaction:
|
|
14056
|
-
this.currencyCode = (l =
|
|
14067
|
+
}, { transaction: i, workflow: s, stepTags: o, readOnly: r } = await n();
|
|
14068
|
+
this.currencyCode = (l = i.product.partner) == null ? void 0 : l.currencyCode;
|
|
14057
14069
|
const c = {
|
|
14058
|
-
product:
|
|
14059
|
-
transaction:
|
|
14070
|
+
product: i.product,
|
|
14071
|
+
transaction: i,
|
|
14060
14072
|
stepTags: o,
|
|
14061
14073
|
layouts: [],
|
|
14062
14074
|
singleVariantsRenderable: (d = a == null ? void 0 : a.workflowConfiguration) == null ? void 0 : d.singleVariantsRenderable,
|
|
14063
14075
|
stateMutationFunc: r ? async () => {
|
|
14064
14076
|
throw new b("State mutation is forbidden in read only mode!");
|
|
14065
14077
|
} : async (u) => {
|
|
14066
|
-
const D = (P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(
|
|
14078
|
+
const D = (P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(i.id) || void 0;
|
|
14067
14079
|
return this.updateTransactionState({ ...u, context: { transactionOwnerId: D } });
|
|
14068
14080
|
},
|
|
14069
14081
|
readOnly: r,
|
|
14070
|
-
workflow:
|
|
14082
|
+
workflow: s
|
|
14071
14083
|
};
|
|
14072
|
-
if (a.type === "transaction" &&
|
|
14073
|
-
const u = JSON.parse(
|
|
14074
|
-
c.layouts = Object.values(u.layouts).map((h) => h.layout), await
|
|
14084
|
+
if (a.type === "transaction" && i.workflowState) {
|
|
14085
|
+
const u = JSON.parse(i.workflowState);
|
|
14086
|
+
c.layouts = Object.values(u.layouts).map((h) => h.layout), await se(u), await re(u), c.reloadedState = u;
|
|
14075
14087
|
} else if (!r && a.workflowState) {
|
|
14076
14088
|
const u = JSON.parse(a.workflowState);
|
|
14077
|
-
c.layouts = Object.values(u.layouts).map((h) => h.layout), await
|
|
14089
|
+
c.layouts = Object.values(u.layouts).map((h) => h.layout), await se(u), await re(u), c.reloadedState = u;
|
|
14078
14090
|
} else
|
|
14079
14091
|
c.layouts = $e(
|
|
14080
14092
|
c.transaction,
|
|
@@ -14085,12 +14097,12 @@ class ai {
|
|
|
14085
14097
|
), a.previewService ? (c.previewService = a.previewService, (C = c.product) != null && C.modelUrl && (c.modelContainer = c.previewService.loadModel({
|
|
14086
14098
|
model: c.product.modelUrl,
|
|
14087
14099
|
contextService: c.renderableContextService
|
|
14088
|
-
}))) : (c.previewService = A && A(
|
|
14100
|
+
}))) : (c.previewService = A && A(s), (w = c.product) != null && w.modelUrl && (c.modelContainer = (E = c.previewService) == null ? void 0 : E.loadModel({
|
|
14089
14101
|
model: c.product.modelUrl,
|
|
14090
14102
|
contextService: c.renderableContextService
|
|
14091
14103
|
}))), a.type !== "transaction") {
|
|
14092
14104
|
const u = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map();
|
|
14093
|
-
u.set(
|
|
14105
|
+
u.set(i.id, i.transactionOwnerId), P.setMap("transactionOwnerIds", u);
|
|
14094
14106
|
} else
|
|
14095
14107
|
c.isReloadedTransaction = !0;
|
|
14096
14108
|
this.initialized = !0, this.experienceOptions = c;
|
|
@@ -14163,9 +14175,9 @@ class ai {
|
|
|
14163
14175
|
readOnly: !1,
|
|
14164
14176
|
index: p[S].index
|
|
14165
14177
|
}));
|
|
14166
|
-
},
|
|
14178
|
+
}, i = e.map((p, Q) => ({ option: p, index: Q })), s = i.filter((p) => p.option.type === "transaction"), o = i.filter(
|
|
14167
14179
|
(p) => p.option.type === "integration" || p.option.type === "external"
|
|
14168
|
-
), r = Pt(
|
|
14180
|
+
), r = Pt(s, 10), c = Pt(o, 10), B = (await Promise.all([
|
|
14169
14181
|
...r.map(a),
|
|
14170
14182
|
...c.map(n)
|
|
14171
14183
|
])).flat(), l = [...new Set(B.map((p) => p.workflowId))], d = await vA(l, t), C = new Map(d.map((p) => [p.id, p])), w = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), E = B.map(async (p) => {
|
|
@@ -14187,10 +14199,10 @@ class ai {
|
|
|
14187
14199
|
};
|
|
14188
14200
|
if (S.type === "transaction" && Q.workflowState) {
|
|
14189
14201
|
const O = JSON.parse(Q.workflowState);
|
|
14190
|
-
R.layouts = Object.values(O.layouts || {}).map((ee) => ee.layout), await
|
|
14202
|
+
R.layouts = Object.values(O.layouts || {}).map((ee) => ee.layout), await se(O), await re(O), R.reloadedState = O;
|
|
14191
14203
|
} else if (!F && S.workflowState) {
|
|
14192
14204
|
const O = JSON.parse(S.workflowState);
|
|
14193
|
-
R.layouts = Object.values(O.layouts || {}).map((ee) => ee.layout), await
|
|
14205
|
+
R.layouts = Object.values(O.layouts || {}).map((ee) => ee.layout), await se(O), await re(O), R.reloadedState = O;
|
|
14194
14206
|
} else
|
|
14195
14207
|
R.layouts = $e(
|
|
14196
14208
|
R.transaction,
|
|
@@ -14213,7 +14225,7 @@ class ai {
|
|
|
14213
14225
|
* @deprecated Use getWorkflowExperience to initialize the experience.
|
|
14214
14226
|
*/
|
|
14215
14227
|
async initFromIntegrationProduct(e) {
|
|
14216
|
-
var
|
|
14228
|
+
var i;
|
|
14217
14229
|
if (e === "")
|
|
14218
14230
|
throw new H("No integration product ID provided.");
|
|
14219
14231
|
const A = await x.getShadowGraphqlClient().mutate({
|
|
@@ -14234,14 +14246,14 @@ class ai {
|
|
|
14234
14246
|
const a = A.data.transactionCreate;
|
|
14235
14247
|
if (!a.product)
|
|
14236
14248
|
throw new H("Failed to create transaction, product not available.");
|
|
14237
|
-
this.currencyCode = (
|
|
14249
|
+
this.currencyCode = (i = a.product.partner) == null ? void 0 : i.currencyCode;
|
|
14238
14250
|
const n = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map();
|
|
14239
14251
|
n.set(a.id, a.transactionOwnerId), P.setMap("transactionOwnerIds", n), this.experienceOptions = {
|
|
14240
14252
|
product: a.product,
|
|
14241
14253
|
transaction: a,
|
|
14242
14254
|
layouts: [],
|
|
14243
|
-
stateMutationFunc: async (
|
|
14244
|
-
...
|
|
14255
|
+
stateMutationFunc: async (s) => this.updateTransactionState({
|
|
14256
|
+
...s,
|
|
14245
14257
|
context: { transactionOwnerId: a.transactionOwnerId }
|
|
14246
14258
|
})
|
|
14247
14259
|
}, this.initialized = !0;
|
|
@@ -14253,7 +14265,7 @@ class ai {
|
|
|
14253
14265
|
* @deprecated Use getWorkflowExperience to initialize the experience.
|
|
14254
14266
|
*/
|
|
14255
14267
|
async initFromTransaction(e, t = !1) {
|
|
14256
|
-
var
|
|
14268
|
+
var s, o, r, c;
|
|
14257
14269
|
if (e === "")
|
|
14258
14270
|
throw new H("No transaction ID provided.");
|
|
14259
14271
|
const A = x.getShadowGraphqlClient(), a = async () => {
|
|
@@ -14280,15 +14292,15 @@ class ai {
|
|
|
14280
14292
|
};
|
|
14281
14293
|
if (t)
|
|
14282
14294
|
return await a();
|
|
14283
|
-
const n = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(),
|
|
14284
|
-
if (
|
|
14285
|
-
const l = (
|
|
14295
|
+
const n = P.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), i = n.get(e);
|
|
14296
|
+
if (i) {
|
|
14297
|
+
const l = (s = (await A.query({
|
|
14286
14298
|
query: Fe,
|
|
14287
14299
|
variables: {
|
|
14288
14300
|
ids: [e]
|
|
14289
14301
|
},
|
|
14290
14302
|
errorPolicy: "all"
|
|
14291
|
-
})).data) == null ? void 0 :
|
|
14303
|
+
})).data) == null ? void 0 : s.transactions[0];
|
|
14292
14304
|
if (!l)
|
|
14293
14305
|
throw new H("Failed to read transaction.");
|
|
14294
14306
|
if (!l.product)
|
|
@@ -14297,7 +14309,7 @@ class ai {
|
|
|
14297
14309
|
product: l.product,
|
|
14298
14310
|
transaction: l,
|
|
14299
14311
|
layouts: [],
|
|
14300
|
-
stateMutationFunc: async (d) => this.updateTransactionState({ ...d, context: { transactionOwnerId:
|
|
14312
|
+
stateMutationFunc: async (d) => this.updateTransactionState({ ...d, context: { transactionOwnerId: i } }),
|
|
14301
14313
|
readOnly: t
|
|
14302
14314
|
}, this.initialized = !0;
|
|
14303
14315
|
return;
|
|
@@ -14330,14 +14342,14 @@ class ai {
|
|
|
14330
14342
|
* @deprecated Remove when the initFrom functions are removed.
|
|
14331
14343
|
*/
|
|
14332
14344
|
async getWorkflowExperienceDeprecated(e, t, A) {
|
|
14333
|
-
var a, n,
|
|
14345
|
+
var a, n, i, s;
|
|
14334
14346
|
if (!this.initialized || !this.experienceOptions)
|
|
14335
14347
|
throw new H("Cannot launch experience: Not initialized.");
|
|
14336
14348
|
if (this.experienceOptions.transaction.workflowId) {
|
|
14337
14349
|
const o = await xe(this.experienceOptions.transaction.workflowId);
|
|
14338
14350
|
if (this.experienceOptions.workflow = o, this.experienceOptions.transaction.workflowState) {
|
|
14339
14351
|
const c = JSON.parse(this.experienceOptions.transaction.workflowState);
|
|
14340
|
-
this.experienceOptions.layouts = Object.values(c.layouts).map((B) => B.layout), await
|
|
14352
|
+
this.experienceOptions.layouts = Object.values(c.layouts).map((B) => B.layout), await se(c), await re(c), this.experienceOptions.reloadedState = c;
|
|
14341
14353
|
}
|
|
14342
14354
|
this.experienceOptions.previewService = A && A(o), this.experienceOptions.renderableContextService = new Ye(this.experienceOptions.layouts), (a = this.experienceOptions.product) != null && a.modelUrl && (this.experienceOptions.modelContainer = (n = this.experienceOptions.previewService) == null ? void 0 : n.loadModel({
|
|
14343
14355
|
model: this.experienceOptions.product.modelUrl,
|
|
@@ -14359,13 +14371,13 @@ class ai {
|
|
|
14359
14371
|
}), B = xe(e);
|
|
14360
14372
|
if (await Promise.all([c, B]), this.experienceOptions.workflow = await B, t) {
|
|
14361
14373
|
const d = JSON.parse(t);
|
|
14362
|
-
this.experienceOptions.layouts = Object.values(d.layouts).map((C) => C.layout), await
|
|
14374
|
+
this.experienceOptions.layouts = Object.values(d.layouts).map((C) => C.layout), await se(d), await re(d), this.experienceOptions.reloadedState = d;
|
|
14363
14375
|
} else
|
|
14364
14376
|
this.experienceOptions.layouts = $e(
|
|
14365
14377
|
this.experienceOptions.transaction,
|
|
14366
14378
|
this.experienceOptions.workflow
|
|
14367
14379
|
);
|
|
14368
|
-
this.experienceOptions.previewService = A && A(await B), this.experienceOptions.renderableContextService = new Ye(this.experienceOptions.layouts), (
|
|
14380
|
+
this.experienceOptions.previewService = A && A(await B), this.experienceOptions.renderableContextService = new Ye(this.experienceOptions.layouts), (i = this.experienceOptions.product) != null && i.modelUrl && (this.experienceOptions.modelContainer = (s = this.experienceOptions.previewService) == null ? void 0 : s.loadModel({
|
|
14369
14381
|
model: this.experienceOptions.product.modelUrl,
|
|
14370
14382
|
contextService: this.experienceOptions.renderableContextService
|
|
14371
14383
|
}));
|
|
@@ -14405,7 +14417,7 @@ class ai {
|
|
|
14405
14417
|
t.set(e.partner.id, e.id), P.setMap("partnerCustomerIds", t);
|
|
14406
14418
|
}
|
|
14407
14419
|
async getIntegrationProductById(e) {
|
|
14408
|
-
var n,
|
|
14420
|
+
var n, i;
|
|
14409
14421
|
const a = (n = (await x.getShadowGraphqlClient().query({
|
|
14410
14422
|
query: Ta,
|
|
14411
14423
|
variables: {
|
|
@@ -14414,13 +14426,13 @@ class ai {
|
|
|
14414
14426
|
fetchPolicy: "no-cache",
|
|
14415
14427
|
errorPolicy: "all"
|
|
14416
14428
|
})).data) == null ? void 0 : n.integrationProducts;
|
|
14417
|
-
if (!a || a.length === 0 || !((
|
|
14429
|
+
if (!a || a.length === 0 || !((i = a[0]) != null && i.id))
|
|
14418
14430
|
throw new Error("Integration product not found.");
|
|
14419
14431
|
return new Tt(a[0]);
|
|
14420
14432
|
}
|
|
14421
14433
|
async getIntegrationProductFromExternalIds(e, t) {
|
|
14422
|
-
var
|
|
14423
|
-
const n = (
|
|
14434
|
+
var i;
|
|
14435
|
+
const n = (i = (await x.getShadowGraphqlClient().query({
|
|
14424
14436
|
query: Oa,
|
|
14425
14437
|
variables: {
|
|
14426
14438
|
externalProductId: t,
|
|
@@ -14428,7 +14440,7 @@ class ai {
|
|
|
14428
14440
|
},
|
|
14429
14441
|
fetchPolicy: "no-cache",
|
|
14430
14442
|
errorPolicy: "all"
|
|
14431
|
-
})).data) == null ? void 0 :
|
|
14443
|
+
})).data) == null ? void 0 : i.integrationProductFromExternalIds;
|
|
14432
14444
|
if (!(n != null && n.id))
|
|
14433
14445
|
throw new Error("Integration product not found.");
|
|
14434
14446
|
return new Tt(n);
|
|
@@ -14453,7 +14465,7 @@ class ai {
|
|
|
14453
14465
|
return a.data.transactions[0].transactionShareActions;
|
|
14454
14466
|
}
|
|
14455
14467
|
}
|
|
14456
|
-
class
|
|
14468
|
+
class ys {
|
|
14457
14469
|
getClient() {
|
|
14458
14470
|
return this.client ?? {};
|
|
14459
14471
|
}
|
|
@@ -14606,8 +14618,8 @@ class yi {
|
|
|
14606
14618
|
return [];
|
|
14607
14619
|
}
|
|
14608
14620
|
}
|
|
14609
|
-
var
|
|
14610
|
-
class
|
|
14621
|
+
var ns = /* @__PURE__ */ ((g) => (g.SelectFrame = "SelectFrame", g.SelectImage = "SelectImage", g.Position = "Position", g))(ns || {});
|
|
14622
|
+
class is extends X {
|
|
14611
14623
|
constructor(e, t, A) {
|
|
14612
14624
|
var a;
|
|
14613
14625
|
super(e, t, A), this.frameService = (a = this.manager.getStepSpecificServices(this.getId())) == null ? void 0 : a.frameService;
|
|
@@ -14781,82 +14793,82 @@ class si extends X {
|
|
|
14781
14793
|
}
|
|
14782
14794
|
export {
|
|
14783
14795
|
wt as AddonHandle,
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14796
|
+
Fs as ArrayInput,
|
|
14797
|
+
Ys as AspectType,
|
|
14798
|
+
ie as AssetNotFoundError,
|
|
14799
|
+
Ps as AssetType,
|
|
14800
|
+
xs as BringForwardCommand,
|
|
14801
|
+
Ns as BringToBackCommand,
|
|
14802
|
+
vs as BringToFrontCommand,
|
|
14803
|
+
Rs as CanvasCommand,
|
|
14792
14804
|
Ze as CollectionProduct,
|
|
14793
14805
|
bt as ColorOptionGlobalPropertyHandle,
|
|
14794
|
-
|
|
14806
|
+
Hs as CommandContext,
|
|
14795
14807
|
va as ConversionDataType,
|
|
14796
14808
|
Na as ConversionLocation,
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14809
|
+
Us as CreateElementCommand,
|
|
14810
|
+
ks as CreateLayoutCommand,
|
|
14811
|
+
Gs as DeleteElementCommand,
|
|
14800
14812
|
Un as DigitalContentStepHandle,
|
|
14801
|
-
|
|
14813
|
+
yi as FileUploadGlobalPropertyHandle,
|
|
14802
14814
|
Pe as FlowExecutionNodeResult,
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14815
|
+
Gi as FlowExecutionResult,
|
|
14816
|
+
ki as FlowService,
|
|
14817
|
+
bs as FontAlignmentCommand,
|
|
14818
|
+
Js as FontColorCommand,
|
|
14819
|
+
Ts as FontSizeCommand,
|
|
14820
|
+
Os as FontSourceCommand,
|
|
14809
14821
|
Xa as FrameService,
|
|
14810
|
-
|
|
14811
|
-
|
|
14822
|
+
ns as FrameStep,
|
|
14823
|
+
is as FrameStepHandle,
|
|
14812
14824
|
Dt as GlobalPropertyHandle,
|
|
14813
|
-
|
|
14825
|
+
Ls as GroupCommand,
|
|
14814
14826
|
Sn as IllustrationStepHandle,
|
|
14815
14827
|
pe as InformationMessageType,
|
|
14816
14828
|
Hn as InformationStepHandle,
|
|
14817
14829
|
Tt as IntegrationProduct,
|
|
14818
14830
|
Pa as IntegrationType,
|
|
14819
|
-
|
|
14820
|
-
|
|
14831
|
+
zs as LayoutElementFactory,
|
|
14832
|
+
Ks as LayoutElementType,
|
|
14821
14833
|
z as LayoutNotFoundError,
|
|
14822
14834
|
Yn as MaterialStepHandle,
|
|
14823
14835
|
Ge as MisconfigurationError,
|
|
14824
|
-
|
|
14836
|
+
ys as MockWorkflowManager,
|
|
14825
14837
|
Pn as ModelStepHandle,
|
|
14826
14838
|
kn as ModuleStepHandle,
|
|
14827
|
-
|
|
14839
|
+
js as MoveCommand,
|
|
14828
14840
|
NA as ObjectInput,
|
|
14829
|
-
|
|
14841
|
+
bi as ObjectInputType,
|
|
14830
14842
|
xA as OptionGlobalPropertyHandle,
|
|
14831
14843
|
ke as OptionNotFoundError,
|
|
14832
14844
|
we as ParseError,
|
|
14833
14845
|
xn as PictureStepHandle,
|
|
14834
14846
|
xa as ProductCameraRig,
|
|
14835
|
-
|
|
14847
|
+
vi as ProductCollection,
|
|
14836
14848
|
Oe as ProductWorkflow,
|
|
14837
14849
|
Qe as PromiseCache,
|
|
14838
14850
|
dA as PromiseQueue,
|
|
14839
14851
|
Nn as QuestionStepHandle,
|
|
14840
14852
|
BA as QueueablePromise,
|
|
14841
|
-
|
|
14853
|
+
Vs as ResizeCommand,
|
|
14842
14854
|
ue as ResourceNotFoundError,
|
|
14843
|
-
|
|
14844
|
-
|
|
14855
|
+
Ws as RotateCommand,
|
|
14856
|
+
Xs as SendBackwardsCommand,
|
|
14845
14857
|
vn as ShapeStepHandle,
|
|
14846
|
-
|
|
14858
|
+
as as SpiffCommerceClient,
|
|
14847
14859
|
be as StakeholderType,
|
|
14848
|
-
|
|
14860
|
+
qs as StepAspectType,
|
|
14849
14861
|
X as StepHandle,
|
|
14850
|
-
|
|
14851
|
-
$
|
|
14852
|
-
|
|
14853
|
-
|
|
14862
|
+
Zs as StepType,
|
|
14863
|
+
$s as TextChangeCommand,
|
|
14864
|
+
Mi as TextGlobalPropertyHandle,
|
|
14865
|
+
fs as TextInput,
|
|
14854
14866
|
Rn as TextStepHandle,
|
|
14855
14867
|
Ya as TransactionShareActionType,
|
|
14856
|
-
|
|
14857
|
-
|
|
14868
|
+
Hi as Transform,
|
|
14869
|
+
Ri as TransformCollection,
|
|
14858
14870
|
b as UnhandledBehaviorError,
|
|
14859
|
-
|
|
14871
|
+
_s as UnitOfMeasurement,
|
|
14860
14872
|
eo as UpdateImageSourceCommand,
|
|
14861
14873
|
Z as Variant,
|
|
14862
14874
|
Vn as WorkflowExperienceEventType,
|
|
@@ -14869,13 +14881,13 @@ export {
|
|
|
14869
14881
|
Ao as determineCorrectFontSizeAndLines,
|
|
14870
14882
|
wA as digitalContentStepService,
|
|
14871
14883
|
ao as findElement,
|
|
14872
|
-
|
|
14884
|
+
ps as findPmsColors,
|
|
14873
14885
|
no as frameDataCache,
|
|
14874
14886
|
Ae as frameStepService,
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14887
|
+
io as generate,
|
|
14888
|
+
ni as generateCommands,
|
|
14889
|
+
so as generateSVGWithUnknownColors,
|
|
14890
|
+
Is as generateStateFromDesignInputSteps,
|
|
14879
14891
|
oo as getAttributesFromArrayBuffer,
|
|
14880
14892
|
ro as getAxisAlignedBoundingBox,
|
|
14881
14893
|
Wa as getBoundedOffsets,
|
|
@@ -14886,7 +14898,7 @@ export {
|
|
|
14886
14898
|
x as graphQlManager,
|
|
14887
14899
|
ve as illustrationStepService,
|
|
14888
14900
|
lo as loadFont,
|
|
14889
|
-
|
|
14901
|
+
ms as matchHexToPms,
|
|
14890
14902
|
EA as materialStepService,
|
|
14891
14903
|
hA as modelStepService,
|
|
14892
14904
|
uA as moduleStepService,
|
|
@@ -14894,7 +14906,7 @@ export {
|
|
|
14894
14906
|
Bo as patternImageDataCache,
|
|
14895
14907
|
P as persistenceService,
|
|
14896
14908
|
QA as pictureStepService,
|
|
14897
|
-
|
|
14909
|
+
Qs as pmsToRgb,
|
|
14898
14910
|
mA as questionStepService,
|
|
14899
14911
|
Co as registerFetchImplementation,
|
|
14900
14912
|
wo as registerWindowImplementation,
|
|
@@ -14905,7 +14917,7 @@ export {
|
|
|
14905
14917
|
Ee as shapeStepService,
|
|
14906
14918
|
qa as shortenUrl,
|
|
14907
14919
|
q as spiffCoreConfiguration,
|
|
14908
|
-
|
|
14920
|
+
Ds as stepAspectValuesToDesignInputSteps,
|
|
14909
14921
|
uo as svgToDataUrl,
|
|
14910
14922
|
j as textStepService,
|
|
14911
14923
|
Bn as toast
|