@useinsider/guido 1.0.2-beta.86f7e79 → 1.0.2-beta.93e2012
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/README.md +31 -1
- package/dist/@types/generic.d.ts +4 -0
- package/dist/components/Guido.vue.d.ts +3 -1
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +76 -65
- package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +3 -2
- package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
- package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -9
- package/dist/components/organisms/header/RightSlot.vue.d.ts +3 -1
- package/dist/components/organisms/header/RightSlot.vue.js +5 -3
- package/dist/components/organisms/header/RightSlot.vue2.js +26 -27
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +11 -11
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +8 -8
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +40 -28
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +6 -6
- package/dist/composables/useCustomInterfaceAppearance.js +22 -18
- package/dist/composables/useHtmlCompiler.js +17 -9
- package/dist/composables/useHtmlValidator.d.ts +3 -0
- package/dist/composables/useHtmlValidator.js +120 -0
- package/dist/composables/useRecommendation.d.ts +19 -0
- package/dist/composables/useRecommendation.js +27 -0
- package/dist/composables/useSave.d.ts +4 -0
- package/dist/composables/useSave.js +15 -0
- package/dist/composables/useStripo.js +27 -25
- package/dist/composables/useToaster.js +17 -17
- package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
- package/dist/config/compiler/outlookCompilerRules.js +36 -0
- package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
- package/dist/config/compiler/recommendationCompilerRules.js +83 -0
- package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
- package/dist/config/compiler/socialCompilerRules.js +21 -0
- package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
- package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
- package/dist/enums/defaults.d.ts +5 -1
- package/dist/enums/defaults.js +14 -10
- package/dist/enums/html-validator.d.ts +6 -0
- package/dist/enums/html-validator.js +7 -0
- package/dist/enums/recommendation.d.ts +54 -0
- package/dist/enums/recommendation.js +56 -0
- package/dist/enums/unsubscribe.d.ts +15 -0
- package/dist/enums/unsubscribe.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/mock/api/validator.d.ts +2 -0
- package/dist/static/styles/components/alert-message.css.js +32 -2
- package/dist/static/styles/components/button.css.js +32 -2
- package/dist/static/styles/components/notification.css.js +55 -0
- package/dist/static/styles/components/popup.css.js +68 -0
- package/dist/static/styles/components/wide-panel.css.js +5 -1
- package/dist/static/styles/customEditorStyle.css.js +6 -0
- package/dist/static/styles/variables.css.js +10 -0
- package/dist/stores/dynamic-content.d.ts +12 -0
- package/dist/stores/dynamic-content.js +7 -6
- package/dist/stores/recommendation.d.ts +10 -0
- package/dist/stores/recommendation.js +9 -0
- package/dist/stores/unsubscribe.d.ts +8 -0
- package/dist/stores/unsubscribe.js +9 -0
- package/dist/utils/genericUtil.js +9 -6
- package/dist/utils/templatePreparation.js +21 -14
- package/package.json +1 -1
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTranslations as
|
|
3
|
-
import { useOnboardingStore as
|
|
4
|
-
import { InOnboard as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as u, computed as a, watch as b } from "vue";
|
|
2
|
+
import { useTranslations as m } from "../../../composables/useTranslations.js";
|
|
3
|
+
import { useOnboardingStore as k } from "../../../stores/onboarding.js";
|
|
4
|
+
import { InOnboard as B } from "@useinsider/design-system-vue";
|
|
5
|
+
const y = /* @__PURE__ */ u({
|
|
6
6
|
__name: "TextBlockOnboarding",
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
7
|
+
setup(h) {
|
|
8
|
+
const i = m(), o = k(), e = a(() => {
|
|
9
|
+
const n = window.innerHeight - 128, r = Math.max(90, n * 0.15), s = Math.max(490, n * 0.71), d = 200, g = 40;
|
|
10
|
+
return {
|
|
11
|
+
settings: {
|
|
12
|
+
top: `${r}px`,
|
|
13
|
+
position: r + d + g > n ? "Right Bottom" : "Right Top"
|
|
14
|
+
},
|
|
15
|
+
dynamic: {
|
|
16
|
+
top: `${s}px`,
|
|
17
|
+
position: s + d + g > n ? "Right Bottom" : "Right Top"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}), c = a(() => [
|
|
9
21
|
{
|
|
10
22
|
classes: "guido-text-block-onboarding-settings",
|
|
11
23
|
right: "450px",
|
|
12
|
-
top:
|
|
13
|
-
position:
|
|
14
|
-
title:
|
|
15
|
-
description:
|
|
24
|
+
top: e.value.settings.top,
|
|
25
|
+
position: e.value.settings.position,
|
|
26
|
+
title: i("email-editor.onboarding-text-block-title"),
|
|
27
|
+
description: i("email-editor.onboarding-text-block-description"),
|
|
16
28
|
imageSource: "",
|
|
17
29
|
backButtonClick: () => {
|
|
18
30
|
},
|
|
19
31
|
nextButtonType: "text",
|
|
20
|
-
nextButtonText:
|
|
32
|
+
nextButtonText: i("products.next"),
|
|
21
33
|
nextButtonClick: () => {
|
|
22
34
|
o.next("textBlockOnboarding");
|
|
23
35
|
}
|
|
@@ -25,38 +37,38 @@ const C = /* @__PURE__ */ d({
|
|
|
25
37
|
{
|
|
26
38
|
classes: "guido-text-block-onboarding-dynamic",
|
|
27
39
|
right: "450px",
|
|
28
|
-
top:
|
|
29
|
-
position:
|
|
30
|
-
title:
|
|
31
|
-
description:
|
|
40
|
+
top: e.value.dynamic.top,
|
|
41
|
+
position: e.value.dynamic.position,
|
|
42
|
+
title: i("email-editor.onboarding-dynamic-content-title"),
|
|
43
|
+
description: i("email-editor.onboarding-dynamic-content-description"),
|
|
32
44
|
imageSource: "",
|
|
33
45
|
backButtonType: "text",
|
|
34
|
-
backButtonText:
|
|
46
|
+
backButtonText: i("ds-steps.back"),
|
|
35
47
|
backButtonClick: () => {
|
|
36
48
|
o.previous("textBlockOnboarding");
|
|
37
49
|
},
|
|
38
50
|
nextButtonType: "text",
|
|
39
|
-
nextButtonText:
|
|
51
|
+
nextButtonText: i("action-builder.ok"),
|
|
40
52
|
nextButtonClick: () => {
|
|
41
53
|
o.close("textBlockOnboarding");
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
|
-
]),
|
|
45
|
-
var t,
|
|
46
|
-
(
|
|
47
|
-
},
|
|
48
|
-
var t,
|
|
49
|
-
(
|
|
56
|
+
]), l = a(() => o.onboardings.textBlockOnboarding.config.length > 0 && o.onboardings.textBlockOnboarding.isActive), p = () => {
|
|
57
|
+
var t, n;
|
|
58
|
+
(n = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.nextButtonClick) == null || n.call(t);
|
|
59
|
+
}, x = () => {
|
|
60
|
+
var t, n;
|
|
61
|
+
(n = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.backButtonClick) == null || n.call(t);
|
|
50
62
|
};
|
|
51
|
-
return
|
|
63
|
+
return b(
|
|
52
64
|
() => o.isActive("textBlockOnboarding"),
|
|
53
65
|
(t) => {
|
|
54
|
-
t && o.setConfig("textBlockOnboarding",
|
|
66
|
+
t && o.setConfig("textBlockOnboarding", c.value);
|
|
55
67
|
},
|
|
56
68
|
{ immediate: !0 }
|
|
57
|
-
), { __sfc: !0, trans:
|
|
69
|
+
), { __sfc: !0, trans: i, onboardingStore: o, dynamicPosition: e, onboardingCardsConfig: c, isVisible: l, handleNext: p, handleBack: x, InOnboard: B };
|
|
58
70
|
}
|
|
59
71
|
});
|
|
60
72
|
export {
|
|
61
|
-
|
|
73
|
+
y as default
|
|
62
74
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent as c, computed as e, watch as g } from "vue";
|
|
2
2
|
import { useTranslations as b } from "../../../composables/useTranslations.js";
|
|
3
|
-
import { useOnboardingStore as
|
|
4
|
-
import { InOnboard as
|
|
3
|
+
import { useOnboardingStore as u } from "../../../stores/onboarding.js";
|
|
4
|
+
import { InOnboard as l } from "@useinsider/design-system-vue";
|
|
5
5
|
const C = /* @__PURE__ */ c({
|
|
6
6
|
__name: "VersionHistoryOnboarding",
|
|
7
|
-
setup(
|
|
8
|
-
const t = b(), n =
|
|
7
|
+
setup(p) {
|
|
8
|
+
const t = b(), n = u(), r = e(() => [
|
|
9
9
|
{
|
|
10
10
|
classes: "guido-version-history-onboarding",
|
|
11
11
|
left: "409px",
|
|
@@ -17,7 +17,7 @@ const C = /* @__PURE__ */ c({
|
|
|
17
17
|
backButtonClick: () => {
|
|
18
18
|
},
|
|
19
19
|
nextButtonType: "text",
|
|
20
|
-
nextButtonText: t("
|
|
20
|
+
nextButtonText: t("action-builder.ok"),
|
|
21
21
|
nextButtonClick: () => void n.close("versionHistoryOnboarding")
|
|
22
22
|
}
|
|
23
23
|
]), s = e(() => n.onboardings.versionHistoryOnboarding.config.length > 0 && n.onboardings.versionHistoryOnboarding.isActive), a = () => {
|
|
@@ -29,7 +29,7 @@ const C = /* @__PURE__ */ c({
|
|
|
29
29
|
};
|
|
30
30
|
return g(() => n.onboardings.versionHistoryOnboarding.isActive, (o) => {
|
|
31
31
|
o && n.setConfig("versionHistoryOnboarding", r.value);
|
|
32
|
-
}, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n, onboardingCardsConfig: r, isVisible: s, handleNext: a, handleBack: d, InOnboard:
|
|
32
|
+
}, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n, onboardingCardsConfig: r, isVisible: s, handleNext: a, handleBack: d, InOnboard: l };
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
export {
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import S from "../static/styles/base.css.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import m from "../static/styles/components/alert-message.css.js";
|
|
3
|
+
import e from "../static/styles/components/amp-block.css.js";
|
|
4
4
|
import i from "../static/styles/components/base-input.css.js";
|
|
5
5
|
import p from "../static/styles/components/button-group.css.js";
|
|
6
6
|
import n from "../static/styles/components/button.css.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import C from "../static/styles/components/combobox.css.js";
|
|
8
|
+
import s from "../static/styles/components/counter.css.js";
|
|
9
9
|
import f from "../static/styles/components/dropdown-menu.css.js";
|
|
10
10
|
import a from "../static/styles/components/loader.css.js";
|
|
11
11
|
import u from "../static/styles/components/narrow-panel.css.js";
|
|
12
|
-
import c from "../static/styles/components/
|
|
13
|
-
import d from "../static/styles/components/
|
|
14
|
-
import l from "../static/styles/components/
|
|
15
|
-
import h from "../static/styles/components/
|
|
16
|
-
import w from "../static/styles/components/
|
|
17
|
-
import y from "../static/styles/
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
import c from "../static/styles/components/notification.css.js";
|
|
13
|
+
import d from "../static/styles/components/popup.css.js";
|
|
14
|
+
import l from "../static/styles/components/switcher.css.js";
|
|
15
|
+
import h from "../static/styles/components/tabs.css.js";
|
|
16
|
+
import w from "../static/styles/components/tools.css.js";
|
|
17
|
+
import y from "../static/styles/components/version-history.css.js";
|
|
18
|
+
import B from "../static/styles/components/wide-panel.css.js";
|
|
19
|
+
import b from "../static/styles/variables.css.js";
|
|
20
|
+
const A = [
|
|
21
|
+
b,
|
|
20
22
|
// Must be on top
|
|
21
23
|
S,
|
|
22
24
|
// Must be on top
|
|
23
|
-
e,
|
|
24
25
|
m,
|
|
26
|
+
e,
|
|
25
27
|
i,
|
|
26
28
|
p,
|
|
27
29
|
n,
|
|
28
|
-
s,
|
|
29
30
|
C,
|
|
31
|
+
s,
|
|
30
32
|
f,
|
|
31
33
|
a,
|
|
32
34
|
u,
|
|
@@ -34,12 +36,14 @@ const B = [
|
|
|
34
36
|
d,
|
|
35
37
|
l,
|
|
36
38
|
h,
|
|
37
|
-
w
|
|
39
|
+
w,
|
|
40
|
+
y,
|
|
41
|
+
B
|
|
38
42
|
].join(`
|
|
39
43
|
|
|
40
|
-
`),
|
|
44
|
+
`), F = () => ({ importCss: () => {
|
|
41
45
|
const o = new CSSStyleSheet();
|
|
42
|
-
o.replaceSync(
|
|
46
|
+
o.replaceSync(A);
|
|
43
47
|
const r = document.querySelector("ui-editor");
|
|
44
48
|
if (!r)
|
|
45
49
|
return;
|
|
@@ -47,5 +51,5 @@ const B = [
|
|
|
47
51
|
t && (t.adoptedStyleSheets = [o]);
|
|
48
52
|
} });
|
|
49
53
|
export {
|
|
50
|
-
|
|
54
|
+
F as useCustomInterfaceAppearance
|
|
51
55
|
};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { defaultHtmlCompilerRules as t } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { outlookCompilerRules as p } from "../config/compiler/outlookCompilerRules.js";
|
|
3
|
+
import { recommendationCompilerRules as s } from "../config/compiler/recommendationCompilerRules.js";
|
|
4
|
+
import { socialCompilerRules as u } from "../config/compiler/socialCompilerRules.js";
|
|
5
|
+
import { unsubscribeCompilerRules as n } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
6
|
+
import { createHtmlCompiler as c } from "../utils/htmlCompiler.js";
|
|
7
|
+
import { useConfig as f } from "./useConfig.js";
|
|
8
|
+
const h = () => {
|
|
9
|
+
const { config: e } = f(), l = e.htmlCompilerRules || [], m = [
|
|
10
|
+
...!!e.ignoreDefaultHtmlCompilerRules ? [] : t,
|
|
11
|
+
...s,
|
|
12
|
+
...n,
|
|
13
|
+
...p,
|
|
14
|
+
...u,
|
|
7
15
|
...l.map((o, i) => ({
|
|
8
16
|
...o,
|
|
9
17
|
priority: o.priority + 1e3 + i
|
|
10
18
|
// Ensure additional rules run after default rules
|
|
11
19
|
}))
|
|
12
|
-
],
|
|
13
|
-
return { compileHtml: (o) =>
|
|
20
|
+
], r = c(m);
|
|
21
|
+
return { compileHtml: (o) => r.compile(o) };
|
|
14
22
|
};
|
|
15
23
|
export {
|
|
16
|
-
|
|
24
|
+
h as useHtmlCompiler
|
|
17
25
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useConfig as V } from "./useConfig.js";
|
|
2
|
+
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
3
|
+
import { DISPLAY_CONDITIONS_REGEX as O, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as B, CampaignCouldNotBeSavedKey as _, CanNotMakeAnyChangesForRunningKey as R } from "../enums/html-validator.js";
|
|
4
|
+
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
+
import { useRecommendationStore as D } from "../stores/recommendation.js";
|
|
6
|
+
import { base64EncodeWithSpecialChars as P } from "../utils/base64.js";
|
|
7
|
+
import { useHttp as X } from "./useHttp.js";
|
|
8
|
+
import { useToaster as j } from "./useToaster.js";
|
|
9
|
+
import { useTranslations as z } from "./useTranslations.js";
|
|
10
|
+
const tt = () => {
|
|
11
|
+
var d;
|
|
12
|
+
const { showToaster: a } = j(), { post: y } = X(), { config: C } = V(), i = z(), m = D(), f = ((d = C.partner) == null ? void 0 : d.messageType) === H.transactional, h = async (t) => {
|
|
13
|
+
const e = await y(
|
|
14
|
+
"/newsletter/template-library/check-template-html-body",
|
|
15
|
+
{ html: P(t) }
|
|
16
|
+
), { status: n, message: c } = e.data;
|
|
17
|
+
return n || a({
|
|
18
|
+
type: r.Alert,
|
|
19
|
+
message: n === void 0 ? c : i("newsletter.invalid-url-link-for-toaster")
|
|
20
|
+
}), i(_), c === i(R) && a({
|
|
21
|
+
type: r.Alert,
|
|
22
|
+
message: i("newsletter.already-in-progress")
|
|
23
|
+
}), n;
|
|
24
|
+
}, v = (t) => !["if", "endif", "else", "elif", "now"].includes(t.toLowerCase()), w = (t) => ["if", "endif"].includes(t.toLowerCase()), S = (t, s) => {
|
|
25
|
+
const e = t.match(/({%(.*?)%})/g);
|
|
26
|
+
let n = !0;
|
|
27
|
+
return e !== null && !f && e.forEach((c) => {
|
|
28
|
+
const o = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
29
|
+
if (o && o.length > 0) {
|
|
30
|
+
const [l] = o;
|
|
31
|
+
v(l) && !s.includes(l) && (a({
|
|
32
|
+
type: r.Warning,
|
|
33
|
+
message: i("custom-fields.invalid-custom-fields")
|
|
34
|
+
}), n = !1);
|
|
35
|
+
}
|
|
36
|
+
}), n;
|
|
37
|
+
}, E = async (t, s, e) => {
|
|
38
|
+
const n = e ? await h(t) : !0;
|
|
39
|
+
return S(t, s) && n;
|
|
40
|
+
}, T = (t) => t.length > 0 ? !0 : (a({
|
|
41
|
+
type: r.Warning,
|
|
42
|
+
message: i("newsletter.html-content-is-empty")
|
|
43
|
+
}), !1), I = (t) => {
|
|
44
|
+
const s = (t.match(/{/gm) || []).length, e = (t.match(/}/gm) || []).length;
|
|
45
|
+
return s > e && a({
|
|
46
|
+
type: r.Warning,
|
|
47
|
+
message: i("custom-fields.missing-closing-braces")
|
|
48
|
+
}), s < e && a({
|
|
49
|
+
type: r.Warning,
|
|
50
|
+
message: i("custom-fields.missing-opening-braces")
|
|
51
|
+
}), s === e;
|
|
52
|
+
}, A = (t) => {
|
|
53
|
+
const s = t.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
54
|
+
return s || a({
|
|
55
|
+
type: r.Warning,
|
|
56
|
+
message: i("custom-fields.invalid-custom-fields")
|
|
57
|
+
}), s;
|
|
58
|
+
}, W = (t, s) => {
|
|
59
|
+
const e = t.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
60
|
+
if (e && !f) {
|
|
61
|
+
const n = s.map((o) => o.toLowerCase()), c = e.some((o) => {
|
|
62
|
+
const l = o.replace("{{", "").replace("}}", "").trim().toLowerCase();
|
|
63
|
+
return !n.includes(l) || l === "";
|
|
64
|
+
});
|
|
65
|
+
return c && a({
|
|
66
|
+
type: r.Warning,
|
|
67
|
+
message: i("custom-fields.invalid-custom-fields")
|
|
68
|
+
}), !c;
|
|
69
|
+
}
|
|
70
|
+
return !0;
|
|
71
|
+
}, x = (t) => {
|
|
72
|
+
const s = t.match(/{%(.*?)%}/g), e = [];
|
|
73
|
+
let n = !0;
|
|
74
|
+
if (s && s.forEach((c) => {
|
|
75
|
+
const o = c.match(O), l = c.match(B), L = (o == null ? void 0 : o.join("")) || "";
|
|
76
|
+
(!o || c !== L) && !l && (a({
|
|
77
|
+
type: r.Alert,
|
|
78
|
+
message: i("newsletter.display-conditions-invalid-syntax")
|
|
79
|
+
}), n = !1), o && o.forEach((u) => {
|
|
80
|
+
u.trim() === "=" && (a({
|
|
81
|
+
type: r.Alert,
|
|
82
|
+
message: i("custom-conditions.wrong-equality-operators")
|
|
83
|
+
}), n = !1);
|
|
84
|
+
const g = u.match(/^[a-zA-Z]*$/g);
|
|
85
|
+
g && g.forEach((p) => {
|
|
86
|
+
w(p) && e.push(p);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}), e.length) {
|
|
90
|
+
const c = e.filter((l) => l === "if"), o = e.filter((l) => l === "endif");
|
|
91
|
+
c.length !== o.length && (a({
|
|
92
|
+
type: r.Alert,
|
|
93
|
+
message: i("custom-conditions.missing-if-endif-tag")
|
|
94
|
+
}), n = !1);
|
|
95
|
+
}
|
|
96
|
+
return n;
|
|
97
|
+
}, b = (t) => {
|
|
98
|
+
const s = (t.match(/{% /gm) || []).length, e = (t.match(/ %}/gm) || []).length, n = s === e;
|
|
99
|
+
return n || a({
|
|
100
|
+
type: r.Warning,
|
|
101
|
+
message: i("custom-conditions.no-space-after-braces")
|
|
102
|
+
}), n;
|
|
103
|
+
}, N = (t) => (t.match(/({%(.*?)%})/g) || []).filter((e) => e.includes("if")).map((e) => (e.match(/{{.*}}/gm) || []).length).reduce((e, n) => e + n, 0) > 0 ? (a({
|
|
104
|
+
type: r.Warning,
|
|
105
|
+
message: i("custom-conditions.no-braces-inside-if-tag")
|
|
106
|
+
}), !1) : !0, k = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((e) => e.value === "")) !== void 0 ? (a({
|
|
107
|
+
type: r.Alert,
|
|
108
|
+
message: i("newsletter.fill-all-necessary-fields")
|
|
109
|
+
}), !1) : !0, F = (t) => {
|
|
110
|
+
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
111
|
+
return t.match(s) === null ? !0 : (a({
|
|
112
|
+
type: r.Alert,
|
|
113
|
+
message: i("newsletter.invalid-image-type")
|
|
114
|
+
}), !1);
|
|
115
|
+
};
|
|
116
|
+
return { validateHtml: async (t, s, e = !1) => await E(t, s, e) && T(t) && I(t) && A(t) && W(t, s) && x(t) && b(t) && N(t) && k() && F(t) };
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
tt as useHtmlValidator
|
|
120
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type CardWidthParams = {
|
|
2
|
+
mobileLeftPadding: number;
|
|
3
|
+
mobileRightPadding: number;
|
|
4
|
+
cardsInRow: number;
|
|
5
|
+
unresponsive: boolean;
|
|
6
|
+
};
|
|
7
|
+
interface CampaignData extends CardWidthParams {
|
|
8
|
+
textTrimming: boolean;
|
|
9
|
+
orientation: string;
|
|
10
|
+
priceBeforeTextValue: string;
|
|
11
|
+
priceAfterTextValue: string;
|
|
12
|
+
discountBeforeTextValue: string;
|
|
13
|
+
discountAfterTextValue: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const useRecommendation: () => {
|
|
16
|
+
calculateCardWidth: ({ mobileLeftPadding, mobileRightPadding, cardsInRow, unresponsive, }: CardWidthParams) => number;
|
|
17
|
+
getRecommendationCampaignData: (id: string) => CampaignData;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MinDeviceViewport as r, DefaultPadding as c } from "../enums/recommendation.js";
|
|
2
|
+
const m = () => ({
|
|
3
|
+
calculateCardWidth: ({
|
|
4
|
+
mobileLeftPadding: e,
|
|
5
|
+
mobileRightPadding: a,
|
|
6
|
+
cardsInRow: n,
|
|
7
|
+
unresponsive: i
|
|
8
|
+
}) => {
|
|
9
|
+
const t = i ? n : 1, o = e + a + (t - 1) * c;
|
|
10
|
+
return (r - o) / t;
|
|
11
|
+
},
|
|
12
|
+
getRecommendationCampaignData: (e) => (console.debug(e), {
|
|
13
|
+
textTrimming: !1,
|
|
14
|
+
orientation: "vertical",
|
|
15
|
+
mobileLeftPadding: 0,
|
|
16
|
+
mobileRightPadding: 0,
|
|
17
|
+
cardsInRow: 2,
|
|
18
|
+
unresponsive: !1,
|
|
19
|
+
priceBeforeTextValue: "",
|
|
20
|
+
priceAfterTextValue: "",
|
|
21
|
+
discountBeforeTextValue: "",
|
|
22
|
+
discountAfterTextValue: ""
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
m as useRecommendation
|
|
27
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useSaveStart as i, useSaveComplete as l } from "./useGuidoActions.js";
|
|
2
|
+
import { useTemplatePreparation as m } from "../utils/templatePreparation.js";
|
|
3
|
+
import { useHtmlValidator as n } from "./useHtmlValidator.js";
|
|
4
|
+
const f = () => {
|
|
5
|
+
const e = i(), a = l(), { validateHtml: s } = n();
|
|
6
|
+
return { save: async (o = !1) => {
|
|
7
|
+
e();
|
|
8
|
+
const { prepareTemplateDetails: r } = m(), t = await r();
|
|
9
|
+
if (await s(t.compiledHtml, [], !0))
|
|
10
|
+
return o || a(t), t;
|
|
11
|
+
} };
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
f as useSave
|
|
15
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useCustomInterfaceAppearance as
|
|
3
|
-
import { useStripoEventHandler as
|
|
4
|
-
import { useToaster as
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
|
|
3
|
+
import { useStripoEventHandler as C } from "./useStripoEventHandler.js";
|
|
4
|
+
import { useToaster as E } from "./useToaster.js";
|
|
5
5
|
import { displayConditions as y } from "../enums/displayConditions.js";
|
|
6
6
|
import h from "../extensions/DynamicContent/extension.js";
|
|
7
7
|
import { useStripoApi as w } from "../services/stripoApi.js";
|
|
8
8
|
import b from "../static/styles/customEditorStyle.css.js";
|
|
9
9
|
import { useEditorStore as V } from "../stores/editor.js";
|
|
10
10
|
import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
|
|
11
|
-
const
|
|
12
|
-
const { handleError: d } =
|
|
13
|
-
const
|
|
11
|
+
const R = (s) => {
|
|
12
|
+
const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = w(), { handleEvent: l } = C(), p = (r, i = []) => {
|
|
13
|
+
const e = V(), { html: o, css: a, forceRecreate: g } = r;
|
|
14
14
|
window.UIEditor.initEditor(
|
|
15
15
|
document.querySelector("#guido-editor"),
|
|
16
16
|
{
|
|
17
|
-
metadata:
|
|
18
|
-
html:
|
|
19
|
-
css:
|
|
17
|
+
metadata: s,
|
|
18
|
+
html: o,
|
|
19
|
+
css: a,
|
|
20
20
|
forceRecreate: g,
|
|
21
21
|
locale: "en",
|
|
22
22
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -41,7 +41,7 @@ const x = (a) => {
|
|
|
41
41
|
},
|
|
42
42
|
mergeTags: [
|
|
43
43
|
{
|
|
44
|
-
entries: _(
|
|
44
|
+
entries: _(s.preselectedDynamicContentList)
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
47
|
async onTokenRefreshRequest(t) {
|
|
@@ -54,41 +54,43 @@ const x = (a) => {
|
|
|
54
54
|
},
|
|
55
55
|
onTemplateLoaded() {
|
|
56
56
|
try {
|
|
57
|
-
const { importCss: t } =
|
|
58
|
-
t(), n(),
|
|
57
|
+
const { importCss: t } = S(), { activateCustomViewStyles: n } = f();
|
|
58
|
+
t(), n(), s.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
59
|
+
e.hasChanges = !1;
|
|
60
|
+
}, 1e3);
|
|
59
61
|
} catch (t) {
|
|
60
62
|
d(t, "Failed to load custom interface appearance");
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
65
|
onCodeEditorVisibilityChanged(t) {
|
|
64
|
-
|
|
66
|
+
e.isCodeEditorOpen = t;
|
|
65
67
|
},
|
|
66
68
|
onEditorVisualModeChanged(t) {
|
|
67
|
-
|
|
69
|
+
e.editorVisualMode = t.toLowerCase();
|
|
68
70
|
},
|
|
69
71
|
onVersionHistoryVisibilityChanged(t) {
|
|
70
|
-
|
|
72
|
+
e.isVersionHistoryOpen = t;
|
|
71
73
|
},
|
|
72
74
|
onDataChanged() {
|
|
73
|
-
|
|
75
|
+
e.hasChanges = !0;
|
|
74
76
|
},
|
|
75
77
|
onEvent: l,
|
|
76
78
|
ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
|
|
77
79
|
extensions: [h]
|
|
78
80
|
}
|
|
79
81
|
);
|
|
80
|
-
}, m = (r) => new Promise((i,
|
|
82
|
+
}, m = (r) => new Promise((i, e) => {
|
|
81
83
|
if (document.getElementById("UiEditorScript")) {
|
|
82
84
|
r(), i();
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
+
const o = document.createElement("script");
|
|
88
|
+
o.id = "UiEditorScript", o.type = "module", o.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o.onload = () => {
|
|
87
89
|
r(), i();
|
|
88
|
-
},
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}, document.body.appendChild(
|
|
90
|
+
}, o.onerror = () => {
|
|
91
|
+
const a = new Error("Failed to load Stripo UIEditor script");
|
|
92
|
+
e(a);
|
|
93
|
+
}, document.body.appendChild(o);
|
|
92
94
|
});
|
|
93
95
|
return { initPlugin: async (r) => {
|
|
94
96
|
await m(async () => {
|
|
@@ -98,5 +100,5 @@ const x = (a) => {
|
|
|
98
100
|
} };
|
|
99
101
|
};
|
|
100
102
|
export {
|
|
101
|
-
|
|
103
|
+
R as useStripo
|
|
102
104
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { useToasterStore as
|
|
3
|
-
import { watch as c
|
|
4
|
-
const
|
|
5
|
-
const t =
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
2
|
+
import { useToasterStore as u } from "../stores/toaster.js";
|
|
3
|
+
import { watch as c } from "vue";
|
|
4
|
+
const d = () => {
|
|
5
|
+
const t = u();
|
|
6
|
+
let o = null;
|
|
7
|
+
const s = () => {
|
|
8
|
+
o && (clearTimeout(o), o = null);
|
|
9
9
|
};
|
|
10
10
|
function r(e = { message: "" }) {
|
|
11
|
-
|
|
11
|
+
s(), t.hideToaster(), t.showToaster(e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function i() {
|
|
14
|
+
s(), t.hideToaster();
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function a(e, n) {
|
|
17
17
|
const m = e instanceof Error ? e.message : String(e);
|
|
18
|
-
r({ type:
|
|
18
|
+
r({ type: T.Alert, message: `${n}: ${m}` });
|
|
19
19
|
}
|
|
20
20
|
return c(
|
|
21
21
|
() => t.shouldAutoHide,
|
|
22
22
|
(e) => {
|
|
23
|
-
|
|
24
|
-
t.hideToaster(),
|
|
23
|
+
s(), e && (o = setTimeout(() => {
|
|
24
|
+
t.hideToaster(), s();
|
|
25
25
|
}, 6e3));
|
|
26
26
|
}
|
|
27
|
-
),
|
|
27
|
+
), { showToaster: r, hideToaster: i, handleError: a };
|
|
28
28
|
};
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
d as useToaster
|
|
31
31
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const c = `
|
|
2
|
+
<!--[if gte mso 9]>
|
|
3
|
+
<xml>
|
|
4
|
+
<o:OfficeDocumentSettings>
|
|
5
|
+
<o:AllowPNG></o:AllowPNG>
|
|
6
|
+
<o:PixelsPerInch>96</o:PixelsPerInch>
|
|
7
|
+
</o:OfficeDocumentSettings>
|
|
8
|
+
</xml>
|
|
9
|
+
<![endif]-->`, s = {
|
|
10
|
+
xmlns: "http://www.w3.org/1999/xhtml",
|
|
11
|
+
"xmlns:o": "urn:schemas-microsoft-com:office:office"
|
|
12
|
+
}, r = [
|
|
13
|
+
{
|
|
14
|
+
id: "append-office-xml",
|
|
15
|
+
description: "Appending office XML into the head if it does not exist.",
|
|
16
|
+
type: "custom",
|
|
17
|
+
processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${c}</head>`),
|
|
18
|
+
priority: 70
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "set-html-attributes",
|
|
22
|
+
description: "Appending office XML into the head if it does not exist.",
|
|
23
|
+
type: "custom",
|
|
24
|
+
processor: (e) => {
|
|
25
|
+
let t = e;
|
|
26
|
+
return Object.entries(s).forEach(([o, i]) => {
|
|
27
|
+
const n = new RegExp(`${o}="[^"]*"`);
|
|
28
|
+
t.search(n) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
|
|
29
|
+
}), t;
|
|
30
|
+
},
|
|
31
|
+
priority: 71
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
export {
|
|
35
|
+
r as outlookCompilerRules
|
|
36
|
+
};
|