@useinsider/guido 2.1.0-beta.4bc6068 → 2.1.0-beta.4bcb91b

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 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
 
@@ -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 u } from "./useConfig.js";
2
+ import { useSaveStart as d, useSaveComplete as p } from "./useGuidoActions.js";
3
+ import { useSyncModuleExtractor as f } from "./useSyncModuleExtractor.js";
4
+ import { useStripoApi as v } from "../services/stripoApi.js";
5
+ import { useTemplatePreparation as S } from "../utils/templatePreparation.js";
6
+ import { useHtmlValidator as x } from "./useHtmlValidator.js";
7
+ const E = () => {
8
+ const o = d(), s = p(), { validateHtml: i } = x(), { callbacks: a } = u(), { extractSyncModuleUnsubscribeData: r } = f(), { setSyncModuleUnsubscriptionPages: n } = v();
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 } = S(), 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 m = r(t.rawHtml);
16
+ return await n(m), l || s(t), t;
13
17
  } };
14
18
  };
15
19
  export {
16
- w as useSave
20
+ E as useSave
17
21
  };
@@ -1,26 +1,26 @@
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 M } from "./useActionsApi.js";
2
+ import { useBlocksConfig as A } from "./useBlocksConfig.js";
3
+ import { useConfig as F } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as D } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as I } from "./useStripoEventHandler.js";
6
+ import { useToaster as U } from "./useToaster.js";
7
+ import { displayConditions as P } from "../enums/displayConditions.js";
8
+ import { useStripoApi as R } from "../services/stripoApi.js";
9
+ import H from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as S } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as O } from "../utils/genericUtil.js";
12
+ import q from "../package.json.js";
13
+ const Z = (c) => {
14
+ const { features: l, template: C } = F(), { handleError: u } = U(), { getToken: E, getCustomFonts: h, getSyncModulesStatus: w } = R(), { handleEvent: b } = I(), { getStripoBlocksConfig: k } = A(), T = async (i, n = [], r = !1) => {
15
+ var g, f, y;
16
+ const e = S(), { html: p, css: a } = i, { baseBlocks: t, extensions: d } = await k(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, _ = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1, B = ((y = C.value) == null ? void 0 : y.forceRecreate) ?? !1;
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
20
20
  metadata: c,
21
- html: r,
22
- css: p,
23
- forceRecreate: T,
21
+ html: p,
22
+ css: a,
23
+ forceRecreate: B,
24
24
  locale: "en",
25
25
  undoButtonSelector: "#guido__undo-button",
26
26
  redoButtonSelector: "#guido__redo-button",
@@ -30,19 +30,20 @@ const W = (c) => {
30
30
  customAppearanceMergetags: !0,
31
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: U,
34
- conditionsEnabled: a,
35
- customConditionsEnabled: a,
36
- conditionCategories: I,
33
+ customViewStyles: H,
34
+ conditionsEnabled: m,
35
+ customConditionsEnabled: m,
36
+ conditionCategories: P,
37
37
  enableXSSSecurity: !0,
38
- modulesDisabled: k,
38
+ modulesDisabled: _,
39
+ syncModulesEnabled: r,
39
40
  messageSettingsEnabled: !0,
40
41
  displayGmailAnnotations: !0,
41
42
  displayHiddenPreheader: !1,
42
43
  displayTitle: !1,
43
44
  displayUTM: !1,
44
45
  selectElementAfterDrop: !0,
45
- ...s ? { baseBlocks: s } : {},
46
+ ...t ? { baseBlocks: t } : {},
46
47
  editorFonts: {
47
48
  showDefaultStandardFonts: !0,
48
49
  showDefaultNotStandardFonts: !0,
@@ -50,68 +51,71 @@ const W = (c) => {
50
51
  },
51
52
  mergeTags: [
52
53
  {
53
- entries: R(c.preselectedDynamicContentList)
54
+ entries: O(c.preselectedDynamicContentList)
54
55
  }
55
56
  ],
56
- async onTokenRefreshRequest(e) {
57
+ async onTokenRefreshRequest(o) {
57
58
  try {
58
- const d = await C();
59
- e(d);
60
- } catch (d) {
61
- u(d, "Failed to refresh token");
59
+ const s = await E();
60
+ o(s);
61
+ } catch (s) {
62
+ u(s, "Failed to refresh token");
62
63
  }
63
64
  },
64
65
  onTemplateLoaded() {
65
66
  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;
67
+ const { importCss: o } = D(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: v } = M();
68
+ o(), s(), v(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
69
+ e.hasChanges = !1;
69
70
  }, 1e3);
70
- } catch (e) {
71
- u(e, "Failed to load custom interface appearance");
71
+ } catch (o) {
72
+ u(o, "Failed to load custom interface appearance");
72
73
  }
73
74
  },
74
- onCodeEditorVisibilityChanged(e) {
75
- o.isCodeEditorOpen = e;
75
+ onCodeEditorVisibilityChanged(o) {
76
+ e.isCodeEditorOpen = o;
76
77
  },
77
- onEditorVisualModeChanged(e) {
78
- o.editorVisualMode = e.toLowerCase();
78
+ onEditorVisualModeChanged(o) {
79
+ e.editorVisualMode = o.toLowerCase();
79
80
  },
80
- onVersionHistoryVisibilityChanged(e) {
81
- o.isVersionHistoryOpen = e;
81
+ onVersionHistoryVisibilityChanged(o) {
82
+ e.isVersionHistoryOpen = o;
82
83
  },
83
84
  onDataChanged() {
84
- o.hasChanges = !0;
85
+ e.hasChanges = !0;
85
86
  },
86
- onEvent: E,
87
+ onEvent: b,
87
88
  ignoreClickOutsideSelectors: [
88
89
  "#guido-dynamic-content-modal",
89
90
  ".in-on-board-wrapper",
90
91
  ".in-drawer__container"
91
92
  ],
92
- extensions: t
93
+ extensions: d
93
94
  }
94
95
  );
95
- }, b = (i) => new Promise((n, o) => {
96
- var a;
96
+ }, V = (i) => new Promise((n, r) => {
97
+ var d;
97
98
  if (document.getElementById("UiEditorScript")) {
98
99
  i(), n();
99
100
  return;
100
101
  }
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 = () => {
102
+ const e = q.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
103
+ t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
103
104
  i(), n();
104
105
  }, t.onerror = () => {
105
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
106
+ r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
106
107
  }, document.body.appendChild(t);
107
108
  });
108
109
  return { initPlugin: async (i) => {
109
- await b(async () => {
110
- const n = await S();
111
- await w(i, n);
110
+ await V(async () => {
111
+ const n = S(), [r, e] = await Promise.all([
112
+ h(),
113
+ w()
114
+ ]);
115
+ n.syncModulesEnabled = e, await T(i, r, e);
112
116
  });
113
117
  } };
114
118
  };
115
119
  export {
116
- W as useStripo
120
+ Z as useStripo
117
121
  };
@@ -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
  };
@@ -0,0 +1,33 @@
1
+ import { UNSUBSCRIBE_SYNC_MODULE_TYPES as S } from "../enums/unsubscribe.js";
2
+ import { DATA_ATTRIBUTES as a } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
3
+ import { useEditorStore as d } from "../stores/editor.js";
4
+ const T = ".esd-synchronizable-module", m = '[esd-extension-block-id="unsubscribe-block"]', A = "esd-custom-block-id", M = () => {
5
+ const l = d();
6
+ return { extractSyncModuleUnsubscribeData: (p) => {
7
+ if (!l.syncModulesEnabled)
8
+ return [];
9
+ const E = new DOMParser().parseFromString(p, "text/html").querySelectorAll(T), e = [];
10
+ return E.forEach((r) => {
11
+ const s = r.getAttribute(A);
12
+ if (!s)
13
+ return;
14
+ r.querySelectorAll(m).forEach((o) => {
15
+ const n = o.getAttribute(a.PAGE_LIST), c = o.getAttribute(a.PAGE_TYPE);
16
+ if (!n || !c)
17
+ return;
18
+ const b = parseInt(c), u = S[b];
19
+ if (!u)
20
+ return;
21
+ const i = n.split(",").map((t) => parseInt(t.trim())).filter((t) => !Number.isNaN(t));
22
+ i.length !== 0 && e.push({
23
+ stripoModuleId: s,
24
+ unsubscriptionPreferencePages: i,
25
+ type: u
26
+ });
27
+ });
28
+ }), e;
29
+ } };
30
+ };
31
+ export {
32
+ M as useSyncModuleExtractor
33
+ };
@@ -1,17 +1,17 @@
1
1
  import { useTranslations as e } from "../composables/useTranslations.js";
2
2
  import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
3
- const I = {
3
+ const _ = {
4
4
  UNSUBSCRIBE_LINK_TYPE: 1,
5
5
  PREFERENCES_LINK_TYPE: 3
6
- }, r = {
6
+ }, I = {
7
7
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
8
8
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
9
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
10
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, s = R(), _ = {
12
- UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
13
- PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
14
- }, i = "iid", B = {
11
+ }, n = R(), r = {
12
+ UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
13
+ PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
14
+ }, B = "iid", i = {
15
15
  name: "Global Unsubscribe",
16
16
  sendGridId: "G"
17
17
  }, C = "/email/unsubscribe-pages", E = {
@@ -20,6 +20,9 @@ const I = {
20
20
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
21
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
22
  RESUBSCRIBE: 5
23
+ }, U = {
24
+ [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
25
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
23
26
  }, t = {
24
27
  [E.GLOBAL_UNSUBSCRIBE]: [
25
28
  E.GLOBAL_UNSUBSCRIBE,
@@ -30,29 +33,30 @@ const I = {
30
33
  E.SUBSCRIPTION_PREFERENCE_CENTER,
31
34
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
32
35
  ]
33
- }, U = () => {
34
- const n = e();
36
+ }, c = () => {
37
+ const s = e();
35
38
  return {
36
- [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
37
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
38
- [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
39
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
40
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
39
+ [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
40
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
41
+ [E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
42
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
43
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
41
44
  };
42
- }, c = {
45
+ }, o = {
43
46
  default: "{{ins-unsubscribe-link}}",
44
47
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
45
48
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
46
49
  };
47
50
  export {
48
- B as DEFAULT_UNSUBSCRIBE_GROUP,
49
- i as INSIDER_ID,
50
- r as LINK_REGEXES,
51
- I as LINK_TYPES,
52
- c as MERGE_TAGS,
51
+ i as DEFAULT_UNSUBSCRIBE_GROUP,
52
+ B as INSIDER_ID,
53
+ I as LINK_REGEXES,
54
+ _ as LINK_TYPES,
55
+ o as MERGE_TAGS,
53
56
  E as PAGE_TYPES,
54
57
  t as TYPE_COLLECTIONS,
55
58
  C as UNSUBSCRIBE_PAGES_LINK,
56
- _ as URLS,
57
- U as getTypeTranslations
59
+ U as UNSUBSCRIBE_SYNC_MODULE_TYPES,
60
+ r as URLS,
61
+ c as getTypeTranslations
58
62
  };
@@ -1,26 +1,26 @@
1
- import { useHttp as m } from "../composables/useHttp.js";
2
- import { useToaster as i } from "../composables/useToaster.js";
1
+ import { useHttp as l } from "../composables/useHttp.js";
2
+ import { useToaster as d } from "../composables/useToaster.js";
3
3
  import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
4
- const y = () => {
5
- const { get: r } = m(), { handleError: o } = i();
4
+ const b = () => {
5
+ const { get: s, post: c } = l(), { handleError: r } = d();
6
6
  return {
7
7
  getToken: async () => {
8
8
  try {
9
- const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await r(`/stripo/get-user-token?test=${t}`);
9
+ const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await s(`/stripo/get-user-token?test=${t}`);
10
10
  return e.body.token;
11
11
  } catch (t) {
12
- return o(t, "Failed to fetch token"), "";
12
+ return r(t, "Failed to fetch token"), "";
13
13
  }
14
14
  },
15
15
  getCustomFonts: async () => {
16
16
  try {
17
- const { data: t = [] } = await r("/stripo/get-partner-custom-fonts");
17
+ const { data: t = [] } = await s("/stripo/get-partner-custom-fonts");
18
18
  return t.map((e) => ({
19
19
  ...e,
20
20
  active: !0
21
21
  }));
22
22
  } catch (t) {
23
- return o(t, "Failed to fetch custom fonts"), [];
23
+ return r(t, "Failed to fetch custom fonts"), [];
24
24
  }
25
25
  },
26
26
  getDefaultTemplate: async () => {
@@ -29,16 +29,52 @@ const y = () => {
29
29
  css: ""
30
30
  };
31
31
  try {
32
- const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
33
- `/stripo/default-template/${l}`
34
- ), a = typeof n == "string" ? JSON.parse(n) : n;
35
- return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
32
+ const u = new URLSearchParams(window.location.search).get("default-template"), a = u ? parseInt(u) : 0, i = a >= 1 && a <= p ? a : 0, { data: n } = await s(
33
+ `/stripo/default-template/${i}`
34
+ ), o = typeof n == "string" ? JSON.parse(n) : n;
35
+ return !o || typeof o != "object" || !("html" in o) || !("css" in o) ? t : o;
36
36
  } catch (e) {
37
- return o(e, "Failed to fetch default template"), t;
37
+ return r(e, "Failed to fetch default template"), t;
38
+ }
39
+ },
40
+ getSyncModulesStatus: async () => {
41
+ try {
42
+ const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
43
+ return t.status;
44
+ } catch (t) {
45
+ return r(t, "Failed to fetch sync modules status"), !1;
46
+ }
47
+ },
48
+ updateSyncModule: async (t) => {
49
+ try {
50
+ return await c(`/stripo/stripo-modules/${t.moduleId}/update`, t), !0;
51
+ } catch (e) {
52
+ return r(e, "Failed to update sync module"), !1;
53
+ }
54
+ },
55
+ getSyncModule: async (t) => {
56
+ try {
57
+ const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
58
+ return e;
59
+ } catch (e) {
60
+ return r(e, "Failed to get sync module"), {
61
+ id: 0,
62
+ stripoId: 0,
63
+ unsubscriptionPreferencePages: []
64
+ };
65
+ }
66
+ },
67
+ setSyncModuleUnsubscriptionPages: async (t) => {
68
+ if (t.length === 0)
69
+ return !0;
70
+ try {
71
+ return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
72
+ } catch (e) {
73
+ return r(e, "Failed to set unsubscription preference pages"), !1;
38
74
  }
39
75
  }
40
76
  };
41
77
  };
42
78
  export {
43
- y as useStripoApi
79
+ b as useStripoApi
44
80
  };
@@ -1,6 +1,38 @@
1
- export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready';
1
+ export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready' | 'module_updated' | 'module_dropped';
2
+ export interface ModuleUpdatedParams {
3
+ target: string;
4
+ blockType: string;
5
+ moduleId: number;
6
+ moduleCategory: string | null;
7
+ syncModule: boolean;
8
+ }
9
+ export interface ModuleDroppedParams {
10
+ target: string;
11
+ blockType: string;
12
+ moduleId: number;
13
+ syncModule: boolean;
14
+ }
15
+ export interface SyncModuleUnsubscribePayload {
16
+ stripoModuleId: string;
17
+ unsubscriptionPreferencePages: number[];
18
+ type: string;
19
+ }
20
+ export interface SyncModuleResponse {
21
+ id: number;
22
+ stripoId: number;
23
+ unsubscriptionPreferencePages: UnsubscriptionPreferencePage[];
24
+ }
25
+ export interface UnsubscriptionPreferencePage {
26
+ id: number;
27
+ name: string;
28
+ type: number;
29
+ status: number;
30
+ isVisible: number;
31
+ thumbnail: string;
32
+ createdAt: string;
33
+ }
2
34
  export interface EventHandler {
3
- (params: Record<string, string>): void | Promise<void>;
35
+ (params: Record<string, unknown>): void | Promise<void>;
4
36
  }
5
37
  export interface EventHandlers {
6
38
  [eventType: string]: EventHandler;
@@ -0,0 +1,4 @@
1
+ import type { SyncModuleUnsubscribePayload } from '@@/Types/events';
2
+ export declare const useSyncModuleExtractor: () => {
3
+ extractSyncModuleUnsubscribeData: (html: string) => SyncModuleUnsubscribePayload[];
4
+ };
@@ -25,6 +25,9 @@ export declare const PAGE_TYPES: {
25
25
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
26
26
  RESUBSCRIBE: number;
27
27
  };
28
+ export declare const UNSUBSCRIBE_SYNC_MODULE_TYPES: {
29
+ [x: number]: string;
30
+ };
28
31
  export declare const TYPE_COLLECTIONS: {
29
32
  [x: number]: number[];
30
33
  };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("msw").HttpHandler[];
2
+ export default _default;
@@ -1,3 +1,4 @@
1
+ import type { ModuleUpdatedParams, SyncModuleResponse, SyncModuleUnsubscribePayload } from '@@/Types/events';
1
2
  import type { CustomFont, Template } from '@@/Types/stripo';
2
3
  export declare const useStripoApi: () => {
3
4
  getToken: () => Promise<string>;
@@ -5,4 +6,8 @@ export declare const useStripoApi: () => {
5
6
  active: boolean;
6
7
  })[]>;
7
8
  getDefaultTemplate: () => Promise<Template>;
9
+ getSyncModulesStatus: () => Promise<boolean>;
10
+ updateSyncModule: (params: ModuleUpdatedParams) => Promise<boolean>;
11
+ getSyncModule: (moduleId: number) => Promise<SyncModuleResponse>;
12
+ setSyncModuleUnsubscriptionPages: (payload: SyncModuleUnsubscribePayload[]) => Promise<boolean>;
8
13
  };
@@ -8,6 +8,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
8
8
  hasChanges: boolean;
9
9
  isStripoInitialized: boolean;
10
10
  templateId: string;
11
+ syncModulesEnabled: boolean;
11
12
  }, {
12
13
  isEditorToolbarVisible: (state: {
13
14
  loadingStatus: boolean;
@@ -19,6 +20,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
19
20
  hasChanges: boolean;
20
21
  isStripoInitialized: boolean;
21
22
  templateId: string;
23
+ syncModulesEnabled: boolean;
22
24
  } & import("pinia").PiniaCustomStateProperties<{
23
25
  loadingStatus: boolean;
24
26
  isCodeEditorOpen: boolean;
@@ -29,6 +31,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
29
31
  hasChanges: boolean;
30
32
  isStripoInitialized: boolean;
31
33
  templateId: string;
34
+ syncModulesEnabled: boolean;
32
35
  }>) => boolean;
33
36
  isUndoButtonDisabled: (state: {
34
37
  loadingStatus: boolean;
@@ -40,6 +43,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
40
43
  hasChanges: boolean;
41
44
  isStripoInitialized: boolean;
42
45
  templateId: string;
46
+ syncModulesEnabled: boolean;
43
47
  } & import("pinia").PiniaCustomStateProperties<{
44
48
  loadingStatus: boolean;
45
49
  isCodeEditorOpen: boolean;
@@ -50,6 +54,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
50
54
  hasChanges: boolean;
51
55
  isStripoInitialized: boolean;
52
56
  templateId: string;
57
+ syncModulesEnabled: boolean;
53
58
  }>) => boolean;
54
59
  isRedoButtonDisabled: (state: {
55
60
  loadingStatus: boolean;
@@ -61,6 +66,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
61
66
  hasChanges: boolean;
62
67
  isStripoInitialized: boolean;
63
68
  templateId: string;
69
+ syncModulesEnabled: boolean;
64
70
  } & import("pinia").PiniaCustomStateProperties<{
65
71
  loadingStatus: boolean;
66
72
  isCodeEditorOpen: boolean;
@@ -71,6 +77,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
71
77
  hasChanges: boolean;
72
78
  isStripoInitialized: boolean;
73
79
  templateId: string;
80
+ syncModulesEnabled: boolean;
74
81
  }>) => boolean;
75
82
  isCodeEditorButtonDisabled: (state: {
76
83
  loadingStatus: boolean;
@@ -82,6 +89,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
82
89
  hasChanges: boolean;
83
90
  isStripoInitialized: boolean;
84
91
  templateId: string;
92
+ syncModulesEnabled: boolean;
85
93
  } & import("pinia").PiniaCustomStateProperties<{
86
94
  loadingStatus: boolean;
87
95
  isCodeEditorOpen: boolean;
@@ -92,6 +100,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
92
100
  hasChanges: boolean;
93
101
  isStripoInitialized: boolean;
94
102
  templateId: string;
103
+ syncModulesEnabled: boolean;
95
104
  }>) => boolean;
96
105
  isPreviewButtonDisabled: (state: {
97
106
  loadingStatus: boolean;
@@ -103,6 +112,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
103
112
  hasChanges: boolean;
104
113
  isStripoInitialized: boolean;
105
114
  templateId: string;
115
+ syncModulesEnabled: boolean;
106
116
  } & import("pinia").PiniaCustomStateProperties<{
107
117
  loadingStatus: boolean;
108
118
  isCodeEditorOpen: boolean;
@@ -113,6 +123,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
113
123
  hasChanges: boolean;
114
124
  isStripoInitialized: boolean;
115
125
  templateId: string;
126
+ syncModulesEnabled: boolean;
116
127
  }>) => boolean;
117
128
  isViewOptionsDisabled: (state: {
118
129
  loadingStatus: boolean;
@@ -124,6 +135,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
124
135
  hasChanges: boolean;
125
136
  isStripoInitialized: boolean;
126
137
  templateId: string;
138
+ syncModulesEnabled: boolean;
127
139
  } & import("pinia").PiniaCustomStateProperties<{
128
140
  loadingStatus: boolean;
129
141
  isCodeEditorOpen: boolean;
@@ -134,6 +146,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
134
146
  hasChanges: boolean;
135
147
  isStripoInitialized: boolean;
136
148
  templateId: string;
149
+ syncModulesEnabled: boolean;
137
150
  }>) => boolean;
138
151
  isVersionHistoryButtonDisabled: (state: {
139
152
  loadingStatus: boolean;
@@ -145,6 +158,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
145
158
  hasChanges: boolean;
146
159
  isStripoInitialized: boolean;
147
160
  templateId: string;
161
+ syncModulesEnabled: boolean;
148
162
  } & import("pinia").PiniaCustomStateProperties<{
149
163
  loadingStatus: boolean;
150
164
  isCodeEditorOpen: boolean;
@@ -155,6 +169,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
155
169
  hasChanges: boolean;
156
170
  isStripoInitialized: boolean;
157
171
  templateId: string;
172
+ syncModulesEnabled: boolean;
158
173
  }>) => boolean;
159
174
  isExportButtonDisabled: (state: {
160
175
  loadingStatus: boolean;
@@ -166,6 +181,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
166
181
  hasChanges: boolean;
167
182
  isStripoInitialized: boolean;
168
183
  templateId: string;
184
+ syncModulesEnabled: boolean;
169
185
  } & import("pinia").PiniaCustomStateProperties<{
170
186
  loadingStatus: boolean;
171
187
  isCodeEditorOpen: boolean;
@@ -176,6 +192,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
176
192
  hasChanges: boolean;
177
193
  isStripoInitialized: boolean;
178
194
  templateId: string;
195
+ syncModulesEnabled: boolean;
179
196
  }>) => boolean;
180
197
  isSaveAsButtonDisabled: (state: {
181
198
  loadingStatus: boolean;
@@ -187,6 +204,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
187
204
  hasChanges: boolean;
188
205
  isStripoInitialized: boolean;
189
206
  templateId: string;
207
+ syncModulesEnabled: boolean;
190
208
  } & import("pinia").PiniaCustomStateProperties<{
191
209
  loadingStatus: boolean;
192
210
  isCodeEditorOpen: boolean;
@@ -197,6 +215,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
197
215
  hasChanges: boolean;
198
216
  isStripoInitialized: boolean;
199
217
  templateId: string;
218
+ syncModulesEnabled: boolean;
200
219
  }>) => boolean;
201
220
  isTestButtonDisabled: (state: {
202
221
  loadingStatus: boolean;
@@ -208,6 +227,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
208
227
  hasChanges: boolean;
209
228
  isStripoInitialized: boolean;
210
229
  templateId: string;
230
+ syncModulesEnabled: boolean;
211
231
  } & import("pinia").PiniaCustomStateProperties<{
212
232
  loadingStatus: boolean;
213
233
  isCodeEditorOpen: boolean;
@@ -218,6 +238,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
218
238
  hasChanges: boolean;
219
239
  isStripoInitialized: boolean;
220
240
  templateId: string;
241
+ syncModulesEnabled: boolean;
221
242
  }>) => boolean;
222
243
  isSaveButtonDisabled: (state: {
223
244
  loadingStatus: boolean;
@@ -229,6 +250,7 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
229
250
  hasChanges: boolean;
230
251
  isStripoInitialized: boolean;
231
252
  templateId: string;
253
+ syncModulesEnabled: boolean;
232
254
  } & import("pinia").PiniaCustomStateProperties<{
233
255
  loadingStatus: boolean;
234
256
  isCodeEditorOpen: boolean;
@@ -239,5 +261,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
239
261
  hasChanges: boolean;
240
262
  isStripoInitialized: boolean;
241
263
  templateId: string;
264
+ syncModulesEnabled: boolean;
242
265
  }>) => boolean;
243
266
  }, {}>;
@@ -1,4 +1,4 @@
1
- const o = `.patch-session-container {
1
+ const n = `.patch-session-container {
2
2
  row-gap: 16px;
3
3
  }
4
4
 
@@ -24,7 +24,15 @@ ue-vh-patch.selected .patch-wrapper {
24
24
  background-color: var(--guido-color-primary-100);
25
25
  box-shadow: 0 0 0 1px var(--guido-color-primary-500);
26
26
  }
27
+
28
+ .change-history-panel-wrapper .control-panel-header {
29
+ padding: 16px 0 16px 16px;
30
+ }
31
+
32
+ .change-history-panel-wrapper .header-control-panel-label {
33
+ grid-area: 1 / 1 / 2 / 12;
34
+ }
27
35
  `;
28
36
  export {
29
- o as default
37
+ n as default
30
38
  };
@@ -60,7 +60,6 @@ ue-control-panel,
60
60
 
61
61
  .control-panel-header {
62
62
  grid-template-columns: repeat(12, 1fr);
63
- padding: 16px 0px 16px 16px;
64
63
  }
65
64
 
66
65
  .control-panel-header > * {
@@ -94,7 +93,9 @@ ue-control-panel,
94
93
  .container.droppable-header-container ue-button:last-child {
95
94
  margin-right: 0;
96
95
  }
97
-
96
+ .container.droppable-header-container {
97
+ margin-top: 13px;
98
+ }
98
99
  .secondary-control-group {
99
100
  gap: 16px;
100
101
  }
@@ -9,7 +9,8 @@ const o = e("guidoEditor", {
9
9
  editorVisualMode: "desktop",
10
10
  hasChanges: !1,
11
11
  isStripoInitialized: !1,
12
- templateId: ""
12
+ templateId: "",
13
+ syncModulesEnabled: !1
13
14
  }),
14
15
  getters: {
15
16
  // Middle Slot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.1.0-beta.4bc6068",
3
+ "version": "2.1.0-beta.4bcb91b",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",