@useinsider/guido 3.15.1-beta.6da4177 → 3.16.0-beta.20cd2fe
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 +118 -100
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +78 -75
- package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
- package/dist/components/organisms/header/AutoSaveStatus.vue2.js +21 -0
- package/dist/components/organisms/header/EditorActions.vue.js +11 -11
- package/dist/components/organisms/header/EditorActions.vue2.js +34 -50
- package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
- package/dist/components/organisms/header/EditorActionsMenu.vue2.js +39 -0
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
- package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
- package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
- package/dist/components/organisms/header/RightSlot.vue.js +6 -6
- package/dist/components/organisms/header/RightSlot.vue2.js +17 -15
- package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
- package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
- package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +24 -0
- package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
- package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +18 -0
- package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +74 -0
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -34
- package/dist/composables/useAccessibilityApi.js +31 -0
- package/dist/composables/useActionsApi.js +30 -22
- package/dist/composables/useEmailTemplateApplier.js +25 -23
- package/dist/composables/useHtmlValidator.js +85 -83
- package/dist/composables/useTimerClone.js +21 -19
- package/dist/config/i18n/en/labels.json.js +28 -4
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +10 -9
- package/dist/extensions/Blocks/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/controls/cardBackground/index.js +5 -9
- 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/controlFactories.js +117 -115
- package/dist/guido.css +1 -1
- package/dist/library.js +11 -7
- package/dist/node_modules/@vueuse/core/index.js +102 -0
- package/dist/node_modules/@vueuse/shared/index.js +40 -28
- 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 +24 -0
- package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useAccessibilityApi.d.ts +15 -0
- package/dist/src/composables/useActionsApi.d.ts +3 -3
- package/dist/src/composables/useConfig.d.ts +6 -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/controls/spacing/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/trackingIds.d.ts +9 -0
- package/dist/src/stores/config.d.ts +54 -0
- package/dist/src/stores/editor.d.ts +132 -0
- package/dist/src/stores/onboarding.d.ts +377 -0
- package/dist/src/stores/version-history.d.ts +1 -1
- package/dist/src/utils/linkTrackingIds.d.ts +30 -0
- package/dist/src/utils/timeUtil.d.ts +10 -0
- package/dist/stores/editor.js +9 -2
- package/dist/stores/onboarding.js +23 -14
- package/dist/utils/linkTrackingIds.js +56 -0
- package/dist/utils/pairProductVariables.js +105 -99
- package/dist/utils/templatePreparation.js +72 -61
- package/dist/utils/timeUtil.js +6 -17
- package/package.json +5 -1
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
- /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → AutoSaveStatus.vue.d.ts} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent as p, computed as d, watch as x } from "vue";
|
|
2
|
+
import { useRibbonOffset as B } from "../../../composables/useRibbonOffset.js";
|
|
3
|
+
import { useTranslations as m } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { useOnboardingStore as k } from "../../../stores/onboarding.js";
|
|
5
|
+
import { InOnboard as T } from "@useinsider/design-system-vue";
|
|
6
|
+
const y = /* @__PURE__ */ p({
|
|
7
|
+
__name: "EditorTabBarOnboarding",
|
|
8
|
+
setup(f) {
|
|
9
|
+
const n = "editorTabBarOnboarding", t = m(), i = k(), { getTopPosition: a } = B(), r = () => i.next(n), c = () => i.previous(n), s = () => void i.close(n), b = d(() => [
|
|
10
|
+
{
|
|
11
|
+
classes: "guido-tab-bar-onboarding",
|
|
12
|
+
right: "150px",
|
|
13
|
+
top: a(56),
|
|
14
|
+
position: "Right Top",
|
|
15
|
+
title: t("email-editor.onboarding-kebab-title"),
|
|
16
|
+
description: t("email-editor.onboarding-kebab-description"),
|
|
17
|
+
imageSource: "",
|
|
18
|
+
backButtonClick: () => {
|
|
19
|
+
},
|
|
20
|
+
nextButtonType: "text",
|
|
21
|
+
nextButtonText: t("action-builder.next"),
|
|
22
|
+
nextButtonClick: r
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
classes: "guido-tab-bar-onboarding",
|
|
26
|
+
right: "320px",
|
|
27
|
+
top: a(56),
|
|
28
|
+
position: "Right Top",
|
|
29
|
+
title: t("email-editor.onboarding-autosave-title"),
|
|
30
|
+
description: t("email-editor.onboarding-autosave-description"),
|
|
31
|
+
imageSource: "",
|
|
32
|
+
backButtonType: "text",
|
|
33
|
+
backButtonText: t("action-builder.back"),
|
|
34
|
+
backButtonClick: c,
|
|
35
|
+
nextButtonType: "text",
|
|
36
|
+
nextButtonText: t("action-builder.next"),
|
|
37
|
+
nextButtonClick: r
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
classes: "guido-tab-bar-onboarding",
|
|
41
|
+
right: "150px",
|
|
42
|
+
top: a(56),
|
|
43
|
+
position: "Right Top",
|
|
44
|
+
title: t("email-editor.onboarding-accessibility-title"),
|
|
45
|
+
description: t("email-editor.onboarding-accessibility-description"),
|
|
46
|
+
imageSource: "",
|
|
47
|
+
backButtonType: "text",
|
|
48
|
+
backButtonText: t("action-builder.back"),
|
|
49
|
+
backButtonClick: c,
|
|
50
|
+
nextButtonType: "text",
|
|
51
|
+
nextButtonText: t("action-builder.ok"),
|
|
52
|
+
nextButtonClick: s
|
|
53
|
+
}
|
|
54
|
+
]), u = d(
|
|
55
|
+
() => i.onboardings.editorTabBarOnboarding.config.length > 0 && i.onboardings.editorTabBarOnboarding.isActive
|
|
56
|
+
), g = () => {
|
|
57
|
+
var o, e;
|
|
58
|
+
(e = (o = i.getEditorTabBarCurrentCard) == null ? void 0 : o.nextButtonClick) == null || e.call(o);
|
|
59
|
+
}, l = () => {
|
|
60
|
+
var o, e;
|
|
61
|
+
(e = (o = i.getEditorTabBarCurrentCard) == null ? void 0 : o.backButtonClick) == null || e.call(o);
|
|
62
|
+
};
|
|
63
|
+
return x(
|
|
64
|
+
() => i.onboardings.editorTabBarOnboarding.isActive,
|
|
65
|
+
(o) => {
|
|
66
|
+
o && i.setConfig(n, b.value);
|
|
67
|
+
},
|
|
68
|
+
{ immediate: !0 }
|
|
69
|
+
), { __sfc: !0, ONBOARDING: n, trans: t, onboardingStore: i, getTopPosition: a, goNext: r, goBack: c, finish: s, onboardingCardsConfig: b, isVisible: u, handleNext: g, handleBack: l, InOnboard: T };
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
y as default
|
|
74
|
+
};
|
|
@@ -1,46 +1,55 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import v from "./
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import { defineComponent as O, computed as a, onMounted as u, watch as e } from "vue";
|
|
2
|
+
import l from "./AMPOnboarding.vue.js";
|
|
3
|
+
import v from "./EditorTabBarOnboarding.vue.js";
|
|
4
|
+
import y from "./GenericOnboarding.vue.js";
|
|
5
|
+
import S from "./ItemsOnboarding.vue.js";
|
|
6
|
+
import h from "./NewVersionPopup.vue.js";
|
|
7
|
+
import w from "./TextBlockOnboarding.vue.js";
|
|
8
|
+
import P from "./VersionHistoryOnboarding.vue.js";
|
|
9
|
+
import { useConfig as A } from "../../../composables/useConfig.js";
|
|
10
|
+
import { usePartner as T } from "../../../composables/usePartner.js";
|
|
11
|
+
import { useEditorStore as _ } from "../../../stores/editor.js";
|
|
12
|
+
import { useOnboardingStore as H } from "../../../stores/onboarding.js";
|
|
13
|
+
import { usePreviewStore as B } from "../../../stores/preview.js";
|
|
14
|
+
const j = /* @__PURE__ */ O({
|
|
13
15
|
__name: "OnboardingWrapper",
|
|
14
16
|
emits: ["onboarding-finished"],
|
|
15
|
-
setup(
|
|
16
|
-
const o =
|
|
17
|
-
{ type: "newVersionPopup", component:
|
|
18
|
-
{ type: "genericOnboarding", component:
|
|
19
|
-
{ type: "textBlockOnboarding", component:
|
|
20
|
-
{ type: "versionHistoryOnboarding", component:
|
|
21
|
-
{ type: "ampOnboarding", component:
|
|
22
|
-
{ type: "itemsOnboarding", component:
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
setup(M, { emit: g }) {
|
|
18
|
+
const o = H(), i = _(), d = B(), { isTestPartner: p } = T(), { isFeatureEnabled: m } = A(), t = a(() => i.isStripoInitialized), s = a(() => p()), b = [
|
|
19
|
+
{ type: "newVersionPopup", component: h },
|
|
20
|
+
{ type: "genericOnboarding", component: y },
|
|
21
|
+
{ type: "textBlockOnboarding", component: w },
|
|
22
|
+
{ type: "versionHistoryOnboarding", component: P },
|
|
23
|
+
{ type: "ampOnboarding", component: l },
|
|
24
|
+
{ type: "itemsOnboarding", component: S },
|
|
25
|
+
{ type: "editorTabBarOnboarding", component: v }
|
|
26
|
+
], c = (n) => s.value || !t.value ? !1 : n === "newVersionPopup" ? o.shouldShowOnboarding(n) : o.isActive(n), f = a(() => b.filter((n) => c(n.type)));
|
|
27
|
+
return u(async () => {
|
|
25
28
|
await o.fetchUserModalState();
|
|
26
|
-
}),
|
|
27
|
-
() =>
|
|
28
|
-
(n,
|
|
29
|
-
n && !
|
|
29
|
+
}), e(
|
|
30
|
+
() => i.isVersionHistoryOpen,
|
|
31
|
+
(n, r) => {
|
|
32
|
+
n && !r && o.shouldShowOnboarding("versionHistoryOnboarding") && o.start("versionHistoryOnboarding"), !n && r && o.isActive("versionHistoryOnboarding") && o.close("versionHistoryOnboarding");
|
|
30
33
|
}
|
|
31
|
-
),
|
|
32
|
-
() =>
|
|
33
|
-
(n,
|
|
34
|
-
|
|
34
|
+
), e(
|
|
35
|
+
() => d.emailFormat,
|
|
36
|
+
(n, r) => {
|
|
37
|
+
r !== "AMP" && n === "AMP" && o.shouldShowOnboarding("ampOnboarding") && o.start("ampOnboarding");
|
|
35
38
|
}
|
|
36
|
-
),
|
|
37
|
-
() =>
|
|
39
|
+
), e(
|
|
40
|
+
() => i.isPreviewModeOpen,
|
|
38
41
|
(n) => {
|
|
39
42
|
!n && o.isActive("ampOnboarding") && o.close("ampOnboarding");
|
|
40
43
|
}
|
|
41
|
-
),
|
|
44
|
+
), e(
|
|
45
|
+
t,
|
|
46
|
+
(n) => {
|
|
47
|
+
n && m("accessibilityTesting") && !s.value && !o.isOnboardingActive() && o.shouldShowOnboarding("editorTabBarOnboarding") && o.start("editorTabBarOnboarding");
|
|
48
|
+
},
|
|
49
|
+
{ immediate: !0 }
|
|
50
|
+
), { __sfc: !0, emit: g, onboardingStore: o, editorStore: i, previewStore: d, isTestPartner: p, isFeatureEnabled: m, isStripoReady: t, isTestPartnerActive: s, onboardingConfigs: b, shouldShow: c, visibleOnboardings: f };
|
|
42
51
|
}
|
|
43
52
|
});
|
|
44
53
|
export {
|
|
45
|
-
|
|
54
|
+
j as default
|
|
46
55
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEditorStore as r } from "../stores/editor.js";
|
|
2
|
+
const A = () => {
|
|
3
|
+
const e = r(), i = () => window.StripoEditorApi.accessibilityApi, s = () => {
|
|
4
|
+
i().openAccessibilityTestingMode(), e.isAccessibilityTestingOpen = !0;
|
|
5
|
+
}, o = () => {
|
|
6
|
+
i().closeAccessibilityTestingMode(), e.isAccessibilityTestingOpen = !1, e.imagesHidden = !1, e.colorVisionDeficiency = "";
|
|
7
|
+
}, g = () => e.isAccessibilityTestingOpen ? o() : s(), l = () => i().isAccessibilityTestingModeOpen(), t = () => {
|
|
8
|
+
i().showImages(), e.imagesHidden = !1;
|
|
9
|
+
}, c = () => {
|
|
10
|
+
i().hideImages(), e.imagesHidden = !0;
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
openAccessibilityTestingMode: s,
|
|
14
|
+
closeAccessibilityTestingMode: o,
|
|
15
|
+
toggleAccessibilityTestingMode: g,
|
|
16
|
+
isAccessibilityTestingModeOpen: l,
|
|
17
|
+
showImages: t,
|
|
18
|
+
hideImages: c,
|
|
19
|
+
toggleImages: () => e.imagesHidden ? t() : c(),
|
|
20
|
+
setColorVisionDeficiency: (n) => {
|
|
21
|
+
i().setColorVisionDeficiency(n), e.colorVisionDeficiency = n;
|
|
22
|
+
},
|
|
23
|
+
getColorVisionDeficiency: () => i().getColorVisionDeficiency(),
|
|
24
|
+
switchToDesktopPreview: () => i().switchToDesktopPreview(),
|
|
25
|
+
switchToMobilePreview: () => i().switchToMobilePreview(),
|
|
26
|
+
toggleCodeEditor: () => i().emitToggleCodeEditor()
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
A as useAccessibilityApi
|
|
31
|
+
};
|
|
@@ -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,
|