@useinsider/guido 3.19.0-beta.acb00a2 → 3.19.0-beta.c0e1797
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/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +53 -59
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/composables/useActionsApi.js +44 -43
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +54 -122
- package/dist/composables/useEmailTemplateApplier.js +52 -108
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -0
- package/dist/guido.css +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -2
- package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -18
- package/dist/src/stores/guido-email-editor.d.ts +10 -20
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/stores/guido-email-editor.js +1 -3
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/stripoEditorApi.js +11 -0
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as re, defineAsyncComponent as m, ref as
|
|
1
|
+
import { defineComponent as re, defineAsyncComponent as m, ref as O, computed as u, watch as x, onMounted as se, onUnmounted as ae } from "vue";
|
|
2
2
|
import { useCortexBlueprintBridge as ie } from "../composables/useCortexBlueprintBridge.js";
|
|
3
3
|
import { useEditorLock as ce } from "../composables/useEditorLock.js";
|
|
4
4
|
import { provideGuidoActions as de } from "../composables/useGuidoActions.js";
|
|
@@ -6,25 +6,25 @@ import { useGuidoStateBridge as me } from "../composables/useGuidoStateBridge.js
|
|
|
6
6
|
import { usePartner as le } from "../composables/usePartner.js";
|
|
7
7
|
import { useStripo as ue } from "../composables/useStripo.js";
|
|
8
8
|
import { useTimerClone as pe } from "../composables/useTimerClone.js";
|
|
9
|
-
import { migrate as
|
|
10
|
-
import { ModuleFolderDefaults as
|
|
9
|
+
import { migrate as W } from "../config/migrator/index.js";
|
|
10
|
+
import { ModuleFolderDefaults as G } from "../enums/defaults.js";
|
|
11
11
|
import { RIBBON_SELECTOR as fe } from "../enums/onboarding.js";
|
|
12
|
-
import { useRecommendationExtensionStore as
|
|
12
|
+
import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
13
13
|
import ye from "./organisms/AutoSaveController.vue.js";
|
|
14
14
|
import ge from "./organisms/base/Toaster.vue.js";
|
|
15
15
|
import ve from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
16
16
|
import Se from "./organisms/header/HeaderWrapper.vue.js";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
17
|
+
import be from "./organisms/LoadingWrapper.vue.js";
|
|
18
|
+
import he from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
19
19
|
import Ee from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
20
20
|
import { useStripoApi as we } from "../services/stripoApi.js";
|
|
21
21
|
import { useConfigStore as Ce } from "../stores/config.js";
|
|
22
22
|
import { useDynamicContentStore as De } from "../stores/dynamic-content.js";
|
|
23
|
-
import { useEditorStore as
|
|
23
|
+
import { useEditorStore as H } from "../stores/editor.js";
|
|
24
24
|
import { usePreviewStore as ke } from "../stores/preview.js";
|
|
25
|
-
import { useTemplateStore as
|
|
26
|
-
import { useUnsubscribeStore as
|
|
27
|
-
import { readTrackFloor as
|
|
25
|
+
import { useTemplateStore as Te } from "../stores/template.js";
|
|
26
|
+
import { useUnsubscribeStore as Fe } from "../stores/unsubscribe.js";
|
|
27
|
+
import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
|
|
28
28
|
const tt = /* @__PURE__ */ re({
|
|
29
29
|
__name: "Guido",
|
|
30
30
|
props: {
|
|
@@ -32,8 +32,8 @@ const tt = /* @__PURE__ */ re({
|
|
|
32
32
|
ready: { type: Boolean, default: !0 }
|
|
33
33
|
},
|
|
34
34
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
35
|
-
setup(
|
|
36
|
-
const a =
|
|
35
|
+
setup(z, { expose: q, emit: r }) {
|
|
36
|
+
const a = z, K = m(
|
|
37
37
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
38
38
|
), V = m(
|
|
39
39
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
@@ -43,32 +43,32 @@ const tt = /* @__PURE__ */ re({
|
|
|
43
43
|
() => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
|
|
44
44
|
), Q = m(
|
|
45
45
|
() => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
|
|
46
|
-
),
|
|
46
|
+
), E = O(), p = O(), f = De(), w = Fe(), o = Ce();
|
|
47
47
|
a.ready && o.init(a.config);
|
|
48
|
-
const c =
|
|
48
|
+
const c = H(), X = ke(), l = u(() => c.hasChanges), { isTestPartner: Y } = le(), C = () => {
|
|
49
49
|
var t;
|
|
50
|
-
return (t =
|
|
51
|
-
},
|
|
50
|
+
return (t = E.value) == null ? void 0 : t.handleSave(!0);
|
|
51
|
+
}, D = (t) => {
|
|
52
52
|
c.loadingStatus = t;
|
|
53
53
|
};
|
|
54
54
|
ie(), me();
|
|
55
|
-
const
|
|
55
|
+
const y = () => {
|
|
56
56
|
var t, e;
|
|
57
57
|
return {
|
|
58
58
|
emailId: o.templateId,
|
|
59
59
|
userId: o.userId,
|
|
60
60
|
username: o.username,
|
|
61
61
|
partnerName: o.partnerName,
|
|
62
|
-
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) ||
|
|
63
|
-
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) ||
|
|
62
|
+
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
|
|
63
|
+
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
|
|
64
64
|
};
|
|
65
|
-
}, { initPlugin:
|
|
66
|
-
let
|
|
67
|
-
const { getDefaultTemplate:
|
|
65
|
+
}, { initPlugin: k, preloadRuntime: T } = ue(), { runExclusive: F, beginMount: M, isCurrentMount: R } = ce();
|
|
66
|
+
let g = 0;
|
|
67
|
+
const { getDefaultTemplate: I } = we(), { cloneTimersOnSave: L, hasTimerBlocks: B } = pe(), Z = u(() => {
|
|
68
68
|
var t;
|
|
69
69
|
return !((t = o.ui) != null && t.showHeader);
|
|
70
|
-
}), ee =
|
|
71
|
-
() => !!
|
|
70
|
+
}), ee = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), te = u(
|
|
71
|
+
() => !!h().recommendationConfigs.strategyId
|
|
72
72
|
);
|
|
73
73
|
de({
|
|
74
74
|
onBack: () => {
|
|
@@ -78,76 +78,70 @@ const tt = /* @__PURE__ */ re({
|
|
|
78
78
|
console.debug("guido:save:start"), r("save:start");
|
|
79
79
|
},
|
|
80
80
|
onSaveComplete: (t) => {
|
|
81
|
-
const e = { ...t, metadata:
|
|
81
|
+
const e = { ...t, metadata: y() };
|
|
82
82
|
console.debug("guido:save:complete", e), r("save:complete", e);
|
|
83
83
|
},
|
|
84
84
|
onTestEmailClick: () => {
|
|
85
85
|
console.debug("guido:test-email:click"), r("test-email:click");
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
const
|
|
89
|
-
console.debug("dynamic-content:close", t),
|
|
90
|
-
},
|
|
88
|
+
const U = (t) => {
|
|
89
|
+
console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
90
|
+
}, A = () => {
|
|
91
91
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
x(() => l.value, () => {
|
|
94
94
|
r("on-change", l.value);
|
|
95
95
|
});
|
|
96
|
-
const
|
|
96
|
+
const v = (t) => {
|
|
97
97
|
const e = t, { attribute: s, position: d } = e.detail;
|
|
98
98
|
console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
|
|
99
99
|
};
|
|
100
100
|
let i = null;
|
|
101
|
-
const
|
|
101
|
+
const S = () => {
|
|
102
102
|
var e;
|
|
103
103
|
const t = document.querySelector(fe);
|
|
104
|
-
(e =
|
|
104
|
+
(e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
105
105
|
}, b = async () => {
|
|
106
106
|
var t;
|
|
107
107
|
try {
|
|
108
108
|
o.initialized || o.init(a.config), c.templateId = o.templateId;
|
|
109
|
-
const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "",
|
|
110
|
-
|
|
111
|
-
const
|
|
109
|
+
const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
110
|
+
w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
111
|
+
const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, N = o.isFeatureEnabled("linkTrackingIds");
|
|
112
112
|
let n = {
|
|
113
|
-
html: s && await
|
|
113
|
+
html: s && await W(s, _),
|
|
114
114
|
css: d
|
|
115
115
|
};
|
|
116
|
-
n.html || (n = await
|
|
117
|
-
const oe =
|
|
118
|
-
|
|
116
|
+
n.html || (n = await I(), n.html = await W(n.html, _));
|
|
117
|
+
const oe = N ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
|
|
118
|
+
B(n.html) && (n.html = await L(n.html)), N && (c.trackIdSessionFloor = Math.max(oe, $(n.html)));
|
|
119
119
|
const ne = {
|
|
120
|
-
preselectedDynamicContentList:
|
|
120
|
+
preselectedDynamicContentList: P,
|
|
121
121
|
onReady: () => {
|
|
122
122
|
console.debug("guido:ready"), r("ready");
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
|
|
125
|
+
g = M(), await k(n, y(), ne), f.selectedDynamicContentList = P;
|
|
126
126
|
} catch (e) {
|
|
127
127
|
console.error("Failed to initialize Stripo editor:", e);
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
return se(async () => {
|
|
131
131
|
var e;
|
|
132
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"),
|
|
133
|
-
const t = (e =
|
|
134
|
-
if (t && (i = new ResizeObserver(
|
|
132
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), H().$reset(), Te().$reset(), S();
|
|
133
|
+
const t = (e = p.value) == null ? void 0 : e.parentElement;
|
|
134
|
+
if (t && (i = new ResizeObserver(S), i.observe(t)), T(), a.ready)
|
|
135
135
|
await b();
|
|
136
136
|
else {
|
|
137
|
-
const s =
|
|
137
|
+
const s = x(() => a.ready, (d) => {
|
|
138
138
|
d && (s(), b());
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
document.addEventListener("dynamic-content:open",
|
|
141
|
+
document.addEventListener("dynamic-content:open", v);
|
|
142
142
|
}), ae(() => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
w().isStripoInitialized = !1;
|
|
146
|
-
} catch (t) {
|
|
147
|
-
console.debug("Failed to close the editor readiness gate on unmount", t);
|
|
148
|
-
}
|
|
149
|
-
M(async () => {
|
|
150
|
-
if (v(u))
|
|
143
|
+
i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), h().disposeStrategyPageReturn(), F(async () => {
|
|
144
|
+
if (R(g))
|
|
151
145
|
try {
|
|
152
146
|
window.UIEditor.removeEditor();
|
|
153
147
|
} catch {
|
|
@@ -156,13 +150,13 @@ const tt = /* @__PURE__ */ re({
|
|
|
156
150
|
}), o.reset();
|
|
157
151
|
}), q({
|
|
158
152
|
dynamicContent: {
|
|
159
|
-
insert:
|
|
160
|
-
close:
|
|
153
|
+
insert: U,
|
|
154
|
+
close: A
|
|
161
155
|
},
|
|
162
156
|
hasChanges: l,
|
|
163
|
-
saveSilent:
|
|
164
|
-
setLoading:
|
|
165
|
-
}), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, LegacyStrategyUpdatedModal: Q, headerWrapperRef:
|
|
157
|
+
saveSilent: C,
|
|
158
|
+
setLoading: D
|
|
159
|
+
}), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, LegacyStrategyUpdatedModal: Q, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: a, configStore: o, editorStore: c, previewStore: X, hasChanges: l, isTestPartner: Y, saveSilent: C, setLoading: D, emit: r, buildMetadata: y, initPlugin: k, preloadRuntime: T, runExclusive: F, beginMount: M, isCurrentMount: R, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: B, noHeader: Z, isRrsEnabled: ee, hasAssignedStrategy: te, insertDynamicContent: U, closeDynamicContent: A, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: b, AutoSaveController: ye, Toaster: ge, FilterSelectionDrawer: ve, HeaderWrapper: Se, LoadingWrapper: be, SaveAsTemplateDrawer: he, UnsubscribeWrapper: Ee };
|
|
166
160
|
}
|
|
167
161
|
});
|
|
168
162
|
export {
|
|
@@ -9,15 +9,15 @@ var u = function() {
|
|
|
9
9
|
} } }), e(t.MigrationConfirmModal, { ref: "migrationModalRef", on: { confirm: function(r) {
|
|
10
10
|
return t.executeSave(!1);
|
|
11
11
|
} } })], 1);
|
|
12
|
-
},
|
|
12
|
+
}, c = [], p = /* @__PURE__ */ d(
|
|
13
13
|
l,
|
|
14
14
|
u,
|
|
15
|
-
|
|
15
|
+
c,
|
|
16
16
|
!1,
|
|
17
17
|
null,
|
|
18
|
-
"
|
|
18
|
+
"c61cc8ea"
|
|
19
19
|
);
|
|
20
|
-
const v =
|
|
20
|
+
const v = p.exports;
|
|
21
21
|
export {
|
|
22
22
|
v as default
|
|
23
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, ref as
|
|
1
|
+
import { defineComponent as q, ref as n, computed as x } from "vue";
|
|
2
2
|
import { useActionsApi as b } from "../../../composables/useActionsApi.js";
|
|
3
3
|
import { useConfig as k } from "../../../composables/useConfig.js";
|
|
4
4
|
import { useExport as B } from "../../../composables/useExport.js";
|
|
@@ -17,48 +17,46 @@ import { storeToRefs as Q } from "pinia";
|
|
|
17
17
|
import U from "./MigrationConfirmModal.vue.js";
|
|
18
18
|
const ft = /* @__PURE__ */ q({
|
|
19
19
|
__name: "EditorActions",
|
|
20
|
-
setup(W, { expose:
|
|
21
|
-
const { config:
|
|
20
|
+
setup(W, { expose: w }) {
|
|
21
|
+
const { config: l, isFeatureEnabled: m } = k(), { exportHtml: c } = B(), { save: p } = R(), { openVersionHistory: u, closeVersionHistory: f } = P(), { getCompiledEmail: d } = b(), { compileHtml: v } = L(), { validateLiquidSyntax: y } = j(), { handleError: r } = z(), e = G(), g = J(), { hasMigrations: S } = Q(g), s = I(), i = n(!1), a = n(!1), H = n(), h = D(), _ = () => {
|
|
22
22
|
if (e.isVersionHistoryOpen) {
|
|
23
|
-
|
|
23
|
+
f();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
u();
|
|
27
27
|
}, C = async () => {
|
|
28
|
-
i.value = !0, await
|
|
28
|
+
i.value = !0, await c(), i.value = !1;
|
|
29
29
|
}, A = () => {
|
|
30
30
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
-
}, M =
|
|
31
|
+
}, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
|
|
32
32
|
() => {
|
|
33
33
|
var t, o;
|
|
34
|
-
return ((o = (t =
|
|
34
|
+
return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
35
35
|
}
|
|
36
|
-
),
|
|
36
|
+
), V = async (t) => {
|
|
37
37
|
a.value = !0, t || (e.loadingStatus = !0);
|
|
38
38
|
let o;
|
|
39
39
|
try {
|
|
40
|
-
o = await
|
|
41
|
-
} catch (
|
|
42
|
-
|
|
43
|
-
throw n;
|
|
44
|
-
r(n, "Failed to save template");
|
|
40
|
+
o = await p(t);
|
|
41
|
+
} catch (T) {
|
|
42
|
+
r(T, "Failed to save template");
|
|
45
43
|
} finally {
|
|
46
44
|
a.value = !1, !t && !o && (e.loadingStatus = !1);
|
|
47
45
|
}
|
|
48
46
|
return o;
|
|
49
|
-
},
|
|
47
|
+
}, E = (t) => {
|
|
50
48
|
var o;
|
|
51
|
-
if (!t &&
|
|
52
|
-
(o =
|
|
49
|
+
if (!t && S.value) {
|
|
50
|
+
(o = H.value) == null || o.open();
|
|
53
51
|
return;
|
|
54
52
|
}
|
|
55
|
-
return
|
|
53
|
+
return V(t);
|
|
56
54
|
}, F = async () => {
|
|
57
|
-
if (
|
|
55
|
+
if (m("liquidSyntax")) {
|
|
58
56
|
e.loadingStatus = !0;
|
|
59
57
|
try {
|
|
60
|
-
const { html: t } = await
|
|
61
|
-
if (!await
|
|
58
|
+
const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
|
|
59
|
+
if (!await y(o))
|
|
62
60
|
return;
|
|
63
61
|
} catch (t) {
|
|
64
62
|
r(t, "Failed to prepare test email");
|
|
@@ -67,11 +65,11 @@ const ft = /* @__PURE__ */ q({
|
|
|
67
65
|
e.loadingStatus = !1;
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
|
|
68
|
+
h();
|
|
71
69
|
};
|
|
72
|
-
return
|
|
73
|
-
handleSave:
|
|
74
|
-
}), { __sfc: !0, config:
|
|
70
|
+
return w({
|
|
71
|
+
handleSave: E
|
|
72
|
+
}), { __sfc: !0, config: l, isFeatureEnabled: m, exportHtml: c, save: p, openVersionHistory: u, closeVersionHistory: f, getCompiledEmail: d, compileHtml: v, validateLiquidSyntax: y, handleError: r, editorStore: e, templateStore: g, hasMigrations: S, trans: s, isExporting: i, isSaving: a, migrationModalRef: H, testEmailClick: h, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: V, handleSave: E, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
|
|
75
73
|
}
|
|
76
74
|
});
|
|
77
75
|
export {
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { filterAmpErrors as y } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { getEditorApi as s } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { useToaster as D } from "./useToaster.js";
|
|
4
|
+
const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
5
|
+
const f = setTimeout(
|
|
6
|
+
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
6
7
|
l
|
|
7
|
-
),
|
|
8
|
-
clearTimeout(
|
|
9
|
-
};
|
|
8
|
+
), c = (t) => (e) => {
|
|
9
|
+
clearTimeout(f), t(e);
|
|
10
|
+
}, d = c(p);
|
|
10
11
|
try {
|
|
11
|
-
|
|
12
|
-
} catch (
|
|
13
|
-
|
|
12
|
+
A(c(C), d);
|
|
13
|
+
} catch (t) {
|
|
14
|
+
d(t);
|
|
14
15
|
}
|
|
15
|
-
}),
|
|
16
|
-
const { handleError: n } =
|
|
16
|
+
}), P = () => {
|
|
17
|
+
const { handleError: n } = D(), l = (t = {}) => r(
|
|
17
18
|
"compileEmail",
|
|
18
19
|
T,
|
|
19
|
-
(e,
|
|
20
|
+
(e, i) => {
|
|
20
21
|
const o = { ...{
|
|
21
22
|
minimize: !0,
|
|
22
23
|
utmEntity: {
|
|
@@ -37,52 +38,52 @@ const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
|
|
|
37
38
|
resetDataSavedFlag: !1,
|
|
38
39
|
disableLineHeightsReplace: !0
|
|
39
40
|
}, ...t }, u = {
|
|
40
|
-
callback: (m,
|
|
41
|
-
m ?
|
|
42
|
-
html:
|
|
43
|
-
ampHtml:
|
|
44
|
-
ampErrors:
|
|
45
|
-
displayConditions:
|
|
41
|
+
callback: (m, g, w, S, v) => {
|
|
42
|
+
m ? i(m) : e({
|
|
43
|
+
html: g,
|
|
44
|
+
ampHtml: w,
|
|
45
|
+
ampErrors: y(S ?? []),
|
|
46
|
+
displayConditions: v
|
|
46
47
|
});
|
|
47
48
|
},
|
|
48
49
|
...o
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
+
s().actionsApi.compileEmail(u);
|
|
51
52
|
}
|
|
52
53
|
);
|
|
53
54
|
return {
|
|
54
55
|
getCompiledEmail: l,
|
|
55
|
-
getTemplateData: () =>
|
|
56
|
+
getTemplateData: () => r(
|
|
56
57
|
"getTemplateData",
|
|
57
58
|
T,
|
|
58
59
|
(t) => {
|
|
59
|
-
const e = ({ html:
|
|
60
|
-
html:
|
|
61
|
-
css:
|
|
60
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
|
|
61
|
+
html: i,
|
|
62
|
+
css: a,
|
|
62
63
|
width: o,
|
|
63
64
|
height: E,
|
|
64
65
|
utmParams: u,
|
|
65
66
|
syncModulesIds: m
|
|
66
67
|
});
|
|
67
|
-
|
|
68
|
+
s().actionsApi.getTemplateData(e);
|
|
68
69
|
}
|
|
69
70
|
),
|
|
70
71
|
activateCustomViewStyles: (t = !0) => {
|
|
71
|
-
|
|
72
|
+
s().actionsApi.activateCustomViewStyles(t);
|
|
72
73
|
},
|
|
73
74
|
getPreviewData: async (t) => {
|
|
74
75
|
try {
|
|
75
76
|
const {
|
|
76
77
|
html: e,
|
|
77
|
-
displayConditions:
|
|
78
|
-
ampHtml:
|
|
78
|
+
displayConditions: i,
|
|
79
|
+
ampHtml: a = "",
|
|
79
80
|
ampErrors: o = []
|
|
80
81
|
} = await l({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
81
82
|
return {
|
|
82
83
|
html: e,
|
|
83
|
-
ampHtml:
|
|
84
|
+
ampHtml: a,
|
|
84
85
|
ampErrors: o,
|
|
85
|
-
displayConditions:
|
|
86
|
+
displayConditions: i
|
|
86
87
|
};
|
|
87
88
|
} catch (e) {
|
|
88
89
|
return n(e, "Error loading preview"), {
|
|
@@ -94,30 +95,30 @@ const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
|
|
|
94
95
|
}
|
|
95
96
|
},
|
|
96
97
|
updateTimerInClonedTemplate: () => new Promise((t) => {
|
|
97
|
-
var e,
|
|
98
|
-
if (typeof ((
|
|
98
|
+
var e, i;
|
|
99
|
+
if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
|
|
99
100
|
t(null);
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
try {
|
|
103
|
-
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((
|
|
104
|
-
|
|
104
|
+
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, o) => {
|
|
105
|
+
a ? (n(a, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
105
106
|
});
|
|
106
|
-
} catch (
|
|
107
|
-
n(
|
|
107
|
+
} catch (a) {
|
|
108
|
+
n(a, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
108
109
|
}
|
|
109
110
|
}),
|
|
110
111
|
updateHtmlAndCss: (t, e) => {
|
|
111
|
-
const { actionsApi:
|
|
112
|
-
return
|
|
113
|
-
|
|
112
|
+
const { actionsApi: i } = s();
|
|
113
|
+
return r("updateHtmlAndCss", h, (a) => {
|
|
114
|
+
i.updateHtmlAndCss(t, e, () => a());
|
|
114
115
|
});
|
|
115
116
|
},
|
|
116
|
-
editorSave: () =>
|
|
117
|
+
editorSave: () => r(
|
|
117
118
|
"save",
|
|
118
119
|
T,
|
|
119
120
|
(t) => {
|
|
120
|
-
|
|
121
|
+
s().actionsApi.save((e) => {
|
|
121
122
|
if (e) {
|
|
122
123
|
n(e, "Failed to save template"), t(!1);
|
|
123
124
|
return;
|
|
@@ -129,5 +130,5 @@ const D = 1e4, T = 3e4, p = (n, l, w) => new Promise((A, s) => {
|
|
|
129
130
|
};
|
|
130
131
|
};
|
|
131
132
|
export {
|
|
132
|
-
|
|
133
|
+
P as useActionsApi
|
|
133
134
|
};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ToasterTypeOptions as d } from "../enums/toaster.js";
|
|
2
|
+
import { findEditorApi as s, EDITOR_NOT_READY_MESSAGE as p } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { useToaster as E } from "./useToaster.js";
|
|
4
|
+
const T = () => {
|
|
5
|
+
const { showToaster: i } = E(), t = (o) => {
|
|
6
|
+
var r;
|
|
7
|
+
const e = (r = s()) == null ? void 0 : r.codeEditorApi;
|
|
8
|
+
if (!e) {
|
|
9
|
+
i({ type: d.Error, message: p });
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
o(e);
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
openCodeEditor: () => {
|
|
16
|
+
t((o) => o.openCodeEditor());
|
|
17
|
+
},
|
|
18
|
+
closeCodeEditor: () => {
|
|
19
|
+
t((o) => o.closeCodeEditor());
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
9
23
|
export {
|
|
10
|
-
|
|
24
|
+
T as useCodeEditorApi
|
|
11
25
|
};
|