@useinsider/guido 3.21.0-beta.f049776 → 3.21.0-beta.ff98fc3

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,44 +1,49 @@
1
- import { useActionsApi as L } from "./useActionsApi.js";
2
- import { useBlocksConfig as O } from "./useBlocksConfig.js";
3
- import { useConfig as H } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as w } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
6
- import { useModuleRepair as j } from "./useModuleRepair.js";
7
- import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
8
- import { useStripoNotifications as $ } from "./useStripoNotifications.js";
9
- import { useToaster as G } from "./useToaster.js";
10
- import { localePatch as J } from "../config/i18n/index.js";
11
- import { en as b } from "../config/i18n/en/index.js";
12
- import { ToasterTypeOptions as X } from "../enums/toaster.js";
13
- import { useStripoApi as K } from "../services/stripoApi.js";
14
- import Q from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as k } from "../stores/editor.js";
16
- import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
- import Z from "../package.json.js";
18
- let n = null;
19
- const he = () => {
20
- const { features: c, template: u, isFeatureEnabled: p } = H(), { handleError: m, showToaster: v } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = O(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((r, s) => {
21
- var d;
1
+ import { useActionsApi as H } from "./useActionsApi.js";
2
+ import { useBlocksConfig as N } from "./useBlocksConfig.js";
3
+ import { useConfig as j } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as _ } from "./useCustomInterfaceAppearance.js";
5
+ import { useEditorOpenMetrics as z } from "./useEditorOpenMetrics.js";
6
+ import { useFullStoryBridge as $ } from "./useFullStoryBridge.js";
7
+ import { useModuleRepair as G } from "./useModuleRepair.js";
8
+ import { useStripoEventHandler as J } from "./useStripoEventHandler.js";
9
+ import { useStripoNotifications as X } from "./useStripoNotifications.js";
10
+ import { useToaster as K } from "./useToaster.js";
11
+ import { localePatch as Q } from "../config/i18n/index.js";
12
+ import { en as M } from "../config/i18n/en/index.js";
13
+ import { ToasterTypeOptions as W } from "../enums/toaster.js";
14
+ import { useStripoApi as Y } from "../services/stripoApi.js";
15
+ import Z from "../static/styles/customEditorStyle.css.js";
16
+ import { useEditorStore as T } from "../stores/editor.js";
17
+ import { buildMergeTagEntries as ee, flattenDynamicContentList as te } from "../utils/genericUtil.js";
18
+ import oe from "../package.json.js";
19
+ let a = null, v = !1;
20
+ const be = () => {
21
+ const { features: u, template: m, isFeatureEnabled: p } = j(), { handleError: f, showToaster: B } = K(), { getToken: F, getCustomFonts: A, getSyncModulesStatus: V } = Y(), { handleEvent: P } = J(), { handleModuleAdd: R } = G(), { getStripoBlocksConfig: D } = N(), { getStripoNotifications: U } = X(), t = z(), g = () => a || (a = new Promise((i, d) => {
22
+ var s;
22
23
  if (document.getElementById("UiEditorScript")) {
23
- r();
24
+ i();
24
25
  return;
25
26
  }
26
- const o = Z.guido, i = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
27
- e.id = "UiEditorScript", e.type = "module", e.src = i, e.onload = () => r(), e.onerror = () => {
28
- e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${i}`));
27
+ const r = oe.guido, n = `https://email-static.useinsider.com/guido/${(s = r == null ? void 0 : r.stripo) == null ? void 0 : s.version}/UIEditor.js`, e = document.createElement("script");
28
+ e.id = "UiEditorScript", e.type = "module", e.src = n, e.onload = () => {
29
+ v = !0, i();
30
+ }, e.onerror = () => {
31
+ e.remove(), d(new Error(`Failed to load Stripo UIEditor script from S3: ${n}`));
29
32
  }, document.body.appendChild(e);
30
- }), n.catch(() => {
31
- n = null;
32
- }), n), D = async (r, s, o, a = [], i = !1) => {
33
- var y, E, h, C;
34
- const e = k(), { html: d, css: P } = r, { baseBlocks: g, extensions: R } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
- w().importCss(), await window.UIEditor.initEditor(
33
+ }), a.catch(() => {
34
+ a = null;
35
+ }), a), I = async (i, d, r, l = [], n = !1) => {
36
+ var C, k, w, b;
37
+ const e = T(), { html: s, css: y } = i, { baseBlocks: S, extensions: L } = await D();
38
+ t.mark("blocks_config_ready");
39
+ const E = ((C = u.value) == null ? void 0 : C.displayConditions) ?? !0, O = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, h = !!s || (((w = m.value) == null ? void 0 : w.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
40
+ t.setTemplate({ html: s, css: y, forceRecreate: h }), _().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
36
41
  document.querySelector("#guido-editor"),
37
42
  {
38
- metadata: s,
39
- html: d,
40
- css: P,
41
- forceRecreate: I,
43
+ metadata: d,
44
+ html: s,
45
+ css: y,
46
+ forceRecreate: h,
42
47
  locale: "en",
43
48
  undoButtonSelector: "#guido__undo-button",
44
49
  redoButtonSelector: "#guido__redo-button",
@@ -48,12 +53,12 @@ const he = () => {
48
53
  customAppearanceMergetags: !p("liquidSyntax"),
49
54
  customAppearanceMergetagsBorderColor: "#f1f3fe",
50
55
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
51
- customViewStyles: Q,
52
- conditionsEnabled: S,
53
- customConditionsEnabled: S,
56
+ customViewStyles: Z,
57
+ conditionsEnabled: E,
58
+ customConditionsEnabled: E,
54
59
  enableXSSSecurity: !0,
55
- modulesDisabled: U,
56
- syncModulesEnabled: i,
60
+ modulesDisabled: O,
61
+ syncModulesEnabled: n,
57
62
  messageSettingsEnabled: !0,
58
63
  displayGmailAnnotations: !0,
59
64
  displayHiddenPreheader: !1,
@@ -64,54 +69,55 @@ const he = () => {
64
69
  selectElementAfterDrop: !0,
65
70
  sameFontSizeForOutlook: !0,
66
71
  allowedScriptSourceDomains: q,
67
- ...g ? { baseBlocks: g } : {},
72
+ ...S ? { baseBlocks: S } : {},
68
73
  editorFonts: {
69
74
  showDefaultStandardFonts: !0,
70
75
  showDefaultNotStandardFonts: !0,
71
- customFonts: a
76
+ customFonts: l
72
77
  },
73
78
  mergeTags: [
74
79
  {
75
- entries: W(
76
- o.preselectedDynamicContentList,
77
- Y((C = u.value) == null ? void 0 : C.dynamicContentList),
80
+ entries: ee(
81
+ r.preselectedDynamicContentList,
82
+ te((b = m.value) == null ? void 0 : b.dynamicContentList),
78
83
  p("liquidSyntax")
79
84
  )
80
85
  }
81
86
  ],
82
- async onTokenRefreshRequest(t) {
87
+ async onTokenRefreshRequest(o) {
83
88
  try {
84
- const l = await B();
85
- t(l);
86
- } catch (l) {
87
- m(l, "Failed to refresh token");
89
+ t.mark("token_start");
90
+ const c = await F();
91
+ t.mark("token_end"), o(c);
92
+ } catch (c) {
93
+ f(c, "Failed to refresh token");
88
94
  }
89
95
  },
90
96
  onTemplateLoaded() {
91
97
  try {
92
- const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = L(), { injectFullStory: x } = N();
93
- w().importCss(), t(), x(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
98
+ const { activateCustomViewStyles: o, updateTimerInClonedTemplate: c } = H(), { injectFullStory: x } = $();
99
+ _().importCss(), o(), x(), c(), r.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
94
100
  e.hasChanges = !1;
95
- }, 1e3);
96
- } catch (t) {
97
- m(t, "Failed to load custom interface appearance");
101
+ }, 1e3), t.markReady();
102
+ } catch (o) {
103
+ f(o, "Failed to load custom interface appearance");
98
104
  }
99
105
  },
100
- onCodeEditorVisibilityChanged(t) {
101
- e.isCodeEditorOpen = t;
106
+ onCodeEditorVisibilityChanged(o) {
107
+ e.isCodeEditorOpen = o;
102
108
  },
103
- onEditorVisualModeChanged(t) {
104
- e.editorVisualMode = t.toLowerCase();
109
+ onEditorVisualModeChanged(o) {
110
+ e.editorVisualMode = o.toLowerCase();
105
111
  },
106
- onVersionHistoryVisibilityChanged(t) {
107
- e.isVersionHistoryOpen = t;
112
+ onVersionHistoryVisibilityChanged(o) {
113
+ e.isVersionHistoryOpen = o;
108
114
  },
109
115
  onDataChanged() {
110
116
  e.hasChanges = !0, e.changeSeq += 1;
111
117
  },
112
- onEvent: F,
113
- onModuleAdd: A,
114
- notifications: _(),
118
+ onEvent: P,
119
+ onModuleAdd: R,
120
+ notifications: U(),
115
121
  // Stripo deselects the block on any click outside the canvas, so every surface
116
122
  // that belongs to the block's own flow has to be listed here (SD-153273).
117
123
  ignoreClickOutsideSelectors: [
@@ -121,35 +127,35 @@ const he = () => {
121
127
  ".in-modal-v2-wrapper",
122
128
  ".in-toasts-wrapper"
123
129
  ],
124
- extensions: R,
125
- localePatch: J
130
+ extensions: L,
131
+ localePatch: Q
126
132
  }
127
133
  );
128
134
  };
129
- return { initPlugin: async (r, s, o) => {
130
- const a = k();
135
+ return { initPlugin: async (i, d, r) => {
136
+ const l = T();
131
137
  try {
132
- await f();
133
- const [i, e] = await Promise.all([
134
- M(),
135
- T()
138
+ t.mark("plugin_start"), t.setScriptPreloaded(v), await g(), t.mark("script_ready");
139
+ const [n, e] = await Promise.all([
140
+ A(),
141
+ V()
136
142
  ]);
137
- a.syncModulesEnabled = e, await D(r, s, o, i, e);
143
+ t.mark("fonts_sync_ready"), l.syncModulesEnabled = e, await I(i, d, r, n, e);
138
144
  } catch {
139
- a.loadingStatus = !1, v({
140
- type: X.Error,
141
- message: b["An error has occurred. Please report the error code to support."],
145
+ l.loadingStatus = !1, B({
146
+ type: W.Error,
147
+ message: M["An error has occurred. Please report the error code to support."],
142
148
  actionButton: {
143
- text: b["Reload page"],
149
+ text: M["Reload page"],
144
150
  onClick: () => window.location.reload()
145
151
  }
146
- });
152
+ }), t.markFailed();
147
153
  }
148
154
  }, preloadRuntime: () => {
149
- f().catch(() => {
155
+ g().catch(() => {
150
156
  });
151
157
  } };
152
158
  };
153
159
  export {
154
- he as useStripo
160
+ be as useStripo
155
161
  };
@@ -1,18 +1,17 @@
1
1
  import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
- import { migrateCouponBlockAlignment as e } from "./couponBlockAlignmentMigrator.js";
3
- import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
4
- import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
- import { migrateProductNameLink as g } from "./productNameLinkMigrator.js";
2
+ import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
+ import { migrateItemsBlock as a } from "./itemsBlockMigrator.js";
4
+ import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
6
5
  import { migrateRadioButton as c } from "./radioButtonMigrator.js";
7
- import { migrateRecommendation as p } from "./recommendationMigrator.js";
6
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
8
7
  import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
9
- import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
8
+ import { migrateRecommendationTitle as p } from "./recommendationTitleMigrator.js";
10
9
  import { migrateSocialIcons as d } from "./socialIconMigrator.js";
11
- import { migrateUnsubscribe as s } from "./unsubscribeMigrator.js";
12
- const y = async (r, t = {}, o) => {
10
+ import { migrateUnsubscribe as l } from "./unsubscribeMigrator.js";
11
+ const h = async (r, t = {}, o) => {
13
12
  let m = r;
14
- return m = i(m), m = c(m), m = await s(m), m = e(m), m = a(m), m = p(m, t), o && (m = f(m, o)), m = l(m), m = n(m), m = g(m), m = d(m), m;
13
+ return m = i(m), m = c(m), m = await l(m), m = e(m), m = g(m, t), o && (m = f(m, o)), m = p(m), m = a(m), m = n(m), m = d(m), m;
15
14
  };
16
15
  export {
17
- y as migrate
16
+ h as migrate
18
17
  };