@useinsider/guido 3.30.0-beta.a94eba0 → 3.30.0-beta.abc28c7

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