@useinsider/guido 3.19.0-beta.c8d2be8 → 3.19.0-beta.dcea8c0
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/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useHttp.js +44 -55
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -0
- package/dist/guido.css +1 -1
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/package.json +1 -1
|
@@ -9,15 +9,15 @@ var u = function() {
|
|
|
9
9
|
} } }), e(t.MigrationConfirmModal, { ref: "migrationModalRef", on: { confirm: function(r) {
|
|
10
10
|
return t.executeSave(!1);
|
|
11
11
|
} } })], 1);
|
|
12
|
-
},
|
|
12
|
+
}, c = [], p = /* @__PURE__ */ d(
|
|
13
13
|
l,
|
|
14
14
|
u,
|
|
15
|
-
|
|
15
|
+
c,
|
|
16
16
|
!1,
|
|
17
17
|
null,
|
|
18
|
-
"
|
|
18
|
+
"c61cc8ea"
|
|
19
19
|
);
|
|
20
|
-
const v =
|
|
20
|
+
const v = p.exports;
|
|
21
21
|
export {
|
|
22
22
|
v as default
|
|
23
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, ref as
|
|
1
|
+
import { defineComponent as q, ref as n, computed as x } from "vue";
|
|
2
2
|
import { useActionsApi as b } from "../../../composables/useActionsApi.js";
|
|
3
3
|
import { useConfig as k } from "../../../composables/useConfig.js";
|
|
4
4
|
import { useExport as B } from "../../../composables/useExport.js";
|
|
@@ -17,48 +17,46 @@ import { storeToRefs as Q } from "pinia";
|
|
|
17
17
|
import U from "./MigrationConfirmModal.vue.js";
|
|
18
18
|
const ft = /* @__PURE__ */ q({
|
|
19
19
|
__name: "EditorActions",
|
|
20
|
-
setup(W, { expose:
|
|
21
|
-
const { config:
|
|
20
|
+
setup(W, { expose: w }) {
|
|
21
|
+
const { config: l, isFeatureEnabled: m } = k(), { exportHtml: c } = B(), { save: p } = R(), { openVersionHistory: u, closeVersionHistory: f } = P(), { getCompiledEmail: d } = b(), { compileHtml: v } = L(), { validateLiquidSyntax: y } = j(), { handleError: r } = z(), e = G(), g = J(), { hasMigrations: S } = Q(g), s = I(), i = n(!1), a = n(!1), H = n(), h = D(), _ = () => {
|
|
22
22
|
if (e.isVersionHistoryOpen) {
|
|
23
|
-
|
|
23
|
+
f();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
u();
|
|
27
27
|
}, C = async () => {
|
|
28
|
-
i.value = !0, await
|
|
28
|
+
i.value = !0, await c(), i.value = !1;
|
|
29
29
|
}, A = () => {
|
|
30
30
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
-
}, M =
|
|
31
|
+
}, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
|
|
32
32
|
() => {
|
|
33
33
|
var t, o;
|
|
34
|
-
return ((o = (t =
|
|
34
|
+
return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
35
35
|
}
|
|
36
|
-
),
|
|
36
|
+
), V = async (t) => {
|
|
37
37
|
a.value = !0, t || (e.loadingStatus = !0);
|
|
38
38
|
let o;
|
|
39
39
|
try {
|
|
40
|
-
o = await
|
|
41
|
-
} catch (
|
|
42
|
-
|
|
43
|
-
throw n;
|
|
44
|
-
r(n, "Failed to save template");
|
|
40
|
+
o = await p(t);
|
|
41
|
+
} catch (T) {
|
|
42
|
+
r(T, "Failed to save template");
|
|
45
43
|
} finally {
|
|
46
44
|
a.value = !1, !t && !o && (e.loadingStatus = !1);
|
|
47
45
|
}
|
|
48
46
|
return o;
|
|
49
|
-
},
|
|
47
|
+
}, E = (t) => {
|
|
50
48
|
var o;
|
|
51
|
-
if (!t &&
|
|
52
|
-
(o =
|
|
49
|
+
if (!t && S.value) {
|
|
50
|
+
(o = H.value) == null || o.open();
|
|
53
51
|
return;
|
|
54
52
|
}
|
|
55
|
-
return
|
|
53
|
+
return V(t);
|
|
56
54
|
}, F = async () => {
|
|
57
|
-
if (
|
|
55
|
+
if (m("liquidSyntax")) {
|
|
58
56
|
e.loadingStatus = !0;
|
|
59
57
|
try {
|
|
60
|
-
const { html: t } = await
|
|
61
|
-
if (!await
|
|
58
|
+
const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
|
|
59
|
+
if (!await y(o))
|
|
62
60
|
return;
|
|
63
61
|
} catch (t) {
|
|
64
62
|
r(t, "Failed to prepare test email");
|
|
@@ -67,11 +65,11 @@ const ft = /* @__PURE__ */ q({
|
|
|
67
65
|
e.loadingStatus = !1;
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
|
|
68
|
+
h();
|
|
71
69
|
};
|
|
72
|
-
return
|
|
73
|
-
handleSave:
|
|
74
|
-
}), { __sfc: !0, config:
|
|
70
|
+
return w({
|
|
71
|
+
handleSave: E
|
|
72
|
+
}), { __sfc: !0, config: l, isFeatureEnabled: m, exportHtml: c, save: p, openVersionHistory: u, closeVersionHistory: f, getCompiledEmail: d, compileHtml: v, validateLiquidSyntax: y, handleError: r, editorStore: e, templateStore: g, hasMigrations: S, trans: s, isExporting: i, isSaving: a, migrationModalRef: H, testEmailClick: h, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: V, handleSave: E, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
|
|
75
73
|
}
|
|
76
74
|
});
|
|
77
75
|
export {
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { filterAmpErrors as y } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { getEditorApi as s } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { useToaster as D } from "./useToaster.js";
|
|
4
|
+
const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
5
|
+
const f = setTimeout(
|
|
6
|
+
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
6
7
|
l
|
|
7
|
-
),
|
|
8
|
-
clearTimeout(
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
), c = (t) => (e) => {
|
|
9
|
+
clearTimeout(f), t(e);
|
|
10
|
+
}, d = c(p);
|
|
11
|
+
try {
|
|
12
|
+
A(c(C), d);
|
|
13
|
+
} catch (t) {
|
|
14
|
+
d(t);
|
|
15
|
+
}
|
|
16
|
+
}), P = () => {
|
|
17
|
+
const { handleError: n } = D(), l = (t = {}) => r(
|
|
13
18
|
"compileEmail",
|
|
14
|
-
|
|
15
|
-
(e,
|
|
19
|
+
T,
|
|
20
|
+
(e, i) => {
|
|
16
21
|
const o = { ...{
|
|
17
22
|
minimize: !0,
|
|
18
23
|
utmEntity: {
|
|
@@ -32,53 +37,53 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
32
37
|
forceAmp: !1,
|
|
33
38
|
resetDataSavedFlag: !1,
|
|
34
39
|
disableLineHeightsReplace: !0
|
|
35
|
-
}, ...t },
|
|
36
|
-
callback: (
|
|
37
|
-
|
|
38
|
-
html:
|
|
39
|
-
ampHtml:
|
|
40
|
-
ampErrors:
|
|
41
|
-
displayConditions:
|
|
40
|
+
}, ...t }, u = {
|
|
41
|
+
callback: (m, g, w, S, v) => {
|
|
42
|
+
m ? i(m) : e({
|
|
43
|
+
html: g,
|
|
44
|
+
ampHtml: w,
|
|
45
|
+
ampErrors: y(S ?? []),
|
|
46
|
+
displayConditions: v
|
|
42
47
|
});
|
|
43
48
|
},
|
|
44
49
|
...o
|
|
45
50
|
};
|
|
46
|
-
|
|
51
|
+
s().actionsApi.compileEmail(u);
|
|
47
52
|
}
|
|
48
53
|
);
|
|
49
54
|
return {
|
|
50
55
|
getCompiledEmail: l,
|
|
51
|
-
getTemplateData: () =>
|
|
56
|
+
getTemplateData: () => r(
|
|
52
57
|
"getTemplateData",
|
|
53
|
-
|
|
58
|
+
T,
|
|
54
59
|
(t) => {
|
|
55
|
-
const e = ({ html:
|
|
56
|
-
html:
|
|
57
|
-
css:
|
|
60
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
|
|
61
|
+
html: i,
|
|
62
|
+
css: a,
|
|
58
63
|
width: o,
|
|
59
64
|
height: E,
|
|
60
|
-
utmParams:
|
|
61
|
-
syncModulesIds:
|
|
65
|
+
utmParams: u,
|
|
66
|
+
syncModulesIds: m
|
|
62
67
|
});
|
|
63
|
-
|
|
68
|
+
s().actionsApi.getTemplateData(e);
|
|
64
69
|
}
|
|
65
70
|
),
|
|
66
71
|
activateCustomViewStyles: (t = !0) => {
|
|
67
|
-
|
|
72
|
+
s().actionsApi.activateCustomViewStyles(t);
|
|
68
73
|
},
|
|
69
74
|
getPreviewData: async (t) => {
|
|
70
75
|
try {
|
|
71
76
|
const {
|
|
72
77
|
html: e,
|
|
73
|
-
displayConditions:
|
|
74
|
-
ampHtml:
|
|
78
|
+
displayConditions: i,
|
|
79
|
+
ampHtml: a = "",
|
|
75
80
|
ampErrors: o = []
|
|
76
81
|
} = await l({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
77
82
|
return {
|
|
78
83
|
html: e,
|
|
79
|
-
ampHtml:
|
|
84
|
+
ampHtml: a,
|
|
80
85
|
ampErrors: o,
|
|
81
|
-
displayConditions:
|
|
86
|
+
displayConditions: i
|
|
82
87
|
};
|
|
83
88
|
} catch (e) {
|
|
84
89
|
return n(e, "Error loading preview"), {
|
|
@@ -90,30 +95,30 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
90
95
|
}
|
|
91
96
|
},
|
|
92
97
|
updateTimerInClonedTemplate: () => new Promise((t) => {
|
|
93
|
-
var e,
|
|
94
|
-
if (typeof ((
|
|
98
|
+
var e, i;
|
|
99
|
+
if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
|
|
95
100
|
t(null);
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
98
103
|
try {
|
|
99
|
-
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((
|
|
100
|
-
|
|
104
|
+
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, o) => {
|
|
105
|
+
a ? (n(a, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
101
106
|
});
|
|
102
|
-
} catch (
|
|
103
|
-
n(
|
|
107
|
+
} catch (a) {
|
|
108
|
+
n(a, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
104
109
|
}
|
|
105
110
|
}),
|
|
106
111
|
updateHtmlAndCss: (t, e) => {
|
|
107
|
-
const { actionsApi:
|
|
108
|
-
return
|
|
109
|
-
|
|
112
|
+
const { actionsApi: i } = s();
|
|
113
|
+
return r("updateHtmlAndCss", h, (a) => {
|
|
114
|
+
i.updateHtmlAndCss(t, e, () => a());
|
|
110
115
|
});
|
|
111
116
|
},
|
|
112
|
-
editorSave: () =>
|
|
117
|
+
editorSave: () => r(
|
|
113
118
|
"save",
|
|
114
|
-
|
|
119
|
+
T,
|
|
115
120
|
(t) => {
|
|
116
|
-
|
|
121
|
+
s().actionsApi.save((e) => {
|
|
117
122
|
if (e) {
|
|
118
123
|
n(e, "Failed to save template"), t(!1);
|
|
119
124
|
return;
|
|
@@ -125,5 +130,5 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
125
130
|
};
|
|
126
131
|
};
|
|
127
132
|
export {
|
|
128
|
-
|
|
133
|
+
P as useActionsApi
|
|
129
134
|
};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ToasterTypeOptions as d } from "../enums/toaster.js";
|
|
2
|
+
import { findEditorApi as s, EDITOR_NOT_READY_MESSAGE as p } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { useToaster as E } from "./useToaster.js";
|
|
4
|
+
const T = () => {
|
|
5
|
+
const { showToaster: i } = E(), t = (o) => {
|
|
6
|
+
var r;
|
|
7
|
+
const e = (r = s()) == null ? void 0 : r.codeEditorApi;
|
|
8
|
+
if (!e) {
|
|
9
|
+
i({ type: d.Error, message: p });
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
o(e);
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
openCodeEditor: () => {
|
|
16
|
+
t((o) => o.openCodeEditor());
|
|
17
|
+
},
|
|
18
|
+
closeCodeEditor: () => {
|
|
19
|
+
t((o) => o.closeCodeEditor());
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
9
23
|
export {
|
|
10
|
-
|
|
24
|
+
T as useCodeEditorApi
|
|
11
25
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCsrfToken as O } from "../utils/genericUtil.js";
|
|
2
|
-
import { ref as m, computed as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
import { ref as m, computed as T } from "vue";
|
|
3
|
+
const X = (b = {}) => {
|
|
4
|
+
const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
|
|
5
5
|
baseURL: "",
|
|
6
6
|
timeout: 1e4,
|
|
7
7
|
retry: 0,
|
|
@@ -10,90 +10,79 @@ const k = (g = {}) => {
|
|
|
10
10
|
"Content-Type": "application/json",
|
|
11
11
|
"X-CSRF-TOKEN": O(),
|
|
12
12
|
Accept: "application/json",
|
|
13
|
-
// The panel backend only answers 401/419 to ajax requests; without this a guest
|
|
14
|
-
// fetch gets a 302 to the login page and never sees an auth status.
|
|
15
13
|
"X-Requested-With": "XMLHttpRequest"
|
|
16
14
|
},
|
|
17
|
-
...
|
|
18
|
-
},
|
|
15
|
+
...b
|
|
16
|
+
}, w = (e, s) => {
|
|
19
17
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
20
18
|
return e;
|
|
21
|
-
const t =
|
|
19
|
+
const t = s || v.baseURL || "";
|
|
22
20
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
23
|
-
}, P = (e) => new Promise((
|
|
21
|
+
}, P = (e) => new Promise((s, t) => {
|
|
24
22
|
setTimeout(() => {
|
|
25
23
|
t(new Error("Request timeout"));
|
|
26
24
|
}, e);
|
|
27
|
-
}),
|
|
28
|
-
setTimeout(
|
|
29
|
-
}), i = async (e,
|
|
30
|
-
|
|
31
|
-
const
|
|
25
|
+
}), x = (e) => new Promise((s) => {
|
|
26
|
+
setTimeout(s, e);
|
|
27
|
+
}), i = async (e, s, t, L = {}) => {
|
|
28
|
+
a.value = null, p.value = !0, u.value = new AbortController();
|
|
29
|
+
const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
|
|
32
30
|
method: e,
|
|
33
|
-
headers: { ...
|
|
31
|
+
headers: { ...n.headers },
|
|
34
32
|
signal: u.value.signal,
|
|
35
|
-
...
|
|
33
|
+
...n
|
|
36
34
|
};
|
|
37
35
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
38
|
-
const
|
|
39
|
-
if (window.isSessionExpired)
|
|
40
|
-
throw n.value = { message: "Session expired" }, new Error("Session expired");
|
|
36
|
+
const E = async (h = 0) => {
|
|
41
37
|
try {
|
|
42
|
-
const o = [fetch(
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
46
|
-
const
|
|
47
|
-
throw
|
|
48
|
-
detail: {
|
|
49
|
-
status: s.status,
|
|
50
|
-
body: H,
|
|
51
|
-
url: new URL(E, window.location.href).href
|
|
52
|
-
}
|
|
53
|
-
}))).catch(() => {
|
|
54
|
-
}), f;
|
|
38
|
+
const o = [fetch(D, c)];
|
|
39
|
+
n.timeout && o.push(P(n.timeout));
|
|
40
|
+
const r = await Promise.race(o);
|
|
41
|
+
if (!r.ok) {
|
|
42
|
+
const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
|
|
43
|
+
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
55
44
|
}
|
|
56
|
-
let
|
|
57
|
-
const l =
|
|
58
|
-
return l != null && l.includes("application/json") ?
|
|
59
|
-
data:
|
|
60
|
-
status:
|
|
61
|
-
statusText:
|
|
62
|
-
headers:
|
|
45
|
+
let f;
|
|
46
|
+
const l = r.headers.get("content-type");
|
|
47
|
+
return l != null && l.includes("application/json") ? f = await r.json() : l != null && l.includes("text/") ? f = await r.text() : f = await r.blob(), {
|
|
48
|
+
data: f,
|
|
49
|
+
status: r.status,
|
|
50
|
+
statusText: r.statusText,
|
|
51
|
+
headers: r.headers
|
|
63
52
|
};
|
|
64
53
|
} catch (o) {
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
return await
|
|
68
|
-
throw o instanceof Error ? o.name === "AbortError" ?
|
|
54
|
+
const r = o instanceof Error && o.name === "AbortError";
|
|
55
|
+
if (h < (n.retry || 0) && !r)
|
|
56
|
+
return await x(n.retryDelay || 1e3), E(h + 1);
|
|
57
|
+
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
69
58
|
}
|
|
70
59
|
};
|
|
71
60
|
try {
|
|
72
|
-
return await
|
|
61
|
+
return await E();
|
|
73
62
|
} finally {
|
|
74
|
-
|
|
63
|
+
p.value = !1, u.value = null;
|
|
75
64
|
}
|
|
76
|
-
},
|
|
65
|
+
}, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
|
|
77
66
|
u.value && u.value.abort(e);
|
|
78
|
-
},
|
|
79
|
-
|
|
67
|
+
}, W = () => {
|
|
68
|
+
a.value = null;
|
|
80
69
|
};
|
|
81
70
|
return {
|
|
82
71
|
// State
|
|
83
|
-
loading:
|
|
84
|
-
error:
|
|
72
|
+
loading: g,
|
|
73
|
+
error: T(() => a.value),
|
|
85
74
|
hasError: y,
|
|
86
75
|
// Methods
|
|
87
76
|
request: i,
|
|
88
|
-
get:
|
|
89
|
-
post:
|
|
77
|
+
get: C,
|
|
78
|
+
post: R,
|
|
90
79
|
put: $,
|
|
91
80
|
patch: q,
|
|
92
81
|
delete: A,
|
|
93
|
-
cancel:
|
|
94
|
-
clearError:
|
|
82
|
+
cancel: U,
|
|
83
|
+
clearError: W
|
|
95
84
|
};
|
|
96
85
|
};
|
|
97
86
|
export {
|
|
98
|
-
|
|
87
|
+
X as useHttp
|
|
99
88
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { useToaster as
|
|
1
|
+
import { useRecommendation as C } from "./useRecommendation.js";
|
|
2
|
+
import { useToaster as I } from "./useToaster.js";
|
|
3
3
|
import { useTranslations as v } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
6
|
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
7
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
-
import { resolveMigrationTarget as
|
|
9
|
-
import { commitBlockChangeOutsidePanel as
|
|
10
|
-
import { useConfigStore as
|
|
8
|
+
import { resolveMigrationTarget as k, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
|
+
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
|
+
import { useConfigStore as h } from "../stores/config.js";
|
|
11
11
|
const F = () => {
|
|
12
|
-
const e = b(), r =
|
|
12
|
+
const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = v();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
14
|
const t = e.currentRecommendationId;
|
|
15
15
|
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s =
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
|
|
18
18
|
campaignId: r.campaignId,
|
|
19
19
|
templateLibraryId: r.templateLibraryId
|
|
20
|
-
}), S =
|
|
20
|
+
}), S = R({
|
|
21
21
|
blockId: t,
|
|
22
22
|
url: m(String(t)),
|
|
23
23
|
campaignId: r.campaignId,
|
|
@@ -29,30 +29,34 @@ const F = () => {
|
|
|
29
29
|
let o;
|
|
30
30
|
try {
|
|
31
31
|
o = await e.convertLegacyStrategy(S, s);
|
|
32
|
-
} catch (
|
|
33
|
-
return console.error("[useLegacyStrategyConversion] migration failed",
|
|
32
|
+
} catch (i) {
|
|
33
|
+
return console.error("[useLegacyStrategyConversion] migration failed", i), c({
|
|
34
34
|
type: g.Error,
|
|
35
|
-
message:
|
|
35
|
+
message: a("email-editor.legacy-strategy-migration-failed"),
|
|
36
|
+
actionButton: {
|
|
37
|
+
text: a("ds-steps.create-recommendation-strategy"),
|
|
38
|
+
onClick: () => e.openStrategyCreation()
|
|
39
|
+
}
|
|
36
40
|
}), "";
|
|
37
41
|
}
|
|
38
42
|
try {
|
|
39
43
|
await e.fetchStrategyProductsForBlock(t);
|
|
40
|
-
} catch (
|
|
41
|
-
console.error("[useLegacyStrategyConversion] product refetch failed",
|
|
44
|
+
} catch (i) {
|
|
45
|
+
console.error("[useLegacyStrategyConversion] product refetch failed", i);
|
|
42
46
|
}
|
|
43
|
-
const
|
|
44
|
-
return
|
|
47
|
+
const n = e.blockStates[t];
|
|
48
|
+
return n ? T(
|
|
45
49
|
t,
|
|
46
50
|
{
|
|
47
51
|
strategyId: o,
|
|
48
|
-
size:
|
|
52
|
+
size: n.recommendationConfigs.size,
|
|
49
53
|
configVersion: L
|
|
50
54
|
},
|
|
51
|
-
|
|
55
|
+
n.recommendationProducts,
|
|
52
56
|
"Converted legacy recommendation strategy"
|
|
53
|
-
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f),
|
|
57
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
|
|
54
58
|
type: g.Error,
|
|
55
|
-
message:
|
|
59
|
+
message: a("email-editor.legacy-strategy-update-failed")
|
|
56
60
|
}), "") : o;
|
|
57
61
|
} };
|
|
58
62
|
};
|
|
@@ -6,9 +6,10 @@ import { useConfig } from "./useConfig.js";
|
|
|
6
6
|
const useTranslations = () => {
|
|
7
7
|
var o, e;
|
|
8
8
|
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
-
|
|
9
|
+
var s;
|
|
10
|
+
const r = (s = translations.value) == null ? void 0 : s[t];
|
|
10
11
|
return r ? n ? Object.entries(n).reduce(
|
|
11
|
-
(
|
|
12
|
+
(i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
|
|
12
13
|
r
|
|
13
14
|
) : r : (console.warn(`Translation key not found: ${t}`), t);
|
|
14
15
|
};
|
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
import { ToasterTypeOptions as t } from "../enums/toaster.js";
|
|
2
|
-
import { useVersionHistoryStore as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useVersionHistoryStore as m } from "../stores/version-history.js";
|
|
3
|
+
import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
|
|
4
|
+
import { useToaster as V } from "./useToaster.js";
|
|
5
|
+
const d = () => {
|
|
6
|
+
const n = m(), { showToaster: i } = V(), o = (e) => {
|
|
7
|
+
var s;
|
|
8
|
+
const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
|
|
9
|
+
if (!r) {
|
|
10
|
+
i({ type: t.Error, message: y });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
e(r);
|
|
14
|
+
}, p = (e) => {
|
|
15
|
+
n.$reset(), n.updateState(e);
|
|
16
|
+
}, a = () => {
|
|
17
|
+
n.$reset();
|
|
9
18
|
};
|
|
10
19
|
return {
|
|
11
20
|
openVersionHistory: () => {
|
|
12
|
-
|
|
21
|
+
o((e) => e.openVersionHistory(p, a));
|
|
13
22
|
},
|
|
14
23
|
closeVersionHistory: () => {
|
|
15
|
-
|
|
24
|
+
o((e) => e.closeVersionHistory());
|
|
16
25
|
},
|
|
17
26
|
switchToDesktopPreview: () => {
|
|
18
|
-
|
|
27
|
+
o((e) => e.switchToDesktopPreview());
|
|
19
28
|
},
|
|
20
29
|
switchToMobilePreview: () => {
|
|
21
|
-
|
|
30
|
+
o((e) => e.switchToMobilePreview());
|
|
22
31
|
},
|
|
23
32
|
previewVersion: (e) => {
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
o((r) => r.previewVersion(e, (s) => {
|
|
34
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
35
|
+
i({
|
|
27
36
|
type: t.Error,
|
|
28
|
-
message: `Error compiling email: ${
|
|
37
|
+
message: `Error compiling email: ${c}`
|
|
29
38
|
});
|
|
30
|
-
});
|
|
39
|
+
}));
|
|
31
40
|
},
|
|
32
41
|
restoreVersion: (e) => {
|
|
33
|
-
|
|
42
|
+
o((r) => r.restoreVersion(
|
|
34
43
|
e,
|
|
35
44
|
() => {
|
|
36
|
-
|
|
45
|
+
i({
|
|
37
46
|
type: t.Success,
|
|
38
47
|
message: "Your version has been restored successfully."
|
|
39
48
|
});
|
|
40
49
|
},
|
|
41
|
-
(
|
|
42
|
-
const
|
|
43
|
-
|
|
50
|
+
(s) => {
|
|
51
|
+
const c = s instanceof Error ? s.message : String(s);
|
|
52
|
+
i({
|
|
44
53
|
type: t.Error,
|
|
45
|
-
message: `Error compiling email: ${
|
|
54
|
+
message: `Error compiling email: ${c}`
|
|
46
55
|
});
|
|
47
56
|
}
|
|
48
|
-
);
|
|
57
|
+
));
|
|
49
58
|
}
|
|
50
59
|
};
|
|
51
60
|
};
|
|
52
61
|
export {
|
|
53
|
-
|
|
62
|
+
d as useVersionHistoryApi
|
|
54
63
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .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-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__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-
|
|
1
|
+
@charset "UTF-8";.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .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-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__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-c61cc8ea]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-36867e2e]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-36867e2e]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-36867e2e]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StripoEditorApi } from '@@/Types/stripo';
|
|
2
|
+
export declare const EDITOR_NOT_READY_MESSAGE = "The editor is not ready yet. Please wait for it to load and try again.";
|
|
3
|
+
export declare const findEditorApi: () => StripoEditorApi | undefined;
|
|
4
|
+
export declare const getEditorApi: () => StripoEditorApi;
|
|
@@ -39,16 +39,16 @@ const r = () => ({
|
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
41
|
isActiveTypeFirstInCollection: (e) => {
|
|
42
|
-
const t = i[e.selectedCollectionType];
|
|
42
|
+
const t = i[e.selectedCollectionType] ?? [];
|
|
43
43
|
return e.activeType === t[0];
|
|
44
44
|
},
|
|
45
45
|
isActiveTypeLastInCollection: (e) => {
|
|
46
|
-
const t = i[e.selectedCollectionType];
|
|
46
|
+
const t = i[e.selectedCollectionType] ?? [];
|
|
47
47
|
return e.activeType === t[t.length - 1];
|
|
48
48
|
},
|
|
49
49
|
hasTemplatesByCollectionType: (e) => {
|
|
50
50
|
const t = {};
|
|
51
|
-
return i[e.selectedCollectionType].forEach((s) => {
|
|
51
|
+
return (i[e.selectedCollectionType] ?? []).forEach((s) => {
|
|
52
52
|
t[s] = e.templates.some((c) => c.type === s);
|
|
53
53
|
}), t;
|
|
54
54
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const o = "The editor is not ready yet. Please wait for it to load and try again.", i = () => window.StripoEditorApi, r = () => {
|
|
2
|
+
const t = i();
|
|
3
|
+
if (!t)
|
|
4
|
+
throw new Error(o);
|
|
5
|
+
return t;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
o as EDITOR_NOT_READY_MESSAGE,
|
|
9
|
+
i as findEditorApi,
|
|
10
|
+
r as getEditorApi
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.19.0-beta.
|
|
3
|
+
"version": "3.19.0-beta.dcea8c0",
|
|
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",
|