@spiffcommerce/core 33.12.0 → 33.13.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 +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +303 -300
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import vn from "lodash.debounce";
|
|
|
24
24
|
import "fs";
|
|
25
25
|
import "path";
|
|
26
26
|
import Vi from "lodash.omit";
|
|
27
|
-
var Pe = /* @__PURE__ */ ((n) => (n.Data = "Data", n.Font = "Font", n.Frame = "Frame", n.Illustration = "Illustration", n.Image = "Image", n.Model = "Model", n.Material = "Material", n.Color = "Color", n.QuestionnaireCollateral = "QuestionnaireCollateral", n.RequestCollateral = "RequestCollateral", n.SignupCollateral = "SignupCollateral", n.Video = "Video", n.ColorProfile = "ColorProfile", n.Environment = "Environment", n))(Pe || {}), En = /* @__PURE__ */ ((n) => (n.AND = "AND", n.OR = "OR", n))(En || {}), G = /* @__PURE__ */ ((n) => (n.FileUpload = "FileUpload", n.Option = "Option", n.ColorOption = "ColorOption", n.Text = "Text", n))(G || {}),
|
|
27
|
+
var Pe = /* @__PURE__ */ ((n) => (n.Data = "Data", n.Font = "Font", n.Frame = "Frame", n.Illustration = "Illustration", n.Image = "Image", n.Model = "Model", n.Material = "Material", n.Color = "Color", n.QuestionnaireCollateral = "QuestionnaireCollateral", n.RequestCollateral = "RequestCollateral", n.SignupCollateral = "SignupCollateral", n.Video = "Video", n.ColorProfile = "ColorProfile", n.Environment = "Environment", n))(Pe || {}), En = /* @__PURE__ */ ((n) => (n.AND = "AND", n.OR = "OR", n))(En || {}), G = /* @__PURE__ */ ((n) => (n.FileUpload = "FileUpload", n.Option = "Option", n.ColorOption = "ColorOption", n.Text = "Text", n))(G || {}), v = /* @__PURE__ */ ((n) => (n.Information = "Information", n.Bulk = "Bulk", n.DigitalContent = "DigitalContent", n.Finish = "Finish", n.Frame = "Frame", n.Illustration = "Illustration", n.Introduction = "Introduction", n.Material = "Material", n.Model = "Model", n.Module = "Module", n.Picture = "Picture", n.Photo = "Photo", n.ProductOverlay = "ProductOverlay", n.Question = "Question", n.Shape = "Shape", n.SilentIllustration = "SilentIllustration", n.Text = "Text", n))(v || {}), zi = /* @__PURE__ */ ((n) => (n.Color = "Color", n.Colors = "Colors", n.Selection = "Selection", n.Selections = "Selections", n.Text = "Text", n.Upload = "Upload", n))(zi || {}), Kt = /* @__PURE__ */ ((n) => (n.ThreeD = "ThreeD", n.FreeDesign = "FreeDesign", n.Print = "Print", n))(Kt || {}), D = /* @__PURE__ */ ((n) => (n.Frame = "frame", n.Group = "group", n.Image = "image", n.Pattern = "pattern", n.Illustration = "illustration", n.Textbox = "textbox", n))(D || {}), Gi = /* @__PURE__ */ ((n) => (n.Default = "Default", n.FirstTransaction = "FirstTransaction", n.OneToOne = "OneToOne", n))(Gi || {}), bn = /* @__PURE__ */ ((n) => (n.Pending = "Pending", n.Failed = "Failed", n.Validated = "Validated", n.Overridden = "Overridden", n))(bn || {}), Wi = /* @__PURE__ */ ((n) => (n.Hyperlink = "Hyperlink", n.Edit = "Edit", n.Approve = "Approve", n))(Wi || {}), qi = /* @__PURE__ */ ((n) => (n.Hub = "Hub", n.Shopify = "Shopify", n))(qi || {}), ba = /* @__PURE__ */ ((n) => (n.BackgroundRemover = "BackgroundRemover", n.ConversionAccelerator = "Conversion Accelerator", n.ProcessBuilder = "ProcessBuilder", n))(ba || {}), Hi = /* @__PURE__ */ ((n) => (n[n.Orbit = 0] = "Orbit", n[n.Pan = 1] = "Pan", n))(Hi || {}), Fe = /* @__PURE__ */ ((n) => (n.Owner = "Owner", n.Approver = "Approver", n.Editor = "Editor", n.Viewer = "Viewer", n))(Fe || {}), Tt = /* @__PURE__ */ ((n) => (n.Autosize = "Autosize", n.Traditional = "Traditional", n))(Tt || {}), Y = /* @__PURE__ */ ((n) => (n[n.North = 0] = "North", n[n.Northeast = 1] = "Northeast", n[n.East = 2] = "East", n[n.Southeast = 3] = "Southeast", n[n.South = 4] = "South", n[n.Southwest = 5] = "Southwest", n[n.West = 6] = "West", n[n.Northwest = 7] = "Northwest", n))(Y || {}), ji = /* @__PURE__ */ ((n) => (n.Pixel = "px", n.Millimeter = "mm", n.Centimeter = "cm", n))(ji || {});
|
|
28
28
|
class In extends Error {
|
|
29
29
|
constructor(t) {
|
|
30
30
|
super(t), this.name = this.constructor.name;
|
|
@@ -342,9 +342,9 @@ class Ar {
|
|
|
342
342
|
if (window && window.__SENTRY__) {
|
|
343
343
|
const f = window.__SENTRY__.hub;
|
|
344
344
|
if (f) {
|
|
345
|
-
const
|
|
346
|
-
Object.entries(
|
|
347
|
-
l[
|
|
345
|
+
const S = f.traceHeaders();
|
|
346
|
+
Object.entries(S).forEach(([w, I]) => {
|
|
347
|
+
l[w] = I;
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -5094,14 +5094,14 @@ const J = new $r(), $n = C`
|
|
|
5094
5094
|
timestamp
|
|
5095
5095
|
}
|
|
5096
5096
|
}
|
|
5097
|
-
`, Ut = [
|
|
5097
|
+
`, Ut = [v.SilentIllustration, v.ProductOverlay], uo = async (n) => {
|
|
5098
5098
|
const t = [];
|
|
5099
5099
|
n.introduction && t.push({
|
|
5100
5100
|
name: "Introduction",
|
|
5101
5101
|
title: n.name,
|
|
5102
5102
|
renderableSteps: [
|
|
5103
5103
|
{
|
|
5104
|
-
type:
|
|
5104
|
+
type: v.Introduction,
|
|
5105
5105
|
stepName: "Introduction",
|
|
5106
5106
|
stepTitle: n.name,
|
|
5107
5107
|
helpText: n.introduction,
|
|
@@ -5136,7 +5136,7 @@ const J = new $r(), $n = C`
|
|
|
5136
5136
|
title: e,
|
|
5137
5137
|
renderableSteps: [
|
|
5138
5138
|
{
|
|
5139
|
-
type:
|
|
5139
|
+
type: v.Finish,
|
|
5140
5140
|
stepName: "Finish",
|
|
5141
5141
|
stepTitle: e,
|
|
5142
5142
|
helpText: "",
|
|
@@ -5171,7 +5171,7 @@ const J = new $r(), $n = C`
|
|
|
5171
5171
|
for (const o of a)
|
|
5172
5172
|
for (const s of o.renderableSteps) {
|
|
5173
5173
|
const l = (s.option?.variants || []).length;
|
|
5174
|
-
s.silent || (s.type ===
|
|
5174
|
+
s.silent || (s.type === v.Model || s.type === v.Material || s.type === v.Picture || s.type === v.Shape ? (l > 1 || e) && i.push(s.stepName) : i.push(s.stepName));
|
|
5175
5175
|
}
|
|
5176
5176
|
const r = a.filter((o) => o.renderableSteps.filter(
|
|
5177
5177
|
(l) => i.includes(l.stepName)
|
|
@@ -5275,14 +5275,14 @@ const M = () => {
|
|
|
5275
5275
|
viewBox: A,
|
|
5276
5276
|
width: u
|
|
5277
5277
|
}) => {
|
|
5278
|
-
const h = e || 0, m = 2 * (l?.scale || 1), p = A || { x: 0, y: 0, width: u, height: r }, g = `${p.x} ${p.y} ${p.width} ${p.height}`, f = M(),
|
|
5278
|
+
const h = e || 0, m = 2 * (l?.scale || 1), p = A || { x: 0, y: 0, width: u, height: r }, g = `${p.x} ${p.y} ${p.width} ${p.height}`, f = M(), S = a.purpose === Kt.FreeDesign && /* @__PURE__ */ P("defs", { children: /* @__PURE__ */ P("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ P("rect", { width: p.width, height: p.height, rx: h }) }) }), w = a.colorProfiles?.map((E, F) => (
|
|
5279
5279
|
/* @ts-ignore */
|
|
5280
|
-
/* @__PURE__ */ P("color-profile", { name:
|
|
5281
|
-
)),
|
|
5282
|
-
...
|
|
5280
|
+
/* @__PURE__ */ P("color-profile", { name: E.name, xlinkHref: E.key, children: " " }, F)
|
|
5281
|
+
)), I = i.map((E) => ({
|
|
5282
|
+
...E,
|
|
5283
5283
|
_renderingConfiguration: a,
|
|
5284
5284
|
mask: l ? `url(#viewmask-${f})` : void 0
|
|
5285
|
-
})),
|
|
5285
|
+
})), b = Ta(I);
|
|
5286
5286
|
return /* @__PURE__ */ dt(
|
|
5287
5287
|
"svg",
|
|
5288
5288
|
{
|
|
@@ -5302,8 +5302,8 @@ const M = () => {
|
|
|
5302
5302
|
},
|
|
5303
5303
|
viewBox: g,
|
|
5304
5304
|
children: [
|
|
5305
|
-
b,
|
|
5306
5305
|
w,
|
|
5306
|
+
S,
|
|
5307
5307
|
!!n && /* @__PURE__ */ P(
|
|
5308
5308
|
"rect",
|
|
5309
5309
|
{
|
|
@@ -5319,7 +5319,7 @@ const M = () => {
|
|
|
5319
5319
|
{
|
|
5320
5320
|
id: "element-group",
|
|
5321
5321
|
clipPath: a.purpose === Kt.FreeDesign ? "url(#viewboxClip)" : void 0,
|
|
5322
|
-
children:
|
|
5322
|
+
children: b.map((E) => Zn(E)).filter((E) => !!E)
|
|
5323
5323
|
}
|
|
5324
5324
|
),
|
|
5325
5325
|
l && /* @__PURE__ */ P(
|
|
@@ -5361,12 +5361,12 @@ const M = () => {
|
|
|
5361
5361
|
}
|
|
5362
5362
|
);
|
|
5363
5363
|
}, dd = (n, t, e, a, i) => {
|
|
5364
|
-
const r = wt(i), o = e / 2, s = a / 2, l = n + o, c = t + s, d = Math.sin(r), A = Math.cos(r), u = o, h = o, m = -s, p = s, g = u * A - m * d, f = h * A - p * d,
|
|
5364
|
+
const r = wt(i), o = e / 2, s = a / 2, l = n + o, c = t + s, d = Math.sin(r), A = Math.cos(r), u = o, h = o, m = -s, p = s, g = u * A - m * d, f = h * A - p * d, S = u * d + m * A, w = h * d + p * A, I = Math.max(Math.abs(g), Math.abs(f)), b = Math.max(Math.abs(S), Math.abs(w));
|
|
5365
5365
|
return {
|
|
5366
|
-
minX: l -
|
|
5367
|
-
maxX: l +
|
|
5368
|
-
minY: c -
|
|
5369
|
-
maxY: c +
|
|
5366
|
+
minX: l - I,
|
|
5367
|
+
maxX: l + I,
|
|
5368
|
+
minY: c - b,
|
|
5369
|
+
maxY: c + b
|
|
5370
5370
|
};
|
|
5371
5371
|
}, Ad = (n, t, e) => {
|
|
5372
5372
|
const a = Math.sqrt(Math.pow(t.x - n.x, 2) + Math.pow(t.y - n.y, 2)), i = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), r = Math.sqrt(Math.pow(e.x - n.x, 2) + Math.pow(e.y - n.y, 2));
|
|
@@ -5674,22 +5674,22 @@ const wo = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", Ke = /* @_
|
|
|
5674
5674
|
});
|
|
5675
5675
|
const o = e.querySelectorAll("tspan");
|
|
5676
5676
|
for (let d = 0; d < o.length; d++) {
|
|
5677
|
-
const A = o.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await Qt(i.get(m)), g = u.getAttribute("fill"), f = u.getAttribute("stroke"),
|
|
5677
|
+
const A = o.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), p = await Qt(i.get(m)), g = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"), w = p.getPath(
|
|
5678
5678
|
A.innerHTML,
|
|
5679
5679
|
0,
|
|
5680
5680
|
0,
|
|
5681
5681
|
parseInt(u.getAttribute("font-size") ?? "72")
|
|
5682
|
-
),
|
|
5683
|
-
let
|
|
5684
|
-
const
|
|
5685
|
-
|
|
5682
|
+
), I = w.getBoundingBox().x2 - w.getBoundingBox().x1;
|
|
5683
|
+
let b = 0;
|
|
5684
|
+
const E = A.getAttribute("text-anchor");
|
|
5685
|
+
E === "middle" ? b = I / 2 : E === "end" && (b = I);
|
|
5686
5686
|
const F = p.getPath(
|
|
5687
5687
|
A.innerHTML,
|
|
5688
|
-
parseFloat(A.getAttribute("x") ?? "0") -
|
|
5688
|
+
parseFloat(A.getAttribute("x") ?? "0") - b,
|
|
5689
5689
|
parseFloat(A.getAttribute("y") ?? "0"),
|
|
5690
5690
|
parseInt(u.getAttribute("font-size") ?? "72")
|
|
5691
5691
|
);
|
|
5692
|
-
F.fill = g, F.stroke = f, F.strokeWidth = parseFloat(
|
|
5692
|
+
F.fill = g, F.stroke = f, F.strokeWidth = parseFloat(S ?? "0");
|
|
5693
5693
|
const x = F.toSVG(2), $ = t.parseFromString(x, "image/svg+xml").firstElementChild;
|
|
5694
5694
|
h.appendChild($);
|
|
5695
5695
|
}
|
|
@@ -7152,14 +7152,14 @@ class nn {
|
|
|
7152
7152
|
if (!r)
|
|
7153
7153
|
throw new K(i);
|
|
7154
7154
|
let o = "";
|
|
7155
|
-
if (this.configuration.type ===
|
|
7155
|
+
if (this.configuration.type === v.ProductOverlay) {
|
|
7156
7156
|
let l = "";
|
|
7157
7157
|
if (this.product?.overlayImageUrl && (l = this.product.overlayImageUrl), o = l, !l)
|
|
7158
7158
|
throw new xe(this.configuration, "Couldn't find an asset for product overlay step");
|
|
7159
7159
|
}
|
|
7160
7160
|
const s = this.evaluateAssetType();
|
|
7161
7161
|
if (s === D.Image) {
|
|
7162
|
-
const l = this.configuration.type ===
|
|
7162
|
+
const l = this.configuration.type === v.SilentIllustration ? this.configuration.data.asset?.fileLink : this.product?.overlayImageUrl;
|
|
7163
7163
|
if (!l)
|
|
7164
7164
|
throw new Error("Undefined raster silent step source");
|
|
7165
7165
|
const c = {
|
|
@@ -7174,7 +7174,7 @@ class nn {
|
|
|
7174
7174
|
layer: i.layer,
|
|
7175
7175
|
layerIndex: i.layerIndex,
|
|
7176
7176
|
immutable: i.immutable,
|
|
7177
|
-
productOverlay: this.configuration.type ===
|
|
7177
|
+
productOverlay: this.configuration.type === v.ProductOverlay ? !0 : void 0,
|
|
7178
7178
|
rotation: i.rotation,
|
|
7179
7179
|
excludeFromExport: this.configuration.data.excludeFromPrint,
|
|
7180
7180
|
preserveAspectRatio: "none"
|
|
@@ -7187,7 +7187,7 @@ class nn {
|
|
|
7187
7187
|
command: new H(c, r)
|
|
7188
7188
|
};
|
|
7189
7189
|
} else {
|
|
7190
|
-
const l = this.configuration.type ===
|
|
7190
|
+
const l = this.configuration.type === v.SilentIllustration ? this.configuration.data.asset?.fileLink : o, d = await lt(await (async () => new Promise((u, h) => {
|
|
7191
7191
|
if (!l) {
|
|
7192
7192
|
h("Undefined vector silent step source");
|
|
7193
7193
|
return;
|
|
@@ -7211,7 +7211,7 @@ class nn {
|
|
|
7211
7211
|
layerIndex: i.layerIndex,
|
|
7212
7212
|
rotation: i.rotation,
|
|
7213
7213
|
immutable: i.immutable,
|
|
7214
|
-
productOverlay: this.configuration.type ===
|
|
7214
|
+
productOverlay: this.configuration.type === v.ProductOverlay ? !0 : void 0,
|
|
7215
7215
|
excludeFromExport: this.configuration.data.excludeFromPrint
|
|
7216
7216
|
};
|
|
7217
7217
|
return {
|
|
@@ -7227,10 +7227,10 @@ class nn {
|
|
|
7227
7227
|
async trigger() {
|
|
7228
7228
|
if (!this.configuration.data.regions)
|
|
7229
7229
|
throw new xe(this.configuration, "Missing regions.");
|
|
7230
|
-
if (this.configuration.type ===
|
|
7230
|
+
if (this.configuration.type === v.SilentIllustration) {
|
|
7231
7231
|
const t = this.configuration.data.regions.map(this.processRegion);
|
|
7232
7232
|
return Promise.all(t);
|
|
7233
|
-
} else return this.configuration.type ===
|
|
7233
|
+
} else return this.configuration.type === v.ProductOverlay ? Promise.all(
|
|
7234
7234
|
this.configuration.data.regions.map((t) => {
|
|
7235
7235
|
if (!this.layouts.find((a) => t.panelId === a.panelId))
|
|
7236
7236
|
throw new K(t);
|
|
@@ -7239,7 +7239,7 @@ class nn {
|
|
|
7239
7239
|
) : Promise.reject("Unknown silent step. This is a bug");
|
|
7240
7240
|
}
|
|
7241
7241
|
evaluateAssetType() {
|
|
7242
|
-
const t = this.configuration.type ===
|
|
7242
|
+
const t = this.configuration.type === v.ProductOverlay && this.product?.overlayImageUrl ? this.product.overlayImageUrl.toLowerCase() : this.configuration.data.asset?.fileLink?.toLowerCase().split("?")[0];
|
|
7243
7243
|
return t?.startsWith("data:image/png") || t?.endsWith(".jpeg") || t?.endsWith(".jpg") || t?.endsWith(".png") ? D.Image : (t?.endsWith(".svg") || t?.startsWith("image/svg+xml"), D.Illustration);
|
|
7244
7244
|
}
|
|
7245
7245
|
}
|
|
@@ -7645,33 +7645,33 @@ class Ne {
|
|
|
7645
7645
|
r && r(!0);
|
|
7646
7646
|
const c = t.data.initialZoomLevel, d = await Promise.all(
|
|
7647
7647
|
t.data.regions.map(async (h, m) => {
|
|
7648
|
-
const p = await We(l[m]), g = s.getImageData(), f = a.map((F) => new Rt(F.id)),
|
|
7648
|
+
const p = await We(l[m]), g = s.getImageData(), f = a.map((F) => new Rt(F.id)), S = g ? Na(
|
|
7649
7649
|
g,
|
|
7650
7650
|
p,
|
|
7651
7651
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
|
7652
7652
|
t.data.forceImageCover
|
|
7653
|
-
) : void 0,
|
|
7653
|
+
) : void 0, w = g ? {
|
|
7654
7654
|
id: M(),
|
|
7655
7655
|
src: g.src,
|
|
7656
|
-
x:
|
|
7657
|
-
y:
|
|
7656
|
+
x: S?.x || 0,
|
|
7657
|
+
y: S?.y || 0,
|
|
7658
7658
|
width: g.width,
|
|
7659
7659
|
height: g.height,
|
|
7660
|
-
scaleX:
|
|
7661
|
-
scaleY:
|
|
7660
|
+
scaleX: S?.zoom || 1,
|
|
7661
|
+
scaleY: S?.zoom || 1,
|
|
7662
7662
|
rotation: 0
|
|
7663
|
-
} : void 0,
|
|
7664
|
-
if (!
|
|
7663
|
+
} : void 0, I = M(), E = i.getLayouts().find((F) => F.panelId === h.panelId);
|
|
7664
|
+
if (!E)
|
|
7665
7665
|
throw new K(h);
|
|
7666
7666
|
return {
|
|
7667
|
-
command: this.getCreateElementCommand(
|
|
7667
|
+
command: this.getCreateElementCommand(I, h, E, {
|
|
7668
7668
|
frameData: p,
|
|
7669
|
-
pattern:
|
|
7669
|
+
pattern: w,
|
|
7670
7670
|
disablePlaceholder: t.data.disablePlaceholder,
|
|
7671
7671
|
stepName: t.stepName
|
|
7672
7672
|
}),
|
|
7673
7673
|
regionEl: {
|
|
7674
|
-
id:
|
|
7674
|
+
id: I,
|
|
7675
7675
|
region: h
|
|
7676
7676
|
},
|
|
7677
7677
|
removeExistingCommands: f
|
|
@@ -7902,13 +7902,13 @@ class zo {
|
|
|
7902
7902
|
if (!l)
|
|
7903
7903
|
throw new _t(s);
|
|
7904
7904
|
const c = await lt(await this.getIllustrationBody(l)), d = await te(c.svg), A = (f) => {
|
|
7905
|
-
const
|
|
7906
|
-
if (!
|
|
7905
|
+
const S = r.getLayouts().find((I) => I.panelId === f.panelId);
|
|
7906
|
+
if (!S)
|
|
7907
7907
|
throw new K(f);
|
|
7908
|
-
const
|
|
7908
|
+
const w = M();
|
|
7909
7909
|
return {
|
|
7910
|
-
regionElement: { id:
|
|
7911
|
-
command: this.getCreateElementCommand(
|
|
7910
|
+
regionElement: { id: w, region: f },
|
|
7911
|
+
command: this.getCreateElementCommand(w, f, S, {
|
|
7912
7912
|
stepName: t.stepName,
|
|
7913
7913
|
src: l,
|
|
7914
7914
|
objectURL: d,
|
|
@@ -7919,47 +7919,47 @@ class zo {
|
|
|
7919
7919
|
let p = Array.from(Object.values(c.colors)).map((f) => f.browserValue);
|
|
7920
7920
|
const g = t.data.colorOption;
|
|
7921
7921
|
return g && g.variants?.forEach((f) => {
|
|
7922
|
-
p = p.map((
|
|
7922
|
+
p = p.map((S) => S.toLowerCase() === f.color?.toLowerCase() ? f.name : S);
|
|
7923
7923
|
}), r.updateMetadata(t.stepName, { colors: p }), {
|
|
7924
7924
|
command: new L(m),
|
|
7925
7925
|
followup: async () => {
|
|
7926
7926
|
await r.setSelectionsAndElements(
|
|
7927
7927
|
t.stepName,
|
|
7928
7928
|
[e],
|
|
7929
|
-
u.map((
|
|
7929
|
+
u.map((S) => S.regionElement),
|
|
7930
7930
|
async () => {
|
|
7931
7931
|
r.setMandatoryFulfilled(t.stepName, !0), i(!1);
|
|
7932
7932
|
}
|
|
7933
7933
|
);
|
|
7934
7934
|
const f = s.assetConfiguration?.defaultColorVariants || [];
|
|
7935
7935
|
if (f.length !== 0) {
|
|
7936
|
-
const
|
|
7937
|
-
(s.assetConfiguration?.channelNumbers || []).forEach((
|
|
7938
|
-
const
|
|
7939
|
-
|
|
7936
|
+
const S = {};
|
|
7937
|
+
(s.assetConfiguration?.channelNumbers || []).forEach((I) => {
|
|
7938
|
+
const b = f.find((E) => E.channelNumber === I.number);
|
|
7939
|
+
b && (S[`${I.id.replace(/\W/g, "")}`] = { browserValue: b?.variant?.color || "" });
|
|
7940
7940
|
}), await this.changeColors(
|
|
7941
7941
|
t,
|
|
7942
|
-
u.map((
|
|
7942
|
+
u.map((I) => I.regionElement),
|
|
7943
7943
|
r,
|
|
7944
7944
|
() => r.getCommandContext().getAllLayouts(),
|
|
7945
|
-
new Map(Object.entries(
|
|
7945
|
+
new Map(Object.entries(S))
|
|
7946
7946
|
);
|
|
7947
7947
|
}
|
|
7948
7948
|
if (t.data.colorPickerEnabled) {
|
|
7949
|
-
const
|
|
7950
|
-
if (
|
|
7951
|
-
const
|
|
7949
|
+
const S = await this.availableColors(t, r) || [], w = Object.keys(c.colors), I = S.length === 1 && w.length === 1;
|
|
7950
|
+
if (I) {
|
|
7951
|
+
const b = S[0], E = w[0];
|
|
7952
7952
|
await this.changeColors(
|
|
7953
7953
|
t,
|
|
7954
7954
|
u.map((F) => F.regionElement),
|
|
7955
7955
|
r,
|
|
7956
7956
|
() => r.getCommandContext().getAllLayouts(),
|
|
7957
|
-
/* @__PURE__ */ new Map([[
|
|
7957
|
+
/* @__PURE__ */ new Map([[E, b.variant.color]])
|
|
7958
7958
|
);
|
|
7959
7959
|
}
|
|
7960
|
-
!
|
|
7960
|
+
!I && f.length === 0 && await this.changeColors(
|
|
7961
7961
|
t,
|
|
7962
|
-
u.map((
|
|
7962
|
+
u.map((b) => b.regionElement),
|
|
7963
7963
|
r,
|
|
7964
7964
|
() => r.getCommandContext().getAllLayouts(),
|
|
7965
7965
|
/* @__PURE__ */ new Map()
|
|
@@ -8481,7 +8481,7 @@ class Yo {
|
|
|
8481
8481
|
};
|
|
8482
8482
|
} else {
|
|
8483
8483
|
const l = (u) => {
|
|
8484
|
-
const h = r.find((
|
|
8484
|
+
const h = r.find((S) => S.panelId === u.panelId);
|
|
8485
8485
|
if (!h)
|
|
8486
8486
|
throw new K(u);
|
|
8487
8487
|
const m = s(), p = `
|
|
@@ -8587,11 +8587,11 @@ const Ko = new Jo(), aa = (n, t, e, a, i) => {
|
|
|
8587
8587
|
const A = Math.max(...s);
|
|
8588
8588
|
if (A <= n.width)
|
|
8589
8589
|
return [r, A];
|
|
8590
|
-
const u = s.reduce((g, f,
|
|
8590
|
+
const u = s.reduce((g, f, S, w) => f > w[g] ? S : g, 0), h = r[u];
|
|
8591
8591
|
let m = !1, p = h.length;
|
|
8592
8592
|
for (; !m && p > -1; ) {
|
|
8593
8593
|
p = h.lastIndexOf(" ", p - 1);
|
|
8594
|
-
const g = [h.slice(0, p), h.slice(p + 1)], f = g.map((
|
|
8594
|
+
const g = [h.slice(0, p), h.slice(p + 1)], f = g.map((w) => pt(w, a, i));
|
|
8595
8595
|
f[0] <= n.width && (r = [...r.slice(0, u), ...g, ...r.slice(u + 1)], s = [
|
|
8596
8596
|
...s.slice(0, u),
|
|
8597
8597
|
...f,
|
|
@@ -8911,11 +8911,11 @@ class Xo {
|
|
|
8911
8911
|
const p = e.getWorkflowExperience().getBundle();
|
|
8912
8912
|
if (p && t.globalPropertyAspectConfigurations) {
|
|
8913
8913
|
const f = p.getGlobalPropertyConfiguration()?.aspects?.find(
|
|
8914
|
-
(
|
|
8914
|
+
(S) => S.type === G.Text && t.globalPropertyAspectConfigurations?.map((w) => w.aspectName).includes(S.name)
|
|
8915
8915
|
);
|
|
8916
8916
|
if (f) {
|
|
8917
|
-
const
|
|
8918
|
-
|
|
8917
|
+
const w = p.getGlobalPropertyStateManager().getAspect(f.name);
|
|
8918
|
+
w && (m = w);
|
|
8919
8919
|
}
|
|
8920
8920
|
}
|
|
8921
8921
|
if (await e.setSelectionsAndElements(
|
|
@@ -8924,7 +8924,7 @@ class Xo {
|
|
|
8924
8924
|
u,
|
|
8925
8925
|
async () => {
|
|
8926
8926
|
e.updateMetadata(t.stepName, { color: h, text: m }), e.updateStorage(t.stepName, { text: m, inputText: m });
|
|
8927
|
-
const g = s.map((
|
|
8927
|
+
const g = s.map((S) => new an(S.id, A)), f = new L(g);
|
|
8928
8928
|
e.getCommandDispatcher()(f);
|
|
8929
8929
|
}
|
|
8930
8930
|
), s.length === 0 && l) {
|
|
@@ -9118,11 +9118,11 @@ class Xo {
|
|
|
9118
9118
|
colorProfileAssetKey: g.colorProfile?.key
|
|
9119
9119
|
});
|
|
9120
9120
|
}
|
|
9121
|
-
const
|
|
9121
|
+
const S = await this.getDefaultColor(a), w = S || "#000000", I = {
|
|
9122
9122
|
stepRegion: u,
|
|
9123
9123
|
stepName: t,
|
|
9124
9124
|
align: this.textAlign(a),
|
|
9125
|
-
fill: r.color ? r.color :
|
|
9125
|
+
fill: r.color ? r.color : w,
|
|
9126
9126
|
fontSize: a.size || na,
|
|
9127
9127
|
fontData: i,
|
|
9128
9128
|
id: p,
|
|
@@ -9142,33 +9142,33 @@ class Xo {
|
|
|
9142
9142
|
curved: a.curved,
|
|
9143
9143
|
paths: a.paths,
|
|
9144
9144
|
fillSpotColorDefinition: f
|
|
9145
|
-
},
|
|
9146
|
-
if (!
|
|
9145
|
+
}, b = [], E = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
9146
|
+
if (!I.fontData) throw new R("Failed to resolve font data for text.");
|
|
9147
9147
|
const [x, T] = be(
|
|
9148
|
-
|
|
9149
|
-
|
|
9148
|
+
I.fontSize,
|
|
9149
|
+
I.fontData,
|
|
9150
9150
|
{
|
|
9151
|
-
left:
|
|
9152
|
-
top:
|
|
9153
|
-
width:
|
|
9154
|
-
height:
|
|
9155
|
-
rotation:
|
|
9151
|
+
left: I.x,
|
|
9152
|
+
top: I.y,
|
|
9153
|
+
width: I.width,
|
|
9154
|
+
height: I.height,
|
|
9155
|
+
rotation: I.rotation,
|
|
9156
9156
|
panelId: ""
|
|
9157
9157
|
},
|
|
9158
9158
|
[c],
|
|
9159
9159
|
{ size: a.size, minSize: a.minSize, maxSize: a.maxSize }
|
|
9160
9160
|
);
|
|
9161
|
-
|
|
9161
|
+
E.set(I.id, x), F.set(I.id, T);
|
|
9162
9162
|
const $ = a.curved || a.vertical ? c : (T || []).join(`
|
|
9163
9163
|
`);
|
|
9164
|
-
|
|
9165
|
-
this.generateTextChangeCommandsForRegion(x, a,
|
|
9164
|
+
b.push(
|
|
9165
|
+
this.generateTextChangeCommandsForRegion(x, a, I.id, $)
|
|
9166
9166
|
);
|
|
9167
|
-
const
|
|
9167
|
+
const B = new H(I, m);
|
|
9168
9168
|
return {
|
|
9169
9169
|
regionElement: { id: p, region: u },
|
|
9170
|
-
commands: [
|
|
9171
|
-
newElement:
|
|
9170
|
+
commands: [B, ...b],
|
|
9171
|
+
newElement: I,
|
|
9172
9172
|
fontData: i
|
|
9173
9173
|
};
|
|
9174
9174
|
} catch (g) {
|
|
@@ -9203,53 +9203,53 @@ class Xo {
|
|
|
9203
9203
|
*/
|
|
9204
9204
|
async changeInputTextWithRegion(t, e, a, i, r, o, s, l, c, d) {
|
|
9205
9205
|
const A = (i || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = xt(A, o), h = this.getProcessedInput(u, t.data, s), m = o.getRegionElements(t.stepName), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
9206
|
-
for (const
|
|
9207
|
-
if (
|
|
9208
|
-
const [
|
|
9206
|
+
for (const b of m)
|
|
9207
|
+
if (b.region) {
|
|
9208
|
+
const [E, F] = be(
|
|
9209
9209
|
e,
|
|
9210
9210
|
a,
|
|
9211
|
-
|
|
9211
|
+
b.region,
|
|
9212
9212
|
[h],
|
|
9213
9213
|
{ size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
|
|
9214
9214
|
);
|
|
9215
|
-
p.set(
|
|
9215
|
+
p.set(b.id, E), g.set(b.id, F);
|
|
9216
9216
|
}
|
|
9217
|
-
const
|
|
9217
|
+
const S = (() => {
|
|
9218
9218
|
if (t.data && t.data.maxLength && h.length > t.data.maxLength)
|
|
9219
9219
|
return d && d(!0), { info: "0" };
|
|
9220
|
-
const
|
|
9221
|
-
for (const F of
|
|
9222
|
-
for (const x in
|
|
9223
|
-
const T =
|
|
9220
|
+
const b = o.getWorkflowExperience().getProfanityList(), E = da(h.toLowerCase());
|
|
9221
|
+
for (const F of E)
|
|
9222
|
+
for (const x in b) {
|
|
9223
|
+
const T = b[x].toLowerCase().replace(/\s/g, "");
|
|
9224
9224
|
if (F === T)
|
|
9225
9225
|
return l(!0), { error: "Blocked profanity." };
|
|
9226
9226
|
}
|
|
9227
9227
|
return !t.data.vertical && !t.data.allowNewlines && (h.includes(`
|
|
9228
9228
|
`) || h.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((x) => x) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - h.length).toString() });
|
|
9229
9229
|
})();
|
|
9230
|
-
if (
|
|
9231
|
-
c(
|
|
9230
|
+
if (S.error) {
|
|
9231
|
+
c(S.error);
|
|
9232
9232
|
return;
|
|
9233
9233
|
}
|
|
9234
|
-
if (c(`${
|
|
9234
|
+
if (c(`${S.info} characters remaining` || ""), d)
|
|
9235
9235
|
return;
|
|
9236
9236
|
o.updateStorage(t.stepName, { text: A }), o.updateMetadata(t.stepName, {
|
|
9237
9237
|
text: this.injectReplaceableText(A, t.data)
|
|
9238
9238
|
}), (r.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && o.setMandatoryFulfilled(t.stepName, !0);
|
|
9239
|
-
const
|
|
9240
|
-
for (const
|
|
9241
|
-
const
|
|
9239
|
+
const w = [];
|
|
9240
|
+
for (const b of m) {
|
|
9241
|
+
const E = t.data.curved ? h : (g.get(b.id) || []).join(`
|
|
9242
9242
|
`);
|
|
9243
|
-
|
|
9243
|
+
w.push(
|
|
9244
9244
|
this.generateTextChangeCommandsForRegion(
|
|
9245
|
-
p.get(
|
|
9245
|
+
p.get(b.id) || 1,
|
|
9246
9246
|
t.data,
|
|
9247
|
-
|
|
9248
|
-
|
|
9247
|
+
b.id,
|
|
9248
|
+
E
|
|
9249
9249
|
)
|
|
9250
9250
|
);
|
|
9251
9251
|
}
|
|
9252
|
-
return new L(
|
|
9252
|
+
return new L(w);
|
|
9253
9253
|
}
|
|
9254
9254
|
}
|
|
9255
9255
|
const j = new Xo();
|
|
@@ -9408,21 +9408,21 @@ class ss extends Zo {
|
|
|
9408
9408
|
return this.svgElement(t, e);
|
|
9409
9409
|
}
|
|
9410
9410
|
svgElement(t, e) {
|
|
9411
|
-
const a = yo(ts), r = t !== "" ? ((
|
|
9412
|
-
const
|
|
9413
|
-
|
|
9414
|
-
const
|
|
9415
|
-
|
|
9416
|
-
const
|
|
9417
|
-
|
|
9418
|
-
const
|
|
9419
|
-
|
|
9411
|
+
const a = yo(ts), r = t !== "" ? ((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())(t) : "", o = a.getPath(r, 0, 72, 72), s = o.toSVG(2), l = o.getBoundingBox(), c = l.x2 - l.x1, d = o.toPathData(3), A = () => {
|
|
9412
|
+
const w = at("g");
|
|
9413
|
+
w.classList.add("module-text-group");
|
|
9414
|
+
const I = at("defs");
|
|
9415
|
+
w.appendChild(I), I.appendChild(as(0, 2, 2, "shadow"));
|
|
9416
|
+
const b = at("path");
|
|
9417
|
+
b.setAttribute("d", d), b.setAttribute("stroke", "black"), b.setAttribute("stroke-width", "3"), I.appendChild(b);
|
|
9418
|
+
const E = at("g");
|
|
9419
|
+
E.classList.add("module-layer0"), w.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = b.outerHTML;
|
|
9420
9420
|
const F = at("g");
|
|
9421
|
-
F.classList.add("module-layer1"),
|
|
9421
|
+
F.classList.add("module-layer1"), w.appendChild(F), F.setAttribute("stroke-width", "3"), F.setAttribute("stroke", "rgb(45,41,38)"), F.setAttribute("fill", "rgb(45,41,38)"), F.setAttribute("transform", "translate(0.5,0)"), F.innerHTML = s;
|
|
9422
9422
|
const x = at("g");
|
|
9423
|
-
x.classList.add("module-layer2"),
|
|
9423
|
+
x.classList.add("module-layer2"), w.appendChild(x), x.setAttribute("fill", "rgb(255,209,0)"), x.setAttribute("transform", "translate(1,-0.1)"), x.innerHTML = s;
|
|
9424
9424
|
const T = at("g");
|
|
9425
|
-
return T.classList.add("module-layer3"),
|
|
9425
|
+
return T.classList.add("module-layer3"), w.appendChild(T), T.setAttribute("fill", "white"), T.innerHTML = s, new os(w).transform(([B, Q]) => [B, Q + (c / 2 - B) ** 2 / (c * 6)]), w;
|
|
9426
9426
|
}, u = at("g");
|
|
9427
9427
|
u.classList.add("module-root");
|
|
9428
9428
|
const h = at("defs");
|
|
@@ -9435,8 +9435,8 @@ class ss extends Zo {
|
|
|
9435
9435
|
g.classList.add("module-text-enclosure"), u.appendChild(g);
|
|
9436
9436
|
const f = A();
|
|
9437
9437
|
g.appendChild(f);
|
|
9438
|
-
const
|
|
9439
|
-
return is(g,
|
|
9438
|
+
const S = Oi(d);
|
|
9439
|
+
return is(g, S, e.height, e.width, 0.35, 0.65), ns(u.outerHTML);
|
|
9440
9440
|
}
|
|
9441
9441
|
}
|
|
9442
9442
|
async function Ai(n) {
|
|
@@ -9544,7 +9544,7 @@ const ls = [
|
|
|
9544
9544
|
const i = e.data, r = a.option;
|
|
9545
9545
|
if (!r)
|
|
9546
9546
|
return console.error(`No option for step ${a.stepName}.`), [];
|
|
9547
|
-
const o = r.variants?.find((
|
|
9547
|
+
const o = r.variants?.find((b) => b.id === i.illustrationVariantId) || le(r);
|
|
9548
9548
|
if (!o)
|
|
9549
9549
|
return console.error(`No variant with ID: ${i.illustrationVariantId}`), [];
|
|
9550
9550
|
if (!o.asset)
|
|
@@ -9558,32 +9558,32 @@ const ls = [
|
|
|
9558
9558
|
return console.error("Failed to read SVG."), [];
|
|
9559
9559
|
Fa(m);
|
|
9560
9560
|
const p = {};
|
|
9561
|
-
Mt(m, (
|
|
9562
|
-
ls.includes(
|
|
9563
|
-
const
|
|
9564
|
-
if (
|
|
9565
|
-
const x =
|
|
9566
|
-
|
|
9567
|
-
}
|
|
9568
|
-
const F =
|
|
9561
|
+
Mt(m, (b) => {
|
|
9562
|
+
ls.includes(b.tagName) && !b.attributes.getNamedItem("fill") && b.setAttribute("fill", "#000000");
|
|
9563
|
+
const E = b.attributes.getNamedItem("fill");
|
|
9564
|
+
if (E && E.value !== "none") {
|
|
9565
|
+
const x = E.value, $ = `spiff-fill-${x.replace(/\W/g, "")}`;
|
|
9566
|
+
b.classList.add($), p[$] = { browserValue: x };
|
|
9567
|
+
}
|
|
9568
|
+
const F = b.attributes.getNamedItem("stroke");
|
|
9569
9569
|
if (F && F.value !== "none") {
|
|
9570
9570
|
const x = F.value, $ = `spiff-stroke-${x.replace(/\W/g, "")}`;
|
|
9571
|
-
|
|
9571
|
+
b.classList.add($), p[$] = { browserValue: x };
|
|
9572
9572
|
}
|
|
9573
9573
|
});
|
|
9574
|
-
const f = Pt().serializeToString(m),
|
|
9575
|
-
if (
|
|
9576
|
-
for (const [
|
|
9577
|
-
for (const F of Object.keys(
|
|
9578
|
-
if (
|
|
9579
|
-
p[
|
|
9574
|
+
const f = Pt().serializeToString(m), S = i.colors;
|
|
9575
|
+
if (S) {
|
|
9576
|
+
for (const [b, E] of Object.entries(p))
|
|
9577
|
+
for (const F of Object.keys(S))
|
|
9578
|
+
if (E.browserValue === F) {
|
|
9579
|
+
p[b] = { browserValue: S[F] };
|
|
9580
9580
|
break;
|
|
9581
9581
|
}
|
|
9582
9582
|
}
|
|
9583
|
-
const
|
|
9584
|
-
const
|
|
9585
|
-
if (!
|
|
9586
|
-
throw new K(
|
|
9583
|
+
const w = (b) => {
|
|
9584
|
+
const E = n.find((x) => x.panelId === b.panelId);
|
|
9585
|
+
if (!E)
|
|
9586
|
+
throw new K(b);
|
|
9587
9587
|
const F = M();
|
|
9588
9588
|
return new H(
|
|
9589
9589
|
{
|
|
@@ -9591,22 +9591,22 @@ const ls = [
|
|
|
9591
9591
|
id: F,
|
|
9592
9592
|
svg: f,
|
|
9593
9593
|
type: D.Illustration,
|
|
9594
|
-
y:
|
|
9595
|
-
x:
|
|
9596
|
-
rotation:
|
|
9597
|
-
width:
|
|
9598
|
-
height:
|
|
9599
|
-
layer:
|
|
9600
|
-
layerIndex:
|
|
9601
|
-
immutable:
|
|
9594
|
+
y: b.top,
|
|
9595
|
+
x: b.left,
|
|
9596
|
+
rotation: b.rotation,
|
|
9597
|
+
width: b.width,
|
|
9598
|
+
height: b.height,
|
|
9599
|
+
layer: b.layer,
|
|
9600
|
+
layerIndex: b.layerIndex,
|
|
9601
|
+
immutable: b.immutable
|
|
9602
9602
|
},
|
|
9603
|
-
|
|
9603
|
+
E
|
|
9604
9604
|
);
|
|
9605
|
-
},
|
|
9605
|
+
}, I = a.data.regions;
|
|
9606
9606
|
try {
|
|
9607
|
-
return
|
|
9608
|
-
} catch (
|
|
9609
|
-
return console.error(
|
|
9607
|
+
return I.map(w);
|
|
9608
|
+
} catch (b) {
|
|
9609
|
+
return console.error(b), [];
|
|
9610
9610
|
}
|
|
9611
9611
|
}, us = async (n, t, e) => {
|
|
9612
9612
|
const a = await Ai(e.data.module), i = t.data, r = (s, l) => {
|
|
@@ -9736,7 +9736,7 @@ const ls = [
|
|
|
9736
9736
|
return console.error(c), [];
|
|
9737
9737
|
}
|
|
9738
9738
|
}, gs = async (n, t, e) => {
|
|
9739
|
-
const a = [], r = t.type ===
|
|
9739
|
+
const a = [], r = t.type === v.ProductOverlay ? e || t.data.asset?.fileLink || "" : t.data.asset?.fileLink || "", s = r.endsWith(".jpeg") || r.endsWith(".jpg") || r.endsWith(".png") ? D.Image : (r.endsWith(".svg"), D.Illustration), l = t.data.regions;
|
|
9740
9740
|
if (s === "image")
|
|
9741
9741
|
try {
|
|
9742
9742
|
l.forEach((c) => {
|
|
@@ -9753,7 +9753,7 @@ const ls = [
|
|
|
9753
9753
|
height: c.height,
|
|
9754
9754
|
layer: c.layer,
|
|
9755
9755
|
layerIndex: c.layerIndex,
|
|
9756
|
-
productOverlay: t.type ===
|
|
9756
|
+
productOverlay: t.type === v.ProductOverlay ? !0 : void 0,
|
|
9757
9757
|
scaleX: 1,
|
|
9758
9758
|
scaleY: 1,
|
|
9759
9759
|
rotation: c.rotation,
|
|
@@ -9792,7 +9792,7 @@ const ls = [
|
|
|
9792
9792
|
scaleX: 1,
|
|
9793
9793
|
scaleY: 1,
|
|
9794
9794
|
rotation: A.rotation,
|
|
9795
|
-
productOverlay: t.type ===
|
|
9795
|
+
productOverlay: t.type === v.ProductOverlay ? !0 : void 0,
|
|
9796
9796
|
excludeFromExport: t.data.excludeFromPrint
|
|
9797
9797
|
};
|
|
9798
9798
|
a.push(new H(h, u));
|
|
@@ -9804,13 +9804,13 @@ const ls = [
|
|
|
9804
9804
|
const g = a.option;
|
|
9805
9805
|
if (!g)
|
|
9806
9806
|
return;
|
|
9807
|
-
const f = g.variants?.find((
|
|
9807
|
+
const f = g.variants?.find((w) => w.id === r.fontVariantId) || le(g);
|
|
9808
9808
|
if (!f || !f.asset)
|
|
9809
9809
|
return;
|
|
9810
9810
|
t[a.stepName] = { selectedVariants: [f] };
|
|
9811
|
-
const
|
|
9812
|
-
if (
|
|
9813
|
-
return
|
|
9811
|
+
const S = f.asset.fileLink;
|
|
9812
|
+
if (S)
|
|
9813
|
+
return S;
|
|
9814
9814
|
}, d = await (async () => {
|
|
9815
9815
|
const g = l();
|
|
9816
9816
|
if (!g)
|
|
@@ -9828,10 +9828,10 @@ const ls = [
|
|
|
9828
9828
|
return f ? J.getDefaultVariant(f)?.color : void 0;
|
|
9829
9829
|
}, m = r.color || await h(a.data), p = a.data.regions;
|
|
9830
9830
|
for (const g of p) {
|
|
9831
|
-
const f = n.find((
|
|
9831
|
+
const f = n.find((w) => w.panelId === g.panelId);
|
|
9832
9832
|
if (!f)
|
|
9833
9833
|
continue;
|
|
9834
|
-
const
|
|
9834
|
+
const S = {
|
|
9835
9835
|
stepName: e.name,
|
|
9836
9836
|
id: M(),
|
|
9837
9837
|
align: s(a.data),
|
|
@@ -9853,7 +9853,7 @@ const ls = [
|
|
|
9853
9853
|
y: g.top
|
|
9854
9854
|
};
|
|
9855
9855
|
if (d) {
|
|
9856
|
-
const [
|
|
9856
|
+
const [w, I] = be(
|
|
9857
9857
|
a.data.size || o,
|
|
9858
9858
|
d,
|
|
9859
9859
|
g,
|
|
@@ -9872,16 +9872,16 @@ const ls = [
|
|
|
9872
9872
|
i.push(
|
|
9873
9873
|
new H(
|
|
9874
9874
|
{
|
|
9875
|
-
...
|
|
9876
|
-
fontSize:
|
|
9877
|
-
text:
|
|
9875
|
+
...S,
|
|
9876
|
+
fontSize: w,
|
|
9877
|
+
text: S.curved ? S.text : (I || []).join(`
|
|
9878
9878
|
`)
|
|
9879
9879
|
},
|
|
9880
9880
|
f
|
|
9881
9881
|
)
|
|
9882
9882
|
);
|
|
9883
9883
|
} else
|
|
9884
|
-
i.push(new H(
|
|
9884
|
+
i.push(new H(S, f));
|
|
9885
9885
|
}
|
|
9886
9886
|
return i;
|
|
9887
9887
|
}, fs = (n, t) => n.conditions ? n.conditions.every((e) => {
|
|
@@ -9899,18 +9899,18 @@ const ls = [
|
|
|
9899
9899
|
const s = t.steps.find((l) => l.stepName === o.name);
|
|
9900
9900
|
if (s)
|
|
9901
9901
|
switch (s.type) {
|
|
9902
|
-
case
|
|
9902
|
+
case v.DigitalContent:
|
|
9903
9903
|
i.push(
|
|
9904
9904
|
...await cs(e, o, s)
|
|
9905
9905
|
);
|
|
9906
9906
|
break;
|
|
9907
|
-
case
|
|
9908
|
-
case
|
|
9907
|
+
case v.Frame:
|
|
9908
|
+
case v.Photo:
|
|
9909
9909
|
i.push(
|
|
9910
9910
|
...await ds(e, r, o, s)
|
|
9911
9911
|
);
|
|
9912
9912
|
break;
|
|
9913
|
-
case
|
|
9913
|
+
case v.Illustration:
|
|
9914
9914
|
i.push(
|
|
9915
9915
|
...await As(
|
|
9916
9916
|
e,
|
|
@@ -9920,20 +9920,20 @@ const ls = [
|
|
|
9920
9920
|
)
|
|
9921
9921
|
);
|
|
9922
9922
|
break;
|
|
9923
|
-
case
|
|
9923
|
+
case v.Module:
|
|
9924
9924
|
i.push(...await us(e, o, s));
|
|
9925
9925
|
break;
|
|
9926
|
-
case
|
|
9926
|
+
case v.Picture:
|
|
9927
9927
|
i.push(
|
|
9928
9928
|
...await hs(e, r, o, s)
|
|
9929
9929
|
);
|
|
9930
9930
|
break;
|
|
9931
|
-
case
|
|
9931
|
+
case v.Shape:
|
|
9932
9932
|
i.push(
|
|
9933
9933
|
...await ms(e, r, o, s)
|
|
9934
9934
|
);
|
|
9935
9935
|
break;
|
|
9936
|
-
case
|
|
9936
|
+
case v.Text:
|
|
9937
9937
|
i.push(
|
|
9938
9938
|
...await ps(e, r, o, s)
|
|
9939
9939
|
);
|
|
@@ -9941,7 +9941,7 @@ const ls = [
|
|
|
9941
9941
|
}
|
|
9942
9942
|
}
|
|
9943
9943
|
for (const o of t.steps)
|
|
9944
|
-
o.type !==
|
|
9944
|
+
o.type !== v.SilentIllustration && o.type !== v.ProductOverlay || fs(o, r) && i.push(
|
|
9945
9945
|
...await gs(e, o, a)
|
|
9946
9946
|
);
|
|
9947
9947
|
return i;
|
|
@@ -10130,7 +10130,7 @@ const Md = (n, t) => {
|
|
|
10130
10130
|
const e = [];
|
|
10131
10131
|
return n.forEach((a) => {
|
|
10132
10132
|
const i = t.steps.find((r) => r.stepName === a.stepName);
|
|
10133
|
-
i?.type ===
|
|
10133
|
+
i?.type === v.Text && a.stepAspectType === "Text" && e.push({
|
|
10134
10134
|
name: i.stepName,
|
|
10135
10135
|
data: {
|
|
10136
10136
|
text: a.value
|
|
@@ -10833,6 +10833,7 @@ const Md = (n, t) => {
|
|
|
10833
10833
|
$customField4: String
|
|
10834
10834
|
$customField5: String
|
|
10835
10835
|
$conversionConfigurationId: String
|
|
10836
|
+
$prevalidated: Boolean
|
|
10836
10837
|
) {
|
|
10837
10838
|
recipientUpdate(
|
|
10838
10839
|
id: $id
|
|
@@ -10853,6 +10854,7 @@ const Md = (n, t) => {
|
|
|
10853
10854
|
customField4: $customField4
|
|
10854
10855
|
customField5: $customField5
|
|
10855
10856
|
conversionConfigurationId: $conversionConfigurationId
|
|
10857
|
+
prevalidated: $prevalidated
|
|
10856
10858
|
) {
|
|
10857
10859
|
id
|
|
10858
10860
|
}
|
|
@@ -10932,7 +10934,7 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
10932
10934
|
a.type === Ie.FirstName ? e[i] = t?.firstName : a.type === Ie.LastName ? e[i] = t?.lastName : a.type === Ie.Custom && (a.customFieldIndex === 1 ? e[i] = t?.customField1 : a.customFieldIndex === 2 ? e[i] = t?.customField2 : a.customFieldIndex === 3 ? e[i] = t?.customField3 : a.customFieldIndex === 4 ? e[i] = t?.customField4 : a.customFieldIndex === 5 && (e[i] = t?.customField5), a.option && (e[i] = a.option.variants?.find((r) => r.id === e[i])?.name));
|
|
10933
10935
|
}), e;
|
|
10934
10936
|
}
|
|
10935
|
-
async updateRecipient(t, e, a, i, r, o, s, l, c, d, A, u, h, m, p, g, f) {
|
|
10937
|
+
async updateRecipient(t, e, a, i, r, o, s, l, c, d, A, u, h, m, p, g, f, S) {
|
|
10936
10938
|
const w = this.experience.getTransaction();
|
|
10937
10939
|
if (w.recipient?.id)
|
|
10938
10940
|
this.experience.getTransaction().recipient = {
|
|
@@ -10976,11 +10978,12 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
10976
10978
|
customField3: m || w.recipient.customField3,
|
|
10977
10979
|
customField4: p || w.recipient.customField4,
|
|
10978
10980
|
customField5: g || w.recipient.customField5,
|
|
10979
|
-
conversionConfigurationId: f || w.recipient.conversionConfigurationId
|
|
10981
|
+
conversionConfigurationId: f || w.recipient.conversionConfigurationId,
|
|
10982
|
+
prevalidated: S
|
|
10980
10983
|
}
|
|
10981
10984
|
});
|
|
10982
10985
|
else {
|
|
10983
|
-
const
|
|
10986
|
+
const I = await this.graphQlClient().mutate({
|
|
10984
10987
|
mutation: _s,
|
|
10985
10988
|
errorPolicy: "all",
|
|
10986
10989
|
fetchPolicy: "no-cache",
|
|
@@ -11005,7 +11008,7 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11005
11008
|
}
|
|
11006
11009
|
});
|
|
11007
11010
|
w.recipient = {
|
|
11008
|
-
id:
|
|
11011
|
+
id: I?.data?.recipientCreate?.id,
|
|
11009
11012
|
firstName: t,
|
|
11010
11013
|
lastName: e,
|
|
11011
11014
|
address: a,
|
|
@@ -11029,14 +11032,14 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11029
11032
|
fetchPolicy: "no-cache",
|
|
11030
11033
|
variables: {
|
|
11031
11034
|
id: this.experience.getTransaction().id,
|
|
11032
|
-
recipientId:
|
|
11035
|
+
recipientId: I.data?.recipientCreate?.id
|
|
11033
11036
|
},
|
|
11034
11037
|
context: {
|
|
11035
11038
|
transactionOwnerId: this.experience.getTransaction().transactionOwnerId
|
|
11036
11039
|
}
|
|
11037
11040
|
});
|
|
11038
11041
|
}
|
|
11039
|
-
await this.fetchConversionConfiguration(), this.recipientCallbacks.forEach((
|
|
11042
|
+
await this.fetchConversionConfiguration(), this.recipientCallbacks.forEach((I) => I(this.experience.getTransaction().recipient));
|
|
11040
11043
|
}
|
|
11041
11044
|
async fetchConversionConfiguration() {
|
|
11042
11045
|
const t = this.experience.getTransaction().recipient;
|
|
@@ -11259,7 +11262,7 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11259
11262
|
},
|
|
11260
11263
|
{ refocusCamera: e }
|
|
11261
11264
|
);
|
|
11262
|
-
this.setModelContainer(i), vt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type ===
|
|
11265
|
+
this.setModelContainer(i), vt(this.allScenes, this.stepSelections).filter((s) => s).map((s) => s.renderableSteps).flat().filter((s) => s.type === v.Model || s.type === v.Material).forEach((s) => {
|
|
11263
11266
|
if (!s.option?.id) {
|
|
11264
11267
|
console.error(`Failed to read option id from step: ${s.stepName}`);
|
|
11265
11268
|
return;
|
|
@@ -11267,7 +11270,7 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11267
11270
|
const l = this.stepSelections[s.stepName]?.selectedVariants || [];
|
|
11268
11271
|
if (l.length === 0) return;
|
|
11269
11272
|
const c = l[0];
|
|
11270
|
-
if (s.type ===
|
|
11273
|
+
if (s.type === v.Model) {
|
|
11271
11274
|
if (!this.modelContainer)
|
|
11272
11275
|
throw new R(
|
|
11273
11276
|
"We should always have a model container when injecting a preview!"
|
|
@@ -11407,17 +11410,17 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11407
11410
|
), t), []) || [];
|
|
11408
11411
|
}
|
|
11409
11412
|
getInvalidModelVariants() {
|
|
11410
|
-
return this.experience.getWorkflow()?.steps.reduce((t, e) => (e.type ===
|
|
11413
|
+
return this.experience.getWorkflow()?.steps.reduce((t, e) => (e.type === v.Model && !bt(e, this.stepSelections) && t.push(e.stepName), t), []) || [];
|
|
11411
11414
|
}
|
|
11412
11415
|
async stepElementsForIntroducedSilentSteps(t, e) {
|
|
11413
11416
|
const a = this.experience.getProduct();
|
|
11414
11417
|
if (!a)
|
|
11415
11418
|
return Promise.resolve({ stepElements: {}, commands: [] });
|
|
11416
11419
|
const i = async (c, d, A) => {
|
|
11417
|
-
if (c.type ===
|
|
11420
|
+
if (c.type === v.SilentIllustration) {
|
|
11418
11421
|
const u = await new nn(c, d).trigger();
|
|
11419
11422
|
return { step: c, results: u };
|
|
11420
|
-
} else if (c.type ===
|
|
11423
|
+
} else if (c.type === v.ProductOverlay) {
|
|
11421
11424
|
const u = await new nn(
|
|
11422
11425
|
c,
|
|
11423
11426
|
d,
|
|
@@ -11504,14 +11507,14 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11504
11507
|
this.stepSelections = {
|
|
11505
11508
|
...this.stepSelections,
|
|
11506
11509
|
[t]: { selectedVariants: e }
|
|
11507
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((
|
|
11508
|
-
bt(
|
|
11510
|
+
}, this.selectionCost = Object.values(this.stepSelections).reduce((E, F) => E + F.selectedVariants.map((x) => x.priceModifier || 0).reduce((x, T) => x + T, 0), 0), r.steps.forEach((E) => {
|
|
11511
|
+
bt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
|
|
11509
11512
|
});
|
|
11510
|
-
const s = this.allScenes, l = vt(s, o), c = vt(s, this.stepSelections), d = l.map((
|
|
11511
|
-
(
|
|
11513
|
+
const s = this.allScenes, l = vt(s, o), c = vt(s, this.stepSelections), d = l.map((E) => E.silentSteps).flat(), u = c.map((E) => E.silentSteps).flat().filter(
|
|
11514
|
+
(E) => !d.some((F) => F.stepName === E.stepName)
|
|
11512
11515
|
);
|
|
11513
|
-
d.forEach((
|
|
11514
|
-
bt(
|
|
11516
|
+
d.forEach((E) => {
|
|
11517
|
+
bt(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1);
|
|
11515
11518
|
});
|
|
11516
11519
|
const h = this.getInvalidCanvasRegions(), { stepElements: m, commands: p } = await this.stepElementsForIntroducedSilentSteps(u, !1);
|
|
11517
11520
|
this.stepElements = {
|
|
@@ -11519,14 +11522,14 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11519
11522
|
...m,
|
|
11520
11523
|
[t]: a
|
|
11521
11524
|
}, this.removeElements(h);
|
|
11522
|
-
const g = r.steps.find((
|
|
11523
|
-
g?.type ===
|
|
11524
|
-
const f = h.map((
|
|
11525
|
-
|
|
11526
|
-
const
|
|
11527
|
-
if (
|
|
11528
|
-
const
|
|
11529
|
-
(F) =>
|
|
11525
|
+
const g = r.steps.find((E) => E.stepName === t);
|
|
11526
|
+
g?.type === v.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((F) => F.id));
|
|
11527
|
+
const f = h.map((E) => new Rt(E.id)), S = new en(this.constructSerializableWorkflow()), w = [...p, ...f, S];
|
|
11528
|
+
w.length > 0 && this.commandContext.apply(new L(w), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
11529
|
+
const I = this.getInvalidModelVariants(), b = this.modelContainer;
|
|
11530
|
+
if (b) {
|
|
11531
|
+
const E = I.map(
|
|
11532
|
+
(F) => b.applyModelVariant(
|
|
11530
11533
|
F,
|
|
11531
11534
|
{
|
|
11532
11535
|
contextService: this.getLayoutPreviewService()
|
|
@@ -11534,7 +11537,7 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11534
11537
|
!1
|
|
11535
11538
|
)
|
|
11536
11539
|
);
|
|
11537
|
-
await Promise.all(
|
|
11540
|
+
await Promise.all(E);
|
|
11538
11541
|
}
|
|
11539
11542
|
await this.onSelectionChange(), i && await i();
|
|
11540
11543
|
}
|
|
@@ -11543,7 +11546,7 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11543
11546
|
for (const l of i)
|
|
11544
11547
|
if (!this.stepInitialised[l.stepName])
|
|
11545
11548
|
switch (this.stepInitialised[l.stepName] = !0, l.type) {
|
|
11546
|
-
case
|
|
11549
|
+
case v.DigitalContent:
|
|
11547
11550
|
a.push(
|
|
11548
11551
|
ri.init(
|
|
11549
11552
|
l,
|
|
@@ -11552,43 +11555,43 @@ const al = (n) => n.sort((t, e) => t.index - e.index).map((t) => ({
|
|
|
11552
11555
|
)
|
|
11553
11556
|
);
|
|
11554
11557
|
break;
|
|
11555
|
-
case
|
|
11558
|
+
case v.Frame:
|
|
11556
11559
|
a.push(Et.init(l, this, this.reloadedState));
|
|
11557
11560
|
break;
|
|
11558
|
-
case
|
|
11561
|
+
case v.Illustration:
|
|
11559
11562
|
a.push(
|
|
11560
11563
|
Ee.init(l, this, this.reloadedState)
|
|
11561
11564
|
);
|
|
11562
11565
|
break;
|
|
11563
|
-
case
|
|
11566
|
+
case v.Material:
|
|
11564
11567
|
a.push(
|
|
11565
11568
|
oi.init(l, this, this.reloadedState)
|
|
11566
11569
|
);
|
|
11567
11570
|
break;
|
|
11568
|
-
case
|
|
11571
|
+
case v.Model:
|
|
11569
11572
|
a.push(si.init(l, this, this.reloadedState));
|
|
11570
11573
|
break;
|
|
11571
|
-
case
|
|
11574
|
+
case v.Module:
|
|
11572
11575
|
this.stepSpecificServices[l.stepName] = {
|
|
11573
11576
|
module: await Ai(l.data.module)
|
|
11574
11577
|
}, a.push(
|
|
11575
11578
|
li.init(l, this, this.reloadedState)
|
|
11576
11579
|
);
|
|
11577
11580
|
break;
|
|
11578
|
-
case
|
|
11581
|
+
case v.Picture:
|
|
11579
11582
|
a.push(
|
|
11580
11583
|
ci.init(l, this, this.reloadedState)
|
|
11581
11584
|
);
|
|
11582
11585
|
break;
|
|
11583
|
-
case
|
|
11586
|
+
case v.Question:
|
|
11584
11587
|
a.push(
|
|
11585
11588
|
di.init(l, this, this.reloadedState)
|
|
11586
11589
|
);
|
|
11587
11590
|
break;
|
|
11588
|
-
case
|
|
11591
|
+
case v.Shape:
|
|
11589
11592
|
a.push(Wt.init(l, this, this.reloadedState));
|
|
11590
11593
|
break;
|
|
11591
|
-
case
|
|
11594
|
+
case v.Text:
|
|
11592
11595
|
a.push(j.init(l, this, this.reloadedState));
|
|
11593
11596
|
break;
|
|
11594
11597
|
}
|
|
@@ -12341,27 +12344,27 @@ class hl extends et {
|
|
|
12341
12344
|
class pe {
|
|
12342
12345
|
static get(t, e) {
|
|
12343
12346
|
switch (e.type) {
|
|
12344
|
-
case
|
|
12347
|
+
case v.DigitalContent:
|
|
12345
12348
|
return new ul(t, e, t.getStepTags(e.stepName));
|
|
12346
|
-
case
|
|
12349
|
+
case v.Information:
|
|
12347
12350
|
return new Al(t, e, t.getStepTags(e.stepName));
|
|
12348
|
-
case
|
|
12351
|
+
case v.Question:
|
|
12349
12352
|
return new ll(t, e, t.getStepTags(e.stepName));
|
|
12350
|
-
case
|
|
12353
|
+
case v.Text:
|
|
12351
12354
|
return new dl(t, e, t.getStepTags(e.stepName));
|
|
12352
|
-
case
|
|
12355
|
+
case v.Illustration:
|
|
12353
12356
|
return new il(t, e, t.getStepTags(e.stepName));
|
|
12354
|
-
case
|
|
12357
|
+
case v.Picture:
|
|
12355
12358
|
return new sl(t, e, t.getStepTags(e.stepName));
|
|
12356
|
-
case
|
|
12359
|
+
case v.Shape:
|
|
12357
12360
|
return new cl(t, e, t.getStepTags(e.stepName));
|
|
12358
|
-
case
|
|
12361
|
+
case v.Material:
|
|
12359
12362
|
return new rl(t, e, t.getStepTags(e.stepName));
|
|
12360
|
-
case
|
|
12363
|
+
case v.Model:
|
|
12361
12364
|
return new ol(t, e, t.getStepTags(e.stepName));
|
|
12362
|
-
case
|
|
12365
|
+
case v.Frame:
|
|
12363
12366
|
return new hc(t, e, t.getStepTags(e.stepName));
|
|
12364
|
-
case
|
|
12367
|
+
case v.Module:
|
|
12365
12368
|
return new hl(t, e, t.getStepTags(e.stepName));
|
|
12366
12369
|
default:
|
|
12367
12370
|
throw new R(`Step type ${e.type} not yet supported in Core SDK`);
|
|
@@ -12581,7 +12584,7 @@ const pl = async (n, t) => {
|
|
|
12581
12584
|
await (async () => {
|
|
12582
12585
|
if (c !== void 0) return c;
|
|
12583
12586
|
await n.outstandingRequestsPromise();
|
|
12584
|
-
const T = (k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(i.id),
|
|
12587
|
+
const T = (k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map()).get(i.id), B = await y.getShadowGraphqlClient().query({
|
|
12585
12588
|
query: zn,
|
|
12586
12589
|
variables: { ids: [i.id] },
|
|
12587
12590
|
fetchPolicy: "no-cache",
|
|
@@ -12589,17 +12592,17 @@ const pl = async (n, t) => {
|
|
|
12589
12592
|
context: {
|
|
12590
12593
|
transactionOwnerId: T
|
|
12591
12594
|
}
|
|
12592
|
-
}), Q =
|
|
12593
|
-
return
|
|
12594
|
-
|
|
12595
|
+
}), Q = B.data?.transactions[0].workflowState;
|
|
12596
|
+
return B.errors ? (B.errors.forEach((U) => {
|
|
12597
|
+
B.errors && console.log("Server Error:", U.message);
|
|
12595
12598
|
}), null) : Q ?? null;
|
|
12596
12599
|
})() || (console.warn("State mismatch detected. Uploading known state explicitly"), console.warn("State Object:", JSON.stringify(a())), await n.updateStateWithServerImmediate(a), console.log("Server state is undefined @ Workflow completion"));
|
|
12597
12600
|
const u = n.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, p = l && ln(l, t, !0), g = l && ln(l, t, !1), f = async (x) => {
|
|
12598
12601
|
const T = {};
|
|
12599
12602
|
let $ = 0;
|
|
12600
12603
|
if (Object.keys(r).length > 0)
|
|
12601
|
-
for (const
|
|
12602
|
-
const Q = r[
|
|
12604
|
+
for (const B of Object.keys(r)) {
|
|
12605
|
+
const Q = r[B], U = t.steps.find((N) => N.stepName === B);
|
|
12603
12606
|
for (let N = 0; N < Q.selections.length; ++N) {
|
|
12604
12607
|
const q = Q.selections[N];
|
|
12605
12608
|
if (U && (!x || U.option && (U.option.variants || []).length > 1 && !U.data.hideSelectionInCart && !U.data.hideSelectionsInCart)) {
|
|
@@ -12620,18 +12623,18 @@ const pl = async (n, t) => {
|
|
|
12620
12623
|
}
|
|
12621
12624
|
}
|
|
12622
12625
|
return [T, $];
|
|
12623
|
-
}, [
|
|
12624
|
-
Object.keys(
|
|
12625
|
-
), [
|
|
12626
|
-
Object.keys(
|
|
12626
|
+
}, [S] = await f(!0), w = Object.fromEntries(
|
|
12627
|
+
Object.keys(S).map((x) => [x, S[x].map((T) => T.id)])
|
|
12628
|
+
), [I] = await f(!1), b = Object.fromEntries(
|
|
12629
|
+
Object.keys(I).map((x) => [
|
|
12627
12630
|
x,
|
|
12628
|
-
|
|
12631
|
+
I[x].map((T) => T.id)
|
|
12629
12632
|
])
|
|
12630
12633
|
);
|
|
12631
|
-
let
|
|
12632
|
-
if (
|
|
12633
|
-
const x = await (await it(
|
|
12634
|
-
|
|
12634
|
+
let E = await s(m, i.id);
|
|
12635
|
+
if (E) {
|
|
12636
|
+
const x = await (await it(E)).blob();
|
|
12637
|
+
E = (await V.uploadAsset(
|
|
12635
12638
|
{ name: `${i.id}-preview-image.png`, blob: x },
|
|
12636
12639
|
Pe.Image,
|
|
12637
12640
|
!0,
|
|
@@ -12649,23 +12652,23 @@ const pl = async (n, t) => {
|
|
|
12649
12652
|
workflowId: t.id,
|
|
12650
12653
|
transactionId: i.id,
|
|
12651
12654
|
useThreeDimPreview: !!m,
|
|
12652
|
-
previewImage:
|
|
12655
|
+
previewImage: E
|
|
12653
12656
|
};
|
|
12654
12657
|
if (g) {
|
|
12655
12658
|
const T = [];
|
|
12656
|
-
for (const [$,
|
|
12657
|
-
T.push({ key: $, value:
|
|
12659
|
+
for (const [$, B] of Object.entries(g))
|
|
12660
|
+
T.push({ key: $, value: B });
|
|
12658
12661
|
x.metadata = T;
|
|
12659
12662
|
}
|
|
12660
|
-
if (
|
|
12663
|
+
if (w) {
|
|
12661
12664
|
const T = [];
|
|
12662
|
-
for (const [$,
|
|
12663
|
-
T.push({ key: $, ids:
|
|
12665
|
+
for (const [$, B] of Object.entries(b))
|
|
12666
|
+
T.push({ key: $, ids: B });
|
|
12664
12667
|
x.selectedVariants = T;
|
|
12665
12668
|
}
|
|
12666
12669
|
return x;
|
|
12667
12670
|
})(),
|
|
12668
|
-
cartSelectionsWithPrices:
|
|
12671
|
+
cartSelectionsWithPrices: S,
|
|
12669
12672
|
cartMetadata: p
|
|
12670
12673
|
};
|
|
12671
12674
|
}, wl = async (n, t, e, a, i, r, o, s, l, c, d) => {
|
|
@@ -13115,7 +13118,7 @@ class Il {
|
|
|
13115
13118
|
}
|
|
13116
13119
|
let r = 2048;
|
|
13117
13120
|
e && e <= 2048 && (r = e);
|
|
13118
|
-
const o = Ct(r, r), s = this.workflowManager.getCommandContext().getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = s.find((
|
|
13121
|
+
const o = Ct(r, r), s = this.workflowManager.getCommandContext().getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = s.find((w) => w.layoutState?.layout.panelId === c?.name) || s[0], A = d.layoutState.layout.previewRegion ? {
|
|
13119
13122
|
x: d.layoutState.layout.previewRegion.left,
|
|
13120
13123
|
y: d.layoutState.layout.previewRegion.top,
|
|
13121
13124
|
width: d.layoutState.layout.previewRegion.width,
|
|
@@ -13143,8 +13146,8 @@ class Il {
|
|
|
13143
13146
|
DOMParser: Pa(),
|
|
13144
13147
|
fetch
|
|
13145
13148
|
})).render();
|
|
13146
|
-
const
|
|
13147
|
-
return o.toDataURL(
|
|
13149
|
+
const S = await this.getCanvasObjectURLAsync(o);
|
|
13150
|
+
return o.toDataURL(S);
|
|
13148
13151
|
}
|
|
13149
13152
|
getStepById(t) {
|
|
13150
13153
|
const e = this.getWorkflow()?.steps.find((r) => r.stepName === t);
|
|
@@ -13362,7 +13365,7 @@ class Il {
|
|
|
13362
13365
|
* @returns Returns true when a valid handle is implemented for a given step type. Certain steps don't support handles, such as silent illustrations.
|
|
13363
13366
|
*/
|
|
13364
13367
|
stepHasHandle(t) {
|
|
13365
|
-
return t.type !==
|
|
13368
|
+
return t.type !== v.SilentIllustration && t.type !== v.ProductOverlay;
|
|
13366
13369
|
}
|
|
13367
13370
|
getExportedStepData() {
|
|
13368
13371
|
const t = this.getWorkflow(), e = this.getWorkflowManager().getWorkflowMetadata(), a = this.getWorkflowManager().getWorkflowSelections(), i = [];
|
|
@@ -13381,7 +13384,7 @@ class Il {
|
|
|
13381
13384
|
return;
|
|
13382
13385
|
}
|
|
13383
13386
|
switch (r.type) {
|
|
13384
|
-
case
|
|
13387
|
+
case v.Frame:
|
|
13385
13388
|
{
|
|
13386
13389
|
const d = r.data, A = s;
|
|
13387
13390
|
A.image && d.displayImageOnFinishStep && c.properties.push({
|
|
@@ -13391,7 +13394,7 @@ class Il {
|
|
|
13391
13394
|
});
|
|
13392
13395
|
}
|
|
13393
13396
|
break;
|
|
13394
|
-
case
|
|
13397
|
+
case v.Illustration:
|
|
13395
13398
|
{
|
|
13396
13399
|
const d = r.data, A = s;
|
|
13397
13400
|
if (A && A.colors && A.colors.length > 0 && d.displayColorsOnFinishStep) {
|
|
@@ -13404,7 +13407,7 @@ class Il {
|
|
|
13404
13407
|
}
|
|
13405
13408
|
}
|
|
13406
13409
|
break;
|
|
13407
|
-
case
|
|
13410
|
+
case v.Module:
|
|
13408
13411
|
{
|
|
13409
13412
|
const d = r.data, A = s;
|
|
13410
13413
|
A && A.text && d.displayTextOnFinishStep && c.properties.push({
|
|
@@ -13414,7 +13417,7 @@ class Il {
|
|
|
13414
13417
|
});
|
|
13415
13418
|
}
|
|
13416
13419
|
break;
|
|
13417
|
-
case
|
|
13420
|
+
case v.Text: {
|
|
13418
13421
|
const d = r.data, A = s;
|
|
13419
13422
|
A && A.text && d.displayTextOnFinishStep && c.properties.push({
|
|
13420
13423
|
type: "text",
|
|
@@ -13468,14 +13471,14 @@ class Il {
|
|
|
13468
13471
|
}
|
|
13469
13472
|
const Bl = (n) => {
|
|
13470
13473
|
if ([
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13474
|
+
v.Question,
|
|
13475
|
+
v.Frame,
|
|
13476
|
+
v.Illustration,
|
|
13477
|
+
v.Material,
|
|
13478
|
+
v.Model,
|
|
13479
|
+
v.Picture,
|
|
13480
|
+
v.Shape,
|
|
13481
|
+
v.Text
|
|
13479
13482
|
].includes(n.type)) {
|
|
13480
13483
|
const e = n.data;
|
|
13481
13484
|
return !!e.displaySelectionOnFinishStep || !!e.displaySelectionsOnFinishStep;
|
|
@@ -13960,15 +13963,15 @@ class dn extends pi {
|
|
|
13960
13963
|
async applyColorVariant(t, e, a) {
|
|
13961
13964
|
const r = this.getSharedSteps(e).map((o) => {
|
|
13962
13965
|
switch (o.getType()) {
|
|
13963
|
-
case
|
|
13966
|
+
case v.Shape:
|
|
13964
13967
|
return o.selectVariant(t);
|
|
13965
|
-
case
|
|
13968
|
+
case v.Text:
|
|
13966
13969
|
return o.setFillColor({
|
|
13967
13970
|
fill: t.getColor(),
|
|
13968
13971
|
stroke: t.getColor(),
|
|
13969
13972
|
variant: t.getResource()
|
|
13970
13973
|
});
|
|
13971
|
-
case
|
|
13974
|
+
case v.Illustration:
|
|
13972
13975
|
return o.setColor(a?.toString() || "", t.getColor() || "");
|
|
13973
13976
|
}
|
|
13974
13977
|
});
|
|
@@ -13992,7 +13995,7 @@ const kl = (n, t, e, a) => n.flatMap((i) => i.getSteps()).filter((i) => i.getGlo
|
|
|
13992
13995
|
n,
|
|
13993
13996
|
t,
|
|
13994
13997
|
e,
|
|
13995
|
-
|
|
13998
|
+
v.Illustration
|
|
13996
13999
|
).map((r) => {
|
|
13997
14000
|
const o = r.getCurrentVariant()?.getAssetResource(), s = r.getColors();
|
|
13998
14001
|
return !o?.assetConfiguration || !s ? 0 : Object.getOwnPropertyNames(s).length;
|
|
@@ -14853,7 +14856,7 @@ class oa {
|
|
|
14853
14856
|
const m = h.map((p) => {
|
|
14854
14857
|
if (p.getType() === G.ColorOption || p.getType() === G.Option) {
|
|
14855
14858
|
const g = p;
|
|
14856
|
-
if (!u.aspects.find((
|
|
14859
|
+
if (!u.aspects.find((S) => S.name === g.getName()))
|
|
14857
14860
|
return g.initDefaultVariant();
|
|
14858
14861
|
}
|
|
14859
14862
|
});
|
|
@@ -15092,7 +15095,7 @@ class oa {
|
|
|
15092
15095
|
return this.productCollection ? new Ci(this.productCollection) : void 0;
|
|
15093
15096
|
}
|
|
15094
15097
|
async initializeAdditionalRequiredColorChannels(t) {
|
|
15095
|
-
for (const e of t.getStepsByType(
|
|
15098
|
+
for (const e of t.getStepsByType(v.Illustration)) {
|
|
15096
15099
|
const a = e.getGlobalPropertyAspects(this.globalConfigurationPropertyId || "");
|
|
15097
15100
|
for (const i of a) {
|
|
15098
15101
|
const r = this.getGlobalPropertyConfiguration()?.aspects.find(
|
|
@@ -16164,7 +16167,7 @@ class $d {
|
|
|
16164
16167
|
} catch (a) {
|
|
16165
16168
|
throw console.error(a), new gt("Critical - Unable to synchronize workflow state with server.");
|
|
16166
16169
|
}
|
|
16167
|
-
}, this.options = t, this.options.applicationKey && rr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 33.
|
|
16170
|
+
}, this.options = t, this.options.applicationKey && rr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 33.13.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
16168
16171
|
}
|
|
16169
16172
|
configure(t) {
|
|
16170
16173
|
ft.setHubUrl(t.hubUrl), ft.setServerUrl(t.serverUrl), ft.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 && sr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && zt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
|
@@ -16483,7 +16486,7 @@ class $d {
|
|
|
16483
16486
|
const m = await this.loggedInBearerToken();
|
|
16484
16487
|
l.Authorization = `Bearer ${m}`;
|
|
16485
16488
|
} catch {
|
|
16486
|
-
const g = Object.entries(localStorage).find(([
|
|
16489
|
+
const g = Object.entries(localStorage).find(([S, w]) => S.startsWith("CognitoIdentityServiceProvider") && S.endsWith("idToken"))?.[0] || "", f = localStorage.getItem(g);
|
|
16487
16490
|
f && !ee(f) && (l.Authorization = `Bearer ${f}`);
|
|
16488
16491
|
}
|
|
16489
16492
|
const c = {
|
|
@@ -16622,14 +16625,14 @@ class $d {
|
|
|
16622
16625
|
async getWorkflowExperiences(t, e, a, i) {
|
|
16623
16626
|
if (t.length === 0)
|
|
16624
16627
|
throw new gt("No options provided!");
|
|
16625
|
-
const r = t.map((
|
|
16626
|
-
(
|
|
16628
|
+
const r = t.map((B, Q) => ({ option: B, index: Q })), o = r.filter((B) => B.option.type === "transaction"), s = r.filter(
|
|
16629
|
+
(B) => B.option.type === "integration" || B.option.type === "external" || B.option.type === "blank"
|
|
16627
16630
|
), l = 50, c = Va(o, l), d = Va(s, l);
|
|
16628
16631
|
let A = 0;
|
|
16629
|
-
const u = y.getShadowGraphqlClient(), h = async (
|
|
16630
|
-
if (
|
|
16632
|
+
const u = y.getShadowGraphqlClient(), h = async (B) => {
|
|
16633
|
+
if (B.length === 0)
|
|
16631
16634
|
return [];
|
|
16632
|
-
const Q =
|
|
16635
|
+
const Q = B.map((q) => q.option.transactionId), U = await u.query({
|
|
16633
16636
|
query: Vr,
|
|
16634
16637
|
variables: {
|
|
16635
16638
|
ids: Q
|
|
@@ -16637,23 +16640,23 @@ class $d {
|
|
|
16637
16640
|
errorPolicy: "all",
|
|
16638
16641
|
fetchPolicy: "no-cache"
|
|
16639
16642
|
}), N = U.data.transactions;
|
|
16640
|
-
if (A = A + N.length, i && i(A, o.length), N.length !==
|
|
16643
|
+
if (A = A + N.length, i && i(A, o.length), N.length !== B.length) {
|
|
16641
16644
|
const q = U.errors?.[0]?.message || "Unknown error";
|
|
16642
16645
|
throw new gt(`Not all transactions were found: ${q}`);
|
|
16643
16646
|
}
|
|
16644
16647
|
return !this.activeIntegration && N[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(N[0].integrationProduct.integration)), N.map((q, St) => ({
|
|
16645
16648
|
transaction: q,
|
|
16646
16649
|
workflowId: q.workflowId,
|
|
16647
|
-
readOnly:
|
|
16648
|
-
index:
|
|
16650
|
+
readOnly: B.find((ut) => ut.option.transactionId === q.id)?.option.readOnly ?? !1,
|
|
16651
|
+
index: B[St].index
|
|
16649
16652
|
}));
|
|
16650
|
-
}, m = async (
|
|
16651
|
-
if (
|
|
16653
|
+
}, m = async (B) => {
|
|
16654
|
+
if (B.length === 0)
|
|
16652
16655
|
return [];
|
|
16653
16656
|
const Q = await u.mutate({
|
|
16654
16657
|
mutation: Ur,
|
|
16655
16658
|
variables: {
|
|
16656
|
-
inputs:
|
|
16659
|
+
inputs: B.map((N) => ({
|
|
16657
16660
|
integrationProductId: N.option.type === "integration" ? N.option.integrationProductId : void 0,
|
|
16658
16661
|
externalIntegrationId: N.option.type === "external" ? N.option.externalIntegrationId : void 0,
|
|
16659
16662
|
externalProductId: N.option.type === "external" ? N.option.externalProductId : void 0,
|
|
@@ -16677,26 +16680,26 @@ class $d {
|
|
|
16677
16680
|
transaction: N,
|
|
16678
16681
|
workflowId: N.workflowId,
|
|
16679
16682
|
readOnly: !1,
|
|
16680
|
-
index:
|
|
16683
|
+
index: B[q].index
|
|
16681
16684
|
}));
|
|
16682
16685
|
}, p = (await Promise.all([
|
|
16683
16686
|
...c.map(h),
|
|
16684
16687
|
...d.map(m)
|
|
16685
16688
|
])).flat(), g = [
|
|
16686
|
-
...new Set(p.map((
|
|
16687
|
-
].filter((
|
|
16688
|
-
(
|
|
16689
|
-
), [
|
|
16689
|
+
...new Set(p.map((B) => B.transaction.integrationProductId))
|
|
16690
|
+
].filter((B) => B !== void 0), f = [...new Set(p.map((B) => B.workflowId))].filter(
|
|
16691
|
+
(B) => B !== void 0
|
|
16692
|
+
), [S, w] = await Promise.all([
|
|
16690
16693
|
(async () => g.length > 0 ? await lc(g) : [])(),
|
|
16691
16694
|
(async () => f.length > 0 ? await yi(f, e) : [])()
|
|
16692
|
-
]),
|
|
16693
|
-
const { transaction: Q, workflowId: U, readOnly: N, index: q } =
|
|
16695
|
+
]), I = new Map(S.map((B) => [B.id, B])), b = new Map(w.map((B) => [B.id, B])), E = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), F = p.map(async (B) => {
|
|
16696
|
+
const { transaction: Q, workflowId: U, readOnly: N, index: q } = B, St = U ? b.get(U) : void 0, ut = t[q];
|
|
16694
16697
|
if (Q.integrationProductId) {
|
|
16695
|
-
const rt =
|
|
16698
|
+
const rt = I.get(Q.integrationProductId);
|
|
16696
16699
|
Q.integrationProduct = rt, Q.product = rt?.product, Q.integrationProduct || console.error("failed to find transaction's product");
|
|
16697
16700
|
}
|
|
16698
|
-
!
|
|
16699
|
-
const He =
|
|
16701
|
+
!E.get(Q.id) && Q.transactionOwnerId && E.set(Q.id, Q.transactionOwnerId);
|
|
16702
|
+
const He = E.get(Q.id) || void 0, bi = new ec({
|
|
16700
16703
|
onMutate: () => ({ context: { transactionOwnerId: He, bundleOwnerId: e?.bundleOwnerId } }),
|
|
16701
16704
|
onQuery: () => ({ context: { transactionOwnerId: He, bundleOwnerId: e?.bundleOwnerId } })
|
|
16702
16705
|
}), Ae = {
|
|
@@ -16722,11 +16725,11 @@ class $d {
|
|
|
16722
16725
|
}
|
|
16723
16726
|
return Ae.delayWorkflowStateSync = !0, { experienceOptions: Ae, index: q, options: ut };
|
|
16724
16727
|
}), x = await Promise.all(F);
|
|
16725
|
-
k.setMap("transactionOwnerIds",
|
|
16726
|
-
const T = x.sort((
|
|
16728
|
+
k.setMap("transactionOwnerIds", E);
|
|
16729
|
+
const T = x.sort((B, Q) => B.index - Q.index);
|
|
16727
16730
|
let $ = [];
|
|
16728
|
-
for (const
|
|
16729
|
-
const { experienceOptions: Q, options: U } =
|
|
16731
|
+
for (const B of T) {
|
|
16732
|
+
const { experienceOptions: Q, options: U } = B, N = new Il(this, Q);
|
|
16730
16733
|
await N.getWorkflowManager().getInitializationPromise(), a && a(), U.type !== "transaction" && this.customer && await N.attachCustomerDetails({ email: this.customer.emailAddress }), $ = [...$, N], N.getWorkflowManager().setWorkflowStateSyncEnabled(!0);
|
|
16731
16734
|
}
|
|
16732
16735
|
return $;
|
|
@@ -17975,7 +17978,7 @@ export {
|
|
|
17975
17978
|
Fe as StakeholderType,
|
|
17976
17979
|
zi as StepAspectType,
|
|
17977
17980
|
et as StepHandle,
|
|
17978
|
-
|
|
17981
|
+
v as StepType,
|
|
17979
17982
|
Tt as TextAlgorithm,
|
|
17980
17983
|
$o as TextChangeCommand,
|
|
17981
17984
|
xl as TextGlobalPropertyHandle,
|