@useinsider/guido 3.1.1-beta.dee5e9c → 3.1.1-beta.e00a22b
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 +69 -59
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +81 -91
- 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 +45 -35
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/composables/useHtmlCompiler.js +23 -21
- 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/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- 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 +13 -11
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +24 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/composables/useConfig.d.ts +10 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -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/stores/config.d.ts +90 -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 +2 -7
- 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 +20 -20
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +5 -4
|
@@ -1,51 +1,61 @@
|
|
|
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 ct = /* @__PURE__ */ O({
|
|
15
18
|
__name: "EditorActions",
|
|
16
|
-
setup(
|
|
17
|
-
const { config: a } =
|
|
19
|
+
setup(N, { expose: x }) {
|
|
20
|
+
const { config: a, isFeatureEnabled: m } = b(), { exportHtml: l } = k(), { save: c } = F(), { openVersionHistory: p, closeVersionHistory: u } = R(), { getCompiledEmail: f } = q(), { compileHtml: d } = D(), { validateLiquidSyntax: v } = z(), e = I(), y = P(), { hasMigrations: H } = J(y), s = L(), i = n(!1), r = n(!1), S = n(), g = B(), T = () => {
|
|
18
21
|
if (e.isVersionHistoryOpen) {
|
|
19
22
|
u();
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
+
p();
|
|
26
|
+
}, w = async () => {
|
|
27
|
+
i.value = !0, await l(), 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 c(t);
|
|
38
|
+
return r.value = !1, (t || !o) && (e.loadingStatus = !1), o;
|
|
39
|
+
}, E = (t) => {
|
|
40
|
+
var o;
|
|
41
|
+
if (!t && H.value) {
|
|
42
|
+
(o = S.value) == null || o.open();
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
|
-
return
|
|
45
|
+
return V(t);
|
|
46
|
+
}, M = async () => {
|
|
47
|
+
if (m("liquidSyntax")) {
|
|
48
|
+
const { html: t } = await f({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = d(t);
|
|
49
|
+
if (!await v(o))
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
g();
|
|
43
53
|
};
|
|
44
|
-
return
|
|
45
|
-
handleSave:
|
|
46
|
-
}), { __sfc: !0, config: a,
|
|
54
|
+
return x({
|
|
55
|
+
handleSave: E
|
|
56
|
+
}), { __sfc: !0, config: a, isFeatureEnabled: m, exportHtml: l, save: c, openVersionHistory: p, closeVersionHistory: u, getCompiledEmail: f, compileHtml: d, validateLiquidSyntax: v, editorStore: e, templateStore: y, hasMigrations: H, trans: s, isExporting: i, isSaving: r, migrationModalRef: S, testEmailClick: g, handleVersionHistory: T, handleExport: w, handleSaveAs: _, versionHistoryTooltipText: C, isVersionHistoryButtonVisible: A, executeSave: V, handleSave: E, handleTestEmail: M, getTooltipOptions: j, InButtonV2: G, MigrationConfirmModal: K };
|
|
47
57
|
}
|
|
48
58
|
});
|
|
49
59
|
export {
|
|
50
|
-
|
|
60
|
+
ct as default
|
|
51
61
|
};
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { localePatch as
|
|
8
|
-
import { displayConditions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import
|
|
11
|
-
import { useEditorStore as
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const { features: l, template:
|
|
16
|
-
var
|
|
17
|
-
const e =
|
|
1
|
+
import { useActionsApi as F } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as D } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as I } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as P } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as U } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as R } from "./useToaster.js";
|
|
7
|
+
import { localePatch as q } from "../config/i18n/index.js";
|
|
8
|
+
import { displayConditions as x } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as H } from "../services/stripoApi.js";
|
|
10
|
+
import O from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as C } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
|
|
13
|
+
import $ from "../package.json.js";
|
|
14
|
+
const ie = (E, c) => {
|
|
15
|
+
const { features: l, template: h, isFeatureEnabled: u } = I(), { handleError: m } = R(), { getToken: b, getCustomFonts: w, getSyncModulesStatus: k } = H(), { handleEvent: T } = U(), { getStripoBlocksConfig: V } = D(), _ = async (i, n = [], r = !1) => {
|
|
16
|
+
var g, y, S;
|
|
17
|
+
const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await V(), f = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, v = ((y = l.value) == null ? void 0 : y.modulesDisabled) ?? !1, M = ((S = h.value) == null ? void 0 : S.forceRecreate) ?? !1;
|
|
18
18
|
window.UIEditor.initEditor(
|
|
19
19
|
document.querySelector("#guido-editor"),
|
|
20
20
|
{
|
|
21
|
-
metadata:
|
|
22
|
-
html:
|
|
21
|
+
metadata: E,
|
|
22
|
+
html: p,
|
|
23
23
|
css: a,
|
|
24
|
-
forceRecreate:
|
|
24
|
+
forceRecreate: M,
|
|
25
25
|
locale: "en",
|
|
26
26
|
undoButtonSelector: "#guido__undo-button",
|
|
27
27
|
redoButtonSelector: "#guido__redo-button",
|
|
28
28
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
29
29
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
30
30
|
codeEditorButtonSelector: "#guido__code-button",
|
|
31
|
-
customAppearanceMergetags: !
|
|
31
|
+
customAppearanceMergetags: !u("liquidSyntax"),
|
|
32
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
35
|
-
conditionsEnabled:
|
|
36
|
-
customConditionsEnabled:
|
|
37
|
-
conditionCategories:
|
|
34
|
+
customViewStyles: O,
|
|
35
|
+
conditionsEnabled: f,
|
|
36
|
+
customConditionsEnabled: f,
|
|
37
|
+
conditionCategories: x,
|
|
38
38
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
39
|
+
modulesDisabled: v,
|
|
40
40
|
syncModulesEnabled: r,
|
|
41
41
|
messageSettingsEnabled: !0,
|
|
42
42
|
displayGmailAnnotations: !0,
|
|
@@ -52,25 +52,28 @@ const oe = (C, c) => {
|
|
|
52
52
|
},
|
|
53
53
|
mergeTags: [
|
|
54
54
|
{
|
|
55
|
-
entries:
|
|
55
|
+
entries: L(
|
|
56
|
+
c.preselectedDynamicContentList,
|
|
57
|
+
u("liquidSyntax")
|
|
58
|
+
)
|
|
56
59
|
}
|
|
57
60
|
],
|
|
58
61
|
async onTokenRefreshRequest(t) {
|
|
59
62
|
try {
|
|
60
|
-
const s = await
|
|
63
|
+
const s = await b();
|
|
61
64
|
t(s);
|
|
62
65
|
} catch (s) {
|
|
63
|
-
|
|
66
|
+
m(s, "Failed to refresh token");
|
|
64
67
|
}
|
|
65
68
|
},
|
|
66
69
|
onTemplateLoaded() {
|
|
67
70
|
try {
|
|
68
|
-
const { importCss: t } =
|
|
69
|
-
t(), s(),
|
|
71
|
+
const { importCss: t } = P(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: A } = F();
|
|
72
|
+
t(), s(), A(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
70
73
|
e.hasChanges = !1;
|
|
71
74
|
}, 1e3);
|
|
72
75
|
} catch (t) {
|
|
73
|
-
|
|
76
|
+
m(t, "Failed to load custom interface appearance");
|
|
74
77
|
}
|
|
75
78
|
},
|
|
76
79
|
onCodeEditorVisibilityChanged(t) {
|
|
@@ -85,23 +88,23 @@ const oe = (C, c) => {
|
|
|
85
88
|
onDataChanged() {
|
|
86
89
|
e.hasChanges = !0;
|
|
87
90
|
},
|
|
88
|
-
onEvent:
|
|
91
|
+
onEvent: T,
|
|
89
92
|
ignoreClickOutsideSelectors: [
|
|
90
93
|
"#guido-dynamic-content-modal",
|
|
91
94
|
".in-on-board-wrapper",
|
|
92
95
|
".in-drawer__container"
|
|
93
96
|
],
|
|
94
97
|
extensions: d,
|
|
95
|
-
localePatch:
|
|
98
|
+
localePatch: q
|
|
96
99
|
}
|
|
97
100
|
);
|
|
98
|
-
},
|
|
101
|
+
}, B = (i) => new Promise((n, r) => {
|
|
99
102
|
var d;
|
|
100
103
|
if (document.getElementById("UiEditorScript")) {
|
|
101
104
|
i(), n();
|
|
102
105
|
return;
|
|
103
106
|
}
|
|
104
|
-
const e =
|
|
107
|
+
const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
105
108
|
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
106
109
|
i(), n();
|
|
107
110
|
}, o.onerror = () => {
|
|
@@ -109,15 +112,15 @@ const oe = (C, c) => {
|
|
|
109
112
|
}, document.body.appendChild(o);
|
|
110
113
|
});
|
|
111
114
|
return { initPlugin: async (i) => {
|
|
112
|
-
await
|
|
113
|
-
const n =
|
|
115
|
+
await B(async () => {
|
|
116
|
+
const n = C(), [r, e] = await Promise.all([
|
|
114
117
|
w(),
|
|
115
|
-
|
|
118
|
+
k()
|
|
116
119
|
]);
|
|
117
|
-
n.syncModulesEnabled = e, await
|
|
120
|
+
n.syncModulesEnabled = e, await _(i, r, e);
|
|
118
121
|
});
|
|
119
122
|
} };
|
|
120
123
|
};
|
|
121
124
|
export {
|
|
122
|
-
|
|
125
|
+
ie as useStripo
|
|
123
126
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ToasterTypeOptions as a } from "../../enums/toaster.js";
|
|
2
|
+
import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
|
|
3
|
+
import { useHttp as d } from "../useHttp.js";
|
|
4
|
+
import { useToaster as c } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as p } from "../useTranslations.js";
|
|
6
|
+
const v = () => {
|
|
7
|
+
const { post: i } = d(), { showToaster: e } = c(), s = p();
|
|
8
|
+
return { validateLiquidSyntax: async (o) => {
|
|
9
|
+
try {
|
|
10
|
+
const t = await i("/newsletter/contents/validate-syntax", [{
|
|
11
|
+
identifier: "default",
|
|
12
|
+
syntax: "liquid",
|
|
13
|
+
contents: {
|
|
14
|
+
subject: null,
|
|
15
|
+
preheader: null,
|
|
16
|
+
html: u(o),
|
|
17
|
+
ampHtml: null
|
|
18
|
+
}
|
|
19
|
+
}]);
|
|
20
|
+
if (!Array.isArray(t.data)) {
|
|
21
|
+
const l = t.data;
|
|
22
|
+
return e({
|
|
23
|
+
type: a.Warning,
|
|
24
|
+
message: l.message ?? s("journey-builder.liquid-validation-failed")
|
|
25
|
+
}), !1;
|
|
26
|
+
}
|
|
27
|
+
const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
|
|
28
|
+
return n.length ? (e({
|
|
29
|
+
type: a.Warning,
|
|
30
|
+
message: n[0].replace(/^line \d+:\s*/, "")
|
|
31
|
+
}), !1) : !0;
|
|
32
|
+
} catch {
|
|
33
|
+
return e({
|
|
34
|
+
type: a.Alert,
|
|
35
|
+
message: s("journey-builder.liquid-validation-failed")
|
|
36
|
+
}), !1;
|
|
37
|
+
}
|
|
38
|
+
} };
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
v as useLiquidValidator
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { COUPON_PLACEHOLDER_LIQUID as e, COUPON_PLACEHOLDER_DEFAULT as i } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
2
|
+
const o = [
|
|
3
|
+
{
|
|
4
|
+
id: "liquid-coupon-code",
|
|
5
|
+
description: "Replace legacy coupon placeholder with liquid syntax",
|
|
6
|
+
type: "replace",
|
|
7
|
+
search: i,
|
|
8
|
+
replacement: e,
|
|
9
|
+
replaceAll: !0,
|
|
10
|
+
priority: 50
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
export {
|
|
14
|
+
o as liquidCompilerRules
|
|
15
|
+
};
|
|
@@ -11,6 +11,8 @@ class f {
|
|
|
11
11
|
try {
|
|
12
12
|
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
|
|
13
13
|
return i.length === 0 ? t : (i.forEach((r) => {
|
|
14
|
+
if (r.classList.contains("checkbox-block-v2"))
|
|
15
|
+
return;
|
|
14
16
|
const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
|
|
15
17
|
`<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
|
|
16
18
|
"text/html"
|
|
@@ -22,7 +24,7 @@ class f {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
extractTextFromElement(t, e) {
|
|
25
|
-
var o,
|
|
27
|
+
var o, d;
|
|
26
28
|
const i = t.querySelector(`.${e}`);
|
|
27
29
|
if (!i)
|
|
28
30
|
return {
|
|
@@ -41,13 +43,13 @@ class f {
|
|
|
41
43
|
align: i.getAttribute("align") || "left",
|
|
42
44
|
styles: ""
|
|
43
45
|
};
|
|
44
|
-
const n = ((
|
|
46
|
+
const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
|
|
45
47
|
return {
|
|
46
48
|
text: n,
|
|
47
49
|
isBold: a,
|
|
48
50
|
isItalic: p,
|
|
49
51
|
align: c,
|
|
50
|
-
styles:
|
|
52
|
+
styles: u
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
buildTextBlock(t) {
|