@useinsider/guido 3.8.1-beta.1a5be20 → 3.8.1-beta.34bf80d

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,6 +1,6 @@
1
- import r from "./DesktopPreview.vue2.js";
1
+ import o from "./DesktopPreview.vue2.js";
2
2
  /* empty css */
3
- import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
+ import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var a = function() {
5
5
  var s = this, e = s._self._c, t = s._self._setupProxy;
6
6
  return e("div", { staticClass: "desktop-preview-wrapper" }, [e("p", { staticClass: "f-s-1 f-w-600 l-h-1 t-t-u t-c-53 mb-6 l-s-5" }, [s._v(" " + s._s(t.trans("email-editor.desktop-preview")) + " ")]), e("div", { ref: "containerRef", staticClass: "desktop-preview d-f f-d-c o-h s-1" }, [e(t.DesktopBrowserHeader), e("div", { staticClass: "desktop-preview__content d-f f-g-1 o-h b-c-5 min-h-0" }, [e("div", { staticClass: "f-g-1 h-1 o-h b-c-4 min-w-0" }, [t.isContainerReady ? e("iframe", { staticClass: "desktop-preview__iframe d-b w-1 h-1 b-c-4 bor-s-n", attrs: { sandbox: `
@@ -8,16 +8,16 @@ var a = function() {
8
8
  allow-popups
9
9
  allow-forms
10
10
  allow-scripts
11
- allow-popups-to-escape-sandbox`, srcdoc: t.previewStore.previewHtml } }) : s._e()])])], 1)]);
12
- }, i = [], p = /* @__PURE__ */ o(
13
- r,
11
+ allow-popups-to-escape-sandbox`, srcdoc: t.previewStore.previewHtml }, on: { load: t.onIframeLoad } }) : s._e()])])], 1)]);
12
+ }, i = [], n = /* @__PURE__ */ r(
13
+ o,
14
14
  a,
15
15
  i,
16
16
  !1,
17
17
  null,
18
- "988f8da6"
18
+ "06afaecb"
19
19
  );
20
- const _ = p.exports;
20
+ const f = n.exports;
21
21
  export {
22
- _ as default
22
+ f as default
23
23
  };
@@ -1,23 +1,26 @@
1
- import { defineComponent as f, ref as s, onMounted as c, onBeforeUnmount as m, nextTick as u } from "vue";
2
- import { useTranslations as p } from "../../../../composables/useTranslations.js";
3
- import { usePreviewStore as l } from "../../../../stores/preview.js";
4
- import _ from "./DesktopBrowserHeader.vue.js";
5
- const x = /* @__PURE__ */ f({
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";
3
+ import { useTranslations as _ } from "../../../../composables/useTranslations.js";
4
+ import { usePreviewStore as w } from "../../../../stores/preview.js";
5
+ import I from "./DesktopBrowserHeader.vue.js";
6
+ const C = /* @__PURE__ */ u({
6
7
  __name: "DesktopPreview",
7
- setup(v) {
8
- const a = p(), o = s(), n = s(!1), i = l();
8
+ setup(k) {
9
+ const i = _(), { blockPreviewInteractions: t } = d(), o = a(), n = a(!1), c = w();
9
10
  let e = null;
10
- const t = () => {
11
+ const f = (m) => {
12
+ t(m.target);
13
+ }, r = () => {
11
14
  o.value && (e = new ResizeObserver(() => {
12
- }), e.observe(o.value), u(() => {
15
+ }), e.observe(o.value), v(() => {
13
16
  n.value = !0;
14
17
  }));
15
- }, r = () => {
18
+ }, s = () => {
16
19
  e == null || e.disconnect();
17
20
  };
18
- return c(t), m(r), { __sfc: !0, trans: a, containerRef: o, isContainerReady: n, previewStore: i, resizeObserver: e, initIframe: t, cleanIframe: r, DesktopBrowserHeader: _ };
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 };
19
22
  }
20
23
  });
21
24
  export {
22
- x as default
25
+ C as default
23
26
  };
@@ -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 o = function() {
4
+ var c = 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
- }, i = [], r = /* @__PURE__ */ n(
9
+ }, o = [], i = /* @__PURE__ */ n(
10
10
  e,
11
+ c,
11
12
  o,
12
- i,
13
13
  !1,
14
14
  null,
15
- "e0424e99"
15
+ "cbafc185"
16
16
  );
17
- const d = r.exports;
17
+ const d = i.exports;
18
18
  export {
19
19
  d as default
20
20
  };
@@ -1,23 +1,24 @@
1
- import { defineComponent as m, ref as c } from "vue";
2
- import { useResponsivePreview as f } from "../../../../composables/useResponsivePreview.js";
3
- import { useTranslations as a } from "../../../../composables/useTranslations.js";
4
- import { usePreviewStore as p } from "../../../../stores/preview.js";
5
- import { InIcons as u } from "@useinsider/design-system-vue";
6
- const h = /* @__PURE__ */ m({
1
+ import { defineComponent as m, ref as a } from "vue";
2
+ import { usePreviewInteractionGuard as f } from "../../../../composables/usePreviewInteractionGuard.js";
3
+ import { useResponsivePreview as p } from "../../../../composables/useResponsivePreview.js";
4
+ import { useTranslations as u } from "../../../../composables/useTranslations.js";
5
+ import { usePreviewStore as v } from "../../../../stores/preview.js";
6
+ import { InIcons as P } from "@useinsider/design-system-vue";
7
+ const g = /* @__PURE__ */ m({
7
8
  __name: "ContentView",
8
9
  emits: ["back-to-inbox"],
9
- setup(v) {
10
- const i = a(), t = p(), n = c(), { setupResponsivePreview: r } = f(), s = (o) => {
11
- ["transform", "transform-origin", "height"].forEach((e) => {
12
- o.documentElement.style.removeProperty(e);
10
+ setup(_) {
11
+ const c = u(), t = v(), r = a(), { setupResponsivePreview: n } = p(), { blockPreviewInteractions: s } = f(), i = (e) => {
12
+ ["transform", "transform-origin", "height"].forEach((o) => {
13
+ e.documentElement.style.removeProperty(o);
13
14
  });
14
15
  };
15
- return { __sfc: !0, trans: i, previewStore: t, iframeRef: n, setupResponsivePreview: r, clearAMPTransforms: s, onLoad: () => {
16
- const o = n.value, e = o == null ? void 0 : o.contentDocument;
17
- e && (r(o), t.isAMPResponsive && s(e));
18
- }, InIcons: u };
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 };
19
20
  }
20
21
  });
21
22
  export {
22
- h as default
23
+ g as default
23
24
  };
@@ -1,6 +1,6 @@
1
- import a from "./UnsubscribePageSelection.vue2.js";
1
+ import n from "./UnsubscribePageSelection.vue2.js";
2
2
  /* empty css */
3
- import n from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ import a from "../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var o = function() {
5
5
  var r = this, e = r._self._c, t = r._self._setupProxy;
6
6
  return e(t.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", size: "large", "footer-button-group-options": t.footerButtonGroupOptions, status: t.unsubscribeStore.pageSelectionDrawerStatus, "title-text": t.trans("newsletter.select-a-template") }, on: { cancelOrBackButtonEvent: t.handleBack, onCloseEvent: t.handleClose, primaryButtonEvent: t.handleSave }, scopedSlots: r._u([{ key: "headerBottomSlot", fn: function() {
@@ -10,13 +10,13 @@ var o = function() {
10
10
  return t.selectTemplate(s.id);
11
11
  } } }, [e(t.InContainer, { staticClass: "template-container o-h", class: { selected: t.unsubscribeStore.getSelectedTemplateByActiveType === s.id }, attrs: { border: t.getBorderClass(s.id) } }, [e("div", { staticClass: "w-1 h-1 d-f j-c-c a-i-c" }, [e("img", { staticClass: "w-1 h-1 thumbnail o-h", attrs: { alt: s.name, src: s.thumbnail } })])]), e("div", { staticClass: "mt-1 f-s-1" }, [r._v(" " + r._s(s.name) + " ")])], 1);
12
12
  }), 0)]);
13
- }, i = [], c = /* @__PURE__ */ n(
14
- a,
13
+ }, i = [], c = /* @__PURE__ */ a(
14
+ n,
15
15
  o,
16
16
  i,
17
17
  !1,
18
18
  null,
19
- "f6a8cb4c"
19
+ "669fe7cf"
20
20
  );
21
21
  const _ = c.exports;
22
22
  export {
@@ -1,66 +1,71 @@
1
- import { defineComponent as y, ref as S, computed as a, watch as T } from "vue";
2
- import v from "../../wrappers/WpDrawer.vue.js";
3
- import { useToaster as C } from "../../../composables/useToaster.js";
4
- import { useTranslations as B } from "../../../composables/useTranslations.js";
5
- import { ToasterTypeOptions as w } from "../../../enums/toaster.js";
6
- import { useUnsubscribeStore as h } from "../../../stores/unsubscribe.js";
7
- import { InContainer as U } from "@useinsider/design-system-vue";
8
- import P from "./UnsubscribeBreadcrumb.vue.js";
9
- const L = /* @__PURE__ */ y({
1
+ import { defineComponent as y, ref as T, computed as a, watch as v } from "vue";
2
+ import w from "../../wrappers/WpDrawer.vue.js";
3
+ import { useToaster as B } from "../../../composables/useToaster.js";
4
+ import { useTranslations as C } from "../../../composables/useTranslations.js";
5
+ import { ToasterTypeOptions as h } from "../../../enums/toaster.js";
6
+ import { useEditorStore as P } from "../../../stores/editor.js";
7
+ import { useUnsubscribeStore as U } from "../../../stores/unsubscribe.js";
8
+ import { InContainer as _ } from "@useinsider/design-system-vue";
9
+ import I from "./UnsubscribeBreadcrumb.vue.js";
10
+ const N = /* @__PURE__ */ y({
10
11
  __name: "UnsubscribePageSelection",
11
- setup(_) {
12
- const s = B(), e = h(), { showToaster: r } = C(), o = S(!1), c = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), u = a(() => ({
12
+ setup(x) {
13
+ const s = C(), e = U(), r = P(), { showToaster: c } = B(), o = T(!1), i = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), l = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = a(() => ({
13
14
  primaryButton: {
14
15
  styling: "solid",
15
16
  type: "primary",
16
- labelText: c.value,
17
+ labelText: i.value,
17
18
  loadingStatus: o.value,
18
19
  disabledStatus: !1
19
20
  },
20
21
  cancelOrBackButton: {
21
22
  styling: "ghost",
22
23
  type: "secondary",
23
- labelText: i.value,
24
+ labelText: l.value,
24
25
  disabledStatus: o.value
25
26
  }
26
- })), p = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", n = (t) => {
27
+ })), d = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", n = (t) => {
27
28
  e.pageSelectionDrawerStatus = !1, t && setTimeout(() => {
28
29
  t();
29
30
  }, 500);
30
- }, d = () => {
31
- n(), e.pageSelectionUpdateStatus || document.dispatchEvent(new CustomEvent("unsubscribe:cancel"));
32
31
  }, m = () => {
32
+ n(), e.pageSelectionUpdateStatus || document.dispatchEvent(new CustomEvent("unsubscribe:cancel", {
33
+ detail: { blockId: e.pendingBlockId }
34
+ }));
35
+ }, b = () => {
33
36
  if (e.isActiveTypeFirstInCollection) {
34
37
  n(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
35
38
  return;
36
39
  }
37
40
  e.setPreviousType();
38
- }, b = () => {
39
- if (e.isActiveTypeLastInCollection) {
40
- o.value = !0;
41
- const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t), g = e.getSelectedUnsubscribePagesByCollection(t);
42
- e.removeUnsubscribePages(g), e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
43
- detail: {
44
- collectionType: t,
45
- selectedPages: l
46
- }
47
- })), n(() => {
48
- o.value = !1, r({
49
- type: w.Success,
50
- message: s("global-unsubscribe.pages-were-attached")
41
+ }, f = () => {
42
+ if (!r.isPreviewModeOpen) {
43
+ if (e.isActiveTypeLastInCollection) {
44
+ o.value = !0;
45
+ const t = e.selectedCollectionType, u = e.getSelectedTemplatesByCollection(t), S = e.getSelectedUnsubscribePagesByCollection(t);
46
+ e.removeUnsubscribePages(S), e.addUnsubscribePages(u), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
47
+ detail: {
48
+ collectionType: t,
49
+ selectedPages: u
50
+ }
51
+ })), n(() => {
52
+ o.value = !1, c({
53
+ type: h.Success,
54
+ message: s("global-unsubscribe.pages-were-attached")
55
+ });
51
56
  });
52
- });
53
- return;
57
+ return;
58
+ }
59
+ e.setNextType();
54
60
  }
55
- e.setNextType();
56
- }, f = (t) => {
57
- e.setSelectedTemplate(t);
61
+ }, g = (t) => {
62
+ r.isPreviewModeOpen || e.setSelectedTemplate(t);
58
63
  };
59
- return T(() => e.pageSelectionDrawerStatus, (t) => {
64
+ return v(() => e.pageSelectionDrawerStatus, (t) => {
60
65
  t && e.pageSelectionUpdateStatus && e.fetchTemplates();
61
- }), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: r, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: u, getBorderClass: p, closeModal: n, handleClose: d, handleBack: m, handleSave: b, selectTemplate: f, WpDrawer: v, InContainer: U, UnsubscribeBreadcrumb: P };
66
+ }), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: c, isApplying: o, getPrimaryButtonText: i, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleClose: m, handleBack: b, handleSave: f, selectTemplate: g, WpDrawer: w, InContainer: _, UnsubscribeBreadcrumb: I };
62
67
  }
63
68
  });
64
69
  export {
65
- L as default
70
+ N as default
66
71
  };
@@ -2,15 +2,15 @@ import n from "./UnsubscribeTypeSelection.vue2.js";
2
2
  /* empty css */
3
3
  import o from "../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var i = function() {
5
- var t = this, s = t._self._c, e = t._self._setupProxy;
6
- return s(e.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", "description-text": e.descriptionText, "footer-button-group-options": e.footerButtonGroupOptions, status: e.unsubscribeStore.typeSelectionDrawerStatus, "title-text": e.trans("unsubscription-preference.select-unsubscribe-page-title") }, on: { cancelOrBackButtonEvent: e.closeModal, onCloseEvent: e.closeModal, primaryButtonEvent: e.selectCollection } }, [s(e.InSegments, { staticClass: "w-1", attrs: { "with-icon": "", align: "vertical", disable: e.isSelecting, "segment-list": e.segmentList, selected: e.selectedCollection, "skeleton-sizing": { width: 495, height: 180 }, "skeleton-status": e.skeletonStatus }, on: { click: e.changeCollection } })], 1);
5
+ var e = this, s = e._self._c, t = e._self._setupProxy;
6
+ return s(t.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.unsubscribeStore.typeSelectionDrawerStatus, "title-text": t.trans("unsubscription-preference.select-unsubscribe-page-title") }, on: { cancelOrBackButtonEvent: t.closeModal, onCloseEvent: t.closeModal, primaryButtonEvent: t.selectCollection } }, [s(t.InSegments, { staticClass: "w-1", attrs: { "with-icon": "", align: "vertical", disable: t.isSelecting, "segment-list": t.segmentList, selected: t.selectedCollection, "skeleton-sizing": { width: 495, height: 180 }, "skeleton-status": t.skeletonStatus }, on: { click: t.changeCollection } })], 1);
7
7
  }, r = [], c = /* @__PURE__ */ o(
8
8
  n,
9
9
  i,
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "18e1220a"
13
+ "7a305bb2"
14
14
  );
15
15
  const _ = c.exports;
16
16
  export {
@@ -1,16 +1,16 @@
1
- import { defineComponent as v, ref as b, computed as f, watch as _ } from "vue";
1
+ import { defineComponent as _, ref as b, computed as f, watch as v } from "vue";
2
2
  import U from "../../wrappers/WpDrawer.vue.js";
3
- import { useToaster as N } from "../../../composables/useToaster.js";
4
- import { useTranslations as w } from "../../../composables/useTranslations.js";
3
+ import { useToaster as w } from "../../../composables/useToaster.js";
4
+ import { useTranslations as N } from "../../../composables/useTranslations.js";
5
5
  import { ACADEMY_LINKS as D } from "../../../enums/academy.js";
6
- import { ToasterTypeOptions as P } from "../../../enums/toaster.js";
7
- import { PAGE_TYPES as l, getTypeTranslations as R, UNSUBSCRIBE_PAGES_LINK as G } from "../../../enums/unsubscribe.js";
8
- import { useUnsubscribeStore as I } from "../../../stores/unsubscribe.js";
6
+ import { ToasterTypeOptions as I } from "../../../enums/toaster.js";
7
+ import { PAGE_TYPES as l, getTypeTranslations as R, UNSUBSCRIBE_PAGES_LINK as P } from "../../../enums/unsubscribe.js";
8
+ import { useUnsubscribeStore as G } from "../../../stores/unsubscribe.js";
9
9
  import { InSegments as L } from "@useinsider/design-system-vue";
10
- const W = /* @__PURE__ */ v({
10
+ const W = /* @__PURE__ */ _({
11
11
  __name: "UnsubscribeTypeSelection",
12
- setup(O) {
13
- const t = w(), { showToaster: d } = N(), e = I(), n = b(!1), i = b(!0), o = b(l.GLOBAL_UNSUBSCRIBE), T = t(
12
+ setup(k) {
13
+ const t = N(), { showToaster: d } = w(), e = G(), n = b(!1), o = b(!0), r = b(l.GLOBAL_UNSUBSCRIBE), T = t(
14
14
  "unsubscription-preference.select-unsubscribe-page-description",
15
15
  { action: `<a href="${D.GLOBAL_UNSUBSCRIBE}" target="_blank">${t("ds-rules.visit-academy")}</a>` }
16
16
  ), y = f(() => [
@@ -31,7 +31,7 @@ const W = /* @__PURE__ */ v({
31
31
  disable: e.isSubscriptionPreferencesCenterDisabled,
32
32
  tooltipText: e.isSubscriptionPreferencesCenterDisabled ? t("unsubscription-preference.pref-center-added") : ""
33
33
  }
34
- ]), S = f(
34
+ ]), g = f(
35
35
  () => e.isGlobalUnsubscribeDisabled && e.isSubscriptionPreferencesCenterDisabled
36
36
  ), C = f(() => ({
37
37
  primaryButton: {
@@ -41,8 +41,8 @@ const W = /* @__PURE__ */ v({
41
41
  n.value ? "unsubscription-preference.selecting-type" : "products.select-and-continue"
42
42
  ),
43
43
  loadingStatus: n.value,
44
- disabledStatus: S.value,
45
- skeletonStatus: i.value,
44
+ disabledStatus: g.value,
45
+ skeletonStatus: o.value,
46
46
  skeletonSizing: { width: 168, height: 40 }
47
47
  },
48
48
  cancelOrBackButton: {
@@ -50,59 +50,62 @@ const W = /* @__PURE__ */ v({
50
50
  type: "secondary",
51
51
  labelText: t("products.cancel"),
52
52
  disabledStatus: n.value,
53
- skeletonStatus: i.value,
53
+ skeletonStatus: o.value,
54
54
  skeletonSizing: { width: 78, height: 40 }
55
55
  }
56
- })), m = (s) => {
57
- e.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel")), s && setTimeout(() => {
56
+ })), S = (s) => {
57
+ e.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel", {
58
+ detail: { blockId: e.pendingBlockId }
59
+ })), s && setTimeout(() => {
58
60
  s();
59
61
  }, 500);
60
62
  }, E = (s) => {
61
- o.value = s;
62
- }, g = () => {
63
- const s = e.hasTemplatesByCollectionType, r = [];
64
- if (Object.entries(s).forEach(([c, p]) => {
65
- p || r.push(Number(c));
66
- }), r.length === 0)
63
+ r.value = s;
64
+ }, m = () => {
65
+ const s = e.hasTemplatesByCollectionType, a = [];
66
+ if (Object.entries(s).forEach(([i, p]) => {
67
+ p || a.push(Number(i));
68
+ }), a.length === 0)
67
69
  return !0;
68
- const B = R(), a = r.map((c) => B[c]);
70
+ const h = R(), c = a.map((i) => h[i]);
69
71
  let u = "";
70
- if (r.length === 1)
72
+ if (a.length === 1)
71
73
  u = t("unsubscription-preference.create-page-to-continue", {
72
- page: a[0]
74
+ page: c[0]
73
75
  });
74
- else if (r.length === 2)
76
+ else if (a.length === 2)
75
77
  u = t("unsubscription-preference.create-pages-to-continue", {
76
- page1: a[0],
77
- page2: a[1]
78
+ page1: c[0],
79
+ page2: c[1]
78
80
  });
79
81
  else {
80
- const c = a.pop() ?? "", p = a.join(", ");
82
+ const i = c.pop() ?? "", p = c.join(", ");
81
83
  u = t("unsubscription-preference.create-multiple-pages-to-continue", {
82
84
  pages: p,
83
- lastPage: c
85
+ lastPage: i
84
86
  });
85
87
  }
86
88
  return d({
87
- type: P.Warning,
89
+ type: I.Warning,
88
90
  message: u,
89
91
  actionButton: {
90
92
  text: "Go to Unsubscribe Pages",
91
93
  onClick: () => {
92
- window.location.href = G;
94
+ const i = new URL(P, window.location.origin).href;
95
+ window.open(i, "_blank", "noopener");
93
96
  }
94
97
  }
95
98
  }), !1;
96
- }, h = async () => {
97
- if (n.value = !0, await e.fetchTemplates(), e.setCollection(o.value), !g()) {
98
- n.value = !1, m();
99
+ }, B = async () => {
100
+ if (n.value = !0, await e.fetchTemplates(!0), e.setCollection(r.value), !m()) {
101
+ n.value = !1, S();
99
102
  return;
100
103
  }
101
104
  n.value = !1, e.typeSelectionDrawerStatus = !1, e.pageSelectionDrawerStatus = !0;
102
105
  };
103
- return _(() => e.typeSelectionDrawerStatus, (s) => {
104
- s && (i.value = !0, o.value = l.GLOBAL_UNSUBSCRIBE, e.isGlobalUnsubscribeDisabled && (o.value = e.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), i.value = !1);
105
- }), { __sfc: !0, trans: t, showToaster: d, unsubscribeStore: e, isSelecting: n, skeletonStatus: i, selectedCollection: o, descriptionText: T, segmentList: y, hasNoSelectableType: S, footerButtonGroupOptions: C, closeModal: m, changeCollection: E, validateTemplates: g, selectCollection: h, WpDrawer: U, InSegments: L };
106
+ return v(() => e.typeSelectionDrawerStatus, (s) => {
107
+ s && (o.value = !0, r.value = l.GLOBAL_UNSUBSCRIBE, e.isGlobalUnsubscribeDisabled && (r.value = e.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), o.value = !1);
108
+ }), { __sfc: !0, trans: t, showToaster: d, unsubscribeStore: e, isSelecting: n, skeletonStatus: o, selectedCollection: r, descriptionText: T, segmentList: y, hasNoSelectableType: g, footerButtonGroupOptions: C, closeModal: S, changeCollection: E, validateTemplates: m, selectCollection: B, WpDrawer: U, InSegments: L };
106
109
  }
107
110
  });
108
111
  export {
@@ -0,0 +1,17 @@
1
+ const o = ["click", "auxclick", "submit"], c = (t) => {
2
+ t.preventDefault(), t.stopPropagation();
3
+ }, a = () => ({ blockPreviewInteractions: (r) => {
4
+ try {
5
+ const e = r.contentDocument;
6
+ if (!e)
7
+ 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);
13
+ }
14
+ } });
15
+ export {
16
+ a as usePreviewInteractionGuard
17
+ };
@@ -1,32 +1,32 @@
1
- import { useActionsApi as x } from "./useActionsApi.js";
1
+ import { useActionsApi as H } from "./useActionsApi.js";
2
2
  import { useConfig as y } from "./useConfig.js";
3
- import { useSaveStart as w, useSaveComplete as H } from "./useGuidoActions.js";
3
+ import { useSaveStart as w, useSaveComplete as k } from "./useGuidoActions.js";
4
4
  import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
5
5
  import { useStripoApi as C } from "../services/stripoApi.js";
6
6
  import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as k } from "./useHtmlValidator.js";
7
+ import { useHtmlValidator as B } from "./useHtmlValidator.js";
8
8
  import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
9
  import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
- import { useUnsubscribeBlockValidator as B } from "./validators/useUnsubscribeBlockValidator.js";
11
- const J = () => {
12
- const o = w(), s = H(), { validateHtml: r } = k(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { validateUnsubscribeBlockUniqueness: d } = B(), { callbacks: i, isFeatureEnabled: u } = y(), { extractSyncModuleData: c } = q(), { setSyncModuleUnsubscriptionPages: m } = C(), { editorSave: p } = x();
13
- return { save: async (f = !1, v = !1) => {
10
+ import { useUnsubscribeBlockValidator as U } from "./validators/useUnsubscribeBlockValidator.js";
11
+ const K = () => {
12
+ const o = w(), s = k(), { validateHtml: r } = B(), { validateLiquidSyntax: l } = P(), { validateCouponBlockTags: n } = L(), { validateUnsubscribeBlockUniqueness: d, validateUnsubscribeBlockHasTemplate: c } = U(), { callbacks: i, isFeatureEnabled: u } = y(), { extractSyncModuleData: m } = q(), { setSyncModuleUnsubscriptionPages: p } = C(), { editorSave: v } = H();
13
+ return { save: async (f = !1, S = !1) => {
14
14
  var a;
15
15
  o();
16
- const { prepareTemplateDetails: S } = E(), t = await S();
17
- if (!l(t.compiledHtml) || !d(t.compiledHtml))
16
+ const { prepareTemplateDetails: V } = E(), t = await V();
17
+ if (!n(t.compiledHtml) || !d(t.compiledHtml) || !c(t.compiledHtml))
18
18
  return;
19
19
  if (u("liquidSyntax")) {
20
- if (!await n(t.compiledHtml))
20
+ if (!await l(t.compiledHtml))
21
21
  return;
22
22
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
23
23
  return;
24
- if ((a = i.value) != null && a.externalValidation && !await i.value.externalValidation(t) || !await p())
24
+ if ((a = i.value) != null && a.externalValidation && !await i.value.externalValidation(t) || !await v())
25
25
  return;
26
- const { unsubscribePayload: V, stripoModules: b } = c(t.rawHtml);
27
- return await m(V), t.modules = b, f || s({ ...t, silent: v }), t;
26
+ const { unsubscribePayload: b, stripoModules: x } = m(t.rawHtml);
27
+ return await p(b), t.modules = x, f || s({ ...t, silent: S }), t;
28
28
  } };
29
29
  };
30
30
  export {
31
- J as useSave
31
+ K as useSave
32
32
  };
@@ -1,32 +1,41 @@
1
1
  import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
- import { PAGE_TYPES as n } from "../../enums/unsubscribe.js";
3
- import { UNSUBSCRIBE_BLOCK_SELECTOR as u, DATA_ATTRIBUTES as l } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as T } from "../useToaster.js";
2
+ import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
+ import { useToaster as m } from "../useToaster.js";
5
5
  import { useTranslations as E } from "../useTranslations.js";
6
- const m = [
6
+ const T = [
7
7
  {
8
- pageType: n.GLOBAL_UNSUBSCRIBE,
8
+ pageType: u.GLOBAL_UNSUBSCRIBE,
9
9
  messageKey: "unsubscription-preference.duplicate-global-unsub"
10
10
  },
11
11
  {
12
- pageType: n.SUBSCRIPTION_PREFERENCE_CENTER,
12
+ pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
13
13
  messageKey: "unsubscription-preference.duplicate-pref-center"
14
14
  }
15
- ], g = "unsubscription-preference.duplicate-both", y = () => {
16
- const { showToaster: o } = T(), a = E();
17
- return { validateUnsubscribeBlockUniqueness: (c) => {
18
- const p = new DOMParser().parseFromString(c, "text/html"), t = /* @__PURE__ */ new Map();
19
- p.querySelectorAll(u).forEach((e) => {
20
- const r = Number(e.getAttribute(l.PAGE_TYPE));
21
- t.set(r, (t.get(r) ?? 0) + 1);
15
+ ], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
+ const { showToaster: c } = m(), p = E();
17
+ return { validateUnsubscribeBlockUniqueness: (n) => {
18
+ const o = new DOMParser().parseFromString(n, "text/html"), s = /* @__PURE__ */ new Map();
19
+ o.querySelectorAll(l).forEach((e) => {
20
+ const r = Number(e.getAttribute(a.PAGE_TYPE));
21
+ s.set(r, (s.get(r) ?? 0) + 1);
22
22
  });
23
- const s = m.filter((e) => (t.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
- return s.length ? (o({
23
+ const t = T.filter((e) => (s.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
+ return t.length ? (c({
25
25
  type: i.Alert,
26
- message: a(s.length > 1 ? g : s[0])
26
+ message: p(t.length > 1 ? g : t[0])
27
+ }), !1) : !0;
28
+ }, validateUnsubscribeBlockHasTemplate: (n) => {
29
+ const o = new DOMParser().parseFromString(n, "text/html");
30
+ return Array.from(o.querySelectorAll(l)).some((t) => {
31
+ const e = t.getAttribute(a.PAGE_TYPE), r = t.getAttribute(a.PAGE_LIST);
32
+ return !e || !r;
33
+ }) ? (c({
34
+ type: i.Warning,
35
+ message: p(b)
27
36
  }), !1) : !0;
28
37
  } };
29
38
  };
30
39
  export {
31
- y as useUnsubscribeBlockValidator
40
+ P as useUnsubscribeBlockValidator
32
41
  };
@@ -1,19 +1,20 @@
1
1
  var S = Object.defineProperty;
2
- var L = (c, o, e) => o in c ? S(c, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[o] = e;
3
- var a = (c, o, e) => L(c, typeof o != "symbol" ? o + "" : o, e);
4
- import { useToaster as f } from "../../../composables/useToaster.js";
2
+ var f = (c, o, e) => o in c ? S(c, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[o] = e;
3
+ var a = (c, o, e) => f(c, typeof o != "symbol" ? o + "" : o, e);
4
+ import { useToaster as L } from "../../../composables/useToaster.js";
5
5
  import { ToasterTypeOptions as A } from "../../../enums/toaster.js";
6
6
  import { PAGE_TYPES as h } from "../../../enums/unsubscribe.js";
7
- import { useUnsubscribeStore as u } from "../../../stores/unsubscribe.js";
8
- import { Block as y, BlockCompositionType as T, ContextActionType as k, ModificationDescription as d, BlockType as I } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
- import { getDefaultTemplate as v } from "./template.js";
7
+ import { useEditorStore as y } from "../../../stores/editor.js";
8
+ import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
9
+ import { Block as T, BlockCompositionType as I, ContextActionType as B, ModificationDescription as d, BlockType as v } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
10
+ import { getDefaultTemplate as C } from "./template.js";
10
11
  import { UNSUBSCRIBE_BLOCK_SELECTOR as m, DATA_ATTRIBUTES as n, UNSUBSCRIBE_EVENTS as b } from "./utils/constants.js";
11
- import { parsePageList as B } from "./utils/utils.js";
12
- const C = "unsubscribe-block", E = 'a[data-unsubscribe-link="true"]', N = "{{ins-unsubscribe-link}}", U = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", R = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", D = {
12
+ import { parsePageList as _ } from "./utils/utils.js";
13
+ const N = "unsubscribe-block", E = 'a[data-unsubscribe-link="true"]', U = "{{ins-unsubscribe-link}}", R = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", D = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", w = {
13
14
  [h.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
15
  [h.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
- }, w = 3;
16
- class H extends y {
16
+ }, P = 3;
17
+ class W extends T {
17
18
  constructor() {
18
19
  super();
19
20
  a(this, "selectEventListener", null);
@@ -29,13 +30,13 @@ class H extends y {
29
30
  a(this, "guardAttemptsByBlockId", /* @__PURE__ */ new Map());
30
31
  }
31
32
  getId() {
32
- return C;
33
+ return N;
33
34
  }
34
35
  getIcon() {
35
36
  return "unsubscribe-icon";
36
37
  }
37
38
  getBlockCompositionType() {
38
- return T.BLOCK;
39
+ return I.BLOCK;
39
40
  }
40
41
  getName() {
41
42
  return this.api.translate("Unsubscribe Block");
@@ -44,15 +45,16 @@ class H extends y {
44
45
  return this.api.translate("Unsubscribe Block Description");
45
46
  }
46
47
  getTemplate() {
47
- return v();
48
+ return C();
48
49
  }
49
50
  getContextActionsIds() {
50
- return [k.MOVE, k.REMOVE];
51
+ return [B.MOVE, B.REMOVE];
51
52
  }
52
53
  onSelect(e) {
53
- this.currentNode = e;
54
+ if (this.currentNode = e, y().isPreviewModeOpen)
55
+ return;
54
56
  const t = this._getOrAssignBlockId(e);
55
- t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), this._setupSelectEventListener(), this._setupCancelEventListener(), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._checkExistingBlocks(), this._openDrawer());
57
+ t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), this._setupSelectEventListener(), this._setupCancelEventListener(t), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), t && (l().pendingBlockId = t), this._loadBlockState(e), this._checkExistingBlocks(), this._openDrawer());
56
58
  }
57
59
  onCreated(e) {
58
60
  this._ensureLeadingTextGuard(e);
@@ -107,9 +109,9 @@ class H extends y {
107
109
  const g = this._getOrAssignBlockId(e);
108
110
  if (!g)
109
111
  return;
110
- const _ = this.guardAttemptsByBlockId.get(g) ?? 0;
111
- if (!(_ >= w)) {
112
- this.guardAttemptsByBlockId.set(g, _ + 1);
112
+ const k = this.guardAttemptsByBlockId.get(g) ?? 0;
113
+ if (!(k >= P)) {
114
+ this.guardAttemptsByBlockId.set(g, k + 1);
113
115
  try {
114
116
  this.api.getDocumentModifier().modifyHtml(r).prepend("&nbsp;").apply(new d("Ensure unsubscribe link text guard"));
115
117
  } catch (p) {
@@ -154,8 +156,8 @@ class H extends y {
154
156
  const t = this.api.getDocumentRoot();
155
157
  t && "querySelectorAll" in t && t.querySelectorAll(m).forEach((r) => {
156
158
  if ("getAttribute" in r) {
157
- const i = r.getAttribute(n.BLOCK_ID), l = i ? parseInt(i) : 0;
158
- l > e && (e = l);
159
+ const i = r.getAttribute(n.BLOCK_ID), u = i ? parseInt(i) : 0;
160
+ u > e && (e = u);
159
161
  }
160
162
  });
161
163
  } catch {
@@ -164,14 +166,14 @@ class H extends y {
164
166
  }
165
167
  _warnLinkRemoved() {
166
168
  try {
167
- const { showToaster: e } = f();
169
+ const { showToaster: e } = L();
168
170
  e({
169
171
  type: A.Warning,
170
- message: this.api.translate(R),
172
+ message: this.api.translate(D),
171
173
  actionButton: {
172
174
  text: this.api.translate("Visit Academy"),
173
175
  onClick: () => {
174
- window.open(U, "_blank", "noopener,noreferrer");
176
+ window.open(R, "_blank", "noopener,noreferrer");
175
177
  }
176
178
  }
177
179
  });
@@ -188,9 +190,10 @@ class H extends y {
188
190
  _removeSelectEventListener() {
189
191
  this.selectEventListener && (document.removeEventListener(b.SELECT, this.selectEventListener), this.selectEventListener = null);
190
192
  }
191
- _setupCancelEventListener() {
192
- this._removeCancelEventListener(), this.cancelEventListener = () => {
193
- this._handleCancel();
193
+ _setupCancelEventListener(e) {
194
+ this._removeCancelEventListener(), this.cancelEventListener = (t) => {
195
+ const { detail: s } = t;
196
+ ((s == null ? void 0 : s.blockId) ?? null) === e && this._handleCancel();
194
197
  }, document.addEventListener(b.CANCEL, this.cancelEventListener);
195
198
  }
196
199
  _removeCancelEventListener() {
@@ -200,7 +203,7 @@ class H extends y {
200
203
  try {
201
204
  if (!this.currentNode)
202
205
  return;
203
- this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${I.EMPTY_CONTAINER}/>`).apply(new d("Removed unsubscribe block due to cancel"));
206
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${v.EMPTY_CONTAINER}/>`).apply(new d("Removed unsubscribe block due to cancel"));
204
207
  } catch (e) {
205
208
  console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
206
209
  }
@@ -218,19 +221,19 @@ class H extends y {
218
221
  this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", r).apply(new d(`Updated unsubscribe link to ${r}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(n.PAGE_TYPE, e.toString()).setAttribute(n.PAGE_LIST, t).apply(new d("Updated unsubscribe block metadata"));
