@useinsider/guido 2.1.0-beta.bcfc012 → 2.1.0-beta.bd5d1ea

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 (61) hide show
  1. package/README.md +41 -2
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +66 -66
  4. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  5. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  6. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  8. package/dist/components/organisms/header/EditorActions.vue.js +10 -12
  9. package/dist/components/organisms/header/EditorActions.vue2.js +31 -41
  10. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  11. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  12. package/dist/composables/useSave.js +16 -12
  13. package/dist/composables/useStripo.js +66 -62
  14. package/dist/composables/useStripoEventHandler.js +27 -12
  15. package/dist/composables/useSyncModuleExtractor.js +45 -0
  16. package/dist/config/i18n/en/labels.json.js +3 -8
  17. package/dist/config/migrator/itemsBlockMigrator.js +138 -139
  18. package/dist/config/migrator/recommendationMigrator.js +40 -42
  19. package/dist/enums/unsubscribe.js +25 -21
  20. package/dist/extensions/Blocks/Items/block.js +25 -45
  21. package/dist/extensions/Blocks/Items/iconsRegistry.js +5 -40
  22. package/dist/extensions/Blocks/Items/items.css.js +0 -48
  23. package/dist/extensions/Blocks/Recommendation/block.js +29 -49
  24. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +2 -37
  25. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +0 -48
  26. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  27. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  28. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  29. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  30. package/dist/extensions/Blocks/common-control.js +4 -12
  31. package/dist/guido.css +1 -1
  32. package/dist/services/stripoApi.js +55 -19
  33. package/dist/src/@types/config/schemas.d.ts +1 -1
  34. package/dist/src/@types/events.d.ts +38 -2
  35. package/dist/src/components/Guido.vue.d.ts +2 -2
  36. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  37. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  38. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  39. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  40. package/dist/src/composables/useGuidoActions.d.ts +1 -1
  41. package/dist/src/composables/useSave.d.ts +2 -2
  42. package/dist/src/composables/useStripo.d.ts +2 -2
  43. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  44. package/dist/src/enums/unsubscribe.d.ts +3 -0
  45. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
  46. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  47. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  48. package/dist/src/extensions/Blocks/common-control.d.ts +0 -5
  49. package/dist/src/mock/api/settings.d.ts +2 -0
  50. package/dist/src/services/stripoApi.d.ts +5 -0
  51. package/dist/src/stores/editor.d.ts +23 -0
  52. package/dist/src/utils/templatePreparation.d.ts +1 -1
  53. package/dist/stores/editor.js +2 -1
  54. package/dist/stores/unsubscribe.js +37 -34
  55. package/dist/utils/templatePreparation.js +1 -1
  56. package/package.json +2 -2
  57. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +0 -21
  58. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +0 -38
  59. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +0 -5
  60. package/dist/src/stores/template.d.ts +0 -3
  61. package/dist/stores/template.js +0 -9
