@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.
Files changed (32) hide show
  1. package/README.md +2 -14
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +110 -101
  4. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +1 -1
  5. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +8 -8
  6. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  7. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +10 -10
  8. package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
  9. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
  10. package/dist/composables/usePreviewInteractionGuard.js +36 -11
  11. package/dist/composables/useRecommendationPreview.js +61 -60
  12. package/dist/composables/useStripo.js +72 -69
  13. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  14. package/dist/extensions/Blocks/Recommendation/controls/blockBackground/index.js +10 -0
  15. package/dist/extensions/Blocks/Recommendation/extension.js +23 -21
  16. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +41 -40
  17. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +3 -2
  18. package/dist/extensions/Blocks/controlFactories.js +125 -75
  19. package/dist/guido.css +1 -1
  20. package/dist/src/components/Guido.vue.d.ts +18 -2
  21. package/dist/src/composables/usePreviewInteractionGuard.d.ts +1 -1
  22. package/dist/src/composables/useStripo.d.ts +3 -2
  23. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  24. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +14 -0
  25. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  26. package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
  27. package/dist/src/extensions/Blocks/controlFactories.d.ts +36 -0
  28. package/dist/src/stores/config.d.ts +3 -1
  29. package/dist/src/utils/urlSchemes.d.ts +6 -0
  30. package/dist/stores/config.js +21 -19
  31. package/dist/utils/urlSchemes.js +4 -0
  32. 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
