@useinsider/guido 3.19.0-beta.c8d2be8 → 3.19.0-beta.cac604e
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/@types/config/schemas.js +104 -91
- 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/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/extensions/Blocks/Recommendation/block.js +88 -53
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +42 -22
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +26 -0
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +27 -0
- package/dist/src/stores/config.d.ts +20 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/package.json +2 -1
|
@@ -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
|
};
|
|
@@ -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
|
};
|