@useinsider/guido 3.9.0-beta.dd55e19 → 3.9.0-beta.e04645f
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/composables/useCortexBlueprintBridge.js +8 -8
- package/dist/composables/useEmailTemplateApplier.js +3 -3
- package/dist/composables/useExport.js +18 -18
- package/dist/composables/useHtmlValidator.js +90 -90
- package/dist/composables/useStripo.js +24 -24
- package/dist/composables/useStripoNotifications.js +7 -7
- package/dist/composables/useToaster.js +11 -11
- package/dist/composables/useVersionHistoryApi.js +2 -2
- package/dist/composables/validators/useLiquidValidator.js +1 -1
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +10 -10
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +118 -110
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/enums/toaster.js +1 -1
- package/dist/extensions/Blocks/Items/block.js +57 -37
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +13 -9
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +26 -14
- package/dist/extensions/Blocks/Items/template.js +245 -247
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +53 -45
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +15 -15
- package/dist/package.json.js +1 -1
- package/dist/services/templateLibraryApi.js +4 -4
- package/dist/src/enums/toaster.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +12 -0
- package/package.json +2 -2
|
@@ -19,12 +19,12 @@ const P = "email_template", x = "chat", L = "guido:debug:ai", M = () => {
|
|
|
19
19
|
const l = a._s, p = l == null ? void 0 : l.get(x);
|
|
20
20
|
if (!p)
|
|
21
21
|
return;
|
|
22
|
-
const { applyTemplate: d, applyTemplateDebounced: f } = m(), { showToaster: T } = _(),
|
|
23
|
-
const r =
|
|
22
|
+
const { applyTemplate: d, applyTemplateDebounced: f } = m(), { showToaster: T } = _(), E = I(), h = (e, t) => {
|
|
23
|
+
const r = E(e);
|
|
24
24
|
return r === e ? t : r;
|
|
25
|
-
}, i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), u = M(),
|
|
25
|
+
}, i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), u = M(), y = (e, t) => {
|
|
26
26
|
u && console.debug(`[guido:cortex] msg=${e ?? "?"} type=${(t == null ? void 0 : t.type) ?? "?"}`, t);
|
|
27
|
-
},
|
|
27
|
+
}, A = (e) => {
|
|
28
28
|
if (e.blueprintType !== P)
|
|
29
29
|
return;
|
|
30
30
|
const t = e.blueprintId, r = e.blueprintData;
|
|
@@ -33,8 +33,8 @@ const P = "email_template", x = "chat", L = "guido:debug:ai", M = () => {
|
|
|
33
33
|
const o = i.get(t);
|
|
34
34
|
o === void 0 ? (i.set(t, r.html), d(t, r)) : o !== r.html && (i.set(t, r.html), f(t, r));
|
|
35
35
|
}, s = (e) => e === void 0 || c.has(e) ? !1 : (c.add(e), T({
|
|
36
|
-
type: S.
|
|
37
|
-
message:
|
|
36
|
+
type: S.Error,
|
|
37
|
+
message: h("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
|
|
38
38
|
}), !0), b = B(
|
|
39
39
|
() => p.messages,
|
|
40
40
|
(e) => {
|
|
@@ -44,9 +44,9 @@ const P = "email_template", x = "chat", L = "guido:debug:ai", M = () => {
|
|
|
44
44
|
const o = t == null ? void 0 : t.segments;
|
|
45
45
|
Array.isArray(o) && o.forEach((n) => {
|
|
46
46
|
if (n)
|
|
47
|
-
switch (
|
|
47
|
+
switch (y(r, n), n.type) {
|
|
48
48
|
case "blueprint":
|
|
49
|
-
|
|
49
|
+
A(n);
|
|
50
50
|
break;
|
|
51
51
|
case "error":
|
|
52
52
|
s(r);
|
|
@@ -3,7 +3,7 @@ import { useToaster as T } from "./useToaster.js";
|
|
|
3
3
|
import { useTranslations as f } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as n } from "../enums/toaster.js";
|
|
5
5
|
import { ref as y } from "vue";
|
|
6
|
-
const
|
|
6
|
+
const E = 250, s = y({}), o = {}, j = () => {
|
|
7
7
|
const { updateHtmlAndCss: l } = u(), { showToaster: r } = T(), i = f(), c = (e, t, p) => {
|
|
8
8
|
s.value = { ...s.value, [e]: "applying" };
|
|
9
9
|
try {
|
|
@@ -13,7 +13,7 @@ const h = 250, s = y({}), o = {}, j = () => {
|
|
|
13
13
|
});
|
|
14
14
|
} catch (a) {
|
|
15
15
|
s.value = { ...s.value, [e]: "failed" }, r({
|
|
16
|
-
type: n.
|
|
16
|
+
type: n.Error,
|
|
17
17
|
message: a instanceof Error ? a.message : "Failed to apply template"
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -30,7 +30,7 @@ const h = 250, s = y({}), o = {}, j = () => {
|
|
|
30
30
|
const { html: p } = t, a = t.css ?? "";
|
|
31
31
|
o[e] = setTimeout(() => {
|
|
32
32
|
delete o[e], c(e, p, a);
|
|
33
|
-
},
|
|
33
|
+
}, E);
|
|
34
34
|
} };
|
|
35
35
|
}, w = () => {
|
|
36
36
|
Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
|
|
@@ -3,39 +3,39 @@ import { useActionsApi as m } from "./useActionsApi.js";
|
|
|
3
3
|
import { useHtmlCompiler as p } from "./useHtmlCompiler.js";
|
|
4
4
|
import { useToaster as d } from "./useToaster.js";
|
|
5
5
|
const H = () => {
|
|
6
|
-
const
|
|
7
|
-
const i = new Blob([s], { type:
|
|
6
|
+
const c = (s, o, n) => {
|
|
7
|
+
const i = new Blob([s], { type: n }), t = URL.createObjectURL(i), e = document.createElement("a");
|
|
8
8
|
e.href = t, e.download = o, document.body.appendChild(e), e.click(), document.body.removeChild(e), URL.revokeObjectURL(t);
|
|
9
|
-
},
|
|
10
|
-
const o = /* @__PURE__ */ new Date(),
|
|
11
|
-
return `${s}_${
|
|
9
|
+
}, l = (s) => {
|
|
10
|
+
const o = /* @__PURE__ */ new Date(), n = String(o.getDate()).padStart(2, "0"), i = String(o.getMonth() + 1).padStart(2, "0"), t = o.getFullYear(), e = String(o.getHours()).padStart(2, "0"), r = String(o.getMinutes()).padStart(2, "0");
|
|
11
|
+
return `${s}_${n}-${i}-${t}_${e}-${r}.html`;
|
|
12
12
|
};
|
|
13
13
|
return { exportHtml: async (s = !0) => {
|
|
14
|
-
const { getCompiledEmail: o } = m(), { showToaster:
|
|
14
|
+
const { getCompiledEmail: o } = m(), { showToaster: n } = d(), { compileHtml: i } = p();
|
|
15
15
|
try {
|
|
16
16
|
const { html: t } = await o();
|
|
17
17
|
if (t) {
|
|
18
18
|
let e = t;
|
|
19
19
|
if (s) {
|
|
20
|
-
const
|
|
21
|
-
e =
|
|
22
|
-
originalSize:
|
|
23
|
-
compiledSize:
|
|
24
|
-
reduction: `${
|
|
25
|
-
appliedRules:
|
|
26
|
-
executionTime: `${
|
|
20
|
+
const r = i(t);
|
|
21
|
+
e = r.compiledHtml, console.debug("HTML Compilation Stats:", {
|
|
22
|
+
originalSize: r.stats.originalSize,
|
|
23
|
+
compiledSize: r.stats.compiledSize,
|
|
24
|
+
reduction: `${r.stats.reductionPercentage.toFixed(2)}%`,
|
|
25
|
+
appliedRules: r.appliedRules,
|
|
26
|
+
executionTime: `${r.stats.executionTime.toFixed(2)}ms`
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
c(e, l("HTML"), "text/html");
|
|
30
30
|
} else
|
|
31
|
-
|
|
32
|
-
type: a.
|
|
31
|
+
n({
|
|
32
|
+
type: a.Error,
|
|
33
33
|
message: "No HTML content to download"
|
|
34
34
|
});
|
|
35
35
|
} catch (t) {
|
|
36
36
|
const e = t instanceof Error ? t.message : String(t);
|
|
37
|
-
|
|
38
|
-
type: a.
|
|
37
|
+
n({
|
|
38
|
+
type: a.Error,
|
|
39
39
|
message: `Error compiling email: ${e}`
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -11,11 +11,11 @@ import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Reco
|
|
|
11
11
|
import { useRecommendationStore as te } from "../stores/recommendation.js";
|
|
12
12
|
import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
|
|
13
13
|
import { useHttp as se } from "./useHttp.js";
|
|
14
|
-
import { useToaster as
|
|
15
|
-
import { useTranslations as
|
|
16
|
-
const
|
|
14
|
+
import { useToaster as re } from "./useToaster.js";
|
|
15
|
+
import { useTranslations as oe } from "./useTranslations.js";
|
|
16
|
+
const ie = /recommendation-id="(\d+)"/g;
|
|
17
17
|
function ae(t) {
|
|
18
|
-
return [...t.matchAll(
|
|
18
|
+
return [...t.matchAll(ie)].map((m) => m[1]);
|
|
19
19
|
}
|
|
20
20
|
function ce(t, m) {
|
|
21
21
|
return m.some((f) => t.startsWith(`${f}_`));
|
|
@@ -31,34 +31,34 @@ function ue(t) {
|
|
|
31
31
|
m.add(Q(f.attributeName, t).toLowerCase());
|
|
32
32
|
}), m;
|
|
33
33
|
}
|
|
34
|
-
function de(t, m, f,
|
|
34
|
+
function de(t, m, f, o, d) {
|
|
35
35
|
const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
36
36
|
if (!u)
|
|
37
37
|
return [];
|
|
38
|
-
const p = new Set(m.map((
|
|
39
|
-
return u.forEach((
|
|
40
|
-
const g =
|
|
38
|
+
const p = new Set(m.map((h) => h.toLowerCase())), E = [];
|
|
39
|
+
return u.forEach((h) => {
|
|
40
|
+
const g = h.slice(2, -2).trim().toLowerCase();
|
|
41
41
|
if (g !== "" && p.has(g))
|
|
42
42
|
return;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
if (!d || d.has(
|
|
43
|
+
const y = me(g);
|
|
44
|
+
if (y && o.has(y.recoId)) {
|
|
45
|
+
if (!d || d.has(y.attribute))
|
|
46
46
|
return;
|
|
47
|
-
|
|
47
|
+
E.push(g);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
ce(g, f) || g.includes(".") ||
|
|
51
|
-
}),
|
|
50
|
+
ce(g, f) || g.includes(".") || E.push(g);
|
|
51
|
+
}), E;
|
|
52
52
|
}
|
|
53
53
|
function fe(t) {
|
|
54
|
-
return (t.replace(U, "$1").match(j) ?? []).filter((
|
|
55
|
-
const d =
|
|
54
|
+
return (t.replace(U, "$1").match(j) ?? []).filter((o) => {
|
|
55
|
+
const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
|
|
56
56
|
return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
const xe = () => {
|
|
60
|
-
var
|
|
61
|
-
const { showToaster: t } =
|
|
60
|
+
var b, S;
|
|
61
|
+
const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
|
|
62
62
|
if (e.size === 0)
|
|
63
63
|
return /* @__PURE__ */ new Set();
|
|
64
64
|
try {
|
|
@@ -67,53 +67,53 @@ const xe = () => {
|
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
return ue(u.filterList);
|
|
70
|
-
},
|
|
70
|
+
}, h = async (e) => {
|
|
71
71
|
const n = await m(
|
|
72
72
|
"/newsletter/template-library/check-template-html-body",
|
|
73
73
|
{ html: ne(e) }
|
|
74
|
-
), { status:
|
|
75
|
-
return
|
|
76
|
-
type: c.
|
|
77
|
-
message:
|
|
78
|
-
}),
|
|
79
|
-
type: c.
|
|
80
|
-
message:
|
|
81
|
-
}),
|
|
82
|
-
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()),
|
|
74
|
+
), { status: r, message: a } = n.data;
|
|
75
|
+
return r || t({
|
|
76
|
+
type: c.Error,
|
|
77
|
+
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
78
|
+
}), o($), a === o(Y) && t({
|
|
79
|
+
type: c.Error,
|
|
80
|
+
message: o("newsletter.already-in-progress")
|
|
81
|
+
}), r;
|
|
82
|
+
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
|
|
83
83
|
const n = e.match(/({%(.*?)%})/g);
|
|
84
|
-
let
|
|
84
|
+
let r = !0;
|
|
85
85
|
return n !== null && !p && n.forEach((a) => {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const [l] =
|
|
86
|
+
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
87
|
+
if (i && i.length > 0) {
|
|
88
|
+
const [l] = i;
|
|
89
89
|
g(l) && !s.includes(l) && (t({
|
|
90
90
|
type: c.Warning,
|
|
91
|
-
message:
|
|
92
|
-
}),
|
|
91
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
92
|
+
}), r = !1);
|
|
93
93
|
}
|
|
94
|
-
}),
|
|
94
|
+
}), r;
|
|
95
95
|
}, w = async (e, s, n) => {
|
|
96
|
-
const
|
|
97
|
-
return T(e, s) &&
|
|
96
|
+
const r = n ? await h(e) : !0;
|
|
97
|
+
return T(e, s) && r;
|
|
98
98
|
}, R = (e) => e.length > 0 ? !0 : (t({
|
|
99
99
|
type: c.Warning,
|
|
100
|
-
message:
|
|
100
|
+
message: o("newsletter.html-content-is-empty")
|
|
101
101
|
}), !1), _ = (e) => {
|
|
102
102
|
const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
103
103
|
return s > n && t({
|
|
104
104
|
type: c.Warning,
|
|
105
|
-
message:
|
|
105
|
+
message: o("custom-fields.missing-closing-braces")
|
|
106
106
|
}), s < n && t({
|
|
107
107
|
type: c.Warning,
|
|
108
|
-
message:
|
|
108
|
+
message: o("custom-fields.missing-opening-braces")
|
|
109
109
|
}), s === n;
|
|
110
110
|
}, N = (e) => {
|
|
111
111
|
const s = fe(e).length === 0;
|
|
112
112
|
return s || t({
|
|
113
113
|
type: c.Warning,
|
|
114
|
-
message:
|
|
114
|
+
message: o("custom-fields.invalid-custom-fields")
|
|
115
115
|
}), s;
|
|
116
|
-
}, x = (e, s, n,
|
|
116
|
+
}, x = (e, s, n, r) => {
|
|
117
117
|
if (p)
|
|
118
118
|
return !0;
|
|
119
119
|
const a = de(
|
|
@@ -121,94 +121,94 @@ const xe = () => {
|
|
|
121
121
|
s,
|
|
122
122
|
ae(e),
|
|
123
123
|
n,
|
|
124
|
-
|
|
124
|
+
r
|
|
125
125
|
);
|
|
126
126
|
if (a.length > 0) {
|
|
127
|
-
const
|
|
127
|
+
const i = `
|
|
128
128
|
<ul>
|
|
129
129
|
${a.map((l) => `<li>${l}</li>`).join("")}
|
|
130
130
|
</ul>
|
|
131
131
|
`;
|
|
132
132
|
return t({
|
|
133
|
-
type: c.
|
|
134
|
-
message:
|
|
133
|
+
type: c.Error,
|
|
134
|
+
message: o("custom-fields.invalid-custom-fields") + i
|
|
135
135
|
}), !1;
|
|
136
136
|
}
|
|
137
137
|
return !0;
|
|
138
138
|
}, O = (e) => {
|
|
139
139
|
const s = e.match(/{%(.*?)%}/g), n = [];
|
|
140
|
-
let
|
|
140
|
+
let r = !0;
|
|
141
141
|
if (s && s.forEach((a) => {
|
|
142
|
-
const
|
|
143
|
-
(!
|
|
144
|
-
type: c.
|
|
145
|
-
message:
|
|
146
|
-
}),
|
|
142
|
+
const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
|
|
143
|
+
(!i || a !== v) && !l && (t({
|
|
144
|
+
type: c.Error,
|
|
145
|
+
message: o("newsletter.display-conditions-invalid-syntax")
|
|
146
|
+
}), r = !1), i && i.forEach((C) => {
|
|
147
147
|
C.trim() === "=" && (t({
|
|
148
|
-
type: c.
|
|
149
|
-
message:
|
|
150
|
-
}),
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
type: c.Error,
|
|
149
|
+
message: o("custom-conditions.wrong-equality-operators")
|
|
150
|
+
}), r = !1);
|
|
151
|
+
const I = C.match(/^[a-zA-Z]*$/g);
|
|
152
|
+
I && I.forEach((A) => {
|
|
153
|
+
y(A) && n.push(A);
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
156
|
}), n.length) {
|
|
157
|
-
const a = n.filter((l) => l === "if"),
|
|
158
|
-
a.length !==
|
|
159
|
-
type: c.
|
|
160
|
-
message:
|
|
161
|
-
}),
|
|
157
|
+
const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
|
|
158
|
+
a.length !== i.length && (t({
|
|
159
|
+
type: c.Error,
|
|
160
|
+
message: o("custom-conditions.missing-if-endif-tag")
|
|
161
|
+
}), r = !1);
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return r;
|
|
164
164
|
}, k = (e) => {
|
|
165
|
-
const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length,
|
|
166
|
-
return
|
|
165
|
+
const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
|
|
166
|
+
return r || t({
|
|
167
167
|
type: c.Warning,
|
|
168
|
-
message:
|
|
169
|
-
}),
|
|
170
|
-
}, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n,
|
|
168
|
+
message: o("custom-conditions.no-space-after-braces")
|
|
169
|
+
}), r;
|
|
170
|
+
}, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
|
|
171
171
|
type: c.Warning,
|
|
172
|
-
message:
|
|
172
|
+
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
173
173
|
}), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
|
|
174
|
-
type: c.
|
|
175
|
-
message:
|
|
174
|
+
type: c.Error,
|
|
175
|
+
message: o(ee)
|
|
176
176
|
}), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
|
|
177
|
-
type: c.
|
|
178
|
-
message:
|
|
177
|
+
type: c.Error,
|
|
178
|
+
message: o("newsletter.fill-all-necessary-fields")
|
|
179
179
|
}), !1) : !0, L = (e) => {
|
|
180
180
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
181
181
|
return e.match(s) === null ? !0 : (t({
|
|
182
|
-
type: c.
|
|
183
|
-
message:
|
|
182
|
+
type: c.Error,
|
|
183
|
+
message: o("newsletter.invalid-image-type")
|
|
184
184
|
}), !1);
|
|
185
185
|
}, V = (e) => {
|
|
186
|
-
const
|
|
187
|
-
return Array.from(
|
|
186
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
187
|
+
return Array.from(r).find((i) => {
|
|
188
188
|
var l;
|
|
189
|
-
return !((l =
|
|
189
|
+
return !((l = i.id) != null && l.trim());
|
|
190
190
|
}) ? (t({
|
|
191
|
-
type: c.
|
|
192
|
-
message:
|
|
191
|
+
type: c.Error,
|
|
192
|
+
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
193
193
|
}), !1) : !0;
|
|
194
194
|
}, M = (e) => {
|
|
195
|
-
const
|
|
196
|
-
return Array.from(
|
|
195
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
196
|
+
return Array.from(r).find((i) => {
|
|
197
197
|
var l;
|
|
198
|
-
return !((l =
|
|
198
|
+
return !((l = i.id) != null && l.trim());
|
|
199
199
|
}) ? (t({
|
|
200
|
-
type: c.
|
|
201
|
-
message:
|
|
200
|
+
type: c.Error,
|
|
201
|
+
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
202
202
|
}), !1) : !0;
|
|
203
203
|
};
|
|
204
204
|
return { validateHtml: async (e, s, n = !1) => {
|
|
205
205
|
var v, C;
|
|
206
|
-
const
|
|
207
|
-
...s.map((
|
|
206
|
+
const r = [
|
|
207
|
+
...s.map((I) => I.value),
|
|
208
208
|
...z,
|
|
209
209
|
...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
|
|
210
|
-
], a = G(e),
|
|
211
|
-
return await w(e,
|
|
210
|
+
], a = G(e), i = await E(a);
|
|
211
|
+
return await w(e, r, n) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
|
|
212
212
|
} };
|
|
213
213
|
};
|
|
214
214
|
export {
|
|
@@ -11,17 +11,17 @@ import { en as h } from "../config/i18n/en/index.js";
|
|
|
11
11
|
import { ToasterTypeOptions as $ } from "../enums/toaster.js";
|
|
12
12
|
import { useStripoApi as G } from "../services/stripoApi.js";
|
|
13
13
|
import J from "../static/styles/customEditorStyle.css.js";
|
|
14
|
-
import { useEditorStore as
|
|
14
|
+
import { useEditorStore as E } from "../stores/editor.js";
|
|
15
15
|
import { dynamicContentToMergeTags as X } from "../utils/genericUtil.js";
|
|
16
16
|
import j from "../package.json.js";
|
|
17
|
-
const
|
|
17
|
+
const fo = (C, l) => {
|
|
18
18
|
const { features: c, template: w, isFeatureEnabled: u } = x(), { handleError: m, showToaster: b } = z(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = G(), { handleEvent: F } = H(), { getStripoBlocksConfig: v } = R(), { getStripoNotifications: V } = N(), _ = async (s, i = [], r = !1) => {
|
|
19
19
|
var g, S, y;
|
|
20
|
-
const
|
|
20
|
+
const o = E(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, M = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, P = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
21
21
|
await window.UIEditor.initEditor(
|
|
22
22
|
document.querySelector("#guido-editor"),
|
|
23
23
|
{
|
|
24
|
-
metadata:
|
|
24
|
+
metadata: C,
|
|
25
25
|
html: p,
|
|
26
26
|
css: a,
|
|
27
27
|
forceRecreate: P,
|
|
@@ -62,35 +62,35 @@ const pe = (E, l) => {
|
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
|
-
async onTokenRefreshRequest(
|
|
65
|
+
async onTokenRefreshRequest(e) {
|
|
66
66
|
try {
|
|
67
67
|
const n = await T();
|
|
68
|
-
|
|
68
|
+
e(n);
|
|
69
69
|
} catch (n) {
|
|
70
70
|
m(n, "Failed to refresh token");
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
onTemplateLoaded() {
|
|
74
74
|
try {
|
|
75
|
-
const { importCss:
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const { importCss: e } = O(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = U(), { injectFullStory: I } = q();
|
|
76
|
+
e(), n(), I(), D(), l.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
77
|
+
o.hasChanges = !1;
|
|
78
78
|
}, 1e3);
|
|
79
|
-
} catch (
|
|
80
|
-
m(
|
|
79
|
+
} catch (e) {
|
|
80
|
+
m(e, "Failed to load custom interface appearance");
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
onCodeEditorVisibilityChanged(
|
|
84
|
-
|
|
83
|
+
onCodeEditorVisibilityChanged(e) {
|
|
84
|
+
o.isCodeEditorOpen = e;
|
|
85
85
|
},
|
|
86
|
-
onEditorVisualModeChanged(
|
|
87
|
-
|
|
86
|
+
onEditorVisualModeChanged(e) {
|
|
87
|
+
o.editorVisualMode = e.toLowerCase();
|
|
88
88
|
},
|
|
89
|
-
onVersionHistoryVisibilityChanged(
|
|
90
|
-
|
|
89
|
+
onVersionHistoryVisibilityChanged(e) {
|
|
90
|
+
o.isVersionHistoryOpen = e;
|
|
91
91
|
},
|
|
92
92
|
onDataChanged() {
|
|
93
|
-
|
|
93
|
+
o.hasChanges = !0;
|
|
94
94
|
},
|
|
95
95
|
onEvent: F,
|
|
96
96
|
notifications: V(),
|
|
@@ -109,7 +109,7 @@ const pe = (E, l) => {
|
|
|
109
109
|
Promise.resolve(s()).then(i, r);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const o = j.guido, a = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
113
113
|
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
114
114
|
Promise.resolve(s()).then(i, r);
|
|
115
115
|
}, t.onerror = () => {
|
|
@@ -117,18 +117,18 @@ const pe = (E, l) => {
|
|
|
117
117
|
}, document.body.appendChild(t);
|
|
118
118
|
});
|
|
119
119
|
return { initPlugin: async (s) => {
|
|
120
|
-
const i =
|
|
120
|
+
const i = E();
|
|
121
121
|
try {
|
|
122
122
|
await A(async () => {
|
|
123
|
-
const [r,
|
|
123
|
+
const [r, o] = await Promise.all([
|
|
124
124
|
k(),
|
|
125
125
|
B()
|
|
126
126
|
]);
|
|
127
|
-
i.syncModulesEnabled =
|
|
127
|
+
i.syncModulesEnabled = o, await _(s, r, o);
|
|
128
128
|
});
|
|
129
129
|
} catch {
|
|
130
130
|
i.loadingStatus = !1, b({
|
|
131
|
-
type: $.
|
|
131
|
+
type: $.Error,
|
|
132
132
|
message: h["An error has occurred. Please report the error code to support."],
|
|
133
133
|
actionButton: {
|
|
134
134
|
text: h["Reload page"],
|
|
@@ -139,5 +139,5 @@ const pe = (E, l) => {
|
|
|
139
139
|
} };
|
|
140
140
|
};
|
|
141
141
|
export {
|
|
142
|
-
|
|
142
|
+
fo as useStripo
|
|
143
143
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { useToaster as d } from "./useToaster.js";
|
|
2
2
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
3
3
|
const g = () => {
|
|
4
|
-
const { showToaster:
|
|
5
|
-
let
|
|
4
|
+
const { showToaster: s, hideToaster: u } = d();
|
|
5
|
+
let r = null;
|
|
6
6
|
const n = (o, t, i, e, f = !0) => {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
r = i;
|
|
8
|
+
const l = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
|
|
9
|
+
s({ type: o, message: t, actionButton: l, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
|
|
10
10
|
};
|
|
11
11
|
return { getStripoNotifications: () => ({
|
|
12
12
|
info: (o, t, i) => n(c.Info, o, t, i),
|
|
13
13
|
success: (o, t, i) => n(c.Success, o, t, i),
|
|
14
14
|
warn: (o, t, i) => n(c.Warning, o, t, i),
|
|
15
|
-
error: (o, t, i) => n(c.
|
|
15
|
+
error: (o, t, i) => n(c.Error, o, t, i),
|
|
16
16
|
// A loader marks an in-progress operation; Stripo dismisses it via hide(id)
|
|
17
17
|
// when finished, so it must not auto-hide.
|
|
18
18
|
loader: (o, t, i) => n(c.Info, o, t, i, !1),
|
|
19
19
|
hide: (o) => {
|
|
20
|
-
|
|
20
|
+
r === o && (u(), r = null);
|
|
21
21
|
}
|
|
22
22
|
}) };
|
|
23
23
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
2
|
import { useToasterStore as c } from "../stores/toaster.js";
|
|
3
|
-
import { watch as u, nextTick as
|
|
3
|
+
import { watch as u, nextTick as f } from "vue";
|
|
4
4
|
const p = () => {
|
|
5
|
-
const
|
|
6
|
-
let
|
|
5
|
+
const o = c();
|
|
6
|
+
let t = null;
|
|
7
7
|
const s = () => {
|
|
8
|
-
|
|
8
|
+
t && (clearTimeout(t), t = null);
|
|
9
9
|
};
|
|
10
10
|
function r(e = { message: "" }) {
|
|
11
|
-
s(),
|
|
12
|
-
|
|
11
|
+
s(), o.hideToaster(), f(() => {
|
|
12
|
+
o.showToaster(e);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
function i() {
|
|
16
|
-
s(),
|
|
16
|
+
s(), o.hideToaster();
|
|
17
17
|
}
|
|
18
18
|
function n(e, a) {
|
|
19
19
|
const m = e instanceof Error ? e.message : String(e);
|
|
20
|
-
r({ type: T.
|
|
20
|
+
r({ type: T.Error, message: `${a}: ${m}` });
|
|
21
21
|
}
|
|
22
22
|
return u(
|
|
23
|
-
() =>
|
|
23
|
+
() => o.shouldAutoHide,
|
|
24
24
|
(e) => {
|
|
25
|
-
s(), e && (
|
|
26
|
-
|
|
25
|
+
s(), e && (t = setTimeout(() => {
|
|
26
|
+
o.hideToaster(), s();
|
|
27
27
|
}, 6e3));
|
|
28
28
|
}
|
|
29
29
|
), { showToaster: r, hideToaster: i, handleError: n };
|
|
@@ -24,7 +24,7 @@ const S = () => {
|
|
|
24
24
|
window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
|
|
25
25
|
const r = o instanceof Error ? o.message : String(o);
|
|
26
26
|
s({
|
|
27
|
-
type: t.
|
|
27
|
+
type: t.Error,
|
|
28
28
|
message: `Error compiling email: ${r}`
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -41,7 +41,7 @@ const S = () => {
|
|
|
41
41
|
(o) => {
|
|
42
42
|
const r = o instanceof Error ? o.message : String(o);
|
|
43
43
|
s({
|
|
44
|
-
type: t.
|
|
44
|
+
type: t.Error,
|
|
45
45
|
message: `Error compiling email: ${r}`
|
|
46
46
|
});
|
|
47
47
|
}
|