@useinsider/guido 3.15.0-beta.36d3655 → 3.15.0-beta.e43de98
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 +23 -25
- package/dist/composables/useHtmlValidator.js +85 -83
- package/dist/composables/useTimerClone.js +19 -21
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/index.js +11 -12
- 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);
|
|
@@ -1,57 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useToaster as
|
|
1
|
+
import { useActionsApi as d } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "./useConfig.js";
|
|
3
|
+
import { useToaster as h } from "./useToaster.js";
|
|
4
4
|
import { useTranslations as E } from "./useTranslations.js";
|
|
5
5
|
import { ToasterTypeOptions as f } from "../enums/toaster.js";
|
|
6
6
|
import { useDynamicContentStore as A } from "../stores/dynamic-content.js";
|
|
7
|
-
import { flattenDynamicContentList as
|
|
8
|
-
import { extractUsedDynamicContent as
|
|
9
|
-
import { ref as
|
|
10
|
-
const
|
|
11
|
-
const { updateHtmlAndCss:
|
|
7
|
+
import { flattenDynamicContentList as S } from "../utils/genericUtil.js";
|
|
8
|
+
import { extractUsedDynamicContent as O } from "../utils/registerUsedDynamicContent.js";
|
|
9
|
+
import { ref as U } from "vue";
|
|
10
|
+
const w = 250, o = U({}), s = {}, u = /* @__PURE__ */ new Map(), z = () => {
|
|
11
|
+
const { updateHtmlAndCss: c } = d(), { showToaster: m } = h(), y = E(), { template: T } = D(), v = A(), g = (e, t) => {
|
|
12
12
|
const a = y(e);
|
|
13
13
|
return a === e ? t : a;
|
|
14
|
-
},
|
|
14
|
+
}, C = (e) => {
|
|
15
15
|
o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
|
|
16
16
|
}, l = (e, t, a) => {
|
|
17
|
-
var
|
|
17
|
+
var n;
|
|
18
18
|
o.value = { ...o.value, [e]: "applying" };
|
|
19
19
|
try {
|
|
20
|
-
|
|
21
|
-
console.warn("Editor did not acknowledge the template apply.", n);
|
|
22
|
-
}), o.value = { ...o.value, [e]: "applied" };
|
|
20
|
+
c(t, a), o.value = { ...o.value, [e]: "applied" };
|
|
23
21
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
22
|
+
const r = S((n = T.value) == null ? void 0 : n.dynamicContentList), p = O(t, r);
|
|
23
|
+
p.length > 0 && v.registerDynamicContent(p);
|
|
26
24
|
} catch {
|
|
27
25
|
}
|
|
28
26
|
u.get(e) !== t && (u.set(e, t), m({
|
|
29
27
|
type: f.Success,
|
|
30
28
|
message: g("newsletter.ai-template-applied", "Template applied to the editor")
|
|
31
29
|
}));
|
|
32
|
-
} catch (
|
|
30
|
+
} catch (r) {
|
|
33
31
|
o.value = { ...o.value, [e]: "failed" }, m({
|
|
34
32
|
type: f.Error,
|
|
35
|
-
message:
|
|
33
|
+
message: r instanceof Error ? r.message : "Failed to apply template"
|
|
36
34
|
});
|
|
37
35
|
}
|
|
38
|
-
},
|
|
36
|
+
}, i = (e) => {
|
|
39
37
|
const t = s[e];
|
|
40
38
|
t && (clearTimeout(t), delete s[e]);
|
|
41
39
|
};
|
|
42
|
-
return { applyStatus: o, markPending:
|
|
43
|
-
t.html && (
|
|
40
|
+
return { applyStatus: o, markPending: C, applyTemplate: (e, t) => {
|
|
41
|
+
t.html && (i(e), l(e, t.html, t.css ?? ""));
|
|
44
42
|
}, applyTemplateDebounced: (e, t) => {
|
|
45
43
|
if (!t.html)
|
|
46
44
|
return;
|
|
47
|
-
|
|
48
|
-
const { html: a } = t,
|
|
45
|
+
i(e);
|
|
46
|
+
const { html: a } = t, n = t.css ?? "";
|
|
49
47
|
s[e] = setTimeout(() => {
|
|
50
|
-
delete s[e], l(e, a,
|
|
51
|
-
},
|
|
48
|
+
delete s[e], l(e, a, n);
|
|
49
|
+
}, w);
|
|
52
50
|
} };
|
|
53
51
|
}, G = () => {
|
|
54
|
-
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((
|
|
52
|
+
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((c) => delete s[c]), o.value = {};
|
|
55
53
|
};
|
|
56
54
|
export {
|
|
57
55
|
G as resetEmailTemplateApplier,
|
|
@@ -1,64 +1,66 @@
|
|
|
1
1
|
import { useConfig as V } from "./useConfig.js";
|
|
2
2
|
import { getIgnoredRecommendationBlockIds as M } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
3
|
import { TemplateTypes as W } from "../enums/defaults.js";
|
|
4
|
-
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as X, DATA_ATTRIBUTE_REGEX as $, DYNAMIC_CONTENT_TAG_REGEX as
|
|
4
|
+
import { DISPLAY_CONDITIONS_REGEX as G, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as X, DATA_ATTRIBUTE_REGEX as $, DYNAMIC_CONTENT_TAG_REGEX as K, ALLOWED_DYNAMIC_SYSTEM_TOKENS as Y, VALID_DYNAMIC_VARIABLE_REGEX as U } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
|
+
import { BLOCK_ROOT_SELECTOR as j } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
7
|
import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
9
|
+
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
10
|
+
import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { resolveProductAttrValue as Q } from "../extensions/Blocks/Recommendation/templates/utils.js";
|
|
12
|
+
import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
13
|
+
import { useRecommendationStore as te } from "../stores/recommendation.js";
|
|
14
|
+
import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
|
|
15
|
+
import { computed as se } from "vue";
|
|
16
|
+
import { useHttp as re } from "./useHttp.js";
|
|
17
|
+
import { useToaster as oe } from "./useToaster.js";
|
|
18
|
+
import { useTranslations as ie } from "./useTranslations.js";
|
|
19
|
+
const ae = /recommendation-id="(\d+)"/g;
|
|
20
|
+
function ce(n) {
|
|
21
|
+
return [...n.matchAll(ae)].map((l) => l[1]);
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
+
function me(n, l) {
|
|
24
|
+
return l.some((f) => n.startsWith(`${f}_`));
|
|
23
25
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
return
|
|
26
|
+
const le = /^(\d+)_\d+_(.+)$/;
|
|
27
|
+
function ue(n) {
|
|
28
|
+
const l = n.match(le);
|
|
29
|
+
return l ? { recoId: l[1], attribute: l[2] } : null;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
+
function de(n) {
|
|
32
|
+
const l = new Set(Z);
|
|
31
33
|
return Object.values(n).forEach((f) => {
|
|
32
|
-
|
|
33
|
-
}),
|
|
34
|
+
l.add(Q(f.attributeName, n).toLowerCase());
|
|
35
|
+
}), l;
|
|
34
36
|
}
|
|
35
|
-
function
|
|
37
|
+
function fe(n, l, f, o, d) {
|
|
36
38
|
const u = n.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
37
39
|
if (!u)
|
|
38
40
|
return [];
|
|
39
|
-
const g = new Set(
|
|
40
|
-
return u.forEach((
|
|
41
|
-
const p =
|
|
41
|
+
const g = new Set(l.map((C) => C.toLowerCase())), E = [];
|
|
42
|
+
return u.forEach((C) => {
|
|
43
|
+
const p = C.slice(2, -2).trim().toLowerCase();
|
|
42
44
|
if (p !== "" && g.has(p))
|
|
43
45
|
return;
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
if (!d || d.has(
|
|
46
|
+
const h = ue(p);
|
|
47
|
+
if (h && o.has(h.recoId)) {
|
|
48
|
+
if (!d || d.has(h.attribute))
|
|
47
49
|
return;
|
|
48
50
|
E.push(p);
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
me(p, f) || p.includes(".") || E.push(p);
|
|
52
54
|
}), E;
|
|
53
55
|
}
|
|
54
|
-
function
|
|
55
|
-
return (n.replace($, "$1").match(
|
|
56
|
+
function pe(n) {
|
|
57
|
+
return (n.replace($, "$1").match(K) ?? []).filter((o) => {
|
|
56
58
|
const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
|
|
57
|
-
return
|
|
59
|
+
return Y.includes(g) ? !1 : U.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
|
-
const
|
|
61
|
-
const { showToaster: n } =
|
|
62
|
+
const De = () => {
|
|
63
|
+
const { showToaster: n } = oe(), { post: l } = re(), { config: f } = V(), o = ie(), d = te(), u = J(), g = se(
|
|
62
64
|
() => {
|
|
63
65
|
var e, t;
|
|
64
66
|
return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
|
|
@@ -71,11 +73,11 @@ const xe = () => {
|
|
|
71
73
|
} catch {
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
74
|
-
return
|
|
75
|
-
},
|
|
76
|
-
const s = await
|
|
76
|
+
return de(u.filterList);
|
|
77
|
+
}, C = async (e) => {
|
|
78
|
+
const s = await l(
|
|
77
79
|
"/newsletter/template-library/check-template-html-body",
|
|
78
|
-
{ html:
|
|
80
|
+
{ html: ne(e) }
|
|
79
81
|
), { status: r, message: a } = s.data;
|
|
80
82
|
return r || n({
|
|
81
83
|
type: c.Error,
|
|
@@ -84,26 +86,26 @@ const xe = () => {
|
|
|
84
86
|
type: c.Error,
|
|
85
87
|
message: o("newsletter.already-in-progress")
|
|
86
88
|
}), r;
|
|
87
|
-
}, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()),
|
|
89
|
+
}, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), h = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, t) => {
|
|
88
90
|
const s = e.match(/({%(.*?)%})/g);
|
|
89
91
|
let r = !0;
|
|
90
92
|
return s !== null && !g.value && s.forEach((a) => {
|
|
91
93
|
const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
92
94
|
if (i && i.length > 0) {
|
|
93
|
-
const [
|
|
94
|
-
p(
|
|
95
|
+
const [m] = i;
|
|
96
|
+
p(m) && !t.includes(m) && (n({
|
|
95
97
|
type: c.Warning,
|
|
96
98
|
message: o("custom-fields.invalid-custom-fields")
|
|
97
99
|
}), r = !1);
|
|
98
100
|
}
|
|
99
101
|
}), r;
|
|
100
|
-
},
|
|
101
|
-
const r = s ? await
|
|
102
|
-
return
|
|
103
|
-
},
|
|
102
|
+
}, b = async (e, t, s) => {
|
|
103
|
+
const r = s ? await C(e) : !0;
|
|
104
|
+
return T(e, t) && r;
|
|
105
|
+
}, R = (e) => e.length > 0 ? !0 : (n({
|
|
104
106
|
type: c.Warning,
|
|
105
107
|
message: o("newsletter.html-content-is-empty")
|
|
106
|
-
}), !1),
|
|
108
|
+
}), !1), A = (e) => {
|
|
107
109
|
const t = (e.match(/{/gm) || []).length, s = (e.match(/}/gm) || []).length;
|
|
108
110
|
return t > s && n({
|
|
109
111
|
type: c.Warning,
|
|
@@ -112,26 +114,26 @@ const xe = () => {
|
|
|
112
114
|
type: c.Warning,
|
|
113
115
|
message: o("custom-fields.missing-opening-braces")
|
|
114
116
|
}), t === s;
|
|
115
|
-
},
|
|
116
|
-
const t =
|
|
117
|
+
}, _ = (e) => {
|
|
118
|
+
const t = pe(e).length === 0;
|
|
117
119
|
return t || n({
|
|
118
120
|
type: c.Warning,
|
|
119
121
|
message: o("custom-fields.invalid-custom-fields")
|
|
120
122
|
}), t;
|
|
121
|
-
},
|
|
123
|
+
}, O = (e, t, s, r) => {
|
|
122
124
|
if (g.value)
|
|
123
125
|
return !0;
|
|
124
|
-
const a =
|
|
126
|
+
const a = fe(
|
|
125
127
|
e,
|
|
126
128
|
t,
|
|
127
|
-
|
|
129
|
+
ce(e),
|
|
128
130
|
s,
|
|
129
131
|
r
|
|
130
132
|
);
|
|
131
133
|
if (a.length > 0) {
|
|
132
134
|
const i = `
|
|
133
135
|
<ul>
|
|
134
|
-
${a.map((
|
|
136
|
+
${a.map((m) => `<li>${m}</li>`).join("")}
|
|
135
137
|
</ul>
|
|
136
138
|
`;
|
|
137
139
|
return n({
|
|
@@ -140,45 +142,45 @@ const xe = () => {
|
|
|
140
142
|
}), !1;
|
|
141
143
|
}
|
|
142
144
|
return !0;
|
|
143
|
-
},
|
|
145
|
+
}, w = (e) => {
|
|
144
146
|
const t = e.match(/{%(.*?)%}/g), s = [];
|
|
145
147
|
let r = !0;
|
|
146
148
|
if (t && t.forEach((a) => {
|
|
147
|
-
const i = a.match(G),
|
|
148
|
-
(!i || a !==
|
|
149
|
+
const i = a.match(G), m = a.match(H), v = (i == null ? void 0 : i.join("")) || "";
|
|
150
|
+
(!i || a !== v) && !m && (n({
|
|
149
151
|
type: c.Error,
|
|
150
152
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
151
|
-
}), r = !1), i && i.forEach((
|
|
152
|
-
|
|
153
|
+
}), r = !1), i && i.forEach((y) => {
|
|
154
|
+
y.trim() === "=" && (n({
|
|
153
155
|
type: c.Error,
|
|
154
156
|
message: o("custom-conditions.wrong-equality-operators")
|
|
155
157
|
}), r = !1);
|
|
156
|
-
const I =
|
|
157
|
-
I && I.forEach((
|
|
158
|
-
|
|
158
|
+
const I = y.match(/^[a-zA-Z]*$/g);
|
|
159
|
+
I && I.forEach((S) => {
|
|
160
|
+
h(S) && s.push(S);
|
|
159
161
|
});
|
|
160
162
|
});
|
|
161
163
|
}), s.length) {
|
|
162
|
-
const a = s.filter((
|
|
164
|
+
const a = s.filter((m) => m === "if"), i = s.filter((m) => m === "endif");
|
|
163
165
|
a.length !== i.length && (n({
|
|
164
166
|
type: c.Error,
|
|
165
167
|
message: o("custom-conditions.missing-if-endif-tag")
|
|
166
168
|
}), r = !1);
|
|
167
169
|
}
|
|
168
170
|
return r;
|
|
169
|
-
},
|
|
171
|
+
}, N = (e) => {
|
|
170
172
|
const t = (e.match(/{% /gm) || []).length, s = (e.match(/ %}/gm) || []).length, r = t === s;
|
|
171
173
|
return r || n({
|
|
172
174
|
type: c.Warning,
|
|
173
175
|
message: o("custom-conditions.no-space-after-braces")
|
|
174
176
|
}), r;
|
|
175
|
-
},
|
|
177
|
+
}, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((s) => s.includes("if")).map((s) => (s.match(/{{.*}}/gm) || []).length).reduce((s, r) => s + r, 0) > 0 ? (n({
|
|
176
178
|
type: c.Warning,
|
|
177
179
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
178
|
-
}), !1) : !0,
|
|
180
|
+
}), !1) : !0, B = () => u.hasInvalidBlock() ? (n({
|
|
179
181
|
type: c.Error,
|
|
180
|
-
message: o(
|
|
181
|
-
}), !1) : !0,
|
|
182
|
+
message: o(ee)
|
|
183
|
+
}), !1) : !0, x = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((s) => s.value === "")) !== void 0 ? (n({
|
|
182
184
|
type: c.Error,
|
|
183
185
|
message: o("newsletter.fill-all-necessary-fields")
|
|
184
186
|
}), !1) : !0, D = (e) => {
|
|
@@ -188,37 +190,37 @@ const xe = () => {
|
|
|
188
190
|
message: o("newsletter.invalid-image-type")
|
|
189
191
|
}), !1);
|
|
190
192
|
}, F = (e) => {
|
|
191
|
-
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
193
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(j);
|
|
192
194
|
return Array.from(r).find((i) => {
|
|
193
|
-
var
|
|
194
|
-
return !((
|
|
195
|
+
var m;
|
|
196
|
+
return !((m = i.id) != null && m.trim());
|
|
195
197
|
}) ? (n({
|
|
196
198
|
type: c.Error,
|
|
197
199
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
198
200
|
}), !1) : !0;
|
|
199
|
-
},
|
|
200
|
-
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
201
|
+
}, k = (e) => {
|
|
202
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
|
|
201
203
|
return Array.from(r).find((i) => {
|
|
202
|
-
var
|
|
203
|
-
return !((
|
|
204
|
+
var m;
|
|
205
|
+
return !((m = i.id) != null && m.trim());
|
|
204
206
|
}) ? (n({
|
|
205
207
|
type: c.Error,
|
|
206
208
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
207
209
|
}), !1) : !0;
|
|
208
210
|
};
|
|
209
211
|
return { validateHtml: async (e, t, s = !1) => {
|
|
210
|
-
var
|
|
212
|
+
var v, y;
|
|
211
213
|
const r = [
|
|
212
214
|
...t.map((I) => I.value),
|
|
213
215
|
...q,
|
|
214
|
-
...((
|
|
216
|
+
...((y = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : y.customFieldAttributes) ?? []
|
|
215
217
|
], a = M(e), i = await E(a);
|
|
216
|
-
return await
|
|
218
|
+
return await b(e, r, s) && R(e) && A(e) && _(e) && O(e, r, a, i) && w(e) && N(e) && L(e) && B() && x() && D(e) && F(e) && k(e);
|
|
217
219
|
} };
|
|
218
220
|
};
|
|
219
221
|
export {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
de as buildPartnerAttributeNameSet,
|
|
223
|
+
fe as findInvalidCustomFields,
|
|
224
|
+
ue as parseRecommendationVariable,
|
|
225
|
+
De as useHtmlValidator
|
|
224
226
|
};
|
|
@@ -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,16 +1,15 @@
|
|
|
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 { migrateProductNameLink as
|
|
5
|
-
import { migrateRadioButton as
|
|
6
|
-
import { migrateRecommendation as
|
|
7
|
-
import { migrateSocialIcons as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return r = i(r), r = g(r), r = await k(r), r = a(r), r = n(r, t), r = e(r), r = c(r), r = f(r), m.linkTrackingIds && (r = p(r, m.trackIdFloor)), r;
|
|
4
|
+
import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
|
|
5
|
+
import { migrateRadioButton as c } from "./radioButtonMigrator.js";
|
|
6
|
+
import { migrateRecommendation as g } from "./recommendationMigrator.js";
|
|
7
|
+
import { migrateSocialIcons as n } from "./socialIconMigrator.js";
|
|
8
|
+
import { migrateUnsubscribe as p } from "./unsubscribeMigrator.js";
|
|
9
|
+
const x = async (r, o = {}) => {
|
|
10
|
+
let m = r;
|
|
11
|
+
return m = t(m), m = c(m), m = await p(m), m = i(m), m = g(m, o), m = e(m), m = a(m), m = n(m), m;
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
|
-
|
|
14
|
+
x as migrate
|
|
16
15
|
};
|