@useinsider/guido 3.2.0-beta.b397787 → 3.2.0-beta.d5a560f

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,17 +1,14 @@
1
- const o = (s, t) => {
2
- const n = window[s];
3
- return typeof n == "string" ? n : t;
4
- }, f = () => ({ injectFullStory: () => {
5
- var i;
6
- const t = o("_fs_org", "");
7
- if (!t)
1
+ const c = "https://email-static.useinsider.com/guido/guido-fullstory.js", u = () => ({ injectFullStory: () => {
2
+ var n;
3
+ const s = window;
4
+ if (typeof s._fs_org != "string" || !s._fs_org)
8
5
  return;
9
- const e = document.querySelector("ui-editor"), n = (i = e == null ? void 0 : e.shadowRoot) == null ? void 0 : i.querySelector("iframe");
10
- if (!(n != null && n.contentDocument))
6
+ const r = document.querySelector("ui-editor"), o = (n = r == null ? void 0 : r.shadowRoot) == null ? void 0 : n.querySelector("iframe"), e = o == null ? void 0 : o.contentDocument;
7
+ if (!e || e.querySelector('script[data-fullstory-bridge="true"]'))
11
8
  return;
12
- const r = o("_fs_host", "fullstory.com"), g = o("_fs_script", "edge.fullstory.com/s/fs.js"), u = o("_fs_namespace", "FS"), c = n.contentDocument.createElement("script");
13
- c.textContent = `window['_fs_run_in_iframe']=true;window['_fs_host']='${r}';window['_fs_script']='${g}';window['_fs_org']='${t}';window['_fs_namespace']='${u}';(function(m,n,e,t,l,o,g,y){if(e in m){if(m.console&&m.console.log){m.console.log('FullStory namespace conflict.');}return;}g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[];o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script;y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)};g.anonymize=function(){g.identify(!!0)};g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)};g.log=function(a,b){g("log",[a,b])};g.consent=function(a){g("consent",!arguments.length||a)};g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};g.clearUserCookie=function(){};g.setVars=function(n,p){g('setVars',[n,p])};g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y];if(m[y])m[y]=function(){return g._api(y,arguments)};g._v="1.3.0";})(window,document,window['_fs_namespace'],'script','user');`, n.contentDocument.head.appendChild(c);
9
+ const t = e.createElement("script");
10
+ t.src = c, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", e.head.appendChild(t);
14
11
  } });
15
12
  export {
16
- f as useFullStoryBridge
13
+ u as useFullStoryBridge
17
14
  };
@@ -12,10 +12,10 @@ import L from "../static/styles/customEditorStyle.css.js";
12
12
  import { useEditorStore as C } from "../stores/editor.js";
13
13
  import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
14
14
  import z from "../package.json.js";
15
- const se = (E, l) => {
16
- const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: b, getCustomFonts: w, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, n = [], r = !1) => {
17
- var g, y, S;
18
- const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((y = c.value) == null ? void 0 : y.modulesDisabled) ?? !1, v = ((S = h.value) == null ? void 0 : S.forceRecreate) ?? !1;
15
+ const ae = (E, l) => {
16
+ const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
17
+ var g, S, y;
18
+ const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
19
19
  window.UIEditor.initEditor(
20
20
  document.querySelector("#guido-editor"),
21
21
  {
@@ -38,18 +38,19 @@ const se = (E, l) => {
38
38
  conditionCategories: O,
39
39
  enableXSSSecurity: !0,
40
40
  modulesDisabled: F,
41
- syncModulesEnabled: r,
41
+ syncModulesEnabled: s,
42
42
  messageSettingsEnabled: !0,
43
43
  displayGmailAnnotations: !0,
44
44
  displayHiddenPreheader: !1,
45
45
  displayTitle: !1,
46
46
  displayUTM: !1,
47
47
  selectElementAfterDrop: !0,
48
+ allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
48
49
  ...o ? { baseBlocks: o } : {},
49
50
  editorFonts: {
50
51
  showDefaultStandardFonts: !0,
51
52
  showDefaultNotStandardFonts: !0,
52
- customFonts: n
53
+ customFonts: r
53
54
  },
54
55
  mergeTags: [
55
56
  {
@@ -61,16 +62,16 @@ const se = (E, l) => {
61
62
  ],
62
63
  async onTokenRefreshRequest(t) {
63
64
  try {
64
- const s = await b();
65
- t(s);
66
- } catch (s) {
67
- m(s, "Failed to refresh token");
65
+ const n = await w();
66
+ t(n);
67
+ } catch (n) {
68
+ m(n, "Failed to refresh token");
68
69
  }
69
70
  },
70
71
  onTemplateLoaded() {
71
72
  try {
72
- const { importCss: t } = U(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
73
- t(), s(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
73
+ const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
74
+ t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
74
75
  e.hasChanges = !1;
75
76
  }, 1e3);
76
77
  } catch (t) {
@@ -99,29 +100,29 @@ const se = (E, l) => {
99
100
  localePatch: H
100
101
  }
101
102
  );
102
- }, _ = (i) => new Promise((n, r) => {
103
+ }, _ = (i) => new Promise((r, s) => {
103
104
  var d;
104
105
  if (document.getElementById("UiEditorScript")) {
105
- i(), n();
106
+ i(), r();
106
107
  return;
107
108
  }
108
109
  const e = z.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");
109
110
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
110
- i(), n();
111
+ i(), r();
111
112
  }, o.onerror = () => {
112
- r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
113
+ s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
113
114
  }, document.body.appendChild(o);
114
115
  });
115
116
  return { initPlugin: async (i) => {
116
117
  await _(async () => {
117
- const n = C(), [r, e] = await Promise.all([
118
- w(),
118
+ const r = C(), [s, e] = await Promise.all([
119
+ b(),
119
120
  k()
120
121
  ]);
121
- n.syncModulesEnabled = e, await V(i, r, e);
122
+ r.syncModulesEnabled = e, await V(i, s, e);
122
123
  });
123
124
  } };
124
125
  };
125
126
  export {
126
- se as useStripo
127
+ ae as useStripo
127
128
  };
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Bridges FullStory from the parent window into the Stripo editor iframe.
2
+ * Injects the hosted FullStory bridge script into the Stripo editor iframe.
3
3
  *
4
- * If FullStory is detected on the parent window (window._fs_org exists),
5
- * injects the FullStory recording snippet into the editor's iframe
6
- * with _fs_run_in_iframe = true so it reports to the parent session.
4
+ * The bridge script's origin is allowlisted via Stripo's
5
+ * `allowedScriptSourceDomains` in useStripo, so the iframe's CSP permits
6
+ * the load. The bundled script itself handles reading FS config from the
7
+ * parent window and booting the FullStory queue stub inside the iframe.
7
8
  */
8
9
  export declare const useFullStoryBridge: () => {
9
10
  injectFullStory: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.2.0-beta.b397787",
3
+ "version": "3.2.0-beta.d5a560f",
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",