@useinsider/guido 3.21.0 → 3.21.1-beta.18ab939

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