@useinsider/guido 3.30.0-beta.60cbdf2 → 3.30.0-beta.60f9fc0
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 +14 -0
- package/dist/components/Guido.vue.js +9 -9
- package/dist/components/Guido.vue2.js +153 -130
- package/dist/components/organisms/dynamic-content/InvalidDynamicContentCard.vue.js +22 -0
- package/dist/components/organisms/dynamic-content/InvalidDynamicContentCard.vue2.js +30 -0
- package/dist/components/organisms/header/EditorActionsMenu.vue.js +4 -4
- package/dist/components/organisms/header/EditorActionsMenu.vue2.js +28 -28
- package/dist/composables/useAutoSave.js +13 -13
- package/dist/composables/useInvalidDynamicContentMarking.js +105 -0
- package/dist/composables/useStripo.js +39 -43
- package/dist/extensions/DynamicContent/dynamic-content.js +39 -57
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/services/stripoApi.js +18 -21
- package/dist/src/@types/generic.d.ts +11 -0
- package/dist/src/components/Guido.vue.d.ts +5 -1
- package/dist/src/components/organisms/dynamic-content/InvalidDynamicContentCard.vue.d.ts +22 -0
- package/dist/src/composables/useInvalidDynamicContentMarking.d.ts +4 -0
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +0 -8
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/dynamic-content.d.ts +42 -1
- package/dist/src/stores/editor.d.ts +0 -6
- package/dist/src/utils/editorCanvas.d.ts +3 -0
- package/dist/static/styles/customEditorStyle.css.js +4 -0
- package/dist/stores/dynamic-content.js +19 -7
- package/dist/stores/editor.js +14 -15
- package/dist/utils/editorCanvas.js +18 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as D, ref as C, computed as
|
|
2
|
-
import { useAccessibilityApi as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useExport as
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import { useVersionHistoryApi as
|
|
1
|
+
import { defineComponent as D, ref as C, computed as i, watch as L } from "vue";
|
|
2
|
+
import { useAccessibilityApi as R } from "../../../composables/useAccessibilityApi.js";
|
|
3
|
+
import { useConfig as Y } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as F } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTranslations as N } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useVersionHistoryApi as U } from "../../../composables/useVersionHistoryApi.js";
|
|
7
7
|
import { useAutosaveStore as X } from "../../../stores/autosave.js";
|
|
8
8
|
import { useEditorStore as j } from "../../../stores/editor.js";
|
|
9
9
|
import { useOnboardingStore as q } from "../../../stores/onboarding.js";
|
|
@@ -12,22 +12,22 @@ import { InToggle as G, InDropdownMenu as J, InButtonV2 as K } from "@useinsider
|
|
|
12
12
|
const ce = /* @__PURE__ */ D({
|
|
13
13
|
__name: "EditorActionsMenu",
|
|
14
14
|
setup(Q) {
|
|
15
|
-
const c = "guido__kebab-autosave", u = "guido__kebab-version-history", p = "guido__kebab-accessibility", d = "guido__kebab-save-as", v = "guido__kebab-export", { config:
|
|
15
|
+
const c = "guido__kebab-autosave", u = "guido__kebab-version-history", p = "guido__kebab-accessibility", d = "guido__kebab-save-as", v = "guido__kebab-export", { config: m, isFeatureEnabled: b } = Y(), { exportHtml: y } = F(), { openVersionHistory: A, closeVersionHistory: S } = U(), { toggleAccessibilityTestingMode: _ } = R(), e = j(), a = X(), f = q(), o = N(), g = C(!1), M = i(() => g.value || f.isEditorActionsMenuPinned), r = C(!1), O = i(() => b("autosave")), x = i(
|
|
16
16
|
() => {
|
|
17
|
-
var t,
|
|
18
|
-
return !!((
|
|
17
|
+
var t, s;
|
|
18
|
+
return !!((s = (t = m.value) == null ? void 0 : t.features) != null && s.versionHistory) && !e.isPreviewModeOpen;
|
|
19
19
|
}
|
|
20
|
-
),
|
|
21
|
-
() =>
|
|
22
|
-
),
|
|
23
|
-
var t,
|
|
24
|
-
return !!((
|
|
25
|
-
}),
|
|
20
|
+
), h = i(
|
|
21
|
+
() => b("accessibilityTesting") && !e.isPreviewModeOpen
|
|
22
|
+
), V = i(() => {
|
|
23
|
+
var t, s;
|
|
24
|
+
return !!((s = (t = m.value) == null ? void 0 : t.features) != null && s.saveAsTemplate);
|
|
25
|
+
}), E = i(() => O.value ? [
|
|
26
26
|
{ categoryText: o("email-editor.preferences") },
|
|
27
27
|
{
|
|
28
28
|
text: o("email-editor.auto-save"),
|
|
29
29
|
value: c,
|
|
30
|
-
disable: e.
|
|
30
|
+
disable: e.loadingStatus,
|
|
31
31
|
rightSlotComponent: G,
|
|
32
32
|
rightSlotProps: {
|
|
33
33
|
// InDropdownMenu fills attrs.id with its own positional test id, and v-bind
|
|
@@ -35,25 +35,25 @@ const ce = /* @__PURE__ */ D({
|
|
|
35
35
|
name: "guido-kebab-autosave-toggle",
|
|
36
36
|
class: "p-e-n",
|
|
37
37
|
checked: a.isOn,
|
|
38
|
-
disable: e.
|
|
38
|
+
disable: e.loadingStatus
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{ divider: "solid" }
|
|
42
|
-
] : []), T =
|
|
42
|
+
] : []), T = i(() => [
|
|
43
43
|
{ categoryText: o("email-editor.actions") },
|
|
44
|
-
...
|
|
44
|
+
...x.value ? [{
|
|
45
45
|
text: o("newsletter.version-history"),
|
|
46
46
|
value: u,
|
|
47
47
|
iconLeft: "line-architect-version-history",
|
|
48
48
|
disable: e.isVersionHistoryButtonDisabled
|
|
49
49
|
}] : [],
|
|
50
|
-
...
|
|
50
|
+
...h.value ? [{
|
|
51
51
|
text: o("email-editor.accessibility-test"),
|
|
52
52
|
value: p,
|
|
53
53
|
iconLeft: "line-accessibility",
|
|
54
|
-
disable: e.
|
|
54
|
+
disable: e.loadingStatus
|
|
55
55
|
}] : [],
|
|
56
|
-
...
|
|
56
|
+
...V.value ? [{
|
|
57
57
|
text: o("newsletter.save-templates"),
|
|
58
58
|
value: d,
|
|
59
59
|
iconLeft: "line-newsletter-save-as-template",
|
|
@@ -65,7 +65,7 @@ const ce = /* @__PURE__ */ D({
|
|
|
65
65
|
iconLeft: "line-export",
|
|
66
66
|
disable: r.value || e.isExportButtonDisabled
|
|
67
67
|
}
|
|
68
|
-
]), P =
|
|
68
|
+
]), P = i(() => [...E.value, ...T.value]), n = () => {
|
|
69
69
|
g.value = !1;
|
|
70
70
|
};
|
|
71
71
|
L(() => f.isEditorActionsMenuPinned, (t) => {
|
|
@@ -74,9 +74,9 @@ const ce = /* @__PURE__ */ D({
|
|
|
74
74
|
const k = () => {
|
|
75
75
|
a.isOn = !a.isOn;
|
|
76
76
|
}, w = () => {
|
|
77
|
-
e.isVersionHistoryOpen ?
|
|
77
|
+
e.isVersionHistoryOpen ? S() : A(), n();
|
|
78
78
|
}, H = () => {
|
|
79
|
-
|
|
79
|
+
_(), n();
|
|
80
80
|
}, I = () => {
|
|
81
81
|
e.isSaveAsTemplateDrawerOpen = !0, n();
|
|
82
82
|
}, B = async () => {
|
|
@@ -88,9 +88,9 @@ const ce = /* @__PURE__ */ D({
|
|
|
88
88
|
[d]: I,
|
|
89
89
|
[v]: B
|
|
90
90
|
};
|
|
91
|
-
return { __sfc: !0, AUTOSAVE: c, VERSION_HISTORY: u, ACCESSIBILITY: p, SAVE_AS: d, EXPORT: v, config:
|
|
92
|
-
var
|
|
93
|
-
return (
|
|
91
|
+
return { __sfc: !0, AUTOSAVE: c, VERSION_HISTORY: u, ACCESSIBILITY: p, SAVE_AS: d, EXPORT: v, config: m, isFeatureEnabled: b, exportHtml: y, openVersionHistory: A, closeVersionHistory: S, toggleAccessibilityTestingMode: _, editorStore: e, autosaveStore: a, onboardingStore: f, trans: o, isOpen: g, isPanelOpen: M, isExporting: r, isAutosaveVisible: O, isVersionHistoryVisible: x, isAccessibilityVisible: h, isSaveAsVisible: V, preferenceOptions: E, actionOptions: T, options: P, close: n, toggleAutosave: k, handleVersionHistory: w, handleAccessibility: H, handleSaveAs: I, handleExport: B, optionHandlers: l, handleOptionClick: ({ value: t }) => {
|
|
92
|
+
var s;
|
|
93
|
+
return (s = l[t]) == null ? void 0 : s.call(l);
|
|
94
94
|
}, getTooltipOptions: z, InButtonV2: K, InDropdownMenu: J };
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -3,9 +3,9 @@ import { useEditorLock as y } from "./useEditorLock.js";
|
|
|
3
3
|
import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
|
|
4
4
|
import { useEditorStore as L } from "../stores/editor.js";
|
|
5
5
|
import { computed as w, watch as V, onUnmounted as k } from "vue";
|
|
6
|
-
const D = 18e4, b = 6e4,
|
|
6
|
+
const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
7
7
|
const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
|
|
8
|
-
let
|
|
8
|
+
let o = null, l = 0, u = -1;
|
|
9
9
|
const d = w(
|
|
10
10
|
() => m("autosave") && t.isOn
|
|
11
11
|
), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
|
|
@@ -30,43 +30,43 @@ const D = 18e4, b = 6e4, U = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
e === "visibility" && (l = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING;
|
|
33
|
-
const
|
|
33
|
+
const n = s.changeSeq;
|
|
34
34
|
try {
|
|
35
35
|
if (await g() === void 0) {
|
|
36
36
|
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
u =
|
|
39
|
+
u = n, h() && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
40
40
|
} catch (S) {
|
|
41
41
|
console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
|
|
42
42
|
}
|
|
43
|
-
},
|
|
43
|
+
}, i = () => {
|
|
44
44
|
const { visibilityState: e } = document;
|
|
45
45
|
if (console.debug("guido:autosave:visibility-change", {
|
|
46
46
|
visibilityState: e,
|
|
47
47
|
isActive: d.value
|
|
48
48
|
}), e !== "hidden")
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
50
|
+
const n = Date.now() - l;
|
|
51
|
+
if (n < b) {
|
|
52
52
|
console.debug("guido:autosave:visibility-debounced", {
|
|
53
|
-
sinceLastMs:
|
|
53
|
+
sinceLastMs: n,
|
|
54
54
|
debounceMs: b
|
|
55
55
|
});
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
r("visibility");
|
|
59
59
|
}, c = () => {
|
|
60
|
-
|
|
60
|
+
o && (clearInterval(o), o = null);
|
|
61
61
|
}, v = () => {
|
|
62
|
-
document.removeEventListener("visibilitychange",
|
|
62
|
+
document.removeEventListener("visibilitychange", i), window.removeEventListener("pagehide", i);
|
|
63
63
|
};
|
|
64
64
|
V(
|
|
65
65
|
d,
|
|
66
66
|
(e) => {
|
|
67
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(),
|
|
67
|
+
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), o = setInterval(() => {
|
|
68
68
|
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
69
|
-
}, D), document.addEventListener("visibilitychange",
|
|
69
|
+
}, D), document.addEventListener("visibilitychange", i), window.addEventListener("pagehide", i)) : (c(), v(), t.status = a.IDLE);
|
|
70
70
|
},
|
|
71
71
|
{ immediate: !0 }
|
|
72
72
|
), k(() => {
|
|
@@ -74,5 +74,5 @@ const D = 18e4, b = 6e4, U = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
export {
|
|
77
|
-
|
|
77
|
+
_ as useAutoSave
|
|
78
78
|
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useDynamicContentStore as f } from "../stores/dynamic-content.js";
|
|
2
|
+
import { useEditorStore as T } from "../stores/editor.js";
|
|
3
|
+
import { getEditorCanvasFrame as g, getCanvasElementPosition as S } from "../utils/editorCanvas.js";
|
|
4
|
+
import { watch as A } from "vue";
|
|
5
|
+
const C = "merge-tag-selector", E = "merge-tag-value", u = "guido-invalid-dynamic-content-style", v = ["", " "], h = (t) => v.flatMap((n) => v.map((e) => ({
|
|
6
|
+
exact: `{{${n}${t}${e}}}`,
|
|
7
|
+
prefix: `{{${n}${t}${e}|`
|
|
8
|
+
}))), D = (t, n) => h(n).some(({ exact: e, prefix: o }) => t === e || t.startsWith(o)), p = (t) => t.replace(/["\\|]/g, "\\$&").replace(/[\n\r\f]/g, (n) => `\\${n.charCodeAt(0).toString(16)} `), _ = (t) => {
|
|
9
|
+
const n = t.flatMap((e) => h(e).flatMap(({ exact: o, prefix: r }) => [`="${p(o)}"`, `^="${p(r)}"`]).map((o) => `${C}[${E}${o}]`).flatMap((o) => [`${o} .esd-merge-tag`, `${o} .esd-x`]));
|
|
10
|
+
return n.length === 0 ? "" : `${n.join(`,
|
|
11
|
+
`)} {
|
|
12
|
+
color: var(--guido-dc-invalid-color) !important;
|
|
13
|
+
border-color: var(--guido-dc-invalid-color) !important;
|
|
14
|
+
}`;
|
|
15
|
+
}, y = (t, n) => {
|
|
16
|
+
const e = t.getAttribute(E) ?? "";
|
|
17
|
+
return n.find((o) => D(e, o.value));
|
|
18
|
+
}, w = (t) => typeof (t == null ? void 0 : t.nodeType) == "number", x = (t) => {
|
|
19
|
+
const n = t;
|
|
20
|
+
return typeof (n == null ? void 0 : n.closest) == "function" ? n.closest(C) : null;
|
|
21
|
+
}, $ = () => {
|
|
22
|
+
var t, n;
|
|
23
|
+
return ((n = (t = g()) == null ? void 0 : t.contentWindow) == null ? void 0 : n.document) ?? null;
|
|
24
|
+
}, L = (t, n) => {
|
|
25
|
+
var a;
|
|
26
|
+
const e = _(n), o = t.getElementById(u);
|
|
27
|
+
if (!e) {
|
|
28
|
+
o == null || o.remove();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (o) {
|
|
32
|
+
o.textContent !== e && (o.textContent = e);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const r = t.createElement("style");
|
|
36
|
+
r.id = u, r.textContent = e, (a = t.head ?? t.body) == null || a.appendChild(r);
|
|
37
|
+
}, P = () => {
|
|
38
|
+
const t = $();
|
|
39
|
+
if (t)
|
|
40
|
+
try {
|
|
41
|
+
const n = f().invalidDynamicContentList.map((e) => e.value);
|
|
42
|
+
L(t, n);
|
|
43
|
+
} catch (n) {
|
|
44
|
+
console.error("Failed to apply the invalid dynamic content marking", n);
|
|
45
|
+
}
|
|
46
|
+
}, k = () => {
|
|
47
|
+
const t = f(), n = T();
|
|
48
|
+
let e = null, o = null;
|
|
49
|
+
const r = () => {
|
|
50
|
+
o && (o = null, document.dispatchEvent(new CustomEvent("dynamic-content:invalid-leave")));
|
|
51
|
+
}, a = (i) => {
|
|
52
|
+
const s = x(i.target);
|
|
53
|
+
if (!s || s === o)
|
|
54
|
+
return;
|
|
55
|
+
const l = y(s, t.invalidDynamicContentList), m = g();
|
|
56
|
+
if (!l || !m)
|
|
57
|
+
return;
|
|
58
|
+
o = s;
|
|
59
|
+
const M = {
|
|
60
|
+
entry: { ...l },
|
|
61
|
+
position: S(m, s)
|
|
62
|
+
};
|
|
63
|
+
document.dispatchEvent(new CustomEvent("dynamic-content:invalid-hover", { detail: M }));
|
|
64
|
+
}, d = (i) => {
|
|
65
|
+
!o || w(i.relatedTarget) && o.contains(i.relatedTarget) || r();
|
|
66
|
+
}, c = () => {
|
|
67
|
+
e == null || e.removeEventListener("mouseover", a), e == null || e.removeEventListener("mouseout", d), e == null || e.removeEventListener("scroll", r, !0), e = null, r();
|
|
68
|
+
}, I = () => {
|
|
69
|
+
if (!n.isStripoInitialized) {
|
|
70
|
+
c();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const i = $(), s = t.invalidDynamicContentList.map((l) => l.value);
|
|
74
|
+
if (!i) {
|
|
75
|
+
c();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (L(i, s), s.length === 0) {
|
|
79
|
+
c();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
i !== e && (c(), i.addEventListener("mouseover", a), i.addEventListener("mouseout", d), i.addEventListener("scroll", r, !0), e = i), o && (!o.isConnected || !y(o, t.invalidDynamicContentList)) && r();
|
|
83
|
+
};
|
|
84
|
+
return A(
|
|
85
|
+
[
|
|
86
|
+
() => n.isStripoInitialized,
|
|
87
|
+
() => n.changeSeq,
|
|
88
|
+
() => n.isCodeEditorOpen,
|
|
89
|
+
() => n.isVersionHistoryOpen,
|
|
90
|
+
() => n.isPreviewModeOpen,
|
|
91
|
+
() => t.invalidDynamicContentList
|
|
92
|
+
],
|
|
93
|
+
() => {
|
|
94
|
+
try {
|
|
95
|
+
I();
|
|
96
|
+
} catch (i) {
|
|
97
|
+
console.error("Failed to track invalid dynamic content", i);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
), { dispose: c };
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
P as applyInvalidDynamicContentMarking,
|
|
104
|
+
k as useInvalidDynamicContentMarking
|
|
105
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useAmbiguousDynamicContent as
|
|
1
|
+
import { useActionsApi as j } from "./useActionsApi.js";
|
|
2
|
+
import { useAmbiguousDynamicContent as z } from "./useAmbiguousDynamicContent.js";
|
|
3
3
|
import { useBlocksConfig as $ } from "./useBlocksConfig.js";
|
|
4
4
|
import { useConfig as G } from "./useConfig.js";
|
|
5
5
|
import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
|
|
@@ -13,40 +13,40 @@ import { en as B } from "../config/i18n/en/index.js";
|
|
|
13
13
|
import { ToasterTypeOptions as Z } from "../enums/toaster.js";
|
|
14
14
|
import { useStripoApi as ee } from "../services/stripoApi.js";
|
|
15
15
|
import te from "../static/styles/customEditorStyle.css.js";
|
|
16
|
-
import { useEditorStore as
|
|
16
|
+
import { useEditorStore as T } from "../stores/editor.js";
|
|
17
17
|
import { buildMergeTagEntries as oe, flattenDynamicContentList as re } from "../utils/genericUtil.js";
|
|
18
18
|
import { getStripoRuntimeBaseUrl as ie } from "../utils/stripoRuntime.js";
|
|
19
|
-
let
|
|
19
|
+
let d = null, F = !1;
|
|
20
20
|
const ve = (t) => {
|
|
21
|
-
const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } =
|
|
21
|
+
const { features: u, template: m, isFeatureEnabled: p } = G(), { handleError: f, showToaster: A } = W(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: D } = ee(), { handleEvent: U } = K(), { handleModuleAdd: V } = J(), { restorePending: I } = z(), { getStripoBlocksConfig: L } = $(), { getStripoNotifications: q } = Q(), g = () => d || (d = new Promise((n, s) => {
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
n();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
const i = ie();
|
|
27
27
|
if (!i) {
|
|
28
|
-
|
|
28
|
+
s(
|
|
29
29
|
new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
|
|
30
30
|
);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
}, document.body.appendChild(
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
var
|
|
43
|
-
const
|
|
33
|
+
const a = `${i}UIEditor.js`, e = document.createElement("script");
|
|
34
|
+
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
35
|
+
F = !0, n();
|
|
36
|
+
}, e.onerror = () => {
|
|
37
|
+
e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
38
|
+
}, document.body.appendChild(e);
|
|
39
|
+
}), d.catch(() => {
|
|
40
|
+
d = null;
|
|
41
|
+
}), d), x = async (n, s, i, a = [], e = !1, c = !1) => {
|
|
42
|
+
var w, k, b, _;
|
|
43
|
+
const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: O } = await L();
|
|
44
44
|
t.mark("blocks_config_ready");
|
|
45
|
-
const h = ((
|
|
45
|
+
const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, H = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), M = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
46
46
|
t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
|
|
47
47
|
document.querySelector("#guido-editor"),
|
|
48
48
|
{
|
|
49
|
-
metadata:
|
|
49
|
+
metadata: s,
|
|
50
50
|
html: S,
|
|
51
51
|
css: y,
|
|
52
52
|
forceRecreate: C,
|
|
@@ -64,7 +64,7 @@ const ve = (t) => {
|
|
|
64
64
|
customConditionsEnabled: h,
|
|
65
65
|
enableXSSSecurity: !0,
|
|
66
66
|
modulesDisabled: H,
|
|
67
|
-
syncModulesEnabled:
|
|
67
|
+
syncModulesEnabled: e,
|
|
68
68
|
messageSettingsEnabled: !0,
|
|
69
69
|
displayGmailAnnotations: !0,
|
|
70
70
|
displayHiddenPreheader: !1,
|
|
@@ -74,12 +74,12 @@ const ve = (t) => {
|
|
|
74
74
|
copyPasteEnabled: !1,
|
|
75
75
|
selectElementAfterDrop: !0,
|
|
76
76
|
sameFontSizeForOutlook: !0,
|
|
77
|
-
allowedScriptSourceDomains:
|
|
77
|
+
allowedScriptSourceDomains: M,
|
|
78
78
|
...E ? { baseBlocks: E } : {},
|
|
79
79
|
editorFonts: {
|
|
80
80
|
showDefaultStandardFonts: !0,
|
|
81
81
|
showDefaultNotStandardFonts: !0,
|
|
82
|
-
customFonts:
|
|
82
|
+
customFonts: a
|
|
83
83
|
},
|
|
84
84
|
mergeTags: [
|
|
85
85
|
{
|
|
@@ -93,37 +93,33 @@ const ve = (t) => {
|
|
|
93
93
|
async onTokenRefreshRequest(r) {
|
|
94
94
|
try {
|
|
95
95
|
t.mark("token_start");
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
r(d);
|
|
102
|
-
} catch (d) {
|
|
103
|
-
f(d, "Failed to refresh token");
|
|
96
|
+
const l = await P();
|
|
97
|
+
t.mark("token_end"), r(l);
|
|
98
|
+
} catch (l) {
|
|
99
|
+
f(l, "Failed to refresh token");
|
|
104
100
|
}
|
|
105
101
|
},
|
|
106
102
|
onTemplateLoaded() {
|
|
107
103
|
try {
|
|
108
|
-
const { activateCustomViewStyles: r, updateTimerInClonedTemplate:
|
|
109
|
-
v().importCss(), r(),
|
|
110
|
-
|
|
104
|
+
const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = j(), { injectFullStory: N } = X();
|
|
105
|
+
v().importCss(), r(), N(), I(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
106
|
+
o.hasChanges = !1;
|
|
111
107
|
}, 1e3), t.markReady();
|
|
112
108
|
} catch (r) {
|
|
113
109
|
f(r, "Failed to load custom interface appearance");
|
|
114
110
|
}
|
|
115
111
|
},
|
|
116
112
|
onCodeEditorVisibilityChanged(r) {
|
|
117
|
-
|
|
113
|
+
o.isCodeEditorOpen = r;
|
|
118
114
|
},
|
|
119
115
|
onEditorVisualModeChanged(r) {
|
|
120
|
-
|
|
116
|
+
o.editorVisualMode = r.toLowerCase();
|
|
121
117
|
},
|
|
122
118
|
onVersionHistoryVisibilityChanged(r) {
|
|
123
|
-
|
|
119
|
+
o.isVersionHistoryOpen = r;
|
|
124
120
|
},
|
|
125
121
|
onDataChanged() {
|
|
126
|
-
|
|
122
|
+
o.hasChanges = !0, o.changeSeq += 1;
|
|
127
123
|
},
|
|
128
124
|
onEvent: U,
|
|
129
125
|
onModuleAdd: V,
|
|
@@ -142,17 +138,17 @@ const ve = (t) => {
|
|
|
142
138
|
}
|
|
143
139
|
);
|
|
144
140
|
};
|
|
145
|
-
return { initPlugin: async (n,
|
|
146
|
-
const
|
|
141
|
+
return { initPlugin: async (n, s, i, a = !1) => {
|
|
142
|
+
const e = T();
|
|
147
143
|
try {
|
|
148
|
-
t.mark("plugin_start"), t.setScriptPreloaded(
|
|
149
|
-
const [c,
|
|
144
|
+
t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
|
|
145
|
+
const [c, o] = await Promise.all([
|
|
150
146
|
R(),
|
|
151
147
|
D()
|
|
152
148
|
]);
|
|
153
|
-
t.mark("fonts_sync_ready"),
|
|
149
|
+
t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await x(n, s, i, c, o, a);
|
|
154
150
|
} catch {
|
|
155
|
-
|
|
151
|
+
e.loadingStatus = !1, A({
|
|
156
152
|
type: Z.Error,
|
|
157
153
|
message: B["An error has occurred. Please report the error code to support."],
|
|
158
154
|
actionButton: {
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var g = (
|
|
3
|
-
var
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var g = (r, n, t) => n in r ? m(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var o = (r, n, t) => g(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { useConfig as d } from "../../composables/useConfig.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { applyInvalidDynamicContentMarking as u } from "../../composables/useInvalidDynamicContentMarking.js";
|
|
6
|
+
import { getEditorCanvasFrame as l, getCanvasElementPosition as h } from "../../utils/editorCanvas.js";
|
|
7
|
+
import { mergeTagToDynamicContent as T, dynamicContentToMergeTags as C } from "../../utils/genericUtil.js";
|
|
8
|
+
import { UIElement as y, UIElementType as a, UEAttr as L, UIElementTagRegistry as k } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
9
|
+
import { ExternalMergeTagsLibrary as p } from "./dynamic-content-modal.js";
|
|
10
|
+
const c = "external-dynamic-content-ui-element", E = "button-add-dynamic-content";
|
|
11
|
+
class U extends k {
|
|
12
|
+
registerUiElements(n) {
|
|
13
|
+
n[a.MERGETAGS] = c;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
class
|
|
16
|
+
class v extends y {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
o(this, "mergeTagsButton", null);
|
|
20
|
+
o(this, "mergeTagsLibrary", null);
|
|
21
|
+
o(this, "clickListener", null);
|
|
22
|
+
o(this, "lastClickedElement", null);
|
|
23
|
+
o(this, "lastClickedFrame", null);
|
|
24
|
+
o(this, "mousedownListener", null);
|
|
24
25
|
}
|
|
25
26
|
getId() {
|
|
26
|
-
return
|
|
27
|
+
return c;
|
|
27
28
|
}
|
|
28
29
|
onRender(t) {
|
|
29
30
|
var e;
|
|
@@ -45,8 +46,8 @@ class x extends T {
|
|
|
45
46
|
onAttributeUpdated(t, e) {
|
|
46
47
|
if (t !== "mergeTag" || !(e != null && e.value))
|
|
47
48
|
return;
|
|
48
|
-
const
|
|
49
|
-
this.lastClickedElement = null, this.lastClickedFrame = null, this._openDynamicContentLibrary(
|
|
49
|
+
const i = T(e), s = this._getLastClickedPosition();
|
|
50
|
+
this.lastClickedElement = null, this.lastClickedFrame = null, this._openDynamicContentLibrary(i, s);
|
|
50
51
|
}
|
|
51
52
|
openMergeTagLibrary() {
|
|
52
53
|
const t = this._getButtonPosition(), e = { value: "", text: "" };
|
|
@@ -57,14 +58,15 @@ class x extends T {
|
|
|
57
58
|
* Dispatches event with dynamic content data and position
|
|
58
59
|
*/
|
|
59
60
|
_openDynamicContentLibrary(t, e) {
|
|
60
|
-
this.mergeTagsLibrary || (this.mergeTagsLibrary = new
|
|
61
|
+
this.mergeTagsLibrary || (this.mergeTagsLibrary = new p()), this.mergeTagsLibrary.openMergeTagsLibrary(
|
|
61
62
|
t,
|
|
62
|
-
(
|
|
63
|
-
if (
|
|
64
|
-
const { isFeatureEnabled:
|
|
65
|
-
this.api.triggerValueChange(
|
|
63
|
+
(i) => {
|
|
64
|
+
if (i.text && i.value) {
|
|
65
|
+
const { isFeatureEnabled: s } = d();
|
|
66
|
+
this.api.triggerValueChange(C([i], s("liquidSyntax"))[0]);
|
|
66
67
|
} else
|
|
67
68
|
this.api.triggerValueChange(null);
|
|
69
|
+
u();
|
|
68
70
|
},
|
|
69
71
|
e
|
|
70
72
|
);
|
|
@@ -76,8 +78,8 @@ class x extends T {
|
|
|
76
78
|
_getButtonPosition() {
|
|
77
79
|
if (!this.mergeTagsButton)
|
|
78
80
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
79
|
-
const { x: t, y: e, width:
|
|
80
|
-
return { x: t, y: e, width:
|
|
81
|
+
const { x: t, y: e, width: i, height: s } = this.mergeTagsButton.getBoundingClientRect();
|
|
82
|
+
return { x: t, y: e, width: i, height: s };
|
|
81
83
|
}
|
|
82
84
|
/**
|
|
83
85
|
* Sets up coordinate tracking for merge tag clicks in the iframe
|
|
@@ -85,20 +87,12 @@ class x extends T {
|
|
|
85
87
|
*/
|
|
86
88
|
_setupCoordinateTracking() {
|
|
87
89
|
var e;
|
|
88
|
-
const t =
|
|
89
|
-
(e = t == null ? void 0 : t.contentWindow) != null && e.document && (this.mousedownListener = (
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const t = l();
|
|
91
|
+
(e = t == null ? void 0 : t.contentWindow) != null && e.document && (this.mousedownListener = (i) => {
|
|
92
|
+
const s = this._findMergeTagElement(i.target);
|
|
93
|
+
s && (this.lastClickedElement = s, this.lastClickedFrame = t);
|
|
92
94
|
}, t.contentWindow.document.addEventListener("mousedown", this.mousedownListener));
|
|
93
95
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Gets the editor iframe element
|
|
96
|
-
*/
|
|
97
|
-
_getEditorFrame() {
|
|
98
|
-
var e, n;
|
|
99
|
-
const t = (e = m()) == null ? void 0 : e.querySelector("iframe");
|
|
100
|
-
return (n = t == null ? void 0 : t.contentWindow) != null && n.document ? t : null;
|
|
101
|
-
}
|
|
102
96
|
/**
|
|
103
97
|
* Finds merge tag element in the element tree
|
|
104
98
|
*/
|
|
@@ -111,19 +105,7 @@ class x extends T {
|
|
|
111
105
|
*/
|
|
112
106
|
_getLastClickedPosition() {
|
|
113
107
|
if (!(!this.lastClickedElement || !this.lastClickedFrame))
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Calculates absolute position of element relative to page
|
|
118
|
-
*/
|
|
119
|
-
_calculateAbsolutePosition(t, e) {
|
|
120
|
-
const n = t.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
121
|
-
return {
|
|
122
|
-
x: n.x + i.x,
|
|
123
|
-
y: n.y + i.y,
|
|
124
|
-
width: i.width,
|
|
125
|
-
height: i.height
|
|
126
|
-
};
|
|
108
|
+
return h(this.lastClickedFrame, this.lastClickedElement);
|
|
127
109
|
}
|
|
128
110
|
/**
|
|
129
111
|
* Cleans up the coordinate tracking event listener
|
|
@@ -132,7 +114,7 @@ class x extends T {
|
|
|
132
114
|
var e;
|
|
133
115
|
if (!this.mousedownListener)
|
|
134
116
|
return;
|
|
135
|
-
const t =
|
|
117
|
+
const t = l();
|
|
136
118
|
(e = t == null ? void 0 : t.contentWindow) != null && e.document && t.contentWindow.document.removeEventListener("mousedown", this.mousedownListener), this.mousedownListener = null;
|
|
137
119
|
}
|
|
138
120
|
/**
|
|
@@ -145,7 +127,7 @@ class x extends T {
|
|
|
145
127
|
<${a.BUTTON}
|
|
146
128
|
id="guido__btn-add-dynamic-content"
|
|
147
129
|
class="btn btn-primary"
|
|
148
|
-
${
|
|
130
|
+
${L.BUTTON.name}="${E}">
|
|
149
131
|
<${a.ICON} src="plus" class="icon icon-button color-primary">
|
|
150
132
|
</${a.ICON}>
|
|
151
133
|
${this.api.translate("Add Dynamic Content")}
|
|
@@ -154,6 +136,6 @@ class x extends T {
|
|
|
154
136
|
}
|
|
155
137
|
}
|
|
156
138
|
export {
|
|
157
|
-
|
|
158
|
-
|
|
139
|
+
U as DynamicContentTagRegistry,
|
|
140
|
+
v as DynamicContentUiElementExtension
|
|
159
141
|
};
|