@useinsider/guido 3.7.2-beta.d7d2e30 → 3.7.2-beta.e9ee855

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 (23) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
  2. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
  3. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  4. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +4 -4
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +38 -35
  7. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
  8. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +54 -51
  9. package/dist/composables/usePreviewInteractionGuard.js +17 -0
  10. package/dist/composables/useSave.js +14 -14
  11. package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
  12. package/dist/extensions/Blocks/Items/block.js +29 -48
  13. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +45 -62
  14. package/dist/extensions/Blocks/Unsubscribe/block.js +40 -37
  15. package/dist/extensions/Blocks/Unsubscribe/control.js +17 -14
  16. package/dist/guido.css +1 -1
  17. package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
  18. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
  19. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -8
  20. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  21. package/dist/src/stores/unsubscribe.d.ts +11 -1
  22. package/dist/stores/unsubscribe.js +8 -7
  23. package/package.json +1 -1
@@ -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
  };
@@ -10,15 +10,15 @@ 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(
13
+ }, c = [], i = /* @__PURE__ */ n(
14
14
  a,
15
15
  o,
16
- i,
16
+ c,
17
17
  !1,
18
18
  null,
19
- "f6a8cb4c"
19
+ "ec5c2ac6"
20
20
  );
21
- const _ = c.exports;
21
+ const _ = i.exports;
22
22
  export {
23
23
  _ as default
24
24
  };
@@ -1,66 +1,69 @@
1
- import { defineComponent as y, ref as S, computed as a, watch as T } from "vue";
2
- import v from "../../wrappers/WpDrawer.vue.js";
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
3
  import { useToaster as C } from "../../../composables/useToaster.js";
4
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({
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 x 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(A) {
13
+ const s = B(), e = U(), r = P(), { showToaster: c } = C(), 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
+ }, b = () => {
33
34
  if (e.isActiveTypeFirstInCollection) {
34
35
  n(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
35
36
  return;
36
37
  }
37
38
  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")
39
+ }, f = () => {
40
+ if (!r.isPreviewModeOpen) {
41
+ if (e.isActiveTypeLastInCollection) {
42
+ o.value = !0;
43
+ const t = e.selectedCollectionType, u = e.getSelectedTemplatesByCollection(t), S = e.getSelectedUnsubscribePagesByCollection(t);
44
+ e.removeUnsubscribePages(S), e.addUnsubscribePages(u), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
45
+ detail: {
46
+ collectionType: t,
47
+ selectedPages: u
48
+ }
49
+ })), n(() => {
50
+ o.value = !1, c({
51
+ type: h.Success,
52
+ message: s("global-unsubscribe.pages-were-attached")
53
+ });
51
54
  });
52
- });
53
- return;
55
+ return;
56
+ }
57
+ e.setNextType();
54
58
  }
55
- e.setNextType();
56
- }, f = (t) => {
57
- e.setSelectedTemplate(t);
59
+ }, g = (t) => {
60
+ r.isPreviewModeOpen || e.setSelectedTemplate(t);
58
61
  };
59
- return T(() => e.pageSelectionDrawerStatus, (t) => {
62
+ return v(() => e.pageSelectionDrawerStatus, (t) => {
60
63
  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 };
64
+ }), { __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: x };
62
65
  }
63
66
  });
64
67
  export {
65
- L as default
68
+ N as default
66
69
  };
@@ -10,7 +10,7 @@ var i = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "43c617a7"
13
+ "811cff80"
14
14
  );
15
15
  const _ = c.exports;
