@useinsider/guido 3.12.0-beta.40db55d → 3.12.0-beta.4e0547f
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 +2 -14
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +110 -101
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
- package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
- package/dist/composables/usePreviewInteractionGuard.js +36 -11
- package/dist/composables/useRecommendationPreview.js +61 -60
- package/dist/composables/useStripo.js +72 -69
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
- package/dist/extensions/Blocks/controlFactories.js +125 -75
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +18 -2
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
- package/dist/src/composables/useStripo.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
- package/dist/src/stores/config.d.ts +3 -1
- package/dist/src/utils/urlSchemes.d.ts +6 -0
- package/dist/stores/config.js +21 -19
- package/dist/utils/urlSchemes.js +4 -0
- package/package.json +5 -10
package/README.md
CHANGED
|
@@ -20,11 +20,9 @@ npm install @useinsider/guido
|
|
|
20
20
|
|
|
21
21
|
### Prerequisites
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
bundle or install them for you:
|
|
23
|
+
Your project needs:
|
|
25
24
|
- Vue 2.7+
|
|
26
25
|
- Pinia (state management)
|
|
27
|
-
- `@useinsider/design-system-vue` 2.x
|
|
28
26
|
|
|
29
27
|
Add these to your bundler config to optimize dependencies:
|
|
30
28
|
|
|
@@ -33,26 +31,16 @@ Add these to your bundler config to optimize dependencies:
|
|
|
33
31
|
shared: {
|
|
34
32
|
vue: { singleton: true },
|
|
35
33
|
pinia: { singleton: true },
|
|
36
|
-
'@useinsider/design-system-vue': { singleton: true },
|
|
37
34
|
},
|
|
38
35
|
```
|
|
39
36
|
|
|
40
37
|
**Vite** (`vite.config.js`):
|
|
41
38
|
```js
|
|
42
39
|
resolve: {
|
|
43
|
-
dedupe: ['vue', 'pinia'
|
|
40
|
+
dedupe: ['vue', 'pinia'],
|
|
44
41
|
},
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
> A second copy of the design system breaks styling and overlay positioning.
|
|
48
|
-
> If your `.npmrc` sets `legacy-peer-deps=true`, npm will neither install these
|
|
49
|
-
> nor warn you about them — declare them in your own `dependencies`.
|
|
50
|
-
>
|
|
51
|
-
> **Upgrading from Guido 3.11 or earlier?** You used to receive the design system
|
|
52
|
-
> transitively. Add `@useinsider/design-system-vue` `^2.0.0` to your own
|
|
53
|
-
> `dependencies` — an already-hoisted 1.x copy resolves silently and fails at
|
|
54
|
-
> runtime instead of at install.
|
|
55
|
-
|
|
56
44
|
---
|
|
57
45
|
|
|
58
46
|
## Quick Start
|
|
@@ -1,140 +1,149 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { provideGuidoActions as
|
|
4
|
-
import { useGuidoStateBridge as
|
|
5
|
-
import { usePartner as
|
|
6
|
-
import { useStripo as
|
|
7
|
-
import { useTimerClone as
|
|
8
|
-
import { migrate as
|
|
9
|
-
import { ModuleFolderDefaults as
|
|
10
|
-
import { RIBBON_SELECTOR as
|
|
11
|
-
import { useRecommendationExtensionStore as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useStripoApi as
|
|
20
|
-
import { useConfigStore as
|
|
21
|
-
import { useDynamicContentStore as
|
|
22
|
-
import { useEditorStore as
|
|
23
|
-
import { usePreviewStore as
|
|
24
|
-
import { useTemplateStore as
|
|
25
|
-
import { useUnsubscribeStore as
|
|
26
|
-
const
|
|
1
|
+
import { defineComponent as q, defineAsyncComponent as M, ref as U, computed as _, watch as B, onMounted as K, onUnmounted as V } from "vue";
|
|
2
|
+
import { useCortexBlueprintBridge as j } from "../composables/useCortexBlueprintBridge.js";
|
|
3
|
+
import { provideGuidoActions as J } from "../composables/useGuidoActions.js";
|
|
4
|
+
import { useGuidoStateBridge as Q } from "../composables/useGuidoStateBridge.js";
|
|
5
|
+
import { usePartner as X } from "../composables/usePartner.js";
|
|
6
|
+
import { useStripo as Y } from "../composables/useStripo.js";
|
|
7
|
+
import { useTimerClone as Z } from "../composables/useTimerClone.js";
|
|
8
|
+
import { migrate as I } from "../config/migrator/index.js";
|
|
9
|
+
import { ModuleFolderDefaults as N } from "../enums/defaults.js";
|
|
10
|
+
import { RIBBON_SELECTOR as ee } from "../enums/onboarding.js";
|
|
11
|
+
import { useRecommendationExtensionStore as te } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
12
|
+
import oe from "./organisms/AutoSaveController.vue.js";
|
|
13
|
+
import ne from "./organisms/base/Toaster.vue.js";
|
|
14
|
+
import re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
|
|
15
|
+
import se from "./organisms/header/HeaderWrapper.vue.js";
|
|
16
|
+
import ie from "./organisms/LoadingWrapper.vue.js";
|
|
17
|
+
import ae from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
|
|
18
|
+
import ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
|
|
19
|
+
import { useStripoApi as de } from "../services/stripoApi.js";
|
|
20
|
+
import { useConfigStore as me } from "../stores/config.js";
|
|
21
|
+
import { useDynamicContentStore as le } from "../stores/dynamic-content.js";
|
|
22
|
+
import { useEditorStore as O } from "../stores/editor.js";
|
|
23
|
+
import { usePreviewStore as ue } from "../stores/preview.js";
|
|
24
|
+
import { useTemplateStore as pe } from "../stores/template.js";
|
|
25
|
+
import { useUnsubscribeStore as fe } from "../stores/unsubscribe.js";
|
|
26
|
+
const xe = /* @__PURE__ */ q({
|
|
27
27
|
__name: "Guido",
|
|
28
28
|
props: {
|
|
29
|
-
config: null
|
|
29
|
+
config: null,
|
|
30
|
+
ready: { type: Boolean, default: !0 }
|
|
30
31
|
},
|
|
31
32
|
emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
|
|
32
|
-
setup(
|
|
33
|
-
const
|
|
33
|
+
setup(P, { expose: A, emit: n }) {
|
|
34
|
+
const i = P, W = M(
|
|
34
35
|
() => import("./organisms/email-preview/PreviewContainer.vue.js")
|
|
35
|
-
),
|
|
36
|
+
), x = M(
|
|
36
37
|
() => import("./organisms/onboarding/OnboardingWrapper.vue.js")
|
|
37
|
-
),
|
|
38
|
-
i.init(
|
|
39
|
-
const
|
|
40
|
-
var
|
|
41
|
-
return (
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
defaultModulesFolderName: _
|
|
60
|
-
}, M = {
|
|
61
|
-
preselectedDynamicContentList: S,
|
|
62
|
-
onReady: () => {
|
|
63
|
-
console.debug("guido:ready"), n("ready");
|
|
64
|
-
}
|
|
65
|
-
}, { initPlugin: O } = se(y, M), { getDefaultTemplate: P } = Se(), { cloneTimersOnSave: R, hasTimerBlocks: A } = ae(), Q = x(() => {
|
|
66
|
-
var e;
|
|
67
|
-
return !((e = i.ui) != null && e.showHeader);
|
|
38
|
+
), g = U(), l = U(), u = le(), S = fe(), o = me();
|
|
39
|
+
i.ready && o.init(i.config);
|
|
40
|
+
const d = O(), G = ue(), m = _(() => d.hasChanges), { isTestPartner: H } = X(), h = () => {
|
|
41
|
+
var t;
|
|
42
|
+
return (t = g.value) == null ? void 0 : t.handleSave(!0);
|
|
43
|
+
}, b = (t) => {
|
|
44
|
+
d.loadingStatus = t;
|
|
45
|
+
};
|
|
46
|
+
j(), Q();
|
|
47
|
+
const p = () => {
|
|
48
|
+
var t, e;
|
|
49
|
+
return {
|
|
50
|
+
emailId: o.templateId,
|
|
51
|
+
userId: o.userId,
|
|
52
|
+
username: o.username,
|
|
53
|
+
partnerName: o.partnerName,
|
|
54
|
+
savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
|
|
55
|
+
defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
|
|
56
|
+
};
|
|
57
|
+
}, { initPlugin: E, preloadRuntime: w } = Y(), { getDefaultTemplate: C } = de(), { cloneTimersOnSave: D, hasTimerBlocks: T } = Z(), $ = _(() => {
|
|
58
|
+
var t;
|
|
59
|
+
return !((t = o.ui) != null && t.showHeader);
|
|
68
60
|
});
|
|
69
|
-
|
|
61
|
+
J({
|
|
70
62
|
onBack: () => {
|
|
71
63
|
console.debug("guido:back"), n("back");
|
|
72
64
|
},
|
|
73
65
|
onSaveStart: () => {
|
|
74
66
|
console.debug("guido:save:start"), n("save:start");
|
|
75
67
|
},
|
|
76
|
-
onSaveComplete: (
|
|
77
|
-
const
|
|
78
|
-
console.debug("guido:save:complete",
|
|
68
|
+
onSaveComplete: (t) => {
|
|
69
|
+
const e = { ...t, metadata: p() };
|
|
70
|
+
console.debug("guido:save:complete", e), n("save:complete", e);
|
|
79
71
|
},
|
|
80
72
|
onTestEmailClick: () => {
|
|
81
73
|
console.debug("guido:test-email:click"), n("test-email:click");
|
|
82
74
|
}
|
|
83
75
|
});
|
|
84
|
-
const
|
|
85
|
-
console.debug("dynamic-content:close",
|
|
86
|
-
},
|
|
76
|
+
const L = (t) => {
|
|
77
|
+
console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
|
|
78
|
+
}, R = () => {
|
|
87
79
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
88
80
|
};
|
|
89
|
-
|
|
90
|
-
n("on-change",
|
|
81
|
+
B(() => m.value, () => {
|
|
82
|
+
n("on-change", m.value);
|
|
91
83
|
});
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
console.debug("dynamic-content:open",
|
|
84
|
+
const f = (t) => {
|
|
85
|
+
const e = t, { attribute: s, position: c } = e.detail;
|
|
86
|
+
console.debug("dynamic-content:open", e.detail), n("dynamic-content:open", s, c);
|
|
95
87
|
};
|
|
96
88
|
let a = null;
|
|
97
|
-
const
|
|
89
|
+
const y = () => {
|
|
90
|
+
var e;
|
|
91
|
+
const t = document.querySelector(ee);
|
|
92
|
+
(e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
|
|
93
|
+
}, v = async () => {
|
|
98
94
|
var t;
|
|
99
|
-
const e = document.querySelector(ce);
|
|
100
|
-
(t = p.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
|
|
101
|
-
};
|
|
102
|
-
return Z(async () => {
|
|
103
|
-
var t, u;
|
|
104
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ie().$reset(), $().$reset(), m.templateId = v, be().$reset(), g();
|
|
105
|
-
const e = (t = p.value) == null ? void 0 : t.parentElement;
|
|
106
|
-
e && (a = new ResizeObserver(g), a.observe(e));
|
|
107
95
|
try {
|
|
108
|
-
|
|
109
|
-
const
|
|
96
|
+
o.initialized || o.init(i.config), d.templateId = o.templateId;
|
|
97
|
+
const e = o.template, s = (e == null ? void 0 : e.html) || "", c = (e == null ? void 0 : e.css) || "", k = (e == null ? void 0 : e.preselectedDynamicContent) || [];
|
|
98
|
+
S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
|
|
99
|
+
const F = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {};
|
|
110
100
|
let r = {
|
|
111
|
-
html:
|
|
112
|
-
css:
|
|
101
|
+
html: s && await I(s, F),
|
|
102
|
+
css: c
|
|
103
|
+
};
|
|
104
|
+
r.html || (r = await C(), r.html = await I(r.html, F)), T(r.html) && (r.html = await D(r.html));
|
|
105
|
+
const z = {
|
|
106
|
+
preselectedDynamicContentList: k,
|
|
107
|
+
onReady: () => {
|
|
108
|
+
console.debug("guido:ready"), n("ready");
|
|
109
|
+
}
|
|
113
110
|
};
|
|
114
|
-
|
|
115
|
-
} catch (
|
|
116
|
-
console.error("Failed to initialize Stripo editor:",
|
|
111
|
+
await E(r, p(), z), u.selectedDynamicContentList = k;
|
|
112
|
+
} catch (e) {
|
|
113
|
+
console.error("Failed to initialize Stripo editor:", e);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
return K(async () => {
|
|
117
|
+
var e;
|
|
118
|
+
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), te().$reset(), O().$reset(), pe().$reset(), y();
|
|
119
|
+
const t = (e = l.value) == null ? void 0 : e.parentElement;
|
|
120
|
+
if (t && (a = new ResizeObserver(y), a.observe(t)), w(), i.ready)
|
|
121
|
+
await v();
|
|
122
|
+
else {
|
|
123
|
+
const s = B(() => i.ready, (c) => {
|
|
124
|
+
c && (s(), v());
|
|
125
|
+
});
|
|
117
126
|
}
|
|
118
|
-
document.addEventListener("dynamic-content:open",
|
|
119
|
-
}),
|
|
120
|
-
a == null || a.disconnect(), document.removeEventListener("dynamic-content:open",
|
|
127
|
+
document.addEventListener("dynamic-content:open", f);
|
|
128
|
+
}), V(() => {
|
|
129
|
+
a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", f);
|
|
121
130
|
try {
|
|
122
131
|
window.UIEditor.removeEditor();
|
|
123
132
|
} catch {
|
|
124
133
|
console.debug("Failed to remove Stripo editor: No editor found");
|
|
125
134
|
}
|
|
126
|
-
|
|
127
|
-
}),
|
|
135
|
+
o.reset();
|
|
136
|
+
}), A({
|
|
128
137
|
dynamicContent: {
|
|
129
|
-
insert:
|
|
130
|
-
close:
|
|
138
|
+
insert: L,
|
|
139
|
+
close: R
|
|
131
140
|
},
|
|
132
|
-
hasChanges:
|
|
133
|
-
saveSilent:
|
|
134
|
-
setLoading:
|
|
135
|
-
}), { __sfc: !0, PreviewContainer:
|
|
141
|
+
hasChanges: m,
|
|
142
|
+
saveSilent: h,
|
|
143
|
+
setLoading: b
|
|
144
|
+
}), { __sfc: !0, PreviewContainer: W, OnboardingWrapper: x, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: i, configStore: o, editorStore: d, previewStore: G, hasChanges: m, isTestPartner: H, saveSilent: h, setLoading: b, emit: n, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: C, cloneTimersOnSave: D, hasTimerBlocks: T, noHeader: $, insertDynamicContent: L, closeDynamicContent: R, handleDynamicContentOpen: f, ribbonObserver: a, updateRibbonOffset: y, startEditor: v, AutoSaveController: oe, Toaster: ne, FilterSelectionDrawer: re, HeaderWrapper: se, LoadingWrapper: ie, SaveAsTemplateDrawer: ae, UnsubscribeWrapper: ce };
|
|
136
145
|
}
|
|
137
146
|
});
|
|
138
147
|
export {
|
|
139
|
-
|
|
148
|
+
xe as default
|
|
140
149
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as u, ref as a, onMounted as p, onBeforeUnmount as l, nextTick as
|
|
2
|
-
import { usePreviewInteractionGuard as
|
|
1
|
+
import { defineComponent as u, ref as a, onMounted as p, onBeforeUnmount as l, nextTick as d } from "vue";
|
|
2
|
+
import { usePreviewInteractionGuard as v } from "../../../../composables/usePreviewInteractionGuard.js";
|
|
3
3
|
import { useTranslations as _ } from "../../../../composables/useTranslations.js";
|
|
4
4
|
import { usePreviewStore as w } from "../../../../stores/preview.js";
|
|
5
5
|
import I from "./DesktopBrowserHeader.vue.js";
|
|
6
6
|
const C = /* @__PURE__ */ u({
|
|
7
7
|
__name: "DesktopPreview",
|
|
8
|
-
setup(
|
|
9
|
-
const i = _(), {
|
|
8
|
+
setup(P) {
|
|
9
|
+
const i = _(), { guardPreviewInteractions: t } = v(), o = a(), r = a(!1), c = w();
|
|
10
10
|
let e = null;
|
|
11
11
|
const f = (m) => {
|
|
12
12
|
t(m.target);
|
|
13
|
-
},
|
|
13
|
+
}, n = () => {
|
|
14
14
|
o.value && (e = new ResizeObserver(() => {
|
|
15
|
-
}), e.observe(o.value),
|
|
16
|
-
|
|
15
|
+
}), e.observe(o.value), d(() => {
|
|
16
|
+
r.value = !0;
|
|
17
17
|
}));
|
|
18
18
|
}, s = () => {
|
|
19
19
|
e == null || e.disconnect();
|
|
20
20
|
};
|
|
21
|
-
return p(
|
|
21
|
+
return p(n), l(s), { __sfc: !0, trans: i, guardPreviewInteractions: t, containerRef: o, isContainerReady: r, previewStore: c, resizeObserver: e, onIframeLoad: f, initIframe: n, cleanIframe: s, DesktopBrowserHeader: I };
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
export {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import e from "./ContentView.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var
|
|
4
|
+
var o = function() {
|
|
5
5
|
var t = this, s = t._self._c, a = t._self._setupProxy;
|
|
6
6
|
return s("div", { staticClass: "w-1 h-1 b-c-4 d-f f-d-c" }, [s("div", { staticClass: "d-f j-c-s-b a-i-c p-2 h-6-s" }, [s("div", { staticClass: "d-f a-i-c cur-p", on: { click: function(l) {
|
|
7
7
|
return t.$emit("back-to-inbox");
|
|
8
8
|
} } }, [s(a.InIcons, { staticClass: "f-s-3 i-c-7", attrs: { name: "line-chevron-left" } }), s("span", { staticClass: "ml-2 f-s-1 f-w-400 l-h-1 t-c-7" }, [t._v(t._s(a.trans("newsletter.inbox")))])], 1), s("div", { staticClass: "d-f a-i-c" }, [s(a.InIcons, { staticClass: "i-c-52", attrs: { name: "line-chevron-down" } }), s(a.InIcons, { staticClass: "ml-1 i-c-52", attrs: { name: "line-chevron-up" } })], 1)]), s("div", { staticClass: "iframe-wrapper f-g-1 o-h" }, [s("iframe", { ref: "iframeRef", staticClass: "iframe-scaled d-b b-c-4 bor-s-n", attrs: { sandbox: "allow-same-origin allow-popups allow-forms allow-scripts allow-popups-to-escape-sandbox", srcdoc: a.previewStore.previewHtml }, on: { load: a.onLoad } })])]);
|
|
9
|
-
},
|
|
9
|
+
}, i = [], r = /* @__PURE__ */ n(
|
|
10
10
|
e,
|
|
11
|
-
c,
|
|
12
11
|
o,
|
|
12
|
+
i,
|
|
13
13
|
!1,
|
|
14
14
|
null,
|
|
15
|
-
"
|
|
15
|
+
"f255b2bb"
|
|
16
16
|
);
|
|
17
|
-
const d =
|
|
17
|
+
const d = r.exports;
|
|
18
18
|
export {
|
|
19
19
|
d as default
|
|
20
20
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as c, ref as a } from "vue";
|
|
2
2
|
import { usePreviewInteractionGuard as f } from "../../../../composables/usePreviewInteractionGuard.js";
|
|
3
3
|
import { useResponsivePreview as p } from "../../../../composables/useResponsivePreview.js";
|
|
4
4
|
import { useTranslations as u } from "../../../../composables/useTranslations.js";
|
|
5
5
|
import { usePreviewStore as v } from "../../../../stores/preview.js";
|
|
6
|
-
import { InIcons as
|
|
7
|
-
const
|
|
6
|
+
import { InIcons as d } from "@useinsider/design-system-vue";
|
|
7
|
+
const b = /* @__PURE__ */ c({
|
|
8
8
|
__name: "ContentView",
|
|
9
9
|
emits: ["back-to-inbox"],
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
10
|
+
setup(P) {
|
|
11
|
+
const m = u(), r = v(), t = a(), { setupResponsivePreview: n } = p(), { guardPreviewInteractions: s } = f(), i = (e) => {
|
|
12
12
|
["transform", "transform-origin", "height"].forEach((o) => {
|
|
13
13
|
e.documentElement.style.removeProperty(o);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
return { __sfc: !0, trans:
|
|
17
|
-
const e =
|
|
18
|
-
o && (n(e), s(e),
|
|
19
|
-
}, InIcons:
|
|
16
|
+
return { __sfc: !0, trans: m, previewStore: r, iframeRef: t, setupResponsivePreview: n, guardPreviewInteractions: s, clearAMPTransforms: i, onLoad: () => {
|
|
17
|
+
const e = t.value, o = e == null ? void 0 : e.contentDocument;
|
|
18
|
+
o && (n(e), s(e), r.isAMPResponsive && i(o));
|
|
19
|
+
}, InIcons: d };
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
b as default
|
|
24
24
|
};
|
|
@@ -1,17 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { URLS as o, MERGE_TAGS as a } from "../enums/unsubscribe.js";
|
|
2
|
+
import { UNSUBSCRIBE_LINK_SELECTOR as i } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
+
import { BASE_SAFE_URL_SCHEMES as u } from "../utils/urlSchemes.js";
|
|
4
|
+
const E = ["click", "auxclick"], d = [
|
|
5
|
+
...Object.values(a),
|
|
6
|
+
o.UNSUBSCRIBE_URL,
|
|
7
|
+
o.PREFERENCES_URL
|
|
8
|
+
], l = (e) => {
|
|
9
|
+
if (e.matches(i))
|
|
10
|
+
return !0;
|
|
11
|
+
const r = e.getAttribute("href") ?? "";
|
|
12
|
+
return d.some((t) => r.includes(t));
|
|
13
|
+
}, S = [...u, "tel:", "sms:"], f = (e) => {
|
|
14
|
+
const r = (e.getAttribute("href") ?? "").trim();
|
|
15
|
+
return r === "" || r.startsWith("#") || r.startsWith("{{") ? !1 : S.includes(e.protocol);
|
|
16
|
+
}, m = (e) => {
|
|
17
|
+
var t, n;
|
|
18
|
+
const r = (n = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : n.call(t, "a");
|
|
19
|
+
if (r) {
|
|
20
|
+
if (l(r) || !f(r)) {
|
|
21
|
+
e.preventDefault(), e.stopPropagation();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer");
|
|
25
|
+
}
|
|
26
|
+
}, R = (e) => {
|
|
27
|
+
e.preventDefault(), e.stopPropagation();
|
|
28
|
+
}, s = /* @__PURE__ */ new WeakSet(), c = "guidoPreviewGuarded", g = () => ({ guardPreviewInteractions: (r) => {
|
|
4
29
|
try {
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
30
|
+
const t = r.contentDocument;
|
|
31
|
+
if (!t || s.has(t))
|
|
7
32
|
return;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
} catch (
|
|
12
|
-
console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:",
|
|
33
|
+
delete t.documentElement.dataset[c], E.forEach((n) => {
|
|
34
|
+
t.addEventListener(n, m, !0);
|
|
35
|
+
}), t.addEventListener("submit", R, !0), s.add(t), t.documentElement.dataset[c] = "true";
|
|
36
|
+
} catch (t) {
|
|
37
|
+
console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", t);
|
|
13
38
|
}
|
|
14
39
|
} });
|
|
15
40
|
export {
|
|
16
|
-
|
|
41
|
+
g as usePreviewInteractionGuard
|
|
17
42
|
};
|