@useinsider/guido 3.3.0-beta.878c1c2 → 3.3.0-beta.c1e1d7e

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.
@@ -4,21 +4,20 @@ import e from "../static/styles/components/amp-block.css.js";
4
4
  import i from "../static/styles/components/base-input.css.js";
5
5
  import p from "../static/styles/components/button-group.css.js";
6
6
  import n from "../static/styles/components/button.css.js";
7
- import C from "../static/styles/components/combobox.css.js";
8
- import s from "../static/styles/components/counter.css.js";
7
+ import s from "../static/styles/components/combobox.css.js";
8
+ import C from "../static/styles/components/counter.css.js";
9
9
  import f from "../static/styles/components/dropdown-menu.css.js";
10
10
  import a from "../static/styles/components/loader.css.js";
11
11
  import u from "../static/styles/components/narrow-panel.css.js";
12
- import c from "../static/styles/components/notification.css.js";
13
- import d from "../static/styles/components/popup.css.js";
14
- import l from "../static/styles/components/switcher.css.js";
15
- import h from "../static/styles/components/tabs.css.js";
16
- import w from "../static/styles/components/tools.css.js";
17
- import y from "../static/styles/components/version-history.css.js";
18
- import B from "../static/styles/components/wide-panel.css.js";
19
- import b from "../static/styles/variables.css.js";
20
- const A = [
21
- b,
12
+ import c from "../static/styles/components/popup.css.js";
13
+ import d from "../static/styles/components/switcher.css.js";
14
+ import l from "../static/styles/components/tabs.css.js";
15
+ import h from "../static/styles/components/tools.css.js";
16
+ import w from "../static/styles/components/version-history.css.js";
17
+ import y from "../static/styles/components/wide-panel.css.js";
18
+ import B from "../static/styles/variables.css.js";
19
+ const b = [
20
+ B,
22
21
  // Must be on top
23
22
  S,
24
23
  // Must be on top
@@ -27,8 +26,8 @@ const A = [
27
26
  i,
28
27
  p,
29
28
  n,
30
- C,
31
29
  s,
30
+ C,
32
31
  f,
33
32
  a,
34
33
  u,
@@ -37,13 +36,12 @@ const A = [
37
36
  l,
38
37
  h,
39
38
  w,
40
- y,
41
- B
39
+ y
42
40
  ].join(`
43
41
 
44
- `), F = () => ({ importCss: () => {
42
+ `), v = () => ({ importCss: () => {
45
43
  const o = new CSSStyleSheet();
46
- o.replaceSync(A);
44
+ o.replaceSync(b);
47
45
  const r = document.querySelector("ui-editor");
48
46
  if (!r)
49
47
  return;
@@ -51,5 +49,5 @@ const A = [
51
49
  t && (t.adoptedStyleSheets = [o]);
52
50
  } });
53
51
  export {
54
- F as useCustomInterfaceAppearance
52
+ v as useCustomInterfaceAppearance
55
53
  };
@@ -1,27 +1,28 @@
1
- import { useActionsApi as D } from "./useActionsApi.js";
2
- import { useBlocksConfig as I } from "./useBlocksConfig.js";
3
- import { useConfig as P } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
6
- import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
7
- import { useToaster as x } from "./useToaster.js";
8
- import { localePatch as H } from "../config/i18n/index.js";
9
- import { useStripoApi as O } from "../services/stripoApi.js";
10
- import j from "../static/styles/customEditorStyle.css.js";
1
+ import { useActionsApi as I } from "./useActionsApi.js";
2
+ import { useBlocksConfig as P } from "./useBlocksConfig.js";
3
+ import { useConfig as U } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as R } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as q } from "./useFullStoryBridge.js";
6
+ import { useStripoEventHandler as x } from "./useStripoEventHandler.js";
7
+ import { useStripoNotifications as H } from "./useStripoNotifications.js";
8
+ import { useToaster as N } from "./useToaster.js";
9
+ import { localePatch as O } from "../config/i18n/index.js";
10
+ import { useStripoApi as j } from "../services/stripoApi.js";
11
+ import L from "../static/styles/customEditorStyle.css.js";
11
12
  import { useEditorStore as E } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
13
- import $ from "../package.json.js";
14
- const se = (C, l) => {
15
- const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = O(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
13
+ import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
14
+ import z from "../package.json.js";
15
+ const dt = (C, c) => {
16
+ const { features: l, template: h, isFeatureEnabled: u } = U(), { handleError: m } = N(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = x(), { getStripoNotifications: T } = H(), { getStripoBlocksConfig: V } = P(), _ = async (i, r = [], s = !1) => {
16
17
  var g, S, y;
17
- const e = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
+ const t = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await V(), f = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, v = ((S = l.value) == null ? void 0 : S.modulesDisabled) ?? !1, M = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
19
  window.UIEditor.initEditor(
19
20
  document.querySelector("#guido-editor"),
20
21
  {
21
22
  metadata: C,
22
23
  html: p,
23
24
  css: a,
24
- forceRecreate: v,
25
+ forceRecreate: M,
25
26
  locale: "en",
26
27
  undoButtonSelector: "#guido__undo-button",
27
28
  redoButtonSelector: "#guido__redo-button",
@@ -31,11 +32,11 @@ const se = (C, l) => {
31
32
  customAppearanceMergetags: !u("liquidSyntax"),
32
33
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
34
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: j,
35
+ customViewStyles: L,
35
36
  conditionsEnabled: f,
36
37
  customConditionsEnabled: f,
37
38
  enableXSSSecurity: !0,
38
- modulesDisabled: F,
39
+ modulesDisabled: v,
39
40
  syncModulesEnabled: s,
40
41
  messageSettingsEnabled: !0,
41
42
  displayGmailAnnotations: !0,
@@ -52,59 +53,60 @@ const se = (C, l) => {
52
53
  },
53
54
  mergeTags: [
54
55
  {
55
- entries: L(
56
- l.preselectedDynamicContentList,
56
+ entries: $(
57
+ c.preselectedDynamicContentList,
57
58
  u("liquidSyntax")
58
59
  )
59
60
  }
60
61
  ],
61
- async onTokenRefreshRequest(t) {
62
+ async onTokenRefreshRequest(e) {
62
63
  try {
63
64
  const n = await w();
64
- t(n);
65
+ e(n);
65
66
  } catch (n) {
66
67
  m(n, "Failed to refresh token");
67
68
  }
68
69
  },
69
70
  onTemplateLoaded() {
70
71
  try {
71
- const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
72
- t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
73
- e.hasChanges = !1;
72
+ const { importCss: e } = R(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: A } = I(), { injectFullStory: D } = q();
73
+ e(), n(), D(), A(), c.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
74
+ t.hasChanges = !1;
74
75
  }, 1e3);
75
- } catch (t) {
76
- m(t, "Failed to load custom interface appearance");
76
+ } catch (e) {
77
+ m(e, "Failed to load custom interface appearance");
77
78
  }
78
79
  },
79
- onCodeEditorVisibilityChanged(t) {
80
- e.isCodeEditorOpen = t;
80
+ onCodeEditorVisibilityChanged(e) {
81
+ t.isCodeEditorOpen = e;
81
82
  },
82
- onEditorVisualModeChanged(t) {
83
- e.editorVisualMode = t.toLowerCase();
83
+ onEditorVisualModeChanged(e) {
84
+ t.editorVisualMode = e.toLowerCase();
84
85
  },
85
- onVersionHistoryVisibilityChanged(t) {
86
- e.isVersionHistoryOpen = t;
86
+ onVersionHistoryVisibilityChanged(e) {
87
+ t.isVersionHistoryOpen = e;
87
88
  },
88
89
  onDataChanged() {
89
- e.hasChanges = !0;
90
+ t.hasChanges = !0;
90
91
  },
91
92
  onEvent: B,
93
+ notifications: T(),
92
94
  ignoreClickOutsideSelectors: [
93
95
  "#guido-dynamic-content-modal",
94
96
  ".in-on-board-wrapper",
95
97
  ".in-drawer__container"
96
98
  ],
97
99
  extensions: d,
98
- localePatch: H
100
+ localePatch: O
99
101
  }
100
102
  );
101
- }, _ = (i) => new Promise((r, s) => {
103
+ }, F = (i) => new Promise((r, s) => {
102
104
  var d;
103
105
  if (document.getElementById("UiEditorScript")) {
104
106
  i(), r();
105
107
  return;
106
108
  }
107
- const e = $.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");
109
+ const t = z.guido, a = `https://email-static.useinsider.com/guido/${(d = t == null ? void 0 : t.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
108
110
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
109
111
  i(), r();
110
112
  }, o.onerror = () => {
@@ -112,15 +114,15 @@ const se = (C, l) => {
112
114
  }, document.body.appendChild(o);
113
115
  });
114
116
  return { initPlugin: async (i) => {
115
- await _(async () => {
116
- const r = E(), [s, e] = await Promise.all([
117
+ await F(async () => {
118
+ const r = E(), [s, t] = await Promise.all([
117
119
  b(),
118
120
  k()
119
121
  ]);
120
- r.syncModulesEnabled = e, await V(i, s, e);
122
+ r.syncModulesEnabled = t, await _(i, s, t);
121
123
  });
122
124
  } };
123
125
  };
124
126
  export {
125
- se as useStripo
127
+ dt as useStripo
126
128
  };
@@ -0,0 +1,30 @@
1
+ import { useToaster as a } from "./useToaster.js";
2
+ import { ToasterTypeOptions as r } from "../enums/toaster.js";
3
+ const h = () => {
4
+ const { showToaster: l, hideToaster: u } = a();
5
+ let e = null, s = null;
6
+ const c = (t, o, i, n) => {
7
+ if (e === i && s === o)
8
+ return;
9
+ e = i, s = o;
10
+ const f = n != null && n.action ? { text: n.action.label, onClick: n.action.func } : void 0;
11
+ l({ type: t, message: o, actionButton: f });
12
+ };
13
+ return { getStripoNotifications: () => ({
14
+ info: (t, o, i) => c(r.Success, t, o, i),
15
+ success: (t, o, i) => c(r.Success, t, o, i),
16
+ warn: (t, o, i) => c(r.Warning, t, o, i),
17
+ error: (t, o, i) => c(r.Alert, t, o, i),
18
+ // Stripo emits `loader` for in-progress operations expected to persist until
19
+ // explicit hide(id). Available toaster types auto-dismiss at 6s, so showing
20
+ // anything here would lie about completion. Skip until a persistent type exists.
21
+ loader: () => {
22
+ },
23
+ hide: (t) => {
24
+ e === t && (u(), e = null, s = null);
25
+ }
26
+ }) };
27
+ };
28
+ export {
29
+ h as useStripoNotifications
30
+ };
@@ -0,0 +1,4 @@
1
+ import type { StripoNotifications } from '@@/Types/stripo';
2
+ export declare const useStripoNotifications: () => {
3
+ getStripoNotifications: () => StripoNotifications;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.3.0-beta.878c1c2",
3
+ "version": "3.3.0-beta.c1e1d7e",
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",
@@ -1,74 +0,0 @@
1
- const n = `ue-notifications-container {
2
- left: 96px;
3
- margin: 0;
4
- bottom: 32px;
5
- top: unset;
6
- width: unset;
7
- position: fixed;
8
- }
9
-
10
- ue-notifications-container ue-message + ue-message {
11
- margin-bottom: 24px;
12
- }
13
-
14
- ue-notifications-container .alert-message-wrapper {
15
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
16
- border: none;
17
- padding: 16px 24px;
18
- }
19
-
20
- ue-notifications-container .alert-message-wrapper.info,
21
- ue-notifications-container .alert-message-wrapper.loader {
22
- background-color: var(--guido-color-background-toaster-info) !important;
23
- color: inherit;
24
- }
25
-
26
- .alert-message-wrapper .alert-message-main {
27
- align-items: center;
28
- }
29
-
30
- ue-notifications-container ue-caption .caption {
31
- color: var(--guido-color-white) !important;
32
- }
33
-
34
- ue-block-thumb-hint {
35
- text-align: left;
36
- }
37
-
38
- ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
39
- width: calc(100% - 64px);
40
- }
41
-
42
- ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-text {
43
- font-size: 15px;
44
- font-weight: 600;
45
- }
46
-
47
- ue-notifications-container .alert-message-text,
48
- ue-notifications-container .alert-message-wrapper ue-icon-component.icon,
49
- ue-notifications-container .alert-message-wrapper ue-icon-component.icon-button {
50
- color: var(--guido-color-white);
51
- }
52
-
53
- ue-notifications-container ue-message ue-button.close {
54
- margin: 0 0 0 16px;
55
- }
56
-
57
- ue-notifications-container .alert-message-wrapper.success {
58
- background: var(--guido-color-background-toaster-success);
59
- color: inherit;
60
- }
61
-
62
- ue-notifications-container .alert-message-wrapper.error {
63
- background: var(--guido-color-background-toaster-error);
64
- color: inherit;
65
- }
66
-
67
- ue-notifications-container .alert-message-wrapper.warn {
68
- background: var(--guido-color-background-toaster-warn);
69
- color: inherit;
70
- }
71
- `;
72
- export {
73
- n as default
74
- };