@useinsider/guido 2.1.0-beta.5ec7b79 → 2.1.0-beta.6294538
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/README.md +1 -3
- package/dist/composables/useSave.js +12 -16
- package/dist/composables/useStripo.js +54 -58
- package/dist/composables/useStripoEventHandler.js +12 -27
- package/dist/enums/unsubscribe.js +21 -25
- package/dist/services/stripoApi.js +14 -50
- package/dist/src/@types/events.d.ts +2 -34
- package/dist/src/enums/unsubscribe.d.ts +0 -3
- package/dist/src/services/stripoApi.d.ts +0 -5
- package/dist/src/stores/editor.d.ts +0 -23
- package/dist/stores/editor.js +1 -2
- package/package.json +1 -1
- package/dist/composables/useSyncModuleExtractor.js +0 -33
- package/dist/src/composables/useSyncModuleExtractor.d.ts +0 -4
- package/dist/src/mock/api/settings.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.youtube.com/shorts/Y0RwBeMezL4" target="_blank" rel="noopener noreferrer">
|
|
3
|
-
<img width="180"
|
|
4
|
-
src="https://web-image.useinsider.com/guido/defaultImageLibrary/iUH0liTK0d2YDsVB5LDN1770169173.jpg"
|
|
5
|
-
alt="Guido logo">
|
|
3
|
+
<img width="180" src="./public/guido.png" alt="Guido logo">
|
|
6
4
|
</a>
|
|
7
5
|
</p>
|
|
8
6
|
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useSaveStart as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const o = d(), s = p(), { validateHtml: i } = x(), { callbacks: a } = u(), { extractSyncModuleUnsubscribeData: r } = f(), { setSyncModuleUnsubscriptionPages: n } = v();
|
|
9
|
-
return { save: async (l = !1) => {
|
|
1
|
+
import { useConfig as l } from "./useConfig.js";
|
|
2
|
+
import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
|
|
3
|
+
import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
|
|
4
|
+
import { useHtmlValidator as p } from "./useHtmlValidator.js";
|
|
5
|
+
const w = () => {
|
|
6
|
+
const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
|
|
7
|
+
return { save: async (r = !1) => {
|
|
10
8
|
var e;
|
|
11
|
-
|
|
12
|
-
const { prepareTemplateDetails:
|
|
13
|
-
if (
|
|
14
|
-
return;
|
|
15
|
-
const m = r(t.rawHtml);
|
|
16
|
-
return await n(m), l || s(t), t;
|
|
9
|
+
i();
|
|
10
|
+
const { prepareTemplateDetails: n } = d(), t = await n();
|
|
11
|
+
if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
|
|
12
|
+
return r || s(t), t;
|
|
17
13
|
} };
|
|
18
14
|
};
|
|
19
15
|
export {
|
|
20
|
-
|
|
16
|
+
w as useSave
|
|
21
17
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
7
|
-
import { displayConditions as
|
|
8
|
-
import { useStripoApi as
|
|
9
|
-
import
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { dynamicContentToMergeTags as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
const { features: l, template:
|
|
15
|
-
var g, f
|
|
16
|
-
const
|
|
1
|
+
import { useActionsApi as _ } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as B } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as v } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as D } from "./useToaster.js";
|
|
7
|
+
import { displayConditions as I } from "../enums/displayConditions.js";
|
|
8
|
+
import { useStripoApi as M } from "../services/stripoApi.js";
|
|
9
|
+
import U from "../static/styles/customEditorStyle.css.js";
|
|
10
|
+
import { useEditorStore as P } from "../stores/editor.js";
|
|
11
|
+
import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
|
|
12
|
+
import H from "../package.json.js";
|
|
13
|
+
const W = (c) => {
|
|
14
|
+
const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
|
|
15
|
+
var m, g, f;
|
|
16
|
+
const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
|
|
17
17
|
window.UIEditor.initEditor(
|
|
18
18
|
document.querySelector("#guido-editor"),
|
|
19
19
|
{
|
|
20
20
|
metadata: c,
|
|
21
|
-
html:
|
|
22
|
-
css:
|
|
23
|
-
forceRecreate:
|
|
21
|
+
html: r,
|
|
22
|
+
css: p,
|
|
23
|
+
forceRecreate: T,
|
|
24
24
|
locale: "en",
|
|
25
25
|
undoButtonSelector: "#guido__undo-button",
|
|
26
26
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,20 +30,19 @@ const Z = (c) => {
|
|
|
30
30
|
customAppearanceMergetags: !0,
|
|
31
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
32
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
33
|
-
customViewStyles:
|
|
34
|
-
conditionsEnabled:
|
|
35
|
-
customConditionsEnabled:
|
|
36
|
-
conditionCategories:
|
|
33
|
+
customViewStyles: U,
|
|
34
|
+
conditionsEnabled: a,
|
|
35
|
+
customConditionsEnabled: a,
|
|
36
|
+
conditionCategories: I,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
|
-
modulesDisabled:
|
|
39
|
-
syncModulesEnabled: r,
|
|
38
|
+
modulesDisabled: k,
|
|
40
39
|
messageSettingsEnabled: !0,
|
|
41
40
|
displayGmailAnnotations: !0,
|
|
42
41
|
displayHiddenPreheader: !1,
|
|
43
42
|
displayTitle: !1,
|
|
44
43
|
displayUTM: !1,
|
|
45
44
|
selectElementAfterDrop: !0,
|
|
46
|
-
...
|
|
45
|
+
...s ? { baseBlocks: s } : {},
|
|
47
46
|
editorFonts: {
|
|
48
47
|
showDefaultStandardFonts: !0,
|
|
49
48
|
showDefaultNotStandardFonts: !0,
|
|
@@ -51,71 +50,68 @@ const Z = (c) => {
|
|
|
51
50
|
},
|
|
52
51
|
mergeTags: [
|
|
53
52
|
{
|
|
54
|
-
entries:
|
|
53
|
+
entries: R(c.preselectedDynamicContentList)
|
|
55
54
|
}
|
|
56
55
|
],
|
|
57
|
-
async onTokenRefreshRequest(
|
|
56
|
+
async onTokenRefreshRequest(e) {
|
|
58
57
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
} catch (
|
|
62
|
-
u(
|
|
58
|
+
const d = await C();
|
|
59
|
+
e(d);
|
|
60
|
+
} catch (d) {
|
|
61
|
+
u(d, "Failed to refresh token");
|
|
63
62
|
}
|
|
64
63
|
},
|
|
65
64
|
onTemplateLoaded() {
|
|
66
65
|
try {
|
|
67
|
-
const { importCss:
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
|
|
67
|
+
e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
68
|
+
o.hasChanges = !1;
|
|
70
69
|
}, 1e3);
|
|
71
|
-
} catch (
|
|
72
|
-
u(
|
|
70
|
+
} catch (e) {
|
|
71
|
+
u(e, "Failed to load custom interface appearance");
|
|
73
72
|
}
|
|
74
73
|
},
|
|
75
|
-
onCodeEditorVisibilityChanged(
|
|
76
|
-
|
|
74
|
+
onCodeEditorVisibilityChanged(e) {
|
|
75
|
+
o.isCodeEditorOpen = e;
|
|
77
76
|
},
|
|
78
|
-
onEditorVisualModeChanged(
|
|
79
|
-
|
|
77
|
+
onEditorVisualModeChanged(e) {
|
|
78
|
+
o.editorVisualMode = e.toLowerCase();
|
|
80
79
|
},
|
|
81
|
-
onVersionHistoryVisibilityChanged(
|
|
82
|
-
|
|
80
|
+
onVersionHistoryVisibilityChanged(e) {
|
|
81
|
+
o.isVersionHistoryOpen = e;
|
|
83
82
|
},
|
|
84
83
|
onDataChanged() {
|
|
85
|
-
|
|
84
|
+
o.hasChanges = !0;
|
|
86
85
|
},
|
|
87
|
-
onEvent:
|
|
86
|
+
onEvent: E,
|
|
88
87
|
ignoreClickOutsideSelectors: [
|
|
89
88
|
"#guido-dynamic-content-modal",
|
|
90
89
|
".in-on-board-wrapper",
|
|
91
90
|
".in-drawer__container"
|
|
92
91
|
],
|
|
93
|
-
extensions:
|
|
92
|
+
extensions: t
|
|
94
93
|
}
|
|
95
94
|
);
|
|
96
|
-
},
|
|
97
|
-
var
|
|
95
|
+
}, b = (i) => new Promise((n, o) => {
|
|
96
|
+
var a;
|
|
98
97
|
if (document.getElementById("UiEditorScript")) {
|
|
99
98
|
i(), n();
|
|
100
99
|
return;
|
|
101
100
|
}
|
|
102
|
-
const
|
|
103
|
-
t.id = "UiEditorScript", t.type = "module", t.src =
|
|
101
|
+
const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
|
|
102
|
+
t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
|
|
104
103
|
i(), n();
|
|
105
104
|
}, t.onerror = () => {
|
|
106
|
-
|
|
105
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
|
|
107
106
|
}, document.body.appendChild(t);
|
|
108
107
|
});
|
|
109
108
|
return { initPlugin: async (i) => {
|
|
110
|
-
await
|
|
111
|
-
const n = S()
|
|
112
|
-
|
|
113
|
-
w()
|
|
114
|
-
]);
|
|
115
|
-
n.syncModulesEnabled = e, await T(i, r, e);
|
|
109
|
+
await b(async () => {
|
|
110
|
+
const n = await S();
|
|
111
|
+
await w(i, n);
|
|
116
112
|
});
|
|
117
113
|
} };
|
|
118
114
|
};
|
|
119
115
|
export {
|
|
120
|
-
|
|
116
|
+
W as useStripo
|
|
121
117
|
};
|
|
@@ -1,35 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (e === "BLOCK_TEXT") {
|
|
9
|
-
const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
|
|
10
|
-
if (t || c)
|
|
1
|
+
import { useOnboardingStore as i } from "../stores/onboarding.js";
|
|
2
|
+
const c = () => {
|
|
3
|
+
const e = {
|
|
4
|
+
block_dropped: ({ blockName: t }) => {
|
|
5
|
+
if (t === "BLOCK_TEXT") {
|
|
6
|
+
const n = i(), o = !n.shouldShowOnboarding("textBlockOnboarding"), r = n.isActive("textBlockOnboarding");
|
|
7
|
+
if (o || r)
|
|
11
8
|
return;
|
|
12
|
-
|
|
9
|
+
n.start("textBlockOnboarding");
|
|
13
10
|
}
|
|
14
|
-
},
|
|
15
|
-
module_saved: async (e) => {
|
|
16
|
-
n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
|
|
17
|
-
},
|
|
18
|
-
module_dropped: async (e) => {
|
|
19
|
-
if (!n.syncModulesEnabled)
|
|
20
|
-
return;
|
|
21
|
-
const { moduleId: o } = e, t = await r(o);
|
|
22
|
-
console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
|
|
23
|
-
},
|
|
24
|
-
module_updated: async (e) => {
|
|
25
|
-
n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
|
|
26
11
|
}
|
|
27
12
|
};
|
|
28
|
-
return { handleEvent: async (
|
|
29
|
-
const
|
|
30
|
-
|
|
13
|
+
return { handleEvent: async (t, n) => {
|
|
14
|
+
const o = e[t];
|
|
15
|
+
o && await o(n);
|
|
31
16
|
} };
|
|
32
17
|
};
|
|
33
18
|
export {
|
|
34
|
-
|
|
19
|
+
c as useStripoEventHandler
|
|
35
20
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
2
|
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
-
const
|
|
3
|
+
const I = {
|
|
4
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
5
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
6
|
+
}, r = {
|
|
7
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
},
|
|
12
|
-
UNSUBSCRIBE_URL: `https://mail.${
|
|
13
|
-
PREFERENCES_URL: `https://mail.${
|
|
14
|
-
},
|
|
11
|
+
}, s = R(), _ = {
|
|
12
|
+
UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
|
|
13
|
+
PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
|
|
14
|
+
}, i = "iid", B = {
|
|
15
15
|
name: "Global Unsubscribe",
|
|
16
16
|
sendGridId: "G"
|
|
17
17
|
}, C = "/email/unsubscribe-pages", E = {
|
|
@@ -20,9 +20,6 @@ const _ = {
|
|
|
20
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
22
|
RESUBSCRIBE: 5
|
|
23
|
-
}, U = {
|
|
24
|
-
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
26
23
|
}, t = {
|
|
27
24
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
28
25
|
E.GLOBAL_UNSUBSCRIBE,
|
|
@@ -33,30 +30,29 @@ const _ = {
|
|
|
33
30
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
34
31
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
35
32
|
]
|
|
36
|
-
},
|
|
37
|
-
const
|
|
33
|
+
}, U = () => {
|
|
34
|
+
const n = e();
|
|
38
35
|
return {
|
|
39
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
40
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
41
|
-
[E.RESUBSCRIBE]:
|
|
42
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
43
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
36
|
+
[E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
|
|
37
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
38
|
+
[E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
|
|
39
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
|
|
40
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
44
41
|
};
|
|
45
|
-
},
|
|
42
|
+
}, c = {
|
|
46
43
|
default: "{{ins-unsubscribe-link}}",
|
|
47
44
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
48
45
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
49
46
|
};
|
|
50
47
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
B as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
49
|
+
i as INSIDER_ID,
|
|
50
|
+
r as LINK_REGEXES,
|
|
51
|
+
I as LINK_TYPES,
|
|
52
|
+
c as MERGE_TAGS,
|
|
56
53
|
E as PAGE_TYPES,
|
|
57
54
|
t as TYPE_COLLECTIONS,
|
|
58
55
|
C as UNSUBSCRIBE_PAGES_LINK,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
c as getTypeTranslations
|
|
56
|
+
_ as URLS,
|
|
57
|
+
U as getTypeTranslations
|
|
62
58
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { useToaster as
|
|
1
|
+
import { useHttp as m } from "../composables/useHttp.js";
|
|
2
|
+
import { useToaster as i } from "../composables/useToaster.js";
|
|
3
3
|
import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
|
|
4
|
-
const
|
|
5
|
-
const { get:
|
|
4
|
+
const y = () => {
|
|
5
|
+
const { get: r } = m(), { handleError: o } = i();
|
|
6
6
|
return {
|
|
7
7
|
getToken: async () => {
|
|
8
8
|
try {
|
|
9
|
-
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await
|
|
9
|
+
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await r(`/stripo/get-user-token?test=${t}`);
|
|
10
10
|
return e.body.token;
|
|
11
11
|
} catch (t) {
|
|
12
|
-
return
|
|
12
|
+
return o(t, "Failed to fetch token"), "";
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
getCustomFonts: async () => {
|
|
16
16
|
try {
|
|
17
|
-
const { data: t = [] } = await
|
|
17
|
+
const { data: t = [] } = await r("/stripo/get-partner-custom-fonts");
|
|
18
18
|
return t.map((e) => ({
|
|
19
19
|
...e,
|
|
20
20
|
active: !0
|
|
21
21
|
}));
|
|
22
22
|
} catch (t) {
|
|
23
|
-
return
|
|
23
|
+
return o(t, "Failed to fetch custom fonts"), [];
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
getDefaultTemplate: async () => {
|
|
@@ -29,52 +29,16 @@ const b = () => {
|
|
|
29
29
|
css: ""
|
|
30
30
|
};
|
|
31
31
|
try {
|
|
32
|
-
const
|
|
33
|
-
`/stripo/default-template/${
|
|
34
|
-
),
|
|
35
|
-
return !
|
|
32
|
+
const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
|
|
33
|
+
`/stripo/default-template/${l}`
|
|
34
|
+
), a = typeof n == "string" ? JSON.parse(n) : n;
|
|
35
|
+
return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
|
|
36
36
|
} catch (e) {
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
getSyncModulesStatus: async () => {
|
|
41
|
-
try {
|
|
42
|
-
const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
|
|
43
|
-
return t.status;
|
|
44
|
-
} catch (t) {
|
|
45
|
-
return r(t, "Failed to fetch sync modules status"), !1;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
updateSyncModule: async (t) => {
|
|
49
|
-
try {
|
|
50
|
-
return await c(`/stripo/stripo-modules/${t.moduleId}/update`, t), !0;
|
|
51
|
-
} catch (e) {
|
|
52
|
-
return r(e, "Failed to update sync module"), !1;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
getSyncModule: async (t) => {
|
|
56
|
-
try {
|
|
57
|
-
const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
|
|
58
|
-
return e;
|
|
59
|
-
} catch (e) {
|
|
60
|
-
return r(e, "Failed to get sync module"), {
|
|
61
|
-
id: 0,
|
|
62
|
-
stripoId: 0,
|
|
63
|
-
unsubscriptionPreferencePages: []
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
setSyncModuleUnsubscriptionPages: async (t) => {
|
|
68
|
-
if (t.length === 0)
|
|
69
|
-
return !0;
|
|
70
|
-
try {
|
|
71
|
-
return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
|
|
72
|
-
} catch (e) {
|
|
73
|
-
return r(e, "Failed to set unsubscription preference pages"), !1;
|
|
37
|
+
return o(e, "Failed to fetch default template"), t;
|
|
74
38
|
}
|
|
75
39
|
}
|
|
76
40
|
};
|
|
77
41
|
};
|
|
78
42
|
export {
|
|
79
|
-
|
|
43
|
+
y as useStripoApi
|
|
80
44
|
};
|
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready'
|
|
2
|
-
export interface ModuleUpdatedParams {
|
|
3
|
-
target: string;
|
|
4
|
-
blockType: string;
|
|
5
|
-
moduleId: number;
|
|
6
|
-
moduleCategory: string | null;
|
|
7
|
-
syncModule: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface ModuleDroppedParams {
|
|
10
|
-
target: string;
|
|
11
|
-
blockType: string;
|
|
12
|
-
moduleId: number;
|
|
13
|
-
syncModule: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface SyncModuleUnsubscribePayload {
|
|
16
|
-
stripoModuleId: string;
|
|
17
|
-
unsubscriptionPreferencePages: number[];
|
|
18
|
-
type: string;
|
|
19
|
-
}
|
|
20
|
-
export interface SyncModuleResponse {
|
|
21
|
-
id: number;
|
|
22
|
-
stripoId: number;
|
|
23
|
-
unsubscriptionPreferencePages: UnsubscriptionPreferencePage[];
|
|
24
|
-
}
|
|
25
|
-
export interface UnsubscriptionPreferencePage {
|
|
26
|
-
id: number;
|
|
27
|
-
name: string;
|
|
28
|
-
type: number;
|
|
29
|
-
status: number;
|
|
30
|
-
isVisible: number;
|
|
31
|
-
thumbnail: string;
|
|
32
|
-
createdAt: string;
|
|
33
|
-
}
|
|
1
|
+
export type StripoEventType = 'save' | 'export' | 'close' | 'autosave' | 'publish' | 'export:requested' | 'export:ready';
|
|
34
2
|
export interface EventHandler {
|
|
35
|
-
(params: Record<string,
|
|
3
|
+
(params: Record<string, string>): void | Promise<void>;
|
|
36
4
|
}
|
|
37
5
|
export interface EventHandlers {
|
|
38
6
|
[eventType: string]: EventHandler;
|
|
@@ -25,9 +25,6 @@ export declare const PAGE_TYPES: {
|
|
|
25
25
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: number;
|
|
26
26
|
RESUBSCRIBE: number;
|
|
27
27
|
};
|
|
28
|
-
export declare const UNSUBSCRIBE_SYNC_MODULE_TYPES: {
|
|
29
|
-
[x: number]: string;
|
|
30
|
-
};
|
|
31
28
|
export declare const TYPE_COLLECTIONS: {
|
|
32
29
|
[x: number]: number[];
|
|
33
30
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ModuleUpdatedParams, SyncModuleResponse, SyncModuleUnsubscribePayload } from '@@/Types/events';
|
|
2
1
|
import type { CustomFont, Template } from '@@/Types/stripo';
|
|
3
2
|
export declare const useStripoApi: () => {
|
|
4
3
|
getToken: () => Promise<string>;
|
|
@@ -6,8 +5,4 @@ export declare const useStripoApi: () => {
|
|
|
6
5
|
active: boolean;
|
|
7
6
|
})[]>;
|
|
8
7
|
getDefaultTemplate: () => Promise<Template>;
|
|
9
|
-
getSyncModulesStatus: () => Promise<boolean>;
|
|
10
|
-
updateSyncModule: (params: ModuleUpdatedParams) => Promise<boolean>;
|
|
11
|
-
getSyncModule: (moduleId: number) => Promise<SyncModuleResponse>;
|
|
12
|
-
setSyncModuleUnsubscriptionPages: (payload: SyncModuleUnsubscribePayload[]) => Promise<boolean>;
|
|
13
8
|
};
|
|
@@ -8,7 +8,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
8
8
|
hasChanges: boolean;
|
|
9
9
|
isStripoInitialized: boolean;
|
|
10
10
|
templateId: string;
|
|
11
|
-
syncModulesEnabled: boolean;
|
|
12
11
|
}, {
|
|
13
12
|
isEditorToolbarVisible: (state: {
|
|
14
13
|
loadingStatus: boolean;
|
|
@@ -20,7 +19,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
20
19
|
hasChanges: boolean;
|
|
21
20
|
isStripoInitialized: boolean;
|
|
22
21
|
templateId: string;
|
|
23
|
-
syncModulesEnabled: boolean;
|
|
24
22
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
25
23
|
loadingStatus: boolean;
|
|
26
24
|
isCodeEditorOpen: boolean;
|
|
@@ -31,7 +29,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
31
29
|
hasChanges: boolean;
|
|
32
30
|
isStripoInitialized: boolean;
|
|
33
31
|
templateId: string;
|
|
34
|
-
syncModulesEnabled: boolean;
|
|
35
32
|
}>) => boolean;
|
|
36
33
|
isUndoButtonDisabled: (state: {
|
|
37
34
|
loadingStatus: boolean;
|
|
@@ -43,7 +40,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
43
40
|
hasChanges: boolean;
|
|
44
41
|
isStripoInitialized: boolean;
|
|
45
42
|
templateId: string;
|
|
46
|
-
syncModulesEnabled: boolean;
|
|
47
43
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
48
44
|
loadingStatus: boolean;
|
|
49
45
|
isCodeEditorOpen: boolean;
|
|
@@ -54,7 +50,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
54
50
|
hasChanges: boolean;
|
|
55
51
|
isStripoInitialized: boolean;
|
|
56
52
|
templateId: string;
|
|
57
|
-
syncModulesEnabled: boolean;
|
|
58
53
|
}>) => boolean;
|
|
59
54
|
isRedoButtonDisabled: (state: {
|
|
60
55
|
loadingStatus: boolean;
|
|
@@ -66,7 +61,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
66
61
|
hasChanges: boolean;
|
|
67
62
|
isStripoInitialized: boolean;
|
|
68
63
|
templateId: string;
|
|
69
|
-
syncModulesEnabled: boolean;
|
|
70
64
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
71
65
|
loadingStatus: boolean;
|
|
72
66
|
isCodeEditorOpen: boolean;
|
|
@@ -77,7 +71,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
77
71
|
hasChanges: boolean;
|
|
78
72
|
isStripoInitialized: boolean;
|
|
79
73
|
templateId: string;
|
|
80
|
-
syncModulesEnabled: boolean;
|
|
81
74
|
}>) => boolean;
|
|
82
75
|
isCodeEditorButtonDisabled: (state: {
|
|
83
76
|
loadingStatus: boolean;
|
|
@@ -89,7 +82,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
89
82
|
hasChanges: boolean;
|
|
90
83
|
isStripoInitialized: boolean;
|
|
91
84
|
templateId: string;
|
|
92
|
-
syncModulesEnabled: boolean;
|
|
93
85
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
94
86
|
loadingStatus: boolean;
|
|
95
87
|
isCodeEditorOpen: boolean;
|
|
@@ -100,7 +92,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
100
92
|
hasChanges: boolean;
|
|
101
93
|
isStripoInitialized: boolean;
|
|
102
94
|
templateId: string;
|
|
103
|
-
syncModulesEnabled: boolean;
|
|
104
95
|
}>) => boolean;
|
|
105
96
|
isPreviewButtonDisabled: (state: {
|
|
106
97
|
loadingStatus: boolean;
|
|
@@ -112,7 +103,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
112
103
|
hasChanges: boolean;
|
|
113
104
|
isStripoInitialized: boolean;
|
|
114
105
|
templateId: string;
|
|
115
|
-
syncModulesEnabled: boolean;
|
|
116
106
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
117
107
|
loadingStatus: boolean;
|
|
118
108
|
isCodeEditorOpen: boolean;
|
|
@@ -123,7 +113,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
123
113
|
hasChanges: boolean;
|
|
124
114
|
isStripoInitialized: boolean;
|
|
125
115
|
templateId: string;
|
|
126
|
-
syncModulesEnabled: boolean;
|
|
127
116
|
}>) => boolean;
|
|
128
117
|
isViewOptionsDisabled: (state: {
|
|
129
118
|
loadingStatus: boolean;
|
|
@@ -135,7 +124,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
135
124
|
hasChanges: boolean;
|
|
136
125
|
isStripoInitialized: boolean;
|
|
137
126
|
templateId: string;
|
|
138
|
-
syncModulesEnabled: boolean;
|
|
139
127
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
140
128
|
loadingStatus: boolean;
|
|
141
129
|
isCodeEditorOpen: boolean;
|
|
@@ -146,7 +134,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
146
134
|
hasChanges: boolean;
|
|
147
135
|
isStripoInitialized: boolean;
|
|
148
136
|
templateId: string;
|
|
149
|
-
syncModulesEnabled: boolean;
|
|
150
137
|
}>) => boolean;
|
|
151
138
|
isVersionHistoryButtonDisabled: (state: {
|
|
152
139
|
loadingStatus: boolean;
|
|
@@ -158,7 +145,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
158
145
|
hasChanges: boolean;
|
|
159
146
|
isStripoInitialized: boolean;
|
|
160
147
|
templateId: string;
|
|
161
|
-
syncModulesEnabled: boolean;
|
|
162
148
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
163
149
|
loadingStatus: boolean;
|
|
164
150
|
isCodeEditorOpen: boolean;
|
|
@@ -169,7 +155,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
169
155
|
hasChanges: boolean;
|
|
170
156
|
isStripoInitialized: boolean;
|
|
171
157
|
templateId: string;
|
|
172
|
-
syncModulesEnabled: boolean;
|
|
173
158
|
}>) => boolean;
|
|
174
159
|
isExportButtonDisabled: (state: {
|
|
175
160
|
loadingStatus: boolean;
|
|
@@ -181,7 +166,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
181
166
|
hasChanges: boolean;
|
|
182
167
|
isStripoInitialized: boolean;
|
|
183
168
|
templateId: string;
|
|
184
|
-
syncModulesEnabled: boolean;
|
|
185
169
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
186
170
|
loadingStatus: boolean;
|
|
187
171
|
isCodeEditorOpen: boolean;
|
|
@@ -192,7 +176,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
192
176
|
hasChanges: boolean;
|
|
193
177
|
isStripoInitialized: boolean;
|
|
194
178
|
templateId: string;
|
|
195
|
-
syncModulesEnabled: boolean;
|
|
196
179
|
}>) => boolean;
|
|
197
180
|
isSaveAsButtonDisabled: (state: {
|
|
198
181
|
loadingStatus: boolean;
|
|
@@ -204,7 +187,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
204
187
|
hasChanges: boolean;
|
|
205
188
|
isStripoInitialized: boolean;
|
|
206
189
|
templateId: string;
|
|
207
|
-
syncModulesEnabled: boolean;
|
|
208
190
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
209
191
|
loadingStatus: boolean;
|
|
210
192
|
isCodeEditorOpen: boolean;
|
|
@@ -215,7 +197,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
215
197
|
hasChanges: boolean;
|
|
216
198
|
isStripoInitialized: boolean;
|
|
217
199
|
templateId: string;
|
|
218
|
-
syncModulesEnabled: boolean;
|
|
219
200
|
}>) => boolean;
|
|
220
201
|
isTestButtonDisabled: (state: {
|
|
221
202
|
loadingStatus: boolean;
|
|
@@ -227,7 +208,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
227
208
|
hasChanges: boolean;
|
|
228
209
|
isStripoInitialized: boolean;
|
|
229
210
|
templateId: string;
|
|
230
|
-
syncModulesEnabled: boolean;
|
|
231
211
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
232
212
|
loadingStatus: boolean;
|
|
233
213
|
isCodeEditorOpen: boolean;
|
|
@@ -238,7 +218,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
238
218
|
hasChanges: boolean;
|
|
239
219
|
isStripoInitialized: boolean;
|
|
240
220
|
templateId: string;
|
|
241
|
-
syncModulesEnabled: boolean;
|
|
242
221
|
}>) => boolean;
|
|
243
222
|
isSaveButtonDisabled: (state: {
|
|
244
223
|
loadingStatus: boolean;
|
|
@@ -250,7 +229,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
250
229
|
hasChanges: boolean;
|
|
251
230
|
isStripoInitialized: boolean;
|
|
252
231
|
templateId: string;
|
|
253
|
-
syncModulesEnabled: boolean;
|
|
254
232
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
255
233
|
loadingStatus: boolean;
|
|
256
234
|
isCodeEditorOpen: boolean;
|
|
@@ -261,6 +239,5 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
|
|
|
261
239
|
hasChanges: boolean;
|
|
262
240
|
isStripoInitialized: boolean;
|
|
263
241
|
templateId: string;
|
|
264
|
-
syncModulesEnabled: boolean;
|
|
265
242
|
}>) => boolean;
|
|
266
243
|
}, {}>;
|
package/dist/stores/editor.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.6294538",
|
|
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",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as S } from "../enums/unsubscribe.js";
|
|
2
|
-
import { DATA_ATTRIBUTES as a } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
-
import { useEditorStore as d } from "../stores/editor.js";
|
|
4
|
-
const T = ".esd-synchronizable-module", m = '[esd-extension-block-id="unsubscribe-block"]', A = "esd-custom-block-id", M = () => {
|
|
5
|
-
const l = d();
|
|
6
|
-
return { extractSyncModuleUnsubscribeData: (p) => {
|
|
7
|
-
if (!l.syncModulesEnabled)
|
|
8
|
-
return [];
|
|
9
|
-
const E = new DOMParser().parseFromString(p, "text/html").querySelectorAll(T), e = [];
|
|
10
|
-
return E.forEach((r) => {
|
|
11
|
-
const s = r.getAttribute(A);
|
|
12
|
-
if (!s)
|
|
13
|
-
return;
|
|
14
|
-
r.querySelectorAll(m).forEach((o) => {
|
|
15
|
-
const n = o.getAttribute(a.PAGE_LIST), c = o.getAttribute(a.PAGE_TYPE);
|
|
16
|
-
if (!n || !c)
|
|
17
|
-
return;
|
|
18
|
-
const b = parseInt(c), u = S[b];
|
|
19
|
-
if (!u)
|
|
20
|
-
return;
|
|
21
|
-
const i = n.split(",").map((t) => parseInt(t.trim())).filter((t) => !Number.isNaN(t));
|
|
22
|
-
i.length !== 0 && e.push({
|
|
23
|
-
stripoModuleId: s,
|
|
24
|
-
unsubscriptionPreferencePages: i,
|
|
25
|
-
type: u
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}), e;
|
|
29
|
-
} };
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
M as useSyncModuleExtractor
|
|
33
|
-
};
|