@spiffcommerce/core 20.0.1-2 → 20.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +182 -179
- package/dist/index.umd.cjs +16 -16
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHttpLink as Et, InMemoryCache as ht, ApolloClient as Ct, from as Qt, gql as F } from "@apollo/client/core";
|
|
2
|
-
import { fetch as $A, getAttributesFromArrayBuffer as ye, AssetType as Be, StepType as D, getFrameData as _A, frameDataCache as ut, GroupCommand as G, UpdateFramePattern as Ye, UpdateFrameThresholdSettingsCommand as mt, calculateOffsets as Ae, LayoutElementType as v, generate as J, CreateElementCommand as L, generateSVGWithUnknownColors as Se, svgObjectURL as
|
|
2
|
+
import { fetch as $A, getAttributesFromArrayBuffer as ye, AssetType as Be, StepType as D, getFrameData as _A, frameDataCache as ut, GroupCommand as G, UpdateFramePattern as Ye, UpdateFrameThresholdSettingsCommand as mt, calculateOffsets as Ae, LayoutElementType as v, generate as J, CreateElementCommand as L, generateSVGWithUnknownColors as Se, svgObjectURL as fA, fetchAsString as Z, DeleteElementCommand as $, generateDefaultRectangleFrameSvg as de, GetSVGDimensions as It, patternImageDataCache as we, fetchAsArrayBuffer as pt, findElement as DA, modifySVGWithElementProperties as ft, IllustrationColorCommand as zA, IllustrationCacheCommand as Dt, getFontMetrics as Ft, getPatternImageData as KA, FontAlignmentCommand as Mt, FontColorCommand as yt, FontImageFillCommand as kA, applyTextTransformations as jA, determineCorrectFontSizeAndLines as mA, FontSourceCommand as Ee, loadFont as ee, TextChangeCommand as Yt, FontSizeCommand as St, createElementNS as xt, createElement as BA, _loadFontExternalDataURL as te, UpdateWorkflowStateCommand as he, CommandContext as Pt, createCanvas as FA, getSvgElement as xe, LayoutRenderingPurpose as Pe, renderPapyrusComponentAsString as Ne, loadImage as He, getDomParser as Re, toBase64 as Ce, getVariant as Nt, generateFrameSVG as Ht, getDefaultVariant as NA, domParser as Ue, sanitizeSvgTree as Ge, traverse as Rt, xmlSerializer as ve, CreateLayoutCommand as Ut, AspectType as IA, rehydrateSerializedLayout as AA } from "@spiffcommerce/papyrus";
|
|
3
3
|
import { AssetType as Oi, BringForwardCommand as zi, BringToBackCommand as Ki, BringToFrontCommand as ji, CanvasCommand as Vi, CommandContext as Wi, CreateElementCommand as Xi, CreateLayoutCommand as qi, DeleteElementCommand as Zi, FontAlignmentCommand as $i, FontColorCommand as _i, FontSizeCommand as As, FontSourceCommand as es, GroupCommand as ts, LayoutElementFactory as ns, LayoutElementType as as, MoveCommand as is, ResizeCommand as ss, RotateCommand as os, SendBackwardsCommand as rs, StepAspectType as cs, StepType as gs, TextChangeCommand as ls, UnitOfMeasurement as Bs, dataUrlFromExternalUrl as ds, determineCorrectFontSizeAndLines as ws, findElement as Es, frameDataCache as hs, generate as Cs, generateSVGWithUnknownColors as Qs, getAttributesFromArrayBuffer as us, getAxisAlignedBoundingBox as ms, getFrameData as Is, getSvgElement as ps, loadFont as fs, patternImageDataCache as Ds, registerFetchImplementation as Fs, registerWindowImplementation as Ms, rehydrateSerializedLayout as ys, setCanvasModule as Ys } from "@spiffcommerce/papyrus";
|
|
4
4
|
import { setContext as Gt } from "@apollo/client/link/context";
|
|
5
5
|
import { onError as vt } from "@apollo/client/link/error";
|
|
@@ -16,32 +16,32 @@ class Te extends Error {
|
|
|
16
16
|
super(A), this.name = this.constructor.name;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
class
|
|
19
|
+
class lA extends Te {
|
|
20
20
|
constructor(A) {
|
|
21
21
|
super(`ConfigurationError - ${A}`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class MA extends lA {
|
|
25
25
|
constructor(A) {
|
|
26
26
|
super(`Option not Configured: ${A.stepTitle}`), this.optionId = (A == null ? void 0 : A.optionId) || "N/A";
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
class z extends
|
|
29
|
+
class z extends lA {
|
|
30
30
|
constructor(A) {
|
|
31
31
|
super(`Panel not Found: ${A.panelId}`), this.panelId = (A == null ? void 0 : A.panelId) || "N/A";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class _ extends lA {
|
|
35
35
|
constructor(A) {
|
|
36
36
|
super(`Asset not found for variant: ${A.name}`), this.variant = A;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
class
|
|
39
|
+
class cA extends lA {
|
|
40
40
|
constructor(A) {
|
|
41
41
|
super(`Resource not found for asset: ${A.name}`), this.asset = A;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
class
|
|
44
|
+
class yA extends lA {
|
|
45
45
|
constructor(A, e) {
|
|
46
46
|
super(`Workflow Misconfiguration: ${A.stepName} - ${e}`), this.step = A;
|
|
47
47
|
}
|
|
@@ -56,7 +56,7 @@ class k extends RA {
|
|
|
56
56
|
super(`Unhandled Behavior Encountered: ${A}`);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
class
|
|
59
|
+
class oA extends RA {
|
|
60
60
|
constructor(A) {
|
|
61
61
|
super(`Parsing Error: ${A}`);
|
|
62
62
|
}
|
|
@@ -147,7 +147,7 @@ class bt {
|
|
|
147
147
|
this.serverUrlCallbacks.push(A);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const q = new bt();
|
|
151
151
|
let Oe;
|
|
152
152
|
const me = (c) => {
|
|
153
153
|
Oe = c;
|
|
@@ -156,7 +156,7 @@ let ae;
|
|
|
156
156
|
const Lt = (c) => {
|
|
157
157
|
ae = c;
|
|
158
158
|
}, Tt = () => ae, Ot = () => new Promise((c) => {
|
|
159
|
-
const A =
|
|
159
|
+
const A = q.getHubUrl(), e = (t) => {
|
|
160
160
|
t.origin === A && (window.removeEventListener("message", e), c(t.data));
|
|
161
161
|
};
|
|
162
162
|
window.parent !== window && (window.addEventListener("message", e, !1), window.parent.postMessage("ready", A));
|
|
@@ -169,7 +169,7 @@ const Lt = (c) => {
|
|
|
169
169
|
};
|
|
170
170
|
class Kt {
|
|
171
171
|
constructor() {
|
|
172
|
-
this.shadowGraphqlClient = this.constructShadowGraphqlClient(),
|
|
172
|
+
this.shadowGraphqlClient = this.constructShadowGraphqlClient(), q.addServerUrlCallback(() => {
|
|
173
173
|
this.shadowGraphqlClient = this.constructShadowGraphqlClient();
|
|
174
174
|
});
|
|
175
175
|
}
|
|
@@ -178,7 +178,7 @@ class Kt {
|
|
|
178
178
|
}
|
|
179
179
|
constructShadowGraphqlClient() {
|
|
180
180
|
const A = Et({
|
|
181
|
-
uri: `${
|
|
181
|
+
uri: `${q.getServerUrl()}/graphql`,
|
|
182
182
|
fetch: $A
|
|
183
183
|
}), e = Gt(async (i, s) => {
|
|
184
184
|
const { headers: o } = s, r = o || {}, g = await zt(), B = s.bearer ?? g.bearer, l = s.partnerId ?? g.partnerId, d = s.activeIntegration ?? g.activeIntegration, w = s.transactionOwnerId, h = s.customerToken ?? g.customerToken, E = s.applicationKey ?? g.applicationKey, Q = s.bundleOwnerId;
|
|
@@ -495,7 +495,7 @@ class $t {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
const
|
|
498
|
+
const iA = "persistentAssets";
|
|
499
499
|
class JA {
|
|
500
500
|
/**
|
|
501
501
|
* Add a new asset to persistence
|
|
@@ -508,27 +508,27 @@ class JA {
|
|
|
508
508
|
}
|
|
509
509
|
const e = /* @__PURE__ */ new Map();
|
|
510
510
|
e.set(A.key || "", A.fileLink);
|
|
511
|
-
const t = x.getMap(
|
|
511
|
+
const t = x.getMap(iA);
|
|
512
512
|
t && t.forEach((n, a) => {
|
|
513
513
|
e.set(a, n);
|
|
514
|
-
}), x.setMap(
|
|
514
|
+
}), x.setMap(iA, e);
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
517
517
|
* Remove an existing asset from persistence. Noop if the asset doesn't exist.
|
|
518
518
|
* @param assetKey The key to remove.
|
|
519
519
|
*/
|
|
520
520
|
static remove(A) {
|
|
521
|
-
const e = x.getMap(
|
|
521
|
+
const e = x.getMap(iA);
|
|
522
522
|
if (!e)
|
|
523
523
|
return;
|
|
524
524
|
const t = Array.from(e.entries()).find((n) => n[0] === A);
|
|
525
|
-
t && (e.delete(t[0]), x.setMap(
|
|
525
|
+
t && (e.delete(t[0]), x.setMap(iA, e));
|
|
526
526
|
}
|
|
527
527
|
/**
|
|
528
528
|
* Get a list of all persisted assets.
|
|
529
529
|
*/
|
|
530
530
|
static list() {
|
|
531
|
-
const A = x.getMap(
|
|
531
|
+
const A = x.getMap(iA);
|
|
532
532
|
return A ? Array.from(A.entries()).map((e) => ({ assetKey: e[0], src: e[1] })) : [];
|
|
533
533
|
}
|
|
534
534
|
}
|
|
@@ -564,7 +564,7 @@ class _t {
|
|
|
564
564
|
this.disabled = A;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
const
|
|
567
|
+
const gA = new _t(), Ke = F`
|
|
568
568
|
fragment OptionFields on Option {
|
|
569
569
|
id
|
|
570
570
|
name
|
|
@@ -629,11 +629,11 @@ const cA = new _t(), Ke = F`
|
|
|
629
629
|
});
|
|
630
630
|
}), A.data.options;
|
|
631
631
|
}, tn = async (c, A) => (await A).find((t) => t.id === c), nn = async (c) => {
|
|
632
|
-
const A = c.map((i) =>
|
|
632
|
+
const A = c.map((i) => gA.get({ id: i })), e = c.filter((i, s) => A[s] === void 0);
|
|
633
633
|
if (e.length === 0)
|
|
634
634
|
return Promise.all(A);
|
|
635
635
|
const t = en(e), n = e.map(
|
|
636
|
-
(i) =>
|
|
636
|
+
(i) => gA.set({ id: i }, tn(i, t))
|
|
637
637
|
), a = A.filter((i) => i !== void 0);
|
|
638
638
|
return await Promise.all(a.concat(n));
|
|
639
639
|
};
|
|
@@ -692,7 +692,7 @@ class an {
|
|
|
692
692
|
}
|
|
693
693
|
const j = new an();
|
|
694
694
|
var sn = /* @__PURE__ */ ((c) => (c.Hub = "Hub", c.Shopify = "Shopify", c))(sn || {}), on = /* @__PURE__ */ ((c) => (c[c.Orbit = 0] = "Orbit", c[c.Pan = 1] = "Pan", c))(on || {}), rn = /* @__PURE__ */ ((c) => (c.Manual = "Manual", c.OnStart = "OnStart", c.OnQuit = "OnQuit", c.OnEnd = "OnEnd", c))(rn || {}), cn = /* @__PURE__ */ ((c) => (c.Email = "Email", c.FirstName = "FirstName", c.LastName = "LastName", c.Phone = "Phone", c))(cn || {}), YA = /* @__PURE__ */ ((c) => (c.Owner = "Owner", c.Approver = "Approver", c.Editor = "Editor", c.Viewer = "Viewer", c))(YA || {});
|
|
695
|
-
const
|
|
695
|
+
const aA = F`
|
|
696
696
|
fragment AdditionalIntegrationProductFields on IntegrationProduct {
|
|
697
697
|
id
|
|
698
698
|
product {
|
|
@@ -710,7 +710,7 @@ const nA = F`
|
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
`, Ie = F`
|
|
713
|
-
${
|
|
713
|
+
${aA}
|
|
714
714
|
mutation CreateTransaction(
|
|
715
715
|
$integrationProductId: String
|
|
716
716
|
$externalIntegrationId: String
|
|
@@ -794,7 +794,7 @@ const nA = F`
|
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
796
|
`, gn = F`
|
|
797
|
-
${
|
|
797
|
+
${aA}
|
|
798
798
|
mutation CreateTransactions($inputs: [TransactionCreateInput]!) {
|
|
799
799
|
transactionCreateMany(inputs: $inputs) {
|
|
800
800
|
id
|
|
@@ -866,7 +866,7 @@ const nA = F`
|
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
`, ln = F`
|
|
869
|
-
${
|
|
869
|
+
${aA}
|
|
870
870
|
mutation ClaimTransaction($id: String!) {
|
|
871
871
|
transactionClaim(id: $id) {
|
|
872
872
|
id
|
|
@@ -937,8 +937,8 @@ const nA = F`
|
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
|
-
`,
|
|
941
|
-
${
|
|
940
|
+
`, dA = F`
|
|
941
|
+
${aA}
|
|
942
942
|
query ReadTransactions($ids: [String]!) {
|
|
943
943
|
transactions(ids: $ids) {
|
|
944
944
|
customLogoLink
|
|
@@ -1091,7 +1091,7 @@ const je = F`
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
`, Ve = F`
|
|
1094
|
-
${
|
|
1094
|
+
${aA}
|
|
1095
1095
|
fragment IntegrationProductFields on IntegrationProduct {
|
|
1096
1096
|
id
|
|
1097
1097
|
externalProductId
|
|
@@ -1149,7 +1149,7 @@ const je = F`
|
|
|
1149
1149
|
...IntegrationProductFields
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
|
-
`,
|
|
1152
|
+
`, sA = [D.SilentIllustration, D.ProductOverlay], hn = async (c) => {
|
|
1153
1153
|
const A = [];
|
|
1154
1154
|
c.introduction && A.push({
|
|
1155
1155
|
name: "Introduction",
|
|
@@ -1172,16 +1172,16 @@ const je = F`
|
|
|
1172
1172
|
A.push({
|
|
1173
1173
|
name: t.stepName,
|
|
1174
1174
|
title: t.stepTitle,
|
|
1175
|
-
renderableSteps:
|
|
1176
|
-
silentSteps:
|
|
1175
|
+
renderableSteps: sA.includes(t.type) ? [] : [t],
|
|
1176
|
+
silentSteps: sA.includes(t.type) ? [t] : []
|
|
1177
1177
|
});
|
|
1178
1178
|
else {
|
|
1179
1179
|
const a = A.find((i) => i.name === n.name);
|
|
1180
|
-
a ?
|
|
1180
|
+
a ? sA.includes(t.type) ? a.silentSteps.push(t) : a.renderableSteps.push(t) : A.push({
|
|
1181
1181
|
name: n.name,
|
|
1182
1182
|
title: n.name,
|
|
1183
|
-
renderableSteps:
|
|
1184
|
-
silentSteps:
|
|
1183
|
+
renderableSteps: sA.includes(t.type) ? [] : [t],
|
|
1184
|
+
silentSteps: sA.includes(t.type) ? [t] : []
|
|
1185
1185
|
});
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
@@ -1204,7 +1204,7 @@ const je = F`
|
|
|
1204
1204
|
],
|
|
1205
1205
|
silentSteps: []
|
|
1206
1206
|
}), A;
|
|
1207
|
-
}, Cn = (c, A) => A.find((e) => e.stepNames.includes(c)),
|
|
1207
|
+
}, Cn = (c, A) => A.find((e) => e.stepNames.includes(c)), nA = (c, A) => (c.conditions || []).every((e) => {
|
|
1208
1208
|
const t = A[e.targetStepName];
|
|
1209
1209
|
if (t && t.selectedVariants) {
|
|
1210
1210
|
const n = t.selectedVariants;
|
|
@@ -1217,13 +1217,13 @@ const je = F`
|
|
|
1217
1217
|
const e = {
|
|
1218
1218
|
name: c.name,
|
|
1219
1219
|
title: c.title,
|
|
1220
|
-
renderableSteps: c.renderableSteps.filter((t) =>
|
|
1221
|
-
silentSteps: c.silentSteps.filter((t) =>
|
|
1220
|
+
renderableSteps: c.renderableSteps.filter((t) => nA(t, A)),
|
|
1221
|
+
silentSteps: c.silentSteps.filter((t) => nA(t, A))
|
|
1222
1222
|
};
|
|
1223
1223
|
return e.silentSteps.length === 0 && e.renderableSteps.length === 0 ? null : e;
|
|
1224
|
-
},
|
|
1224
|
+
}, tA = (c, A) => c.map((e) => Qn(e, A)).filter((e) => e !== null), un = async (c, A, e = !1) => {
|
|
1225
1225
|
var i;
|
|
1226
|
-
const t =
|
|
1226
|
+
const t = tA(c, A), n = [];
|
|
1227
1227
|
for (const s of t)
|
|
1228
1228
|
for (const o of s.renderableSteps) {
|
|
1229
1229
|
const r = (((i = o.option) == null ? void 0 : i.variants) || []).length;
|
|
@@ -1319,12 +1319,12 @@ function mn(c, A, e, t) {
|
|
|
1319
1319
|
const s = c, o = Math.max(A.width / e.width, A.height / e.height);
|
|
1320
1320
|
s.zoom = Math.max(o, c.zoom);
|
|
1321
1321
|
const r = e.width * s.zoom, g = e.height * s.zoom;
|
|
1322
|
-
return s.x =
|
|
1322
|
+
return s.x = wA(c.x, A.width - r, 0), s.y = wA(c.y, A.height - g, 0), s;
|
|
1323
1323
|
}
|
|
1324
1324
|
const i = c;
|
|
1325
|
-
return i.x =
|
|
1325
|
+
return i.x = wA(i.x, -n, A.width), i.y = wA(i.y, -a, A.height), i;
|
|
1326
1326
|
}
|
|
1327
|
-
function
|
|
1327
|
+
function wA(c, A, e) {
|
|
1328
1328
|
return Math.min(Math.max(c, A), e);
|
|
1329
1329
|
}
|
|
1330
1330
|
class In {
|
|
@@ -1523,7 +1523,7 @@ class pe {
|
|
|
1523
1523
|
if (this.configuration.type === D.ProductOverlay) {
|
|
1524
1524
|
let l = "";
|
|
1525
1525
|
if ((o = this.product) != null && o.overlayImageUrl && (l = this.product.overlayImageUrl), i = l, !l)
|
|
1526
|
-
throw new
|
|
1526
|
+
throw new yA(this.configuration, "Couldn't find an asset for product overlay step");
|
|
1527
1527
|
}
|
|
1528
1528
|
const s = this.evaluateAssetType();
|
|
1529
1529
|
if (s === v.Image) {
|
|
@@ -1560,13 +1560,13 @@ class pe {
|
|
|
1560
1560
|
Q("Undefined vector silent step source");
|
|
1561
1561
|
return;
|
|
1562
1562
|
}
|
|
1563
|
-
|
|
1563
|
+
Z(l, !0).then((C) => {
|
|
1564
1564
|
E(C);
|
|
1565
1565
|
}).catch((C) => console.error(C));
|
|
1566
1566
|
}))()), h = {
|
|
1567
1567
|
stepName: this.configuration.stepName,
|
|
1568
1568
|
id: J(),
|
|
1569
|
-
cachedObjectURL: await
|
|
1569
|
+
cachedObjectURL: await fA(w.svg),
|
|
1570
1570
|
src: l,
|
|
1571
1571
|
svg: w.svg,
|
|
1572
1572
|
colors: w.colors,
|
|
@@ -1594,7 +1594,7 @@ class pe {
|
|
|
1594
1594
|
}
|
|
1595
1595
|
async trigger() {
|
|
1596
1596
|
if (!this.configuration.data.regions)
|
|
1597
|
-
throw new
|
|
1597
|
+
throw new yA(this.configuration, "Missing regions.");
|
|
1598
1598
|
if (this.configuration.type === D.SilentIllustration) {
|
|
1599
1599
|
const A = this.configuration.data.regions.map(this.processRegion);
|
|
1600
1600
|
return Promise.all(A);
|
|
@@ -1614,7 +1614,7 @@ class pe {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
1616
|
const pn = async (c) => {
|
|
1617
|
-
const A = `${
|
|
1617
|
+
const A = `${q.getServicesApiUrl()}/shortener`;
|
|
1618
1618
|
try {
|
|
1619
1619
|
return (await (await fetch(A, {
|
|
1620
1620
|
method: "POST",
|
|
@@ -1680,7 +1680,7 @@ class fn {
|
|
|
1680
1680
|
async () => {
|
|
1681
1681
|
const u = await g();
|
|
1682
1682
|
if (!u.link || !u.link)
|
|
1683
|
-
throw new
|
|
1683
|
+
throw new cA(u.asset);
|
|
1684
1684
|
C({
|
|
1685
1685
|
rel: "mpeg4",
|
|
1686
1686
|
href: u.link
|
|
@@ -1693,7 +1693,7 @@ class fn {
|
|
|
1693
1693
|
40
|
|
1694
1694
|
);
|
|
1695
1695
|
});
|
|
1696
|
-
A.forEach((C) => o(new
|
|
1696
|
+
A.forEach((C) => o(new $(C.id)));
|
|
1697
1697
|
const l = i.data.baseUrl.slice(0, 4) === "http" ? "" : "https://", d = new URL(l + i.data.baseUrl);
|
|
1698
1698
|
d.searchParams.append("video", btoa(JSON.stringify([B]))), d.pathname = d.pathname + (d.pathname.slice(-1) === "/" ? "" : "/");
|
|
1699
1699
|
const w = d.toString();
|
|
@@ -1701,7 +1701,7 @@ class fn {
|
|
|
1701
1701
|
throw new UA("Cannot create QR code, URL too long.");
|
|
1702
1702
|
const h = await pn(w);
|
|
1703
1703
|
if (s(h), !i.data || !i.data.regions)
|
|
1704
|
-
throw new
|
|
1704
|
+
throw new yA(i, "Missing regions.");
|
|
1705
1705
|
const E = await this.regionElements(i), Q = await this.command(h, E, a, i.stepName);
|
|
1706
1706
|
Q && (Q.command && a.getCommandDispatcher()(Q.command), Q.followup && await Q.followup()), await a.setSelectionsAndElements(i.stepName, [], E, async () => {
|
|
1707
1707
|
a.updateStorage(i.stepName, {
|
|
@@ -1753,11 +1753,11 @@ class Fn {
|
|
|
1753
1753
|
return de(e);
|
|
1754
1754
|
const t = A.asset;
|
|
1755
1755
|
if (!t)
|
|
1756
|
-
throw new
|
|
1756
|
+
throw new _(A);
|
|
1757
1757
|
const n = t.fileLink;
|
|
1758
1758
|
if (n)
|
|
1759
|
-
return
|
|
1760
|
-
throw new
|
|
1759
|
+
return Z(n, !0);
|
|
1760
|
+
throw new cA(t);
|
|
1761
1761
|
};
|
|
1762
1762
|
}
|
|
1763
1763
|
async init(A, e, t) {
|
|
@@ -1926,7 +1926,7 @@ class Fn {
|
|
|
1926
1926
|
a && a(!0);
|
|
1927
1927
|
const r = await Promise.all(
|
|
1928
1928
|
A.data.regions.map(async (d, w) => {
|
|
1929
|
-
const h = await _A(o[w]), E = s.getImageData(), Q = t.map((p) => new
|
|
1929
|
+
const h = await _A(o[w]), E = s.getImageData(), Q = t.map((p) => new $(p.id)), C = E ? Ae(E, h) : void 0, f = E ? {
|
|
1930
1930
|
id: J(),
|
|
1931
1931
|
src: E.src,
|
|
1932
1932
|
x: (C == null ? void 0 : C.x) || 0,
|
|
@@ -1990,7 +1990,7 @@ class Fn {
|
|
|
1990
1990
|
const t = A.fileLink;
|
|
1991
1991
|
if (t)
|
|
1992
1992
|
return t;
|
|
1993
|
-
throw new
|
|
1993
|
+
throw new cA(A);
|
|
1994
1994
|
}
|
|
1995
1995
|
async loadPatternFromAsset(A, e, t) {
|
|
1996
1996
|
var s;
|
|
@@ -2006,7 +2006,7 @@ const WA = new Fn();
|
|
|
2006
2006
|
class Mn {
|
|
2007
2007
|
async getIllustrationBody(A) {
|
|
2008
2008
|
return new Promise((e) => {
|
|
2009
|
-
|
|
2009
|
+
Z(A, !0).then((t) => {
|
|
2010
2010
|
e(t);
|
|
2011
2011
|
}).catch((t) => console.error(t));
|
|
2012
2012
|
});
|
|
@@ -2039,7 +2039,7 @@ class Mn {
|
|
|
2039
2039
|
if (t.length === 0)
|
|
2040
2040
|
return [];
|
|
2041
2041
|
try {
|
|
2042
|
-
return
|
|
2042
|
+
return DA(
|
|
2043
2043
|
t[0].id,
|
|
2044
2044
|
e.getAllLayoutData()
|
|
2045
2045
|
).colors;
|
|
@@ -2104,7 +2104,7 @@ class Mn {
|
|
|
2104
2104
|
const i = {};
|
|
2105
2105
|
for (const [B, l] of a.entries())
|
|
2106
2106
|
i[B] = { browserValue: l, spotColor: (g = i[B]) == null ? void 0 : g.spotColor };
|
|
2107
|
-
const s = ft(A, e, t, i), o = await
|
|
2107
|
+
const s = ft(A, e, t, i), o = await fA(s), r = [];
|
|
2108
2108
|
for (const B of n) {
|
|
2109
2109
|
for (const [l, d] of a.entries())
|
|
2110
2110
|
r.push(new zA(B, l, d));
|
|
@@ -2116,7 +2116,7 @@ class Mn {
|
|
|
2116
2116
|
var d, w;
|
|
2117
2117
|
if (e.length === 0)
|
|
2118
2118
|
return;
|
|
2119
|
-
const i =
|
|
2119
|
+
const i = DA(
|
|
2120
2120
|
e[0].id,
|
|
2121
2121
|
n().map((h) => h.layoutState)
|
|
2122
2122
|
), s = { ...i.colors }, o = {};
|
|
@@ -2157,17 +2157,17 @@ class Mn {
|
|
|
2157
2157
|
async selectVariantCommand(A, e, t, n, a) {
|
|
2158
2158
|
var Q;
|
|
2159
2159
|
if (!A.data || !A.data.regions)
|
|
2160
|
-
throw new
|
|
2160
|
+
throw new yA(A, "Missing regions.");
|
|
2161
2161
|
n(!0);
|
|
2162
|
-
const i = t.map((C) => new
|
|
2162
|
+
const i = t.map((C) => new $(C.id));
|
|
2163
2163
|
a.setMandatoryFulfilled(A.stepName, !1);
|
|
2164
2164
|
const s = e.asset;
|
|
2165
2165
|
if (!s)
|
|
2166
|
-
throw new
|
|
2166
|
+
throw new _(e);
|
|
2167
2167
|
const o = s.fileLink;
|
|
2168
2168
|
if (!o)
|
|
2169
|
-
throw new
|
|
2170
|
-
const r = await Se(await this.getIllustrationBody(o)), g = await
|
|
2169
|
+
throw new cA(s);
|
|
2170
|
+
const r = await Se(await this.getIllustrationBody(o)), g = await fA(r.svg), B = (C) => {
|
|
2171
2171
|
const f = a.getLayouts().find((m) => m.panelId === C.panelId);
|
|
2172
2172
|
if (!f)
|
|
2173
2173
|
throw new z(C);
|
|
@@ -2215,12 +2215,12 @@ class Mn {
|
|
|
2215
2215
|
};
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
|
-
const
|
|
2218
|
+
const pA = new Mn();
|
|
2219
2219
|
class yn {
|
|
2220
2220
|
async init(A, e, t) {
|
|
2221
2221
|
const n = A.option;
|
|
2222
2222
|
if (!n)
|
|
2223
|
-
throw new
|
|
2223
|
+
throw new MA(A);
|
|
2224
2224
|
if (t)
|
|
2225
2225
|
await this.reload(A, e, t);
|
|
2226
2226
|
else {
|
|
@@ -2238,7 +2238,7 @@ class yn {
|
|
|
2238
2238
|
t.serializableWorkflow.steps
|
|
2239
2239
|
), s = Object.values(t.layouts).map((g) => g.elements).flat().filter((g) => g.stepName === A.stepName), o = A.option;
|
|
2240
2240
|
if (!o)
|
|
2241
|
-
throw new
|
|
2241
|
+
throw new MA(A);
|
|
2242
2242
|
if (n != null && n.selectedVariants) {
|
|
2243
2243
|
const g = n.selectedVariants[0].id;
|
|
2244
2244
|
if (g) {
|
|
@@ -2272,7 +2272,7 @@ class yn {
|
|
|
2272
2272
|
n(!0);
|
|
2273
2273
|
const i = e.material;
|
|
2274
2274
|
if (!i)
|
|
2275
|
-
throw n(!1), new
|
|
2275
|
+
throw n(!1), new _(e);
|
|
2276
2276
|
return {
|
|
2277
2277
|
command: void 0,
|
|
2278
2278
|
followup: async () => {
|
|
@@ -2294,7 +2294,7 @@ class Yn {
|
|
|
2294
2294
|
async init(A, e, t) {
|
|
2295
2295
|
const n = A.option;
|
|
2296
2296
|
if (!n)
|
|
2297
|
-
throw new
|
|
2297
|
+
throw new MA(A);
|
|
2298
2298
|
if (t)
|
|
2299
2299
|
await this.reload(A, e, t);
|
|
2300
2300
|
else {
|
|
@@ -2327,7 +2327,7 @@ class Yn {
|
|
|
2327
2327
|
if (d && A.option) {
|
|
2328
2328
|
const h = (w = B.asset) == null ? void 0 : w.fileLink;
|
|
2329
2329
|
if (!h)
|
|
2330
|
-
throw new
|
|
2330
|
+
throw new _(B);
|
|
2331
2331
|
await d.applyModelVariant(
|
|
2332
2332
|
A.stepName || "",
|
|
2333
2333
|
{
|
|
@@ -2352,7 +2352,7 @@ class Yn {
|
|
|
2352
2352
|
n(!0);
|
|
2353
2353
|
const a = (i = e.asset) == null ? void 0 : i.fileLink;
|
|
2354
2354
|
if (!a)
|
|
2355
|
-
throw new
|
|
2355
|
+
throw new _(e);
|
|
2356
2356
|
return {
|
|
2357
2357
|
command: void 0,
|
|
2358
2358
|
followup: async () => {
|
|
@@ -2415,7 +2415,7 @@ class Sn {
|
|
|
2415
2415
|
if (!E)
|
|
2416
2416
|
return console.error(`Can not find layout for region: ${l.panelId}`), null;
|
|
2417
2417
|
const Q = [];
|
|
2418
|
-
return d && Q.push(new
|
|
2418
|
+
return d && Q.push(new $(w)), Q.push(
|
|
2419
2419
|
new L(
|
|
2420
2420
|
{
|
|
2421
2421
|
stepRegion: l,
|
|
@@ -2532,12 +2532,12 @@ class Pn {
|
|
|
2532
2532
|
async selectVariantCommand(A, e, t, n) {
|
|
2533
2533
|
const a = e.asset;
|
|
2534
2534
|
if (!a)
|
|
2535
|
-
throw new
|
|
2535
|
+
throw new _(e);
|
|
2536
2536
|
const i = a == null ? void 0 : a.fileLink;
|
|
2537
2537
|
if (!i)
|
|
2538
2538
|
return console.error("No URL for picture!"), null;
|
|
2539
2539
|
n(!0), t.setMandatoryFulfilled(A.stepName, !1);
|
|
2540
|
-
const o = t.getRegionElements(A.stepName).map((B) => new
|
|
2540
|
+
const o = t.getRegionElements(A.stepName).map((B) => new $(B.id)), r = (B) => {
|
|
2541
2541
|
const d = t.getLayouts().find((h) => h.panelId === B.panelId);
|
|
2542
2542
|
if (!d)
|
|
2543
2543
|
throw new z(B);
|
|
@@ -2666,7 +2666,7 @@ class Hn {
|
|
|
2666
2666
|
async init(A, e, t) {
|
|
2667
2667
|
const n = A.option;
|
|
2668
2668
|
if (!n)
|
|
2669
|
-
throw new
|
|
2669
|
+
throw new MA(A);
|
|
2670
2670
|
if (t)
|
|
2671
2671
|
await this.reload(A, e, t);
|
|
2672
2672
|
else {
|
|
@@ -2812,7 +2812,7 @@ class Hn {
|
|
|
2812
2812
|
}
|
|
2813
2813
|
}
|
|
2814
2814
|
}
|
|
2815
|
-
const
|
|
2815
|
+
const rA = new Hn();
|
|
2816
2816
|
class Rn {
|
|
2817
2817
|
constructor() {
|
|
2818
2818
|
this.latestToast = null, this.toastType = null, this.toastCallbacks = [];
|
|
@@ -2921,7 +2921,7 @@ class vn {
|
|
|
2921
2921
|
return null;
|
|
2922
2922
|
}
|
|
2923
2923
|
findLayoutElements(A, e) {
|
|
2924
|
-
return A.getRegionElements(e.stepName).map((a) =>
|
|
2924
|
+
return A.getRegionElements(e.stepName).map((a) => DA(a.id, A.getAllLayoutData()));
|
|
2925
2925
|
}
|
|
2926
2926
|
/**
|
|
2927
2927
|
* Get the colors that can be used for a given text step.
|
|
@@ -3032,7 +3032,7 @@ class vn {
|
|
|
3032
3032
|
for (const l of e) {
|
|
3033
3033
|
if (!l.fontData)
|
|
3034
3034
|
throw new k("Failed to resolve font data for text.");
|
|
3035
|
-
const [d, w] =
|
|
3035
|
+
const [d, w] = mA(
|
|
3036
3036
|
l.fontSize,
|
|
3037
3037
|
l.fontData,
|
|
3038
3038
|
{ left: l.x, top: l.y, width: l.width, height: l.height, rotation: l.rotation, panelId: "" },
|
|
@@ -3125,10 +3125,10 @@ class vn {
|
|
|
3125
3125
|
async fontDataFromVariant(A) {
|
|
3126
3126
|
const e = A.asset;
|
|
3127
3127
|
if (!e)
|
|
3128
|
-
throw new
|
|
3128
|
+
throw new _(A);
|
|
3129
3129
|
const t = e.fileLink;
|
|
3130
3130
|
if (!t)
|
|
3131
|
-
throw new
|
|
3131
|
+
throw new cA(e);
|
|
3132
3132
|
const n = await ee(t);
|
|
3133
3133
|
return {
|
|
3134
3134
|
assetUrl: t,
|
|
@@ -3249,7 +3249,7 @@ class vn {
|
|
|
3249
3249
|
}, m = [], I = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
3250
3250
|
if (!u.fontData)
|
|
3251
3251
|
throw new k("Failed to resolve font data for text.");
|
|
3252
|
-
const [M, y] =
|
|
3252
|
+
const [M, y] = mA(
|
|
3253
3253
|
u.fontSize,
|
|
3254
3254
|
u.fontData,
|
|
3255
3255
|
{
|
|
@@ -3310,7 +3310,7 @@ class vn {
|
|
|
3310
3310
|
const B = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), l = this.getProcessedInput(B, A.data, s), d = i.getRegionElements(A.stepName), w = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
3311
3311
|
for (const u of d)
|
|
3312
3312
|
if (u.region) {
|
|
3313
|
-
const [m, I] =
|
|
3313
|
+
const [m, I] = mA(
|
|
3314
3314
|
e,
|
|
3315
3315
|
t,
|
|
3316
3316
|
u.region,
|
|
@@ -4644,13 +4644,13 @@ function tt(c, A, e) {
|
|
|
4644
4644
|
Tn(A, e, `bgdef-${t}`), c.appendChild(Ln(`#bgdef-${t}`));
|
|
4645
4645
|
}
|
|
4646
4646
|
const nt = (c, A, e, t) => {
|
|
4647
|
-
const n =
|
|
4647
|
+
const n = BA("filter");
|
|
4648
4648
|
n.setAttribute("id", t), n.setAttribute("height", "200%"), n.setAttribute("width", "200%"), n.setAttribute("x", "-50%"), n.setAttribute("y", "-50%");
|
|
4649
|
-
const a =
|
|
4649
|
+
const a = BA("feOffset");
|
|
4650
4650
|
n.appendChild(a), a.setAttribute("result", "offOut"), a.setAttribute("in", "SourceAlpha"), a.setAttribute("dx", `${c}`), a.setAttribute("dy", `${A}`);
|
|
4651
|
-
const i =
|
|
4651
|
+
const i = BA("feGaussianBlur");
|
|
4652
4652
|
n.appendChild(i), i.setAttribute("result", "blurOut"), i.setAttribute("in", "offOut"), i.setAttribute("stdDeviation", `${e}`);
|
|
4653
|
-
const s =
|
|
4653
|
+
const s = BA("feBlend");
|
|
4654
4654
|
return n.appendChild(s), s.setAttribute("in", "SourceGraphic"), s.setAttribute("in2", "blurOut"), s.setAttribute("mode", "normal"), n;
|
|
4655
4655
|
}, at = (c) => {
|
|
4656
4656
|
let A = c;
|
|
@@ -4715,7 +4715,7 @@ class ce {
|
|
|
4715
4715
|
l = (B * 100 | 0) / 100;
|
|
4716
4716
|
break;
|
|
4717
4717
|
default:
|
|
4718
|
-
throw new
|
|
4718
|
+
throw new oA("Failed to encode path.");
|
|
4719
4719
|
}
|
|
4720
4720
|
o || i.push(" "), i.push(l), o = !1;
|
|
4721
4721
|
}
|
|
@@ -4729,12 +4729,12 @@ class ce {
|
|
|
4729
4729
|
for (e.lastIndex = 0; a = e.exec(A); ) {
|
|
4730
4730
|
const i = a[1].toLowerCase(), s = (a[2].match(t) || []).map(parseFloat), o = i === a[1], r = fe[i];
|
|
4731
4731
|
if (s.length < r.length)
|
|
4732
|
-
throw new
|
|
4732
|
+
throw new oA(
|
|
4733
4733
|
`Path type "${i}" given ${s.length} arguments, expected ${r.length}.`
|
|
4734
4734
|
);
|
|
4735
4735
|
if (r.length > 0) {
|
|
4736
4736
|
if (s.length % r.length !== 0)
|
|
4737
|
-
throw new
|
|
4737
|
+
throw new oA(
|
|
4738
4738
|
`Path type "${i}" given ${s.length} arguments, not divisible by ${r.length}`
|
|
4739
4739
|
);
|
|
4740
4740
|
for (let g = 0; g < s.length / r.length; g++) {
|
|
@@ -4759,7 +4759,7 @@ class ce {
|
|
|
4759
4759
|
if (s in a && o in a) {
|
|
4760
4760
|
const r = [a[s], a[o]], g = e(r);
|
|
4761
4761
|
if (g.length < 2)
|
|
4762
|
-
throw new
|
|
4762
|
+
throw new oA("Transformer must return at least 2 points.");
|
|
4763
4763
|
a[s] = g[0], a[o] = g[1];
|
|
4764
4764
|
}
|
|
4765
4765
|
}
|
|
@@ -4920,7 +4920,7 @@ async function it(c) {
|
|
|
4920
4920
|
if (c === "Favourites")
|
|
4921
4921
|
return new zn();
|
|
4922
4922
|
if (c === "Maltesers") {
|
|
4923
|
-
const A =
|
|
4923
|
+
const A = Z("https://assets.spiff.com.au/public/modules/img/MaltesersBackground.svg"), e = Z("https://assets.spiff.com.au/public/modules/img/MaltesersBackgroundShort.svg"), t = await Promise.all([A, e]);
|
|
4924
4924
|
return new jn(t[0], t[1]);
|
|
4925
4925
|
}
|
|
4926
4926
|
if (c === "Vegemite")
|
|
@@ -4973,7 +4973,7 @@ class qn {
|
|
|
4973
4973
|
this.reloadedState && this.reloadedState.serializableWorkflow.steps.forEach((s) => {
|
|
4974
4974
|
this.storage[s.stepName] = s.storage || {};
|
|
4975
4975
|
}), this.allScenes = await hn(A);
|
|
4976
|
-
const n =
|
|
4976
|
+
const n = tA(this.allScenes, this.stepSelections).map((s) => s.silentSteps).flat(), { stepElements: a, commands: i } = await this.stepElementsForIntroducedSilentSteps(n, !!this.reloadedState);
|
|
4977
4977
|
this.commandContext.apply(new G(i), !0), this.stepElements = { ...this.stepElements, ...a }, await this.ensureStepsAreLoaded(), !this.isReloadedTransaction && this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
|
4978
4978
|
}
|
|
4979
4979
|
setWorkflowStateSyncEnabled(A) {
|
|
@@ -5142,7 +5142,7 @@ class qn {
|
|
|
5142
5142
|
model: this.getProduct().modelUrl,
|
|
5143
5143
|
contextService: this.getLayoutPreviewService()
|
|
5144
5144
|
});
|
|
5145
|
-
this.setModelContainer(e),
|
|
5145
|
+
this.setModelContainer(e), tA(this.allScenes, this.stepSelections).filter((a) => a).map((a) => a.renderableSteps).flat().filter((a) => a.type === D.Model || a.type === D.Material).forEach((a) => {
|
|
5146
5146
|
var o, r, g;
|
|
5147
5147
|
if (!((o = a.option) != null && o.id)) {
|
|
5148
5148
|
console.error(`Failed to read option id from step: ${a.stepName}`);
|
|
@@ -5281,12 +5281,12 @@ class qn {
|
|
|
5281
5281
|
this.stepElements = e(this.stepElements, A);
|
|
5282
5282
|
}
|
|
5283
5283
|
getInvalidCanvasRegions() {
|
|
5284
|
-
return this.workflow.steps.reduce((A, e) => (
|
|
5284
|
+
return this.workflow.steps.reduce((A, e) => (nA(e, this.stepSelections) || this.stepElements[e.stepName] && this.stepElements[e.stepName].forEach(
|
|
5285
5285
|
(t) => A.push(t)
|
|
5286
5286
|
), A), []);
|
|
5287
5287
|
}
|
|
5288
5288
|
getInvalidModelVariants() {
|
|
5289
|
-
return this.workflow.steps.reduce((A, e) => (e.type === D.Model && !
|
|
5289
|
+
return this.workflow.steps.reduce((A, e) => (e.type === D.Model && !nA(e, this.stepSelections) && A.push(e.stepName), A), []);
|
|
5290
5290
|
}
|
|
5291
5291
|
async stepElementsForIntroducedSilentSteps(A, e) {
|
|
5292
5292
|
const t = this.product;
|
|
@@ -5336,7 +5336,7 @@ class qn {
|
|
|
5336
5336
|
async reset() {
|
|
5337
5337
|
this.commandContext.getAllLayouts().forEach(
|
|
5338
5338
|
(e) => e.layoutState.elements.forEach((t) => {
|
|
5339
|
-
this.getCommandDispatcher()(new
|
|
5339
|
+
this.getCommandDispatcher()(new $(t.id));
|
|
5340
5340
|
})
|
|
5341
5341
|
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
|
5342
5342
|
}
|
|
@@ -5347,13 +5347,13 @@ class qn {
|
|
|
5347
5347
|
...this.stepSelections,
|
|
5348
5348
|
[A]: { selectedVariants: e }
|
|
5349
5349
|
}, this.selectionCost = Object.values(this.stepSelections).reduce((I, p) => I + p.selectedVariants.map((M) => M.priceModifier || 0).reduce((M, y) => M + y, 0), 0), this.workflow.steps.forEach((I) => {
|
|
5350
|
-
|
|
5350
|
+
nA(I, this.stepSelections) || (this.stepInitialised[I.stepName] = !1, delete this.stepMetadata[I.stepName], delete this.stepSelections[I.stepName], delete this.storage[I.stepName]);
|
|
5351
5351
|
});
|
|
5352
|
-
const i = this.allScenes, s =
|
|
5352
|
+
const i = this.allScenes, s = tA(i, a), o = tA(i, this.stepSelections), r = s.map((I) => I.silentSteps).flat(), B = o.map((I) => I.silentSteps).flat().filter(
|
|
5353
5353
|
(I) => !r.some((p) => p.stepName === I.stepName)
|
|
5354
5354
|
);
|
|
5355
5355
|
r.forEach((I) => {
|
|
5356
|
-
|
|
5356
|
+
nA(I, this.stepSelections) || (this.stepInitialised[I.stepName] = !1);
|
|
5357
5357
|
});
|
|
5358
5358
|
const l = this.getInvalidCanvasRegions(), { stepElements: d, commands: w } = await this.stepElementsForIntroducedSilentSteps(B, !1);
|
|
5359
5359
|
this.stepElements = {
|
|
@@ -5366,7 +5366,7 @@ class qn {
|
|
|
5366
5366
|
const I = this.getStepSpecificServices(A);
|
|
5367
5367
|
(m = I == null ? void 0 : I.frameService) == null || m.setTargetElements(t.map((p) => p.id));
|
|
5368
5368
|
}
|
|
5369
|
-
const E = l.map((I) => new
|
|
5369
|
+
const E = l.map((I) => new $(I.id)), Q = new he(this.constructSerializableWorkflow()), C = [...w, ...E, Q];
|
|
5370
5370
|
C.length > 0 && this.commandContext.apply(new G(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
5371
5371
|
const f = this.getInvalidModelVariants(), u = this.modelContainer;
|
|
5372
5372
|
if (u) {
|
|
@@ -5384,7 +5384,7 @@ class qn {
|
|
|
5384
5384
|
await this.onSelectionChange(), n && await n();
|
|
5385
5385
|
}
|
|
5386
5386
|
async ensureStepsAreLoaded() {
|
|
5387
|
-
const e =
|
|
5387
|
+
const e = tA(this.allScenes, this.stepSelections).map((o) => o.renderableSteps), t = [], n = e.flat();
|
|
5388
5388
|
for (const o of n)
|
|
5389
5389
|
if (!this.stepInitialised[o.stepName])
|
|
5390
5390
|
switch (this.stepInitialised[o.stepName] = !0, o.type) {
|
|
@@ -5410,7 +5410,7 @@ class qn {
|
|
|
5410
5410
|
break;
|
|
5411
5411
|
case D.Illustration:
|
|
5412
5412
|
t.push(
|
|
5413
|
-
|
|
5413
|
+
pA.init(o, this, this.reloadedState)
|
|
5414
5414
|
);
|
|
5415
5415
|
break;
|
|
5416
5416
|
case D.Material:
|
|
@@ -5439,7 +5439,7 @@ class qn {
|
|
|
5439
5439
|
);
|
|
5440
5440
|
break;
|
|
5441
5441
|
case D.Shape:
|
|
5442
|
-
t.push(
|
|
5442
|
+
t.push(rA.init(o, this, this.reloadedState));
|
|
5443
5443
|
break;
|
|
5444
5444
|
case D.Text:
|
|
5445
5445
|
t.push(K.init(o, this, this.reloadedState));
|
|
@@ -5693,7 +5693,7 @@ class Zn extends W {
|
|
|
5693
5693
|
*/
|
|
5694
5694
|
async selectVariant(A) {
|
|
5695
5695
|
if (!this.getUpdateState() && this.getCurrentVariant() !== A)
|
|
5696
|
-
return
|
|
5696
|
+
return pA.selectVariant(
|
|
5697
5697
|
this.step,
|
|
5698
5698
|
A.getResource(),
|
|
5699
5699
|
this.manager.getRegionElements(this.step.stepName) || [],
|
|
@@ -5709,7 +5709,7 @@ class Zn extends W {
|
|
|
5709
5709
|
const A = this.manager.getRegionElements(this.step.stepName) || [];
|
|
5710
5710
|
if (A.length !== 0)
|
|
5711
5711
|
try {
|
|
5712
|
-
return
|
|
5712
|
+
return DA(A[0].id, this.manager.getAllLayoutData()).colors;
|
|
5713
5713
|
} catch (e) {
|
|
5714
5714
|
console.error(e);
|
|
5715
5715
|
}
|
|
@@ -5719,7 +5719,7 @@ class Zn extends W {
|
|
|
5719
5719
|
*/
|
|
5720
5720
|
setColor(A, e) {
|
|
5721
5721
|
const t = /* @__PURE__ */ new Map();
|
|
5722
|
-
return t.set(A, e),
|
|
5722
|
+
return t.set(A, e), pA.changeColors(
|
|
5723
5723
|
this.step,
|
|
5724
5724
|
this.manager.getRegionElements(this.step.stepName),
|
|
5725
5725
|
this.manager,
|
|
@@ -5731,7 +5731,7 @@ class Zn extends W {
|
|
|
5731
5731
|
return this.step.data.colorOption;
|
|
5732
5732
|
}
|
|
5733
5733
|
getAvailableColors() {
|
|
5734
|
-
return this.step.data.colorPickerEnabled ?
|
|
5734
|
+
return this.step.data.colorPickerEnabled ? pA.availableColors(this.step, this.manager) : Promise.resolve([]);
|
|
5735
5735
|
}
|
|
5736
5736
|
isColorPickerEnabled() {
|
|
5737
5737
|
return this.step.data.colorPickerEnabled;
|
|
@@ -5804,7 +5804,7 @@ class ta extends W {
|
|
|
5804
5804
|
}
|
|
5805
5805
|
selectVariant(A) {
|
|
5806
5806
|
const e = A.getResource();
|
|
5807
|
-
return
|
|
5807
|
+
return rA.selectVariant(
|
|
5808
5808
|
this.step,
|
|
5809
5809
|
{
|
|
5810
5810
|
fill: e.color,
|
|
@@ -5822,7 +5822,7 @@ class ta extends W {
|
|
|
5822
5822
|
* @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
|
|
5823
5823
|
*/
|
|
5824
5824
|
setColor(A) {
|
|
5825
|
-
return
|
|
5825
|
+
return rA.selectVariant(
|
|
5826
5826
|
this.step,
|
|
5827
5827
|
A,
|
|
5828
5828
|
this.manager.getRegionElements(this.step.stepName) || [],
|
|
@@ -5834,7 +5834,7 @@ class ta extends W {
|
|
|
5834
5834
|
* @returns A list of color definitions that are currently applied to the illustration.
|
|
5835
5835
|
*/
|
|
5836
5836
|
getColors() {
|
|
5837
|
-
return
|
|
5837
|
+
return rA.availableColours(this.step);
|
|
5838
5838
|
}
|
|
5839
5839
|
/**
|
|
5840
5840
|
* Allows for setting a custom color when the custom variant is selected. Will
|
|
@@ -5846,7 +5846,7 @@ class ta extends W {
|
|
|
5846
5846
|
throw new Error(
|
|
5847
5847
|
"Custom colors can only be set on a non-custom variant. Please add a custom variant to the step."
|
|
5848
5848
|
);
|
|
5849
|
-
return
|
|
5849
|
+
return rA.setCustomColor(A, this.step, this.manager);
|
|
5850
5850
|
}
|
|
5851
5851
|
getCustomColor() {
|
|
5852
5852
|
var e, t;
|
|
@@ -6045,7 +6045,7 @@ class aa extends W {
|
|
|
6045
6045
|
return this.step.data.content;
|
|
6046
6046
|
}
|
|
6047
6047
|
}
|
|
6048
|
-
class
|
|
6048
|
+
class EA {
|
|
6049
6049
|
static get(A, e) {
|
|
6050
6050
|
switch (e.type) {
|
|
6051
6051
|
case D.Information:
|
|
@@ -6512,7 +6512,7 @@ const LA = new Ba(), da = F`
|
|
|
6512
6512
|
}
|
|
6513
6513
|
}
|
|
6514
6514
|
`;
|
|
6515
|
-
class
|
|
6515
|
+
class hA {
|
|
6516
6516
|
constructor(A, e) {
|
|
6517
6517
|
var n;
|
|
6518
6518
|
if (this.renderableScenes = [], this.renderableSceneCallbacks = [], this.debouncedSavedDesignUpdate = Je(async () => {
|
|
@@ -6530,11 +6530,11 @@ class EA {
|
|
|
6530
6530
|
} catch (o) {
|
|
6531
6531
|
s(o);
|
|
6532
6532
|
}
|
|
6533
|
-
}),
|
|
6533
|
+
}), !e.workflow)
|
|
6534
6534
|
throw new Error("No Workflow ID provided.");
|
|
6535
6535
|
this.client = A;
|
|
6536
6536
|
const t = e.layouts;
|
|
6537
|
-
this.commandContext = new Pt(),
|
|
6537
|
+
this.commandContext = new Pt(), this.commandContext.initialize(t, e.reloadedState), this.isReadOnly = e.transaction.isOrdered || !!e.readOnly, this.workflowManager = new qn(
|
|
6538
6538
|
e.workflow,
|
|
6539
6539
|
((n = e.product.profanities) == null ? void 0 : n.map((a) => a.word)) || [],
|
|
6540
6540
|
t,
|
|
@@ -6567,7 +6567,7 @@ class EA {
|
|
|
6567
6567
|
};
|
|
6568
6568
|
});
|
|
6569
6569
|
this.renderableScenes = i, this.renderableSceneCallbacks.forEach((s) => s(i));
|
|
6570
|
-
})
|
|
6570
|
+
});
|
|
6571
6571
|
}
|
|
6572
6572
|
getClient() {
|
|
6573
6573
|
return this.client;
|
|
@@ -6591,7 +6591,7 @@ class EA {
|
|
|
6591
6591
|
}
|
|
6592
6592
|
let a = 2048;
|
|
6593
6593
|
e && e <= 2048 && (a = e);
|
|
6594
|
-
const i =
|
|
6594
|
+
const i = FA(a, a), s = this.commandContext.getAllLayouts(), o = t.defaultPreviewPanelIndex || 0, r = t.panels[o], g = s.find((u) => {
|
|
6595
6595
|
var m;
|
|
6596
6596
|
return ((m = u.layoutState) == null ? void 0 : m.layout.panelId) === (r == null ? void 0 : r.name);
|
|
6597
6597
|
}) || s[0], B = g.layoutState.layout.previewRegion ? {
|
|
@@ -6616,7 +6616,7 @@ class EA {
|
|
|
6616
6616
|
await (await ke.from(d, h, {
|
|
6617
6617
|
anonymousCrossOrigin: !0,
|
|
6618
6618
|
ignoreDimensions: !1,
|
|
6619
|
-
createCanvas:
|
|
6619
|
+
createCanvas: FA,
|
|
6620
6620
|
createImage: He,
|
|
6621
6621
|
DOMParser: Re(),
|
|
6622
6622
|
fetch: $A
|
|
@@ -6627,7 +6627,7 @@ class EA {
|
|
|
6627
6627
|
getStepById(A) {
|
|
6628
6628
|
const e = this.getWorkflowManager().getWorkflow().steps.find((t) => t.stepName === A);
|
|
6629
6629
|
if (!(!e || !this.stepHasHandle(e)))
|
|
6630
|
-
return
|
|
6630
|
+
return EA.get(this.getWorkflowManager(), e);
|
|
6631
6631
|
}
|
|
6632
6632
|
getSteps() {
|
|
6633
6633
|
return this.getScenes().flatMap((A) => this.getStepsByScene(A));
|
|
@@ -6687,10 +6687,10 @@ class EA {
|
|
|
6687
6687
|
getStepByName(A) {
|
|
6688
6688
|
const e = this.getWorkflowManager().getWorkflow().steps.find((t) => t.stepTitle === A);
|
|
6689
6689
|
if (!(!e || !this.stepHasHandle(e)))
|
|
6690
|
-
return
|
|
6690
|
+
return EA.get(this.getWorkflowManager(), e);
|
|
6691
6691
|
}
|
|
6692
6692
|
getStepsByType(A) {
|
|
6693
|
-
return this.getWorkflowManager().getWorkflow().steps.filter((e) => e.type === A).map((e) =>
|
|
6693
|
+
return this.getWorkflowManager().getWorkflow().steps.filter((e) => e.type === A).map((e) => EA.get(this.getWorkflowManager(), e));
|
|
6694
6694
|
}
|
|
6695
6695
|
getStepsByScene(A) {
|
|
6696
6696
|
if (!this.getWorkflowManager().getWorkflow().stepGroups.find((t) => t.name === A.name))
|
|
@@ -6699,7 +6699,7 @@ class EA {
|
|
|
6699
6699
|
);
|
|
6700
6700
|
return A.stepIds.map(
|
|
6701
6701
|
(t) => this.getWorkflowManager().getWorkflow().steps.find((n) => n.stepName === t)
|
|
6702
|
-
).filter((t) => this.stepHasHandle(t)).map((t) =>
|
|
6702
|
+
).filter((t) => this.stepHasHandle(t)).map((t) => EA.get(this.getWorkflowManager(), t));
|
|
6703
6703
|
}
|
|
6704
6704
|
async attachCustomerDetails(A) {
|
|
6705
6705
|
return this.assignCustomerDetails({ emailAddress: A.email });
|
|
@@ -6913,7 +6913,7 @@ const wa = [
|
|
|
6913
6913
|
const s = (I = i.asset) == null ? void 0 : I.fileLink;
|
|
6914
6914
|
if (!s)
|
|
6915
6915
|
return console.error(`No asset link for variant with ID: ${n.illustrationVariantId}`), [];
|
|
6916
|
-
const o = await
|
|
6916
|
+
const o = await Z(s, !0), r = /<svg.*?<\/svg>/s, g = o.match(r) || [], B = (g == null ? void 0 : g.length) > 0 ? g[0] : "", w = Ue().parseFromString(B, "image/svg+xml").firstElementChild;
|
|
6917
6917
|
if (!w)
|
|
6918
6918
|
return console.error("Failed to read SVG."), [];
|
|
6919
6919
|
Ge(w);
|
|
@@ -7131,10 +7131,10 @@ const wa = [
|
|
|
7131
7131
|
console.error(r);
|
|
7132
7132
|
}
|
|
7133
7133
|
else {
|
|
7134
|
-
const r = await
|
|
7134
|
+
const r = await Z(a, !0), g = (B) => {
|
|
7135
7135
|
const l = /<svg.*?<\/svg>/s, d = B.match(l) || [], w = (d == null ? void 0 : d.length) > 0 ? d[0] : "", Q = Ue().parseFromString(w, "image/svg+xml").firstElementChild;
|
|
7136
7136
|
if (!Q)
|
|
7137
|
-
throw new
|
|
7137
|
+
throw new oA("Failed to read SVG.");
|
|
7138
7138
|
return Ge(Q), ve().serializeToString(Q);
|
|
7139
7139
|
};
|
|
7140
7140
|
o.forEach((B) => {
|
|
@@ -7222,7 +7222,7 @@ const wa = [
|
|
|
7222
7222
|
y: E.top
|
|
7223
7223
|
};
|
|
7224
7224
|
if (g) {
|
|
7225
|
-
const [f, u] =
|
|
7225
|
+
const [f, u] = mA(
|
|
7226
7226
|
t.data.size || i,
|
|
7227
7227
|
g,
|
|
7228
7228
|
E,
|
|
@@ -7315,7 +7315,7 @@ const wa = [
|
|
|
7315
7315
|
);
|
|
7316
7316
|
return n;
|
|
7317
7317
|
};
|
|
7318
|
-
class
|
|
7318
|
+
class CA {
|
|
7319
7319
|
constructor(A) {
|
|
7320
7320
|
this.handleCompleteRender = null;
|
|
7321
7321
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -7332,7 +7332,7 @@ class hA {
|
|
|
7332
7332
|
}
|
|
7333
7333
|
}
|
|
7334
7334
|
const Fa = () => new Promise((c, A) => {
|
|
7335
|
-
const t =
|
|
7335
|
+
const t = FA().getContext("webgl2");
|
|
7336
7336
|
c(!!t);
|
|
7337
7337
|
}), Ma = Fa();
|
|
7338
7338
|
class ya {
|
|
@@ -7470,7 +7470,7 @@ class Ya extends We {
|
|
|
7470
7470
|
ignoreClear: !0,
|
|
7471
7471
|
ignoreMouse: !0,
|
|
7472
7472
|
enableRedraw: !1,
|
|
7473
|
-
createCanvas:
|
|
7473
|
+
createCanvas: FA,
|
|
7474
7474
|
createImage: He,
|
|
7475
7475
|
DOMParser: Re(),
|
|
7476
7476
|
fetch: $A
|
|
@@ -7498,7 +7498,7 @@ const Gi = (c, A) => {
|
|
|
7498
7498
|
const i = await Da(c, A, e, t);
|
|
7499
7499
|
return new G(i).apply(n);
|
|
7500
7500
|
}, Sa = F`
|
|
7501
|
-
${
|
|
7501
|
+
${aA}
|
|
7502
7502
|
fragment ProductFields on Product {
|
|
7503
7503
|
id
|
|
7504
7504
|
basePrice
|
|
@@ -7824,13 +7824,13 @@ class Oa {
|
|
|
7824
7824
|
}
|
|
7825
7825
|
async createHandle(A) {
|
|
7826
7826
|
switch (A.type) {
|
|
7827
|
-
case
|
|
7827
|
+
case IA.FileUpload:
|
|
7828
7828
|
return new za(this.bundle, A);
|
|
7829
|
-
case
|
|
7829
|
+
case IA.Option: {
|
|
7830
7830
|
const e = A.entityId ? await j.getOption(A.entityId) : void 0;
|
|
7831
7831
|
return (e == null ? void 0 : e.type) === "Color" ? new ja(this.bundle, A, e) : new Bt(this.bundle, A, e);
|
|
7832
7832
|
}
|
|
7833
|
-
case
|
|
7833
|
+
case IA.Text:
|
|
7834
7834
|
return new Ka(this.bundle, A);
|
|
7835
7835
|
}
|
|
7836
7836
|
}
|
|
@@ -8489,7 +8489,7 @@ class Fe {
|
|
|
8489
8489
|
return this.globalPropertyStateManager;
|
|
8490
8490
|
}
|
|
8491
8491
|
async getGlobalPropertyTotalSubunits() {
|
|
8492
|
-
return (await this.globalPropertyHandleService.getHandles()).filter((t) => t.getType() ===
|
|
8492
|
+
return (await this.globalPropertyHandleService.getHandles()).filter((t) => t.getType() === IA.Option).map((t) => {
|
|
8493
8493
|
var n;
|
|
8494
8494
|
return ((n = t.getCurrentVariant()) == null ? void 0 : n.getPrice()) || 0;
|
|
8495
8495
|
}).reduce((t, n) => t + n, 0);
|
|
@@ -8938,14 +8938,14 @@ class ni {
|
|
|
8938
8938
|
* @returns The nodes contained within the execution.
|
|
8939
8939
|
*/
|
|
8940
8940
|
getNodes() {
|
|
8941
|
-
return this.execution.nodes.map((A) => new
|
|
8941
|
+
return this.execution.nodes.map((A) => new QA(A));
|
|
8942
8942
|
}
|
|
8943
8943
|
/**
|
|
8944
8944
|
* @param type The type of node to return.
|
|
8945
8945
|
* @returns A list of nodes matching the requested type.
|
|
8946
8946
|
*/
|
|
8947
8947
|
getNodesByType(A) {
|
|
8948
|
-
return this.execution.nodes.filter((e) => e.type === A).map((e) => new
|
|
8948
|
+
return this.execution.nodes.filter((e) => e.type === A).map((e) => new QA(e));
|
|
8949
8949
|
}
|
|
8950
8950
|
/**
|
|
8951
8951
|
* @returns A list of input nodes that exist in this execution.
|
|
@@ -8954,7 +8954,7 @@ class ni {
|
|
|
8954
8954
|
return this.execution.nodes.filter(
|
|
8955
8955
|
(A) => A.type === "StartTerminal"
|
|
8956
8956
|
/* StartTerminal */
|
|
8957
|
-
).map((A) => new
|
|
8957
|
+
).map((A) => new QA(A));
|
|
8958
8958
|
}
|
|
8959
8959
|
/**
|
|
8960
8960
|
* @returns A list of out put nodes that exist in this execution.
|
|
@@ -8963,7 +8963,7 @@ class ni {
|
|
|
8963
8963
|
return this.execution.nodes.filter(
|
|
8964
8964
|
(A) => A.type === "EndTerminal"
|
|
8965
8965
|
/* EndTerminal */
|
|
8966
|
-
).map((A) => new
|
|
8966
|
+
).map((A) => new QA(A));
|
|
8967
8967
|
}
|
|
8968
8968
|
/**
|
|
8969
8969
|
* @returns A date object representing the point in time this execution completed.
|
|
@@ -8980,7 +8980,7 @@ class ni {
|
|
|
8980
8980
|
return new Date(this.execution.failedAt);
|
|
8981
8981
|
}
|
|
8982
8982
|
}
|
|
8983
|
-
class
|
|
8983
|
+
class QA {
|
|
8984
8984
|
constructor(A) {
|
|
8985
8985
|
this.node = A;
|
|
8986
8986
|
}
|
|
@@ -9703,7 +9703,7 @@ const ii = F`
|
|
|
9703
9703
|
}
|
|
9704
9704
|
}
|
|
9705
9705
|
}
|
|
9706
|
-
`,
|
|
9706
|
+
`, eA = async (c) => {
|
|
9707
9707
|
var A;
|
|
9708
9708
|
for (const e in c.layouts) {
|
|
9709
9709
|
const t = c.layouts[e].elements.filter(
|
|
@@ -9711,7 +9711,7 @@ const ii = F`
|
|
|
9711
9711
|
);
|
|
9712
9712
|
for (let a = 0; a < t.length; ++a) {
|
|
9713
9713
|
const i = t[a];
|
|
9714
|
-
i.src && i.svg && (i.cachedObjectURL = await
|
|
9714
|
+
i.src && i.svg && (i.cachedObjectURL = await fA(i.svg));
|
|
9715
9715
|
}
|
|
9716
9716
|
const n = c.layouts[e].elements.filter((a) => a.type === v.Textbox);
|
|
9717
9717
|
for (let a = 0; a < n.length; ++a) {
|
|
@@ -9736,7 +9736,7 @@ const ii = F`
|
|
|
9736
9736
|
var s, o, r;
|
|
9737
9737
|
delete i.data.__typename, (s = i.option) != null && s.id && ((o = i.option.defaultVariant) != null && o.asset && O.cacheAsset(i.option.defaultVariant.asset), i.option.colorProfile && O.cacheAsset(i.option.colorProfile), (r = i.option.variants) == null || r.forEach((g) => {
|
|
9738
9738
|
g.asset && O.cacheAsset(g.asset), g.displayImage && O.cacheAsset(g.displayImage), g.thumbnail && O.cacheAsset(g.thumbnail), g.material && O.cacheMaterial(g.material);
|
|
9739
|
-
}),
|
|
9739
|
+
}), gA.set({ id: i.option.id }, Promise.resolve(i.option)));
|
|
9740
9740
|
});
|
|
9741
9741
|
}), t;
|
|
9742
9742
|
}, ui = async (c, A) => {
|
|
@@ -9745,14 +9745,14 @@ const ii = F`
|
|
|
9745
9745
|
throw new Error(`Workflow not found: ${c}`);
|
|
9746
9746
|
return t;
|
|
9747
9747
|
}, wt = async (c, A) => {
|
|
9748
|
-
const e = c.map((s) =>
|
|
9748
|
+
const e = c.map((s) => gA.get({ id: s, options: A })), t = c.filter((s, o) => e[o] === void 0);
|
|
9749
9749
|
if (t.length === 0)
|
|
9750
9750
|
return Promise.all(e);
|
|
9751
9751
|
const n = Qi(t, A), a = t.map(
|
|
9752
|
-
(s) =>
|
|
9752
|
+
(s) => gA.set({ id: s, options: A }, ui(s, n))
|
|
9753
9753
|
), i = e.filter((s) => s !== void 0);
|
|
9754
9754
|
return await Promise.all(i.concat(a));
|
|
9755
|
-
},
|
|
9755
|
+
}, uA = async (c, A) => (await wt([c], A))[0], mi = (c) => c.sort((A, e) => A.index - e.index).map((A) => ({
|
|
9756
9756
|
id: J(),
|
|
9757
9757
|
panelId: A.name,
|
|
9758
9758
|
name: A.name,
|
|
@@ -10101,7 +10101,7 @@ class Ii {
|
|
|
10101
10101
|
const E = P.getShadowGraphqlClient();
|
|
10102
10102
|
if (n.type === "transaction") {
|
|
10103
10103
|
const { transactionId: f, readOnly: u } = n, m = await E.query({
|
|
10104
|
-
query:
|
|
10104
|
+
query: dA,
|
|
10105
10105
|
variables: {
|
|
10106
10106
|
ids: [f]
|
|
10107
10107
|
},
|
|
@@ -10113,7 +10113,7 @@ class Ii {
|
|
|
10113
10113
|
const I = (C = m.data) == null ? void 0 : C.transactions[0];
|
|
10114
10114
|
if (!I.workflowId)
|
|
10115
10115
|
throw new U("Existing transaction has no workflow ID.");
|
|
10116
|
-
const p = await
|
|
10116
|
+
const p = await uA(I.workflowId);
|
|
10117
10117
|
if (!I.product)
|
|
10118
10118
|
throw new U("Failed to load transaction, product not available.");
|
|
10119
10119
|
return { transaction: I, workflow: p, readOnly: u };
|
|
@@ -10141,7 +10141,7 @@ class Ii {
|
|
|
10141
10141
|
if (!y.product)
|
|
10142
10142
|
throw new U("Failed to create transaction, product not available.");
|
|
10143
10143
|
return y;
|
|
10144
|
-
}, u =
|
|
10144
|
+
}, u = uA(n.workflowId, n == null ? void 0 : n.graphql), [m, I] = await Promise.all([f(), u]);
|
|
10145
10145
|
return { transaction: m, workflow: I };
|
|
10146
10146
|
}
|
|
10147
10147
|
throw new U("No workflow ID provided.");
|
|
@@ -10163,16 +10163,16 @@ class Ii {
|
|
|
10163
10163
|
};
|
|
10164
10164
|
if (n.type === "transaction" && i.workflowState) {
|
|
10165
10165
|
const E = JSON.parse(i.workflowState);
|
|
10166
|
-
r.layouts = Object.values(E.layouts).map((Q) => Q.layout), await
|
|
10166
|
+
r.layouts = Object.values(E.layouts).map((Q) => Q.layout), await AA(E), await eA(E), r.reloadedState = E;
|
|
10167
10167
|
} else if (!o && n.workflowState) {
|
|
10168
10168
|
const E = JSON.parse(n.workflowState);
|
|
10169
|
-
r.layouts = Object.values(E.layouts).map((Q) => Q.layout), await
|
|
10169
|
+
r.layouts = Object.values(E.layouts).map((Q) => Q.layout), await AA(E), await eA(E), r.reloadedState = E;
|
|
10170
10170
|
} else
|
|
10171
10171
|
r.layouts = OA(
|
|
10172
10172
|
r.transaction,
|
|
10173
10173
|
r.workflow
|
|
10174
10174
|
);
|
|
10175
|
-
if (r.renderableContextService = new
|
|
10175
|
+
if (r.renderableContextService = new CA(
|
|
10176
10176
|
r.layouts
|
|
10177
10177
|
), n.previewService ? (r.previewService = n.previewService, (d = r.product) != null && d.modelUrl && (r.modelContainer = r.previewService.loadModel({
|
|
10178
10178
|
model: r.product.modelUrl,
|
|
@@ -10186,7 +10186,7 @@ class Ii {
|
|
|
10186
10186
|
} else
|
|
10187
10187
|
r.isReloadedTransaction = !0;
|
|
10188
10188
|
this.initialized = !0, this.experienceOptions = r;
|
|
10189
|
-
const g = new
|
|
10189
|
+
const g = new hA(this, r);
|
|
10190
10190
|
return await g.getWorkflowManager().getInitializationPromise(), n.type !== "transaction" && this.customer && await g.attachCustomerDetails({ email: this.customer.emailAddress }), g;
|
|
10191
10191
|
}
|
|
10192
10192
|
/**
|
|
@@ -10204,7 +10204,7 @@ class Ii {
|
|
|
10204
10204
|
if (m.length === 0)
|
|
10205
10205
|
return [];
|
|
10206
10206
|
const I = m.map((Y) => Y.option.transactionId), p = await t.query({
|
|
10207
|
-
query:
|
|
10207
|
+
query: dA,
|
|
10208
10208
|
variables: {
|
|
10209
10209
|
ids: I
|
|
10210
10210
|
},
|
|
@@ -10275,22 +10275,22 @@ class Ii {
|
|
|
10275
10275
|
};
|
|
10276
10276
|
if (Y.type === "transaction" && I.workflowState) {
|
|
10277
10277
|
const b = JSON.parse(I.workflowState);
|
|
10278
|
-
H.layouts = Object.values(b.layouts).map((V) => V.layout), await
|
|
10278
|
+
H.layouts = Object.values(b.layouts).map((V) => V.layout), await AA(b), await eA(b), H.reloadedState = b;
|
|
10279
10279
|
} else if (!M && Y.workflowState) {
|
|
10280
10280
|
const b = JSON.parse(Y.workflowState);
|
|
10281
|
-
H.layouts = Object.values(b.layouts).map((V) => V.layout), await
|
|
10281
|
+
H.layouts = Object.values(b.layouts).map((V) => V.layout), await AA(b), await eA(b), H.reloadedState = b;
|
|
10282
10282
|
} else
|
|
10283
10283
|
H.layouts = OA(
|
|
10284
10284
|
H.transaction,
|
|
10285
10285
|
H.workflow
|
|
10286
10286
|
);
|
|
10287
|
-
return H.renderableContextService = new
|
|
10287
|
+
return H.renderableContextService = new CA(
|
|
10288
10288
|
H.layouts
|
|
10289
10289
|
), H.delayWorkflowStateSync = !0, this.initialized = !0, this.experienceOptions = H, { experienceOptions: H, index: y, options: Y };
|
|
10290
10290
|
});
|
|
10291
10291
|
x.setMap("transactionOwnerIds", h);
|
|
10292
10292
|
const f = (await Promise.all(E)).sort((m, I) => m.index - I.index).map(async (m) => {
|
|
10293
|
-
const { experienceOptions: I, options: p } = m, M = new
|
|
10293
|
+
const { experienceOptions: I, options: p } = m, M = new hA(this, I);
|
|
10294
10294
|
return await M.getWorkflowManager().getInitializationPromise(), p.type !== "transaction" && this.customer && await M.attachCustomerDetails({ email: this.customer.emailAddress }), M;
|
|
10295
10295
|
}), u = await Promise.all(f);
|
|
10296
10296
|
return u.forEach((m) => m.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), u;
|
|
@@ -10345,7 +10345,7 @@ class Ii {
|
|
|
10345
10345
|
const t = P.getShadowGraphqlClient(), n = async () => {
|
|
10346
10346
|
var d, w;
|
|
10347
10347
|
const l = (d = (await t.query({
|
|
10348
|
-
query:
|
|
10348
|
+
query: dA,
|
|
10349
10349
|
variables: { ids: [A] },
|
|
10350
10350
|
fetchPolicy: "no-cache",
|
|
10351
10351
|
errorPolicy: "all"
|
|
@@ -10369,7 +10369,7 @@ class Ii {
|
|
|
10369
10369
|
const a = x.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), i = a.get(A);
|
|
10370
10370
|
if (i) {
|
|
10371
10371
|
const l = (s = (await t.query({
|
|
10372
|
-
query:
|
|
10372
|
+
query: dA,
|
|
10373
10373
|
variables: {
|
|
10374
10374
|
ids: [A]
|
|
10375
10375
|
},
|
|
@@ -10420,16 +10420,16 @@ class Ii {
|
|
|
10420
10420
|
if (!this.initialized || !this.experienceOptions)
|
|
10421
10421
|
throw new U("Cannot launch experience: Not initialized.");
|
|
10422
10422
|
if (this.experienceOptions.transaction.workflowId) {
|
|
10423
|
-
const o = await
|
|
10423
|
+
const o = await uA(this.experienceOptions.transaction.workflowId);
|
|
10424
10424
|
if (this.experienceOptions.workflow = o, this.experienceOptions.transaction.workflowState) {
|
|
10425
10425
|
const g = JSON.parse(this.experienceOptions.transaction.workflowState);
|
|
10426
|
-
this.experienceOptions.layouts = Object.values(g.layouts).map((B) => B.layout), await
|
|
10426
|
+
this.experienceOptions.layouts = Object.values(g.layouts).map((B) => B.layout), await AA(g), await eA(g), this.experienceOptions.reloadedState = g;
|
|
10427
10427
|
}
|
|
10428
|
-
this.experienceOptions.previewService = t && t(o), this.experienceOptions.renderableContextService = new
|
|
10428
|
+
this.experienceOptions.previewService = t && t(o), this.experienceOptions.renderableContextService = new CA(this.experienceOptions.layouts), (n = this.experienceOptions.product) != null && n.modelUrl && (this.experienceOptions.modelContainer = (a = this.experienceOptions.previewService) == null ? void 0 : a.loadModel({
|
|
10429
10429
|
model: this.experienceOptions.product.modelUrl,
|
|
10430
10430
|
contextService: this.experienceOptions.renderableContextService
|
|
10431
10431
|
}));
|
|
10432
|
-
const r = new
|
|
10432
|
+
const r = new hA(this, this.experienceOptions);
|
|
10433
10433
|
return await r.getWorkflowManager().getInitializationPromise(), r;
|
|
10434
10434
|
}
|
|
10435
10435
|
if (A) {
|
|
@@ -10442,20 +10442,20 @@ class Ii {
|
|
|
10442
10442
|
context: {
|
|
10443
10443
|
transactionOwnerId: r
|
|
10444
10444
|
}
|
|
10445
|
-
}), B =
|
|
10445
|
+
}), B = uA(A);
|
|
10446
10446
|
if (await Promise.all([g, B]), this.experienceOptions.workflow = await B, e) {
|
|
10447
10447
|
const d = JSON.parse(e);
|
|
10448
|
-
this.experienceOptions.layouts = Object.values(d.layouts).map((w) => w.layout), await
|
|
10448
|
+
this.experienceOptions.layouts = Object.values(d.layouts).map((w) => w.layout), await AA(d), await eA(d), this.experienceOptions.reloadedState = d;
|
|
10449
10449
|
} else
|
|
10450
10450
|
this.experienceOptions.layouts = OA(
|
|
10451
10451
|
this.experienceOptions.transaction,
|
|
10452
10452
|
this.experienceOptions.workflow
|
|
10453
10453
|
);
|
|
10454
|
-
this.experienceOptions.previewService = t && t(await B), this.experienceOptions.renderableContextService = new
|
|
10454
|
+
this.experienceOptions.previewService = t && t(await B), this.experienceOptions.renderableContextService = new CA(this.experienceOptions.layouts), (i = this.experienceOptions.product) != null && i.modelUrl && (this.experienceOptions.modelContainer = (s = this.experienceOptions.previewService) == null ? void 0 : s.loadModel({
|
|
10455
10455
|
model: this.experienceOptions.product.modelUrl,
|
|
10456
10456
|
contextService: this.experienceOptions.renderableContextService
|
|
10457
10457
|
}));
|
|
10458
|
-
const l = new
|
|
10458
|
+
const l = new hA(this, this.experienceOptions);
|
|
10459
10459
|
return await l.getWorkflowManager().getInitializationPromise(), l;
|
|
10460
10460
|
}
|
|
10461
10461
|
throw new U("No workflow ID provided.");
|
|
@@ -10486,6 +10486,9 @@ class Ii {
|
|
|
10486
10486
|
throw new U("Cannot get transaction: Not initialized.");
|
|
10487
10487
|
return this.experienceOptions.transaction;
|
|
10488
10488
|
}
|
|
10489
|
+
configureUrls(A, e, t) {
|
|
10490
|
+
q.setHubUrl(A), q.setServerUrl(e), q.setServicesApiUrl(t);
|
|
10491
|
+
}
|
|
10489
10492
|
storeCustomer(A) {
|
|
10490
10493
|
const e = x.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
|
|
10491
10494
|
e.set(A.partner.id, A.id), x.setMap("partnerCustomerIds", e);
|
|
@@ -10688,7 +10691,7 @@ class fi extends W {
|
|
|
10688
10691
|
}
|
|
10689
10692
|
export {
|
|
10690
10693
|
Ji as ArrayInput,
|
|
10691
|
-
|
|
10694
|
+
_ as AssetNotFoundError,
|
|
10692
10695
|
Oi as AssetType,
|
|
10693
10696
|
zi as BringForwardCommand,
|
|
10694
10697
|
Ki as BringToBackCommand,
|
|
@@ -10701,7 +10704,7 @@ export {
|
|
|
10701
10704
|
Xi as CreateElementCommand,
|
|
10702
10705
|
qi as CreateLayoutCommand,
|
|
10703
10706
|
Zi as DeleteElementCommand,
|
|
10704
|
-
|
|
10707
|
+
QA as FlowExecutionNodeResult,
|
|
10705
10708
|
ni as FlowExecutionResult,
|
|
10706
10709
|
ti as FlowService,
|
|
10707
10710
|
$i as FontAlignmentCommand,
|
|
@@ -10722,24 +10725,24 @@ export {
|
|
|
10722
10725
|
as as LayoutElementType,
|
|
10723
10726
|
z as LayoutNotFoundError,
|
|
10724
10727
|
$n as MaterialStepHandle,
|
|
10725
|
-
|
|
10728
|
+
yA as MisconfigurationError,
|
|
10726
10729
|
bi as MockWorkflowManager,
|
|
10727
10730
|
_n as ModelStepHandle,
|
|
10728
10731
|
is as MoveCommand,
|
|
10729
10732
|
dt as ObjectInput,
|
|
10730
10733
|
ai as ObjectInputType,
|
|
10731
|
-
|
|
10732
|
-
|
|
10734
|
+
MA as OptionNotFoundError,
|
|
10735
|
+
oA as ParseError,
|
|
10733
10736
|
Aa as PictureStepHandle,
|
|
10734
10737
|
on as ProductCameraRig,
|
|
10735
10738
|
$a as ProductCollection,
|
|
10736
10739
|
ZA as ProductWorkflow,
|
|
10737
|
-
|
|
10740
|
+
gA as PromiseCache,
|
|
10738
10741
|
Xe as PromiseQueue,
|
|
10739
10742
|
ea as QuestionStepHandle,
|
|
10740
10743
|
We as QueueablePromise,
|
|
10741
10744
|
ss as ResizeCommand,
|
|
10742
|
-
|
|
10745
|
+
cA as ResourceNotFoundError,
|
|
10743
10746
|
os as RotateCommand,
|
|
10744
10747
|
rs as SendBackwardsCommand,
|
|
10745
10748
|
ta as ShapeStepHandle,
|
|
@@ -10756,7 +10759,7 @@ export {
|
|
|
10756
10759
|
k as UnhandledBehaviorError,
|
|
10757
10760
|
Bs as UnitOfMeasurement,
|
|
10758
10761
|
X as Variant,
|
|
10759
|
-
|
|
10762
|
+
hA as WorkflowExperienceImpl,
|
|
10760
10763
|
O as assetService,
|
|
10761
10764
|
ga as createDesign,
|
|
10762
10765
|
ds as dataUrlFromExternalUrl,
|
|
@@ -10775,10 +10778,10 @@ export {
|
|
|
10775
10778
|
mn as getBoundedOffsets,
|
|
10776
10779
|
Is as getFrameData,
|
|
10777
10780
|
ps as getSvgElement,
|
|
10778
|
-
|
|
10781
|
+
uA as getWorkflow,
|
|
10779
10782
|
wt as getWorkflows,
|
|
10780
10783
|
P as graphQlManager,
|
|
10781
|
-
|
|
10784
|
+
pA as illustrationStepService,
|
|
10782
10785
|
fs as loadFont,
|
|
10783
10786
|
Ze as materialStepService,
|
|
10784
10787
|
$e as modelStepService,
|
|
@@ -10792,9 +10795,9 @@ export {
|
|
|
10792
10795
|
Ms as registerWindowImplementation,
|
|
10793
10796
|
ys as rehydrateSerializedLayout,
|
|
10794
10797
|
Ys as setCanvasModule,
|
|
10795
|
-
|
|
10798
|
+
rA as shapeStepService,
|
|
10796
10799
|
pn as shortenUrl,
|
|
10797
|
-
|
|
10800
|
+
q as spiffCoreConfiguration,
|
|
10798
10801
|
Gi as stepAspectValuesToDesignInputSteps,
|
|
10799
10802
|
K as textStepService,
|
|
10800
10803
|
Un as toast
|