@useinsider/guido 2.1.0-beta.bcfc012 → 2.1.0-beta.bd5d1ea
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 +41 -2
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +66 -66
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue.js +10 -12
- package/dist/components/organisms/header/EditorActions.vue2.js +31 -41
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +66 -62
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +45 -0
- package/dist/config/i18n/en/labels.json.js +3 -8
- package/dist/config/migrator/itemsBlockMigrator.js +138 -139
- package/dist/config/migrator/recommendationMigrator.js +40 -42
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Items/block.js +25 -45
- package/dist/extensions/Blocks/Items/iconsRegistry.js +5 -40
- package/dist/extensions/Blocks/Items/items.css.js +0 -48
- package/dist/extensions/Blocks/Recommendation/block.js +29 -49
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +2 -37
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +0 -48
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/extensions/Blocks/common-control.js +4 -12
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +55 -19
- package/dist/src/@types/config/schemas.d.ts +1 -1
- package/dist/src/@types/events.d.ts +38 -2
- package/dist/src/components/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/composables/useGuidoActions.d.ts +1 -1
- package/dist/src/composables/useSave.d.ts +2 -2
- package/dist/src/composables/useStripo.d.ts +2 -2
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -5
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/templatePreparation.d.ts +1 -1
- package/dist/stores/editor.js +2 -1
- package/dist/stores/unsubscribe.js +37 -34
- package/dist/utils/templatePreparation.js +1 -1
- package/package.json +2 -2
- package/dist/components/organisms/header/MigrationConfirmModal.vue.js +0 -21
- package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +0 -38
- package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +0 -5
- package/dist/src/stores/template.d.ts +0 -3
- package/dist/stores/template.js +0 -9
|
@@ -1,27 +1,27 @@
|
|
|
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 { localePatch as
|
|
8
|
-
import { displayConditions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import
|
|
11
|
-
import { useEditorStore as
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const { features: l, template:
|
|
16
|
-
var
|
|
17
|
-
const
|
|
1
|
+
import { useActionsApi as A } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as F } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as D } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as I } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as P } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as U } from "./useToaster.js";
|
|
7
|
+
import { localePatch as R } from "../config/i18n/index.js";
|
|
8
|
+
import { displayConditions as H } from "../enums/displayConditions.js";
|
|
9
|
+
import { useStripoApi as O } from "../services/stripoApi.js";
|
|
10
|
+
import q from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as S } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as x } from "../utils/genericUtil.js";
|
|
13
|
+
import L from "../package.json.js";
|
|
14
|
+
const oe = (C, c) => {
|
|
15
|
+
const { features: l, template: E } = D(), { handleError: u } = U(), { getToken: h, getCustomFonts: w, getSyncModulesStatus: b } = O(), { handleEvent: k } = P(), { getStripoBlocksConfig: T } = F(), V = async (i, n = [], r = !1) => {
|
|
16
|
+
var f, g, y;
|
|
17
|
+
const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await T(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, B = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, v = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
18
|
window.UIEditor.initEditor(
|
|
19
19
|
document.querySelector("#guido-editor"),
|
|
20
20
|
{
|
|
21
|
-
metadata:
|
|
22
|
-
html:
|
|
23
|
-
css:
|
|
24
|
-
forceRecreate:
|
|
21
|
+
metadata: C,
|
|
22
|
+
html: m,
|
|
23
|
+
css: a,
|
|
24
|
+
forceRecreate: v,
|
|
25
25
|
locale: "en",
|
|
26
26
|
undoButtonSelector: "#guido__undo-button",
|
|
27
27
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -31,89 +31,93 @@ const Z = (c) => {
|
|
|
31
31
|
customAppearanceMergetags: !0,
|
|
32
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
35
|
-
conditionsEnabled:
|
|
36
|
-
customConditionsEnabled:
|
|
37
|
-
conditionCategories:
|
|
34
|
+
customViewStyles: q,
|
|
35
|
+
conditionsEnabled: p,
|
|
36
|
+
customConditionsEnabled: p,
|
|
37
|
+
conditionCategories: H,
|
|
38
38
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
39
|
+
modulesDisabled: B,
|
|
40
|
+
syncModulesEnabled: r,
|
|
40
41
|
messageSettingsEnabled: !0,
|
|
41
42
|
displayGmailAnnotations: !0,
|
|
42
43
|
displayHiddenPreheader: !1,
|
|
43
44
|
displayTitle: !1,
|
|
44
45
|
displayUTM: !1,
|
|
45
46
|
selectElementAfterDrop: !0,
|
|
46
|
-
...
|
|
47
|
+
...o ? { baseBlocks: o } : {},
|
|
47
48
|
editorFonts: {
|
|
48
49
|
showDefaultStandardFonts: !0,
|
|
49
50
|
showDefaultNotStandardFonts: !0,
|
|
50
|
-
customFonts:
|
|
51
|
+
customFonts: n
|
|
51
52
|
},
|
|
52
53
|
mergeTags: [
|
|
53
54
|
{
|
|
54
|
-
entries:
|
|
55
|
+
entries: x(c.preselectedDynamicContentList)
|
|
55
56
|
}
|
|
56
57
|
],
|
|
57
|
-
async onTokenRefreshRequest(
|
|
58
|
+
async onTokenRefreshRequest(t) {
|
|
58
59
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
} catch (
|
|
62
|
-
u(
|
|
60
|
+
const s = await h();
|
|
61
|
+
t(s);
|
|
62
|
+
} catch (s) {
|
|
63
|
+
u(s, "Failed to refresh token");
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
onTemplateLoaded() {
|
|
66
67
|
try {
|
|
67
|
-
const { importCss:
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const { importCss: t } = I(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: M } = A();
|
|
69
|
+
t(), s(), M(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
70
|
+
e.hasChanges = !1;
|
|
70
71
|
}, 1e3);
|
|
71
|
-
} catch (
|
|
72
|
-
u(
|
|
72
|
+
} catch (t) {
|
|
73
|
+
u(t, "Failed to load custom interface appearance");
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
|
-
onCodeEditorVisibilityChanged(
|
|
76
|
-
|
|
76
|
+
onCodeEditorVisibilityChanged(t) {
|
|
77
|
+
e.isCodeEditorOpen = t;
|
|
77
78
|
},
|
|
78
|
-
onEditorVisualModeChanged(
|
|
79
|
-
|
|
79
|
+
onEditorVisualModeChanged(t) {
|
|
80
|
+
e.editorVisualMode = t.toLowerCase();
|
|
80
81
|
},
|
|
81
|
-
onVersionHistoryVisibilityChanged(
|
|
82
|
-
|
|
82
|
+
onVersionHistoryVisibilityChanged(t) {
|
|
83
|
+
e.isVersionHistoryOpen = t;
|
|
83
84
|
},
|
|
84
85
|
onDataChanged() {
|
|
85
|
-
|
|
86
|
+
e.hasChanges = !0;
|
|
86
87
|
},
|
|
87
|
-
onEvent:
|
|
88
|
+
onEvent: k,
|
|
88
89
|
ignoreClickOutsideSelectors: [
|
|
89
90
|
"#guido-dynamic-content-modal",
|
|
90
91
|
".in-on-board-wrapper",
|
|
91
92
|
".in-drawer__container"
|
|
92
93
|
],
|
|
93
|
-
extensions:
|
|
94
|
-
localePatch:
|
|
94
|
+
extensions: d,
|
|
95
|
+
localePatch: R
|
|
95
96
|
}
|
|
96
97
|
);
|
|
97
|
-
},
|
|
98
|
-
var
|
|
98
|
+
}, _ = (i) => new Promise((n, r) => {
|
|
99
|
+
var d;
|
|
99
100
|
if (document.getElementById("UiEditorScript")) {
|
|
100
|
-
i(),
|
|
101
|
+
i(), n();
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
i(),
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
}, document.body.appendChild(
|
|
104
|
+
const e = L.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");
|
|
105
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
106
|
+
i(), n();
|
|
107
|
+
}, o.onerror = () => {
|
|
108
|
+
r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
109
|
+
}, document.body.appendChild(o);
|
|
109
110
|
});
|
|
110
111
|
return { initPlugin: async (i) => {
|
|
111
|
-
await
|
|
112
|
-
const r = await
|
|
113
|
-
|
|
112
|
+
await _(async () => {
|
|
113
|
+
const n = S(), [r, e] = await Promise.all([
|
|
114
|
+
w(),
|
|
115
|
+
b()
|
|
116
|
+
]);
|
|
117
|
+
n.syncModulesEnabled = e, await V(i, r, e);
|
|
114
118
|
});
|
|
115
119
|
} };
|
|
116
120
|
};
|
|
117
121
|
export {
|
|
118
|
-
|
|
122
|
+
oe as useStripo
|
|
119
123
|
};
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useStripoApi as i } from "../services/stripoApi.js";
|
|
2
|
+
import { useEditorStore as u } from "../stores/editor.js";
|
|
3
|
+
import { useOnboardingStore as l } from "../stores/onboarding.js";
|
|
4
|
+
import { useUnsubscribeStore as b } from "../stores/unsubscribe.js";
|
|
5
|
+
const v = () => {
|
|
6
|
+
const { updateSyncModule: d, getSyncModule: r } = i(), n = u(), s = b(), a = {
|
|
7
|
+
block_dropped: ({ blockName: e }) => {
|
|
8
|
+
if (e === "BLOCK_TEXT") {
|
|
9
|
+
const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
|
|
10
|
+
if (t || c)
|
|
8
11
|
return;
|
|
9
|
-
|
|
12
|
+
o.start("textBlockOnboarding");
|
|
10
13
|
}
|
|
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));
|
|
11
26
|
}
|
|
12
27
|
};
|
|
13
|
-
return { handleEvent: async (
|
|
14
|
-
const
|
|
15
|
-
o && await o
|
|
28
|
+
return { handleEvent: async (e, o) => {
|
|
29
|
+
const t = a[e];
|
|
30
|
+
console.debug("Stripo Event: ", e, o), t && await t(o);
|
|
16
31
|
} };
|
|
17
32
|
};
|
|
18
33
|
export {
|
|
19
|
-
|
|
34
|
+
v as useStripoEventHandler
|
|
20
35
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as T } from "../enums/unsubscribe.js";
|
|
2
|
+
import { DATA_ATTRIBUTES as p } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
+
import { useEditorStore as f } from "../stores/editor.js";
|
|
4
|
+
const y = ".esd-synchronizable-module", A = '[esd-extension-block-id="unsubscribe-block"]', _ = "esd-custom-block-id", B = () => {
|
|
5
|
+
const d = f();
|
|
6
|
+
return { extractSyncModuleData: (E) => {
|
|
7
|
+
const S = {
|
|
8
|
+
unsubscribePayload: [],
|
|
9
|
+
stripoModules: []
|
|
10
|
+
};
|
|
11
|
+
if (!d.syncModulesEnabled)
|
|
12
|
+
return S;
|
|
13
|
+
const b = new DOMParser().parseFromString(E, "text/html").querySelectorAll(y), r = [], s = [];
|
|
14
|
+
return b.forEach((o) => {
|
|
15
|
+
const t = o.getAttribute(_);
|
|
16
|
+
if (!t)
|
|
17
|
+
return;
|
|
18
|
+
const n = o.querySelectorAll(A);
|
|
19
|
+
if (n.length === 0) {
|
|
20
|
+
s.push(Number(t));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
n.forEach((c) => {
|
|
24
|
+
const u = c.getAttribute(p.PAGE_LIST), i = c.getAttribute(p.PAGE_TYPE);
|
|
25
|
+
if (!u || !i)
|
|
26
|
+
return;
|
|
27
|
+
const m = parseInt(i), a = T[m];
|
|
28
|
+
if (!a)
|
|
29
|
+
return;
|
|
30
|
+
const l = u.split(",").map((e) => parseInt(e.trim())).filter((e) => !Number.isNaN(e));
|
|
31
|
+
l.length !== 0 && r.push({
|
|
32
|
+
stripoModuleId: t,
|
|
33
|
+
unsubscriptionPreferencePages: l,
|
|
34
|
+
type: a
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}), {
|
|
38
|
+
unsubscribePayload: r,
|
|
39
|
+
stripoModules: s
|
|
40
|
+
};
|
|
41
|
+
} };
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
B as useSyncModuleExtractor
|
|
45
|
+
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = {
|
|
2
2
|
"Global Styles & Layout": "Global Styles and Layout",
|
|
3
|
-
"Structures & Modules": "Structures and Modules"
|
|
4
|
-
"Recommendation Block": "Recommendation",
|
|
5
|
-
Items: e,
|
|
6
|
-
"This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
|
|
7
|
-
"This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly."
|
|
3
|
+
"Structures & Modules": "Structures and Modules"
|
|
8
4
|
};
|
|
9
5
|
export {
|
|
10
|
-
|
|
11
|
-
o as default
|
|
6
|
+
l as default
|
|
12
7
|
};
|