@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.
Files changed (44) hide show
  1. package/README.md +41 -2
  2. package/dist/components/Guido.vue.js +3 -3
  3. package/dist/components/Guido.vue2.js +65 -67
  4. package/dist/components/organisms/base/Toaster.vue.js +6 -6
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  6. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  7. package/dist/composables/useSave.js +16 -12
  8. package/dist/composables/useStripo.js +63 -57
  9. package/dist/composables/useStripoEventHandler.js +27 -12
  10. package/dist/composables/useSyncModuleExtractor.js +45 -0
  11. package/dist/composables/useVersionHistoryApi.js +1 -1
  12. package/dist/config/i18n/en/index.js +11 -0
  13. package/dist/config/i18n/en/labels.json.js +7 -0
  14. package/dist/config/i18n/en/toasters.json.js +56 -0
  15. package/dist/config/i18n/en/tooltips.json.js +82 -0
  16. package/dist/config/i18n/index.js +7 -0
  17. package/dist/enums/unsubscribe.js +25 -21
  18. package/dist/guido.css +1 -1
  19. package/dist/services/stripoApi.js +56 -17
  20. package/dist/src/@types/config/schemas.d.ts +1 -1
  21. package/dist/src/@types/events.d.ts +38 -2
  22. package/dist/src/components/Guido.vue.d.ts +2 -2
  23. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  24. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  25. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  26. package/dist/src/composables/useGuidoActions.d.ts +1 -1
  27. package/dist/src/composables/useSave.d.ts +2 -2
  28. package/dist/src/composables/useStripo.d.ts +2 -2
  29. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  30. package/dist/src/config/i18n/en/index.d.ts +1 -0
  31. package/dist/src/config/i18n/index.d.ts +16 -0
  32. package/dist/src/enums/unsubscribe.d.ts +3 -0
  33. package/dist/src/mock/api/settings.d.ts +2 -0
  34. package/dist/src/services/stripoApi.d.ts +5 -0
  35. package/dist/src/stores/editor.d.ts +23 -0
  36. package/dist/src/utils/templatePreparation.d.ts +1 -1
  37. package/dist/static/styles/components/notification.css.js +18 -0
  38. package/dist/static/styles/components/tools.css.js +6 -2
  39. package/dist/static/styles/variables.css.js +2 -0
  40. package/dist/static/templates/empty/index.html.js +74 -0
  41. package/dist/static/templates/empty/style.css.js +779 -0
  42. package/dist/stores/editor.js +2 -1
  43. package/dist/utils/templatePreparation.js +1 -1
  44. 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" src="./public/guido.png" alt="Guido logo">
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` | `Template` | Save completed successfully |
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
@@ -12,9 +12,9 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "f3f58806"
15
+ "a26d7792"
16
16
  );
17
- const u = s.exports;
17
+ const v = s.exports;
18
18
  export {
19
- u as default
19
+ v as default
20
20
  };
@@ -1,66 +1,64 @@
1
- import { defineComponent as V, defineAsyncComponent as P, ref as A, computed as N, watch as j, onMounted as J, onUnmounted as Q } from "vue";
2
- import { provideGuidoActions as X } from "../composables/useGuidoActions.js";
3
- import { usePartner as Y } from "../composables/usePartner.js";
4
- import { useStripo as Z } from "../composables/useStripo.js";
5
- import { useTimerClone as $ } from "../composables/useTimerClone.js";
6
- import { migrate as W } from "../config/migrator/index.js";
7
- import { ModuleFolderDefaults as I } from "../enums/defaults.js";
8
- import ee from "./organisms/base/Toaster.vue.js";
9
- import oe from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
10
- import te from "./organisms/header/HeaderWrapper.vue.js";
11
- import ne from "./organisms/LoadingWrapper.vue.js";
12
- import re from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
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 ae } from "../services/stripoApi.js";
14
+ import { useStripoApi as re } from "../services/stripoApi.js";
15
15
  import { useConfigStore as ce } from "../stores/config.js";
16
- import { useDynamicContentStore as ie } from "../stores/dynamic-content.js";
17
- import { useEditorStore as de } from "../stores/editor.js";
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 { useToasterStore as le } from "../stores/toaster.js";
20
- import { useUnsubscribeStore as ue } from "../stores/unsubscribe.js";
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(O, { expose: G, emit: t }) {
28
- const p = O, H = P(
26
+ setup(W, { expose: I, emit: t }) {
27
+ const v = W, O = _(
29
28
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
30
- ), R = P(
29
+ ), G = _(
31
30
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
32
- ), v = A(), i = ie(), f = ue(), y = le(), r = ce();
33
- r.init(p.config);
34
- const d = de(), x = me(), s = N(() => d.hasChanges), { isTestPartner: B } = Y(), h = () => {
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 = v.value) == null ? void 0 : e.handleSave(!0);
35
+ return (e = h.value) == null ? void 0 : e.handleSave(!0);
37
36
  }, {
38
- templateId: m,
39
- userId: S,
40
- partnerName: b,
41
- productType: g,
42
- username: w,
37
+ templateId: d,
38
+ userId: b,
39
+ partnerName: S,
40
+ username: g,
43
41
  template: o,
44
42
  editor: n
45
- } = r, a = (o == null ? void 0 : o.html) || "", D = (o == null ? void 0 : o.css) || "", l = (o == null ? void 0 : o.preselectedDynamicContent) || [], E = (n == null ? void 0 : n.savedModulesFolderName) || I.SAVED_MODULES, C = (n == null ? void 0 : n.defaultModulesFolderName) || I.DEFAULT_MODULES;
46
- d.templateId = m;
47
- const c = A(!1), { initPlugin: T } = Z({
48
- emailId: m,
49
- userId: S,
50
- username: w,
51
- partnerName: b,
52
- productType: g,
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: _ } = ae(), { cloneTimersOnSave: k, hasTimerBlocks: F } = $(), q = N(() => {
57
+ }, { initPlugin: T } = Y(u, C), { getDefaultTemplate: k } = re(), { cloneTimersOnSave: F, hasTimerBlocks: U } = Z(), B = P(() => {
60
58
  var e;
61
- return !((e = r.ui) != null && e.showHeader);
59
+ return !((e = s.ui) != null && e.showHeader);
62
60
  });
63
- X({
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
- console.debug("guido:save:complete", e), t("save:complete", e);
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 U = (e) => {
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
- }, L = () => {
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(() => s.value, () => {
83
- t("on-change", s.value);
81
+ j(() => c.value, () => {
82
+ t("on-change", c.value);
84
83
  });
85
- const u = (e) => {
86
- const M = e, { attribute: z, position: K } = M.detail;
87
- console.debug("dynamic-content:open", M.detail), t("dynamic-content:open", z, K);
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 J(async () => {
88
+ return q(async () => {
90
89
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
91
90
  try {
92
- f.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
91
+ y.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
93
92
  let e = {
94
- html: a && await W(a),
93
+ html: a && await A(a),
95
94
  css: D
96
95
  };
97
- e.html || (e = await _(), e.html = await W(e.html)), F(e.html) && (e.html = await k(e.html)), await T(e), i.selectedDynamicContentList = l;
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", u), c.value = !0;
102
- }), Q(() => {
103
- var e;
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
- r.reset();
111
- }), G({
108
+ s.reset();
109
+ }), I({
112
110
  dynamicContent: {
113
- insert: U,
114
- close: L
111
+ insert: L,
112
+ close: M
115
113
  },
116
- hasChanges: s,
117
- saveSilent: h
118
- }), { __sfc: !0, PreviewContainer: H, OnboardingWrapper: R, headerWrapperRef: v, dynamicContentStore: i, unsubscribeStore: f, toasterStore: y, props: p, configStore: r, editorStore: d, previewStore: x, hasChanges: s, isTestPartner: B, saveSilent: h, templateId: m, userId: S, partnerName: b, productType: g, username: w, templateConfig: o, editorConfig: n, html: a, css: D, preselectedDynamicContentList: l, savedModulesFolderName: E, defaultModulesFolderName: C, editorReady: c, emit: t, initPlugin: T, getDefaultTemplate: _, cloneTimersOnSave: k, hasTimerBlocks: F, noHeader: q, insertDynamicContent: U, closeDynamicContent: L, handleDynamicContentOpen: u, Toaster: ee, FilterSelectionDrawer: oe, HeaderWrapper: te, LoadingWrapper: ne, SaveAsTemplateDrawer: re, UnsubscribeWrapper: se };
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
- Ae as default
120
+ Me as default
123
121
  };
@@ -1,17 +1,17 @@
1
- import n from "./Toaster.vue2.js";
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, e = o._self._c, t = o._self._setupProxy;
5
- return e(t.InToasts, { attrs: { id: "guido__toaster", "action-buttons-config": t.actionButtonsConfig, status: t.store.status, text: t.store.text, type: t.store.type }, on: { actionButtonClick0: t.handleActionClick } });
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
- n,
7
+ e,
8
8
  r,
9
9
  a,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const f = _.exports;
14
+ const l = _.exports;
15
15
  export {
16
- f as default
16
+ l as default
17
17
  };
@@ -1,16 +1,16 @@
1
- import s from "./EmailSizeIndicator.vue2.js";
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 e = this, i = e._self._c, t = e._self._setupProxy;
6
- return t.previewStore.previewHtml ? i("div", { staticClass: "d-f a-i-c j-c-c" }, [i(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.htmlSize, "max-value": t.MAX_EMAIL_SIZE_IN_KB, type: t.progress.type, value: t.progress.value } }), i(t.InTooltipV2, { attrs: { id: "email-size-tooltip", "icon-status": "", "static-position": "bottom center", "dynamic-position": !1, text: t.trans("email-editor.preview-design-size-tooltip") } })], 1) : e._e();
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
- s,
8
+ i,
9
9
  o,
10
10
  a,
11
11
  !1,
12
12
  null,
13
- "079d2bf7"
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 { InTooltipV2 as v, InProgress as f } from "@useinsider/design-system-vue";
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, InTooltipV2: v };
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 l } from "./useConfig.js";
2
- import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
3
- import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
4
- import { useHtmlValidator as p } from "./useHtmlValidator.js";
5
- const w = () => {
6
- const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
7
- return { save: async (r = !1) => {
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
- i();
10
- const { prepareTemplateDetails: n } = d(), t = await n();
11
- if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
12
- return r || s(t), t;
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
- w as useSave
20
+ g as useSave
17
21
  };
@@ -1,26 +1,27 @@
1
- import { useActionsApi as _ } from "./useActionsApi.js";
2
- import { useBlocksConfig as B } from "./useBlocksConfig.js";
3
- import { useConfig as v } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
6
- import { useToaster as D } from "./useToaster.js";
7
- import { displayConditions as I } from "../enums/displayConditions.js";
8
- import { useStripoApi as M } from "../services/stripoApi.js";
9
- import U from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as P } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
12
- import H from "../package.json.js";
13
- const W = (c) => {
14
- const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
15
- var m, g, f;
16
- const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
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: c,
21
- html: r,
22
- css: p,
23
- forceRecreate: T,
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: U,
34
- conditionsEnabled: a,
35
- customConditionsEnabled: a,
36
- conditionCategories: I,
34
+ customViewStyles: q,
35
+ conditionsEnabled: p,
36
+ customConditionsEnabled: p,
37
+ conditionCategories: H,
37
38
  enableXSSSecurity: !0,
38
- modulesDisabled: k,
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
- ...s ? { baseBlocks: s } : {},
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: R(c.preselectedDynamicContentList)
55
+ entries: x(c.preselectedDynamicContentList)
54
56
  }
55
57
  ],
56
- async onTokenRefreshRequest(e) {
58
+ async onTokenRefreshRequest(t) {
57
59
  try {
58
- const d = await C();
59
- e(d);
60
- } catch (d) {
61
- u(d, "Failed to refresh token");
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: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
67
- e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
68
- o.hasChanges = !1;
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 (e) {
71
- u(e, "Failed to load custom interface appearance");
72
+ } catch (t) {
73
+ u(t, "Failed to load custom interface appearance");
72
74
  }
73
75
  },
74
- onCodeEditorVisibilityChanged(e) {
75
- o.isCodeEditorOpen = e;
76
+ onCodeEditorVisibilityChanged(t) {
77
+ e.isCodeEditorOpen = t;
76
78
  },
77
- onEditorVisualModeChanged(e) {
78
- o.editorVisualMode = e.toLowerCase();
79
+ onEditorVisualModeChanged(t) {
80
+ e.editorVisualMode = t.toLowerCase();
79
81
  },
80
- onVersionHistoryVisibilityChanged(e) {
81
- o.isVersionHistoryOpen = e;
82
+ onVersionHistoryVisibilityChanged(t) {
83
+ e.isVersionHistoryOpen = t;
82
84
  },
83
85
  onDataChanged() {
84
- o.hasChanges = !0;
86
+ e.hasChanges = !0;
85
87
  },
86
- onEvent: E,
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: t
94
+ extensions: d,
95
+ localePatch: R
93
96
  }
94
97
  );
95
- }, b = (i) => new Promise((n, o) => {
96
- var a;
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 r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
102
- t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
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
- }, t.onerror = () => {
105
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
106
- }, document.body.appendChild(t);
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 b(async () => {
110
- const n = await S();
111
- await w(i, n);
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
- W as useStripo
122
+ oe as useStripo
117
123
  };
@@ -1,20 +1,35 @@
1
- import { useOnboardingStore as i } from "../stores/onboarding.js";
2
- const c = () => {
3
- const e = {
4
- block_dropped: ({ blockName: t }) => {
5
- if (t === "BLOCK_TEXT") {
6
- const n = i(), o = !n.shouldShowOnboarding("textBlockOnboarding"), r = n.isActive("textBlockOnboarding");
7
- if (o || r)
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
- n.start("textBlockOnboarding");
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 (t, n) => {
14
- const o = e[t];
15
- o && await o(n);
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
- c as useStripoEventHandler
34
+ v as useStripoEventHandler
20
35
  };