@useinsider/guido 3.21.2-beta.c321b5c → 3.21.2-beta.c7b74c0
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.
- package/dist/composables/useActionsApi.js +22 -21
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/utils/fullStoryScripts.js +8 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
1
|
+
import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { stripFullStoryScripts as h } from "../utils/fullStoryScripts.js";
|
|
3
|
+
import { getEditorApi as r } from "../utils/stripoEditorApi.js";
|
|
3
4
|
import { useToaster as D } from "./useToaster.js";
|
|
4
|
-
const
|
|
5
|
+
const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
5
6
|
const f = setTimeout(
|
|
6
7
|
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
7
8
|
l
|
|
@@ -13,8 +14,8 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
13
14
|
} catch (t) {
|
|
14
15
|
d(t);
|
|
15
16
|
}
|
|
16
|
-
}),
|
|
17
|
-
const { handleError: n } = D(), l = (t = {}) =>
|
|
17
|
+
}), _ = () => {
|
|
18
|
+
const { handleError: n } = D(), l = (t = {}) => m(
|
|
18
19
|
"compileEmail",
|
|
19
20
|
T,
|
|
20
21
|
(e, i) => {
|
|
@@ -38,38 +39,38 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
38
39
|
resetDataSavedFlag: !1,
|
|
39
40
|
disableLineHeightsReplace: !0
|
|
40
41
|
}, ...t }, u = {
|
|
41
|
-
callback: (
|
|
42
|
-
|
|
42
|
+
callback: (s, g, w, S, y) => {
|
|
43
|
+
s ? i(s) : e({
|
|
43
44
|
html: g,
|
|
44
45
|
ampHtml: w,
|
|
45
|
-
ampErrors:
|
|
46
|
-
displayConditions:
|
|
46
|
+
ampErrors: v(S ?? []),
|
|
47
|
+
displayConditions: y
|
|
47
48
|
});
|
|
48
49
|
},
|
|
49
50
|
...o
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
+
r().actionsApi.compileEmail(u);
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
return {
|
|
55
56
|
getCompiledEmail: l,
|
|
56
|
-
getTemplateData: () =>
|
|
57
|
+
getTemplateData: () => m(
|
|
57
58
|
"getTemplateData",
|
|
58
59
|
T,
|
|
59
60
|
(t) => {
|
|
60
|
-
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds:
|
|
61
|
-
html: i,
|
|
61
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: s }) => t({
|
|
62
|
+
html: h(i),
|
|
62
63
|
css: a,
|
|
63
64
|
width: o,
|
|
64
65
|
height: E,
|
|
65
66
|
utmParams: u,
|
|
66
|
-
syncModulesIds:
|
|
67
|
+
syncModulesIds: s
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
r().actionsApi.getTemplateData(e);
|
|
69
70
|
}
|
|
70
71
|
),
|
|
71
72
|
activateCustomViewStyles: (t = !0) => {
|
|
72
|
-
|
|
73
|
+
r().actionsApi.activateCustomViewStyles(t);
|
|
73
74
|
},
|
|
74
75
|
getPreviewData: async (t) => {
|
|
75
76
|
try {
|
|
@@ -109,16 +110,16 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
109
110
|
}
|
|
110
111
|
}),
|
|
111
112
|
updateHtmlAndCss: (t, e) => {
|
|
112
|
-
const { actionsApi: i } =
|
|
113
|
-
return
|
|
113
|
+
const { actionsApi: i } = r();
|
|
114
|
+
return m("updateHtmlAndCss", H, (a) => {
|
|
114
115
|
i.updateHtmlAndCss(t, e, () => a());
|
|
115
116
|
});
|
|
116
117
|
},
|
|
117
|
-
editorSave: () =>
|
|
118
|
+
editorSave: () => m(
|
|
118
119
|
"save",
|
|
119
120
|
T,
|
|
120
121
|
(t) => {
|
|
121
|
-
|
|
122
|
+
r().actionsApi.save((e) => {
|
|
122
123
|
if (e) {
|
|
123
124
|
n(e, "Failed to save template"), t(!1);
|
|
124
125
|
return;
|
|
@@ -130,5 +131,5 @@ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
|
130
131
|
};
|
|
131
132
|
};
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
_ as useActionsApi
|
|
134
135
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { FULLSTORY_BRIDGE_SCRIPT_URL as s } from "../utils/fullStoryScripts.js";
|
|
2
|
+
const l = () => ({ injectFullStory: () => {
|
|
3
|
+
var c;
|
|
4
|
+
const n = window;
|
|
5
|
+
if (typeof n._fs_org != "string" || !n._fs_org)
|
|
5
6
|
return;
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
7
|
+
const e = document.querySelector("ui-editor"), o = (c = e == null ? void 0 : e.shadowRoot) == null ? void 0 : c.querySelector("iframe"), r = o == null ? void 0 : o.contentDocument;
|
|
8
|
+
if (!r || r.querySelector('script[data-fullstory-bridge="true"]'))
|
|
8
9
|
return;
|
|
9
|
-
const t =
|
|
10
|
-
t.src =
|
|
10
|
+
const t = r.createElement("script");
|
|
11
|
+
t.src = s, t.async = !0, t.crossOrigin = "anonymous", t.dataset.fullstoryBridge = "true", r.head.appendChild(t);
|
|
11
12
|
} });
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
l as useFullStoryBridge
|
|
14
15
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { migrateCheckbox as i } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { migrateFullStoryScripts as a } from "./fullStoryScriptMigrator.js";
|
|
4
|
+
import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
|
|
5
|
+
import { migrateProductNameLink as c } from "./productNameLinkMigrator.js";
|
|
6
|
+
import { migrateRadioButton as g } from "./radioButtonMigrator.js";
|
|
7
|
+
import { migrateRecommendation as p } from "./recommendationMigrator.js";
|
|
7
8
|
import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
|
|
8
|
-
import { migrateRecommendationTitle as
|
|
9
|
-
import { migrateSocialIcons as
|
|
10
|
-
import { migrateUnsubscribe as
|
|
11
|
-
const h = async (
|
|
12
|
-
let m =
|
|
13
|
-
return m = i(m), m =
|
|
9
|
+
import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
|
|
10
|
+
import { migrateSocialIcons as s } from "./socialIconMigrator.js";
|
|
11
|
+
import { migrateUnsubscribe as d } from "./unsubscribeMigrator.js";
|
|
12
|
+
const h = async (o, t = {}, r) => {
|
|
13
|
+
let m = o;
|
|
14
|
+
return m = i(m), m = g(m), m = await d(m), m = e(m), m = p(m, t), r && (m = f(m, r)), m = l(m), m = n(m), m = c(m), m = s(m), m = a(m), m;
|
|
14
15
|
};
|
|
15
16
|
export {
|
|
16
17
|
h as migrate
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const migrateFullStoryScripts: (html: string) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const FULLSTORY_BRIDGE_SCRIPT_URL = "https://email-static.useinsider.com/guido/guido-fs.js";
|
|
2
|
+
/**
|
|
3
|
+
* Removes FullStory `<script>` elements that the panel / bridge leave in the editor iframe head,
|
|
4
|
+
* which Stripo then serializes into the stored source. Other scripts are left untouched.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stripFullStoryScripts(html: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const o = "https://email-static.useinsider.com/guido/guido-fs.js", E = new RegExp("<script\\b([^>]*?)(?<!\\/)>([\\s\\S]*?)<\\/script\\s*>", "gi"), _ = /<script\b([^>]*?)\/>/gi, e = /\bsrc\s*=\s*["']?(?:https?:)?\/\/(?:[\w-]+\.)*fullstory\.com[/"'\s>]/i, R = /\bdata-fullstory-bridge\b/i, S = /\b_fs_(?:script|namespace)\b/, i = (s, t = "") => e.test(`${s} `) || R.test(s) || s.includes(o) || S.test(t);
|
|
2
|
+
function n(s) {
|
|
3
|
+
return !s || !/fullstory|_fs_|guido-fs\.js/i.test(s) ? s : s.replace(E, (t, c, r) => i(c, r) ? "" : t).replace(_, (t, c) => i(c) ? "" : t);
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as FULLSTORY_BRIDGE_SCRIPT_URL,
|
|
7
|
+
n as stripFullStoryScripts
|
|
8
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.21.2-beta.
|
|
3
|
+
"version": "3.21.2-beta.c7b74c0",
|
|
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",
|