- Guido declares these as peer dependencies — install them yourself, it does not
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', '@useinsider/design-system-vue'],
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
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "50dac6de"
15
+ "daf7d5f8"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,140 +1,149 @@
1
- import { defineComponent as X, defineAsyncComponent as I, ref as W, computed as x, watch as Y, onMounted as Z, onUnmounted as ee } from "vue";
2
- import { useCortexBlueprintBridge as oe } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as te } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as ne } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as re } from "../composables/usePartner.js";
6
- import { useStripo as se } from "../composables/useStripo.js";
7
- import { useTimerClone as ae } from "../composables/useTimerClone.js";
8
- import { migrate as G } from "../config/migrator/index.js";
9
- import { ModuleFolderDefaults as H } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as ce } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as ie } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import me from "./organisms/AutoSaveController.vue.js";
13
- import de from "./organisms/base/Toaster.vue.js";
14
- import le from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import ue from "./organisms/header/HeaderWrapper.vue.js";
16
- import pe from "./organisms/LoadingWrapper.vue.js";
17
- import fe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import ve from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as Se } from "../services/stripoApi.js";
20
- import { useConfigStore as ye } from "../stores/config.js";
21
- import { useDynamicContentStore as he } from "../stores/dynamic-content.js";
22
- import { useEditorStore as $ } from "../stores/editor.js";
23
- import { usePreviewStore as ge } from "../stores/preview.js";
24
- import { useTemplateStore as be } from "../stores/template.js";
25
- import { useUnsubscribeStore as Ee } from "../stores/unsubscribe.js";
26
- const Ve = /* @__PURE__ */ X({
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(z, { expose: q, emit: n }) {
33
- const b = z, K = I(
33
+ setup(P, { expose: A, emit: n }) {
34
+ const i = P, W = M(
34
35
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
35
- ), V = I(
36
+ ), x = M(
36
37
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
37
- ), E = W(), p = W(), f = he(), w = Ee(), i = ye();
38
- i.init(b.config);
39
- const m = $(), j = ge(), d = x(() => m.hasChanges), { isTestPartner: J } = re(), D = () => {
40
- var e;
41
- return (e = E.value) == null ? void 0 : e.handleSave(!0);
42
- }, C = (e) => {
43
- m.loadingStatus = e;
44
- }, {
45
- templateId: v,
46
- userId: T,
47
- partnerName: L,
48
- username: k,
49
- template: o,
50
- editor: s
51
- } = i, l = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", S = (o == null ? void 0 : o.preselectedDynamicContent) || [], U = (s == null ? void 0 : s.savedModulesFolderName) || H.SAVED_MODULES, _ = (s == null ? void 0 : s.defaultModulesFolderName) || H.DEFAULT_MODULES;
52
- oe(), ne();
53
- const y = {
54
- emailId: v,
55
- userId: T,
56
- username: k,
57
- partnerName: L,
58
- savedModulesFolderName: U,
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
- te({
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: (e) => {
77
- const t = { ...e, metadata: y };
78
- console.debug("guido:save:complete", t), n("save:complete", t);
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 B = (e) => {
85
- console.debug("dynamic-content:close", e), f.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
86
- }, N = () => {
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
- Y(() => d.value, () => {
90
- n("on-change", d.value);
81
+ B(() => m.value, () => {
82
+ n("on-change", m.value);
91
83
  });
92
- const h = (e) => {
93
- const t = e, { attribute: u, position: c } = t.detail;
94
- console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", u, c);
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 g = () => {
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
- w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
109
- const c = ((u = o == null ? void 0 : o.migration) == null ? void 0 : u.recommendationConfigs) ?? {};
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: l && await G(l, c),
112
- css: F
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
- r.html || (r = await P(), r.html = await G(r.html, c)), A(r.html) && (r.html = await R(r.html)), await O(r), f.selectedDynamicContentList = S;
115
- } catch (c) {
116
- console.error("Failed to initialize Stripo editor:", c);
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", h);
119
- }), ee(() => {
120
- a == null || a.disconnect(), document.removeEventListener("dynamic-content:open", h);
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
- i.reset();
127
- }), q({
135
+ o.reset();
136
+ }), A({
128
137
  dynamicContent: {
129
- insert: B,
130
- close: N
138
+ insert: L,
139
+ close: R
131
140
  },
132
- hasChanges: d,
133
- saveSilent: D,
134
- setLoading: C
135
- }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: b, configStore: i, editorStore: m, previewStore: j, hasChanges: d, isTestPartner: J, saveSilent: D, setLoading: C, templateId: v, userId: T, partnerName: L, username: k, templateConfig: o, editorConfig: s, html: l, css: F, preselectedDynamicContentList: S, savedModulesFolderName: U, defaultModulesFolderName: _, emit: n, metadata: y, options: M, initPlugin: O, getDefaultTemplate: P, cloneTimersOnSave: R, hasTimerBlocks: A, noHeader: Q, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: h, ribbonObserver: a, updateRibbonOffset: g, AutoSaveController: me, Toaster: de, FilterSelectionDrawer: le, HeaderWrapper: ue, LoadingWrapper: pe, SaveAsTemplateDrawer: fe, UnsubscribeWrapper: ve };
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
- Ve as default
148
+ xe as default
140
149
  };
@@ -15,7 +15,7 @@ var a = function() {
15
15
  i,
16
16
  !1,
17
17
  null,
18
- "06afaecb"
18
+ "cf946232"
19
19
  );
20
20
  const f = n.exports;
21
21
  export {
@@ -1,24 +1,24 @@
1
- import { defineComponent as u, ref as a, onMounted as p, onBeforeUnmount as l, nextTick as v } from "vue";
2
- import { usePreviewInteractionGuard as d } from "../../../../composables/usePreviewInteractionGuard.js";
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(k) {
9
- const i = _(), { blockPreviewInteractions: t } = d(), o = a(), n = a(!1), c = w();
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
- }, r = () => {
13
+ }, n = () => {
14
14
  o.value && (e = new ResizeObserver(() => {
15
- }), e.observe(o.value), v(() => {
16
- n.value = !0;
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(r), l(s), { __sfc: !0, trans: i, blockPreviewInteractions: t, containerRef: o, isContainerReady: n, previewStore: c, resizeObserver: e, onIframeLoad: f, initIframe: r, cleanIframe: s, DesktopBrowserHeader: I };
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 c = function() {
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
- }, o = [], i = /* @__PURE__ */ n(
9
+ }, i = [], r = /* @__PURE__ */ n(
10
10
  e,
11
- c,
12
11
  o,
12
+ i,
13
13
  !1,
14
14
  null,
15
- "cbafc185"
15
+ "f255b2bb"
16
16
  );
17
- const d = i.exports;
17
+ const d = r.exports;
18
18
  export {
19
19
  d as default
20
20
  };
@@ -1,24 +1,24 @@
1
- import { defineComponent as m, ref as a } from "vue";
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 P } from "@useinsider/design-system-vue";
7
- const g = /* @__PURE__ */ m({
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 c = u(), t = v(), r = a(), { setupResponsivePreview: n } = p(), { blockPreviewInteractions: s } = f(), i = (e) => {
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: c, previewStore: t, iframeRef: r, setupResponsivePreview: n, blockPreviewInteractions: s, clearAMPTransforms: i, onLoad: () => {
17
- const e = r.value, o = e == null ? void 0 : e.contentDocument;
18
- o && (n(e), s(e), t.isAMPResponsive && i(o));
19
- }, InIcons: P };
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
- g as default
23
+ b as default
24
24
  };
@@ -10,9 +10,9 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "10599c37"
13
+ "195ab6d4"
14
14
  );
15
- const d = a.exports;
15
+ const c = a.exports;
16
16
  export {
17
- d as default
17
+ c as default
18
18
  };
@@ -10,7 +10,7 @@ var n = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "38eb0a73"
13
+ "d405ca59"
14
14
  );
15
15
  const d = a.exports;
16
16
  export {
@@ -1,17 +1,42 @@
1
- const o = ["click", "auxclick", "submit"], c = (t) => {
2
- t.preventDefault(), t.stopPropagation();
3
- }, a = () => ({ blockPreviewInteractions: (r) => {
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 e = r.contentDocument;
6
- if (!e)
30
+ const t = r.contentDocument;
31
+ if (!t || s.has(t))
7
32
  return;
8
- o.forEach((n) => {
9
- e.addEventListener(n, c, !0);
10
- });
11
- } catch (e) {
12
- console.warn("[usePreviewInteractionGuard] Could not guard preview iframe:", e);
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
- a as usePreviewInteractionGuard
41
+ g as usePreviewInteractionGuard
17
42
  };