@useinsider/guido 2.1.0-beta.37311dd → 2.1.0-beta.37f9328
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 +41 -2
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +65 -67
- package/dist/components/organisms/base/Toaster.vue.js +6 -6
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +63 -57
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +45 -0
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +7 -0
- package/dist/config/i18n/en/toasters.json.js +56 -0
- package/dist/config/i18n/en/tooltips.json.js +82 -0
- package/dist/config/i18n/index.js +7 -0
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +56 -17
- package/dist/src/@types/config/schemas.d.ts +1 -1
- package/dist/src/@types/events.d.ts +38 -2
- package/dist/src/components/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useGuidoActions.d.ts +1 -1
- package/dist/src/composables/useSave.d.ts +2 -2
- package/dist/src/composables/useStripo.d.ts +2 -2
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/config/i18n/en/index.d.ts +1 -0
- package/dist/src/config/i18n/index.d.ts +16 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/templatePreparation.d.ts +1 -1
- package/dist/static/styles/components/notification.css.js +18 -0
- package/dist/static/styles/components/tools.css.js +6 -2
- package/dist/static/styles/variables.css.js +2 -0
- package/dist/static/templates/empty/index.html.js +74 -0
- package/dist/static/templates/empty/style.css.js +779 -0
- package/dist/stores/editor.js +2 -1
- package/dist/utils/templatePreparation.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.youtube.com/shorts/Y0RwBeMezL4" target="_blank" rel="noopener noreferrer">
|
|
3
|
-
<img width="180"
|
|
3
|
+
<img width="180"
|
|
4
|
+
src="https://web-image.useinsider.com/guido/defaultImageLibrary/iUH0liTK0d2YDsVB5LDN1770169173.jpg"
|
|
5
|
+
alt="Guido logo">
|
|
4
6
|
</a>
|
|
5
7
|
</p>
|
|
6
8
|
|
|
@@ -172,11 +174,48 @@ const config: GuidoConfigInput = {
|
|
|
172
174
|
| `dynamic-content:open` | `DynamicContent \| null` | User wants to insert dynamic content |
|
|
173
175
|
| `back` | - | Back button clicked |
|
|
174
176
|
| `save:start` | - | Save process started |
|
|
175
|
-
| `save:complete` | `
|
|
177
|
+
| `save:complete` | `SavedTemplateDetails` | Save completed successfully (includes `metadata`) |
|
|
176
178
|
| `on-change` | - | Template was modified |
|
|
177
179
|
| `test-email:click` | - | Test email button clicked |
|
|
178
180
|
| `onboarding-finished` | - | Onboarding popup dismissed |
|
|
179
181
|
|
|
182
|
+
### `save:complete` Payload
|
|
183
|
+
|
|
184
|
+
The `save:complete` event emits a `SavedTemplateDetails` object containing the compiled template data along with editor `metadata`:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface SavedTemplateDetails {
|
|
188
|
+
dynamicContentList: DynamicContent[];
|
|
189
|
+
compiledHtml: string;
|
|
190
|
+
rawHtml: string;
|
|
191
|
+
css: string;
|
|
192
|
+
ampHtml: string;
|
|
193
|
+
ampErrors: string[];
|
|
194
|
+
modules: number[];
|
|
195
|
+
recommendation: {
|
|
196
|
+
campaignUrls: Record<string, string>;
|
|
197
|
+
configs: Record<string, string>;
|
|
198
|
+
};
|
|
199
|
+
unsubscribe: {
|
|
200
|
+
status: boolean;
|
|
201
|
+
config: number[];
|
|
202
|
+
};
|
|
203
|
+
metadata: Metadata;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
interface Metadata {
|
|
207
|
+
emailId: string;
|
|
208
|
+
partnerName?: string;
|
|
209
|
+
productType?: number;
|
|
210
|
+
userId: string;
|
|
211
|
+
username?: string;
|
|
212
|
+
savedModulesFolderName?: string;
|
|
213
|
+
defaultModulesFolderName?: string;
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
> ⚠️ **Important:** The `metadata` object in the `save:complete` payload must be passed directly into your `templateConfig` / `stripoConfig` object while saving. This ensures the email-service receives the correct version of sync modules features
|
|
218
|
+
|
|
180
219
|
---
|
|
181
220
|
|
|
182
221
|
## Exposed Methods
|
|
@@ -1,66 +1,64 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as
|
|
3
|
-
import { usePartner as
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import { useTimerClone as
|
|
6
|
-
import { migrate as
|
|
7
|
-
import { ModuleFolderDefaults as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
1
|
+
import { defineComponent as K, defineAsyncComponent as _, ref as V, computed as P, watch as j, onMounted as q, onUnmounted as J } from "vue";
|
|
2
|
+
import { provideGuidoActions as Q } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as X } from "../composables/usePartner.js";
|
|
4
|
+
import { useStripo as Y } from "../composables/useStripo.js";
|
|
5
|
+
import { useTimerClone as Z } from "../composables/useTimerClone.js";
|
|
6
|
+
import { migrate as A } from "../config/migrator/index.js";
|
|
7
|
+
import { ModuleFolderDefaults as N } from "../enums/defaults.js";
|
|
8
|
+
import $ from "./organisms/base/Toaster.vue.js";
|
|
9
|
+
import ee from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
10
|
+
import oe from "./organisms/header/HeaderWrapper.vue.js";
|
|
11
|
+
import te from "./organisms/LoadingWrapper.vue.js";
|
|
12
|
+
import ne from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
13
13
|
import se from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
14
|
-
import { useStripoApi as
|
|
14
|
+
import { useStripoApi as re } from "../services/stripoApi.js";
|
|
15
15
|
import { useConfigStore as ce } from "../stores/config.js";
|
|
16
|
-
import { useDynamicContentStore as
|
|
17
|
-
import { useEditorStore as
|
|
16
|
+
import { useDynamicContentStore as ae } from "../stores/dynamic-content.js";
|
|
17
|
+
import { useEditorStore as ie } from "../stores/editor.js";
|
|
18
18
|
import { usePreviewStore as me } from "../stores/preview.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
const Ae = /* @__PURE__ */ V({
|
|
19
|
+
import { useUnsubscribeStore as de } from "../stores/unsubscribe.js";
|
|
20
|
+
const Me = /* @__PURE__ */ K({
|
|
22
21
|
__name: "Guido",
|
|
23
22
|
props: {
|
|
24
23
|
config: null
|
|
25
24
|
},
|
|
26
25
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
26
|
+
setup(W, { expose: I, emit: t }) {
|
|
27
|
+
const v = W, O = _(
|
|
29
28
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
30
|
-
),
|
|
29
|
+
), G = _(
|
|
31
30
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
const
|
|
31
|
+
), h = V(), i = ae(), y = de(), s = ce();
|
|
32
|
+
s.init(v.config);
|
|
33
|
+
const m = ie(), H = me(), c = P(() => m.hasChanges), { isTestPartner: x } = X(), f = () => {
|
|
35
34
|
var e;
|
|
36
|
-
return (e =
|
|
35
|
+
return (e = h.value) == null ? void 0 : e.handleSave(!0);
|
|
37
36
|
}, {
|
|
38
|
-
templateId:
|
|
39
|
-
userId:
|
|
40
|
-
partnerName:
|
|
41
|
-
|
|
42
|
-
username: w,
|
|
37
|
+
templateId: d,
|
|
38
|
+
userId: b,
|
|
39
|
+
partnerName: S,
|
|
40
|
+
username: g,
|
|
43
41
|
template: o,
|
|
44
42
|
editor: n
|
|
45
|
-
} =
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
emailId:
|
|
49
|
-
userId:
|
|
50
|
-
username:
|
|
51
|
-
partnerName:
|
|
52
|
-
|
|
43
|
+
} = s, a = (o == null ? void 0 : o.html) || "", D = (o == null ? void 0 : o.css) || "", l = (o == null ? void 0 : o.preselectedDynamicContent) || [], w = (n == null ? void 0 : n.savedModulesFolderName) || N.SAVED_MODULES, E = (n == null ? void 0 : n.defaultModulesFolderName) || N.DEFAULT_MODULES;
|
|
44
|
+
m.templateId = d;
|
|
45
|
+
const u = {
|
|
46
|
+
emailId: d,
|
|
47
|
+
userId: b,
|
|
48
|
+
username: g,
|
|
49
|
+
partnerName: S,
|
|
50
|
+
savedModulesFolderName: w,
|
|
51
|
+
defaultModulesFolderName: E
|
|
52
|
+
}, C = {
|
|
53
53
|
preselectedDynamicContentList: l,
|
|
54
|
-
savedModulesFolderName: E,
|
|
55
|
-
defaultModulesFolderName: C,
|
|
56
54
|
onReady: () => {
|
|
57
55
|
console.debug("guido:ready"), t("ready");
|
|
58
56
|
}
|
|
59
|
-
}), { getDefaultTemplate:
|
|
57
|
+
}, { initPlugin: T } = Y(u, C), { getDefaultTemplate: k } = re(), { cloneTimersOnSave: F, hasTimerBlocks: U } = Z(), B = P(() => {
|
|
60
58
|
var e;
|
|
61
|
-
return !((e =
|
|
59
|
+
return !((e = s.ui) != null && e.showHeader);
|
|
62
60
|
});
|
|
63
|
-
|
|
61
|
+
Q({
|
|
64
62
|
onBack: () => {
|
|
65
63
|
console.debug("guido:back"), t("back");
|
|
66
64
|
},
|
|
@@ -68,56 +66,56 @@ const Ae = /* @__PURE__ */ V({
|
|
|
68
66
|
console.debug("guido:save:start"), t("save:start");
|
|
69
67
|
},
|
|
70
68
|
onSaveComplete: (e) => {
|
|
71
|
-
|
|
69
|
+
const r = { ...e, metadata: u };
|
|
70
|
+
console.debug("guido:save:complete", r), t("save:complete", r);
|
|
72
71
|
},
|
|
73
72
|
onTestEmailClick: () => {
|
|
74
73
|
console.debug("guido:test-email:click"), t("test-email:click");
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
|
-
const
|
|
76
|
+
const L = (e) => {
|
|
78
77
|
console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
79
|
-
},
|
|
78
|
+
}, M = () => {
|
|
80
79
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
81
80
|
};
|
|
82
|
-
j(() =>
|
|
83
|
-
t("on-change",
|
|
81
|
+
j(() => c.value, () => {
|
|
82
|
+
t("on-change", c.value);
|
|
84
83
|
});
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
console.debug("dynamic-content:open",
|
|
84
|
+
const p = (e) => {
|
|
85
|
+
const r = e, { attribute: R, position: z } = r.detail;
|
|
86
|
+
console.debug("dynamic-content:open", r.detail), t("dynamic-content:open", R, z);
|
|
88
87
|
};
|
|
89
|
-
return
|
|
88
|
+
return q(async () => {
|
|
90
89
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
91
90
|
try {
|
|
92
|
-
|
|
91
|
+
y.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
|
|
93
92
|
let e = {
|
|
94
|
-
html: a && await
|
|
93
|
+
html: a && await A(a),
|
|
95
94
|
css: D
|
|
96
95
|
};
|
|
97
|
-
e.html || (e = await
|
|
96
|
+
e.html || (e = await k(), e.html = await A(e.html)), U(e.html) && (e.html = await F(e.html)), await T(e), i.selectedDynamicContentList = l;
|
|
98
97
|
} catch (e) {
|
|
99
98
|
console.error("Failed to initialize Stripo editor:", e);
|
|
100
99
|
}
|
|
101
|
-
document.addEventListener("dynamic-content:open",
|
|
102
|
-
}),
|
|
103
|
-
|
|
104
|
-
c.value && (y.hideToaster(), (e = document.querySelector("#guido__toaster")) == null || e.remove()), c.value = !1, document.removeEventListener("dynamic-content:open", u);
|
|
100
|
+
document.addEventListener("dynamic-content:open", p);
|
|
101
|
+
}), J(() => {
|
|
102
|
+
document.removeEventListener("dynamic-content:open", p);
|
|
105
103
|
try {
|
|
106
104
|
window.UIEditor.removeEditor();
|
|
107
105
|
} catch {
|
|
108
106
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
109
107
|
}
|
|
110
|
-
|
|
111
|
-
}),
|
|
108
|
+
s.reset();
|
|
109
|
+
}), I({
|
|
112
110
|
dynamicContent: {
|
|
113
|
-
insert:
|
|
114
|
-
close:
|
|
111
|
+
insert: L,
|
|
112
|
+
close: M
|
|
115
113
|
},
|
|
116
|
-
hasChanges:
|
|
117
|
-
saveSilent:
|
|
118
|
-
}), { __sfc: !0, PreviewContainer:
|
|
114
|
+
hasChanges: c,
|
|
115
|
+
saveSilent: f
|
|
116
|
+
}), { __sfc: !0, PreviewContainer: O, OnboardingWrapper: G, headerWrapperRef: h, dynamicContentStore: i, unsubscribeStore: y, props: v, configStore: s, editorStore: m, previewStore: H, hasChanges: c, isTestPartner: x, saveSilent: f, templateId: d, userId: b, partnerName: S, username: g, templateConfig: o, editorConfig: n, html: a, css: D, preselectedDynamicContentList: l, savedModulesFolderName: w, defaultModulesFolderName: E, emit: t, metadata: u, options: C, initPlugin: T, getDefaultTemplate: k, cloneTimersOnSave: F, hasTimerBlocks: U, noHeader: B, insertDynamicContent: L, closeDynamicContent: M, handleDynamicContentOpen: p, Toaster: $, FilterSelectionDrawer: ee, HeaderWrapper: oe, LoadingWrapper: te, SaveAsTemplateDrawer: ne, UnsubscribeWrapper: se };
|
|
119
117
|
}
|
|
120
118
|
});
|
|
121
119
|
export {
|
|
122
|
-
|
|
120
|
+
Me as default
|
|
123
121
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "./Toaster.vue2.js";
|
|
2
2
|
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var r = function() {
|
|
4
|
-
var o = this,
|
|
5
|
-
return
|
|
4
|
+
var o = this, n = o._self._c, t = o._self._setupProxy;
|
|
5
|
+
return n(t.InToasts, { attrs: { "action-buttons-config": t.actionButtonsConfig, status: t.store.status, text: t.store.text, type: t.store.type }, on: { actionButtonClick0: t.handleActionClick } });
|
|
6
6
|
}, a = [], _ = /* @__PURE__ */ s(
|
|
7
|
-
|
|
7
|
+
e,
|
|
8
8
|
r,
|
|
9
9
|
a,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
12
12
|
null
|
|
13
13
|
);
|
|
14
|
-
const
|
|
14
|
+
const l = _.exports;
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
l as default
|
|
17
17
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i from "./EmailSizeIndicator.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var o = function() {
|
|
5
|
-
var
|
|
6
|
-
return
|
|
5
|
+
var t = this, s = t._self._c, e = t._self._setupProxy;
|
|
6
|
+
return e.previewStore.previewHtml ? s("div", { staticClass: "d-f a-i-c j-c-c" }, [s(e.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: e.htmlSize, "max-value": e.MAX_EMAIL_SIZE_IN_KB, type: e.progress.type, value: e.progress.value } }), s(e.InTooltip, { staticClass: "d-f ml-1", attrs: { id: "email-size-tooltip", align: "center", position: "bottom", text: e.trans("email-editor.preview-design-size-tooltip") } })], 1) : t._e();
|
|
7
7
|
}, a = [], n = /* @__PURE__ */ r(
|
|
8
|
-
|
|
8
|
+
i,
|
|
9
9
|
o,
|
|
10
10
|
a,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"913a3417"
|
|
14
14
|
);
|
|
15
15
|
const m = n.exports;
|
|
16
16
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as c, ref as n, computed as l, watch as u } from "vue";
|
|
2
2
|
import { useTranslations as p } from "../../../../composables/useTranslations.js";
|
|
3
3
|
import { usePreviewStore as _ } from "../../../../stores/preview.js";
|
|
4
|
-
import {
|
|
4
|
+
import { InTooltip as v, InProgress as f } from "@useinsider/design-system-vue";
|
|
5
5
|
const S = /* @__PURE__ */ c({
|
|
6
6
|
__name: "EmailSizeIndicator",
|
|
7
7
|
setup(w) {
|
|
@@ -17,7 +17,7 @@ const S = /* @__PURE__ */ c({
|
|
|
17
17
|
}, i = p();
|
|
18
18
|
return u(() => t.previewHtml, () => {
|
|
19
19
|
r();
|
|
20
|
-
}, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f,
|
|
20
|
+
}, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltip: v };
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
export {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useSaveStart as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useConfig as d } from "./useConfig.js";
|
|
2
|
+
import { useSaveStart as p, useSaveComplete as f } from "./useGuidoActions.js";
|
|
3
|
+
import { useSyncModuleExtractor as v } from "./useSyncModuleExtractor.js";
|
|
4
|
+
import { useStripoApi as S } from "../services/stripoApi.js";
|
|
5
|
+
import { useTemplatePreparation as x } from "../utils/templatePreparation.js";
|
|
6
|
+
import { useHtmlValidator as V } from "./useHtmlValidator.js";
|
|
7
|
+
const g = () => {
|
|
8
|
+
const o = p(), s = f(), { validateHtml: i } = V(), { callbacks: a } = d(), { extractSyncModuleData: r } = v(), { setSyncModuleUnsubscriptionPages: n } = S();
|
|
9
|
+
return { save: async (l = !1) => {
|
|
8
10
|
var e;
|
|
9
|
-
|
|
10
|
-
const { prepareTemplateDetails:
|
|
11
|
-
if (await
|
|
12
|
-
return
|
|
11
|
+
o();
|
|
12
|
+
const { prepareTemplateDetails: c } = x(), t = await c();
|
|
13
|
+
if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
|
|
14
|
+
return;
|
|
15
|
+
const { unsubscribePayload: m, stripoModules: u } = r(t.rawHtml);
|
|
16
|
+
return await n(m), t.modules = u, l || s(t), t;
|
|
13
17
|
} };
|
|
14
18
|
};
|
|
15
19
|
export {
|
|
16
|
-
|
|
20
|
+
g as useSave
|
|
17
21
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useActionsApi as A } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as F } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as D } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as I } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as P } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as U } from "./useToaster.js";
|
|
7
|
+
import { localePatch as R } from "../config/i18n/index.js";
|
|
8
|
+
import { displayConditions as H } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as O } from "../services/stripoApi.js";
|
|
10
|
+
import q from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as S } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as x } from "../utils/genericUtil.js";
|
|
13
|
+
import L from "../package.json.js";
|
|
14
|
+
const oe = (C, c) => {
|
|
15
|
+
const { features: l, template: E } = D(), { handleError: u } = U(), { getToken: h, getCustomFonts: w, getSyncModulesStatus: b } = O(), { handleEvent: k } = P(), { getStripoBlocksConfig: T } = F(), V = async (i, n = [], r = !1) => {
|
|
16
|
+
var f, g, y;
|
|
17
|
+
const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await T(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, B = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, v = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
17
18
|
window.UIEditor.initEditor(
|
|
18
19
|
document.querySelector("#guido-editor"),
|
|
19
20
|
{
|
|
20
|
-
metadata:
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
21
|
+
metadata: C,
|
|
22
|
+
html: m,
|
|
23
|
+
css: a,
|
|
24
|
+
forceRecreate: v,
|
|
24
25
|
locale: "en",
|
|
25
26
|
undoButtonSelector: "#guido__undo-button",
|
|
26
27
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,19 +31,20 @@ const W = (c) => {
|
|
|
30
31
|
customAppearanceMergetags: !0,
|
|
31
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
34
|
+
customViewStyles: q,
|
|
35
|
+
conditionsEnabled: p,
|
|
36
|
+
customConditionsEnabled: p,
|
|
37
|
+
conditionCategories: H,
|
|
37
38
|
enableXSSSecurity: !0,
|
|
38
|
-
modulesDisabled:
|
|
39
|
+
modulesDisabled: B,
|
|
40
|
+
syncModulesEnabled: r,
|
|
39
41
|
messageSettingsEnabled: !0,
|
|
40
42
|
displayGmailAnnotations: !0,
|
|
41
43
|
displayHiddenPreheader: !1,
|
|
42
44
|
displayTitle: !1,
|
|
43
45
|
displayUTM: !1,
|
|
44
46
|
selectElementAfterDrop: !0,
|
|
45
|
-
...
|
|
47
|
+
...o ? { baseBlocks: o } : {},
|
|
46
48
|
editorFonts: {
|
|
47
49
|
showDefaultStandardFonts: !0,
|
|
48
50
|
showDefaultNotStandardFonts: !0,
|
|
@@ -50,68 +52,72 @@ const W = (c) => {
|
|
|
50
52
|
},
|
|
51
53
|
mergeTags: [
|
|
52
54
|
{
|
|
53
|
-
entries:
|
|
55
|
+
entries: x(c.preselectedDynamicContentList)
|
|
54
56
|
}
|
|
55
57
|
],
|
|
56
|
-
async onTokenRefreshRequest(
|
|
58
|
+
async onTokenRefreshRequest(t) {
|
|
57
59
|
try {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
} catch (
|
|
61
|
-
u(
|
|
60
|
+
const s = await h();
|
|
61
|
+
t(s);
|
|
62
|
+
} catch (s) {
|
|
63
|
+
u(s, "Failed to refresh token");
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
onTemplateLoaded() {
|
|
65
67
|
try {
|
|
66
|
-
const { importCss:
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const { importCss: t } = I(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: M } = A();
|
|
69
|
+
t(), s(), M(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
70
|
+
e.hasChanges = !1;
|
|
69
71
|
}, 1e3);
|
|
70
|
-
} catch (
|
|
71
|
-
u(
|
|
72
|
+
} catch (t) {
|
|
73
|
+
u(t, "Failed to load custom interface appearance");
|
|
72
74
|
}
|
|
73
75
|
},
|
|
74
|
-
onCodeEditorVisibilityChanged(
|
|
75
|
-
|
|
76
|
+
onCodeEditorVisibilityChanged(t) {
|
|
77
|
+
e.isCodeEditorOpen = t;
|
|
76
78
|
},
|
|
77
|
-
onEditorVisualModeChanged(
|
|
78
|
-
|
|
79
|
+
onEditorVisualModeChanged(t) {
|
|
80
|
+
e.editorVisualMode = t.toLowerCase();
|
|
79
81
|
},
|
|
80
|
-
onVersionHistoryVisibilityChanged(
|
|
81
|
-
|
|
82
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
83
|
+
e.isVersionHistoryOpen = t;
|
|
82
84
|
},
|
|
83
85
|
onDataChanged() {
|
|
84
|
-
|
|
86
|
+
e.hasChanges = !0;
|
|
85
87
|
},
|
|
86
|
-
onEvent:
|
|
88
|
+
onEvent: k,
|
|
87
89
|
ignoreClickOutsideSelectors: [
|
|
88
90
|
"#guido-dynamic-content-modal",
|
|
89
91
|
".in-on-board-wrapper",
|
|
90
92
|
".in-drawer__container"
|
|
91
93
|
],
|
|
92
|
-
extensions:
|
|
94
|
+
extensions: d,
|
|
95
|
+
localePatch: R
|
|
93
96
|
}
|
|
94
97
|
);
|
|
95
|
-
},
|
|
96
|
-
var
|
|
98
|
+
}, _ = (i) => new Promise((n, r) => {
|
|
99
|
+
var d;
|
|
97
100
|
if (document.getElementById("UiEditorScript")) {
|
|
98
101
|
i(), n();
|
|
99
102
|
return;
|
|
100
103
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
104
|
+
const e = L.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
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
103
106
|
i(), n();
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
}, document.body.appendChild(
|
|
107
|
+
}, o.onerror = () => {
|
|
108
|
+
r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
109
|
+
}, document.body.appendChild(o);
|
|
107
110
|
});
|
|
108
111
|
return { initPlugin: async (i) => {
|
|
109
|
-
await
|
|
110
|
-
const n = await
|
|
111
|
-
|
|
112
|
+
await _(async () => {
|
|
113
|
+
const n = S(), [r, e] = await Promise.all([
|
|
114
|
+
w(),
|
|
115
|
+
b()
|
|
116
|
+
]);
|
|
117
|
+
n.syncModulesEnabled = e, await V(i, r, e);
|
|
112
118
|
});
|
|
113
119
|
} };
|
|
114
120
|
};
|
|
115
121
|
export {
|
|
116
|
-
|
|
122
|
+
oe as useStripo
|
|
117
123
|
};
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useStripoApi as i } from "../services/stripoApi.js";
|
|
2
|
+
import { useEditorStore as u } from "../stores/editor.js";
|
|
3
|
+
import { useOnboardingStore as l } from "../stores/onboarding.js";
|
|
4
|
+
import { useUnsubscribeStore as b } from "../stores/unsubscribe.js";
|
|
5
|
+
const v = () => {
|
|
6
|
+
const { updateSyncModule: d, getSyncModule: r } = i(), n = u(), s = b(), a = {
|
|
7
|
+
block_dropped: ({ blockName: e }) => {
|
|
8
|
+
if (e === "BLOCK_TEXT") {
|
|
9
|
+
const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
|
|
10
|
+
if (t || c)
|
|
8
11
|
return;
|
|
9
|
-
|
|
12
|
+
o.start("textBlockOnboarding");
|
|
10
13
|
}
|
|
14
|
+
},
|
|
15
|
+
module_saved: async (e) => {
|
|
16
|
+
n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
|
|
17
|
+
},
|
|
18
|
+
module_dropped: async (e) => {
|
|
19
|
+
if (!n.syncModulesEnabled)
|
|
20
|
+
return;
|
|
21
|
+
const { moduleId: o } = e, t = await r(o);
|
|
22
|
+
console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
|
|
23
|
+
},
|
|
24
|
+
module_updated: async (e) => {
|
|
25
|
+
n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
|
|
11
26
|
}
|
|
12
27
|
};
|
|
13
|
-
return { handleEvent: async (
|
|
14
|
-
const
|
|
15
|
-
o && await o
|
|
28
|
+
return { handleEvent: async (e, o) => {
|
|
29
|
+
const t = a[e];
|
|
30
|
+
console.debug("Stripo Event: ", e, o), t && await t(o);
|
|
16
31
|
} };
|
|
17
32
|
};
|
|
18
33
|
export {
|
|
19
|
-
|
|
34
|
+
v as useStripoEventHandler
|
|
20
35
|
};
|