@useinsider/guido 3.15.0 → 3.16.0-beta.0faee0c
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 +108 -92
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +78 -75
- package/dist/composables/useActionsApi.js +30 -22
- package/dist/composables/useEmailTemplateApplier.js +25 -23
- package/dist/composables/useHtmlValidator.js +108 -106
- package/dist/composables/useStripo.js +30 -29
- package/dist/composables/useTimerClone.js +21 -19
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- 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/Items/block.js +44 -42
- package/dist/extensions/Blocks/Items/template.js +86 -86
- 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/Recommendation/constants/selectors.js +18 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +5 -9
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +98 -113
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +21 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/extensions/Blocks/controlFactories.js +117 -115
- package/dist/guido.css +1 -1
- package/dist/library.js +11 -7
- package/dist/node_modules/valibot/dist/index.js +230 -216
- package/dist/public/trackingIds.js +8 -0
- package/dist/src/@types/config/schemas.d.ts +20 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- 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/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -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/extensions/Blocks/common-control.d.ts +3 -1
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/trackingIds.d.ts +9 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/utils/linkTrackingIds.d.ts +30 -0
- package/dist/stores/editor.js +4 -1
- package/dist/stores/onboarding.js +11 -7
- package/dist/utils/linkTrackingIds.js +56 -0
- package/dist/utils/pairProductVariables.js +105 -99
- package/dist/utils/templatePreparation.js +72 -61
- package/package.json +5 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
1
|
+
import { filterAmpErrors as T } from "../utils/ampErrorFilter.js";
|
|
2
2
|
import { useToaster as A } from "./useToaster.js";
|
|
3
|
-
const D = () => {
|
|
4
|
-
const { handleError:
|
|
3
|
+
const p = 1e4, D = () => {
|
|
4
|
+
const { handleError: r } = A(), l = (t = {}) => new Promise((e, a) => {
|
|
5
5
|
const o = { ...{
|
|
6
6
|
minimize: !0,
|
|
7
7
|
utmEntity: {
|
|
@@ -21,29 +21,29 @@ const 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 }, n = {
|
|
25
|
+
callback: (m, d, c, u, w) => {
|
|
26
|
+
m ? a(m) : e({
|
|
27
|
+
html: d,
|
|
28
|
+
ampHtml: c,
|
|
29
|
+
ampErrors: T(u ?? []),
|
|
30
|
+
displayConditions: w
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
33
|
...o
|
|
34
34
|
};
|
|
35
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
35
|
+
window.StripoEditorApi.actionsApi.compileEmail(n);
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
|
-
getCompiledEmail:
|
|
38
|
+
getCompiledEmail: l,
|
|
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: s, utmParams: n, syncModulesIds: m }) => t({
|
|
41
41
|
html: a,
|
|
42
42
|
css: i,
|
|
43
43
|
width: o,
|
|
44
|
-
height:
|
|
45
|
-
utmParams:
|
|
46
|
-
syncModulesIds:
|
|
44
|
+
height: s,
|
|
45
|
+
utmParams: n,
|
|
46
|
+
syncModulesIds: m
|
|
47
47
|
});
|
|
48
48
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
49
49
|
}),
|
|
@@ -57,7 +57,7 @@ const D = () => {
|
|
|
57
57
|
displayConditions: a,
|
|
58
58
|
ampHtml: i = "",
|
|
59
59
|
ampErrors: o = []
|
|
60
|
-
} = await
|
|
60
|
+
} = await l({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
61
61
|
return {
|
|
62
62
|
html: e,
|
|
63
63
|
ampHtml: i,
|
|
@@ -65,7 +65,7 @@ const D = () => {
|
|
|
65
65
|
displayConditions: a
|
|
66
66
|
};
|
|
67
67
|
} catch (e) {
|
|
68
|
-
return
|
|
68
|
+
return r(e, "Error loading preview"), {
|
|
69
69
|
html: "",
|
|
70
70
|
ampHtml: "",
|
|
71
71
|
ampErrors: [],
|
|
@@ -81,19 +81,27 @@ const D = () => {
|
|
|
81
81
|
}
|
|
82
82
|
try {
|
|
83
83
|
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
|
|
84
|
-
i ? (
|
|
84
|
+
i ? (r(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
85
85
|
});
|
|
86
86
|
} catch (i) {
|
|
87
|
-
|
|
87
|
+
r(i, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
88
88
|
}
|
|
89
89
|
}),
|
|
90
90
|
updateHtmlAndCss: (t, e) => {
|
|
91
|
-
window.StripoEditorApi
|
|
91
|
+
const { actionsApi: a } = window.StripoEditorApi;
|
|
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
|
+
});
|
|
92
100
|
},
|
|
93
101
|
editorSave: () => new Promise((t) => {
|
|
94
102
|
window.StripoEditorApi.actionsApi.save((e) => {
|
|
95
103
|
if (e) {
|
|
96
|
-
|
|
104
|
+
r(e, "Failed to save template"), t(!1);
|
|
97
105
|
return;
|
|
98
106
|
}
|
|
99
107
|
t(!0);
|
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useToaster as
|
|
1
|
+
import { useActionsApi as C } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as h } from "./useConfig.js";
|
|
3
|
+
import { useToaster as D } 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 w } from "../utils/genericUtil.js";
|
|
8
|
+
import { extractUsedDynamicContent as S } from "../utils/registerUsedDynamicContent.js";
|
|
9
|
+
import { ref as O } from "vue";
|
|
10
|
+
const U = 250, o = O({}), s = {}, u = /* @__PURE__ */ new Map(), z = () => {
|
|
11
|
+
const { updateHtmlAndCss: r } = C(), { showToaster: m } = D(), y = E(), { template: T } = h(), d = A(), g = (e, t) => {
|
|
12
12
|
const a = y(e);
|
|
13
13
|
return a === e ? t : a;
|
|
14
|
-
},
|
|
14
|
+
}, v = (e) => {
|
|
15
15
|
o.value[e] === void 0 && (o.value = { ...o.value, [e]: "pending" });
|
|
16
16
|
}, l = (e, t, a) => {
|
|
17
|
-
var
|
|
17
|
+
var c;
|
|
18
18
|
o.value = { ...o.value, [e]: "applying" };
|
|
19
19
|
try {
|
|
20
|
-
|
|
20
|
+
r(t, a).catch((n) => {
|
|
21
|
+
console.warn("Editor did not acknowledge the template apply.", n);
|
|
22
|
+
}), o.value = { ...o.value, [e]: "applied" };
|
|
21
23
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
+
const n = w((c = T.value) == null ? void 0 : c.dynamicContentList), i = S(t, n);
|
|
25
|
+
i.length > 0 && d.registerDynamicContent(i);
|
|
24
26
|
} catch {
|
|
25
27
|
}
|
|
26
28
|
u.get(e) !== t && (u.set(e, t), m({
|
|
27
29
|
type: f.Success,
|
|
28
30
|
message: g("newsletter.ai-template-applied", "Template applied to the editor")
|
|
29
31
|
}));
|
|
30
|
-
} catch (
|
|
32
|
+
} catch (n) {
|
|
31
33
|
o.value = { ...o.value, [e]: "failed" }, m({
|
|
32
34
|
type: f.Error,
|
|
33
|
-
message:
|
|
35
|
+
message: n instanceof Error ? n.message : "Failed to apply template"
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
|
-
},
|
|
38
|
+
}, p = (e) => {
|
|
37
39
|
const t = s[e];
|
|
38
40
|
t && (clearTimeout(t), delete s[e]);
|
|
39
41
|
};
|
|
40
|
-
return { applyStatus: o, markPending:
|
|
41
|
-
t.html && (
|
|
42
|
+
return { applyStatus: o, markPending: v, applyTemplate: (e, t) => {
|
|
43
|
+
t.html && (p(e), l(e, t.html, t.css ?? ""));
|
|
42
44
|
}, applyTemplateDebounced: (e, t) => {
|
|
43
45
|
if (!t.html)
|
|
44
46
|
return;
|
|
45
|
-
|
|
46
|
-
const { html: a } = t,
|
|
47
|
+
p(e);
|
|
48
|
+
const { html: a } = t, c = t.css ?? "";
|
|
47
49
|
s[e] = setTimeout(() => {
|
|
48
|
-
delete s[e], l(e, a,
|
|
49
|
-
},
|
|
50
|
+
delete s[e], l(e, a, c);
|
|
51
|
+
}, U);
|
|
50
52
|
} };
|
|
51
53
|
}, G = () => {
|
|
52
|
-
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((
|
|
54
|
+
Object.values(s).forEach(clearTimeout), Object.keys(s).forEach((r) => delete s[r]), o.value = {};
|
|
53
55
|
};
|
|
54
56
|
export {
|
|
55
57
|
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 { filterToProductAttrValue as Q } from "../extensions/Blocks/Recommendation/utils/compositionKeys.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(s) {
|
|
21
|
+
return [...s.matchAll(ae)].map((l) => l[1]);
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
+
function me(s, l) {
|
|
24
|
+
return l.some((f) => s.startsWith(`${f}_`));
|
|
23
25
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
return
|
|
26
|
+
const le = /^(\d+)_\d+_(.+)$/;
|
|
27
|
+
function ue(s) {
|
|
28
|
+
const l = s.match(le);
|
|
29
|
+
return l ? { recoId: l[1], attribute: l[2] } : null;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
return Object.values(
|
|
32
|
-
|
|
33
|
-
}),
|
|
31
|
+
function de(s) {
|
|
32
|
+
const l = new Set(Z);
|
|
33
|
+
return Object.values(s).forEach((f) => {
|
|
34
|
+
l.add(Q(f).toLowerCase());
|
|
35
|
+
}), l;
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
const u =
|
|
37
|
+
function fe(s, l, f, o, d) {
|
|
38
|
+
const u = s.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 (
|
|
56
|
+
function pe(s) {
|
|
57
|
+
return (s.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:
|
|
62
|
+
const De = () => {
|
|
63
|
+
const { showToaster: s } = 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,154 +73,154 @@ const xe = () => {
|
|
|
71
73
|
} catch {
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
74
|
-
return
|
|
75
|
-
},
|
|
76
|
-
const
|
|
76
|
+
return de(u.filterList);
|
|
77
|
+
}, C = async (e) => {
|
|
78
|
+
const n = await l(
|
|
77
79
|
"/newsletter/template-library/check-template-html-body",
|
|
78
|
-
{ html:
|
|
79
|
-
), { status: r, message: a } =
|
|
80
|
-
return r ||
|
|
80
|
+
{ html: ne(e) }
|
|
81
|
+
), { status: r, message: a } = n.data;
|
|
82
|
+
return r || s({
|
|
81
83
|
type: c.Error,
|
|
82
84
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
83
|
-
}), o(P), a === o(X) &&
|
|
85
|
+
}), o(P), a === o(X) && s({
|
|
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()),
|
|
88
|
-
const
|
|
89
|
+
}, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), h = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, t) => {
|
|
90
|
+
const n = e.match(/({%(.*?)%})/g);
|
|
89
91
|
let r = !0;
|
|
90
|
-
return
|
|
92
|
+
return n !== null && !g.value && n.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) && (s({
|
|
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 =
|
|
102
|
-
return
|
|
103
|
-
},
|
|
102
|
+
}, R = async (e, t, n) => {
|
|
103
|
+
const r = n ? await C(e) : !0;
|
|
104
|
+
return T(e, t) && r;
|
|
105
|
+
}, b = (e) => e.length > 0 ? !0 : (s({
|
|
104
106
|
type: c.Warning,
|
|
105
107
|
message: o("newsletter.html-content-is-empty")
|
|
106
|
-
}), !1),
|
|
107
|
-
const t = (e.match(/{/gm) || []).length,
|
|
108
|
-
return t >
|
|
108
|
+
}), !1), A = (e) => {
|
|
109
|
+
const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
110
|
+
return t > n && s({
|
|
109
111
|
type: c.Warning,
|
|
110
112
|
message: o("custom-fields.missing-closing-braces")
|
|
111
|
-
}), t <
|
|
113
|
+
}), t < n && s({
|
|
112
114
|
type: c.Warning,
|
|
113
115
|
message: o("custom-fields.missing-opening-braces")
|
|
114
|
-
}), t ===
|
|
115
|
-
},
|
|
116
|
-
const t =
|
|
117
|
-
return t ||
|
|
116
|
+
}), t === n;
|
|
117
|
+
}, _ = (e) => {
|
|
118
|
+
const t = pe(e).length === 0;
|
|
119
|
+
return t || s({
|
|
118
120
|
type: c.Warning,
|
|
119
121
|
message: o("custom-fields.invalid-custom-fields")
|
|
120
122
|
}), t;
|
|
121
|
-
},
|
|
123
|
+
}, O = (e, t, n, r) => {
|
|
122
124
|
if (g.value)
|
|
123
125
|
return !0;
|
|
124
|
-
const a =
|
|
126
|
+
const a = fe(
|
|
125
127
|
e,
|
|
126
128
|
t,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
ce(e),
|
|
130
|
+
n,
|
|
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
|
-
return
|
|
139
|
+
return s({
|
|
138
140
|
type: c.Error,
|
|
139
141
|
message: o("custom-fields.invalid-custom-fields") + i
|
|
140
142
|
}), !1;
|
|
141
143
|
}
|
|
142
144
|
return !0;
|
|
143
|
-
},
|
|
144
|
-
const t = e.match(/{%(.*?)%}/g),
|
|
145
|
+
}, w = (e) => {
|
|
146
|
+
const t = e.match(/{%(.*?)%}/g), n = [];
|
|
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 && (s({
|
|
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() === "=" && (s({
|
|
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) && n.push(S);
|
|
159
161
|
});
|
|
160
162
|
});
|
|
161
|
-
}),
|
|
162
|
-
const a =
|
|
163
|
-
a.length !== i.length && (
|
|
163
|
+
}), n.length) {
|
|
164
|
+
const a = n.filter((m) => m === "if"), i = n.filter((m) => m === "endif");
|
|
165
|
+
a.length !== i.length && (s({
|
|
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
|
-
},
|
|
170
|
-
const t = (e.match(/{% /gm) || []).length,
|
|
171
|
-
return r ||
|
|
171
|
+
}, L = (e) => {
|
|
172
|
+
const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
|
|
173
|
+
return r || s({
|
|
172
174
|
type: c.Warning,
|
|
173
175
|
message: o("custom-conditions.no-space-after-braces")
|
|
174
176
|
}), r;
|
|
175
|
-
},
|
|
177
|
+
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
|
|
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() ? (s({
|
|
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((n) => n.value === "")) !== void 0 ? (s({
|
|
182
184
|
type: c.Error,
|
|
183
185
|
message: o("newsletter.fill-all-necessary-fields")
|
|
184
186
|
}), !1) : !0, D = (e) => {
|
|
185
187
|
const t = /src="[^"]*\.(svg|pst)"/gm;
|
|
186
|
-
return e.match(t) === null ? !0 : (
|
|
188
|
+
return e.match(t) === null ? !0 : (s({
|
|
187
189
|
type: c.Error,
|
|
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
|
-
}) ? (
|
|
195
|
+
var m;
|
|
196
|
+
return !((m = i.id) != null && m.trim());
|
|
197
|
+
}) ? (s({
|
|
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
|
-
}) ? (
|
|
204
|
+
var m;
|
|
205
|
+
return !((m = i.id) != null && m.trim());
|
|
206
|
+
}) ? (s({
|
|
205
207
|
type: c.Error,
|
|
206
208
|
message: o("unsubscribe-templates.select-radio-button-groups")
|
|
207
209
|
}), !1) : !0;
|
|
208
210
|
};
|
|
209
|
-
return { validateHtml: async (e, t,
|
|
210
|
-
var
|
|
211
|
+
return { validateHtml: async (e, t, n = !1) => {
|
|
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 R(e, r, n) && b(e) && A(e) && _(e) && O(e, r, a, i) && w(e) && L(e) && N(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
|
};
|
|
@@ -16,22 +16,22 @@ import { useEditorStore as b } from "../stores/editor.js";
|
|
|
16
16
|
import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
|
-
const
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken:
|
|
19
|
+
const Ce = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: B } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var l;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, document.body.appendChild(
|
|
26
|
+
const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(l = o == null ? void 0 : o.stripo) == null ? void 0 : l.version}/UIEditor.js`, e = document.createElement("script");
|
|
27
|
+
e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
|
|
28
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
|
|
29
|
+
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), _ = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const
|
|
34
|
+
const e = b(), { html: l, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = ((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1;
|
|
35
35
|
await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
@@ -57,6 +57,7 @@ const Ct = () => {
|
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
59
59
|
displayHiddenPreheader: !1,
|
|
60
|
+
keepModuleStylesEnabled: !0,
|
|
60
61
|
displayTitle: !1,
|
|
61
62
|
displayUTM: !1,
|
|
62
63
|
selectElementAfterDrop: !0,
|
|
@@ -77,38 +78,38 @@ const Ct = () => {
|
|
|
77
78
|
)
|
|
78
79
|
}
|
|
79
80
|
],
|
|
80
|
-
async onTokenRefreshRequest(
|
|
81
|
+
async onTokenRefreshRequest(t) {
|
|
81
82
|
try {
|
|
82
|
-
const d = await
|
|
83
|
-
|
|
83
|
+
const d = await M();
|
|
84
|
+
t(d);
|
|
84
85
|
} catch (d) {
|
|
85
86
|
p(d, "Failed to refresh token");
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
89
|
onTemplateLoaded() {
|
|
89
90
|
try {
|
|
90
|
-
const { importCss:
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const { importCss: t } = H(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
|
|
92
|
+
t(), d(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
|
+
e.hasChanges = !1;
|
|
93
94
|
}, 1e3);
|
|
94
|
-
} catch (
|
|
95
|
-
p(
|
|
95
|
+
} catch (t) {
|
|
96
|
+
p(t, "Failed to load custom interface appearance");
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
onCodeEditorVisibilityChanged(
|
|
99
|
-
|
|
99
|
+
onCodeEditorVisibilityChanged(t) {
|
|
100
|
+
e.isCodeEditorOpen = t;
|
|
100
101
|
},
|
|
101
|
-
onEditorVisualModeChanged(
|
|
102
|
-
|
|
102
|
+
onEditorVisualModeChanged(t) {
|
|
103
|
+
e.editorVisualMode = t.toLowerCase();
|
|
103
104
|
},
|
|
104
|
-
onVersionHistoryVisibilityChanged(
|
|
105
|
-
|
|
105
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
106
|
+
e.isVersionHistoryOpen = t;
|
|
106
107
|
},
|
|
107
108
|
onDataChanged() {
|
|
108
|
-
|
|
109
|
+
e.hasChanges = !0;
|
|
109
110
|
},
|
|
110
|
-
onEvent:
|
|
111
|
-
onModuleAdd:
|
|
111
|
+
onEvent: B,
|
|
112
|
+
onModuleAdd: F,
|
|
112
113
|
notifications: V(),
|
|
113
114
|
ignoreClickOutsideSelectors: [
|
|
114
115
|
"#guido-dynamic-content-modal",
|
|
@@ -124,11 +125,11 @@ const Ct = () => {
|
|
|
124
125
|
const a = b();
|
|
125
126
|
try {
|
|
126
127
|
await f();
|
|
127
|
-
const [r,
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const [r, e] = await Promise.all([
|
|
129
|
+
T(),
|
|
130
|
+
v()
|
|
130
131
|
]);
|
|
131
|
-
a.syncModulesEnabled =
|
|
132
|
+
a.syncModulesEnabled = e, await _(i, s, o, r, e);
|
|
132
133
|
} catch {
|
|
133
134
|
a.loadingStatus = !1, k({
|
|
134
135
|
type: X.Error,
|
|
@@ -145,5 +146,5 @@ const Ct = () => {
|
|
|
145
146
|
} };
|
|
146
147
|
};
|
|
147
148
|
export {
|
|
148
|
-
|
|
149
|
+
Ce as useStripo
|
|
149
150
|
};
|