@useinsider/guido 3.14.0-beta.8d5df20 → 3.14.0-beta.a865e56
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 +92 -108
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +85 -91
- package/dist/composables/useActionsApi.js +22 -30
- package/dist/composables/useEmailTemplateApplier.js +6 -8
- package/dist/composables/useHtmlValidator.js +91 -89
- package/dist/composables/useTimerClone.js +19 -21
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/index.js +10 -11
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +10 -9
- package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/RadioButton/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/RadioButton/extension.js +5 -4
- package/dist/extensions/Blocks/RadioButton/settingsPanel.js +12 -11
- package/dist/extensions/Blocks/RadioButton/template.js +16 -9
- package/dist/extensions/Blocks/controlFactories.js +117 -115
- package/dist/guido.css +1 -1
- package/dist/library.js +5 -8
- package/dist/node_modules/valibot/dist/index.js +216 -230
- package/dist/src/@types/config/schemas.d.ts +0 -20
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/index.d.ts +1 -6
- package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/library.d.ts +0 -1
- package/dist/src/stores/config.d.ts +0 -36
- package/dist/src/stores/editor.d.ts +0 -25
- package/dist/stores/editor.js +1 -4
- package/dist/utils/templatePreparation.js +61 -72
- package/package.json +1 -1
- package/dist/config/migrator/trackIdMigrator.js +0 -11
- package/dist/src/config/migrator/trackIdMigrator.d.ts +0 -6
- package/dist/src/utils/linkTrackingIds.d.ts +0 -25
- package/dist/utils/linkTrackingIds.js +0 -46
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
1
|
+
import { filterAmpErrors as w } from "../utils/ampErrorFilter.js";
|
|
2
2
|
import { useToaster as A } from "./useToaster.js";
|
|
3
|
-
const
|
|
4
|
-
const { handleError:
|
|
3
|
+
const D = () => {
|
|
4
|
+
const { handleError: n } = A(), s = (t = {}) => new Promise((e, a) => {
|
|
5
5
|
const o = { ...{
|
|
6
6
|
minimize: !0,
|
|
7
7
|
utmEntity: {
|
|
@@ -21,29 +21,29 @@ const p = 1e4, D = () => {
|
|
|
21
21
|
forceAmp: !1,
|
|
22
22
|
resetDataSavedFlag: !1,
|
|
23
23
|
disableLineHeightsReplace: !0
|
|
24
|
-
}, ...t },
|
|
25
|
-
callback: (
|
|
26
|
-
|
|
27
|
-
html:
|
|
28
|
-
ampHtml:
|
|
29
|
-
ampErrors:
|
|
30
|
-
displayConditions:
|
|
24
|
+
}, ...t }, l = {
|
|
25
|
+
callback: (r, p, d, c, u) => {
|
|
26
|
+
r ? a(r) : e({
|
|
27
|
+
html: p,
|
|
28
|
+
ampHtml: d,
|
|
29
|
+
ampErrors: w(c ?? []),
|
|
30
|
+
displayConditions: u
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
33
|
...o
|
|
34
34
|
};
|
|
35
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
35
|
+
window.StripoEditorApi.actionsApi.compileEmail(l);
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
|
-
getCompiledEmail:
|
|
38
|
+
getCompiledEmail: s,
|
|
39
39
|
getTemplateData: () => new Promise((t) => {
|
|
40
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
40
|
+
const e = ({ html: a, css: i, width: o, height: m, utmParams: l, syncModulesIds: r }) => t({
|
|
41
41
|
html: a,
|
|
42
42
|
css: i,
|
|
43
43
|
width: o,
|
|
44
|
-
height:
|
|
45
|
-
utmParams:
|
|
46
|
-
syncModulesIds:
|
|
44
|
+
height: m,
|
|
45
|
+
utmParams: l,
|
|
46
|
+
syncModulesIds: r
|
|
47
47
|
});
|
|
48
48
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
49
49
|
}),
|
|
@@ -57,7 +57,7 @@ const p = 1e4, D = () => {
|
|
|
57
57
|
displayConditions: a,
|
|
58
58
|
ampHtml: i = "",
|
|
59
59
|
ampErrors: o = []
|
|
60
|
-
} = await
|
|
60
|
+
} = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
61
61
|
return {
|
|
62
62
|
html: e,
|
|
63
63
|
ampHtml: i,
|
|
@@ -65,7 +65,7 @@ const p = 1e4, D = () => {
|
|
|
65
65
|
displayConditions: a
|
|
66
66
|
};
|
|
67
67
|
} catch (e) {
|
|
68
|
-
return
|
|
68
|
+
return n(e, "Error loading preview"), {
|
|
69
69
|
html: "",
|
|
70
70
|
ampHtml: "",
|
|
71
71
|
ampErrors: [],
|
|
@@ -81,27 +81,19 @@ const p = 1e4, D = () => {
|
|
|
81
81
|
}
|
|
82
82
|
try {
|
|
83
83
|
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
|
|
84
|
-
i ? (
|
|
84
|
+
i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
85
85
|
});
|
|
86
86
|
} catch (i) {
|
|
87
|
-
|
|
87
|
+
n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
88
88
|
}
|
|
89
89
|
}),
|
|
90
90
|
updateHtmlAndCss: (t, e) => {
|
|
91
|
-
|
|
92
|
-
return new Promise((i, o) => {
|
|
93
|
-
const s = new Error(
|
|
94
|
-
`updateHtmlAndCss did not report completion within ${p}ms`
|
|
95
|
-
), n = setTimeout(() => o(s), p);
|
|
96
|
-
a.updateHtmlAndCss(t, e, () => {
|
|
97
|
-
clearTimeout(n), i();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
91
|
+
window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
|
|
100
92
|
},
|
|
101
93
|
editorSave: () => new Promise((t) => {
|
|
102
94
|
window.StripoEditorApi.actionsApi.save((e) => {
|
|
103
95
|
if (e) {
|
|
104
|
-
|
|
96
|
+
n(e, "Failed to save template"), t(!1);
|
|
105
97
|
return;
|
|
106
98
|
}
|
|
107
99
|
t(!0);
|
|
@@ -3,15 +3,13 @@ import { useToaster as f } from "./useToaster.js";
|
|
|
3
3
|
import { useTranslations as y } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as n } from "../enums/toaster.js";
|
|
5
5
|
import { ref as v } from "vue";
|
|
6
|
-
const
|
|
6
|
+
const E = 250, s = v({}), o = {}, j = () => {
|
|
7
7
|
const { updateHtmlAndCss: l } = T(), { showToaster: p } = f(), i = y(), u = (e) => {
|
|
8
8
|
s.value[e] === void 0 && (s.value = { ...s.value, [e]: "pending" });
|
|
9
9
|
}, c = (e, t, r) => {
|
|
10
10
|
s.value = { ...s.value, [e]: "applying" };
|
|
11
11
|
try {
|
|
12
|
-
l(t, r).
|
|
13
|
-
console.warn("Editor did not acknowledge the template apply.", a);
|
|
14
|
-
}), s.value = { ...s.value, [e]: "applied" }, p({
|
|
12
|
+
l(t, r), s.value = { ...s.value, [e]: "applied" }, p({
|
|
15
13
|
type: n.Success,
|
|
16
14
|
message: i("newsletter.ai-template-applied")
|
|
17
15
|
});
|
|
@@ -34,12 +32,12 @@ const h = 250, s = v({}), o = {}, k = () => {
|
|
|
34
32
|
const { html: r } = t, a = t.css ?? "";
|
|
35
33
|
o[e] = setTimeout(() => {
|
|
36
34
|
delete o[e], c(e, r, a);
|
|
37
|
-
},
|
|
35
|
+
}, E);
|
|
38
36
|
} };
|
|
39
|
-
},
|
|
37
|
+
}, k = () => {
|
|
40
38
|
Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
|
|
41
39
|
};
|
|
42
40
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
k as resetEmailTemplateApplier,
|
|
42
|
+
j as useEmailTemplateApplier
|
|
45
43
|
};
|
|
@@ -1,64 +1,66 @@
|
|
|
1
1
|
import { useConfig as W } from "./useConfig.js";
|
|
2
2
|
import { getIgnoredRecommendationBlockIds as G } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
3
|
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
4
|
-
import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as
|
|
4
|
+
import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as K, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as U, ALLOWED_DYNAMIC_SYSTEM_TOKENS as j, VALID_DYNAMIC_VARIABLE_REGEX as q } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
7
|
+
import { itemsBlockDynamicVariables as Z } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
8
|
+
import { BLOCK_ROOT_SELECTOR as J } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
9
|
+
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Q } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
10
|
+
import { useRecommendationExtensionStore as ee } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { resolveProductAttrValue as te } from "../extensions/Blocks/Recommendation/templates/utils.js";
|
|
12
|
+
import { RecommendationRequiredFieldsKey as ne } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
13
|
+
import { useRecommendationStore as se } from "../stores/recommendation.js";
|
|
14
|
+
import { base64EncodeWithSpecialChars as re } from "../utils/base64.js";
|
|
15
|
+
import { useHttp as oe } from "./useHttp.js";
|
|
16
|
+
import { useToaster as ie } from "./useToaster.js";
|
|
17
|
+
import { useTranslations as ae } from "./useTranslations.js";
|
|
18
|
+
const ce = /recommendation-id="(\d+)"/g;
|
|
19
|
+
function me(t) {
|
|
20
|
+
return [...t.matchAll(ce)].map((l) => l[1]);
|
|
19
21
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
22
|
+
function le(t, l) {
|
|
23
|
+
return l.some((f) => t.startsWith(`${f}_`));
|
|
22
24
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const ue = /^(\d+)_\d+_(.+)$/;
|
|
26
|
+
function de(t) {
|
|
27
|
+
const l = t.match(ue);
|
|
28
|
+
return l ? { recoId: l[1], attribute: l[2] } : null;
|
|
27
29
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
+
function fe(t) {
|
|
31
|
+
const l = new Set(Q);
|
|
30
32
|
return Object.values(t).forEach((f) => {
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
+
l.add(te(f.attributeName, t).toLowerCase());
|
|
34
|
+
}), l;
|
|
33
35
|
}
|
|
34
|
-
function
|
|
36
|
+
function pe(t, l, f, o, d) {
|
|
35
37
|
const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
36
38
|
if (!u)
|
|
37
39
|
return [];
|
|
38
|
-
const
|
|
39
|
-
return u.forEach((
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
40
|
+
const g = new Set(l.map((C) => C.toLowerCase())), E = [];
|
|
41
|
+
return u.forEach((C) => {
|
|
42
|
+
const p = C.slice(2, -2).trim().toLowerCase();
|
|
43
|
+
if (p !== "" && g.has(p))
|
|
42
44
|
return;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
if (!d || d.has(
|
|
45
|
+
const h = de(p);
|
|
46
|
+
if (h && o.has(h.recoId)) {
|
|
47
|
+
if (!d || d.has(h.attribute))
|
|
46
48
|
return;
|
|
47
|
-
E.push(
|
|
49
|
+
E.push(p);
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
le(p, f) || p.includes(".") || E.push(p);
|
|
51
53
|
}), E;
|
|
52
54
|
}
|
|
53
|
-
function
|
|
54
|
-
return (t.replace(
|
|
55
|
-
const d = o.slice(2, -2), u = d.indexOf("|"),
|
|
56
|
-
return
|
|
55
|
+
function ge(t) {
|
|
56
|
+
return (t.replace(Y, "$1").match(U) ?? []).filter((o) => {
|
|
57
|
+
const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
|
|
58
|
+
return j.includes(g) ? !1 : q.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
|
-
const
|
|
60
|
-
var
|
|
61
|
-
const { showToaster: t } =
|
|
61
|
+
const De = () => {
|
|
62
|
+
var S, T;
|
|
63
|
+
const { showToaster: t } = ie(), { post: l } = oe(), { config: f } = W(), o = ae(), d = se(), u = ee(), g = ((T = (S = f.value) == null ? void 0 : S.partner) == null ? void 0 : T.messageType) === H.transactional, E = async (e) => {
|
|
62
64
|
if (e.size === 0)
|
|
63
65
|
return /* @__PURE__ */ new Set();
|
|
64
66
|
try {
|
|
@@ -66,39 +68,39 @@ const xe = () => {
|
|
|
66
68
|
} catch {
|
|
67
69
|
return null;
|
|
68
70
|
}
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
const n = await
|
|
71
|
+
return fe(u.filterList);
|
|
72
|
+
}, C = async (e) => {
|
|
73
|
+
const n = await l(
|
|
72
74
|
"/newsletter/template-library/check-template-html-body",
|
|
73
|
-
{ html:
|
|
75
|
+
{ html: re(e) }
|
|
74
76
|
), { status: r, message: a } = n.data;
|
|
75
77
|
return r || t({
|
|
76
78
|
type: c.Error,
|
|
77
79
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
78
|
-
}), o($), a === o(
|
|
80
|
+
}), o($), a === o(K) && t({
|
|
79
81
|
type: c.Error,
|
|
80
82
|
message: o("newsletter.already-in-progress")
|
|
81
83
|
}), r;
|
|
82
|
-
},
|
|
84
|
+
}, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), h = (e) => ["if", "endif"].includes(e.toLowerCase()), R = (e, s) => {
|
|
83
85
|
const n = e.match(/({%(.*?)%})/g);
|
|
84
86
|
let r = !0;
|
|
85
|
-
return n !== null && !
|
|
87
|
+
return n !== null && !g && n.forEach((a) => {
|
|
86
88
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
87
89
|
if (i && i.length > 0) {
|
|
88
|
-
const [
|
|
89
|
-
|
|
90
|
+
const [m] = i;
|
|
91
|
+
p(m) && !s.includes(m) && (t({
|
|
90
92
|
type: c.Warning,
|
|
91
93
|
message: o("custom-fields.invalid-custom-fields")
|
|
92
94
|
}), r = !1);
|
|
93
95
|
}
|
|
94
96
|
}), r;
|
|
95
|
-
},
|
|
96
|
-
const r = n ? await
|
|
97
|
-
return
|
|
98
|
-
},
|
|
97
|
+
}, A = async (e, s, n) => {
|
|
98
|
+
const r = n ? await C(e) : !0;
|
|
99
|
+
return R(e, s) && r;
|
|
100
|
+
}, _ = (e) => e.length > 0 ? !0 : (t({
|
|
99
101
|
type: c.Warning,
|
|
100
102
|
message: o("newsletter.html-content-is-empty")
|
|
101
|
-
}), !1),
|
|
103
|
+
}), !1), O = (e) => {
|
|
102
104
|
const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
103
105
|
return s > n && t({
|
|
104
106
|
type: c.Warning,
|
|
@@ -107,26 +109,26 @@ const xe = () => {
|
|
|
107
109
|
type: c.Warning,
|
|
108
110
|
message: o("custom-fields.missing-opening-braces")
|
|
109
111
|
}), s === n;
|
|
110
|
-
},
|
|
111
|
-
const s =
|
|
112
|
+
}, w = (e) => {
|
|
113
|
+
const s = ge(e).length === 0;
|
|
112
114
|
return s || t({
|
|
113
115
|
type: c.Warning,
|
|
114
116
|
message: o("custom-fields.invalid-custom-fields")
|
|
115
117
|
}), s;
|
|
116
|
-
},
|
|
117
|
-
if (
|
|
118
|
+
}, N = (e, s, n, r) => {
|
|
119
|
+
if (g)
|
|
118
120
|
return !0;
|
|
119
|
-
const a =
|
|
121
|
+
const a = pe(
|
|
120
122
|
e,
|
|
121
123
|
s,
|
|
122
|
-
|
|
124
|
+
me(e),
|
|
123
125
|
n,
|
|
124
126
|
r
|
|
125
127
|
);
|
|
126
128
|
if (a.length > 0) {
|
|
127
129
|
const i = `
|
|
128
130
|
<ul>
|
|
129
|
-
${a.map((
|
|
131
|
+
${a.map((m) => `<li>${m}</li>`).join("")}
|
|
130
132
|
</ul>
|
|
131
133
|
`;
|
|
132
134
|
return t({
|
|
@@ -135,85 +137,85 @@ const xe = () => {
|
|
|
135
137
|
}), !1;
|
|
136
138
|
}
|
|
137
139
|
return !0;
|
|
138
|
-
},
|
|
140
|
+
}, L = (e) => {
|
|
139
141
|
const s = e.match(/{%(.*?)%}/g), n = [];
|
|
140
142
|
let r = !0;
|
|
141
143
|
if (s && s.forEach((a) => {
|
|
142
|
-
const i = a.match(P),
|
|
143
|
-
(!i || a !== v) && !
|
|
144
|
+
const i = a.match(P), m = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
|
|
145
|
+
(!i || a !== v) && !m && (t({
|
|
144
146
|
type: c.Error,
|
|
145
147
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
146
|
-
}), r = !1), i && i.forEach((
|
|
147
|
-
|
|
148
|
+
}), r = !1), i && i.forEach((y) => {
|
|
149
|
+
y.trim() === "=" && (t({
|
|
148
150
|
type: c.Error,
|
|
149
151
|
message: o("custom-conditions.wrong-equality-operators")
|
|
150
152
|
}), r = !1);
|
|
151
|
-
const I =
|
|
152
|
-
I && I.forEach((
|
|
153
|
-
|
|
153
|
+
const I = y.match(/^[a-zA-Z]*$/g);
|
|
154
|
+
I && I.forEach((b) => {
|
|
155
|
+
h(b) && n.push(b);
|
|
154
156
|
});
|
|
155
157
|
});
|
|
156
158
|
}), n.length) {
|
|
157
|
-
const a = n.filter((
|
|
159
|
+
const a = n.filter((m) => m === "if"), i = n.filter((m) => m === "endif");
|
|
158
160
|
a.length !== i.length && (t({
|
|
159
161
|
type: c.Error,
|
|
160
162
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
161
163
|
}), r = !1);
|
|
162
164
|
}
|
|
163
165
|
return r;
|
|
164
|
-
},
|
|
166
|
+
}, B = (e) => {
|
|
165
167
|
const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
|
|
166
168
|
return r || t({
|
|
167
169
|
type: c.Warning,
|
|
168
170
|
message: o("custom-conditions.no-space-after-braces")
|
|
169
171
|
}), r;
|
|
170
|
-
},
|
|
172
|
+
}, x = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
|
|
171
173
|
type: c.Warning,
|
|
172
174
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
173
175
|
}), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
|
|
174
176
|
type: c.Error,
|
|
175
|
-
message: o(
|
|
177
|
+
message: o(ne)
|
|
176
178
|
}), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
|
|
177
179
|
type: c.Error,
|
|
178
180
|
message: o("newsletter.fill-all-necessary-fields")
|
|
179
|
-
}), !1) : !0,
|
|
181
|
+
}), !1) : !0, k = (e) => {
|
|
180
182
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
181
183
|
return e.match(s) === null ? !0 : (t({
|
|
182
184
|
type: c.Error,
|
|
183
185
|
message: o("newsletter.invalid-image-type")
|
|
184
186
|
}), !1);
|
|
185
187
|
}, V = (e) => {
|
|
186
|
-
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
188
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
|
|
187
189
|
return Array.from(r).find((i) => {
|
|
188
|
-
var
|
|
189
|
-
return !((
|
|
190
|
+
var m;
|
|
191
|
+
return !((m = i.id) != null && m.trim());
|
|
190
192
|
}) ? (t({
|
|
191
193
|
type: c.Error,
|
|
192
194
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
193
195
|
}), !1) : !0;
|
|
194
196
|
}, M = (e) => {
|
|
195
|
-
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
197
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(J);
|
|
196
198
|
return Array.from(r).find((i) => {
|
|
197
|
-
var
|
|
198
|
-
return !((
|
|
199
|
+
var m;
|
|
200
|
+
return !((m = i.id) != null && m.trim());
|
|
199
201
|
}) ? (t({
|
|
200
202
|
type: c.Error,
|
|
201
203
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
202
204
|
}), !1) : !0;
|
|
203
205
|
};
|
|
204
206
|
return { validateHtml: async (e, s, n = !1) => {
|
|
205
|
-
var v,
|
|
207
|
+
var v, y;
|
|
206
208
|
const r = [
|
|
207
209
|
...s.map((I) => I.value),
|
|
208
|
-
...
|
|
209
|
-
...((
|
|
210
|
+
...Z,
|
|
211
|
+
...((y = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : y.customFieldAttributes) ?? []
|
|
210
212
|
], a = G(e), i = await E(a);
|
|
211
|
-
return await
|
|
213
|
+
return await A(e, r, n) && _(e) && O(e) && w(e) && N(e, r, a, i) && L(e) && B(e) && x(e) && D() && F() && k(e) && V(e) && M(e);
|
|
212
214
|
} };
|
|
213
215
|
};
|
|
214
216
|
export {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
fe as buildPartnerAttributeNameSet,
|
|
218
|
+
pe as findInvalidCustomFields,
|
|
219
|
+
de as parseRecommendationVariable,
|
|
220
|
+
De as useHtmlValidator
|
|
219
221
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
-
import { useHttp as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useStripoApi as
|
|
5
|
-
const
|
|
6
|
-
const { handleError: c } =
|
|
2
|
+
import { useHttp as w } from "./useHttp.js";
|
|
3
|
+
import { useToaster as H } from "./useToaster.js";
|
|
4
|
+
import { useStripoApi as y } from "../services/stripoApi.js";
|
|
5
|
+
const O = () => {
|
|
6
|
+
const { handleError: c } = H(), { getToken: u } = y(), { post: d } = w(), { updateHtmlAndCss: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
|
|
7
7
|
try {
|
|
8
|
-
return (await
|
|
8
|
+
return (await d(
|
|
9
9
|
"https://plugins.stripo.email/api/v1/timers/clone",
|
|
10
10
|
{ html: t },
|
|
11
11
|
{
|
|
@@ -25,31 +25,29 @@ const S = () => {
|
|
|
25
25
|
cloneTimersOnSave: async (t) => {
|
|
26
26
|
if (!s(t))
|
|
27
27
|
return t;
|
|
28
|
-
const e = await
|
|
28
|
+
const e = await u();
|
|
29
29
|
return e && await i(t, e) || t;
|
|
30
30
|
},
|
|
31
31
|
updateTimersOnLoad: async (t) => {
|
|
32
|
-
var e, r,
|
|
32
|
+
var e, r, o, m;
|
|
33
33
|
try {
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
34
|
+
const n = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
|
|
35
|
+
if (!n || !s(n))
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const p = await t();
|
|
38
|
+
if (!p)
|
|
39
39
|
return;
|
|
40
|
-
const a = await i(
|
|
41
|
-
if (!a || a ===
|
|
40
|
+
const a = await i(n, p);
|
|
41
|
+
if (!a || a === n)
|
|
42
42
|
return;
|
|
43
|
-
const T = ((
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} catch (o) {
|
|
48
|
-
c(o, "Failed to update timer blocks");
|
|
43
|
+
const T = ((m = (o = window.UIEditor) == null ? void 0 : o.getCss) == null ? void 0 : m.call(o)) || "";
|
|
44
|
+
l(a, T);
|
|
45
|
+
} catch (n) {
|
|
46
|
+
c(n, "Failed to update timer blocks");
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
50
|
};
|
|
53
51
|
export {
|
|
54
|
-
|
|
52
|
+
O as useTimerClone
|
|
55
53
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import f from "../../extensions/Blocks/Checkbox/
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var x = (r, t, e) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var m = (r, t, e) => x(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { CSS_CLASS_CHECKBOX_BLOCK as b, CSS_CLASS_CHECKBOX_BLOCK_V2 as T, BLOCK_ROOT_SELECTOR as f } from "../../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
5
|
+
import h from "../../extensions/Blocks/Checkbox/template.js";
|
|
6
|
+
import { extractTextFromElement as p, buildTextBlock as C } from "./textBlockMigration.js";
|
|
7
|
+
class O {
|
|
7
8
|
constructor() {
|
|
8
|
-
|
|
9
|
+
m(this, "parser");
|
|
9
10
|
this.parser = new DOMParser();
|
|
10
11
|
}
|
|
11
12
|
migrate(t) {
|
|
12
13
|
try {
|
|
13
|
-
const e = this.parser.parseFromString(t, "text/html"),
|
|
14
|
-
if (
|
|
14
|
+
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll(`td.${b}`);
|
|
15
|
+
if (i.length === 0)
|
|
15
16
|
return t;
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
if (o.classList.contains(
|
|
17
|
+
let s = !1;
|
|
18
|
+
return i.forEach((o) => {
|
|
19
|
+
if (o.classList.contains(T))
|
|
19
20
|
return;
|
|
20
|
-
const
|
|
21
|
+
const l = o.getAttribute("id"), c = p(o, "ins-title"), a = p(o, "ins-description"), u = C(c, c.containerClass), S = C(a, a.containerClass), d = h.replace("{-{-TITLE-}-}", u).replace("{-{-DESCRIPTION-}-}", S), n = this.parser.parseFromString(
|
|
21
22
|
`<table id="tempDoc"><tbody><tr>${d}</tr></tbody></table>`,
|
|
22
23
|
"text/html"
|
|
23
|
-
).querySelector(
|
|
24
|
-
|
|
25
|
-
}),
|
|
24
|
+
).querySelector(f);
|
|
25
|
+
n && o.parentNode && (n.setAttribute("id", l || ""), o.parentNode.replaceChild(n, o), s = !0);
|
|
26
|
+
}), s ? e.documentElement.outerHTML : t;
|
|
26
27
|
} catch (e) {
|
|
27
28
|
return console.error("CheckboxMigrator failed:", e), t;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
return new
|
|
32
|
+
function D(r) {
|
|
33
|
+
return new O().migrate(r);
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
D as migrateCheckbox
|
|
36
37
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
1
|
+
import { migrateCheckbox as t } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
|
-
import { migrateRadioButton as
|
|
5
|
-
import { migrateRecommendation as
|
|
6
|
-
import { migrateSocialIcons as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return r = i(r), r = c(r), r = await p(r), r = a(r), r = g(r, t), r = e(r), r = n(r), m.linkTrackingIds && (r = f(r, m.trackIdFloor)), r;
|
|
4
|
+
import { migrateRadioButton as a } from "./radioButtonMigrator.js";
|
|
5
|
+
import { migrateRecommendation as c } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateSocialIcons as g } from "./socialIconMigrator.js";
|
|
7
|
+
import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
|
|
8
|
+
const k = async (o, r = {}) => {
|
|
9
|
+
let m = o;
|
|
10
|
+
return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
|
|
12
11
|
};
|
|
13
12
|
export {
|
|
14
|
-
|
|
13
|
+
k as migrate
|
|
15
14
|
};
|