16
16
  export {
@@ -1,106 +1,109 @@
1
- import { defineComponent as h, ref as b, computed as g, watch as _ } from "vue";
1
+ import { defineComponent as _, ref as b, computed as m, watch as h } from "vue";
2
2
  import v from "../../wrappers/WpDrawer.vue.js";
3
3
  import { useToaster as U } from "../../../composables/useToaster.js";
4
- import { useTranslations as N } from "../../../composables/useTranslations.js";
5
- import { ACADEMY_LINKS as w } from "../../../enums/academy.js";
6
- import { ToasterTypeOptions as R } from "../../../enums/toaster.js";
7
- import { PAGE_TYPES as l, getTypeTranslations as D, UNSUBSCRIBE_PAGES_LINK as I } from "../../../enums/unsubscribe.js";
8
- import { useUnsubscribeStore as P } from "../../../stores/unsubscribe.js";
9
- import { InSegments as G } from "@useinsider/design-system-vue";
10
- const V = /* @__PURE__ */ h({
4
+ import { useTranslations as w } from "../../../composables/useTranslations.js";
5
+ import { ACADEMY_LINKS as N } from "../../../enums/academy.js";
6
+ import { ToasterTypeOptions as I } from "../../../enums/toaster.js";
7
+ import { PAGE_TYPES as l, getTypeTranslations as R, UNSUBSCRIBE_PAGES_LINK as D } from "../../../enums/unsubscribe.js";
8
+ import { useUnsubscribeStore as L } from "../../../stores/unsubscribe.js";
9
+ import { InSegments as P } from "@useinsider/design-system-vue";
10
+ const V = /* @__PURE__ */ _({
11
11
  __name: "UnsubscribeTypeSelection",
12
- setup(L) {
13
- const e = N(), { showToaster: f } = U(), t = P(), n = b(!1), i = b(!0), o = b(l.GLOBAL_UNSUBSCRIBE), S = e(
12
+ setup(G) {
13
+ const t = w(), { showToaster: f } = U(), e = L(), n = b(!1), o = b(!0), r = b(l.GLOBAL_UNSUBSCRIBE), S = t(
14
14
  "unsubscription-preference.select-unsubscribe-page-description",
15
- { action: `<a href="${w.GLOBAL_UNSUBSCRIBE}" target="_blank">${e("ds-rules.visit-academy")}</a>` }
16
- ), T = g(() => [
15
+ { action: `<a href="${N.GLOBAL_UNSUBSCRIBE}" target="_blank">${t("ds-rules.visit-academy")}</a>` }
16
+ ), T = m(() => [
17
17
  {
18
- description: e("unsubscription-preference.type-global-unsubscribe-description"),
18
+ description: t("unsubscription-preference.type-global-unsubscribe-description"),
19
19
  icon: "line-contact-global-unsub-page",
20
- text: e("unsubscription-preference.type-global-unsubscribe"),
20
+ text: t("unsubscription-preference.type-global-unsubscribe"),
21
21
  value: l.GLOBAL_UNSUBSCRIBE,
22
- disable: t.isGlobalUnsubscribeDisabled,
22
+ disable: e.isGlobalUnsubscribeDisabled,
23
23
  position: "bottom",
24
- tooltipText: t.isGlobalUnsubscribeDisabled ? e("unsubscription-preference.global-unsub-added") : ""
24
+ tooltipText: e.isGlobalUnsubscribeDisabled ? t("unsubscription-preference.global-unsub-added") : ""
25
25
  },
26
26
  {
27
- description: e("unsubscription-preference.type-subscription-preferences-center-description"),
27
+ description: t("unsubscription-preference.type-subscription-preferences-center-description"),
28
28
  icon: "line-contact-sub-pref-center-page",
29
- text: e("unsubscription-preference.type-subscription-preferences-center"),
29
+ text: t("unsubscription-preference.type-subscription-preferences-center"),
30
30
  value: l.SUBSCRIPTION_PREFERENCE_CENTER,
31
- disable: t.isSubscriptionPreferencesCenterDisabled,
32
- tooltipText: t.isSubscriptionPreferencesCenterDisabled ? e("unsubscription-preference.pref-center-added") : ""
31
+ disable: e.isSubscriptionPreferencesCenterDisabled,
32
+ tooltipText: e.isSubscriptionPreferencesCenterDisabled ? t("unsubscription-preference.pref-center-added") : ""
33
33
  }
34
- ]), y = g(() => ({
34
+ ]), y = m(() => ({
35
35
  primaryButton: {
36
36
  styling: "solid",
37
37
  type: "primary",
38
- labelText: e(
38
+ labelText: t(
39
39
  n.value ? "unsubscription-preference.selecting-type" : "products.select-and-continue"
40
40
  ),
41
41
  loadingStatus: n.value,
42
42
  disabledStatus: !1,
43
- skeletonStatus: i.value,
43
+ skeletonStatus: o.value,
44
44
  skeletonSizing: { width: 168, height: 40 }
45
45
  },
46
46
  cancelOrBackButton: {
47
47
  styling: "ghost",
48
48
  type: "secondary",
49
- labelText: e("products.cancel"),
49
+ labelText: t("products.cancel"),
50
50
  disabledStatus: n.value,
51
- skeletonStatus: i.value,
51
+ skeletonStatus: o.value,
52
52
  skeletonSizing: { width: 78, height: 40 }
53
53
  }
54
54
  })), d = (s) => {
55
- t.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel")), s && setTimeout(() => {
55
+ e.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel", {
56
+ detail: { blockId: e.pendingBlockId }
57
+ })), s && setTimeout(() => {
56
58
  s();
57
59
  }, 500);
58
60
  }, E = (s) => {
59
- o.value = s;
60
- }, m = () => {
61
- const s = t.hasTemplatesByCollectionType, r = [];
62
- if (Object.entries(s).forEach(([c, p]) => {
63
- p || r.push(Number(c));
64
- }), r.length === 0)
61
+ r.value = s;
62
+ }, g = () => {
63
+ const s = e.hasTemplatesByCollectionType, a = [];
64
+ if (Object.entries(s).forEach(([i, p]) => {
65
+ p || a.push(Number(i));
66
+ }), a.length === 0)
65
67
  return !0;
66
- const B = D(), a = r.map((c) => B[c]);
68
+ const C = R(), c = a.map((i) => C[i]);
67
69
  let u = "";
68
- if (r.length === 1)
69
- u = e("unsubscription-preference.create-page-to-continue", {
70
- page: a[0]
70
+ if (a.length === 1)
71
+ u = t("unsubscription-preference.create-page-to-continue", {
72
+ page: c[0]
71
73
  });
72
- else if (r.length === 2)
73
- u = e("unsubscription-preference.create-pages-to-continue", {
74
- page1: a[0],
75
- page2: a[1]
74
+ else if (a.length === 2)
75
+ u = t("unsubscription-preference.create-pages-to-continue", {
76
+ page1: c[0],
77
+ page2: c[1]
76
78
  });
77
79
  else {
78
- const c = a.pop() ?? "", p = a.join(", ");
79
- u = e("unsubscription-preference.create-multiple-pages-to-continue", {
80
+ const i = c.pop() ?? "", p = c.join(", ");
81
+ u = t("unsubscription-preference.create-multiple-pages-to-continue", {
80
82
  pages: p,
81
- lastPage: c
83
+ lastPage: i
82
84
  });
83
85
  }
84
86
  return f({
85
- type: R.Warning,
87
+ type: I.Warning,
86
88
  message: u,
87
89
  actionButton: {
88
90
  text: "Go to Unsubscribe Pages",
89
91
  onClick: () => {
90
- window.location.href = I;
92
+ const i = new URL(D, window.location.origin).href;
93
+ window.open(i, "_blank", "noopener");
91
94
  }
92
95
  }
93
96
  }), !1;
94
- }, C = async () => {
95
- if (n.value = !0, await t.fetchTemplates(), t.setCollection(o.value), !m()) {
97
+ }, B = async () => {
98
+ if (n.value = !0, await e.fetchTemplates(!0), e.setCollection(r.value), !g()) {
96
99
  n.value = !1, d();
97
100
  return;
98
101
  }
99
- n.value = !1, t.typeSelectionDrawerStatus = !1, t.pageSelectionDrawerStatus = !0;
102
+ n.value = !1, e.typeSelectionDrawerStatus = !1, e.pageSelectionDrawerStatus = !0;
100
103
  };
101
- return _(() => t.typeSelectionDrawerStatus, (s) => {
102
- s && (i.value = !0, o.value = l.GLOBAL_UNSUBSCRIBE, t.isGlobalUnsubscribeDisabled && (o.value = t.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), i.value = !1);
103
- }), { __sfc: !0, trans: e, showToaster: f, unsubscribeStore: t, isSelecting: n, skeletonStatus: i, selectedCollection: o, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: m, selectCollection: C, WpDrawer: v, InSegments: G };
104
+ return h(() => e.typeSelectionDrawerStatus, (s) => {
105
+ s && (o.value = !0, r.value = l.GLOBAL_UNSUBSCRIBE, e.isGlobalUnsubscribeDisabled && (r.value = e.isSubscriptionPreferencesCenterDisabled ? 0 : l.SUBSCRIPTION_PREFERENCE_CENTER), o.value = !1);
106
+ }), { __sfc: !0, trans: t, showToaster: f, unsubscribeStore: e, isSelecting: n, skeletonStatus: o, selectedCollection: r, descriptionText: S, segmentList: T, footerButtonGroupOptions: y, closeModal: d, changeCollection: E, validateTemplates: g, selectCollection: B, WpDrawer: v, InSegments: P };
104
107
  }
105
108
  });
106
109
  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
  };