@useinsider/guido 3.4.1-beta.a56e43f → 3.4.1-beta.ad76dd1
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/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +48 -50
- package/dist/composables/useActionsApi.js +9 -5
- package/dist/composables/useSave.js +13 -14
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +60 -58
- package/dist/extensions/Blocks/Recommendation/block.js +45 -90
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +14 -33
- package/dist/guido.css +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
- package/package.json +1 -1
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { provideGuidoActions as
|
|
4
|
-
import { useGuidoStateBridge as
|
|
5
|
-
import { usePartner as
|
|
6
|
-
import { useStripo as
|
|
7
|
-
import { useTimerClone as
|
|
1
|
+
import { defineComponent as J, defineAsyncComponent as R, ref as I, computed as W, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as Z } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { provideGuidoActions as ee } from "../composables/useGuidoActions.js";
|
|
4
|
+
import { useGuidoStateBridge as oe } from "../composables/useGuidoStateBridge.js";
|
|
5
|
+
import { usePartner as te } from "../composables/usePartner.js";
|
|
6
|
+
import { useStripo as ne } from "../composables/useStripo.js";
|
|
7
|
+
import { useTimerClone as re } from "../composables/useTimerClone.js";
|
|
8
8
|
import { migrate as x } from "../config/migrator/index.js";
|
|
9
9
|
import { ModuleFolderDefaults as G } from "../enums/defaults.js";
|
|
10
|
-
import { RIBBON_SELECTOR as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { useEditorStore as H } from "../stores/editor.js";
|
|
10
|
+
import { RIBBON_SELECTOR as se } from "../enums/onboarding.js";
|
|
11
|
+
import ce from "./organisms/AutoSaveController.vue.js";
|
|
12
|
+
import ae from "./organisms/base/Toaster.vue.js";
|
|
13
|
+
import ie from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
14
|
+
import me from "./organisms/header/HeaderWrapper.vue.js";
|
|
15
|
+
import de from "./organisms/LoadingWrapper.vue.js";
|
|
16
|
+
import le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
17
|
+
import ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
18
|
+
import { useStripoApi as pe } from "../services/stripoApi.js";
|
|
19
|
+
import { useConfigStore as fe } from "../stores/config.js";
|
|
20
|
+
import { useDynamicContentStore as ve } from "../stores/dynamic-content.js";
|
|
21
|
+
import { useEditorStore as ye } from "../stores/editor.js";
|
|
23
22
|
import { usePreviewStore as he } from "../stores/preview.js";
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
const Ke = /* @__PURE__ */ Q({
|
|
23
|
+
import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
|
|
24
|
+
const He = /* @__PURE__ */ J({
|
|
27
25
|
__name: "Guido",
|
|
28
26
|
props: {
|
|
29
27
|
config: null
|
|
30
28
|
},
|
|
31
29
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
32
|
-
setup(
|
|
33
|
-
const g =
|
|
30
|
+
setup(H, { expose: z, emit: n }) {
|
|
31
|
+
const g = H, q = R(
|
|
34
32
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
35
|
-
), K =
|
|
33
|
+
), K = R(
|
|
36
34
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
37
|
-
),
|
|
35
|
+
), w = I(), u = I(), p = ve(), E = Se(), i = fe();
|
|
38
36
|
i.init(g.config);
|
|
39
|
-
const f =
|
|
37
|
+
const f = ye(), V = he(), m = W(() => f.hasChanges), { isTestPartner: $ } = te(), D = () => {
|
|
40
38
|
var e;
|
|
41
|
-
return (e =
|
|
39
|
+
return (e = w.value) == null ? void 0 : e.handleSave(!0);
|
|
42
40
|
}, {
|
|
43
41
|
templateId: v,
|
|
44
42
|
userId: C,
|
|
@@ -47,8 +45,8 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
47
45
|
template: o,
|
|
48
46
|
editor: s
|
|
49
47
|
} = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || G.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || G.DEFAULT_MODULES;
|
|
50
|
-
|
|
51
|
-
const
|
|
48
|
+
f.templateId = v, Z(), oe();
|
|
49
|
+
const h = {
|
|
52
50
|
emailId: v,
|
|
53
51
|
userId: C,
|
|
54
52
|
username: k,
|
|
@@ -60,11 +58,11 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
60
58
|
onReady: () => {
|
|
61
59
|
console.debug("guido:ready"), n("ready");
|
|
62
60
|
}
|
|
63
|
-
}, { initPlugin: M } =
|
|
61
|
+
}, { initPlugin: M } = ne(h, _), { getDefaultTemplate: O } = pe(), { cloneTimersOnSave: P, hasTimerBlocks: A } = re(), j = W(() => {
|
|
64
62
|
var e;
|
|
65
63
|
return !((e = i.ui) != null && e.showHeader);
|
|
66
64
|
});
|
|
67
|
-
|
|
65
|
+
ee({
|
|
68
66
|
onBack: () => {
|
|
69
67
|
console.debug("guido:back"), n("back");
|
|
70
68
|
},
|
|
@@ -72,50 +70,50 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
72
70
|
console.debug("guido:save:start"), n("save:start");
|
|
73
71
|
},
|
|
74
72
|
onSaveComplete: (e) => {
|
|
75
|
-
const t = { ...e, metadata:
|
|
73
|
+
const t = { ...e, metadata: h };
|
|
76
74
|
console.debug("guido:save:complete", t), n("save:complete", t);
|
|
77
75
|
},
|
|
78
76
|
onTestEmailClick: () => {
|
|
79
77
|
console.debug("guido:test-email:click"), n("test-email:click");
|
|
80
78
|
}
|
|
81
79
|
});
|
|
82
|
-
const
|
|
80
|
+
const B = (e) => {
|
|
83
81
|
console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
84
|
-
},
|
|
82
|
+
}, N = () => {
|
|
85
83
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
86
84
|
};
|
|
87
|
-
|
|
85
|
+
Q(() => m.value, () => {
|
|
88
86
|
n("on-change", m.value);
|
|
89
87
|
});
|
|
90
|
-
const
|
|
88
|
+
const S = (e) => {
|
|
91
89
|
const t = e, { attribute: l, position: a } = t.detail;
|
|
92
90
|
console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
|
|
93
91
|
};
|
|
94
92
|
let c = null;
|
|
95
93
|
const b = () => {
|
|
96
94
|
var t;
|
|
97
|
-
const e = document.querySelector(
|
|
95
|
+
const e = document.querySelector(se);
|
|
98
96
|
(t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
99
97
|
};
|
|
100
|
-
return
|
|
98
|
+
return X(async () => {
|
|
101
99
|
var t, l;
|
|
102
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
100
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b();
|
|
103
101
|
const e = (t = u.value) == null ? void 0 : t.parentElement;
|
|
104
102
|
e && (c = new ResizeObserver(b), c.observe(e));
|
|
105
103
|
try {
|
|
106
|
-
|
|
104
|
+
E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
107
105
|
const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
|
|
108
106
|
let r = {
|
|
109
107
|
html: d && await x(d, a),
|
|
110
108
|
css: F
|
|
111
109
|
};
|
|
112
|
-
r.html || (r = await O(), r.html = await x(r.html, a)),
|
|
110
|
+
r.html || (r = await O(), r.html = await x(r.html, a)), A(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
|
|
113
111
|
} catch (a) {
|
|
114
112
|
console.error("Failed to initialize Stripo editor:", a);
|
|
115
113
|
}
|
|
116
|
-
document.addEventListener("dynamic-content:open",
|
|
117
|
-
}),
|
|
118
|
-
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
114
|
+
document.addEventListener("dynamic-content:open", S);
|
|
115
|
+
}), Y(() => {
|
|
116
|
+
c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", S);
|
|
119
117
|
try {
|
|
120
118
|
window.UIEditor.removeEditor();
|
|
121
119
|
} catch {
|
|
@@ -124,14 +122,14 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
124
122
|
i.reset();
|
|
125
123
|
}), z({
|
|
126
124
|
dynamicContent: {
|
|
127
|
-
insert:
|
|
128
|
-
close:
|
|
125
|
+
insert: B,
|
|
126
|
+
close: N
|
|
129
127
|
},
|
|
130
128
|
hasChanges: m,
|
|
131
129
|
saveSilent: D
|
|
132
|
-
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef:
|
|
130
|
+
}), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: w, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: E, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: $, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: A, noHeader: j, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: S, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ce, Toaster: ae, FilterSelectionDrawer: ie, HeaderWrapper: me, LoadingWrapper: de, SaveAsTemplateDrawer: le, UnsubscribeWrapper: ue };
|
|
133
131
|
}
|
|
134
132
|
});
|
|
135
133
|
export {
|
|
136
|
-
|
|
134
|
+
He as default
|
|
137
135
|
};
|
|
@@ -21,9 +21,9 @@ const v = () => {
|
|
|
21
21
|
resetDataSavedFlag: !1,
|
|
22
22
|
disableLineHeightsReplace: !0
|
|
23
23
|
}, ...t }, s = {
|
|
24
|
-
callback: (l,
|
|
24
|
+
callback: (l, p, d, c, u) => {
|
|
25
25
|
l ? a(l) : e({
|
|
26
|
-
html:
|
|
26
|
+
html: p,
|
|
27
27
|
ampHtml: d,
|
|
28
28
|
ampErrors: c,
|
|
29
29
|
displayConditions: u
|
|
@@ -36,11 +36,11 @@ const v = () => {
|
|
|
36
36
|
return {
|
|
37
37
|
getCompiledEmail: m,
|
|
38
38
|
getTemplateData: () => new Promise((t) => {
|
|
39
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
39
|
+
const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
|
|
40
40
|
html: a,
|
|
41
41
|
css: i,
|
|
42
42
|
width: o,
|
|
43
|
-
height:
|
|
43
|
+
height: r,
|
|
44
44
|
utmParams: s,
|
|
45
45
|
syncModulesIds: l
|
|
46
46
|
});
|
|
@@ -91,7 +91,11 @@ const v = () => {
|
|
|
91
91
|
},
|
|
92
92
|
editorSave: () => new Promise((t) => {
|
|
93
93
|
window.StripoEditorApi.actionsApi.save((e) => {
|
|
94
|
-
|
|
94
|
+
if (e) {
|
|
95
|
+
n(e, "Failed to save template"), t(!1);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
t(!0);
|
|
95
99
|
});
|
|
96
100
|
})
|
|
97
101
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
2
|
import { useConfig as y } from "./useConfig.js";
|
|
3
3
|
import { useSaveStart as w, useSaveComplete as C } from "./useGuidoActions.js";
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import { useCouponBlockValidator as
|
|
9
|
-
import { useLiquidValidator as
|
|
10
|
-
const
|
|
11
|
-
const o = w(), s = C(), { validateHtml: r } =
|
|
4
|
+
import { useSyncModuleExtractor as E } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as H } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as q } from "./useHtmlValidator.js";
|
|
8
|
+
import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
|
|
9
|
+
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
10
|
+
const z = () => {
|
|
11
|
+
const o = w(), s = C(), { validateHtml: r } = q(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = E(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = x();
|
|
12
12
|
return { save: async (p = !1, f = !1) => {
|
|
13
13
|
var i;
|
|
14
14
|
o();
|
|
15
|
-
const { prepareTemplateDetails: v } =
|
|
16
|
-
if (!
|
|
15
|
+
const { prepareTemplateDetails: v } = b(), t = await v();
|
|
16
|
+
if (!l(t.compiledHtml))
|
|
17
17
|
return;
|
|
18
18
|
if (d("liquidSyntax")) {
|
|
19
|
-
if (!await
|
|
19
|
+
if (!await n(t.compiledHtml))
|
|
20
20
|
return;
|
|
21
21
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
22
22
|
return;
|
|
23
|
-
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
23
|
+
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t) || !await m())
|
|
24
24
|
return;
|
|
25
|
-
await m();
|
|
26
25
|
const { unsubscribePayload: S, stripoModules: V } = u(t.rawHtml);
|
|
27
26
|
return await c(S), t.modules = V, p || s({ ...t, silent: f }), t;
|
|
28
27
|
} };
|
|
29
28
|
};
|
|
30
29
|
export {
|
|
31
|
-
|
|
30
|
+
z as useSave
|
|
32
31
|
};
|
|
@@ -2,126 +2,128 @@ import { useConfig as S } from "../../../composables/useConfig.js";
|
|
|
2
2
|
import { useRecommendation as g } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { CSS_CLASS_RECO_BUTTON as _ } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useRecommendationExtensionStore as q } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
function y(r,
|
|
6
|
-
const
|
|
7
|
-
return o === "before" ? `${t} ${
|
|
5
|
+
function y(r, i, e, o, s = "") {
|
|
6
|
+
const c = `{{${s}${r}_${i}_${e}}}`, t = `{{${s}${r}_${i}_currency}}`;
|
|
7
|
+
return o === "before" ? `${t} ${c}` : `${c} ${t}`;
|
|
8
8
|
}
|
|
9
|
-
function f(r,
|
|
10
|
-
switch (
|
|
9
|
+
function f(r, i, e, o, s, c) {
|
|
10
|
+
switch (i) {
|
|
11
11
|
case "productImage": {
|
|
12
12
|
const t = r.querySelector("img");
|
|
13
|
-
t && (t.setAttribute("src", `{{${
|
|
14
|
-
const
|
|
15
|
-
|
|
13
|
+
t && (t.setAttribute("src", `{{${c}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${c}${e}_${o}_name}}`));
|
|
14
|
+
const n = r.querySelector("a");
|
|
15
|
+
n && (n.setAttribute("href", `{{${c}${e}_${o}_url}}`), n.classList.add(_));
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
18
|
case "productName": {
|
|
19
19
|
const t = r.querySelector("p");
|
|
20
20
|
if (t) {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const n = t.querySelector("strong") || t;
|
|
22
|
+
n.textContent = `{{${c}${e}_${o}_name}}`;
|
|
23
23
|
}
|
|
24
24
|
break;
|
|
25
25
|
}
|
|
26
26
|
case "productPrice": {
|
|
27
27
|
const t = r.querySelector("p");
|
|
28
28
|
if (t) {
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const n = t.querySelector("strong") || t;
|
|
30
|
+
n.textContent = y(e, o, "price", s, c);
|
|
31
31
|
}
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
case "productOldPrice": {
|
|
35
35
|
const t = r.querySelector("p");
|
|
36
36
|
if (t) {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
let n = t;
|
|
38
|
+
for (; n.children.length === 1; )
|
|
39
|
+
[n] = n.children;
|
|
40
|
+
n.textContent = y(
|
|
39
41
|
e,
|
|
40
42
|
o,
|
|
41
43
|
"original_price",
|
|
42
44
|
s,
|
|
43
|
-
|
|
45
|
+
c
|
|
44
46
|
), t.setAttribute("product-attr", "discount");
|
|
45
47
|
}
|
|
46
48
|
break;
|
|
47
49
|
}
|
|
48
50
|
case "productButton": {
|
|
49
51
|
const t = r.querySelector("a");
|
|
50
|
-
t && t.setAttribute("href", `{{${
|
|
52
|
+
t && t.setAttribute("href", `{{${c}${e}_${o}_url}}`);
|
|
51
53
|
break;
|
|
52
54
|
}
|
|
53
55
|
case "productOmnibusPrice": {
|
|
54
56
|
const t = r.querySelector(".omnibus-price-value");
|
|
55
57
|
if (t) {
|
|
56
|
-
t.textContent = `{{${
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
t.textContent = `{{${c}${e}_${o}_omnibus_price}}`;
|
|
59
|
+
const n = t.closest("p");
|
|
60
|
+
n && (n.setAttribute("product-attr", "omnibus_price"), n.setAttribute("composition", "true"));
|
|
59
61
|
}
|
|
60
62
|
break;
|
|
61
63
|
}
|
|
62
64
|
case "productOmnibusDiscount": {
|
|
63
65
|
const t = r.querySelector(".omnibus-discount-value");
|
|
64
66
|
if (t) {
|
|
65
|
-
t.textContent = `{{${
|
|
66
|
-
const
|
|
67
|
-
|
|
67
|
+
t.textContent = `{{${c}${e}_${o}_omnibus_discount}}`;
|
|
68
|
+
const n = t.closest("p");
|
|
69
|
+
n && (n.setAttribute("product-attr", "omnibus_discount"), n.setAttribute("composition", "true"));
|
|
68
70
|
}
|
|
69
71
|
break;
|
|
70
72
|
}
|
|
71
73
|
default: {
|
|
72
74
|
const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
|
|
73
75
|
if (t) {
|
|
74
|
-
const
|
|
76
|
+
const n = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
75
77
|
if (a) {
|
|
76
78
|
const u = a.querySelector("strong") || a;
|
|
77
|
-
u.textContent = `{{${
|
|
79
|
+
u.textContent = `{{${c}${e}_${o}_${n}}}`;
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
break;
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
|
-
function C(r,
|
|
85
|
-
r.querySelectorAll(".recommendation-product-row").forEach((
|
|
86
|
-
|
|
86
|
+
function C(r, i, e, o) {
|
|
87
|
+
r.querySelectorAll(".recommendation-product-row").forEach((c, t) => {
|
|
88
|
+
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
87
89
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
88
90
|
p.length > 0 ? p.forEach((l) => {
|
|
89
|
-
f(l, u,
|
|
90
|
-
}) : f(a, u,
|
|
91
|
+
f(l, u, i, t, e, o);
|
|
92
|
+
}) : f(a, u, i, t, e, o);
|
|
91
93
|
});
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
|
-
function
|
|
96
|
+
function w(r, i, e, o) {
|
|
95
97
|
const s = r.querySelectorAll(".recommendation-product-row");
|
|
96
98
|
if (!s.length)
|
|
97
99
|
return;
|
|
98
|
-
const [
|
|
100
|
+
const [c] = s, t = c.querySelector("[data-attribute-type]"), n = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
99
101
|
s.forEach((a, u) => {
|
|
100
102
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
101
103
|
const d = l.getAttribute("data-attribute-type") || "";
|
|
102
104
|
l.querySelectorAll(".attribute-cell").forEach((A, h) => {
|
|
103
|
-
const $ = u *
|
|
104
|
-
f(A, d,
|
|
105
|
+
const $ = u * n + h;
|
|
106
|
+
f(A, d, i, $, e, o);
|
|
105
107
|
});
|
|
106
108
|
});
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
|
-
function
|
|
110
|
-
r.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
111
|
-
|
|
111
|
+
function E(r, i, e, o) {
|
|
112
|
+
r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
|
|
113
|
+
w(c, i, e, o);
|
|
112
114
|
});
|
|
113
115
|
}
|
|
114
|
-
function R(r,
|
|
116
|
+
function R(r, i, e) {
|
|
115
117
|
const o = r.getAttribute("data-layout") || "grid", s = r.getAttribute("currency-alignment") || "after";
|
|
116
|
-
o === "list" ? C(r,
|
|
118
|
+
o === "list" ? C(r, i, s, e) : E(r, i, s, e);
|
|
117
119
|
}
|
|
118
|
-
function b(r,
|
|
119
|
-
const o = new RegExp(`${
|
|
120
|
+
function b(r, i, e) {
|
|
121
|
+
const o = new RegExp(`${i}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
|
|
120
122
|
return s ? parseInt(s[1]) : e;
|
|
121
123
|
}
|
|
122
|
-
function P(r,
|
|
124
|
+
function P(r, i) {
|
|
123
125
|
let e = r.parentElement;
|
|
124
|
-
for (; e && e !==
|
|
126
|
+
for (; e && e !== i; ) {
|
|
125
127
|
if (e.tagName === "TD") {
|
|
126
128
|
const o = e.getAttribute("width");
|
|
127
129
|
if (o && o.endsWith("%") && parseFloat(o) < 100)
|
|
@@ -132,39 +134,39 @@ function P(r, c) {
|
|
|
132
134
|
return null;
|
|
133
135
|
}
|
|
134
136
|
function T(r) {
|
|
135
|
-
const
|
|
136
|
-
s !== 0 && r.querySelectorAll("img.adapt-img").forEach((
|
|
137
|
-
if (
|
|
137
|
+
const i = r.getAttribute("style") || "", e = b(i, "width", 600), o = b(i, "padding", 0) * 2, s = Math.max(0, e - o);
|
|
138
|
+
s !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
139
|
+
if (c.hasAttribute("width"))
|
|
138
140
|
return;
|
|
139
|
-
const t = P(
|
|
141
|
+
const t = P(c, r);
|
|
140
142
|
if (!t)
|
|
141
143
|
return;
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const d =
|
|
144
|
+
const n = t.getAttribute("width"), a = parseFloat(n), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
|
|
145
|
+
c.setAttribute("width", String(l));
|
|
146
|
+
const d = c.getAttribute("style") || "";
|
|
145
147
|
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
146
148
|
const m = d && !d.trim().endsWith(";") ? "; " : "";
|
|
147
|
-
|
|
149
|
+
c.setAttribute("style", `${d}${m}width: ${l}px`);
|
|
148
150
|
}
|
|
149
151
|
});
|
|
150
152
|
}
|
|
151
|
-
function v(r,
|
|
153
|
+
function v(r, i) {
|
|
152
154
|
const e = r.match(/<!DOCTYPE[^>]*>/i);
|
|
153
155
|
return (e ? `${e[0]}
|
|
154
|
-
` : "") +
|
|
156
|
+
` : "") + i.documentElement.outerHTML;
|
|
155
157
|
}
|
|
156
158
|
function N(r) {
|
|
157
|
-
const
|
|
159
|
+
const i = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(i, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
158
160
|
if (!o.length)
|
|
159
161
|
return r;
|
|
160
|
-
const { buildCampaignUrl: s } = g(),
|
|
161
|
-
|
|
162
|
-
const { isFeatureEnabled: t } = S(),
|
|
162
|
+
const { buildCampaignUrl: s } = g(), c = q();
|
|
163
|
+
c.recommendationCampaignUrls = {};
|
|
164
|
+
const { isFeatureEnabled: t } = S(), n = t("liquidSyntax") ? "reco_" : "";
|
|
163
165
|
return o.forEach((u) => {
|
|
164
166
|
var l, d;
|
|
165
167
|
const p = u.getAttribute("recommendation-id");
|
|
166
|
-
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p,
|
|
167
|
-
}), v(
|
|
168
|
+
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p, n), T(u));
|
|
169
|
+
}), v(i, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
168
170
|
}
|
|
169
171
|
export {
|
|
170
172
|
y as formatPriceVariable,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BlockId as
|
|
1
|
+
var k = Object.defineProperty;
|
|
2
|
+
var B = (r, n, t) => n in r ? k(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var g = (r, n, t) => B(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { BlockId as _ } from "../../../enums/block.js";
|
|
5
5
|
import { getMigrationBannerHtml as b } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
-
import { Block as
|
|
7
|
-
import { regenerateMobileProductRows as
|
|
8
|
-
import { ensureMobileCssRulesExist as
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { getDefaultTemplate as
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
class q extends
|
|
6
|
+
import { Block as R, BlockCompositionType as y, ModificationDescription as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { regenerateMobileProductRows as A } from "./controls/main/utils.js";
|
|
8
|
+
import { ensureMobileCssRulesExist as d, setMobileLayoutOptOut as p, hasMobileLayoutOptOut as D } from "./controls/mobileLayout/cssRules.js";
|
|
9
|
+
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as f } from "./store/recommendation.js";
|
|
11
|
+
import { getDefaultTemplate as E } from "./templates/grid/template.js";
|
|
12
|
+
const h = _.Recommendation, l = "recommendation-block-v2", m = "recommendation-id";
|
|
13
|
+
let I = !1;
|
|
14
|
+
class q extends R {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
/**
|
|
18
18
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
19
19
|
* This avoids generating a new (different) ID in onCreated().
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
g(this, "_pendingBlockId", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return h;
|
|
25
25
|
}
|
|
26
26
|
getIcon() {
|
|
27
27
|
return "recommendation-icon";
|
|
@@ -39,7 +39,7 @@ class q extends A {
|
|
|
39
39
|
}
|
|
40
40
|
getSettingsPanelTitleHtml() {
|
|
41
41
|
return b(
|
|
42
|
-
|
|
42
|
+
h,
|
|
43
43
|
this.api.translate("Recommendation Block"),
|
|
44
44
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
|
|
45
45
|
);
|
|
@@ -59,7 +59,7 @@ class q extends A {
|
|
|
59
59
|
*/
|
|
60
60
|
getTemplate() {
|
|
61
61
|
const t = this._generateNextId();
|
|
62
|
-
return this._pendingBlockId = t,
|
|
62
|
+
return this._pendingBlockId = t, E(t);
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Called when a new block is dropped into the template
|
|
@@ -70,26 +70,24 @@ class q extends A {
|
|
|
70
70
|
*/
|
|
71
71
|
onCreated(t) {
|
|
72
72
|
const e = this._getRecommendationId(t);
|
|
73
|
-
if (e !== null && e > 0)
|
|
74
|
-
this._detectDuplicate(e) && this._handleDuplicate(t, e);
|
|
73
|
+
if (e !== null && e > 0)
|
|
75
74
|
return;
|
|
76
|
-
}
|
|
77
75
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
78
76
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
79
|
-
const { config:
|
|
77
|
+
const { config: o, wasFreshDrop: c } = s.initializeConfig(
|
|
80
78
|
this.api,
|
|
81
79
|
t,
|
|
82
80
|
{ recommendationId: i }
|
|
83
|
-
),
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
81
|
+
), a = f();
|
|
82
|
+
if (a.setCurrentBlock(i), c) {
|
|
83
|
+
d(this.api);
|
|
84
|
+
const u = this._getBlockElement(t);
|
|
85
|
+
u && (p(this.api, u, !0), A({
|
|
88
86
|
currentNode: t,
|
|
89
87
|
documentModifier: this.api.getDocumentModifier()
|
|
90
88
|
}));
|
|
91
89
|
}
|
|
92
|
-
|
|
90
|
+
a.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
|
|
93
91
|
}
|
|
94
92
|
/**
|
|
95
93
|
* Called when the document changes or template is loaded
|
|
@@ -102,20 +100,20 @@ class q extends A {
|
|
|
102
100
|
if (!(!t || !("getNodeConfig" in t))) {
|
|
103
101
|
if (!this._getRecommendationId(t)) {
|
|
104
102
|
const e = this._generateNextId();
|
|
105
|
-
this._assignRecommendationId(t, e),
|
|
103
|
+
this._assignRecommendationId(t, e), s.hasConfig(t) && s.updateConfig(
|
|
106
104
|
this.api,
|
|
107
105
|
t,
|
|
108
106
|
{ recommendationId: e },
|
|
109
107
|
"Assign recommendation ID to legacy block"
|
|
110
108
|
);
|
|
111
109
|
}
|
|
112
|
-
|
|
110
|
+
s.needsMigration(t) && this._migrateFromLegacy(t);
|
|
113
111
|
try {
|
|
114
|
-
|
|
115
|
-
const e =
|
|
112
|
+
I || (d(this.api), I = !0);
|
|
113
|
+
const e = s.getConfig(t), i = this._getBlockElement(t);
|
|
116
114
|
if (i) {
|
|
117
|
-
const
|
|
118
|
-
|
|
115
|
+
const o = !e.mobileLayoutEnabled;
|
|
116
|
+
D(i) !== o && p(this.api, i, o);
|
|
119
117
|
}
|
|
120
118
|
} catch {
|
|
121
119
|
}
|
|
@@ -129,7 +127,7 @@ class q extends A {
|
|
|
129
127
|
*/
|
|
130
128
|
onDelete(t) {
|
|
131
129
|
const e = this._getRecommendationId(t);
|
|
132
|
-
e &&
|
|
130
|
+
e && f().removeBlockState(e);
|
|
133
131
|
}
|
|
134
132
|
/**
|
|
135
133
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -139,59 +137,16 @@ class q extends A {
|
|
|
139
137
|
let t = 0;
|
|
140
138
|
try {
|
|
141
139
|
const e = this.api.getDocumentRoot();
|
|
142
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${
|
|
143
|
-
if ("getAttribute" in
|
|
144
|
-
const
|
|
145
|
-
|
|
140
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${l}`).forEach((o) => {
|
|
141
|
+
if ("getAttribute" in o) {
|
|
142
|
+
const c = o.getAttribute(m), a = c ? parseInt(c) : 0;
|
|
143
|
+
a > t && (t = a);
|
|
146
144
|
}
|
|
147
145
|
});
|
|
148
146
|
} catch {
|
|
149
147
|
}
|
|
150
148
|
return t + 1;
|
|
151
149
|
}
|
|
152
|
-
/** True when another block already holds the same id — Stripo's duplication signal. */
|
|
153
|
-
_detectDuplicate(t) {
|
|
154
|
-
try {
|
|
155
|
-
const e = this.api.getDocumentRoot();
|
|
156
|
-
if (e && "querySelectorAll" in e)
|
|
157
|
-
return e.querySelectorAll(
|
|
158
|
-
`.${m}[${u}="${t}"]`
|
|
159
|
-
).length > 1;
|
|
160
|
-
} catch {
|
|
161
|
-
}
|
|
162
|
-
return !1;
|
|
163
|
-
}
|
|
164
|
-
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
165
|
-
_handleDuplicate(t, e) {
|
|
166
|
-
const i = this._generateNextId(), n = this._getBlockElement(t);
|
|
167
|
-
this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), c.hasConfig(t) && c.updateConfig(
|
|
168
|
-
this.api,
|
|
169
|
-
t,
|
|
170
|
-
{ recommendationId: i },
|
|
171
|
-
`Reassign recommendation ID on duplicate (was ${e})`
|
|
172
|
-
);
|
|
173
|
-
const o = g();
|
|
174
|
-
o.cloneBlockState(e, i), o.setCurrentBlock(i);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
178
|
-
* class scopes per-block CSS rules, so leaving the source's class would
|
|
179
|
-
* make stylistic edits leak between source and clone.
|
|
180
|
-
*/
|
|
181
|
-
_reassignInstanceClass(t, e, i) {
|
|
182
|
-
if (!("getAttribute" in t))
|
|
183
|
-
return;
|
|
184
|
-
const n = t.getAttribute("class");
|
|
185
|
-
if (!n)
|
|
186
|
-
return;
|
|
187
|
-
const o = `ins-recommendation-v3-block-${e}`, r = `ins-recommendation-v3-block-${i}`;
|
|
188
|
-
if (!n.includes(o))
|
|
189
|
-
return;
|
|
190
|
-
const l = n.replace(o, r), d = this.api.getDocumentModifier();
|
|
191
|
-
d.modifyHtml(t).setAttribute("class", l), d.apply(new f(
|
|
192
|
-
`Reassign recommendation instance class ${o} -> ${r}`
|
|
193
|
-
));
|
|
194
|
-
}
|
|
195
150
|
/**
|
|
196
151
|
* Assigns a recommendation-id attribute to the block element.
|
|
197
152
|
* The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
|
|
@@ -202,8 +157,8 @@ class q extends A {
|
|
|
202
157
|
const i = this._getBlockElement(t);
|
|
203
158
|
if (!i)
|
|
204
159
|
return;
|
|
205
|
-
const
|
|
206
|
-
|
|
160
|
+
const o = this.api.getDocumentModifier();
|
|
161
|
+
o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new C(`Assign recommendation ID ${e}`));
|
|
207
162
|
}
|
|
208
163
|
/**
|
|
209
164
|
* Gets the recommendation-id from a block node
|
|
@@ -212,11 +167,11 @@ class q extends A {
|
|
|
212
167
|
const e = this._getBlockElement(t);
|
|
213
168
|
if (!e || !("getAttribute" in e))
|
|
214
169
|
return null;
|
|
215
|
-
const i = e.getAttribute(
|
|
170
|
+
const i = e.getAttribute(m);
|
|
216
171
|
if (!i)
|
|
217
172
|
return null;
|
|
218
|
-
const
|
|
219
|
-
return Number.isNaN(
|
|
173
|
+
const o = parseInt(i);
|
|
174
|
+
return Number.isNaN(o) ? null : o;
|
|
220
175
|
}
|
|
221
176
|
/**
|
|
222
177
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -224,19 +179,19 @@ class q extends A {
|
|
|
224
179
|
_getBlockElement(t) {
|
|
225
180
|
if ("getAttribute" in t) {
|
|
226
181
|
const e = t.getAttribute("class");
|
|
227
|
-
if (e && e.includes(
|
|
182
|
+
if (e && e.includes(l))
|
|
228
183
|
return t;
|
|
229
184
|
}
|
|
230
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
185
|
+
return "querySelector" in t ? t.querySelector(`.${l}`) ?? null : null;
|
|
231
186
|
}
|
|
232
187
|
/**
|
|
233
188
|
* Migrate configuration from legacy format
|
|
234
189
|
*/
|
|
235
190
|
_migrateFromLegacy(t) {
|
|
236
|
-
|
|
191
|
+
s.migrateFromDataAttributes(this.api, t);
|
|
237
192
|
}
|
|
238
193
|
}
|
|
239
194
|
export {
|
|
240
|
-
|
|
195
|
+
h as BLOCK_ID,
|
|
241
196
|
q as RecommendationBlock
|
|
242
197
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as
|
|
2
|
-
import { useRecommendationApi as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as y } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as P } from "pinia";
|
|
5
5
|
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import { isFilterValid as
|
|
10
|
-
import { isConfigValid as
|
|
11
|
-
const h =
|
|
9
|
+
import { isFilterValid as w } from "../validation/filterSchema.js";
|
|
10
|
+
import { isConfigValid as v } from "../validation/requiredFields.js";
|
|
11
|
+
const h = C();
|
|
12
12
|
let m = null, u = null, d = null;
|
|
13
|
-
function
|
|
13
|
+
function k() {
|
|
14
14
|
return {
|
|
15
15
|
cardsInRow: F,
|
|
16
16
|
currencySettings: {
|
|
@@ -38,9 +38,9 @@ function I() {
|
|
|
38
38
|
customAttributes: []
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function I() {
|
|
42
42
|
return {
|
|
43
|
-
recommendationConfigs:
|
|
43
|
+
recommendationConfigs: k(),
|
|
44
44
|
recommendationProducts: [],
|
|
45
45
|
filterStatus: !1,
|
|
46
46
|
filterSelectionDrawerStatus: !1,
|
|
@@ -69,7 +69,7 @@ const N = () => ({
|
|
|
69
69
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
70
70
|
*/
|
|
71
71
|
recommendationConfigs(t) {
|
|
72
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
72
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
|
|
73
73
|
},
|
|
74
74
|
/**
|
|
75
75
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -133,7 +133,7 @@ const N = () => ({
|
|
|
133
133
|
getFilterList() {
|
|
134
134
|
return Object.values(this.filterList).map((t) => {
|
|
135
135
|
let e;
|
|
136
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
136
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : y.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
137
137
|
text: t.displayName,
|
|
138
138
|
value: e,
|
|
139
139
|
type: t.attributeType
|
|
@@ -155,7 +155,7 @@ const N = () => ({
|
|
|
155
155
|
setCurrentBlock(t) {
|
|
156
156
|
this.blockStates[t] || (this.blockStates = {
|
|
157
157
|
...this.blockStates,
|
|
158
|
-
[t]:
|
|
158
|
+
[t]: I()
|
|
159
159
|
}), this.currentRecommendationId = t;
|
|
160
160
|
},
|
|
161
161
|
/**
|
|
@@ -174,25 +174,6 @@ const N = () => ({
|
|
|
174
174
|
this.currentRecommendationId = n.length > 0 ? n[0] : null;
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
|
-
/**
|
|
178
|
-
* Deep-clones a block's state and mirrors its campaign URL under a new id.
|
|
179
|
-
* Invoked from `onCreated` when a duplicate is detected (SD-142352).
|
|
180
|
-
*/
|
|
181
|
-
cloneBlockState(t, e) {
|
|
182
|
-
const r = this.blockStates[t];
|
|
183
|
-
if (r) {
|
|
184
|
-
const o = structuredClone(r);
|
|
185
|
-
o.recommendationConfigs.id = e, this.blockStates = {
|
|
186
|
-
...this.blockStates,
|
|
187
|
-
[e]: o
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const n = t.toString(), c = e.toString(), i = this.recommendationCampaignUrls[n];
|
|
191
|
-
i && (this.recommendationCampaignUrls = {
|
|
192
|
-
...this.recommendationCampaignUrls,
|
|
193
|
-
[c]: i
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
177
|
/**
|
|
197
178
|
* Marks a block as initialized (initial API data has been fetched).
|
|
198
179
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -223,7 +204,7 @@ const N = () => ({
|
|
|
223
204
|
decimalCount: String(e.currencyDecimalCount),
|
|
224
205
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
225
206
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
226
|
-
}, c = !this.blockStates[t], i = c ?
|
|
207
|
+
}, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
|
|
227
208
|
i.recommendationConfigs = {
|
|
228
209
|
...i.recommendationConfigs,
|
|
229
210
|
strategy: e.strategy,
|
|
@@ -378,7 +359,7 @@ const N = () => ({
|
|
|
378
359
|
const n = [...e.recommendationConfigs.filters];
|
|
379
360
|
n[r] = {
|
|
380
361
|
...t,
|
|
381
|
-
isValid:
|
|
362
|
+
isValid: w(t)
|
|
382
363
|
}, e.recommendationConfigs.filters = n;
|
|
383
364
|
}
|
|
384
365
|
},
|
|
@@ -424,7 +405,7 @@ const N = () => ({
|
|
|
424
405
|
* every block's recommendationConfigs across user edits.
|
|
425
406
|
*/
|
|
426
407
|
hasInvalidBlock() {
|
|
427
|
-
return Object.values(this.blockStates).some((t) => !
|
|
408
|
+
return Object.values(this.blockStates).some((t) => !v(t.recommendationConfigs, this));
|
|
428
409
|
},
|
|
429
410
|
// ====================================================================
|
|
430
411
|
// Per-Block Product Fetching
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-
|
|
1
|
+
.gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-cdee3452]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-cdee3452]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-cdee3452]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
|
|
@@ -7,5 +7,5 @@ export declare const useActionsApi: () => {
|
|
|
7
7
|
getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
|
|
8
8
|
updateTimerInClonedTemplate: () => Promise<string | null>;
|
|
9
9
|
updateHtmlAndCss: (html: string, css: string) => void;
|
|
10
|
-
editorSave: () => Promise<
|
|
10
|
+
editorSave: () => Promise<boolean>;
|
|
11
11
|
};
|
|
@@ -60,16 +60,6 @@ export declare class RecommendationBlock extends Block {
|
|
|
60
60
|
* in the document and finding the maximum existing ID + 1.
|
|
61
61
|
*/
|
|
62
62
|
private _generateNextId;
|
|
63
|
-
/** True when another block already holds the same id — Stripo's duplication signal. */
|
|
64
|
-
private _detectDuplicate;
|
|
65
|
-
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
66
|
-
private _handleDuplicate;
|
|
67
|
-
/**
|
|
68
|
-
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
69
|
-
* class scopes per-block CSS rules, so leaving the source's class would
|
|
70
|
-
* make stylistic edits leak between source and clone.
|
|
71
|
-
*/
|
|
72
|
-
private _reassignInstanceClass;
|
|
73
63
|
/**
|
|
74
64
|
* Assigns a recommendation-id attribute to the block element.
|
|
75
65
|
* The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
|
|
@@ -216,11 +216,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
216
216
|
* Resets currentRecommendationId if it was the deleted block.
|
|
217
217
|
*/
|
|
218
218
|
removeBlockState(id: number): void;
|
|
219
|
-
/**
|
|
220
|
-
* Deep-clones a block's state and mirrors its campaign URL under a new id.
|
|
221
|
-
* Invoked from `onCreated` when a duplicate is detected (SD-142352).
|
|
222
|
-
*/
|
|
223
|
-
cloneBlockState(sourceId: number, newId: number): void;
|
|
224
219
|
/**
|
|
225
220
|
* Marks a block as initialized (initial API data has been fetched).
|
|
226
221
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.4.1-beta.
|
|
3
|
+
"version": "3.4.1-beta.ad76dd1",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|