@spiffcommerce/core 26.21.1-beta.2b34ee5b-1f7e-5d31-8b98-09fa8952c35d → 26.21.1-beta.9277f4d4-a84b-5ad3-8822-ff3a64c69eb5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -2
- package/dist/index.js +37 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +234 -230
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -331,8 +331,8 @@ class Qr {
|
|
|
331
331
|
const p = window.__SENTRY__.hub;
|
|
332
332
|
if (p) {
|
|
333
333
|
const C = p.traceHeaders();
|
|
334
|
-
Object.entries(C).forEach(([w,
|
|
335
|
-
l[w] =
|
|
334
|
+
Object.entries(C).forEach(([w, B]) => {
|
|
335
|
+
l[w] = B;
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
}
|
|
@@ -5266,15 +5266,15 @@ const Q = () => {
|
|
|
5266
5266
|
viewBox: A,
|
|
5267
5267
|
width: u
|
|
5268
5268
|
}) => {
|
|
5269
|
-
var
|
|
5270
|
-
const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, f = `${g.x} ${g.y} ${g.width} ${g.height}`, p = Q(), C = a.purpose === Gt.FreeDesign && /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ F("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (
|
|
5269
|
+
var E;
|
|
5270
|
+
const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, f = `${g.x} ${g.y} ${g.width} ${g.height}`, p = Q(), C = a.purpose === Gt.FreeDesign && /* @__PURE__ */ F("defs", { children: /* @__PURE__ */ F("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ F("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (E = a.colorProfiles) == null ? void 0 : E.map((S, I) => (
|
|
5271
5271
|
/* @ts-ignore */
|
|
5272
|
-
/* @__PURE__ */ F("color-profile", { name:
|
|
5273
|
-
)),
|
|
5274
|
-
...
|
|
5272
|
+
/* @__PURE__ */ F("color-profile", { name: S.name, xlinkHref: S.key, children: " " }, I)
|
|
5273
|
+
)), B = n.map((S) => ({
|
|
5274
|
+
...S,
|
|
5275
5275
|
_renderingConfiguration: a,
|
|
5276
5276
|
mask: l ? `url(#viewmask-${p})` : void 0
|
|
5277
|
-
})),
|
|
5277
|
+
})), v = ya(B);
|
|
5278
5278
|
return /* @__PURE__ */ lt(
|
|
5279
5279
|
"svg",
|
|
5280
5280
|
{
|
|
@@ -5311,7 +5311,7 @@ const Q = () => {
|
|
|
5311
5311
|
{
|
|
5312
5312
|
id: "element-group",
|
|
5313
5313
|
clipPath: a.purpose === Gt.FreeDesign ? "url(#viewboxClip)" : void 0,
|
|
5314
|
-
children:
|
|
5314
|
+
children: v.map((S) => Qn(S)).filter((S) => !!S)
|
|
5315
5315
|
}
|
|
5316
5316
|
),
|
|
5317
5317
|
l && /* @__PURE__ */ F(
|
|
@@ -5353,12 +5353,12 @@ const Q = () => {
|
|
|
5353
5353
|
}
|
|
5354
5354
|
);
|
|
5355
5355
|
}, rc = (r, t, e, a, n) => {
|
|
5356
|
-
const i = gt(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, f = u * A - m * d, p = h * A - g * d, C = u * d + m * A, w = h * d + g * A,
|
|
5356
|
+
const i = gt(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, f = u * A - m * d, p = h * A - g * d, C = u * d + m * A, w = h * d + g * A, B = Math.max(Math.abs(f), Math.abs(p)), v = Math.max(Math.abs(C), Math.abs(w));
|
|
5357
5357
|
return {
|
|
5358
|
-
minX: l -
|
|
5359
|
-
maxX: l +
|
|
5360
|
-
minY: c -
|
|
5361
|
-
maxY: c +
|
|
5358
|
+
minX: l - B,
|
|
5359
|
+
maxX: l + B,
|
|
5360
|
+
minY: c - v,
|
|
5361
|
+
maxY: c + v
|
|
5362
5362
|
};
|
|
5363
5363
|
}, ic = (r, t, e) => {
|
|
5364
5364
|
const a = Math.sqrt(Math.pow(t.x - r.x, 2) + Math.pow(t.y - r.y, 2)), n = Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)), i = Math.sqrt(Math.pow(e.x - r.x, 2) + Math.pow(e.y - r.y, 2));
|
|
@@ -5516,8 +5516,8 @@ const Q = () => {
|
|
|
5516
5516
|
/* @__PURE__ */ F("feFuncB", { type: "discrete", tableValues: n() })
|
|
5517
5517
|
] })
|
|
5518
5518
|
] }) }) }), s = r.rotation || 0, o = gt(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
|
|
5519
|
-
var w,
|
|
5520
|
-
const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((
|
|
5519
|
+
var w, B, v, E, S, I, P, x, M, N;
|
|
5520
|
+
const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((B = r.pattern) == null ? void 0 : B.y) || 0, h = ((v = r.pattern) == null ? void 0 : v.width) || 0, m = ((E = r.pattern) == null ? void 0 : E.height) || 0, g = ((S = r.pattern) == null ? void 0 : S.scaleX) || 1, f = ((I = r.pattern) == null ? void 0 : I.scaleY) || 1, p = ((P = r.pattern) == null ? void 0 : P.rotation) || 0;
|
|
5521
5521
|
return [(x = r.pattern) != null && x.svg ? {
|
|
5522
5522
|
id: `${t}-contents`,
|
|
5523
5523
|
type: T.Illustration,
|
|
@@ -5663,8 +5663,8 @@ const Ui = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5663
5663
|
var m, g, f;
|
|
5664
5664
|
if (h.type === "font-face" && h.declarations) {
|
|
5665
5665
|
const p = (m = h.declarations.find(
|
|
5666
|
-
(
|
|
5667
|
-
)) == null ? void 0 : m.value, C = (g = h.declarations.find((
|
|
5666
|
+
(B) => B.property === "font-family"
|
|
5667
|
+
)) == null ? void 0 : m.value, C = (g = h.declarations.find((B) => B.property === "src")) == null ? void 0 : g.value, w = (f = C == null ? void 0 : C.match(/'(https.*?)'/)) == null ? void 0 : f[1];
|
|
5668
5668
|
p && w && n.set(p, w);
|
|
5669
5669
|
}
|
|
5670
5670
|
});
|
|
@@ -5676,18 +5676,18 @@ const Ui = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Oe = /* @_
|
|
|
5676
5676
|
0,
|
|
5677
5677
|
0,
|
|
5678
5678
|
parseInt(u.getAttribute("font-size") ?? "72")
|
|
5679
|
-
),
|
|
5680
|
-
let
|
|
5681
|
-
const
|
|
5682
|
-
|
|
5683
|
-
const
|
|
5679
|
+
), B = w.getBoundingBox().x2 - w.getBoundingBox().x1;
|
|
5680
|
+
let v = 0;
|
|
5681
|
+
const E = A.getAttribute("text-anchor");
|
|
5682
|
+
E === "middle" ? v = B / 2 : E === "end" && (v = B);
|
|
5683
|
+
const S = g.getPath(
|
|
5684
5684
|
A.innerHTML,
|
|
5685
|
-
parseFloat(A.getAttribute("x") ?? "0") -
|
|
5685
|
+
parseFloat(A.getAttribute("x") ?? "0") - v,
|
|
5686
5686
|
parseFloat(A.getAttribute("y") ?? "0"),
|
|
5687
5687
|
parseInt(u.getAttribute("font-size") ?? "72")
|
|
5688
5688
|
);
|
|
5689
|
-
|
|
5690
|
-
const I =
|
|
5689
|
+
S.fill = f, S.stroke = p, S.strokeWidth = parseFloat(C ?? "0");
|
|
5690
|
+
const I = S.toSVG(2), x = t.parseFromString(I, "image/svg+xml").firstElementChild;
|
|
5691
5691
|
h.appendChild(x);
|
|
5692
5692
|
}
|
|
5693
5693
|
return e.querySelectorAll("text").forEach((d) => d.remove()), Et().serializeToString(a);
|
|
@@ -7674,7 +7674,7 @@ class we {
|
|
|
7674
7674
|
f,
|
|
7675
7675
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
|
7676
7676
|
t.data.forceImageCover
|
|
7677
|
-
) : void 0,
|
|
7677
|
+
) : void 0, B = p ? {
|
|
7678
7678
|
id: Q(),
|
|
7679
7679
|
src: p.src,
|
|
7680
7680
|
x: (w == null ? void 0 : w.x) || 0,
|
|
@@ -7684,18 +7684,18 @@ class we {
|
|
|
7684
7684
|
scaleX: (w == null ? void 0 : w.zoom) || 1,
|
|
7685
7685
|
scaleY: (w == null ? void 0 : w.zoom) || 1,
|
|
7686
7686
|
rotation: 0
|
|
7687
|
-
} : void 0,
|
|
7688
|
-
if (!
|
|
7687
|
+
} : void 0, v = Q(), S = n.getLayouts().find((I) => I.panelId === m.panelId);
|
|
7688
|
+
if (!S)
|
|
7689
7689
|
throw new Y(m);
|
|
7690
7690
|
return {
|
|
7691
|
-
command: this.getCreateElementCommand(
|
|
7691
|
+
command: this.getCreateElementCommand(v, m, S, {
|
|
7692
7692
|
frameData: f,
|
|
7693
|
-
pattern:
|
|
7693
|
+
pattern: B,
|
|
7694
7694
|
disablePlaceholder: t.data.disablePlaceholder,
|
|
7695
7695
|
stepName: t.stepName
|
|
7696
7696
|
}),
|
|
7697
7697
|
regionEl: {
|
|
7698
|
-
id:
|
|
7698
|
+
id: v,
|
|
7699
7699
|
region: m
|
|
7700
7700
|
},
|
|
7701
7701
|
removeExistingCommands: C
|
|
@@ -7940,13 +7940,13 @@ class os {
|
|
|
7940
7940
|
if (!l)
|
|
7941
7941
|
throw new Wt(o);
|
|
7942
7942
|
const c = await ot(await this.getIllustrationBody(l)), d = await qt(c.svg), A = (C) => {
|
|
7943
|
-
const w = i.getLayouts().find((
|
|
7943
|
+
const w = i.getLayouts().find((v) => v.panelId === C.panelId);
|
|
7944
7944
|
if (!w)
|
|
7945
7945
|
throw new Y(C);
|
|
7946
|
-
const
|
|
7946
|
+
const B = Q();
|
|
7947
7947
|
return {
|
|
7948
|
-
regionElement: { id:
|
|
7949
|
-
command: this.getCreateElementCommand(
|
|
7948
|
+
regionElement: { id: B, region: C },
|
|
7949
|
+
command: this.getCreateElementCommand(B, C, w, {
|
|
7950
7950
|
stepName: t.stepName,
|
|
7951
7951
|
src: l,
|
|
7952
7952
|
objectURL: d,
|
|
@@ -7958,40 +7958,40 @@ class os {
|
|
|
7958
7958
|
const f = t.data.colorOption;
|
|
7959
7959
|
return f && ((p = f.variants) == null || p.forEach((C) => {
|
|
7960
7960
|
g = g.map((w) => {
|
|
7961
|
-
var
|
|
7962
|
-
return w.toLowerCase() === ((
|
|
7961
|
+
var B;
|
|
7962
|
+
return w.toLowerCase() === ((B = C.color) == null ? void 0 : B.toLowerCase()) ? C.name : w;
|
|
7963
7963
|
});
|
|
7964
7964
|
})), i.updateMetadata(t.stepName, { colors: g }), {
|
|
7965
7965
|
command: new O(m),
|
|
7966
7966
|
followup: async () => {
|
|
7967
|
-
var w,
|
|
7967
|
+
var w, B;
|
|
7968
7968
|
await i.setSelectionsAndElements(
|
|
7969
7969
|
t.stepName,
|
|
7970
7970
|
[e],
|
|
7971
|
-
u.map((
|
|
7971
|
+
u.map((v) => v.regionElement),
|
|
7972
7972
|
async () => {
|
|
7973
7973
|
i.setMandatoryFulfilled(t.stepName, !0), n(!1);
|
|
7974
7974
|
}
|
|
7975
7975
|
);
|
|
7976
7976
|
const C = ((w = o.assetConfiguration) == null ? void 0 : w.defaultColorVariants) || [];
|
|
7977
7977
|
if (C.length !== 0) {
|
|
7978
|
-
const
|
|
7979
|
-
(((
|
|
7978
|
+
const v = {};
|
|
7979
|
+
(((B = o.assetConfiguration) == null ? void 0 : B.channelNumbers) || []).forEach((S) => {
|
|
7980
7980
|
var P;
|
|
7981
|
-
const I = C.find((x) => x.channelNumber ===
|
|
7982
|
-
I && (
|
|
7981
|
+
const I = C.find((x) => x.channelNumber === S.number);
|
|
7982
|
+
I && (v[`${S.id.replace(/\W/g, "")}`] = { browserValue: ((P = I == null ? void 0 : I.variant) == null ? void 0 : P.color) || "" });
|
|
7983
7983
|
}), await this.changeColors(
|
|
7984
7984
|
t,
|
|
7985
|
-
u.map((
|
|
7985
|
+
u.map((S) => S.regionElement),
|
|
7986
7986
|
i,
|
|
7987
7987
|
() => i.getCommandContext().getAllLayouts(),
|
|
7988
|
-
new Map(Object.entries(
|
|
7988
|
+
new Map(Object.entries(v))
|
|
7989
7989
|
);
|
|
7990
7990
|
}
|
|
7991
7991
|
if (t.data.colorPickerEnabled) {
|
|
7992
|
-
const
|
|
7993
|
-
if (
|
|
7994
|
-
const I =
|
|
7992
|
+
const v = await this.availableColors(t, i) || [], E = Object.keys(c.colors), S = v.length === 1 && E.length === 1;
|
|
7993
|
+
if (S) {
|
|
7994
|
+
const I = v[0], P = E[0];
|
|
7995
7995
|
await this.changeColors(
|
|
7996
7996
|
t,
|
|
7997
7997
|
u.map((x) => x.regionElement),
|
|
@@ -8000,7 +8000,7 @@ class os {
|
|
|
8000
8000
|
/* @__PURE__ */ new Map([[P, I.variant.color]])
|
|
8001
8001
|
);
|
|
8002
8002
|
}
|
|
8003
|
-
!
|
|
8003
|
+
!S && C.length === 0 && await this.changeColors(
|
|
8004
8004
|
t,
|
|
8005
8005
|
u.map((I) => I.regionElement),
|
|
8006
8006
|
i,
|
|
@@ -8983,8 +8983,8 @@ class ps {
|
|
|
8983
8983
|
g,
|
|
8984
8984
|
async () => {
|
|
8985
8985
|
e.updateMetadata(t.stepName, { color: f, text: p }), e.updateStorage(t.stepName, { text: p, inputText: p });
|
|
8986
|
-
const w = o.map((
|
|
8987
|
-
e.getCommandDispatcher()(
|
|
8986
|
+
const w = o.map((v) => new Va(v.id, m)), B = new O(w);
|
|
8987
|
+
e.getCommandDispatcher()(B);
|
|
8988
8988
|
}
|
|
8989
8989
|
);
|
|
8990
8990
|
const { command: C } = q.updateInputText(
|
|
@@ -9132,7 +9132,7 @@ class ps {
|
|
|
9132
9132
|
colorProfileAssetKey: (g = f.colorProfile) == null ? void 0 : g.key
|
|
9133
9133
|
});
|
|
9134
9134
|
}
|
|
9135
|
-
const C = await this.getDefaultColor(a), w = C || "#000000",
|
|
9135
|
+
const C = await this.getDefaultColor(a), w = C || "#000000", B = {
|
|
9136
9136
|
stepRegion: A,
|
|
9137
9137
|
stepName: t,
|
|
9138
9138
|
align: this.textAlign(a),
|
|
@@ -9156,34 +9156,34 @@ class ps {
|
|
|
9156
9156
|
curved: a.curved,
|
|
9157
9157
|
paths: a.paths,
|
|
9158
9158
|
fillSpotColorDefinition: p
|
|
9159
|
-
},
|
|
9160
|
-
if (!
|
|
9159
|
+
}, v = [], E = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
9160
|
+
if (!B.fontData)
|
|
9161
9161
|
throw new z("Failed to resolve font data for text.");
|
|
9162
9162
|
const [I, P] = Ae(
|
|
9163
|
-
|
|
9164
|
-
|
|
9163
|
+
B.fontSize,
|
|
9164
|
+
B.fontData,
|
|
9165
9165
|
{
|
|
9166
|
-
left:
|
|
9167
|
-
top:
|
|
9168
|
-
width:
|
|
9169
|
-
height:
|
|
9170
|
-
rotation:
|
|
9166
|
+
left: B.x,
|
|
9167
|
+
top: B.y,
|
|
9168
|
+
width: B.width,
|
|
9169
|
+
height: B.height,
|
|
9170
|
+
rotation: B.rotation,
|
|
9171
9171
|
panelId: ""
|
|
9172
9172
|
},
|
|
9173
9173
|
[l],
|
|
9174
9174
|
{ size: a.size, minSize: a.minSize, maxSize: a.maxSize }
|
|
9175
9175
|
);
|
|
9176
|
-
|
|
9176
|
+
E.set(B.id, I), S.set(B.id, P);
|
|
9177
9177
|
const x = a.curved || a.vertical ? l : (P || []).join(`
|
|
9178
9178
|
`);
|
|
9179
|
-
|
|
9180
|
-
this.generateTextChangeCommandsForRegion(I, a,
|
|
9179
|
+
v.push(
|
|
9180
|
+
this.generateTextChangeCommandsForRegion(I, a, B.id, x)
|
|
9181
9181
|
);
|
|
9182
|
-
const M = new W(
|
|
9182
|
+
const M = new W(B, h);
|
|
9183
9183
|
return {
|
|
9184
9184
|
regionElement: { id: m, region: A },
|
|
9185
|
-
commands: [M, ...
|
|
9186
|
-
newElement:
|
|
9185
|
+
commands: [M, ...v],
|
|
9186
|
+
newElement: B,
|
|
9187
9187
|
fontData: n
|
|
9188
9188
|
};
|
|
9189
9189
|
} catch (f) {
|
|
@@ -9218,29 +9218,29 @@ class ps {
|
|
|
9218
9218
|
*/
|
|
9219
9219
|
async changeInputTextWithRegion(t, e, a, n, i, s, o, l, c, d) {
|
|
9220
9220
|
const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = s.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
9221
|
-
for (const
|
|
9222
|
-
if (
|
|
9223
|
-
const [
|
|
9221
|
+
for (const B of h)
|
|
9222
|
+
if (B.region) {
|
|
9223
|
+
const [v, E] = Ae(
|
|
9224
9224
|
e,
|
|
9225
9225
|
a,
|
|
9226
|
-
|
|
9226
|
+
B.region,
|
|
9227
9227
|
[u],
|
|
9228
9228
|
{ size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
|
|
9229
9229
|
);
|
|
9230
|
-
m.set(
|
|
9230
|
+
m.set(B.id, v), g.set(B.id, E);
|
|
9231
9231
|
}
|
|
9232
9232
|
const p = (() => {
|
|
9233
9233
|
if (t.data && t.data.maxLength && u.length > t.data.maxLength)
|
|
9234
9234
|
return d && d(!0), { info: "0" };
|
|
9235
|
-
const
|
|
9236
|
-
for (const
|
|
9237
|
-
for (const
|
|
9238
|
-
const I =
|
|
9239
|
-
if (
|
|
9235
|
+
const B = s.getProfanities(), v = Ke(u.toLowerCase());
|
|
9236
|
+
for (const E of v)
|
|
9237
|
+
for (const S in B) {
|
|
9238
|
+
const I = B[S].toLowerCase().replace(/\s/g, "");
|
|
9239
|
+
if (E === I)
|
|
9240
9240
|
return l(!0), { error: "Blocked profanity." };
|
|
9241
9241
|
}
|
|
9242
9242
|
return !t.data.vertical && !t.data.allowNewlines && (u.includes(`
|
|
9243
|
-
`) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((
|
|
9243
|
+
`) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((S) => S) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - u.length).toString() });
|
|
9244
9244
|
})();
|
|
9245
9245
|
if (p.error) {
|
|
9246
9246
|
c(p.error);
|
|
@@ -9252,15 +9252,15 @@ class ps {
|
|
|
9252
9252
|
text: this.injectReplaceableText(A, t.data)
|
|
9253
9253
|
}), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
|
|
9254
9254
|
const C = [];
|
|
9255
|
-
for (const
|
|
9256
|
-
const
|
|
9255
|
+
for (const B of h) {
|
|
9256
|
+
const v = t.data.curved ? u : (g.get(B.id) || []).join(`
|
|
9257
9257
|
`);
|
|
9258
9258
|
C.push(
|
|
9259
9259
|
this.generateTextChangeCommandsForRegion(
|
|
9260
|
-
m.get(
|
|
9260
|
+
m.get(B.id) || 1,
|
|
9261
9261
|
t.data,
|
|
9262
|
-
|
|
9263
|
-
|
|
9262
|
+
B.id,
|
|
9263
|
+
v
|
|
9264
9264
|
)
|
|
9265
9265
|
);
|
|
9266
9266
|
}
|
|
@@ -9426,14 +9426,14 @@ class Is extends Cs {
|
|
|
9426
9426
|
const a = Li(ws), i = t !== "" ? ((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
|
|
9427
9427
|
const w = tt("g");
|
|
9428
9428
|
w.classList.add("module-text-group");
|
|
9429
|
-
const
|
|
9430
|
-
w.appendChild(
|
|
9431
|
-
const
|
|
9432
|
-
|
|
9433
|
-
const B = tt("g");
|
|
9434
|
-
B.classList.add("module-layer0"), w.appendChild(B), B.setAttribute("filter", "url(#shadow)"), B.innerHTML = S.outerHTML;
|
|
9429
|
+
const B = tt("defs");
|
|
9430
|
+
w.appendChild(B), B.appendChild(Ss(0, 2, 2, "shadow"));
|
|
9431
|
+
const v = tt("path");
|
|
9432
|
+
v.setAttribute("d", d), v.setAttribute("stroke", "black"), v.setAttribute("stroke-width", "3"), B.appendChild(v);
|
|
9435
9433
|
const E = tt("g");
|
|
9436
|
-
E.classList.add("module-
|
|
9434
|
+
E.classList.add("module-layer0"), w.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = v.outerHTML;
|
|
9435
|
+
const S = tt("g");
|
|
9436
|
+
S.classList.add("module-layer1"), w.appendChild(S), S.setAttribute("stroke-width", "3"), S.setAttribute("stroke", "rgb(45,41,38)"), S.setAttribute("fill", "rgb(45,41,38)"), S.setAttribute("transform", "translate(0.5,0)"), S.innerHTML = o;
|
|
9437
9437
|
const I = tt("g");
|
|
9438
9438
|
I.classList.add("module-layer2"), w.appendChild(I), I.setAttribute("fill", "rgb(255,209,0)"), I.setAttribute("transform", "translate(1,-0.1)"), I.innerHTML = o;
|
|
9439
9439
|
const P = tt("g");
|
|
@@ -10017,13 +10017,13 @@ class ja extends Dn {
|
|
|
10017
10017
|
class eo {
|
|
10018
10018
|
constructor(t, e, a, n, i, s, o, l, c, d, A, u, h = !1, m, g = !1, f = !1, p = !1) {
|
|
10019
10019
|
this.workflowStatePromiseQueue = new Pn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
|
|
10020
|
-
var
|
|
10020
|
+
var B;
|
|
10021
10021
|
if (!this.previewService)
|
|
10022
10022
|
return;
|
|
10023
|
-
const C = this.getCommandContext().getAllLayouts(), w = (
|
|
10023
|
+
const C = this.getCommandContext().getAllLayouts(), w = (B = this.getLayoutPreviewService()) == null ? void 0 : B.getAll();
|
|
10024
10024
|
if (w)
|
|
10025
|
-
for (const [,
|
|
10026
|
-
|
|
10025
|
+
for (const [, v] of w)
|
|
10026
|
+
v.render(C);
|
|
10027
10027
|
}, this.experience = t, this.client = e, this.updateTransaction = o, this.commandContext = s, this.reloadedState = u, this.transaction = l, this.readOnly = h, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = n, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = c, this.previewService = d, this.modelContainer = m, this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, this.validationErrors = { steps: /* @__PURE__ */ new Map() }, this.confirmCallbacks = [], this.editedCallbacks = [], this.elementsCallbacks = [], this.informationResultCallbacks = [], this.initCallbacks = [], this.mandatoryCallbacks = [], this.makingAdjustmentsCallback = [], this.metadataCallbacks = [], this.selectionCallbacks = [], this.stepSpecificStorageCallbacks = {}, this.storageCallbacks = [], this.validationCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = A, this.isReloadedTransaction = g, this.workflow.steps.forEach((C) => {
|
|
10028
10028
|
this.stepTags[C.stepName] = C.tags ?? [];
|
|
10029
10029
|
}), p && (this.workflowStatePromiseQueue.enabled = !1), this.initializationPromise = this.initializeDefaultWorkflowState(a), this.initializationPromise.then(() => {
|
|
@@ -10498,19 +10498,19 @@ class eo {
|
|
|
10498
10498
|
), this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, await this.ensureStepsAreLoaded();
|
|
10499
10499
|
}
|
|
10500
10500
|
async setSelectionsAndElements(t, e, a, n) {
|
|
10501
|
-
var
|
|
10501
|
+
var v;
|
|
10502
10502
|
const i = this.stepSelections;
|
|
10503
10503
|
this.stepSelections = {
|
|
10504
10504
|
...this.stepSelections,
|
|
10505
10505
|
[t]: { selectedVariants: e }
|
|
10506
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((
|
|
10507
|
-
Ct(
|
|
10506
|
+
}, this.selectionCost = Object.values(this.stepSelections).reduce((E, S) => E + S.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, P) => I + P, 0), 0), this.workflow.steps.forEach((E) => {
|
|
10507
|
+
Ct(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1, delete this.stepMetadata[E.stepName], delete this.stepSelections[E.stepName], delete this.storage[E.stepName]);
|
|
10508
10508
|
});
|
|
10509
|
-
const s = this.allScenes, o = It(s, i), l = It(s, this.stepSelections), c = o.map((
|
|
10510
|
-
(
|
|
10509
|
+
const s = this.allScenes, o = It(s, i), l = It(s, this.stepSelections), c = o.map((E) => E.silentSteps).flat(), A = l.map((E) => E.silentSteps).flat().filter(
|
|
10510
|
+
(E) => !c.some((S) => S.stepName === E.stepName)
|
|
10511
10511
|
);
|
|
10512
|
-
c.forEach((
|
|
10513
|
-
Ct(
|
|
10512
|
+
c.forEach((E) => {
|
|
10513
|
+
Ct(E, this.stepSelections) || (this.stepInitialised[E.stepName] = !1);
|
|
10514
10514
|
});
|
|
10515
10515
|
const u = this.getInvalidCanvasRegions(), { stepElements: h, commands: m } = await this.stepElementsForIntroducedSilentSteps(A, !1);
|
|
10516
10516
|
this.stepElements = {
|
|
@@ -10518,25 +10518,25 @@ class eo {
|
|
|
10518
10518
|
...h,
|
|
10519
10519
|
[t]: a
|
|
10520
10520
|
}, this.removeElements(u);
|
|
10521
|
-
const g = this.workflow.steps.find((
|
|
10521
|
+
const g = this.workflow.steps.find((E) => E.stepName === t);
|
|
10522
10522
|
if ((g == null ? void 0 : g.type) === D.Frame) {
|
|
10523
|
-
const
|
|
10524
|
-
|
|
10523
|
+
const E = (v = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : v.frameService;
|
|
10524
|
+
E == null || E.setTargetElements(a.map((S) => S.id));
|
|
10525
10525
|
}
|
|
10526
|
-
const f = u.map((
|
|
10526
|
+
const f = u.map((E) => new vt(E.id)), p = new $a(this.constructSerializableWorkflow()), C = [...m, ...f, p];
|
|
10527
10527
|
C.length > 0 && this.commandContext.apply(new O(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
|
10528
|
-
const w = this.getInvalidModelVariants(),
|
|
10529
|
-
if (
|
|
10530
|
-
const
|
|
10531
|
-
(
|
|
10532
|
-
|
|
10528
|
+
const w = this.getInvalidModelVariants(), B = this.modelContainer;
|
|
10529
|
+
if (B) {
|
|
10530
|
+
const E = w.map(
|
|
10531
|
+
(S) => B.applyModelVariant(
|
|
10532
|
+
S,
|
|
10533
10533
|
{
|
|
10534
10534
|
contextService: this.getLayoutPreviewService()
|
|
10535
10535
|
},
|
|
10536
10536
|
!1
|
|
10537
10537
|
)
|
|
10538
10538
|
);
|
|
10539
|
-
await Promise.all(
|
|
10539
|
+
await Promise.all(E);
|
|
10540
10540
|
}
|
|
10541
10541
|
await this.onSelectionChange(), n && await n();
|
|
10542
10542
|
}
|
|
@@ -11633,16 +11633,16 @@ const go = async (r) => {
|
|
|
11633
11633
|
return [x, M];
|
|
11634
11634
|
}, [C] = await p(!0), w = Object.fromEntries(
|
|
11635
11635
|
Object.keys(C).map((P) => [P, C[P].map((x) => x.id)])
|
|
11636
|
-
), [
|
|
11637
|
-
Object.keys(
|
|
11636
|
+
), [B] = await p(!1), v = Object.fromEntries(
|
|
11637
|
+
Object.keys(B).map((P) => [
|
|
11638
11638
|
P,
|
|
11639
|
-
|
|
11639
|
+
B[P].map((x) => x.id)
|
|
11640
11640
|
])
|
|
11641
11641
|
);
|
|
11642
|
-
let
|
|
11643
|
-
if (
|
|
11644
|
-
const P = await (await ct(
|
|
11645
|
-
|
|
11642
|
+
let E = await o(m, n.id);
|
|
11643
|
+
if (E) {
|
|
11644
|
+
const P = await (await ct(E)).blob();
|
|
11645
|
+
E = (await U.uploadAsset(
|
|
11646
11646
|
{ name: `${n.id}-preview-image.png`, blob: P },
|
|
11647
11647
|
he.Image,
|
|
11648
11648
|
!0,
|
|
@@ -11660,7 +11660,7 @@ const go = async (r) => {
|
|
|
11660
11660
|
workflowId: t.id,
|
|
11661
11661
|
transactionId: n.id,
|
|
11662
11662
|
useThreeDimPreview: !!m,
|
|
11663
|
-
previewImage:
|
|
11663
|
+
previewImage: E
|
|
11664
11664
|
};
|
|
11665
11665
|
if (f) {
|
|
11666
11666
|
const x = [];
|
|
@@ -11670,7 +11670,7 @@ const go = async (r) => {
|
|
|
11670
11670
|
}
|
|
11671
11671
|
if (w) {
|
|
11672
11672
|
const x = [];
|
|
11673
|
-
for (const [M, N] of Object.entries(
|
|
11673
|
+
for (const [M, N] of Object.entries(v))
|
|
11674
11674
|
x.push({ key: M, ids: N });
|
|
11675
11675
|
P.selectedVariants = x;
|
|
11676
11676
|
}
|
|
@@ -11985,39 +11985,32 @@ class bo {
|
|
|
11985
11985
|
getWorkflowManager() {
|
|
11986
11986
|
return this.workflowManager;
|
|
11987
11987
|
}
|
|
11988
|
-
async
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
let i = 2048;
|
|
11997
|
-
e && e <= 2048 && (i = e);
|
|
11998
|
-
const s = mt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((v) => {
|
|
11999
|
-
var S;
|
|
12000
|
-
return ((S = v.layoutState) == null ? void 0 : S.layout.panelId) === (c == null ? void 0 : c.name);
|
|
12001
|
-
}) || o[0], A = d.layoutState.layout.previewRegion ? {
|
|
12002
|
-
x: d.layoutState.layout.previewRegion.left,
|
|
12003
|
-
y: d.layoutState.layout.previewRegion.top,
|
|
12004
|
-
width: d.layoutState.layout.previewRegion.width,
|
|
12005
|
-
height: d.layoutState.layout.previewRegion.height
|
|
12006
|
-
} : {
|
|
11988
|
+
async create2dImage(t, e, a) {
|
|
11989
|
+
let n = 2048;
|
|
11990
|
+
e && e <= 2048 && (n = e);
|
|
11991
|
+
const i = mt(n, n), s = i.getContext("2d");
|
|
11992
|
+
if (!s)
|
|
11993
|
+
throw new Be("Failed to obtain 2D context for preview image creation");
|
|
11994
|
+
const o = this.commandContext.getLayoutById(t);
|
|
11995
|
+
let l = {
|
|
12007
11996
|
x: 0,
|
|
12008
11997
|
y: 0,
|
|
12009
|
-
width:
|
|
12010
|
-
height:
|
|
12011
|
-
}
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
11998
|
+
width: o.layoutState.layout.width,
|
|
11999
|
+
height: o.layoutState.layout.height
|
|
12000
|
+
};
|
|
12001
|
+
a && o.layoutState.layout.previewRegion && (l = {
|
|
12002
|
+
x: o.layoutState.layout.previewRegion.left,
|
|
12003
|
+
y: o.layoutState.layout.previewRegion.top,
|
|
12004
|
+
width: o.layoutState.layout.previewRegion.width,
|
|
12005
|
+
height: o.layoutState.layout.previewRegion.height
|
|
12006
|
+
});
|
|
12007
|
+
const c = wa(o.layoutState.layout, o.layoutState.elements, {
|
|
12015
12008
|
renderingConfiguration: {
|
|
12016
12009
|
purpose: Gt.Print,
|
|
12017
|
-
region: { left:
|
|
12010
|
+
region: { left: l.x, top: l.y, width: l.width, height: l.height }
|
|
12018
12011
|
}
|
|
12019
|
-
}),
|
|
12020
|
-
await (await ca.from(
|
|
12012
|
+
}), d = dn(c);
|
|
12013
|
+
await (await ca.from(s, d, {
|
|
12021
12014
|
anonymousCrossOrigin: !0,
|
|
12022
12015
|
ignoreDimensions: !1,
|
|
12023
12016
|
createCanvas: mt,
|
|
@@ -12025,8 +12018,22 @@ class bo {
|
|
|
12025
12018
|
DOMParser: ha(),
|
|
12026
12019
|
fetch
|
|
12027
12020
|
})).render();
|
|
12028
|
-
const
|
|
12029
|
-
return
|
|
12021
|
+
const u = await this.getCanvasObjectURLAsync(i);
|
|
12022
|
+
return i.toDataURL(u);
|
|
12023
|
+
}
|
|
12024
|
+
async createPreviewImage(t, e) {
|
|
12025
|
+
var c, d;
|
|
12026
|
+
const a = this.workflowManager.getWorkflow(), n = (c = a == null ? void 0 : a.finalizeStepConfig) == null ? void 0 : c.lookAtAnimation;
|
|
12027
|
+
if (t) {
|
|
12028
|
+
if (!n)
|
|
12029
|
+
throw new Error("Failed to generate cart preview image!");
|
|
12030
|
+
return await ((d = this.workflowManager.getPreviewService()) == null ? void 0 : d.renderSceneScreenshot(e ?? 512, n)) || "";
|
|
12031
|
+
}
|
|
12032
|
+
const i = this.commandContext.getAllLayouts(), s = a.defaultPreviewPanelIndex || 0, o = a.panels[s], l = i.find((A) => {
|
|
12033
|
+
var u;
|
|
12034
|
+
return ((u = A.layoutState) == null ? void 0 : u.layout.panelId) === (o == null ? void 0 : o.name);
|
|
12035
|
+
}) || i[0];
|
|
12036
|
+
return this.create2dImage(l.layoutState.layout.id, e, !0);
|
|
12030
12037
|
}
|
|
12031
12038
|
getStepById(t) {
|
|
12032
12039
|
const e = this.getWorkflowManager().getWorkflow().steps.find((i) => i.stepName === t);
|
|
@@ -12414,17 +12421,17 @@ const Io = [
|
|
|
12414
12421
|
return console.error(o), [];
|
|
12415
12422
|
}
|
|
12416
12423
|
}, xo = async (r, t, e, a) => {
|
|
12417
|
-
var
|
|
12424
|
+
var v, E;
|
|
12418
12425
|
const n = e.data, i = a.option;
|
|
12419
12426
|
if (!i)
|
|
12420
12427
|
return console.error(`No option for step ${a.stepName}.`), [];
|
|
12421
|
-
const s = ((
|
|
12428
|
+
const s = ((v = i.variants) == null ? void 0 : v.find((S) => S.id === n.illustrationVariantId)) || te(i);
|
|
12422
12429
|
if (!s)
|
|
12423
12430
|
return console.error(`No variant with ID: ${n.illustrationVariantId}`), [];
|
|
12424
12431
|
if (!s.asset)
|
|
12425
12432
|
return console.error(`No asset for variant with ID: ${n.illustrationVariantId}`), [];
|
|
12426
12433
|
t[a.stepName] = { selectedVariants: [s] };
|
|
12427
|
-
const o = (
|
|
12434
|
+
const o = (E = s.asset) == null ? void 0 : E.fileLink;
|
|
12428
12435
|
if (!o)
|
|
12429
12436
|
return console.error(`No asset link for variant with ID: ${n.illustrationVariantId}`), [];
|
|
12430
12437
|
const l = await at(o, !0), c = /<svg.*?<\/svg>/s, d = l.match(c) || [], A = (d == null ? void 0 : d.length) > 0 ? d[0] : "", m = dt().parseFromString(A, "image/svg+xml").firstElementChild;
|
|
@@ -12432,32 +12439,32 @@ const Io = [
|
|
|
12432
12439
|
return console.error("Failed to read SVG."), [];
|
|
12433
12440
|
ma(m);
|
|
12434
12441
|
const g = {};
|
|
12435
|
-
Ft(m, (
|
|
12436
|
-
Io.includes(
|
|
12437
|
-
const I =
|
|
12442
|
+
Ft(m, (S) => {
|
|
12443
|
+
Io.includes(S.tagName) && !S.attributes.getNamedItem("fill") && S.setAttribute("fill", "#000000");
|
|
12444
|
+
const I = S.attributes.getNamedItem("fill");
|
|
12438
12445
|
if (I && I.value !== "none") {
|
|
12439
12446
|
const x = I.value, N = `spiff-fill-${x.replace(/\W/g, "")}`;
|
|
12440
|
-
|
|
12447
|
+
S.classList.add(N), g[N] = { browserValue: x };
|
|
12441
12448
|
}
|
|
12442
|
-
const P =
|
|
12449
|
+
const P = S.attributes.getNamedItem("stroke");
|
|
12443
12450
|
if (P && P.value !== "none") {
|
|
12444
12451
|
const x = P.value, N = `spiff-stroke-${x.replace(/\W/g, "")}`;
|
|
12445
|
-
|
|
12452
|
+
S.classList.add(N), g[N] = { browserValue: x };
|
|
12446
12453
|
}
|
|
12447
12454
|
});
|
|
12448
12455
|
const p = Et().serializeToString(m), C = n.colors;
|
|
12449
12456
|
if (C) {
|
|
12450
|
-
for (const [
|
|
12457
|
+
for (const [S, I] of Object.entries(g))
|
|
12451
12458
|
for (const P of Object.keys(C))
|
|
12452
12459
|
if (I.browserValue === P) {
|
|
12453
|
-
g[
|
|
12460
|
+
g[S] = { browserValue: C[P] };
|
|
12454
12461
|
break;
|
|
12455
12462
|
}
|
|
12456
12463
|
}
|
|
12457
|
-
const w = (
|
|
12458
|
-
const I = r.find((x) => x.panelId ===
|
|
12464
|
+
const w = (S) => {
|
|
12465
|
+
const I = r.find((x) => x.panelId === S.panelId);
|
|
12459
12466
|
if (!I)
|
|
12460
|
-
throw new Y(
|
|
12467
|
+
throw new Y(S);
|
|
12461
12468
|
const P = Q();
|
|
12462
12469
|
return new W(
|
|
12463
12470
|
{
|
|
@@ -12465,22 +12472,22 @@ const Io = [
|
|
|
12465
12472
|
id: P,
|
|
12466
12473
|
svg: p,
|
|
12467
12474
|
type: T.Illustration,
|
|
12468
|
-
y:
|
|
12469
|
-
x:
|
|
12470
|
-
rotation:
|
|
12471
|
-
width:
|
|
12472
|
-
height:
|
|
12473
|
-
layer:
|
|
12474
|
-
layerIndex:
|
|
12475
|
-
immutable:
|
|
12475
|
+
y: S.top,
|
|
12476
|
+
x: S.left,
|
|
12477
|
+
rotation: S.rotation,
|
|
12478
|
+
width: S.width,
|
|
12479
|
+
height: S.height,
|
|
12480
|
+
layer: S.layer,
|
|
12481
|
+
layerIndex: S.layerIndex,
|
|
12482
|
+
immutable: S.immutable
|
|
12476
12483
|
},
|
|
12477
12484
|
I
|
|
12478
12485
|
);
|
|
12479
|
-
},
|
|
12486
|
+
}, B = a.data.regions;
|
|
12480
12487
|
try {
|
|
12481
|
-
return
|
|
12482
|
-
} catch (
|
|
12483
|
-
return console.error(
|
|
12488
|
+
return B.map(w);
|
|
12489
|
+
} catch (S) {
|
|
12490
|
+
return console.error(S), [];
|
|
12484
12491
|
}
|
|
12485
12492
|
}, Fo = async (r, t, e) => {
|
|
12486
12493
|
const a = await Hn(e.data.module), n = t.data, i = (o, l) => {
|
|
@@ -12684,7 +12691,7 @@ const Io = [
|
|
|
12684
12691
|
const f = a.option;
|
|
12685
12692
|
if (!f)
|
|
12686
12693
|
return;
|
|
12687
|
-
const p = ((w = f.variants) == null ? void 0 : w.find((
|
|
12694
|
+
const p = ((w = f.variants) == null ? void 0 : w.find((B) => B.id === i.fontVariantId)) || te(f);
|
|
12688
12695
|
if (!p || !p.asset)
|
|
12689
12696
|
return;
|
|
12690
12697
|
t[a.stepName] = { selectedVariants: [p] };
|
|
@@ -12736,7 +12743,7 @@ const Io = [
|
|
|
12736
12743
|
y: f.top
|
|
12737
12744
|
};
|
|
12738
12745
|
if (d) {
|
|
12739
|
-
const [w,
|
|
12746
|
+
const [w, B] = Ae(
|
|
12740
12747
|
a.data.size || s,
|
|
12741
12748
|
d,
|
|
12742
12749
|
f,
|
|
@@ -12757,7 +12764,7 @@ const Io = [
|
|
|
12757
12764
|
{
|
|
12758
12765
|
...C,
|
|
12759
12766
|
fontSize: w,
|
|
12760
|
-
text: C.curved ? C.text : (
|
|
12767
|
+
text: C.curved ? C.text : (B || []).join(`
|
|
12761
12768
|
`)
|
|
12762
12769
|
},
|
|
12763
12770
|
p
|
|
@@ -12979,9 +12986,7 @@ class Vo extends Dn {
|
|
|
12979
12986
|
l = i.width, c = i.height;
|
|
12980
12987
|
const d = wa(t.layoutState.layout, e, {
|
|
12981
12988
|
renderingConfiguration: { purpose: Gt.ThreeD }
|
|
12982
|
-
}), A = dn(d)
|
|
12983
|
-
console.log(`in execute: ${A}`);
|
|
12984
|
-
const u = await ca.from(this.ctx, A, {
|
|
12989
|
+
}), A = dn(d), u = await ca.from(this.ctx, A, {
|
|
12985
12990
|
anonymousCrossOrigin: !0,
|
|
12986
12991
|
ignoreDimensions: !this.nonPOTSupport,
|
|
12987
12992
|
ignoreAnimation: !0,
|
|
@@ -15215,7 +15220,7 @@ class kc {
|
|
|
15215
15220
|
} catch (a) {
|
|
15216
15221
|
throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
|
|
15217
15222
|
}
|
|
15218
|
-
}, this.options = t, this.options.applicationKey && xr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.21.1
|
|
15223
|
+
}, this.options = t, this.options.applicationKey && xr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.21.1"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
15219
15224
|
}
|
|
15220
15225
|
configure(t) {
|
|
15221
15226
|
wt.setHubUrl(t.hubUrl), wt.setServerUrl(t.serverUrl), wt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, t.bearerAuthenticationToken && kr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();
|
|
@@ -15318,13 +15323,13 @@ class kc {
|
|
|
15318
15323
|
if (f && await this.authenticateCustomerId(f)) {
|
|
15319
15324
|
const C = ((h = (u = this.customer) == null ? void 0 : u.bundleStakeholders) == null ? void 0 : h.find(
|
|
15320
15325
|
(w) => {
|
|
15321
|
-
var
|
|
15322
|
-
return (
|
|
15326
|
+
var B, v;
|
|
15327
|
+
return (v = (B = w.bundle) == null ? void 0 : B.transactions) == null ? void 0 : v.some((E) => E.id === t);
|
|
15323
15328
|
}
|
|
15324
15329
|
)) || ((g = (m = this.customer) == null ? void 0 : m.stakeholders) == null ? void 0 : g.find(
|
|
15325
15330
|
(w) => {
|
|
15326
|
-
var
|
|
15327
|
-
return ((
|
|
15331
|
+
var B;
|
|
15332
|
+
return ((B = w.transaction) == null ? void 0 : B.id) === t;
|
|
15328
15333
|
}
|
|
15329
15334
|
));
|
|
15330
15335
|
if (C)
|
|
@@ -15522,7 +15527,7 @@ class kc {
|
|
|
15522
15527
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
15523
15528
|
*/
|
|
15524
15529
|
async getExistingBundle(t, e, a, n) {
|
|
15525
|
-
var f, p, C, w,
|
|
15530
|
+
var f, p, C, w, B, v, E, S, I, P, x;
|
|
15526
15531
|
const i = k.getMap("bundleOwnerIds"), s = i == null ? void 0 : i.get(t), l = ((f = Object.entries(localStorage).find(([M, N]) => M.startsWith("CognitoIdentityServiceProvider") && M.endsWith("idToken"))) == null ? void 0 : f[0]) || "", c = localStorage.getItem(l), d = {};
|
|
15527
15532
|
c && !ve(c) && (d.Authorization = `Bearer ${c}`);
|
|
15528
15533
|
const A = {
|
|
@@ -15539,9 +15544,9 @@ class kc {
|
|
|
15539
15544
|
headers: A
|
|
15540
15545
|
}
|
|
15541
15546
|
});
|
|
15542
|
-
if (!((
|
|
15547
|
+
if (!((B = u.data) != null && B.bundles) || ((v = u.data) == null ? void 0 : v.bundles.length) === 0 || !((E = u.data) != null && E.bundles[0]))
|
|
15543
15548
|
throw new Error(`Unable to find bundle: ${t}`);
|
|
15544
|
-
const h = (
|
|
15549
|
+
const h = (S = u.data) == null ? void 0 : S.bundles[0], m = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
15545
15550
|
m.set(h.id, h.partner.id), k.setMap("bundlePartnerIds", m);
|
|
15546
15551
|
const g = new He(this, h, e, a, s, {
|
|
15547
15552
|
additionalHeaders: (I = n == null ? void 0 : n.graphql) == null ? void 0 : I.additionalHeaders,
|
|
@@ -15558,15 +15563,15 @@ class kc {
|
|
|
15558
15563
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
15559
15564
|
*/
|
|
15560
15565
|
async duplicateBundle(t, e, a, n) {
|
|
15561
|
-
var f, p, C, w,
|
|
15566
|
+
var f, p, C, w, B, v, E, S;
|
|
15562
15567
|
const i = (f = k.getMap("bundleOwnerIds")) == null ? void 0 : f.get(t), o = ((p = Object.entries(localStorage).find(([I, P]) => I.startsWith("CognitoIdentityServiceProvider") && I.endsWith("idToken"))) == null ? void 0 : p[0]) || "", l = localStorage.getItem(o), c = {};
|
|
15563
15568
|
l && !ve(l) && (c.Authorization = `Bearer ${l}`);
|
|
15564
15569
|
const d = {
|
|
15565
15570
|
bundleOwnerId: i,
|
|
15566
15571
|
...c,
|
|
15567
15572
|
...(C = n == null ? void 0 : n.graphql) == null ? void 0 : C.additionalHeaders
|
|
15568
|
-
}, u = (
|
|
15569
|
-
mutation: Rs(((
|
|
15573
|
+
}, u = (v = (await b.getShadowGraphqlClient().mutate({
|
|
15574
|
+
mutation: Rs(((B = (w = n == null ? void 0 : n.graphql) == null ? void 0 : w.productCollection) == null ? void 0 : B.eagerFetchProducts) || !1),
|
|
15570
15575
|
variables: {
|
|
15571
15576
|
id: t,
|
|
15572
15577
|
template: e,
|
|
@@ -15578,7 +15583,7 @@ class kc {
|
|
|
15578
15583
|
headers: d
|
|
15579
15584
|
},
|
|
15580
15585
|
fetchPolicy: "no-cache"
|
|
15581
|
-
})).data) == null ? void 0 :
|
|
15586
|
+
})).data) == null ? void 0 : v.bundleDuplicate;
|
|
15582
15587
|
if (!(u != null && u.id))
|
|
15583
15588
|
throw new Error("Unable to duplicate bundle");
|
|
15584
15589
|
const h = k.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
|
|
@@ -15586,7 +15591,7 @@ class kc {
|
|
|
15586
15591
|
const m = k.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
|
|
15587
15592
|
m.set(u.id, u.bundleOwnerId), k.setMap("bundleOwnerIds", m);
|
|
15588
15593
|
const g = new He(this, u, void 0, void 0, u.bundleOwnerId, {
|
|
15589
|
-
eagerFetchProducts: (
|
|
15594
|
+
eagerFetchProducts: (S = (E = n == null ? void 0 : n.graphql) == null ? void 0 : E.productCollection) == null ? void 0 : S.eagerFetchProducts
|
|
15590
15595
|
});
|
|
15591
15596
|
return await g.getInitializationPromise(), g;
|
|
15592
15597
|
}
|
|
@@ -15658,20 +15663,20 @@ class kc {
|
|
|
15658
15663
|
async getWorkflowExperiences(t, e) {
|
|
15659
15664
|
if (t.length === 0)
|
|
15660
15665
|
throw new ut("No options provided!");
|
|
15661
|
-
const a = b.getShadowGraphqlClient(), n = async (
|
|
15666
|
+
const a = b.getShadowGraphqlClient(), n = async (v) => {
|
|
15662
15667
|
var P, x, M;
|
|
15663
|
-
if (
|
|
15668
|
+
if (v.length === 0)
|
|
15664
15669
|
return [];
|
|
15665
|
-
const
|
|
15670
|
+
const E = v.map((N) => N.option.transactionId), S = await a.query({
|
|
15666
15671
|
query: di,
|
|
15667
15672
|
variables: {
|
|
15668
|
-
ids:
|
|
15673
|
+
ids: E
|
|
15669
15674
|
},
|
|
15670
15675
|
errorPolicy: "all",
|
|
15671
15676
|
fetchPolicy: "no-cache"
|
|
15672
|
-
}), I =
|
|
15673
|
-
if (I.length !==
|
|
15674
|
-
const N = ((x = (P =
|
|
15677
|
+
}), I = S.data.transactions;
|
|
15678
|
+
if (I.length !== v.length) {
|
|
15679
|
+
const N = ((x = (P = S.errors) == null ? void 0 : P[0]) == null ? void 0 : x.message) || "Unknown error";
|
|
15675
15680
|
throw new ut(`Not all transactions were found: ${N}`);
|
|
15676
15681
|
}
|
|
15677
15682
|
return !this.activeIntegration && ((M = I[0].integrationProduct) != null && M.integration) && (this.activeIntegration = Promise.resolve(I[0].integrationProduct.integration)), I.map((N, V) => {
|
|
@@ -15679,18 +15684,18 @@ class kc {
|
|
|
15679
15684
|
return {
|
|
15680
15685
|
transaction: N,
|
|
15681
15686
|
workflowId: N.workflowId,
|
|
15682
|
-
readOnly: ((j =
|
|
15683
|
-
index:
|
|
15687
|
+
readOnly: ((j = v.find((G) => G.option.transactionId === N.id)) == null ? void 0 : j.option.readOnly) ?? !1,
|
|
15688
|
+
index: v[V].index
|
|
15684
15689
|
};
|
|
15685
15690
|
});
|
|
15686
|
-
}, i = async (
|
|
15691
|
+
}, i = async (v) => {
|
|
15687
15692
|
var I, P, x;
|
|
15688
|
-
if (
|
|
15693
|
+
if (v.length === 0)
|
|
15689
15694
|
return [];
|
|
15690
|
-
const
|
|
15695
|
+
const E = await a.mutate({
|
|
15691
15696
|
mutation: ci,
|
|
15692
15697
|
variables: {
|
|
15693
|
-
inputs:
|
|
15698
|
+
inputs: v.map((M) => ({
|
|
15694
15699
|
integrationProductId: M.option.type === "integration" ? M.option.integrationProductId : void 0,
|
|
15695
15700
|
externalIntegrationId: M.option.type === "external" ? M.option.externalIntegrationId : void 0,
|
|
15696
15701
|
externalProductId: M.option.type === "external" ? M.option.externalProductId : void 0,
|
|
@@ -15703,29 +15708,29 @@ class kc {
|
|
|
15703
15708
|
},
|
|
15704
15709
|
errorPolicy: "all",
|
|
15705
15710
|
fetchPolicy: "no-cache"
|
|
15706
|
-
}),
|
|
15707
|
-
if (!
|
|
15708
|
-
const M = ((x = (P =
|
|
15711
|
+
}), S = (I = E.data) == null ? void 0 : I.transactionCreateMany;
|
|
15712
|
+
if (!S || S.length === 0) {
|
|
15713
|
+
const M = ((x = (P = E.errors) == null ? void 0 : P[0]) == null ? void 0 : x.message) || "Unknown error";
|
|
15709
15714
|
throw new ut(`Failed to create transactions: ${M}`);
|
|
15710
15715
|
}
|
|
15711
|
-
return
|
|
15716
|
+
return S.map((M, N) => ({
|
|
15712
15717
|
transaction: M,
|
|
15713
15718
|
workflowId: M.workflowId,
|
|
15714
15719
|
readOnly: !1,
|
|
15715
|
-
index:
|
|
15720
|
+
index: v[N].index
|
|
15716
15721
|
}));
|
|
15717
|
-
}, s = t.map((
|
|
15718
|
-
(
|
|
15722
|
+
}, s = t.map((v, E) => ({ option: v, index: E })), o = s.filter((v) => v.option.type === "transaction"), l = s.filter(
|
|
15723
|
+
(v) => v.option.type === "integration" || v.option.type === "external"
|
|
15719
15724
|
), c = Da(o, 10), d = Da(l, 10), A = (await Promise.all([
|
|
15720
15725
|
...c.map(n),
|
|
15721
15726
|
...d.map(i)
|
|
15722
|
-
])).flat(), u = [...new Set(A.map((
|
|
15727
|
+
])).flat(), u = [...new Set(A.map((v) => v.workflowId))], h = await Zn(u, e), m = new Map(h.map((v) => [v.id, v])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), f = A.map(async (v) => {
|
|
15723
15728
|
var j;
|
|
15724
|
-
const { transaction:
|
|
15725
|
-
!g.get(
|
|
15726
|
-
const N = g.get(
|
|
15727
|
-
product:
|
|
15728
|
-
transaction:
|
|
15729
|
+
const { transaction: E, workflowId: S, readOnly: I, index: P } = v, x = m.get(S), M = t[P];
|
|
15730
|
+
!g.get(E.id) && E.transactionOwnerId && g.set(E.id, E.transactionOwnerId);
|
|
15731
|
+
const N = g.get(E.id) || void 0, V = {
|
|
15732
|
+
product: E.product,
|
|
15733
|
+
transaction: E,
|
|
15729
15734
|
layouts: [],
|
|
15730
15735
|
singleVariantsRenderable: (j = M == null ? void 0 : M.workflowConfiguration) == null ? void 0 : j.singleVariantsRenderable,
|
|
15731
15736
|
stateMutationFunc: I ? async () => {
|
|
@@ -15738,8 +15743,8 @@ class kc {
|
|
|
15738
15743
|
workflow: x,
|
|
15739
15744
|
isReloadedTransaction: M.type === "transaction"
|
|
15740
15745
|
};
|
|
15741
|
-
if (M.type === "transaction" &&
|
|
15742
|
-
const G = JSON.parse(
|
|
15746
|
+
if (M.type === "transaction" && E.workflowState) {
|
|
15747
|
+
const G = JSON.parse(E.workflowState);
|
|
15743
15748
|
V.layouts = Object.values(G.layouts || {}).map((nt) => nt.layout), await La(G), V.reloadedState = G;
|
|
15744
15749
|
} else if (!I && M.workflowState) {
|
|
15745
15750
|
const G = JSON.parse(M.workflowState);
|
|
@@ -15754,11 +15759,11 @@ class kc {
|
|
|
15754
15759
|
), V.delayWorkflowStateSync = !0, { experienceOptions: V, index: P, options: M };
|
|
15755
15760
|
}), p = await Promise.all(f);
|
|
15756
15761
|
k.setMap("transactionOwnerIds", g);
|
|
15757
|
-
const w = p.sort((
|
|
15758
|
-
const { experienceOptions:
|
|
15759
|
-
return await I.getWorkflowManager().getInitializationPromise(),
|
|
15760
|
-
}),
|
|
15761
|
-
return
|
|
15762
|
+
const w = p.sort((v, E) => v.index - E.index).map(async (v) => {
|
|
15763
|
+
const { experienceOptions: E, options: S } = v, I = new bo(this, E);
|
|
15764
|
+
return await I.getWorkflowManager().getInitializationPromise(), S.type !== "transaction" && this.customer && await I.attachCustomerDetails({ email: this.customer.emailAddress }), I;
|
|
15765
|
+
}), B = await Promise.all(w);
|
|
15766
|
+
return B.forEach((v) => v.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), B;
|
|
15762
15767
|
}
|
|
15763
15768
|
storeCustomer(t) {
|
|
15764
15769
|
const e = k.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
|
|
@@ -16941,7 +16946,6 @@ export {
|
|
|
16941
16946
|
Zl as registerFetchImplementation,
|
|
16942
16947
|
Xl as registerWindowImplementation,
|
|
16943
16948
|
La as rehydrateSerializedLayout,
|
|
16944
|
-
dn as renderPapyrusComponentAsString,
|
|
16945
16949
|
Lr as rgbToPms,
|
|
16946
16950
|
re as rotateAroundPoint,
|
|
16947
16951
|
ma as sanitizeSvgTree,
|