@spiffcommerce/core 40.1.1 → 40.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +23 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +154 -156
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4054,7 +4054,7 @@ class Yr {
|
|
|
4054
4054
|
return e || (t.material ? t.material.id : "");
|
|
4055
4055
|
}
|
|
4056
4056
|
}
|
|
4057
|
-
const
|
|
4057
|
+
const I = new Yr(), Wn = C`
|
|
4058
4058
|
fragment ActiveIntegrationFields on Integration {
|
|
4059
4059
|
id
|
|
4060
4060
|
logo
|
|
@@ -5245,7 +5245,7 @@ const B = new Yr(), Wn = C`
|
|
|
5245
5245
|
let l = 0;
|
|
5246
5246
|
if (o.type !== "Finish" && o.type !== "Module") {
|
|
5247
5247
|
let c;
|
|
5248
|
-
o.option?.variants ? (c = o.option, l = c?.variants?.length || 0) : (c = await
|
|
5248
|
+
o.option?.variants ? (c = o.option, l = c?.variants?.length || 0) : (c = await I.getOption(o.option?.id), l = c?.variants?.length || 0);
|
|
5249
5249
|
}
|
|
5250
5250
|
o.silent || (o.type === E.Model || o.type === E.Material || o.type === E.Picture || o.type === E.Shape ? (l > 1 || e) && n.push(o.stepName) : n.push(o.stepName));
|
|
5251
5251
|
}
|
|
@@ -5351,9 +5351,9 @@ const N = () => {
|
|
|
5351
5351
|
viewBox: u,
|
|
5352
5352
|
width: A
|
|
5353
5353
|
}) => {
|
|
5354
|
-
const h = e || 0, g = 2 * (l?.scale || 1), p = u || { x: 0, y: 0, width: A, height: r }, m = `${p.x} ${p.y} ${p.width} ${p.height}`, f = N(), y = a.purpose === _t.FreeDesign && /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ F("rect", { width: p.width, height: p.height, rx: h }) }) }), w = a.colorProfiles?.map((v,
|
|
5354
|
+
const h = e || 0, g = 2 * (l?.scale || 1), p = u || { x: 0, y: 0, width: A, height: r }, m = `${p.x} ${p.y} ${p.width} ${p.height}`, f = N(), y = a.purpose === _t.FreeDesign && /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ F("rect", { width: p.width, height: p.height, rx: h }) }) }), w = a.colorProfiles?.map((v, B) => (
|
|
5355
5355
|
/* @ts-ignore */
|
|
5356
|
-
/* @__PURE__ */ F("color-profile", { name: v.name, xlinkHref: v.key, children: " " },
|
|
5356
|
+
/* @__PURE__ */ F("color-profile", { name: v.name, xlinkHref: v.key, children: " " }, B)
|
|
5357
5357
|
)), x = n.map((v) => ({
|
|
5358
5358
|
...v,
|
|
5359
5359
|
_renderingConfiguration: a,
|
|
@@ -5757,8 +5757,8 @@ const Is = (i) => i.substring(0, 5).toLowerCase().trim() === "data:", _e = /* @_
|
|
|
5757
5757
|
parseInt(A.getAttribute("font-size") ?? "72")
|
|
5758
5758
|
), b = x.getBoundingBox().x2 - x.getBoundingBox().x1;
|
|
5759
5759
|
let v = 0;
|
|
5760
|
-
const
|
|
5761
|
-
|
|
5760
|
+
const B = u.getAttribute("text-anchor");
|
|
5761
|
+
B === "middle" ? v = b / 2 : B === "end" && (v = b);
|
|
5762
5762
|
const M = p.getPath(
|
|
5763
5763
|
m,
|
|
5764
5764
|
parseFloat(u.getAttribute("x") ?? "0") - v,
|
|
@@ -6211,7 +6211,7 @@ const mt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map(), Ze = /* @_
|
|
|
6211
6211
|
}, $s = async (i, t) => {
|
|
6212
6212
|
if (!t)
|
|
6213
6213
|
return;
|
|
6214
|
-
const e = await
|
|
6214
|
+
const e = await I.getDefaultVariant(t, i.frameVariantId);
|
|
6215
6215
|
if (!e)
|
|
6216
6216
|
throw new Error(`No variant with ID: ${i.frameVariantId}`);
|
|
6217
6217
|
if (!e.asset)
|
|
@@ -7462,7 +7462,7 @@ class De {
|
|
|
7462
7462
|
}
|
|
7463
7463
|
async init(t, e, a) {
|
|
7464
7464
|
const n = a?.serializableWorkflow.steps.find(
|
|
7465
|
-
(
|
|
7465
|
+
(l) => l.stepName === t.stepName
|
|
7466
7466
|
);
|
|
7467
7467
|
if (n?.storage && Object.keys(n.storage).length !== 0 || n?.selectedVariants && n.selectedVariants.length !== 0)
|
|
7468
7468
|
return await this.reload(t, e, a), null;
|
|
@@ -7470,24 +7470,22 @@ class De {
|
|
|
7470
7470
|
let r;
|
|
7471
7471
|
const s = e.getWorkflowExperience().getBundle();
|
|
7472
7472
|
if (s && t.globalPropertyAspectConfigurations) {
|
|
7473
|
-
const
|
|
7474
|
-
|
|
7473
|
+
const l = s.getGlobalPropertyStateManager(), c = t.globalPropertyAspectConfigurations[0], d = l.getAspectStorage(c.aspectName);
|
|
7474
|
+
d && d.originalAssetKey && (r = (await H.getLocalOrFromServer(d.originalAssetKey)).fileLink);
|
|
7475
7475
|
}
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
);
|
|
7481
|
-
if (o)
|
|
7476
|
+
const o = await I.getOptionForStep(t);
|
|
7477
|
+
if (o) {
|
|
7478
|
+
const l = await I.getDefaultVariant(o, t.overrideDefaultVariantId);
|
|
7479
|
+
if (l)
|
|
7482
7480
|
return this.selectVariantCommand(
|
|
7483
7481
|
t,
|
|
7484
|
-
|
|
7482
|
+
l,
|
|
7485
7483
|
[],
|
|
7486
7484
|
e,
|
|
7487
7485
|
void 0,
|
|
7488
7486
|
r || t.data.placeholderImageUrl
|
|
7489
7487
|
);
|
|
7490
|
-
if (
|
|
7488
|
+
if (o.variants && o.variants?.length !== 0) return null;
|
|
7491
7489
|
}
|
|
7492
7490
|
return this.selectVariantCommand(
|
|
7493
7491
|
t,
|
|
@@ -7502,59 +7500,59 @@ class De {
|
|
|
7502
7500
|
const n = e.getSerializedStep(
|
|
7503
7501
|
t.stepName,
|
|
7504
7502
|
a.serializableWorkflow.steps
|
|
7505
|
-
), l = Object.values(a.layouts).map((
|
|
7506
|
-
id:
|
|
7507
|
-
region:
|
|
7508
|
-
regionIndex:
|
|
7509
|
-
}));
|
|
7510
|
-
if (!
|
|
7511
|
-
const
|
|
7503
|
+
), l = Object.values(a.layouts).map((d) => d.elements).flat().filter((d) => d.stepName === t.stepName).map((d) => ({
|
|
7504
|
+
id: d.id,
|
|
7505
|
+
region: d.stepRegion,
|
|
7506
|
+
regionIndex: d.stepRegionIndex
|
|
7507
|
+
})), c = await I.getOptionForStep(t);
|
|
7508
|
+
if (!c || (c.variants || []).length === 0) {
|
|
7509
|
+
const d = t.data.regions.map((u) => fa(u));
|
|
7512
7510
|
e.updateStorage(t.stepName, {
|
|
7513
|
-
currentFrameSources:
|
|
7511
|
+
currentFrameSources: d
|
|
7514
7512
|
});
|
|
7515
7513
|
}
|
|
7516
7514
|
if (n) {
|
|
7517
|
-
const
|
|
7518
|
-
const
|
|
7515
|
+
const d = async () => {
|
|
7516
|
+
const u = n.storage?.colors, A = n.storage?.framePatternSrc, h = n.storage?.frameOffsetsList;
|
|
7519
7517
|
if (e.updateMetadata(t.stepName, {
|
|
7520
|
-
frameOffsetsList:
|
|
7521
|
-
framePatternSrc:
|
|
7522
|
-
}),
|
|
7523
|
-
const
|
|
7524
|
-
if (!
|
|
7525
|
-
await this.loadPatternFromString(
|
|
7526
|
-
framePatternSrc:
|
|
7518
|
+
frameOffsetsList: h,
|
|
7519
|
+
framePatternSrc: A
|
|
7520
|
+
}), A) {
|
|
7521
|
+
const g = e.getWorkflowExperience().getStepById(t.stepName)?.frameService;
|
|
7522
|
+
if (!g) throw new Error("Frame service unavailable, cannot load pattern!");
|
|
7523
|
+
await this.loadPatternFromString(A, g, !0, u), e.updateMetadata(t.stepName, { image: A }), e.updateStorage(t.stepName, {
|
|
7524
|
+
framePatternSrc: A
|
|
7527
7525
|
}), this.validateColorCount(t, e);
|
|
7528
7526
|
}
|
|
7529
|
-
if (
|
|
7530
|
-
const
|
|
7531
|
-
if (!
|
|
7532
|
-
|
|
7527
|
+
if (h?.some((g) => g.zoom)) {
|
|
7528
|
+
const g = e.getWorkflowExperience().getStepById(t.stepName)?.frameService;
|
|
7529
|
+
if (!g) throw new Error("Frame service unavailable, cannot load pattern!");
|
|
7530
|
+
g.updateOffsets(h);
|
|
7533
7531
|
}
|
|
7534
7532
|
e.setMandatoryFulfilled(t.stepName, !0);
|
|
7535
7533
|
};
|
|
7536
7534
|
if (n.selectedVariants && n.selectedVariants.length > 0) {
|
|
7537
|
-
const
|
|
7538
|
-
if (
|
|
7539
|
-
const
|
|
7540
|
-
|
|
7535
|
+
const u = n.selectedVariants[0].id;
|
|
7536
|
+
if (c && u) {
|
|
7537
|
+
const A = c.variants?.find((h) => h.id === u);
|
|
7538
|
+
A && await e.setSelectionsAndElements(
|
|
7541
7539
|
t.stepName,
|
|
7542
|
-
[
|
|
7540
|
+
[A],
|
|
7543
7541
|
l,
|
|
7544
7542
|
async () => {
|
|
7545
|
-
const
|
|
7546
|
-
t.data.regions.map((
|
|
7543
|
+
const h = await Promise.all(
|
|
7544
|
+
t.data.regions.map((g) => this.frameSourceSvg(A, g))
|
|
7547
7545
|
);
|
|
7548
|
-
e.updateStorage(t.stepName, { currentFrameSources:
|
|
7546
|
+
e.updateStorage(t.stepName, { currentFrameSources: h }), await d();
|
|
7549
7547
|
}
|
|
7550
7548
|
);
|
|
7551
7549
|
}
|
|
7552
7550
|
} else
|
|
7553
|
-
await e.setSelectionsAndElements(t.stepName, [], l,
|
|
7551
|
+
await e.setSelectionsAndElements(t.stepName, [], l, d);
|
|
7554
7552
|
}
|
|
7555
7553
|
}
|
|
7556
7554
|
async availableColors(t, e) {
|
|
7557
|
-
return (await
|
|
7555
|
+
return (await I.ensureFullOption(t.data.colorOption))?.variants?.map((n) => ({
|
|
7558
7556
|
fill: n.color,
|
|
7559
7557
|
stroke: n.color,
|
|
7560
7558
|
variant: n,
|
|
@@ -7704,7 +7702,7 @@ class De {
|
|
|
7704
7702
|
for (const [l, c] of a.entries())
|
|
7705
7703
|
n[l] = { browserValue: c.browserValue, pmsValue: c.pmsValue }, r[l] = c;
|
|
7706
7704
|
let s = Array.from(Object.values(n)).map((l) => l.browserValue);
|
|
7707
|
-
const o = await
|
|
7705
|
+
const o = await I.ensureFullOption(e.data.colorOption);
|
|
7708
7706
|
return o && o.variants?.forEach((l) => {
|
|
7709
7707
|
s = s.map((c) => c.toLowerCase() === l.color?.toLowerCase() ? l.name : c);
|
|
7710
7708
|
}), {
|
|
@@ -7730,7 +7728,7 @@ class De {
|
|
|
7730
7728
|
r && r(!0);
|
|
7731
7729
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
|
7732
7730
|
t.data.regions.map(async (h, g) => {
|
|
7733
|
-
const p = await Le(l[g]), m = o.getImageData(), f = a.map((
|
|
7731
|
+
const p = await Le(l[g]), m = o.getImageData(), f = a.map((B) => new Ot(B.id)), y = m ? $a(
|
|
7734
7732
|
m,
|
|
7735
7733
|
p,
|
|
7736
7734
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
|
@@ -7745,7 +7743,7 @@ class De {
|
|
|
7745
7743
|
scaleX: y?.zoom || 1,
|
|
7746
7744
|
scaleY: y?.zoom || 1,
|
|
7747
7745
|
rotation: 0
|
|
7748
|
-
} : void 0, x = N(), v = n.getLayouts().find((
|
|
7746
|
+
} : void 0, x = N(), v = n.getLayouts().find((B) => B.panelId === h.panelId);
|
|
7749
7747
|
if (!v)
|
|
7750
7748
|
throw new J(h);
|
|
7751
7749
|
return {
|
|
@@ -7868,13 +7866,13 @@ class Ys {
|
|
|
7868
7866
|
}
|
|
7869
7867
|
}
|
|
7870
7868
|
async init(t, e, a) {
|
|
7871
|
-
const n = await
|
|
7869
|
+
const n = await I.getOptionForStep(t);
|
|
7872
7870
|
if (!n)
|
|
7873
7871
|
throw new At(t, "No option configured for illustration step.");
|
|
7874
7872
|
if (a)
|
|
7875
7873
|
return await this.reload(t, e, a);
|
|
7876
7874
|
{
|
|
7877
|
-
const r = await
|
|
7875
|
+
const r = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
7878
7876
|
if (r)
|
|
7879
7877
|
return await this.selectVariantCommand(t, r, [], e);
|
|
7880
7878
|
}
|
|
@@ -7884,7 +7882,7 @@ class Ys {
|
|
|
7884
7882
|
const n = e.getSerializedStep(
|
|
7885
7883
|
t.stepName,
|
|
7886
7884
|
a.serializableWorkflow.steps
|
|
7887
|
-
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await
|
|
7885
|
+
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await I.getOptionForStep(t);
|
|
7888
7886
|
if (n?.selectedVariants) {
|
|
7889
7887
|
const c = n.selectedVariants[0].id;
|
|
7890
7888
|
if (l && c) {
|
|
@@ -7911,7 +7909,7 @@ class Ys {
|
|
|
7911
7909
|
return null;
|
|
7912
7910
|
}
|
|
7913
7911
|
async availableColors(t, e) {
|
|
7914
|
-
const a = await
|
|
7912
|
+
const a = await I.ensureFullOption(t.data.colorOption);
|
|
7915
7913
|
return a ? a ? a.variants?.map((n) => ({
|
|
7916
7914
|
fill: n.color,
|
|
7917
7915
|
stroke: n.color,
|
|
@@ -7957,7 +7955,7 @@ class Ys {
|
|
|
7957
7955
|
}) : (s[A] = { browserValue: g, spotColor: s[A]?.spotColor, pmsValue: p }, o[A] = { browserValue: g });
|
|
7958
7956
|
}
|
|
7959
7957
|
let l = Array.from(Object.values(s)).map((A) => A.browserValue);
|
|
7960
|
-
const c = await
|
|
7958
|
+
const c = await I.ensureFullOption(t.data.colorOption);
|
|
7961
7959
|
c && c.variants?.forEach((A) => {
|
|
7962
7960
|
l = l.map((h) => h.toLowerCase() === A.color?.toLowerCase() ? A.name : h);
|
|
7963
7961
|
}), a.updateMetadata(t.stepName, { colors: l });
|
|
@@ -8012,7 +8010,7 @@ class Ys {
|
|
|
8012
8010
|
};
|
|
8013
8011
|
}, u = t.data.regions.map(d), A = u.map((m) => m.command), h = [...o, ...A];
|
|
8014
8012
|
let g = Array.from(Object.values(l.colors)).map((m) => m.browserValue);
|
|
8015
|
-
const p = await
|
|
8013
|
+
const p = await I.ensureFullOption(t.data.colorOption);
|
|
8016
8014
|
return p && p.variants?.forEach((m) => {
|
|
8017
8015
|
g = g.map((f) => f.toLowerCase() === m.color?.toLowerCase() ? m.name : f);
|
|
8018
8016
|
}), n.updateMetadata(t.stepName, { colors: g }), {
|
|
@@ -8053,13 +8051,13 @@ class Ys {
|
|
|
8053
8051
|
const ye = new Ys();
|
|
8054
8052
|
class Js {
|
|
8055
8053
|
async init(t, e, a) {
|
|
8056
|
-
const n = t
|
|
8054
|
+
const n = await I.getOptionForStep(t);
|
|
8057
8055
|
if (!n)
|
|
8058
8056
|
throw new Ie(t);
|
|
8059
8057
|
if (a)
|
|
8060
8058
|
await this.reload(t, e, a);
|
|
8061
8059
|
else {
|
|
8062
|
-
const r = await
|
|
8060
|
+
const r = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
8063
8061
|
if (r)
|
|
8064
8062
|
return await this.selectVariantLambda(t, r, e, () => {
|
|
8065
8063
|
});
|
|
@@ -8070,7 +8068,7 @@ class Js {
|
|
|
8070
8068
|
const n = e.getSerializedStep(
|
|
8071
8069
|
t.stepName,
|
|
8072
8070
|
a.serializableWorkflow.steps
|
|
8073
|
-
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = t
|
|
8071
|
+
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await I.getOptionForStep(t);
|
|
8074
8072
|
if (!l) throw new Ie(t);
|
|
8075
8073
|
if (n?.selectedVariants) {
|
|
8076
8074
|
const c = n.selectedVariants[0].id;
|
|
@@ -8131,12 +8129,12 @@ class Js {
|
|
|
8131
8129
|
const Ai = new Js();
|
|
8132
8130
|
class Ks {
|
|
8133
8131
|
async init(t, e, a) {
|
|
8134
|
-
const n = await
|
|
8132
|
+
const n = await I.getOptionForStep(t);
|
|
8135
8133
|
if (!n) throw new Ie(t);
|
|
8136
8134
|
if (a)
|
|
8137
8135
|
await this.reload(t, e, a);
|
|
8138
8136
|
else {
|
|
8139
|
-
const r = await
|
|
8137
|
+
const r = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
8140
8138
|
if (r)
|
|
8141
8139
|
return await this.selectVariantLambda(t, r, e, () => {
|
|
8142
8140
|
});
|
|
@@ -8147,7 +8145,7 @@ class Ks {
|
|
|
8147
8145
|
const n = e.getSerializedStep(
|
|
8148
8146
|
t.stepName,
|
|
8149
8147
|
a.serializableWorkflow.steps
|
|
8150
|
-
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await
|
|
8148
|
+
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await I.getOptionForStep(t);
|
|
8151
8149
|
if (n?.selectedVariants) {
|
|
8152
8150
|
const c = n.selectedVariants[0].id;
|
|
8153
8151
|
if (l && c) {
|
|
@@ -8337,13 +8335,13 @@ class _s {
|
|
|
8337
8335
|
const gi = new _s();
|
|
8338
8336
|
class Xs {
|
|
8339
8337
|
async init(t, e, a) {
|
|
8340
|
-
const n = await
|
|
8338
|
+
const n = await I.getOptionForStep(t);
|
|
8341
8339
|
if (!n)
|
|
8342
8340
|
throw new At(t, "Missing option for picture step");
|
|
8343
8341
|
if (a)
|
|
8344
8342
|
await this.reload(t, e, a);
|
|
8345
8343
|
else {
|
|
8346
|
-
const r = await
|
|
8344
|
+
const r = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
8347
8345
|
if (r)
|
|
8348
8346
|
return e.markStepsAsInitialised([t.stepName]), this.selectVariantCommand(t, r, e, () => {
|
|
8349
8347
|
});
|
|
@@ -8354,7 +8352,7 @@ class Xs {
|
|
|
8354
8352
|
const n = e.getSerializedStep(
|
|
8355
8353
|
t.stepName,
|
|
8356
8354
|
a.serializableWorkflow.steps
|
|
8357
|
-
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await
|
|
8355
|
+
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await I.getOptionForStep(t);
|
|
8358
8356
|
if (n?.selectedVariants) {
|
|
8359
8357
|
const c = n.selectedVariants[0].id;
|
|
8360
8358
|
if (l && c) {
|
|
@@ -8429,13 +8427,13 @@ class Xs {
|
|
|
8429
8427
|
const mi = new Xs();
|
|
8430
8428
|
class Zs {
|
|
8431
8429
|
async init(t, e, a) {
|
|
8432
|
-
const n = t
|
|
8430
|
+
const n = await I.getOptionForStep(t);
|
|
8433
8431
|
if (!n)
|
|
8434
8432
|
throw new At(t, "Missing option for question step");
|
|
8435
8433
|
if (a)
|
|
8436
8434
|
await this.reload(t, e, a);
|
|
8437
8435
|
else {
|
|
8438
|
-
const r = await
|
|
8436
|
+
const r = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
8439
8437
|
if (r)
|
|
8440
8438
|
return this.selectVariantLambda(t, r.id || "", e);
|
|
8441
8439
|
}
|
|
@@ -8445,7 +8443,7 @@ class Zs {
|
|
|
8445
8443
|
const n = e.getSerializedStep(
|
|
8446
8444
|
t.stepName,
|
|
8447
8445
|
a.serializableWorkflow.steps
|
|
8448
|
-
), r = await
|
|
8446
|
+
), r = await I.getOptionForStep(t);
|
|
8449
8447
|
if (n?.selectedVariants) {
|
|
8450
8448
|
const s = n.selectedVariants[0].id;
|
|
8451
8449
|
if (r && s) {
|
|
@@ -8459,7 +8457,7 @@ class Zs {
|
|
|
8459
8457
|
n && (n.command && a.getCommandDispatcher()(n.command), n.followup && await n.followup());
|
|
8460
8458
|
}
|
|
8461
8459
|
async selectVariantLambda(t, e, a) {
|
|
8462
|
-
const n = await
|
|
8460
|
+
const n = await I.getOptionForStep(t);
|
|
8463
8461
|
if (!n)
|
|
8464
8462
|
throw new At(t, "Missing option for question step");
|
|
8465
8463
|
const r = n.variants;
|
|
@@ -8485,7 +8483,7 @@ class to {
|
|
|
8485
8483
|
}
|
|
8486
8484
|
// Get the step's options.
|
|
8487
8485
|
async availableColours(t) {
|
|
8488
|
-
const e = await
|
|
8486
|
+
const e = await I.getOptionForStep(t);
|
|
8489
8487
|
return e ? e.variants?.map((a) => ({
|
|
8490
8488
|
fill: a.color,
|
|
8491
8489
|
stroke: a.color,
|
|
@@ -8501,13 +8499,13 @@ class to {
|
|
|
8501
8499
|
a.getCommandDispatcher()(new U(s)), a.updateStorage(e.stepName, { colour: t });
|
|
8502
8500
|
}
|
|
8503
8501
|
async init(t, e, a) {
|
|
8504
|
-
const n = await
|
|
8502
|
+
const n = await I.getOptionForStep(t);
|
|
8505
8503
|
if (!n)
|
|
8506
8504
|
throw new Ie(t);
|
|
8507
8505
|
if (a)
|
|
8508
8506
|
await this.reload(t, e, a);
|
|
8509
8507
|
else {
|
|
8510
|
-
const r = await
|
|
8508
|
+
const r = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
8511
8509
|
return r ? this.selectVariantCommand(
|
|
8512
8510
|
t,
|
|
8513
8511
|
{
|
|
@@ -8529,7 +8527,7 @@ class to {
|
|
|
8529
8527
|
const n = e.getSerializedStep(
|
|
8530
8528
|
t.stepName,
|
|
8531
8529
|
a.serializableWorkflow.steps
|
|
8532
|
-
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await
|
|
8530
|
+
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await I.getOptionForStep(t);
|
|
8533
8531
|
if (n?.selectedVariants) {
|
|
8534
8532
|
const c = n.selectedVariants[0].id;
|
|
8535
8533
|
if (l && c) {
|
|
@@ -8764,7 +8762,7 @@ class io {
|
|
|
8764
8762
|
};
|
|
8765
8763
|
}
|
|
8766
8764
|
async init(t, e, a) {
|
|
8767
|
-
const n = await
|
|
8765
|
+
const n = await I.getOptionForStep(t);
|
|
8768
8766
|
if (!n)
|
|
8769
8767
|
return null;
|
|
8770
8768
|
if (a)
|
|
@@ -8802,7 +8800,7 @@ class io {
|
|
|
8802
8800
|
fillImage: r?.name,
|
|
8803
8801
|
strokeColor: t.data.strokeEnabled ? c?.color : void 0
|
|
8804
8802
|
});
|
|
8805
|
-
const h = await
|
|
8803
|
+
const h = await I.getDefaultVariant(n, t.overrideDefaultVariantId);
|
|
8806
8804
|
if (h)
|
|
8807
8805
|
return this.selectVariantCommand(
|
|
8808
8806
|
t,
|
|
@@ -8832,7 +8830,7 @@ class io {
|
|
|
8832
8830
|
const e = this.cachedColors.get(t.stepName);
|
|
8833
8831
|
if (e)
|
|
8834
8832
|
return e;
|
|
8835
|
-
const a = await
|
|
8833
|
+
const a = await I.ensureFullOption(t.data.colorOption);
|
|
8836
8834
|
if (a) {
|
|
8837
8835
|
const n = a.variants?.map((r) => ({
|
|
8838
8836
|
fill: r.color,
|
|
@@ -8857,7 +8855,7 @@ class io {
|
|
|
8857
8855
|
return;
|
|
8858
8856
|
const r = n.getCommandDispatcher();
|
|
8859
8857
|
e.variant ? n.updateMetadata(t.stepName, { color: e.variant.name }) : n.updateMetadata(t.stepName, { color: e.fill });
|
|
8860
|
-
const s = await
|
|
8858
|
+
const s = await I.ensureFullOption(t.data.colorOption), o = s ? this.createTextFillSpotColor(s, e.variant) : void 0;
|
|
8861
8859
|
s ? n.updateStorage(t.stepName, {
|
|
8862
8860
|
color: e.fill,
|
|
8863
8861
|
colorProfileAssetKey: s.colorProfile?.key
|
|
@@ -8872,7 +8870,7 @@ class io {
|
|
|
8872
8870
|
}
|
|
8873
8871
|
}
|
|
8874
8872
|
async availableFillImages(t) {
|
|
8875
|
-
const e = await
|
|
8873
|
+
const e = await I.ensureFullOption(t.data.imageFillOption);
|
|
8876
8874
|
if (e) {
|
|
8877
8875
|
const a = e.variants?.map((n) => n.asset?.fileLink)?.filter((n) => !!n) || [];
|
|
8878
8876
|
return Promise.all(
|
|
@@ -8892,13 +8890,13 @@ class io {
|
|
|
8892
8890
|
async changeFillImage(t, e, a, n) {
|
|
8893
8891
|
if (!t.data || !t.data.regions)
|
|
8894
8892
|
return;
|
|
8895
|
-
const r = n.getCommandDispatcher(),
|
|
8896
|
-
n.updateMetadata(t.stepName, { fillImage:
|
|
8893
|
+
const r = n.getCommandDispatcher(), o = (await I.getOptionForStep(t))?.variants?.find((l) => l.asset?.fileLink === e.src);
|
|
8894
|
+
n.updateMetadata(t.stepName, { fillImage: o?.name }), n.updateStorage(t.stepName, {
|
|
8897
8895
|
fillImage: e
|
|
8898
8896
|
});
|
|
8899
|
-
for (const
|
|
8900
|
-
const
|
|
8901
|
-
r(
|
|
8897
|
+
for (const l of a) {
|
|
8898
|
+
const c = new ea(l.id, e);
|
|
8899
|
+
r(c);
|
|
8902
8900
|
}
|
|
8903
8901
|
}
|
|
8904
8902
|
/**
|
|
@@ -8910,7 +8908,7 @@ class io {
|
|
|
8910
8908
|
const e = this.cachedStrokeColors.get(t.stepName);
|
|
8911
8909
|
if (e)
|
|
8912
8910
|
return e;
|
|
8913
|
-
const a = await
|
|
8911
|
+
const a = await I.ensureFullOption(t.data.strokeOption);
|
|
8914
8912
|
if (a) {
|
|
8915
8913
|
const n = a.variants?.map((r) => ({
|
|
8916
8914
|
fill: r.color,
|
|
@@ -9000,7 +8998,7 @@ class io {
|
|
|
9000
8998
|
const n = e.getSerializedStep(
|
|
9001
8999
|
t.stepName,
|
|
9002
9000
|
a.serializableWorkflow.steps
|
|
9003
|
-
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await
|
|
9001
|
+
), o = Object.values(a.layouts).map((c) => c.elements).flat().filter((c) => c.stepName === t.stepName), l = await I.getOptionForStep(t);
|
|
9004
9002
|
if (n?.selectedVariants) {
|
|
9005
9003
|
const c = n.selectedVariants[0].id;
|
|
9006
9004
|
if (l && c) {
|
|
@@ -9032,7 +9030,7 @@ class io {
|
|
|
9032
9030
|
e.getCommandDispatcher()(f);
|
|
9033
9031
|
}
|
|
9034
9032
|
), o.length === 0 && l) {
|
|
9035
|
-
const m = await
|
|
9033
|
+
const m = await I.getDefaultVariant(
|
|
9036
9034
|
l,
|
|
9037
9035
|
t.overrideDefaultVariantId
|
|
9038
9036
|
);
|
|
@@ -9071,7 +9069,7 @@ class io {
|
|
|
9071
9069
|
const h = c.getGlobalPropertyStateManager().getAspect(u.name);
|
|
9072
9070
|
if (h)
|
|
9073
9071
|
if (o.length === 0 && l) {
|
|
9074
|
-
const g = await
|
|
9072
|
+
const g = await I.getDefaultVariant(
|
|
9075
9073
|
l,
|
|
9076
9074
|
t.overrideDefaultVariantId
|
|
9077
9075
|
);
|
|
@@ -9105,21 +9103,21 @@ class io {
|
|
|
9105
9103
|
async getDefaultColorVariant(t) {
|
|
9106
9104
|
const e = t.colorOption;
|
|
9107
9105
|
if (e)
|
|
9108
|
-
return
|
|
9106
|
+
return I.getDefaultVariant(e);
|
|
9109
9107
|
}
|
|
9110
9108
|
async getDefaultColor(t) {
|
|
9111
9109
|
const e = t.colorOption;
|
|
9112
|
-
return e ? (await
|
|
9110
|
+
return e ? (await I.getDefaultVariant(e))?.color : void 0;
|
|
9113
9111
|
}
|
|
9114
9112
|
async getDefaultImageFillVariant(t) {
|
|
9115
9113
|
const e = t.imageFillOption;
|
|
9116
9114
|
if (e)
|
|
9117
|
-
return
|
|
9115
|
+
return I.getDefaultVariant(e);
|
|
9118
9116
|
}
|
|
9119
9117
|
async getDefaultStrokeColorVariant(t) {
|
|
9120
9118
|
const e = t.strokeOption;
|
|
9121
9119
|
if (e)
|
|
9122
|
-
return
|
|
9120
|
+
return I.getDefaultVariant(e);
|
|
9123
9121
|
}
|
|
9124
9122
|
async fontDataFromVariant(t) {
|
|
9125
9123
|
const e = t.asset;
|
|
@@ -9226,10 +9224,10 @@ class io {
|
|
|
9226
9224
|
try {
|
|
9227
9225
|
if (!p)
|
|
9228
9226
|
throw new Me("Failed to find layout for region: " + A.panelId);
|
|
9229
|
-
const f = await
|
|
9227
|
+
const f = await I.ensureFullOption(a.colorOption);
|
|
9230
9228
|
let y;
|
|
9231
9229
|
if (f && f.variants) {
|
|
9232
|
-
const k = await
|
|
9230
|
+
const k = await I.getDefaultVariant(f);
|
|
9233
9231
|
k && (y = this.createTextFillSpotColor(f, k), s.updateStorage(t, {
|
|
9234
9232
|
colorProfileAssetKey: f.colorProfile?.key
|
|
9235
9233
|
}));
|
|
@@ -9259,7 +9257,7 @@ class io {
|
|
|
9259
9257
|
curved: a.curved,
|
|
9260
9258
|
paths: a.paths,
|
|
9261
9259
|
fillSpotColorDefinition: y
|
|
9262
|
-
}, v = [],
|
|
9260
|
+
}, v = [], B = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
|
|
9263
9261
|
if (!b.fontData) throw new O("Failed to resolve font data for text.");
|
|
9264
9262
|
const [R, P] = Se(
|
|
9265
9263
|
b.fontSize,
|
|
@@ -9275,7 +9273,7 @@ class io {
|
|
|
9275
9273
|
[c],
|
|
9276
9274
|
{ size: a.size, minSize: a.minSize, maxSize: a.maxSize }
|
|
9277
9275
|
);
|
|
9278
|
-
|
|
9276
|
+
B.set(b.id, R), M.set(b.id, P);
|
|
9279
9277
|
const T = a.curved || a.vertical ? c : (P || []).join(`
|
|
9280
9278
|
`);
|
|
9281
9279
|
v.push(
|
|
@@ -9322,31 +9320,31 @@ class io {
|
|
|
9322
9320
|
const u = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), A = Dt(u, s), h = this.getProcessedInput(A, t.data, o), g = s.getRegionElements(t.stepName), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
9323
9321
|
for (const b of g)
|
|
9324
9322
|
if (b.region) {
|
|
9325
|
-
const [v,
|
|
9323
|
+
const [v, B] = Se(
|
|
9326
9324
|
e,
|
|
9327
9325
|
a,
|
|
9328
9326
|
b.region,
|
|
9329
9327
|
[h],
|
|
9330
9328
|
{ size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
|
|
9331
9329
|
);
|
|
9332
|
-
p.set(b.id, v), m.set(b.id,
|
|
9330
|
+
p.set(b.id, v), m.set(b.id, B);
|
|
9333
9331
|
}
|
|
9334
9332
|
const y = (() => {
|
|
9335
9333
|
if (t.data && t.data.maxLength && h.length > t.data.maxLength)
|
|
9336
9334
|
return d && d(!0), { info: "0" };
|
|
9337
9335
|
const b = s.getWorkflowExperience().getProfanityList(), v = ua(h.toLowerCase());
|
|
9338
|
-
for (const
|
|
9336
|
+
for (const B of v)
|
|
9339
9337
|
for (const M in b) {
|
|
9340
9338
|
const R = b[M].toLowerCase().replace(/\s/g, "");
|
|
9341
|
-
if (
|
|
9339
|
+
if (B === R) {
|
|
9342
9340
|
const T = "Blocked profanity.";
|
|
9343
9341
|
return l(T), { error: T };
|
|
9344
9342
|
}
|
|
9345
9343
|
}
|
|
9346
9344
|
if (!t.data.vertical && !t.data.allowNewlines && (h.includes(`
|
|
9347
9345
|
`) || h.includes("\r"))) {
|
|
9348
|
-
const
|
|
9349
|
-
return l(
|
|
9346
|
+
const B = "Text may not span multiple lines.";
|
|
9347
|
+
return l(B), { error: B };
|
|
9350
9348
|
}
|
|
9351
9349
|
if (!t.data.curved && !Array.from(m.values()).every((M) => M)) {
|
|
9352
9350
|
const M = "Text does not fit.";
|
|
@@ -9544,8 +9542,8 @@ class go extends ro {
|
|
|
9544
9542
|
b.setAttribute("d", d), b.setAttribute("stroke", "black"), b.setAttribute("stroke-width", "3"), x.appendChild(b);
|
|
9545
9543
|
const v = et("g");
|
|
9546
9544
|
v.classList.add("module-layer0"), w.appendChild(v), v.setAttribute("filter", "url(#shadow)"), v.innerHTML = b.outerHTML;
|
|
9547
|
-
const
|
|
9548
|
-
|
|
9545
|
+
const B = et("g");
|
|
9546
|
+
B.classList.add("module-layer1"), w.appendChild(B), B.setAttribute("stroke-width", "3"), B.setAttribute("stroke", "rgb(45,41,38)"), B.setAttribute("fill", "rgb(45,41,38)"), B.setAttribute("transform", "translate(0.5,0)"), B.innerHTML = o;
|
|
9549
9547
|
const M = et("g");
|
|
9550
9548
|
M.classList.add("module-layer2"), w.appendChild(M), M.setAttribute("fill", "rgb(255,209,0)"), M.setAttribute("transform", "translate(1,-0.1)"), M.innerHTML = o;
|
|
9551
9549
|
const R = et("g");
|
|
@@ -9668,10 +9666,10 @@ const mo = [
|
|
|
9668
9666
|
return console.error(o), [];
|
|
9669
9667
|
}
|
|
9670
9668
|
}, Co = async (i, t, e, a) => {
|
|
9671
|
-
const n = e.data, r = a
|
|
9669
|
+
const n = e.data, r = await I.getOptionForStep(a);
|
|
9672
9670
|
if (!r)
|
|
9673
9671
|
return console.error(`No option for step ${a.stepName}.`), [];
|
|
9674
|
-
const s = r.variants?.find((b) => b.id === n.illustrationVariantId) || await
|
|
9672
|
+
const s = r.variants?.find((b) => b.id === n.illustrationVariantId) || await I.getDefaultVariant(r, a.overrideDefaultVariantId);
|
|
9675
9673
|
if (!s)
|
|
9676
9674
|
return console.error(`No variant with ID: ${n.illustrationVariantId}`), [];
|
|
9677
9675
|
if (!s.asset)
|
|
@@ -9692,18 +9690,18 @@ const mo = [
|
|
|
9692
9690
|
const M = v.value, P = `spiff-fill-${M.replace(/\W/g, "")}`;
|
|
9693
9691
|
b.classList.add(P), p[P] = { browserValue: M };
|
|
9694
9692
|
}
|
|
9695
|
-
const
|
|
9696
|
-
if (
|
|
9697
|
-
const M =
|
|
9693
|
+
const B = b.attributes.getNamedItem("stroke");
|
|
9694
|
+
if (B && B.value !== "none") {
|
|
9695
|
+
const M = B.value, P = `spiff-stroke-${M.replace(/\W/g, "")}`;
|
|
9698
9696
|
b.classList.add(P), p[P] = { browserValue: M };
|
|
9699
9697
|
}
|
|
9700
9698
|
});
|
|
9701
9699
|
const f = Pt().serializeToString(g), y = n.colors;
|
|
9702
9700
|
if (y) {
|
|
9703
9701
|
for (const [b, v] of Object.entries(p))
|
|
9704
|
-
for (const
|
|
9705
|
-
if (v.browserValue ===
|
|
9706
|
-
p[b] = { browserValue: y[
|
|
9702
|
+
for (const B of Object.keys(y))
|
|
9703
|
+
if (v.browserValue === B) {
|
|
9704
|
+
p[b] = { browserValue: y[B] };
|
|
9707
9705
|
break;
|
|
9708
9706
|
}
|
|
9709
9707
|
}
|
|
@@ -9711,11 +9709,11 @@ const mo = [
|
|
|
9711
9709
|
const v = i.find((M) => M.panelId === b.panelId);
|
|
9712
9710
|
if (!v)
|
|
9713
9711
|
throw new J(b);
|
|
9714
|
-
const
|
|
9712
|
+
const B = N();
|
|
9715
9713
|
return new W(
|
|
9716
9714
|
{
|
|
9717
9715
|
colors: p,
|
|
9718
|
-
id:
|
|
9716
|
+
id: B,
|
|
9719
9717
|
svg: f,
|
|
9720
9718
|
type: D.Illustration,
|
|
9721
9719
|
y: b.top,
|
|
@@ -9766,10 +9764,10 @@ const mo = [
|
|
|
9766
9764
|
return console.error(o), [];
|
|
9767
9765
|
}
|
|
9768
9766
|
}, yo = async (i, t, e, a) => {
|
|
9769
|
-
const n = e.data, r = a
|
|
9767
|
+
const n = e.data, r = await I.getOptionForStep(a);
|
|
9770
9768
|
if (!r)
|
|
9771
9769
|
return console.error(`No option for step ${a.stepName}.`), [];
|
|
9772
|
-
const s = r.variants?.find((d) => d.id === n.pictureVariantId) || await
|
|
9770
|
+
const s = r.variants?.find((d) => d.id === n.pictureVariantId) || await I.getDefaultVariant(r, a.overrideDefaultVariantId);
|
|
9773
9771
|
if (!s)
|
|
9774
9772
|
return console.error(`No variant with ID: ${n.pictureVariantId}`), [];
|
|
9775
9773
|
if (!s.asset)
|
|
@@ -9807,10 +9805,10 @@ const mo = [
|
|
|
9807
9805
|
return console.error(d), [];
|
|
9808
9806
|
}
|
|
9809
9807
|
}, So = async (i, t, e, a) => {
|
|
9810
|
-
const n = e.data, r = a
|
|
9808
|
+
const n = e.data, r = await I.getOptionForStep(a);
|
|
9811
9809
|
if (!r)
|
|
9812
9810
|
return console.error(`No option for step ${a.stepName}.`), [];
|
|
9813
|
-
const s = r.variants?.find((c) => c.id === n.colorVariantId) || await
|
|
9811
|
+
const s = r.variants?.find((c) => c.id === n.colorVariantId) || await I.getDefaultVariant(r, a.overrideDefaultVariantId);
|
|
9814
9812
|
if (!s)
|
|
9815
9813
|
return console.error(`No variant with ID: ${n.colorVariantId}`), [];
|
|
9816
9814
|
t[a.stepName] = { selectedVariants: [s] };
|
|
@@ -9928,10 +9926,10 @@ const mo = [
|
|
|
9928
9926
|
return a;
|
|
9929
9927
|
}, Eo = async (i, t, e, a) => {
|
|
9930
9928
|
const n = [], r = e.data, s = 30, o = (m) => m.vertical ? "center" : m.textAlign || "center", l = async () => {
|
|
9931
|
-
const m = a
|
|
9929
|
+
const m = await I.getOptionForStep(a);
|
|
9932
9930
|
if (!m)
|
|
9933
9931
|
return;
|
|
9934
|
-
const f = m.variants?.find((w) => w.id === r.fontVariantId) || await
|
|
9932
|
+
const f = m.variants?.find((w) => w.id === r.fontVariantId) || await I.getDefaultVariant(m, a.overrideDefaultVariantId);
|
|
9935
9933
|
if (!f || !f.asset)
|
|
9936
9934
|
return;
|
|
9937
9935
|
t[a.stepName] = { selectedVariants: [f] };
|
|
@@ -9952,7 +9950,7 @@ const mo = [
|
|
|
9952
9950
|
uppercase: a.data.uppercase
|
|
9953
9951
|
}), h = async (m) => {
|
|
9954
9952
|
const f = m.colorOption;
|
|
9955
|
-
return f ? (await
|
|
9953
|
+
return f ? (await I.getDefaultVariant(f))?.color : void 0;
|
|
9956
9954
|
}, g = r.color || await h(a.data), p = a.data.regions;
|
|
9957
9955
|
for (const m of p) {
|
|
9958
9956
|
const f = i.find((w) => w.panelId === m.panelId);
|
|
@@ -11172,7 +11170,7 @@ const ul = (i) => i.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11172
11170
|
this.reloadedState?.serializableWorkflow?.steps.reduce((d, u) => (u.selectedVariants?.length && (d[u.stepName] = {
|
|
11173
11171
|
selectedVariants: u.selectedVariants.map((A) => ({ id: A.id }))
|
|
11174
11172
|
}), d), {})
|
|
11175
|
-
), n =
|
|
11173
|
+
), n = I.getOptions(Array.from(a)), r = this.fetchConversionConfiguration();
|
|
11176
11174
|
await Promise.all([n, r]), this.allScenes = en(t);
|
|
11177
11175
|
const o = (await lt(this.allScenes, this.stepSelections)).map((d) => d.silentSteps).flat(), { stepElements: l, commands: c } = await this.stepElementsForIntroducedSilentSteps(o, !!this.reloadedState);
|
|
11178
11176
|
this.commandContext.apply(new U(c), !0), this.stepElements = { ...this.stepElements, ...l }, await this.ensureStepsAreLoaded(), this.isReloadedTransaction || this.updateStateWithServer(), this.renderLayouts(), this.reloadedState && e();
|
|
@@ -11641,11 +11639,11 @@ const ul = (i) => i.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11641
11639
|
this.stepSelections = {
|
|
11642
11640
|
...this.stepSelections,
|
|
11643
11641
|
[t]: { selectedVariants: e }
|
|
11644
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((v,
|
|
11642
|
+
}, this.selectionCost = Object.values(this.stepSelections).reduce((v, B) => v + B.selectedVariants.map((M) => M.priceModifier || 0).reduce((M, R) => M + R, 0), 0);
|
|
11645
11643
|
for (const v of r.steps)
|
|
11646
11644
|
await ft(v, this.stepSelections) || (this.stepInitialised[v.stepName] = !1, delete this.stepMetadata[v.stepName], delete this.stepSelections[v.stepName], delete this.storage[v.stepName]);
|
|
11647
11645
|
const o = this.allScenes, l = await lt(o, s), c = await lt(o, this.stepSelections), d = l.map((v) => v.silentSteps).flat(), A = c.map((v) => v.silentSteps).flat().filter(
|
|
11648
|
-
(v) => !d.some((
|
|
11646
|
+
(v) => !d.some((B) => B.stepName === v.stepName)
|
|
11649
11647
|
);
|
|
11650
11648
|
for (const v of d)
|
|
11651
11649
|
await ft(v, this.stepSelections) || (this.stepInitialised[v.stepName] = !1);
|
|
@@ -11656,14 +11654,14 @@ const ul = (i) => i.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11656
11654
|
[t]: a
|
|
11657
11655
|
}, this.removeElements(h);
|
|
11658
11656
|
const m = r.steps.find((v) => v.stepName === t);
|
|
11659
|
-
m?.type === E.Frame && this.getWorkflowExperience().getStepById(m.stepName)?.frameService?.setTargetElements(a.map((
|
|
11657
|
+
m?.type === E.Frame && this.getWorkflowExperience().getStepById(m.stepName)?.frameService?.setTargetElements(a.map((B) => B.id));
|
|
11660
11658
|
const f = h.map((v) => new Ot(v.id)), y = new on(this.constructSerializableWorkflow()), w = [...p, ...f, y];
|
|
11661
11659
|
w.length > 0 && this.commandContext.apply(new U(w), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
11662
11660
|
const x = await this.getInvalidModelVariants(), b = this.modelContainer;
|
|
11663
11661
|
if (b) {
|
|
11664
11662
|
const v = x.map(
|
|
11665
|
-
(
|
|
11666
|
-
|
|
11663
|
+
(B) => b.applyModelVariant(
|
|
11664
|
+
B,
|
|
11667
11665
|
{
|
|
11668
11666
|
contextService: this.getLayoutPreviewService()
|
|
11669
11667
|
},
|
|
@@ -11933,7 +11931,7 @@ const Jt = class Jt {
|
|
|
11933
11931
|
if (!this.step.option?.id) return [];
|
|
11934
11932
|
if (this.step.option.variants)
|
|
11935
11933
|
return (this.step.option.variants || []).map((e) => new rt(e)) || [];
|
|
11936
|
-
const t = await
|
|
11934
|
+
const t = await I.getOption(this.step.option?.id);
|
|
11937
11935
|
if (!t) throw new Error("Option not found, cannot fetch variants.");
|
|
11938
11936
|
return (t.variants || []).map((e) => new rt(e)) || [];
|
|
11939
11937
|
}
|
|
@@ -12088,7 +12086,7 @@ class hl extends tt {
|
|
|
12088
12086
|
);
|
|
12089
12087
|
}
|
|
12090
12088
|
async getColorOption() {
|
|
12091
|
-
return await
|
|
12089
|
+
return await I.ensureFullOption(this.step.data.colorOption);
|
|
12092
12090
|
}
|
|
12093
12091
|
getAvailableColors() {
|
|
12094
12092
|
return this.step.data.colorPickerEnabled ? ye.availableColors(this.step, this.manager) : Promise.resolve([]);
|
|
@@ -12174,8 +12172,8 @@ class fl extends tt {
|
|
|
12174
12172
|
/**
|
|
12175
12173
|
* The way that this step expects to be rendered.
|
|
12176
12174
|
*/
|
|
12177
|
-
getDisplayType() {
|
|
12178
|
-
return this.step.data.displayType
|
|
12175
|
+
async getDisplayType() {
|
|
12176
|
+
return this.step.data.displayType ? this.step.data.displayType : (await I.getOptionForStep(this.step))?.displayType;
|
|
12179
12177
|
}
|
|
12180
12178
|
}
|
|
12181
12179
|
class Cl extends tt {
|
|
@@ -12710,7 +12708,7 @@ const Il = async (i, t) => {
|
|
|
12710
12708
|
}, Fl = async (i, t, e, a, n, r, s, o, l, c) => {
|
|
12711
12709
|
c && (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await i.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
|
|
12712
12710
|
const d = i.getPreviewService(), u = t?.finalizeStepConfig?.lookAtAnimation, A = d && t.showModelOnFinishStep && !!u, h = l && hn(l, t, !0), g = l && hn(l, t, !1), p = async (v) => {
|
|
12713
|
-
const
|
|
12711
|
+
const B = {};
|
|
12714
12712
|
let M = 0;
|
|
12715
12713
|
if (Object.keys(r).length > 0)
|
|
12716
12714
|
for (const R of Object.keys(r)) {
|
|
@@ -12718,14 +12716,14 @@ const Il = async (i, t) => {
|
|
|
12718
12716
|
for (let V = 0; V < P.selections.length; ++V) {
|
|
12719
12717
|
const k = P.selections[V];
|
|
12720
12718
|
if (T) {
|
|
12721
|
-
const X = await
|
|
12719
|
+
const X = await I.getOptionForStep(T);
|
|
12722
12720
|
if (!v || X && (X.variants || []).length > 1 && !T.data.hideSelectionInCart && !T.data.hideSelectionsInCart) {
|
|
12723
12721
|
const Et = T.stepTitle;
|
|
12724
|
-
|
|
12722
|
+
B[Et] ? B[Et].push({
|
|
12725
12723
|
id: k.id || "",
|
|
12726
12724
|
name: k.name,
|
|
12727
12725
|
priceModifier: k.priceModifier
|
|
12728
|
-
}) :
|
|
12726
|
+
}) : B[Et] = [
|
|
12729
12727
|
{
|
|
12730
12728
|
id: k.id || "",
|
|
12731
12729
|
name: k.name,
|
|
@@ -12737,13 +12735,13 @@ const Il = async (i, t) => {
|
|
|
12737
12735
|
M += k.priceModifier;
|
|
12738
12736
|
}
|
|
12739
12737
|
}
|
|
12740
|
-
return [
|
|
12738
|
+
return [B, M];
|
|
12741
12739
|
}, [m] = await p(!0), f = Object.fromEntries(
|
|
12742
|
-
Object.keys(m).map((v) => [v, m[v].map((
|
|
12740
|
+
Object.keys(m).map((v) => [v, m[v].map((B) => B.id)])
|
|
12743
12741
|
), [y] = await p(!1), w = Object.fromEntries(
|
|
12744
12742
|
Object.keys(y).map((v) => [
|
|
12745
12743
|
v,
|
|
12746
|
-
y[v].map((
|
|
12744
|
+
y[v].map((B) => B.id)
|
|
12747
12745
|
])
|
|
12748
12746
|
);
|
|
12749
12747
|
let x = await o(A, n.id);
|
|
@@ -12760,9 +12758,9 @@ const Il = async (i, t) => {
|
|
|
12760
12758
|
designDetails: (() => {
|
|
12761
12759
|
const v = {
|
|
12762
12760
|
name: s,
|
|
12763
|
-
layouts: e.map((
|
|
12764
|
-
index:
|
|
12765
|
-
panelId:
|
|
12761
|
+
layouts: e.map((B) => ({
|
|
12762
|
+
index: B.index,
|
|
12763
|
+
panelId: B.panelId
|
|
12766
12764
|
})),
|
|
12767
12765
|
workflowId: t.id,
|
|
12768
12766
|
transactionId: n.id,
|
|
@@ -12770,16 +12768,16 @@ const Il = async (i, t) => {
|
|
|
12770
12768
|
previewImage: x
|
|
12771
12769
|
};
|
|
12772
12770
|
if (g) {
|
|
12773
|
-
const
|
|
12771
|
+
const B = [];
|
|
12774
12772
|
for (const [M, R] of Object.entries(g))
|
|
12775
|
-
|
|
12776
|
-
v.metadata =
|
|
12773
|
+
B.push({ key: M, value: R });
|
|
12774
|
+
v.metadata = B;
|
|
12777
12775
|
}
|
|
12778
12776
|
if (f) {
|
|
12779
|
-
const
|
|
12777
|
+
const B = [];
|
|
12780
12778
|
for (const [M, R] of Object.entries(w))
|
|
12781
|
-
|
|
12782
|
-
v.selectedVariants =
|
|
12779
|
+
B.push({ key: M, ids: R });
|
|
12780
|
+
v.selectedVariants = B;
|
|
12783
12781
|
}
|
|
12784
12782
|
return v;
|
|
12785
12783
|
})(),
|
|
@@ -13593,7 +13591,7 @@ const Nl = (i) => {
|
|
|
13593
13591
|
return !1;
|
|
13594
13592
|
}, Ql = async (i, t) => {
|
|
13595
13593
|
if (!Nl(i)) return !1;
|
|
13596
|
-
const e = await
|
|
13594
|
+
const e = await I.getOptionForStep(i);
|
|
13597
13595
|
if (e && (e.variants || []).length > 1) {
|
|
13598
13596
|
const a = t[i.stepName];
|
|
13599
13597
|
return !!(a && a.selections.length > 0);
|
|
@@ -13647,10 +13645,10 @@ class Ol {
|
|
|
13647
13645
|
return new mn(
|
|
13648
13646
|
this.bundle,
|
|
13649
13647
|
t,
|
|
13650
|
-
t.entityId ? await
|
|
13648
|
+
t.entityId ? await I.getOption(t.entityId) : void 0
|
|
13651
13649
|
);
|
|
13652
13650
|
case z.Option: {
|
|
13653
|
-
const e = t.entityId ? await
|
|
13651
|
+
const e = t.entityId ? await I.getOption(t.entityId) : void 0;
|
|
13654
13652
|
return e?.type === "Color" ? new mn(this.bundle, t, e) : new Si(this.bundle, t, e);
|
|
13655
13653
|
}
|
|
13656
13654
|
case z.Text:
|
|
@@ -13733,7 +13731,7 @@ class Rl extends La {
|
|
|
13733
13731
|
super(t, e);
|
|
13734
13732
|
}
|
|
13735
13733
|
async initialize() {
|
|
13736
|
-
return this.property.data?.fileUpload?.colorOptionId && (this.colorOption = await
|
|
13734
|
+
return this.property.data?.fileUpload?.colorOptionId && (this.colorOption = await I.getOption(this.property.data?.fileUpload?.colorOptionId)), await this.loadImageData(), this;
|
|
13737
13735
|
}
|
|
13738
13736
|
async loadImageData() {
|
|
13739
13737
|
const t = await this.getImage();
|
|
@@ -14030,7 +14028,7 @@ class Si extends La {
|
|
|
14030
14028
|
async ensureOptionLoaded() {
|
|
14031
14029
|
if (this.optionResource?.variants) return this.optionResource;
|
|
14032
14030
|
if (!this.property.entityId) return this.optionResource;
|
|
14033
|
-
const t = await
|
|
14031
|
+
const t = await I.getOption(this.property.entityId);
|
|
14034
14032
|
return t && (this.optionResource = t), this.optionResource;
|
|
14035
14033
|
}
|
|
14036
14034
|
/**
|
|
@@ -16278,7 +16276,7 @@ class Wd {
|
|
|
16278
16276
|
} catch (a) {
|
|
16279
16277
|
throw console.error(a), new pt("Critical - Unable to synchronize workflow state with server.");
|
|
16280
16278
|
}
|
|
16281
|
-
}, this.options = t, this.options.applicationKey && Ar(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 40.
|
|
16279
|
+
}, this.options = t, this.options.applicationKey && Ar(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 40.2.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
16282
16280
|
}
|
|
16283
16281
|
configure(t) {
|
|
16284
16282
|
wt.setHubUrl(t.hubUrl), wt.setServerUrl(t.serverUrl), wt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && gr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Gt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
|
@@ -17460,7 +17458,7 @@ class yc extends tt {
|
|
|
17460
17458
|
return this.frameService.getImageData();
|
|
17461
17459
|
}
|
|
17462
17460
|
async getColorOption() {
|
|
17463
|
-
return await
|
|
17461
|
+
return await I.ensureFullOption(this.step.data.colorOption);
|
|
17464
17462
|
}
|
|
17465
17463
|
getAvailableColors() {
|
|
17466
17464
|
return this.step.data.colorPickerEnabled ? bt.availableColors(this.step, this.manager) : Promise.resolve([]);
|
|
@@ -18161,7 +18159,7 @@ export {
|
|
|
18161
18159
|
gi as moduleStepService,
|
|
18162
18160
|
tu as nameBundle,
|
|
18163
18161
|
eu as nameTransaction,
|
|
18164
|
-
|
|
18162
|
+
I as optionService,
|
|
18165
18163
|
Dd as outlineFontsInSvg,
|
|
18166
18164
|
mu as overrideWorkflowExperienceRecipientAddress,
|
|
18167
18165
|
mt as patternImageDataCache,
|