@useinsider/guido 3.9.1-beta.22c4bcc → 3.9.1-beta.23867f9

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.
@@ -10,17 +10,17 @@ import { en as h } from "../config/i18n/en/index.js";
10
10
  import { ToasterTypeOptions as L } from "../enums/toaster.js";
11
11
  import { useStripoApi as $ } from "../services/stripoApi.js";
12
12
  import G from "../static/styles/customEditorStyle.css.js";
13
- import { useEditorStore as E } from "../stores/editor.js";
13
+ import { useEditorStore as C } from "../stores/editor.js";
14
14
  import { dynamicContentToMergeTags as J } from "../utils/genericUtil.js";
15
15
  import N from "../package.json.js";
16
- const ce = (C, l) => {
17
- const { features: c, template: w, isFeatureEnabled: u } = R(), { handleError: m, showToaster: b } = H(), { getToken: k, getCustomFonts: T, getSyncModulesStatus: B } = $(), { handleEvent: F } = q(), { getStripoBlocksConfig: v } = U(), V = async (s, r = [], i = !1) => {
16
+ const ce = (E, l) => {
17
+ const { features: c, template: w, isFeatureEnabled: u } = R(), { handleError: m, showToaster: b } = H(), { getToken: T, getCustomFonts: k, getSyncModulesStatus: B } = $(), { handleEvent: F } = q(), { getStripoBlocksConfig: v } = U(), V = async (s, r = [], i = !1) => {
18
18
  var g, S, y;
19
- const e = E(), { html: p, css: a } = s, { baseBlocks: o, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, A = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, M = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
19
+ const e = C(), { html: p, css: a } = s, { baseBlocks: t, extensions: d } = await v(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, A = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, M = ((y = w.value) == null ? void 0 : y.forceRecreate) ?? !1;
20
20
  await window.UIEditor.initEditor(
21
21
  document.querySelector("#guido-editor"),
22
22
  {
23
- metadata: C,
23
+ metadata: E,
24
24
  html: p,
25
25
  css: a,
26
26
  forceRecreate: M,
@@ -42,13 +42,12 @@ const ce = (C, l) => {
42
42
  messageSettingsEnabled: !0,
43
43
  displayGmailAnnotations: !0,
44
44
  displayHiddenPreheader: !1,
45
- keepModuleStylesEnabled: !0,
46
45
  displayTitle: !1,
47
46
  displayUTM: !1,
48
47
  selectElementAfterDrop: !0,
49
48
  sameFontSizeForOutlook: !0,
50
49
  allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
51
- ...o ? { baseBlocks: o } : {},
50
+ ...t ? { baseBlocks: t } : {},
52
51
  editorFonts: {
53
52
  showDefaultStandardFonts: !0,
54
53
  showDefaultNotStandardFonts: !0,
@@ -62,32 +61,32 @@ const ce = (C, l) => {
62
61
  )
63
62
  }
64
63
  ],
65
- async onTokenRefreshRequest(t) {
64
+ async onTokenRefreshRequest(o) {
66
65
  try {
67
- const n = await k();
68
- t(n);
66
+ const n = await T();
67
+ o(n);
69
68
  } catch (n) {
70
69
  m(n, "Failed to refresh token");
71
70
  }
72
71
  },
73
72
  onTemplateLoaded() {
74
73
  try {
75
- const { importCss: t } = x(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: P } = I(), { injectFullStory: D } = O();
76
- t(), n(), D(), P(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
74
+ const { importCss: o } = x(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: P } = I(), { injectFullStory: D } = O();
75
+ o(), n(), D(), P(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
77
76
  e.hasChanges = !1;
78
77
  }, 1e3);
79
- } catch (t) {
80
- m(t, "Failed to load custom interface appearance");
78
+ } catch (o) {
79
+ m(o, "Failed to load custom interface appearance");
81
80
  }
82
81
  },
83
- onCodeEditorVisibilityChanged(t) {
84
- e.isCodeEditorOpen = t;
82
+ onCodeEditorVisibilityChanged(o) {
83
+ e.isCodeEditorOpen = o;
85
84
  },
86
- onEditorVisualModeChanged(t) {
87
- e.editorVisualMode = t.toLowerCase();
85
+ onEditorVisualModeChanged(o) {
86
+ e.editorVisualMode = o.toLowerCase();
88
87
  },
89
- onVersionHistoryVisibilityChanged(t) {
90
- e.isVersionHistoryOpen = t;
88
+ onVersionHistoryVisibilityChanged(o) {
89
+ e.isVersionHistoryOpen = o;
91
90
  },
92
91
  onDataChanged() {
93
92
  e.hasChanges = !0;
@@ -108,19 +107,19 @@ const ce = (C, l) => {
108
107
  Promise.resolve(s()).then(r, i);
109
108
  return;
110
109
  }
111
- const e = N.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");
112
- o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
110
+ const e = N.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
111
+ t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
113
112
  Promise.resolve(s()).then(r, i);
114
- }, o.onerror = () => {
113
+ }, t.onerror = () => {
115
114
  i(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
116
- }, document.body.appendChild(o);
115
+ }, document.body.appendChild(t);
117
116
  });
118
117
  return { initPlugin: async (s) => {
119
- const r = E();
118
+ const r = C();
120
119
  try {
121
120
  await _(async () => {
122
121
  const [i, e] = await Promise.all([
123
- T(),
122
+ k(),
124
123
  B()
125
124
  ]);
126
125
  r.syncModulesEnabled = e, await V(s, i, e);
@@ -122,10 +122,10 @@ const d = [
122
122
  ], i = /<head>([\S\s]*)<\/head>/, o = new RegExp(i);
123
123
  if (!e.match(o))
124
124
  return e;
125
- let s = e;
126
- return t.forEach((r) => {
127
- s = s.replace("</head>", `${r}</head>`);
128
- }), s;
125
+ let r = e;
126
+ return t.forEach((s) => {
127
+ r = r.replace("</head>", `${s}</head>`);
128
+ }), r;
129
129
  },
130
130
  priority: 30
131
131
  },
@@ -156,9 +156,9 @@ const d = [
156
156
  type: "custom",
157
157
  processor: (e) => {
158
158
  const t = (i) => i.toString(16).padStart(2, "0");
159
- return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, s) => {
160
- const [r, a, c] = [Number(o), Number(n), Number(s)];
161
- return r > 255 || a > 255 || c > 255 ? i : `#${t(r)}${t(a)}${t(c)}`;
159
+ return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
160
+ const [s, a, c] = [Number(o), Number(n), Number(r)];
161
+ return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
162
162
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
163
163
  },
164
164
  priority: 44
@@ -174,6 +174,29 @@ const d = [
174
174
  replacement: "",
175
175
  flags: "g",
176
176
  priority: 45
177
+ },
178
+ {
179
+ id: "remove-script-tags",
180
+ // SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <script> from
181
+ // compiled email. Priority 50 runs after the &lt;/&gt; unescape rules (13/14) so
182
+ // post-unescape tags are still caught. Do NOT add to AMP_SAFE_RULE_IDS (AMP needs <script>).
183
+ description: "Strip <script>…<\/script> tags from compiled email",
184
+ type: "regex",
185
+ pattern: "<script[^>]*>.*?<\/script>",
186
+ replacement: "",
187
+ flags: "gis",
188
+ priority: 50
189
+ },
190
+ {
191
+ id: "remove-iframe-tags",
192
+ // SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <iframe>.
193
+ // Do NOT add this id to AMP_SAFE_RULE_IDS.
194
+ description: "Strip <iframe>…</iframe> tags from compiled email",
195
+ type: "regex",
196
+ pattern: "<iframe[^>]*>.*?</iframe>",
197
+ replacement: "",
198
+ flags: "gis",
199
+ priority: 51
177
200
  }
178
201
  ];
179
202
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.9.1-beta.22c4bcc",
3
+ "version": "3.9.1-beta.23867f9",
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",