@useinsider/guido 3.2.0-beta.e01b42a → 3.2.0
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 +1 -0
- package/dist/@types/config/schemas.js +66 -54
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useSave.js +23 -15
- package/dist/composables/useStripo.js +44 -41
- package/dist/composables/validators/useLiquidValidator.js +42 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/recommendationCompilerRules.js +158 -44
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- package/dist/enums/extensions/recommendationBlock.js +14 -11
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +94 -92
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +31 -31
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +28 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/composables/useConfig.d.ts +12 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/config.d.ts +108 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/genericUtil.d.ts +1 -1
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/dist/stores/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +36 -25
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +4 -4
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
1
|
+
import { defineComponent as O, ref as n, computed as h } from "vue";
|
|
2
|
+
import { useActionsApi as q } from "../../../composables/useActionsApi.js";
|
|
3
|
+
import { useConfig as b } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as k } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTestEmailClick as B } from "../../../composables/useGuidoActions.js";
|
|
6
|
+
import { useHtmlCompiler as D } from "../../../composables/useHtmlCompiler.js";
|
|
7
|
+
import { useSave as F } from "../../../composables/useSave.js";
|
|
8
|
+
import { useTranslations as L } from "../../../composables/useTranslations.js";
|
|
9
|
+
import { useVersionHistoryApi as R } from "../../../composables/useVersionHistoryApi.js";
|
|
10
|
+
import { useLiquidValidator as z } from "../../../composables/validators/useLiquidValidator.js";
|
|
11
|
+
import { useEditorStore as I } from "../../../stores/editor.js";
|
|
12
|
+
import { useTemplateStore as P } from "../../../stores/template.js";
|
|
13
|
+
import { getTooltipOptions as j } from "../../../utils/tooltipUtils.js";
|
|
14
|
+
import { InButtonV2 as G } from "@useinsider/design-system-vue";
|
|
15
|
+
import { storeToRefs as J } from "pinia";
|
|
16
|
+
import K from "./MigrationConfirmModal.vue.js";
|
|
17
|
+
const ut = /* @__PURE__ */ O({
|
|
15
18
|
__name: "EditorActions",
|
|
16
|
-
setup(
|
|
17
|
-
const { config: a } =
|
|
19
|
+
setup(N, { expose: x }) {
|
|
20
|
+
const { config: a, isFeatureEnabled: l } = b(), { exportHtml: m } = k(), { save: u } = F(), { openVersionHistory: c, closeVersionHistory: p } = R(), { getCompiledEmail: f } = q(), { compileHtml: d } = D(), { validateLiquidSyntax: v } = z(), e = I(), y = P(), { hasMigrations: S } = J(y), s = L(), i = n(!1), r = n(!1), g = n(), H = B(), T = () => {
|
|
18
21
|
if (e.isVersionHistoryOpen) {
|
|
19
|
-
|
|
22
|
+
p();
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
+
c();
|
|
26
|
+
}, w = async () => {
|
|
27
|
+
i.value = !0, await m(), i.value = !1;
|
|
25
28
|
}, _ = () => {
|
|
26
29
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
27
|
-
},
|
|
30
|
+
}, C = h(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), A = h(
|
|
28
31
|
() => {
|
|
29
|
-
var
|
|
30
|
-
return ((
|
|
32
|
+
var t, o;
|
|
33
|
+
return ((o = (t = a.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
31
34
|
}
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
var
|
|
38
|
-
if (!
|
|
39
|
-
(
|
|
35
|
+
), V = async (t) => {
|
|
36
|
+
r.value = !0, e.loadingStatus = !0;
|
|
37
|
+
const o = await u(t);
|
|
38
|
+
return r.value = !1, (t || !o) && (e.loadingStatus = !1), o;
|
|
39
|
+
}, E = (t) => {
|
|
40
|
+
var o;
|
|
41
|
+
if (!t && S.value) {
|
|
42
|
+
(o = g.value) == null || o.open();
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
|
-
return
|
|
45
|
+
return V(t);
|
|
46
|
+
}, M = async () => {
|
|
47
|
+
if (l("liquidSyntax")) {
|
|
48
|
+
e.loadingStatus = !0;
|
|
49
|
+
try {
|
|
50
|
+
const { html: t } = await f({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = d(t);
|
|
51
|
+
if (!await v(o))
|
|
52
|
+
return;
|
|
53
|
+
} finally {
|
|
54
|
+
e.loadingStatus = !1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
H();
|
|
43
58
|
};
|
|
44
|
-
return
|
|
45
|
-
handleSave:
|
|
46
|
-
}), { __sfc: !0, config: a, exportHtml: m, save:
|
|
59
|
+
return x({
|
|
60
|
+
handleSave: E
|
|
61
|
+
}), { __sfc: !0, config: a, isFeatureEnabled: l, exportHtml: m, save: u, openVersionHistory: c, closeVersionHistory: p, getCompiledEmail: f, compileHtml: d, validateLiquidSyntax: v, editorStore: e, templateStore: y, hasMigrations: S, trans: s, isExporting: i, isSaving: r, migrationModalRef: g, testEmailClick: H, handleVersionHistory: T, handleExport: w, handleSaveAs: _, versionHistoryTooltipText: C, isVersionHistoryButtonVisible: A, executeSave: V, handleSave: E, handleTestEmail: M, getTooltipOptions: j, InButtonV2: G, MigrationConfirmModal: K };
|
|
47
62
|
}
|
|
48
63
|
});
|
|
49
64
|
export {
|
|
50
|
-
|
|
65
|
+
ut as default
|
|
51
66
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return
|
|
6
|
-
},
|
|
7
|
-
o,
|
|
8
|
-
n,
|
|
1
|
+
import i from "./RightSlot.vue2.js";
|
|
2
|
+
import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var o = function() {
|
|
4
|
+
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
5
|
+
return e("div", { staticClass: "d-f a-i-c" }, [t.isLiquidEnabled && !t.editorStore.isVersionHistoryOpen ? e(t.InChips, { staticClass: "mr-3", attrs: { id: "guido__liquid-tag-chip", styles: "stroke", type: "default", value: "liquid-tags", "close-button": !1, "disabled-status": t.editorStore.loadingStatus, interactive: !1, text: t.trans("email-editor.liquid-tags-enabled") } }) : s._e(), t.editorStore.isVersionHistoryOpen ? e(t.RestoreButton) : e(t.EditorActions, { ref: "editorActionsRef" })], 1);
|
|
6
|
+
}, a = [], n = /* @__PURE__ */ r(
|
|
9
7
|
i,
|
|
8
|
+
o,
|
|
9
|
+
a,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
12
12
|
null
|
|
13
13
|
);
|
|
14
|
-
const
|
|
14
|
+
const u = n.exports;
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
u as default
|
|
17
17
|
};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { defineComponent as a, ref as f, computed as p } from "vue";
|
|
2
|
+
import { useConfig as u } from "../../../composables/useConfig.js";
|
|
3
|
+
import { useTranslations as d } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { useEditorStore as c } from "../../../stores/editor.js";
|
|
5
|
+
import { InChips as l } from "@useinsider/design-system-vue";
|
|
6
|
+
import _ from "./EditorActions.vue.js";
|
|
7
|
+
import S from "./version-history/RestoreButton.vue.js";
|
|
8
|
+
const x = /* @__PURE__ */ a({
|
|
6
9
|
__name: "RightSlot",
|
|
7
|
-
setup(
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
handleSave: (
|
|
11
|
-
var
|
|
12
|
-
return (
|
|
10
|
+
setup(h, { expose: r }) {
|
|
11
|
+
const { isFeatureEnabled: o } = u(), n = d(), i = c(), t = f(null), s = p(() => o("liquidSyntax"));
|
|
12
|
+
return r({
|
|
13
|
+
handleSave: (m) => {
|
|
14
|
+
var e;
|
|
15
|
+
return (e = t.value) == null ? void 0 : e.handleSave(m);
|
|
13
16
|
}
|
|
14
|
-
}), { __sfc: !0, editorStore:
|
|
17
|
+
}), { __sfc: !0, isFeatureEnabled: o, trans: n, editorStore: i, editorActionsRef: t, isLiquidEnabled: s, InChips: l, EditorActions: _, RestoreButton: S };
|
|
15
18
|
}
|
|
16
19
|
});
|
|
17
20
|
export {
|
|
18
|
-
|
|
21
|
+
x as default
|
|
19
22
|
};
|
|
@@ -10,29 +10,29 @@ import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.j
|
|
|
10
10
|
const H = /* @__PURE__ */ A({
|
|
11
11
|
__name: "SaveAsTemplateDrawer",
|
|
12
12
|
setup(E) {
|
|
13
|
-
const
|
|
13
|
+
const o = O(), n = D(), t = k(), { createTemplate: m } = B(), a = c(!1), r = c(!1), l = c(""), f = b(() => ({
|
|
14
14
|
primaryButton: {
|
|
15
15
|
styling: "solid",
|
|
16
16
|
type: "primary",
|
|
17
|
-
labelText:
|
|
17
|
+
labelText: o(a.value ? "newsletter.saving" : "products.save"),
|
|
18
18
|
loadingStatus: a.value,
|
|
19
19
|
disabledStatus: t.skeletonStatus
|
|
20
20
|
},
|
|
21
21
|
cancelOrBackButton: {
|
|
22
22
|
styling: "ghost",
|
|
23
23
|
type: "secondary",
|
|
24
|
-
labelText:
|
|
24
|
+
labelText: o("products.cancel"),
|
|
25
25
|
disabledStatus: a.value
|
|
26
26
|
}
|
|
27
|
-
})),
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
const e = h(t, "templateName"), { success:
|
|
31
|
-
return
|
|
27
|
+
})), u = () => {
|
|
28
|
+
l.value = "", n.isSaveAsTemplateDrawerOpen = !1;
|
|
29
|
+
}, i = async () => {
|
|
30
|
+
const e = h(t, "templateName"), { success: s, errorMessage: _ } = await x(e).validate();
|
|
31
|
+
return l.value = _, s;
|
|
32
32
|
}, v = V(async (e) => {
|
|
33
|
-
t.templateName = e, await
|
|
33
|
+
t.templateName = e, await i();
|
|
34
34
|
}, 500), g = async (e) => {
|
|
35
|
-
|
|
35
|
+
r.value = !0, await t.addCategory(e), r.value = !1;
|
|
36
36
|
}, y = (e) => {
|
|
37
37
|
t.selectedCategories = e;
|
|
38
38
|
}, S = (e) => {
|
|
@@ -40,22 +40,23 @@ const H = /* @__PURE__ */ A({
|
|
|
40
40
|
}, T = () => {
|
|
41
41
|
t.selectedCategories = [];
|
|
42
42
|
}, w = async () => {
|
|
43
|
-
if (a.value = !0, !await
|
|
43
|
+
if (a.value = !0, !await i()) {
|
|
44
44
|
a.value = !1;
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const s = await m();
|
|
48
|
+
a.value = !1, s && u();
|
|
49
|
+
}, p = () => {
|
|
49
50
|
C(() => {
|
|
50
51
|
const e = document.querySelector("input#guido__template-name-input");
|
|
51
52
|
e == null || e.focus();
|
|
52
53
|
});
|
|
53
54
|
}, d = async () => {
|
|
54
|
-
t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1,
|
|
55
|
+
t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1, p();
|
|
55
56
|
};
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
}), { __sfc: !0, trans:
|
|
57
|
+
return n.$subscribe((e, { isSaveAsTemplateDrawerOpen: s }) => {
|
|
58
|
+
s && d();
|
|
59
|
+
}), { __sfc: !0, trans: o, editorStore: n, saveAsTemplateStore: t, createTemplate: m, isSaving: a, isAddingOption: r, templateNameError: l, footerButtonGroupOptions: f, closeModal: u, validateTemplateName: i, handleTemplateName: v, handleAddOption: g, handleCategoryChange: y, handleSelectAllOptions: S, handleResetAllOptions: T, saveTemplate: w, focusToInput: p, initializeDrawer: d, WpDrawer: N, InBasicTextInput: M, InMultiSelect: I };
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
export {
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
...
|
|
16
|
-
...c,
|
|
1
|
+
import { defaultHtmlCompilerRules as c } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as R } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
|
|
5
|
+
import { recommendationCompilerRules as d } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
+
import { socialCompilerRules as b } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { useConfig as v } from "./useConfig.js";
|
|
10
|
+
const w = () => {
|
|
11
|
+
var l, m, r;
|
|
12
|
+
const { compiler: e, isFeatureEnabled: t, partner: i } = v(), s = ((l = e.value) == null ? void 0 : l.customRules) || [], u = [
|
|
13
|
+
...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : c,
|
|
14
|
+
...d,
|
|
15
|
+
...g,
|
|
17
16
|
...f,
|
|
18
|
-
...
|
|
17
|
+
...C,
|
|
18
|
+
...b,
|
|
19
|
+
...t("liquidSyntax") ? R : [],
|
|
20
|
+
...s.map((o, a) => ({
|
|
19
21
|
...o,
|
|
20
|
-
priority: o.priority + 1e3 +
|
|
22
|
+
priority: o.priority + 1e3 + a
|
|
21
23
|
// Ensure additional rules run after default rules
|
|
22
24
|
}))
|
|
23
|
-
],
|
|
24
|
-
return { compileHtml: (o) =>
|
|
25
|
+
], p = H(u), n = (r = i.value) == null ? void 0 : r.fallbackFont;
|
|
26
|
+
return { compileHtml: (o) => p.compile(o, void 0, n) };
|
|
25
27
|
};
|
|
26
28
|
export {
|
|
27
|
-
|
|
29
|
+
w as useHtmlCompiler
|
|
28
30
|
};
|
|
@@ -9,76 +9,76 @@ import { useHttp as j } from "./useHttp.js";
|
|
|
9
9
|
import { useToaster as q } from "./useToaster.js";
|
|
10
10
|
import { useTranslations as z } from "./useTranslations.js";
|
|
11
11
|
const K = /recommendation-id="(\d+)"/g;
|
|
12
|
-
function U(
|
|
13
|
-
return [...
|
|
12
|
+
function U(a) {
|
|
13
|
+
return [...a.matchAll(K)].map((u) => u[1]);
|
|
14
14
|
}
|
|
15
|
-
function Y(
|
|
16
|
-
return u.some((d) =>
|
|
15
|
+
function Y(a, u) {
|
|
16
|
+
return u.some((d) => a.startsWith(`${d}_`));
|
|
17
17
|
}
|
|
18
18
|
const ce = () => {
|
|
19
19
|
var y, h;
|
|
20
|
-
const { showToaster:
|
|
20
|
+
const { showToaster: a } = q(), { post: u } = j(), { config: d } = L(), r = z(), g = $(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === V.transactional, b = async (e) => {
|
|
21
21
|
const t = await u(
|
|
22
22
|
"/newsletter/template-library/check-template-html-body",
|
|
23
23
|
{ html: X(e) }
|
|
24
24
|
), { status: n, message: l } = t.data;
|
|
25
|
-
return n ||
|
|
25
|
+
return n || a({
|
|
26
26
|
type: c.Alert,
|
|
27
27
|
message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
|
|
28
|
-
}), r(P), l === r(G) &&
|
|
28
|
+
}), r(P), l === r(G) && a({
|
|
29
29
|
type: c.Alert,
|
|
30
30
|
message: r("newsletter.already-in-progress")
|
|
31
31
|
}), n;
|
|
32
|
-
},
|
|
32
|
+
}, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), E = (e, s) => {
|
|
33
33
|
const t = e.match(/({%(.*?)%})/g);
|
|
34
34
|
let n = !0;
|
|
35
35
|
return t !== null && !p && t.forEach((l) => {
|
|
36
36
|
const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
37
37
|
if (o && o.length > 0) {
|
|
38
|
-
const [
|
|
39
|
-
|
|
38
|
+
const [i] = o;
|
|
39
|
+
w(i) && !s.includes(i) && (a({
|
|
40
40
|
type: c.Warning,
|
|
41
41
|
message: r("custom-fields.invalid-custom-fields")
|
|
42
42
|
}), n = !1);
|
|
43
43
|
}
|
|
44
44
|
}), n;
|
|
45
45
|
}, A = async (e, s, t) => {
|
|
46
|
-
const n = t ? await
|
|
46
|
+
const n = t ? await b(e) : !0;
|
|
47
47
|
return E(e, s) && n;
|
|
48
|
-
}, I = (e) => e.length > 0 ? !0 : (
|
|
48
|
+
}, I = (e) => e.length > 0 ? !0 : (a({
|
|
49
49
|
type: c.Warning,
|
|
50
50
|
message: r("newsletter.html-content-is-empty")
|
|
51
51
|
}), !1), k = (e) => {
|
|
52
52
|
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
53
|
-
return s > t &&
|
|
53
|
+
return s > t && a({
|
|
54
54
|
type: c.Warning,
|
|
55
55
|
message: r("custom-fields.missing-closing-braces")
|
|
56
|
-
}), s < t &&
|
|
56
|
+
}), s < t && a({
|
|
57
57
|
type: c.Warning,
|
|
58
58
|
message: r("custom-fields.missing-opening-braces")
|
|
59
59
|
}), s === t;
|
|
60
60
|
}, x = (e) => {
|
|
61
61
|
const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
62
|
-
return s ||
|
|
62
|
+
return s || a({
|
|
63
63
|
type: c.Warning,
|
|
64
64
|
message: r("custom-fields.invalid-custom-fields")
|
|
65
65
|
}), s;
|
|
66
66
|
}, T = (e, s) => {
|
|
67
67
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
68
68
|
if (t && !p) {
|
|
69
|
-
const n = new Set(s.map((
|
|
70
|
-
if (t.forEach((
|
|
71
|
-
const m =
|
|
69
|
+
const n = new Set(s.map((i) => i.toLowerCase())), l = U(e), o = [];
|
|
70
|
+
if (t.forEach((i) => {
|
|
71
|
+
const m = i.slice(2, -2).trim().toLowerCase();
|
|
72
72
|
(!n.has(m) || m === "") && !Y(m, l) && o.push(m);
|
|
73
73
|
}), o.length > 0) {
|
|
74
|
-
const
|
|
74
|
+
const i = `
|
|
75
75
|
<ul>
|
|
76
76
|
${o.map((m) => `<li>${m}</li>`).join("")}
|
|
77
77
|
</ul>
|
|
78
78
|
`;
|
|
79
|
-
return
|
|
79
|
+
return a({
|
|
80
80
|
type: c.Alert,
|
|
81
|
-
message: r("custom-fields.invalid-custom-fields") +
|
|
81
|
+
message: r("custom-fields.invalid-custom-fields") + i
|
|
82
82
|
}), !1;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -87,12 +87,12 @@ const ce = () => {
|
|
|
87
87
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
88
88
|
let n = !0;
|
|
89
89
|
if (s && s.forEach((l) => {
|
|
90
|
-
const o = l.match(_),
|
|
91
|
-
(!o || l !== m) && !
|
|
90
|
+
const o = l.match(_), i = l.match(H), m = (o == null ? void 0 : o.join("")) || "";
|
|
91
|
+
(!o || l !== m) && !i && (a({
|
|
92
92
|
type: c.Alert,
|
|
93
93
|
message: r("newsletter.display-conditions-invalid-syntax")
|
|
94
94
|
}), n = !1), o && o.forEach((f) => {
|
|
95
|
-
f.trim() === "=" && (
|
|
95
|
+
f.trim() === "=" && (a({
|
|
96
96
|
type: c.Alert,
|
|
97
97
|
message: r("custom-conditions.wrong-equality-operators")
|
|
98
98
|
}), n = !1);
|
|
@@ -102,8 +102,8 @@ const ce = () => {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
}), t.length) {
|
|
105
|
-
const l = t.filter((
|
|
106
|
-
l.length !== o.length && (
|
|
105
|
+
const l = t.filter((i) => i === "if"), o = t.filter((i) => i === "endif");
|
|
106
|
+
l.length !== o.length && (a({
|
|
107
107
|
type: c.Alert,
|
|
108
108
|
message: r("custom-conditions.missing-if-endif-tag")
|
|
109
109
|
}), n = !1);
|
|
@@ -111,45 +111,47 @@ const ce = () => {
|
|
|
111
111
|
return n;
|
|
112
112
|
}, W = (e) => {
|
|
113
113
|
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
114
|
-
return n ||
|
|
114
|
+
return n || a({
|
|
115
115
|
type: c.Warning,
|
|
116
116
|
message: r("custom-conditions.no-space-after-braces")
|
|
117
117
|
}), n;
|
|
118
|
-
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (
|
|
118
|
+
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
|
|
119
119
|
type: c.Warning,
|
|
120
120
|
message: r("custom-conditions.no-braces-inside-if-tag")
|
|
121
|
-
}), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (
|
|
121
|
+
}), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
|
|
122
122
|
type: c.Alert,
|
|
123
123
|
message: r("newsletter.fill-all-necessary-fields")
|
|
124
124
|
}), !1) : !0, B = (e) => {
|
|
125
125
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
126
|
-
return e.match(s) === null ? !0 : (
|
|
126
|
+
return e.match(s) === null ? !0 : (a({
|
|
127
127
|
type: c.Alert,
|
|
128
128
|
message: r("newsletter.invalid-image-type")
|
|
129
129
|
}), !1);
|
|
130
130
|
}, R = (e) => {
|
|
131
131
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
132
132
|
return Array.from(n).find((o) => {
|
|
133
|
-
var
|
|
134
|
-
return !((
|
|
135
|
-
}) ? (
|
|
133
|
+
var i;
|
|
134
|
+
return !((i = o.id) != null && i.trim());
|
|
135
|
+
}) ? (a({
|
|
136
136
|
type: c.Alert,
|
|
137
137
|
message: r("unsubscribe-templates.select-checkbox-groups")
|
|
138
138
|
}), !1) : !0;
|
|
139
139
|
}, D = (e) => {
|
|
140
140
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
141
141
|
return Array.from(n).find((o) => {
|
|
142
|
-
var
|
|
143
|
-
return !((
|
|
144
|
-
}) ? (
|
|
142
|
+
var i;
|
|
143
|
+
return !((i = o.id) != null && i.trim());
|
|
144
|
+
}) ? (a({
|
|
145
145
|
type: c.Alert,
|
|
146
146
|
message: r("unsubscribe-templates.select-radio-button-groups")
|
|
147
147
|
}), !1) : !0;
|
|
148
148
|
};
|
|
149
149
|
return { validateHtml: async (e, s, t = !1) => {
|
|
150
|
+
var o, i;
|
|
150
151
|
const n = [
|
|
151
|
-
...s.map((
|
|
152
|
-
...M
|
|
152
|
+
...s.map((m) => m.value),
|
|
153
|
+
...M,
|
|
154
|
+
...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
|
|
153
155
|
];
|
|
154
156
|
return await A(e, n, t) && I(e) && k(e) && x(e) && T(e, n) && F(e) && W(e) && N(e) && O() && B(e) && R(e) && D(e);
|
|
155
157
|
} };
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { useEditorStore as
|
|
2
|
-
import { usePreviewStore as
|
|
3
|
-
import { useActionsApi as
|
|
4
|
-
import { useCodeEditorApi as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useEditorStore as d } from "../stores/editor.js";
|
|
2
|
+
import { usePreviewStore as n } from "../stores/preview.js";
|
|
3
|
+
import { useActionsApi as p } from "./useActionsApi.js";
|
|
4
|
+
import { useCodeEditorApi as c } from "./useCodeEditorApi.js";
|
|
5
|
+
import { useHtmlCompiler as u } from "./useHtmlCompiler.js";
|
|
6
|
+
const g = () => {
|
|
7
|
+
const t = d(), e = n(), { closeCodeEditor: i } = c(), { getPreviewData: a, getCompiledEmail: s } = p(), { compileHtml: m } = u(), r = () => {
|
|
8
|
+
t.isPreviewModeOpen = !1, e.$reset();
|
|
8
9
|
};
|
|
9
10
|
return {
|
|
10
11
|
closePreviewMode: r,
|
|
11
12
|
openPreviewMode: () => {
|
|
12
|
-
|
|
13
|
+
t.isCodeEditorOpen && i(), t.isPreviewModeOpen = !0;
|
|
13
14
|
},
|
|
14
15
|
loadPreviewData: async () => {
|
|
15
|
-
if (!(
|
|
16
|
-
|
|
16
|
+
if (!(t.loadingStatus || e.isLoaded)) {
|
|
17
|
+
t.loadingStatus = !0;
|
|
17
18
|
try {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const [o, l] = await Promise.all([
|
|
20
|
+
a(),
|
|
21
|
+
s({ minimize: !0, resetDataSavedFlag: !1 })
|
|
22
|
+
]);
|
|
23
|
+
e.templateHtml = o.html || "", e.ampHtml = o.ampHtml || "", e.ampErrors = o.ampErrors || [], e.setEmailFormat(o.ampHtml ? "AMP" : "html"), e.emailSizeKB = m(l.html).estimatedSizeKB, e.isLoaded = !0;
|
|
24
|
+
} catch (o) {
|
|
25
|
+
console.error("Failed to load preview data:", o), r();
|
|
22
26
|
} finally {
|
|
23
|
-
|
|
27
|
+
t.loadingStatus = !1;
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
};
|
|
29
33
|
export {
|
|
30
|
-
|
|
34
|
+
g as usePreviewMode
|
|
31
35
|
};
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useActionsApi as S } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as V } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as x, useSaveComplete as y } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as w } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as b } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as q } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as H } from "./useHtmlValidator.js";
|
|
8
|
+
import { useLiquidValidator as L } from "./validators/useLiquidValidator.js";
|
|
9
|
+
const F = () => {
|
|
10
|
+
const o = x(), s = y(), { validateHtml: r } = H(), { validateLiquidSyntax: n } = L(), { callbacks: a, isFeatureEnabled: l } = V(), { extractSyncModuleData: d } = w(), { setSyncModuleUnsubscriptionPages: u } = b(), { editorSave: c } = S();
|
|
11
|
+
return { save: async (m = !1) => {
|
|
12
|
+
var i;
|
|
11
13
|
o();
|
|
12
|
-
const { prepareTemplateDetails:
|
|
13
|
-
if (
|
|
14
|
+
const { prepareTemplateDetails: p } = q(), t = await p();
|
|
15
|
+
if (l("liquidSyntax")) {
|
|
16
|
+
if (!await n(t.compiledHtml))
|
|
17
|
+
return;
|
|
18
|
+
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
14
19
|
return;
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
21
|
+
return;
|
|
22
|
+
c();
|
|
23
|
+
const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
|
|
24
|
+
return await u(f), t.modules = v, m || s(t), t;
|
|
17
25
|
} };
|
|
18
26
|
};
|
|
19
27
|
export {
|
|
20
|
-
|
|
28
|
+
F as useSave
|
|
21
29
|
};
|