@useinsider/guido 3.30.0-beta.a1f329f → 3.30.0-beta.b189780

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.
@@ -1,5 +1,5 @@
1
- import { useActionsApi as j } from "./useActionsApi.js";
2
- import { useAmbiguousDynamicContent as z } from "./useAmbiguousDynamicContent.js";
1
+ import { useActionsApi as N } from "./useActionsApi.js";
2
+ import { useAmbiguousDynamicContent as j } from "./useAmbiguousDynamicContent.js";
3
3
  import { useBlocksConfig as $ } from "./useBlocksConfig.js";
4
4
  import { useConfig as G } from "./useConfig.js";
5
5
  import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
@@ -13,12 +13,12 @@ import { en as B } from "../config/i18n/en/index.js";
13
13
  import { ToasterTypeOptions as Z } from "../enums/toaster.js";
14
14
  import { useStripoApi as ee } from "../services/stripoApi.js";
15
15
  import te from "../static/styles/customEditorStyle.css.js";
16
- import { useEditorStore as T } from "../stores/editor.js";
16
+ import { useEditorStore as F } from "../stores/editor.js";
17
17
  import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
18
18
  import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
19
- let d = null, F = !1;
19
+ let l = null, T = !1;
20
20
  const ve = (t) => {
21
- const { features: m, template: p, isFeatureEnabled: c } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = z(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => d || (d = new Promise((n, a) => {
21
+ const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = j(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => l || (l = new Promise((n, a) => {
22
22
  if (document.getElementById("UiEditorScript")) {
23
23
  n();
24
24
  return;
@@ -30,25 +30,25 @@ const ve = (t) => {
30
30
  );
31
31
  return;
32
32
  }
33
- const s = `${i}UIEditor.js`, e = document.createElement("script");
34
- e.id = "UiEditorScript", e.type = "module", e.src = s, e.onload = () => {
35
- F = !0, n();
36
- }, e.onerror = () => {
37
- e.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
38
- }, document.body.appendChild(e);
39
- }), d.catch(() => {
40
- d = null;
41
- }), d), x = async (n, a, i, s = [], e = !1, u = !1) => {
42
- var w, k, b, _;
43
- const o = T(), { html: y, css: S } = n, { baseBlocks: E, extensions: O } = await L();
33
+ const s = `${i}UIEditor.js`, o = document.createElement("script");
34
+ o.id = "UiEditorScript", o.type = "module", o.src = s, o.onload = () => {
35
+ T = !0, n();
36
+ }, o.onerror = () => {
37
+ o.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
38
+ }, document.body.appendChild(o);
39
+ }), l.catch(() => {
40
+ l = null;
41
+ }), l), x = async (n, a, i, s = [], o = !1, c = !1) => {
42
+ var k, w, b, _;
43
+ const e = F(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
44
44
  t.mark("blocks_config_ready");
45
- const h = ((w = m.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = m.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = u || (((b = p.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
46
- t.setTemplate({ html: y, css: S, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
45
+ const h = ((k = u.value) == null ? void 0 : k.displayConditions) ?? !0, H = ((w = u.value) == null ? void 0 : w.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), z = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
46
+ t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
47
47
  document.querySelector("#guido-editor"),
48
48
  {
49
49
  metadata: a,
50
- html: y,
51
- css: S,
50
+ html: S,
51
+ css: y,
52
52
  forceRecreate: C,
53
53
  locale: "en",
54
54
  undoButtonSelector: "#guido__undo-button",
@@ -56,7 +56,7 @@ const ve = (t) => {
56
56
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
57
57
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
58
58
  codeEditorButtonSelector: "#guido__code-button",
59
- customAppearanceMergetags: !c("liquidSyntax"),
59
+ customAppearanceMergetags: !p("liquidSyntax"),
60
60
  customAppearanceMergetagsBorderColor: "#f1f3fe",
61
61
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
62
62
  customViewStyles: te,
@@ -64,7 +64,7 @@ const ve = (t) => {
64
64
  customConditionsEnabled: h,
65
65
  enableXSSSecurity: !0,
66
66
  modulesDisabled: H,
67
- syncModulesEnabled: e,
67
+ syncModulesEnabled: o,
68
68
  messageSettingsEnabled: !0,
69
69
  displayGmailAnnotations: !0,
70
70
  displayHiddenPreheader: !1,
@@ -74,7 +74,7 @@ const ve = (t) => {
74
74
  copyPasteEnabled: !1,
75
75
  selectElementAfterDrop: !0,
76
76
  sameFontSizeForOutlook: !0,
77
- allowedScriptSourceDomains: M,
77
+ allowedScriptSourceDomains: z,
78
78
  ...E ? { baseBlocks: E } : {},
79
79
  editorFonts: {
80
80
  showDefaultStandardFonts: !0,
@@ -85,41 +85,45 @@ const ve = (t) => {
85
85
  {
86
86
  entries: oe(
87
87
  i.preselectedDynamicContentList,
88
- re((_ = p.value) == null ? void 0 : _.dynamicContentList),
89
- c("liquidSyntax")
88
+ re((_ = m.value) == null ? void 0 : _.dynamicContentList),
89
+ p("liquidSyntax")
90
90
  )
91
91
  }
92
92
  ],
93
93
  async onTokenRefreshRequest(r) {
94
94
  try {
95
95
  t.mark("token_start");
96
- const l = await P();
97
- t.mark("token_end"), r(l);
98
- } catch (l) {
99
- f(l, "Failed to refresh token");
96
+ const d = await P();
97
+ if (t.mark("token_end"), !d) {
98
+ e.isStripoInitialized || (e.loadingStatus = !1, t.markFailed());
99
+ return;
100
+ }
101
+ r(d);
102
+ } catch (d) {
103
+ f(d, "Failed to refresh token");
100
104
  }
101
105
  },
102
106
  onTemplateLoaded() {
103
107
  try {
104
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = j(), { injectFullStory: N } = X();
105
- v().importCss(), r(), N(), I(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
106
- o.hasChanges = !1;
108
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: d } = N(), { injectFullStory: M } = X();
109
+ v().importCss(), r(), M(), I(), d(), i.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
110
+ e.hasChanges = !1;
107
111
  }, 1e3), t.markReady();
108
112
  } catch (r) {
109
113
  f(r, "Failed to load custom interface appearance");
110
114
  }
111
115
  },
112
116
  onCodeEditorVisibilityChanged(r) {
113
- o.isCodeEditorOpen = r;
117
+ e.isCodeEditorOpen = r;
114
118
  },
115
119
  onEditorVisualModeChanged(r) {
116
- o.editorVisualMode = r.toLowerCase();
120
+ e.editorVisualMode = r.toLowerCase();
117
121
  },
118
122
  onVersionHistoryVisibilityChanged(r) {
119
- o.isVersionHistoryOpen = r;
123
+ e.isVersionHistoryOpen = r;
120
124
  },
121
125
  onDataChanged() {
122
- c("readonly") || (o.hasChanges = !0), o.changeSeq += 1;
126
+ e.hasChanges = !0, e.changeSeq += 1;
123
127
  },
124
128
  onEvent: U,
125
129
  onModuleAdd: V,
@@ -139,16 +143,16 @@ const ve = (t) => {
139
143
  );
140
144
  };
141
145
  return { initPlugin: async (n, a, i, s = !1) => {
142
- const e = T();
146
+ const o = F();
143
147
  try {
144
- t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
145
- const [u, o] = await Promise.all([
148
+ t.mark("plugin_start"), t.setScriptPreloaded(T), await g(), t.mark("script_ready");
149
+ const [c, e] = await Promise.all([
146
150
  R(),
147
151
  D()
148
152
  ]);
149
- t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, a, i, u, o, s);
153
+ t.mark("fonts_sync_ready"), o.syncModulesEnabled = e, await x(n, a, i, c, e, s);
150
154
  } catch {
151
- e.loadingStatus = !1, A({
155
+ o.loadingStatus = !1, A({
152
156
  type: Z.Error,
153
157
  message: B["An error has occurred. Please report the error code to support."],
154
158
  actionButton: {