219
222
  }
220
223
  _getMergeTag(e) {
221
- return D[e] ?? N;
224
+ return w[e] ?? U;
222
225
  }
223
226
  _openDrawer() {
224
227
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
225
228
  try {
226
- const e = u();
229
+ const e = l();
227
230
  e.typeSelectionDrawerStatus = !0;
228
231
  } catch (e) {
229
232
  console.error("[UnsubscribeBlock] Failed to open drawer:", e);
230
233
  }
231
234
  }
232
235
  _checkExistingBlocks() {
233
- const e = u();
236
+ const e = l();
234
237
  e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(m).forEach((s) => {
235
238
  if ("getAttribute" in s) {
236
239
  const r = s.getAttribute(n.PAGE_TYPE);
@@ -247,11 +250,11 @@ class H extends y {
247
250
  const t = e.getAttribute(n.PAGE_TYPE), s = e.getAttribute(n.PAGE_LIST);
248
251
  if (!t || !s)
249
252
  return;
250
- const r = u(), i = Number(t), l = B(s);
251
- await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(i), r.loadSelectedTemplates(l);
253
+ const r = l(), i = Number(t), u = _(s);
254
+ await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(i), r.loadSelectedTemplates(u);
252
255
  }
253
256
  _resetStoreState() {
254
- u().$reset();
257
+ l().$reset();
255
258
  }
256
259
  _removeBlockTemplatesFromStore(e) {
257
260
  if (!("getAttribute" in e))
@@ -259,11 +262,11 @@ class H extends y {
259
262
  const t = e.getAttribute(n.PAGE_LIST);
260
263
  if (!t)
261
264
  return;
262
- const s = u(), r = B(t);
265
+ const s = l(), r = _(t);
263
266
  s.removeUnsubscribePages(r);
264
267
  }
265
268
  }
266
269
  export {
267
- C as UNSUBSCRIBE_BLOCK_ID,
268
- H as UnsubscribeBlock
270
+ N as UNSUBSCRIBE_BLOCK_ID,
271
+ W as UnsubscribeBlock
269
272
  };
@@ -1,18 +1,19 @@
1
1
  var T = Object.defineProperty;
2
- var p = (o, s, e) => s in o ? T(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e;
3
- var c = (o, s, e) => p(o, typeof s != "symbol" ? s + "" : s, e);
2
+ var p = (a, s, e) => s in a ? T(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
3
+ var c = (a, s, e) => p(a, typeof s != "symbol" ? s + "" : s, e);
4
+ import { useEditorStore as _ } from "../../../stores/editor.js";
4
5
  import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
5
- import { Control as _, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { Control as g, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
7
  import { DATA_ATTRIBUTES as d } from "./utils/constants.js";
7
8
  import { parsePageList as h } from "./utils/utils.js";
8
- const g = "ui-elements-unsubscribe", r = {
9
+ const v = "ui-elements-unsubscribe", r = {
9
10
  SELECT_BUTTON: "selectTemplateButton",
10
11
  PREV_BUTTON: "prevButton",
11
12
  NEXT_BUTTON: "nextButton",
12
13
  COUNTER_TEXT: "counterText",
13
14
  PREVIEW_IMAGE: "previewImage"
14
15
  };
15
- class B extends _ {
16
+ class w extends g {
16
17
  constructor() {
17
18
  super(...arguments);
18
19
  c(this, "currentPreviewIndex", 0);
@@ -22,7 +23,7 @@ class B extends _ {
22
23
  c(this, "lastParsedAttribute");
23
24
  }
24
25
  getId() {
25
- return g;
26
+ return v;
26
27
  }
27
28
  getTemplate() {
28
29
  return `
@@ -59,10 +60,12 @@ class B extends _ {
59
60
  this.api.onValueChanged(r.NEXT_BUTTON, () => this._onNextClick())
60
61
  );
61
62
  }
62
- _onButtonClick() {
63
+ async _onButtonClick() {
63
64
  try {
65
+ if (_().isPreviewModeOpen)
66
+ return;
64
67
  const e = l();
65
- this._reseedSelectionFromBlock(), e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
68
+ await e.fetchTemplates(!0), this._reseedSelectionFromBlock(), e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
66
69
  } catch (e) {
67
70
  console.error("[UnsubscribeControl] Failed to open drawer:", e);
68
71
  }
@@ -71,8 +74,8 @@ class B extends _ {
71
74
  const e = l();
72
75
  if (e.$reset(), !this.currentNode || !("getAttribute" in this.currentNode))
73
76
  return;
74
- const t = this.currentNode.getAttribute(d.PAGE_TYPE), a = this.currentNode.getAttribute(d.PAGE_LIST);
75
- !t || !a || (e.setCollectionWithoutAutoSelection(Number(t)), e.loadSelectedTemplates(h(a)));
77
+ const t = this.currentNode.getAttribute(d.PAGE_TYPE), o = this.currentNode.getAttribute(d.PAGE_LIST);
78
+ !t || !o || (e.setCollectionWithoutAutoSelection(Number(t)), e.loadSelectedTemplates(h(o)));
76
79
  }
77
80
  _onPrevClick() {
78
81
  this.currentPreviewIndex > 0 && (this.currentPreviewIndex--, this._updatePreview(), this._updateCounter());
@@ -100,8 +103,8 @@ class B extends _ {
100
103
  }
101
104
  }
102
105
  _updateCounter() {
103
- const e = this.currentPreviewIndex + 1, t = this.totalTemplates, a = this.currentPreviewIndex === 0, u = this.currentPreviewIndex >= t - 1;
104
- this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, a), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, u), this.api.setUIEAttribute(
106
+ const e = this.currentPreviewIndex + 1, t = this.totalTemplates, o = this.currentPreviewIndex === 0, u = this.currentPreviewIndex >= t - 1;
107
+ this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, o), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, u), this.api.setUIEAttribute(
105
108
  r.COUNTER_TEXT,
106
109
  i.LABEL.text,
107
110
  `${this.api.translate("Showing")} ${e} ${this.api.translate("of")} ${t}`
@@ -142,8 +145,8 @@ class B extends _ {
142
145
  </${n.LABEL}>
143
146
  `;
144
147
  }
145
- _getIconButton(e, t, a) {
146
- const u = a ? `${i.BUTTON.disabled}="true"` : "";
148
+ _getIconButton(e, t, o) {
149
+ const u = o ? `${i.BUTTON.disabled}="true"` : "";
147
150
  return `
148
151
  <${n.BUTTON}
149
152
  id="${e}"
@@ -172,6 +175,6 @@ class B extends _ {
172
175
  }
173
176
  }
174
177
  export {
175
- g as UNSUBSCRIBE_CONTROL_ID,
176
- B as UnsubscribeControl
178
+ v as UNSUBSCRIBE_CONTROL_ID,
179
+ w as UnsubscribeControl
177
180
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-f6a8cb4c]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-f6a8cb4c]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-f6a8cb4c]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-f6a8cb4c]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-f6a8cb4c]{object-fit:cover;transform:scale(1)}[data-v-18e1220a] .guido__verion-history-view-option-selection-desktop svg,[data-v-18e1220a] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-18e1220a] .in-segments-wrapper__button_selected,[data-v-18e1220a] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-669fe7cf]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-669fe7cf]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-669fe7cf]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-669fe7cf]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-669fe7cf]{object-fit:cover;transform:scale(1)}[data-v-7a305bb2] .guido__verion-history-view-option-selection-desktop svg,[data-v-7a305bb2] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-7a305bb2] .in-segments-wrapper__button_selected,[data-v-7a305bb2] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-06afaecb]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-06afaecb]{min-height:504px}.iframe-wrapper[data-v-cbafc185]{width:258px}.iframe-scaled[data-v-cbafc185]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
@@ -0,0 +1,3 @@
1
+ export declare const usePreviewInteractionGuard: () => {
2
+ blockPreviewInteractions: (iframe: HTMLIFrameElement) => void;
3
+ };
@@ -1,3 +1,4 @@
1
1
  export declare const useUnsubscribeBlockValidator: () => {
2
2
  validateUnsubscribeBlockUniqueness: (html: string) => boolean;
3
+ validateUnsubscribeBlockHasTemplate: (html: string) => boolean;
3
4
  };
@@ -10,6 +10,7 @@ interface StoreState {
10
10
  typeSelectionDrawerStatus: boolean;
11
11
  isGlobalUnsubscribeDisabled: boolean;
12
12
  isSubscriptionPreferencesCenterDisabled: boolean;
13
+ pendingBlockId: string | null;
13
14
  }
14
15
  export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guidoUnsubscribe", StoreState, {
15
16
  getSelectedCollection: (state: {
@@ -35,6 +36,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
35
36
  typeSelectionDrawerStatus: boolean;
36
37
  isGlobalUnsubscribeDisabled: boolean;
37
38
  isSubscriptionPreferencesCenterDisabled: boolean;
39
+ pendingBlockId: string | null;
38
40
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => number[];
39
41
  getSelectedTemplateByActiveType: (state: {
40
42
  templates: {
@@ -59,6 +61,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
59
61
  typeSelectionDrawerStatus: boolean;
60
62
  isGlobalUnsubscribeDisabled: boolean;
61
63
  isSubscriptionPreferencesCenterDisabled: boolean;
64
+ pendingBlockId: string | null;
62
65
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => number;
63
66
  getTemplatesByActiveType: (state: {
64
67
  templates: {
@@ -83,6 +86,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
83
86
  typeSelectionDrawerStatus: boolean;
84
87
  isGlobalUnsubscribeDisabled: boolean;
85
88
  isSubscriptionPreferencesCenterDisabled: boolean;
89
+ pendingBlockId: string | null;
86
90
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
87
91
  id: number;
88
92
  name: string;
@@ -119,6 +123,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
119
123
  typeSelectionDrawerStatus: boolean;
120
124
  isGlobalUnsubscribeDisabled: boolean;
121
125
  isSubscriptionPreferencesCenterDisabled: boolean;
126
+ pendingBlockId: string | null;
122
127
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => (id: number) => string;
123
128
  getSelectedUnsubscribePagesByCollection: (state: {
124
129
  templates: {
@@ -143,6 +148,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
143
148
  typeSelectionDrawerStatus: boolean;
144
149
  isGlobalUnsubscribeDisabled: boolean;
145
150
  isSubscriptionPreferencesCenterDisabled: boolean;
151
+ pendingBlockId: string | null;
146
152
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => (collectionType: number) => number[];
147
153
  isActiveTypeFirstInCollection: (state: {
148
154
  templates: {
@@ -167,6 +173,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
167
173
  typeSelectionDrawerStatus: boolean;
168
174
  isGlobalUnsubscribeDisabled: boolean;
169
175
  isSubscriptionPreferencesCenterDisabled: boolean;
176
+ pendingBlockId: string | null;
170
177
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
171
178
  isActiveTypeLastInCollection: (state: {
172
179
  templates: {
@@ -191,6 +198,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
191
198
  typeSelectionDrawerStatus: boolean;
192
199
  isGlobalUnsubscribeDisabled: boolean;
193
200
  isSubscriptionPreferencesCenterDisabled: boolean;
201
+ pendingBlockId: string | null;
194
202
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
195
203
  hasTemplatesByCollectionType: (state: {
196
204
  templates: {
@@ -215,6 +223,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
215
223
  typeSelectionDrawerStatus: boolean;
216
224
  isGlobalUnsubscribeDisabled: boolean;
217
225
  isSubscriptionPreferencesCenterDisabled: boolean;
226
+ pendingBlockId: string | null;
218
227
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => Record<number, boolean>;
219
228
  unsubscribePagesStatus: (state: {
220
229
  templates: {
@@ -239,10 +248,11 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
239
248
  typeSelectionDrawerStatus: boolean;
240
249
  isGlobalUnsubscribeDisabled: boolean;
241
250
  isSubscriptionPreferencesCenterDisabled: boolean;
251
+ pendingBlockId: string | null;
242
252
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
243
253
  }, {
244
254
  $reset(): void;
245
- fetchTemplates(): Promise<void>;
255
+ fetchTemplates(force?: boolean): Promise<void>;
246
256
  setCollection(collectionType: number): void;
247
257
  setCollectionWithoutAutoSelection(collectionType: number): void;
248
258
  setSelectedTemplate(template: number): void;
@@ -1,6 +1,6 @@
1
1
  import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
2
2
  import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
- import { defineStore as h } from "pinia";
3
+ import { defineStore as u } from "pinia";
4
4
  let o = null;
5
5
  const r = () => ({
6
6
  templates: [],
@@ -12,8 +12,9 @@ const r = () => ({
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
- isSubscriptionPreferencesCenterDisabled: !1
16
- }), b = h("guidoUnsubscribe", {
15
+ isSubscriptionPreferencesCenterDisabled: !1,
16
+ pendingBlockId: null
17
+ }), b = u("guidoUnsubscribe", {
17
18
  state: () => r(),
18
19
  getters: {
19
20
  getSelectedCollection: (e) => i[e.selectedCollectionType],
@@ -62,10 +63,10 @@ const r = () => ({
62
63
  selectedUnsubscribePages: t
63
64
  });
64
65
  },
65
- async fetchTemplates() {
66
- this.templates.length || (o || (o = (async () => {
67
- const { getUnsubscribePages: e } = d();
68
- this.templates = await e();
66
+ async fetchTemplates(e = !1) {
67
+ !e && this.templates.length || ((e || !o) && (o = (async () => {
68
+ const { getUnsubscribePages: t } = d();
69
+ this.templates = await t();
69
70
  })().finally(() => {
70
71
  o = null;
71
72
  })), await o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.8.1-beta.1a5be20",
3
+ "version": "3.8.1-beta.34bf80d",
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",