@useinsider/guido 3.7.0-beta.2037cb1 → 3.7.0-beta.24a845f
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,42 +1,42 @@
|
|
|
1
1
|
import { useActionsApi as D } from "./useActionsApi.js";
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
2
|
+
import { useBlocksConfig as I } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as P } from "./useConfig.js";
|
|
4
4
|
import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
6
6
|
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
7
|
import { useToaster as x } from "./useToaster.js";
|
|
8
8
|
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
9
|
import { useStripoApi as O } from "../services/stripoApi.js";
|
|
10
|
-
import
|
|
11
|
-
import { useEditorStore as
|
|
12
|
-
import { dynamicContentToMergeTags as
|
|
13
|
-
import
|
|
14
|
-
const se = (
|
|
15
|
-
const { features:
|
|
10
|
+
import j from "../static/styles/customEditorStyle.css.js";
|
|
11
|
+
import { useEditorStore as E } from "../stores/editor.js";
|
|
12
|
+
import { dynamicContentToMergeTags as z } from "../utils/genericUtil.js";
|
|
13
|
+
import L from "../package.json.js";
|
|
14
|
+
const se = (C, l) => {
|
|
15
|
+
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = O(), { handleEvent: F } = q(), { getStripoBlocksConfig: B } = I(), T = async (i, r = [], s = !1) => {
|
|
16
16
|
var g, S, y;
|
|
17
|
-
const e =
|
|
17
|
+
const e = E(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await B(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, _ = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
18
|
window.UIEditor.initEditor(
|
|
19
19
|
document.querySelector("#guido-editor"),
|
|
20
20
|
{
|
|
21
|
-
metadata:
|
|
21
|
+
metadata: C,
|
|
22
22
|
html: p,
|
|
23
23
|
css: a,
|
|
24
|
-
forceRecreate:
|
|
24
|
+
forceRecreate: v,
|
|
25
25
|
locale: "en",
|
|
26
26
|
undoButtonSelector: "#guido__undo-button",
|
|
27
27
|
redoButtonSelector: "#guido__redo-button",
|
|
28
28
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
29
29
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
30
30
|
codeEditorButtonSelector: "#guido__code-button",
|
|
31
|
-
customAppearanceMergetags: !
|
|
31
|
+
customAppearanceMergetags: !u("liquidSyntax"),
|
|
32
32
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
33
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
34
|
+
customViewStyles: j,
|
|
35
35
|
conditionsEnabled: f,
|
|
36
36
|
customConditionsEnabled: f,
|
|
37
37
|
enableXSSSecurity: !0,
|
|
38
|
-
modulesDisabled:
|
|
39
|
-
syncModulesEnabled:
|
|
38
|
+
modulesDisabled: _,
|
|
39
|
+
syncModulesEnabled: s,
|
|
40
40
|
messageSettingsEnabled: !0,
|
|
41
41
|
displayGmailAnnotations: !0,
|
|
42
42
|
displayHiddenPreheader: !1,
|
|
@@ -45,7 +45,7 @@ const se = (E, c) => {
|
|
|
45
45
|
selectElementAfterDrop: !0,
|
|
46
46
|
sameFontSizeForOutlook: !0,
|
|
47
47
|
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
48
|
-
...
|
|
48
|
+
...o ? { baseBlocks: o } : {},
|
|
49
49
|
editorFonts: {
|
|
50
50
|
showDefaultStandardFonts: !0,
|
|
51
51
|
showDefaultNotStandardFonts: !0,
|
|
@@ -53,9 +53,9 @@ const se = (E, c) => {
|
|
|
53
53
|
},
|
|
54
54
|
mergeTags: [
|
|
55
55
|
{
|
|
56
|
-
entries:
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
entries: z(
|
|
57
|
+
l.preselectedDynamicContentList,
|
|
58
|
+
u("liquidSyntax")
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
],
|
|
@@ -64,17 +64,17 @@ const se = (E, c) => {
|
|
|
64
64
|
const n = await w();
|
|
65
65
|
t(n);
|
|
66
66
|
} catch (n) {
|
|
67
|
-
|
|
67
|
+
m(n, "Failed to refresh token");
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
onTemplateLoaded() {
|
|
71
71
|
try {
|
|
72
72
|
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
|
|
73
|
-
t(), n(), A(), M(),
|
|
73
|
+
t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
74
74
|
e.hasChanges = !1;
|
|
75
75
|
}, 1e3);
|
|
76
76
|
} catch (t) {
|
|
77
|
-
|
|
77
|
+
m(t, "Failed to load custom interface appearance");
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
onCodeEditorVisibilityChanged(t) {
|
|
@@ -89,7 +89,7 @@ const se = (E, c) => {
|
|
|
89
89
|
onDataChanged() {
|
|
90
90
|
e.hasChanges = !0;
|
|
91
91
|
},
|
|
92
|
-
onEvent:
|
|
92
|
+
onEvent: F,
|
|
93
93
|
ignoreClickOutsideSelectors: [
|
|
94
94
|
"#guido-dynamic-content-modal",
|
|
95
95
|
".in-on-board-wrapper",
|
|
@@ -99,32 +99,27 @@ const se = (E, c) => {
|
|
|
99
99
|
localePatch: H
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
-
},
|
|
102
|
+
}, V = (i) => new Promise((r, s) => {
|
|
103
103
|
var d;
|
|
104
104
|
if (document.getElementById("UiEditorScript")) {
|
|
105
|
-
|
|
105
|
+
i(), r();
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
const e =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
}, document.body.appendChild(
|
|
108
|
+
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");
|
|
109
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
110
|
+
i(), r();
|
|
111
|
+
}, o.onerror = () => {
|
|
112
|
+
s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
113
|
+
}, document.body.appendChild(o);
|
|
114
114
|
});
|
|
115
|
-
return { initPlugin: async (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
r.syncModulesEnabled = e, await B(s, o, e);
|
|
124
|
-
});
|
|
125
|
-
} catch (o) {
|
|
126
|
-
r.loadingStatus = !1, l(o, "Failed to load the editor");
|
|
127
|
-
}
|
|
115
|
+
return { initPlugin: async (i) => {
|
|
116
|
+
await V(async () => {
|
|
117
|
+
const r = E(), [s, e] = await Promise.all([
|
|
118
|
+
b(),
|
|
119
|
+
k()
|
|
120
|
+
]);
|
|
121
|
+
r.syncModulesEnabled = e, await T(i, s, e);
|
|
122
|
+
});
|
|
128
123
|
} };
|
|
129
124
|
};
|
|
130
125
|
export {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BlockId as g } from "../../../enums/block.js";
|
|
2
|
-
import { useOnboardingStore as
|
|
3
|
-
import { getMigrationBannerHtml as
|
|
4
|
-
import { Block as
|
|
2
|
+
import { useOnboardingStore as u } from "../../../stores/onboarding.js";
|
|
3
|
+
import { getMigrationBannerHtml as p } from "../../../utils/migrationBannerHtml.js";
|
|
4
|
+
import { Block as f, BlockCompositionType as I, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { SETTINGS_ENUMS as a, DefaultConfigValues as i } from "./enums/settingsEnums.js";
|
|
6
6
|
import { getDefaultTemplate as C } from "./template.js";
|
|
7
7
|
import { getItemsBlockContainer as y, getItemsBlockConfig as b, getDefaultItemsBlockConfig as h } from "./utils/nodeConfigUtils.js";
|
|
8
8
|
const c = g.Items;
|
|
9
|
-
class E extends
|
|
9
|
+
class E extends f {
|
|
10
10
|
getId() {
|
|
11
11
|
return c;
|
|
12
12
|
}
|
|
@@ -23,7 +23,7 @@ class E extends u {
|
|
|
23
23
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
24
24
|
}
|
|
25
25
|
getSettingsPanelTitleHtml() {
|
|
26
|
-
return
|
|
26
|
+
return p(
|
|
27
27
|
c,
|
|
28
28
|
this.api.translate("Items"),
|
|
29
29
|
this.api.translate("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.")
|
|
@@ -42,18 +42,23 @@ class E extends u {
|
|
|
42
42
|
allowInnerBlocksDND() {
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
|
+
// Stripo's Block default is false. Items keeps its full config in nodeConfig
|
|
46
|
+
// (esd-ext-config), so a saved module is self-contained and restores on re-drop.
|
|
47
|
+
canBeSavedAsModule() {
|
|
48
|
+
return !0;
|
|
49
|
+
}
|
|
45
50
|
onCreated(n) {
|
|
46
51
|
const l = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
|
|
47
52
|
r.querySelector('[product-attr="imageSrc"] img') || l.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
53
|
+
const t = y(n);
|
|
54
|
+
if (!t)
|
|
50
55
|
return;
|
|
51
|
-
const s =
|
|
52
|
-
if (
|
|
53
|
-
m ?
|
|
56
|
+
const s = t.getNodeConfig(), m = s && Object.keys(s).length > 0, e = b(n);
|
|
57
|
+
if (e != null && e.initialized)
|
|
58
|
+
m ? e.blockInstanceId || this.api.getDocumentModifier().modifyHtml(t).setNodeConfig({ ...e, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(e).apply(new o("Migrate legacy config to nodeConfig"));
|
|
54
59
|
else {
|
|
55
60
|
const d = h();
|
|
56
|
-
this.api.getDocumentModifier().modifyHtml(
|
|
61
|
+
this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(d).apply(new o("Initialize Items block with default configuration")), u().startOnboarding("itemsOnboarding");
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
}
|
|
@@ -47,8 +47,11 @@ class q extends R {
|
|
|
47
47
|
allowInnerBlocksDND() {
|
|
48
48
|
return !1;
|
|
49
49
|
}
|
|
50
|
+
// Full config persists in nodeConfig (esd-ext-config) and is rebuilt at
|
|
51
|
+
// compile time by hydrateRecommendationStoreFromRawHtml, so a saved module
|
|
52
|
+
// restores its campaign/layout/styles when re-dropped into another email.
|
|
50
53
|
canBeSavedAsModule() {
|
|
51
|
-
return !
|
|
54
|
+
return !0;
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
54
57
|
* Returns the template HTML for a new recommendation block.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.24a845f",
|
|
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",
|