@@ -1,27 +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 { localePatch as I } from "../config/i18n/index.js";
8
- import { displayConditions as M } from "../enums/displayConditions.js";
9
- import { useStripoApi as U } from "../services/stripoApi.js";
10
- import P from "../static/styles/customEditorStyle.css.js";
11
- import { useEditorStore as R } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
13
- import O from "../package.json.js";
14
- const Z = (c) => {
15
- const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = U(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, r = []) => {
16
- var m, f, g;
17
- const o = R(), { html: n, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1, T = ((g = y.value) == null ? void 0 : g.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;
18
18
  window.UIEditor.initEditor(
19
19
  document.querySelector("#guido-editor"),
20
20
  {
21
- metadata: c,
22
- html: n,
23
- css: p,
24
- forceRecreate: T,
21
+ metadata: C,
22
+ html: m,
23
+ css: a,
24
+ forceRecreate: v,
25
25
  locale: "en",
26
26
  undoButtonSelector: "#guido__undo-button",
27
27
  redoButtonSelector: "#guido__redo-button",
@@ -31,89 +31,93 @@ const Z = (c) => {
31
31
  customAppearanceMergetags: !0,
32
32
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
33
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: P,
35
- conditionsEnabled: a,
36
- customConditionsEnabled: a,
37
- conditionCategories: M,
34
+ customViewStyles: q,
35
+ conditionsEnabled: p,
36
+ customConditionsEnabled: p,
37
+ conditionCategories: H,
38
38
  enableXSSSecurity: !0,
39
- modulesDisabled: k,
39
+ modulesDisabled: B,
40
+ syncModulesEnabled: r,
40
41
  messageSettingsEnabled: !0,
41
42
  displayGmailAnnotations: !0,
42
43
  displayHiddenPreheader: !1,
43
44
  displayTitle: !1,
44
45
  displayUTM: !1,
45
46
  selectElementAfterDrop: !0,
46
- ...s ? { baseBlocks: s } : {},
47
+ ...o ? { baseBlocks: o } : {},
47
48
  editorFonts: {
48
49
  showDefaultStandardFonts: !0,
49
50
  showDefaultNotStandardFonts: !0,
50
- customFonts: r
51
+ customFonts: n
51
52
  },
52
53
  mergeTags: [
53
54
  {
54
- entries: H(c.preselectedDynamicContentList)
55
+ entries: x(c.preselectedDynamicContentList)
55
56
  }
56
57
  ],
57
- async onTokenRefreshRequest(e) {
58
+ async onTokenRefreshRequest(t) {
58
59
  try {
59
- const d = await C();
60
- e(d);
61
- } catch (d) {
62
- u(d, "Failed to refresh token");
60
+ const s = await h();
61
+ t(s);
62
+ } catch (s) {
63
+ u(s, "Failed to refresh token");
63
64
  }
64
65
  },
65
66
  onTemplateLoaded() {
66
67
  try {
67
- const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
68
- e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
69
- 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;
70
71
  }, 1e3);
71
- } catch (e) {
72
- u(e, "Failed to load custom interface appearance");
72
+ } catch (t) {
73
+ u(t, "Failed to load custom interface appearance");
73
74
  }
74
75
  },
75
- onCodeEditorVisibilityChanged(e) {
76
- o.isCodeEditorOpen = e;
76
+ onCodeEditorVisibilityChanged(t) {
77
+ e.isCodeEditorOpen = t;
77
78
  },
78
- onEditorVisualModeChanged(e) {
79
- o.editorVisualMode = e.toLowerCase();
79
+ onEditorVisualModeChanged(t) {
80
+ e.editorVisualMode = t.toLowerCase();
80
81
  },
81
- onVersionHistoryVisibilityChanged(e) {
82
- o.isVersionHistoryOpen = e;
82
+ onVersionHistoryVisibilityChanged(t) {
83
+ e.isVersionHistoryOpen = t;
83
84
  },
84
85
  onDataChanged() {
85
- o.hasChanges = !0;
86
+ e.hasChanges = !0;
86
87
  },
87
- onEvent: E,
88
+ onEvent: k,
88
89
  ignoreClickOutsideSelectors: [
89
90
  "#guido-dynamic-content-modal",
90
91
  ".in-on-board-wrapper",
91
92
  ".in-drawer__container"
92
93
  ],
93
- extensions: t,
94
- localePatch: I
94
+ extensions: d,
95
+ localePatch: R
95
96
  }
96
97
  );
97
- }, b = (i) => new Promise((r, o) => {
98
- var a;
98
+ }, _ = (i) => new Promise((n, r) => {
99
+ var d;
99
100
  if (document.getElementById("UiEditorScript")) {
100
- i(), r();
101
+ i(), n();
101
102
  return;
102
103
  }
103
- const n = O.guido, s = `https://email-static.useinsider.com/guido/${(a = n == null ? void 0 : n.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
104
- t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
105
- i(), r();
106
- }, t.onerror = () => {
107
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
108
- }, document.body.appendChild(t);
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 = () => {
106
+ i(), n();
107
+ }, o.onerror = () => {
108
+ r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
109
+ }, document.body.appendChild(o);
109
110
  });
110
111
  return { initPlugin: async (i) => {
111
- await b(async () => {
112
- const r = await S();
113
- await w(i, r);
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);
114
118
  });
115
119
  } };
116
120
  };
117
121
  export {
118
- Z as useStripo
122
+ oe as useStripo
119
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
  };
@@ -0,0 +1,45 @@
1
+ import { UNSUBSCRIBE_SYNC_MODULE_TYPES as T } from "../enums/unsubscribe.js";
2
+ import { DATA_ATTRIBUTES as p } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
3
+ import { useEditorStore as f } from "../stores/editor.js";
4
+ const y = ".esd-synchronizable-module", A = '[esd-extension-block-id="unsubscribe-block"]', _ = "esd-custom-block-id", B = () => {
5
+ const d = f();
6
+ return { extractSyncModuleData: (E) => {
7
+ const S = {
8
+ unsubscribePayload: [],
9
+ stripoModules: []
10
+ };
11
+ if (!d.syncModulesEnabled)
12
+ return S;
13
+ const b = new DOMParser().parseFromString(E, "text/html").querySelectorAll(y), r = [], s = [];
14
+ return b.forEach((o) => {
15
+ const t = o.getAttribute(_);
16
+ if (!t)
17
+ return;
18
+ const n = o.querySelectorAll(A);
19
+ if (n.length === 0) {
20
+ s.push(Number(t));
21
+ return;
22
+ }
23
+ n.forEach((c) => {
24
+ const u = c.getAttribute(p.PAGE_LIST), i = c.getAttribute(p.PAGE_TYPE);
25
+ if (!u || !i)
26
+ return;
27
+ const m = parseInt(i), a = T[m];
28
+ if (!a)
29
+ return;
30
+ const l = u.split(",").map((e) => parseInt(e.trim())).filter((e) => !Number.isNaN(e));
31
+ l.length !== 0 && r.push({
32
+ stripoModuleId: t,
33
+ unsubscriptionPreferencePages: l,
34
+ type: a
35
+ });
36
+ });
37
+ }), {
38
+ unsubscribePayload: r,
39
+ stripoModules: s
40
+ };
41
+ } };
42
+ };
43
+ export {
44
+ B as useSyncModuleExtractor
45
+ };
@@ -1,12 +1,7 @@
1
- const e = "Items", o = {
1
+ const l = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
- "Structures & Modules": "Structures and Modules",
4
- "Recommendation Block": "Recommendation",
5
- Items: e,
6
- "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
- "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly."
3
+ "Structures & Modules": "Structures and Modules"
8
4
  };
9
5
  export {
10
- e as Items,
11
- o as default
6
+ l as default
12
7
  };