@spiffcommerce/core 32.3.0-beta.69d8a509-cc6d-54dc-80c5-1c8b6fee8d45 → 32.3.0-beta.a29b838d-4b58-56cd-884c-4af2137bb2ba
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 +2 -0
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -99
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -343,8 +343,8 @@ class Kr {
|
|
343
343
|
const f = window.__SENTRY__.hub;
|
344
344
|
if (f) {
|
345
345
|
const S = f.traceHeaders();
|
346
|
-
Object.entries(S).forEach(([
|
347
|
-
l[
|
346
|
+
Object.entries(S).forEach(([B, I]) => {
|
347
|
+
l[B] = I;
|
348
348
|
});
|
349
349
|
}
|
350
350
|
}
|
@@ -5342,7 +5342,7 @@ const M = () => {
|
|
5342
5342
|
viewBox: A,
|
5343
5343
|
width: u
|
5344
5344
|
}) => {
|
5345
|
-
const h = e || 0, m = 2 * (l?.scale || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = M(), S = a.purpose === jt.FreeDesign && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ D("rect", { width: g.width, height: g.height, rx: h }) }) }),
|
5345
|
+
const h = e || 0, m = 2 * (l?.scale || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = M(), S = a.purpose === jt.FreeDesign && /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ D("rect", { width: g.width, height: g.height, rx: h }) }) }), B = a.colorProfiles?.map((E, P) => (
|
5346
5346
|
/* @ts-ignore */
|
5347
5347
|
/* @__PURE__ */ D("color-profile", { name: E.name, xlinkHref: E.key, children: " " }, P)
|
5348
5348
|
)), I = r.map((E) => ({
|
@@ -5369,7 +5369,7 @@ const M = () => {
|
|
5369
5369
|
},
|
5370
5370
|
viewBox: p,
|
5371
5371
|
children: [
|
5372
|
-
|
5372
|
+
B,
|
5373
5373
|
S,
|
5374
5374
|
!!n && /* @__PURE__ */ D(
|
5375
5375
|
"rect",
|
@@ -5428,7 +5428,7 @@ const M = () => {
|
|
5428
5428
|
}
|
5429
5429
|
);
|
5430
5430
|
}, Yc = (n, t, e, a, r) => {
|
5431
|
-
const i = ft(r), s = e / 2, o = a / 2, l = n + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, S = u * d + m * A,
|
5431
|
+
const i = ft(r), s = e / 2, o = a / 2, l = n + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, S = u * d + m * A, B = h * d + g * A, I = Math.max(Math.abs(p), Math.abs(f)), C = Math.max(Math.abs(S), Math.abs(B));
|
5432
5432
|
return {
|
5433
5433
|
minX: l - I,
|
5434
5434
|
maxX: l + I,
|
@@ -5741,12 +5741,12 @@ const as = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5741
5741
|
});
|
5742
5742
|
const s = e.querySelectorAll("tspan");
|
5743
5743
|
for (let d = 0; d < s.length; d++) {
|
5744
|
-
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), g = await Nt(r.get(m)), p = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"),
|
5744
|
+
const A = s.item(d), u = A.closest("text"), h = A.closest("g"), m = u.getAttribute("font-family"), g = await Nt(r.get(m)), p = u.getAttribute("fill"), f = u.getAttribute("stroke"), S = u.getAttribute("stroke-width"), B = g.getPath(
|
5745
5745
|
A.innerHTML,
|
5746
5746
|
0,
|
5747
5747
|
0,
|
5748
5748
|
parseInt(u.getAttribute("font-size") ?? "72")
|
5749
|
-
), I =
|
5749
|
+
), I = B.getBoundingBox().x2 - B.getBoundingBox().x1;
|
5750
5750
|
let C = 0;
|
5751
5751
|
const E = A.getAttribute("text-anchor");
|
5752
5752
|
E === "middle" ? C = I / 2 : E === "end" && (C = I);
|
@@ -5757,7 +5757,7 @@ const as = (n) => n.substring(0, 5).toLowerCase().trim() === "data:", We = /* @_
|
|
5757
5757
|
parseInt(u.getAttribute("font-size") ?? "72")
|
5758
5758
|
);
|
5759
5759
|
P.fill = p, P.stroke = f, P.strokeWidth = parseFloat(S ?? "0");
|
5760
|
-
const
|
5760
|
+
const b = P.toSVG(2), Q = t.parseFromString(b, "image/svg+xml").firstElementChild;
|
5761
5761
|
h.appendChild(Q);
|
5762
5762
|
}
|
5763
5763
|
return e.querySelectorAll("text").forEach((d) => d.remove()), It().serializeToString(a);
|
@@ -7717,7 +7717,7 @@ class Fe {
|
|
7717
7717
|
g,
|
7718
7718
|
c && !t.data.forceImageCover ? { scale: c } : void 0,
|
7719
7719
|
t.data.forceImageCover
|
7720
|
-
) : void 0,
|
7720
|
+
) : void 0, B = p ? {
|
7721
7721
|
id: M(),
|
7722
7722
|
src: p.src,
|
7723
7723
|
x: S?.x || 0,
|
@@ -7733,7 +7733,7 @@ class Fe {
|
|
7733
7733
|
return {
|
7734
7734
|
command: this.getCreateElementCommand(I, h, E, {
|
7735
7735
|
frameData: g,
|
7736
|
-
pattern:
|
7736
|
+
pattern: B,
|
7737
7737
|
disablePlaceholder: t.data.disablePlaceholder,
|
7738
7738
|
stepName: t.stepName
|
7739
7739
|
}),
|
@@ -7972,10 +7972,10 @@ class Bs {
|
|
7972
7972
|
const S = i.getLayouts().find((I) => I.panelId === f.panelId);
|
7973
7973
|
if (!S)
|
7974
7974
|
throw new Y(f);
|
7975
|
-
const
|
7975
|
+
const B = M();
|
7976
7976
|
return {
|
7977
|
-
regionElement: { id:
|
7978
|
-
command: this.getCreateElementCommand(
|
7977
|
+
regionElement: { id: B, region: f },
|
7978
|
+
command: this.getCreateElementCommand(B, f, S, {
|
7979
7979
|
stepName: t.stepName,
|
7980
7980
|
src: l,
|
7981
7981
|
objectURL: d,
|
@@ -8013,9 +8013,9 @@ class Bs {
|
|
8013
8013
|
);
|
8014
8014
|
}
|
8015
8015
|
if (t.data.colorPickerEnabled) {
|
8016
|
-
const S = await this.availableColors(t, i) || [],
|
8016
|
+
const S = await this.availableColors(t, i) || [], B = Object.keys(c.colors), I = S.length === 1 && B.length === 1;
|
8017
8017
|
if (I) {
|
8018
|
-
const C = S[0], E =
|
8018
|
+
const C = S[0], E = B[0];
|
8019
8019
|
await this.changeColors(
|
8020
8020
|
t,
|
8021
8021
|
u.map((P) => P.regionElement),
|
@@ -8654,11 +8654,11 @@ const Ts = new Ms(), Ke = (n, t, e, a, r) => {
|
|
8654
8654
|
const A = Math.max(...o);
|
8655
8655
|
if (A <= n.width)
|
8656
8656
|
return [i, A];
|
8657
|
-
const u = o.reduce((p, f, S,
|
8657
|
+
const u = o.reduce((p, f, S, B) => f > B[p] ? S : p, 0), h = i[u];
|
8658
8658
|
let m = !1, g = h.length;
|
8659
8659
|
for (; !m && g > -1; ) {
|
8660
8660
|
g = h.lastIndexOf(" ", g - 1);
|
8661
|
-
const p = [h.slice(0, g), h.slice(g + 1)], f = p.map((
|
8661
|
+
const p = [h.slice(0, g), h.slice(g + 1)], f = p.map((B) => mt(B, a, r));
|
8662
8662
|
f[0] <= n.width && (i = [...i.slice(0, u), ...p, ...i.slice(u + 1)], o = [
|
8663
8663
|
...o.slice(0, u),
|
8664
8664
|
...f,
|
@@ -8978,11 +8978,11 @@ class Qs {
|
|
8978
8978
|
const g = e.getWorkflowExperience().getBundle();
|
8979
8979
|
if (g && t.globalPropertyAspectConfigurations) {
|
8980
8980
|
const f = g.getGlobalPropertyConfiguration()?.aspects?.find(
|
8981
|
-
(S) => S.type === U.Text && t.globalPropertyAspectConfigurations?.map((
|
8981
|
+
(S) => S.type === U.Text && t.globalPropertyAspectConfigurations?.map((B) => B.aspectName).includes(S.name)
|
8982
8982
|
);
|
8983
8983
|
if (f) {
|
8984
|
-
const
|
8985
|
-
|
8984
|
+
const B = g.getGlobalPropertyStateManager().getAspect(f.name);
|
8985
|
+
B && (m = B);
|
8986
8986
|
}
|
8987
8987
|
}
|
8988
8988
|
if (await e.setSelectionsAndElements(
|
@@ -9185,11 +9185,11 @@ class Qs {
|
|
9185
9185
|
colorProfileAssetKey: p.colorProfile?.key
|
9186
9186
|
});
|
9187
9187
|
}
|
9188
|
-
const S = await this.getDefaultColor(a),
|
9188
|
+
const S = await this.getDefaultColor(a), B = S || "#000000", I = {
|
9189
9189
|
stepRegion: u,
|
9190
9190
|
stepName: t,
|
9191
9191
|
align: this.textAlign(a),
|
9192
|
-
fill: i.color ? i.color :
|
9192
|
+
fill: i.color ? i.color : B,
|
9193
9193
|
fontSize: a.size || _e,
|
9194
9194
|
fontData: r,
|
9195
9195
|
id: g,
|
@@ -9211,7 +9211,7 @@ class Qs {
|
|
9211
9211
|
fillSpotColorDefinition: f
|
9212
9212
|
}, C = [], E = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
|
9213
9213
|
if (!I.fontData) throw new V("Failed to resolve font data for text.");
|
9214
|
-
const [
|
9214
|
+
const [b, F] = Ce(
|
9215
9215
|
I.fontSize,
|
9216
9216
|
I.fontData,
|
9217
9217
|
{
|
@@ -9225,11 +9225,11 @@ class Qs {
|
|
9225
9225
|
[c],
|
9226
9226
|
{ size: a.size, minSize: a.minSize, maxSize: a.maxSize }
|
9227
9227
|
);
|
9228
|
-
E.set(I.id,
|
9228
|
+
E.set(I.id, b), P.set(I.id, F);
|
9229
9229
|
const Q = a.curved || a.vertical ? c : (F || []).join(`
|
9230
9230
|
`);
|
9231
9231
|
C.push(
|
9232
|
-
this.generateTextChangeCommandsForRegion(
|
9232
|
+
this.generateTextChangeCommandsForRegion(b, a, I.id, Q)
|
9233
9233
|
);
|
9234
9234
|
const T = new z(I, m);
|
9235
9235
|
return {
|
@@ -9286,13 +9286,13 @@ class Qs {
|
|
9286
9286
|
return d && d(!0), { info: "0" };
|
9287
9287
|
const C = s.getProfanities(), E = na(h.toLowerCase());
|
9288
9288
|
for (const P of E)
|
9289
|
-
for (const
|
9290
|
-
const F = C[
|
9289
|
+
for (const b in C) {
|
9290
|
+
const F = C[b].toLowerCase().replace(/\s/g, "");
|
9291
9291
|
if (P === F)
|
9292
9292
|
return l(!0), { error: "Blocked profanity." };
|
9293
9293
|
}
|
9294
9294
|
return !t.data.vertical && !t.data.allowNewlines && (h.includes(`
|
9295
|
-
`) || h.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(p.values()).every((
|
9295
|
+
`) || h.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(p.values()).every((b) => b) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - h.length).toString() });
|
9296
9296
|
})();
|
9297
9297
|
if (S.error) {
|
9298
9298
|
c(S.error);
|
@@ -9303,11 +9303,11 @@ class Qs {
|
|
9303
9303
|
s.updateStorage(t.stepName, { text: A }), s.updateMetadata(t.stepName, {
|
9304
9304
|
text: this.injectReplaceableText(A, t.data)
|
9305
9305
|
}), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
|
9306
|
-
const
|
9306
|
+
const B = [];
|
9307
9307
|
for (const C of m) {
|
9308
9308
|
const E = t.data.curved ? h : (p.get(C.id) || []).join(`
|
9309
9309
|
`);
|
9310
|
-
|
9310
|
+
B.push(
|
9311
9311
|
this.generateTextChangeCommandsForRegion(
|
9312
9312
|
g.get(C.id) || 1,
|
9313
9313
|
t.data,
|
@@ -9316,7 +9316,7 @@ class Qs {
|
|
9316
9316
|
)
|
9317
9317
|
);
|
9318
9318
|
}
|
9319
|
-
return new R(
|
9319
|
+
return new R(B);
|
9320
9320
|
}
|
9321
9321
|
}
|
9322
9322
|
const G = new Qs();
|
@@ -9475,21 +9475,21 @@ class Ws extends Rs {
|
|
9475
9475
|
return this.svgElement(t, e);
|
9476
9476
|
}
|
9477
9477
|
svgElement(t, e) {
|
9478
|
-
const a = ns(Os), i = t !== "" ? ((
|
9479
|
-
const
|
9480
|
-
|
9478
|
+
const a = ns(Os), i = t !== "" ? ((B) => B.charAt(0).toUpperCase() + B.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 = () => {
|
9479
|
+
const B = at("g");
|
9480
|
+
B.classList.add("module-text-group");
|
9481
9481
|
const I = at("defs");
|
9482
|
-
|
9482
|
+
B.appendChild(I), I.appendChild(Us(0, 2, 2, "shadow"));
|
9483
9483
|
const C = at("path");
|
9484
9484
|
C.setAttribute("d", d), C.setAttribute("stroke", "black"), C.setAttribute("stroke-width", "3"), I.appendChild(C);
|
9485
9485
|
const E = at("g");
|
9486
|
-
E.classList.add("module-layer0"),
|
9486
|
+
E.classList.add("module-layer0"), B.appendChild(E), E.setAttribute("filter", "url(#shadow)"), E.innerHTML = C.outerHTML;
|
9487
9487
|
const P = at("g");
|
9488
|
-
P.classList.add("module-layer1"),
|
9489
|
-
const
|
9490
|
-
|
9488
|
+
P.classList.add("module-layer1"), B.appendChild(P), P.setAttribute("stroke-width", "3"), P.setAttribute("stroke", "rgb(45,41,38)"), P.setAttribute("fill", "rgb(45,41,38)"), P.setAttribute("transform", "translate(0.5,0)"), P.innerHTML = o;
|
9489
|
+
const b = at("g");
|
9490
|
+
b.classList.add("module-layer2"), B.appendChild(b), b.setAttribute("fill", "rgb(255,209,0)"), b.setAttribute("transform", "translate(1,-0.1)"), b.innerHTML = o;
|
9491
9491
|
const F = at("g");
|
9492
|
-
return F.classList.add("module-layer3"),
|
9492
|
+
return F.classList.add("module-layer3"), B.appendChild(F), F.setAttribute("fill", "white"), F.innerHTML = o, new Gs(B).transform(([T, tt]) => [T, tt + (c / 2 - T) ** 2 / (c * 6)]), B;
|
9493
9493
|
}, u = at("g");
|
9494
9494
|
u.classList.add("module-root");
|
9495
9495
|
const h = at("defs");
|
@@ -10250,16 +10250,16 @@ class Bo {
|
|
10250
10250
|
constructor(t, e, a, r, i, s, o, l, c, d, A, u, h, m = !1, g, p = !1, f = !1, S = !1) {
|
10251
10251
|
this.workflowStatePromiseQueue = new Tn(1), this.initialized = !1, this.readOnly = !1, this.isReloadedTransaction = !1, this.singleVariantsRenderable = !1, this.stepTags = {}, this.renderLayouts = () => {
|
10252
10252
|
if (!this.previewService) return;
|
10253
|
-
const
|
10253
|
+
const B = this.getCommandContext().getAllLayouts(), I = this.getLayoutPreviewService()?.getAll();
|
10254
10254
|
if (I)
|
10255
10255
|
for (const [, C] of I)
|
10256
|
-
C.render(
|
10257
|
-
}, this.experience = t, this.client = e, this.updateTransaction = o, this.graphQlClient = l, this.commandContext = s, this.reloadedState = h, this.transaction = c, this.readOnly = m, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = r, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer = g, 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.recipientCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = u, this.renderableContextService?.setWorkflowManager(this), this.isReloadedTransaction = p, this.workflow.steps.forEach((
|
10258
|
-
this.stepTags[
|
10256
|
+
C.render(B);
|
10257
|
+
}, this.experience = t, this.client = e, this.updateTransaction = o, this.graphQlClient = l, this.commandContext = s, this.reloadedState = h, this.transaction = c, this.readOnly = m, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = r, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer = g, 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.recipientCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = u, this.renderableContextService?.setWorkflowManager(this), this.isReloadedTransaction = p, this.workflow.steps.forEach((B) => {
|
10258
|
+
this.stepTags[B.stepName] = B.tags ?? [];
|
10259
10259
|
}), S && (this.workflowStatePromiseQueue.enabled = !1), this.initializationPromise = this.initializeDefaultWorkflowState(a), this.initializationPromise.then(() => {
|
10260
10260
|
this.initialized = !0;
|
10261
|
-
}), this.initializationPromise.catch((
|
10262
|
-
throw console.error(
|
10261
|
+
}), this.initializationPromise.catch((B) => {
|
10262
|
+
throw console.error(B), this.initialized = !1, new Error("Workflow initialization failed due to an error. See console.");
|
10263
10263
|
}), this.initializationPromise.finally(
|
10264
10264
|
() => this.getCommandContext().registerStateCallback(() => {
|
10265
10265
|
this.updateStateWithServer(), this.renderLayouts();
|
@@ -10857,7 +10857,7 @@ class Bo {
|
|
10857
10857
|
this.stepSelections = {
|
10858
10858
|
...this.stepSelections,
|
10859
10859
|
[t]: { selectedVariants: e }
|
10860
|
-
}, this.selectionCost = Object.values(this.stepSelections).reduce((C, E) => C + E.selectedVariants.map((P) => P.priceModifier || 0).reduce((P,
|
10860
|
+
}, this.selectionCost = Object.values(this.stepSelections).reduce((C, E) => C + E.selectedVariants.map((P) => P.priceModifier || 0).reduce((P, b) => P + b, 0), 0), this.workflow.steps.forEach((C) => {
|
10861
10861
|
vt(C, this.stepSelections) || (this.stepInitialised[C.stepName] = !1, delete this.stepMetadata[C.stepName], delete this.stepSelections[C.stepName], delete this.storage[C.stepName]);
|
10862
10862
|
});
|
10863
10863
|
const s = this.allScenes, o = yt(s, i), l = yt(s, this.stepSelections), c = o.map((C) => C.silentSteps).flat(), A = l.map((C) => C.silentSteps).flat().filter(
|
@@ -10876,9 +10876,9 @@ class Bo {
|
|
10876
10876
|
g?.type === v.Frame && this.getWorkflowExperience().getStepById(g.stepName)?.frameService?.setTargetElements(a.map((E) => E.id));
|
10877
10877
|
const p = u.map((C) => new Bt(C.id)), f = new Ha(this.constructSerializableWorkflow()), S = [...m, ...p, f];
|
10878
10878
|
S.length > 0 && this.commandContext.apply(new R(S), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
|
10879
|
-
const
|
10879
|
+
const B = this.getInvalidModelVariants(), I = this.modelContainer;
|
10880
10880
|
if (I) {
|
10881
|
-
const C =
|
10881
|
+
const C = B.map(
|
10882
10882
|
(E) => I.applyModelVariant(
|
10883
10883
|
E,
|
10884
10884
|
{
|
@@ -11940,7 +11940,7 @@ const $o = async (n, t) => {
|
|
11940
11940
|
T.errors && console.log("Server Error:", et.message);
|
11941
11941
|
}), null) : tt ?? null;
|
11942
11942
|
})() || (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"));
|
11943
|
-
const u = n.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l && Xa(l, t, !0), p = l && Xa(l, t, !1), f = async (
|
11943
|
+
const u = n.getPreviewService(), h = t?.finalizeStepConfig?.lookAtAnimation, m = u && t.showModelOnFinishStep && !!h, g = l && Xa(l, t, !0), p = l && Xa(l, t, !1), f = async (b) => {
|
11944
11944
|
const F = {};
|
11945
11945
|
let Q = 0;
|
11946
11946
|
if (Object.keys(i).length > 0)
|
@@ -11948,7 +11948,7 @@ const $o = async (n, t) => {
|
|
11948
11948
|
const tt = i[T], et = t.steps.find((W) => W.stepName === T);
|
11949
11949
|
for (let W = 0; W < tt.selections.length; ++W) {
|
11950
11950
|
const q = tt.selections[W];
|
11951
|
-
if (et && (!
|
11951
|
+
if (et && (!b || et.option && (et.option.variants || []).length > 1 && !et.data.hideSelectionInCart && !et.data.hideSelectionsInCart)) {
|
11952
11952
|
const wt = et.stepTitle;
|
11953
11953
|
F[wt] ? F[wt].push({
|
11954
11954
|
id: q.id || "",
|
@@ -11966,19 +11966,19 @@ const $o = async (n, t) => {
|
|
11966
11966
|
}
|
11967
11967
|
}
|
11968
11968
|
return [F, Q];
|
11969
|
-
}, [S] = await f(!0),
|
11970
|
-
Object.keys(S).map((
|
11969
|
+
}, [S] = await f(!0), B = Object.fromEntries(
|
11970
|
+
Object.keys(S).map((b) => [b, S[b].map((F) => F.id)])
|
11971
11971
|
), [I] = await f(!1), C = Object.fromEntries(
|
11972
|
-
Object.keys(I).map((
|
11973
|
-
|
11974
|
-
I[
|
11972
|
+
Object.keys(I).map((b) => [
|
11973
|
+
b,
|
11974
|
+
I[b].map((F) => F.id)
|
11975
11975
|
])
|
11976
11976
|
);
|
11977
11977
|
let E = await o(m, r.id);
|
11978
11978
|
if (E) {
|
11979
|
-
const
|
11979
|
+
const b = await (await rt(E)).blob();
|
11980
11980
|
E = (await O.uploadAsset(
|
11981
|
-
{ name: `${r.id}-preview-image.png`, blob:
|
11981
|
+
{ name: `${r.id}-preview-image.png`, blob: b },
|
11982
11982
|
ve.Image,
|
11983
11983
|
!0,
|
11984
11984
|
!1
|
@@ -11986,7 +11986,7 @@ const $o = async (n, t) => {
|
|
11986
11986
|
}
|
11987
11987
|
return {
|
11988
11988
|
designDetails: (() => {
|
11989
|
-
const
|
11989
|
+
const b = {
|
11990
11990
|
name: s,
|
11991
11991
|
layouts: e.map((F) => ({
|
11992
11992
|
index: F.index,
|
@@ -12001,15 +12001,15 @@ const $o = async (n, t) => {
|
|
12001
12001
|
const F = [];
|
12002
12002
|
for (const [Q, T] of Object.entries(p))
|
12003
12003
|
F.push({ key: Q, value: T });
|
12004
|
-
|
12004
|
+
b.metadata = F;
|
12005
12005
|
}
|
12006
|
-
if (
|
12006
|
+
if (B) {
|
12007
12007
|
const F = [];
|
12008
12008
|
for (const [Q, T] of Object.entries(C))
|
12009
12009
|
F.push({ key: Q, ids: T });
|
12010
|
-
|
12010
|
+
b.selectedVariants = F;
|
12011
12011
|
}
|
12012
|
-
return
|
12012
|
+
return b;
|
12013
12013
|
})(),
|
12014
12014
|
cartSelectionsWithPrices: S,
|
12015
12015
|
cartMetadata: g
|
@@ -12312,7 +12312,7 @@ class Yo {
|
|
12312
12312
|
}
|
12313
12313
|
let i = 2048;
|
12314
12314
|
e && e <= 2048 && (i = e);
|
12315
|
-
const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((
|
12315
|
+
const s = pt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((B) => B.layoutState?.layout.panelId === c?.name) || o[0], A = d.layoutState.layout.previewRegion ? {
|
12316
12316
|
x: d.layoutState.layout.previewRegion.left,
|
12317
12317
|
y: d.layoutState.layout.previewRegion.top,
|
12318
12318
|
width: d.layoutState.layout.previewRegion.width,
|
@@ -12800,13 +12800,13 @@ const Jo = (n) => {
|
|
12800
12800
|
_o.includes(C.tagName) && !C.attributes.getNamedItem("fill") && C.setAttribute("fill", "#000000");
|
12801
12801
|
const E = C.attributes.getNamedItem("fill");
|
12802
12802
|
if (E && E.value !== "none") {
|
12803
|
-
const
|
12804
|
-
C.classList.add(Q), g[Q] = { browserValue:
|
12803
|
+
const b = E.value, Q = `spiff-fill-${b.replace(/\W/g, "")}`;
|
12804
|
+
C.classList.add(Q), g[Q] = { browserValue: b };
|
12805
12805
|
}
|
12806
12806
|
const P = C.attributes.getNamedItem("stroke");
|
12807
12807
|
if (P && P.value !== "none") {
|
12808
|
-
const
|
12809
|
-
C.classList.add(Q), g[Q] = { browserValue:
|
12808
|
+
const b = P.value, Q = `spiff-stroke-${b.replace(/\W/g, "")}`;
|
12809
|
+
C.classList.add(Q), g[Q] = { browserValue: b };
|
12810
12810
|
}
|
12811
12811
|
});
|
12812
12812
|
const f = It().serializeToString(m), S = r.colors;
|
@@ -12818,8 +12818,8 @@ const Jo = (n) => {
|
|
12818
12818
|
break;
|
12819
12819
|
}
|
12820
12820
|
}
|
12821
|
-
const
|
12822
|
-
const E = n.find((
|
12821
|
+
const B = (C) => {
|
12822
|
+
const E = n.find((b) => b.panelId === C.panelId);
|
12823
12823
|
if (!E)
|
12824
12824
|
throw new Y(C);
|
12825
12825
|
const P = M();
|
@@ -12842,7 +12842,7 @@ const Jo = (n) => {
|
|
12842
12842
|
);
|
12843
12843
|
}, I = a.data.regions;
|
12844
12844
|
try {
|
12845
|
-
return I.map(
|
12845
|
+
return I.map(B);
|
12846
12846
|
} catch (C) {
|
12847
12847
|
return console.error(C), [];
|
12848
12848
|
}
|
@@ -13042,7 +13042,7 @@ const Jo = (n) => {
|
|
13042
13042
|
const p = a.option;
|
13043
13043
|
if (!p)
|
13044
13044
|
return;
|
13045
|
-
const f = p.variants?.find((
|
13045
|
+
const f = p.variants?.find((B) => B.id === i.fontVariantId) || ne(p);
|
13046
13046
|
if (!f || !f.asset)
|
13047
13047
|
return;
|
13048
13048
|
t[a.stepName] = { selectedVariants: [f] };
|
@@ -13066,7 +13066,7 @@ const Jo = (n) => {
|
|
13066
13066
|
return f ? j.getDefaultVariant(f)?.color : void 0;
|
13067
13067
|
}, m = i.color || await h(a.data), g = a.data.regions;
|
13068
13068
|
for (const p of g) {
|
13069
|
-
const f = n.find((
|
13069
|
+
const f = n.find((B) => B.panelId === p.panelId);
|
13070
13070
|
if (!f)
|
13071
13071
|
continue;
|
13072
13072
|
const S = {
|
@@ -13091,7 +13091,7 @@ const Jo = (n) => {
|
|
13091
13091
|
y: p.top
|
13092
13092
|
};
|
13093
13093
|
if (d) {
|
13094
|
-
const [
|
13094
|
+
const [B, I] = Ce(
|
13095
13095
|
a.data.size || s,
|
13096
13096
|
d,
|
13097
13097
|
p,
|
@@ -13111,7 +13111,7 @@ const Jo = (n) => {
|
|
13111
13111
|
new z(
|
13112
13112
|
{
|
13113
13113
|
...S,
|
13114
|
-
fontSize:
|
13114
|
+
fontSize: B,
|
13115
13115
|
text: S.curved ? S.text : (I || []).join(`
|
13116
13116
|
`)
|
13117
13117
|
},
|
@@ -15996,7 +15996,7 @@ class Ed {
|
|
15996
15996
|
} catch (a) {
|
15997
15997
|
throw console.error(a), new ht("Critical - Unable to synchronize workflow state with server.");
|
15998
15998
|
}
|
15999
|
-
}, this.options = t, this.options.applicationKey && Wr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.3.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
15999
|
+
}, this.options = t, this.options.applicationKey && Wr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 32.3.0-beta.69d8a509-cc6d-54dc-80c5-1c8b6fee8d45"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
16000
16000
|
}
|
16001
16001
|
configure(t) {
|
16002
16002
|
gt.setHubUrl(t.hubUrl), gt.setServerUrl(t.serverUrl), gt.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 && Hr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration(), this.spiffRegion && this.userPoolRegion && this.userPoolClientId && Lt.init(this.spiffRegion, this.userPoolRegion, this.userPoolClientId);
|
@@ -16465,12 +16465,12 @@ class Ed {
|
|
16465
16465
|
},
|
16466
16466
|
errorPolicy: "all",
|
16467
16467
|
fetchPolicy: "no-cache"
|
16468
|
-
}),
|
16469
|
-
if (
|
16468
|
+
}), b = P.data.transactions;
|
16469
|
+
if (b.length !== C.length) {
|
16470
16470
|
const F = P.errors?.[0]?.message || "Unknown error";
|
16471
16471
|
throw new ht(`Not all transactions were found: ${F}`);
|
16472
16472
|
}
|
16473
|
-
return !this.activeIntegration &&
|
16473
|
+
return !this.activeIntegration && b[0].integrationProduct?.integration && (this.activeIntegration = Promise.resolve(b[0].integrationProduct.integration)), b.map((F, Q) => ({
|
16474
16474
|
transaction: F,
|
16475
16475
|
workflowId: F.workflowId,
|
16476
16476
|
readOnly: C.find((T) => T.option.transactionId === F.id)?.option.readOnly ?? !1,
|
@@ -16482,13 +16482,15 @@ class Ed {
|
|
16482
16482
|
const E = await a.mutate({
|
16483
16483
|
mutation: Bi,
|
16484
16484
|
variables: {
|
16485
|
-
inputs: C.map((
|
16486
|
-
integrationProductId:
|
16487
|
-
externalIntegrationId:
|
16488
|
-
externalProductId:
|
16489
|
-
workflowId:
|
16490
|
-
designName:
|
16491
|
-
claim: !0
|
16485
|
+
inputs: C.map((b) => ({
|
16486
|
+
integrationProductId: b.option.type === "integration" ? b.option.integrationProductId : void 0,
|
16487
|
+
externalIntegrationId: b.option.type === "external" ? b.option.externalIntegrationId : void 0,
|
16488
|
+
externalProductId: b.option.type === "external" ? b.option.externalProductId : void 0,
|
16489
|
+
workflowId: b.option.workflowId,
|
16490
|
+
designName: b.option.designName,
|
16491
|
+
claim: !0,
|
16492
|
+
quantity: b.option.type === "integration" ? b.option.quantity : void 0,
|
16493
|
+
recipient: b.option.type === "integration" ? b.option.recipient : void 0
|
16492
16494
|
})),
|
16493
16495
|
marketplaceThemeInstallId: this.marketplaceThemeInstallId,
|
16494
16496
|
marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
|
@@ -16497,12 +16499,12 @@ class Ed {
|
|
16497
16499
|
fetchPolicy: "no-cache"
|
16498
16500
|
}), P = E.data?.transactionCreateMany;
|
16499
16501
|
if (!P || P.length === 0) {
|
16500
|
-
const
|
16501
|
-
throw new ht(`Failed to create transactions: ${
|
16502
|
+
const b = E.errors?.[0]?.message || "Unknown error";
|
16503
|
+
throw new ht(`Failed to create transactions: ${b}`);
|
16502
16504
|
}
|
16503
|
-
return P.map((
|
16504
|
-
transaction:
|
16505
|
-
workflowId:
|
16505
|
+
return P.map((b, F) => ({
|
16506
|
+
transaction: b,
|
16507
|
+
workflowId: b.workflowId,
|
16506
16508
|
readOnly: !1,
|
16507
16509
|
index: C[F].index
|
16508
16510
|
}));
|
@@ -16512,7 +16514,7 @@ class Ed {
|
|
16512
16514
|
...c.map(r),
|
16513
16515
|
...d.map(i)
|
16514
16516
|
])).flat(), u = [...new Set(A.map((C) => C.workflowId))], h = await or(u, e), m = new Map(h.map((C) => [C.id, C])), g = k.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (C) => {
|
16515
|
-
const { transaction: E, workflowId: P, readOnly:
|
16517
|
+
const { transaction: E, workflowId: P, readOnly: b, index: F } = C, Q = m.get(P), T = t[F];
|
16516
16518
|
!g.get(E.id) && E.transactionOwnerId && g.set(E.id, E.transactionOwnerId);
|
16517
16519
|
const tt = g.get(E.id) || void 0, et = new Ll({
|
16518
16520
|
onMutate: () => ({ context: { transactionOwnerId: tt, bundleOwnerId: e?.bundleOwnerId } }),
|
@@ -16522,21 +16524,21 @@ class Ed {
|
|
16522
16524
|
transaction: E,
|
16523
16525
|
layouts: [],
|
16524
16526
|
singleVariantsRenderable: T?.workflowConfiguration?.singleVariantsRenderable,
|
16525
|
-
stateMutationFunc:
|
16527
|
+
stateMutationFunc: b ? async () => {
|
16526
16528
|
throw new V("State mutation is forbidden in read only mode!");
|
16527
16529
|
} : async (q) => this.updateTransactionState({
|
16528
16530
|
...q,
|
16529
16531
|
context: { transactionOwnerId: tt, bundleOwnerId: e?.bundleOwnerId }
|
16530
16532
|
}),
|
16531
16533
|
graphQlClient: () => et,
|
16532
|
-
readOnly:
|
16534
|
+
readOnly: b,
|
16533
16535
|
workflow: Q,
|
16534
16536
|
isReloadedTransaction: T.type === "transaction"
|
16535
16537
|
};
|
16536
16538
|
if (T.type === "transaction" && E.workflowState) {
|
16537
16539
|
const q = JSON.parse(E.workflowState);
|
16538
16540
|
W.layouts = Object.values(q.layouts || {}).map((wt) => wt.layout), await qa(q), W.reloadedState = q;
|
16539
|
-
} else if (!
|
16541
|
+
} else if (!b && T.workflowState) {
|
16540
16542
|
const q = JSON.parse(T.workflowState);
|
16541
16543
|
W.layouts = Object.values(q.layouts || {}).map((wt) => wt.layout), await qa(q), W.reloadedState = q;
|
16542
16544
|
} else
|
@@ -16549,10 +16551,10 @@ class Ed {
|
|
16549
16551
|
), W.delayWorkflowStateSync = !0, { experienceOptions: W, index: F, options: T };
|
16550
16552
|
}), f = await Promise.all(p);
|
16551
16553
|
k.setMap("transactionOwnerIds", g);
|
16552
|
-
const
|
16553
|
-
const { experienceOptions: E, options: P } = C,
|
16554
|
-
return await
|
16555
|
-
}), I = await Promise.all(
|
16554
|
+
const B = f.sort((C, E) => C.index - E.index).map(async (C) => {
|
16555
|
+
const { experienceOptions: E, options: P } = C, b = new Yo(this, E);
|
16556
|
+
return await b.getWorkflowManager().getInitializationPromise(), P.type !== "transaction" && this.customer && await b.attachCustomerDetails({ email: this.customer.emailAddress }), b;
|
16557
|
+
}), I = await Promise.all(B);
|
16556
16558
|
return I.forEach((C) => C.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), I;
|
16557
16559
|
}
|
16558
16560
|
storeCustomer(t) {
|