@useinsider/guido 3.7.0-beta.a1aaf44 → 3.7.0-beta.a8c44c1

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.
@@ -16,7 +16,7 @@ var o = function() {
16
16
  i,
17
17
  !1,
18
18
  null,
19
- "1b31027d"
19
+ "df672485"
20
20
  );
21
21
  const _ = c.exports;
22
22
  export {
@@ -1,16 +1,15 @@
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 w } from "../../../composables/useToaster.js";
1
+ import { defineComponent as g, ref as y, computed as n, watch as S } from "vue";
2
+ import T from "../../wrappers/WpDrawer.vue.js";
3
+ import { useToaster as v } from "../../../composables/useToaster.js";
4
4
  import { useTranslations as B } from "../../../composables/useTranslations.js";
5
5
  import { ToasterTypeOptions as C } from "../../../enums/toaster.js";
6
- import { useEditorStore as P } from "../../../stores/editor.js";
7
- import { useUnsubscribeStore as h } from "../../../stores/unsubscribe.js";
8
- import { InContainer as U } from "@useinsider/design-system-vue";
9
- import _ from "./UnsubscribeBreadcrumb.vue.js";
10
- const G = /* @__PURE__ */ y({
6
+ import { useUnsubscribeStore as w } from "../../../stores/unsubscribe.js";
7
+ import { InContainer as h } from "@useinsider/design-system-vue";
8
+ import U from "./UnsubscribeBreadcrumb.vue.js";
9
+ const F = /* @__PURE__ */ g({
11
10
  __name: "UnsubscribePageSelection",
12
- setup(x) {
13
- const s = B(), e = h(), r = P(), { showToaster: i } = w(), o = S(!1), c = 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(() => ({
11
+ setup(P) {
12
+ const s = B(), e = w(), { showToaster: a } = v(), o = y(!1), c = n(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = n(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), u = n(() => ({
14
13
  primaryButton: {
15
14
  styling: "solid",
16
15
  type: "primary",
@@ -21,47 +20,45 @@ const G = /* @__PURE__ */ y({
21
20
  cancelOrBackButton: {
22
21
  styling: "ghost",
23
22
  type: "secondary",
24
- labelText: l.value,
23
+ labelText: i.value,
25
24
  disabledStatus: o.value
26
25
  }
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) => {
26
+ })), p = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", r = (t) => {
28
27
  e.pageSelectionDrawerStatus = !1, t && setTimeout(() => {
29
28
  t();
30
29
  }, 500);
31
- }, m = () => {
30
+ }, d = () => {
32
31
  if (e.isActiveTypeFirstInCollection) {
33
- n(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
32
+ r(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
34
33
  return;
35
34
  }
36
35
  e.setPreviousType();
37
- }, b = () => {
38
- if (!r.isPreviewModeOpen) {
39
- if (e.isActiveTypeLastInCollection) {
40
- o.value = !0;
41
- const t = e.selectedCollectionType, u = e.getSelectedTemplatesByCollection(t), g = e.getSelectedUnsubscribePagesByCollection(t);
42
- e.removeUnsubscribePages(g), e.addUnsubscribePages(u), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
43
- detail: {
44
- collectionType: t,
45
- selectedPages: u
46
- }
47
- })), n(() => {
48
- o.value = !1, i({
49
- type: C.Success,
50
- message: s("global-unsubscribe.pages-were-attached")
51
- });
36
+ }, m = () => {
37
+ if (e.isActiveTypeLastInCollection) {
38
+ o.value = !0;
39
+ const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t), f = e.getSelectedUnsubscribePagesByCollection(t);
40
+ e.removeUnsubscribePages(f), e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
41
+ detail: {
42
+ collectionType: t,
43
+ selectedPages: l
44
+ }
45
+ })), r(() => {
46
+ o.value = !1, a({
47
+ type: C.Success,
48
+ message: s("global-unsubscribe.pages-were-attached")
52
49
  });
53
- return;
54
- }
55
- e.setNextType();
50
+ });
51
+ return;
56
52
  }
57
- }, f = (t) => {
58
- r.isPreviewModeOpen || e.setSelectedTemplate(t);
53
+ e.setNextType();
54
+ }, b = (t) => {
55
+ e.setSelectedTemplate(t);
59
56
  };
60
- return T(() => e.pageSelectionDrawerStatus, (t) => {
57
+ return S(() => e.pageSelectionDrawerStatus, (t) => {
61
58
  t && e.pageSelectionUpdateStatus && e.fetchTemplates();
62
- }), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: i, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleBack: m, handleSave: b, selectTemplate: f, WpDrawer: v, InContainer: U, UnsubscribeBreadcrumb: _ };
59
+ }), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: a, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: u, getBorderClass: p, closeModal: r, handleBack: d, handleSave: m, selectTemplate: b, WpDrawer: T, InContainer: h, UnsubscribeBreadcrumb: U };
63
60
  }
64
61
  });
65
62
  export {
66
- G as default
63
+ F as default
67
64
  };
@@ -10,7 +10,7 @@ var i = function() {
10
10
  r,
11
11
  !1,
12
12
  null,
13
- "811cff80"
13
+ "43c617a7"
14
14
  );
15
15
  const _ = c.exports;
16
16
  export {
@@ -1,109 +1,106 @@
1
- import { defineComponent as _, ref as b, computed as m, watch as h } from "vue";
1
+ import { defineComponent as h, ref as b, computed as g, watch as _ } 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 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__ */ _({
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({
11
11
  __name: "UnsubscribeTypeSelection",
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(
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(
14
14
  "unsubscription-preference.select-unsubscribe-page-description",
15
- { action: `<a href="${N.GLOBAL_UNSUBSCRIBE}" target="_blank">${t("ds-rules.visit-academy")}</a>` }
16
- ), T = m(() => [
15
+ { action: `<a href="${w.GLOBAL_UNSUBSCRIBE}" target="_blank">${e("ds-rules.visit-academy")}</a>` }
16
+ ), T = g(() => [
17
17
  {
18
- description: t("unsubscription-preference.type-global-unsubscribe-description"),
18
+ description: e("unsubscription-preference.type-global-unsubscribe-description"),
19
19
  icon: "line-contact-global-unsub-page",
20
- text: t("unsubscription-preference.type-global-unsubscribe"),
20
+ text: e("unsubscription-preference.type-global-unsubscribe"),
21
21
  value: l.GLOBAL_UNSUBSCRIBE,
22
- disable: e.isGlobalUnsubscribeDisabled,
22
+ disable: t.isGlobalUnsubscribeDisabled,
23
23
  position: "bottom",
24
- tooltipText: e.isGlobalUnsubscribeDisabled ? t("unsubscription-preference.global-unsub-added") : ""
24
+ tooltipText: t.isGlobalUnsubscribeDisabled ? e("unsubscription-preference.global-unsub-added") : ""
25
25
  },
26
26
  {
27
- description: t("unsubscription-preference.type-subscription-preferences-center-description"),
27
+ description: e("unsubscription-preference.type-subscription-preferences-center-description"),
28
28
  icon: "line-contact-sub-pref-center-page",
29
- text: t("unsubscription-preference.type-subscription-preferences-center"),
29
+ text: e("unsubscription-preference.type-subscription-preferences-center"),
30
30
  value: l.SUBSCRIPTION_PREFERENCE_CENTER,
31
- disable: e.isSubscriptionPreferencesCenterDisabled,
32
- tooltipText: e.isSubscriptionPreferencesCenterDisabled ? t("unsubscription-preference.pref-center-added") : ""
31
+ disable: t.isSubscriptionPreferencesCenterDisabled,
32
+ tooltipText: t.isSubscriptionPreferencesCenterDisabled ? e("unsubscription-preference.pref-center-added") : ""
33
33
  }
34
- ]), y = m(() => ({
34
+ ]), y = g(() => ({
35
35
  primaryButton: {
36
36
  styling: "solid",
37
37
  type: "primary",
38
- labelText: t(
38
+ labelText: e(
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: o.value,
43
+ skeletonStatus: i.value,
44
44
  skeletonSizing: { width: 168, height: 40 }
45
45
  },
46
46
  cancelOrBackButton: {
47
47
  styling: "ghost",
48
48
  type: "secondary",
49
- labelText: t("products.cancel"),
49
+ labelText: e("products.cancel"),
50
50
  disabledStatus: n.value,
51
- skeletonStatus: o.value,
51
+ skeletonStatus: i.value,
52
52
  skeletonSizing: { width: 78, height: 40 }
53
53
  }
54
54
  })), d = (s) => {
55
- e.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel", {
56
- detail: { blockId: e.pendingBlockId }
57
- })), s && setTimeout(() => {
55
+ t.typeSelectionDrawerStatus = !1, document.dispatchEvent(new CustomEvent("unsubscribe:cancel")), s && setTimeout(() => {
58
56
  s();
59
57
  }, 500);
60
58
  }, E = (s) => {
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)
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)
67
65
  return !0;
68
- const C = R(), c = a.map((i) => C[i]);
66
+ const B = D(), a = r.map((c) => B[c]);
69
67
  let u = "";
70
- if (a.length === 1)
71
- u = t("unsubscription-preference.create-page-to-continue", {
72
- page: c[0]
68
+ if (r.length === 1)
69
+ u = e("unsubscription-preference.create-page-to-continue", {
70
+ page: a[0]
73
71
  });
74
- else if (a.length === 2)
75
- u = t("unsubscription-preference.create-pages-to-continue", {
76
- page1: c[0],
77
- page2: c[1]
72
+ else if (r.length === 2)
73
+ u = e("unsubscription-preference.create-pages-to-continue", {
74
+ page1: a[0],
75
+ page2: a[1]
78
76
  });
79
77
  else {
80
- const i = c.pop() ?? "", p = c.join(", ");
81
- u = t("unsubscription-preference.create-multiple-pages-to-continue", {
78
+ const c = a.pop() ?? "", p = a.join(", ");
79
+ u = e("unsubscription-preference.create-multiple-pages-to-continue", {
82
80
  pages: p,
83
- lastPage: i
81
+ lastPage: c
84
82
  });
85
83
  }
86
84
  return f({
87
- type: I.Warning,
85
+ type: R.Warning,
88
86
  message: u,
89
87
  actionButton: {
90
88
  text: "Go to Unsubscribe Pages",
91
89
  onClick: () => {
92
- const i = new URL(D, window.location.origin).href;
93
- window.open(i, "_blank", "noopener");
90
+ window.location.href = I;
94
91
  }
95
92
  }
96
93
  }), !1;
97
- }, B = async () => {
98
- if (n.value = !0, await e.fetchTemplates(!0), e.setCollection(r.value), !g()) {
94
+ }, C = async () => {
95
+ if (n.value = !0, await t.fetchTemplates(), t.setCollection(o.value), !m()) {
99
96
  n.value = !1, d();
100
97
  return;
101
98
  }
102
- n.value = !1, e.typeSelectionDrawerStatus = !1, e.pageSelectionDrawerStatus = !0;
99
+ n.value = !1, t.typeSelectionDrawerStatus = !1, t.pageSelectionDrawerStatus = !0;
103
100
  };
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 };
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 };
107
104
  }
108
105
  });
109
106
  export {
@@ -1,86 +1,92 @@
1
- import { useConfig as _ } from "./useConfig.js";
2
- import { TemplateTypes as H } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as G, CampaignCouldNotBeSavedKey as M, CanNotMakeAnyChangesForRunningKey as $ } from "../enums/html-validator.js";
1
+ import { useConfig as V } from "./useConfig.js";
2
+ import { TemplateTypes as G } from "../enums/defaults.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as M, CampaignCouldNotBeSavedKey as X, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as $, ALLOWED_DYNAMIC_SYSTEM_TOKENS as q, VALID_DYNAMIC_VARIABLE_REGEX as K } from "../enums/html-validator.js";
4
4
  import { ToasterTypeOptions as c } from "../enums/toaster.js";
5
- import { itemsBlockDynamicVariables as q } from "../extensions/Blocks/Items/enums/productEnums.js";
6
- import { useRecommendationExtensionStore as X } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
- import { RecommendationRequiredFieldsKey as j } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
8
- import { useRecommendationStore as K } from "../stores/recommendation.js";
9
- import { base64EncodeWithSpecialChars as z } from "../utils/base64.js";
10
- import { useHttp as U } from "./useHttp.js";
11
- import { useToaster as Y } from "./useToaster.js";
12
- import { useTranslations as Z } from "./useTranslations.js";
13
- const J = /recommendation-id="(\d+)"/g;
14
- function Q(a) {
15
- return [...a.matchAll(J)].map((u) => u[1]);
5
+ import { itemsBlockDynamicVariables as j } from "../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { useRecommendationExtensionStore as U } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
+ import { RecommendationRequiredFieldsKey as z } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
8
+ import { useRecommendationStore as Z } from "../stores/recommendation.js";
9
+ import { base64EncodeWithSpecialChars as J } from "../utils/base64.js";
10
+ import { useHttp as Q } from "./useHttp.js";
11
+ import { useToaster as ee } from "./useToaster.js";
12
+ import { useTranslations as te } from "./useTranslations.js";
13
+ const se = /recommendation-id="(\d+)"/g;
14
+ function ne(i) {
15
+ return [...i.matchAll(se)].map((d) => d[1]);
16
16
  }
17
- function ee(a, u) {
18
- return u.some((d) => a.startsWith(`${d}_`));
17
+ function ie(i, d) {
18
+ return d.some((g) => i.startsWith(`${g}_`));
19
19
  }
20
- const ge = () => {
21
- var y, h;
22
- const { showToaster: a } = Y(), { post: u } = U(), { config: d } = _(), r = Z(), g = K(), S = X(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === H.transactional, b = async (e) => {
23
- const t = await u(
20
+ function oe(i) {
21
+ return (i.replace(Y, "$1").match($) ?? []).filter((r) => {
22
+ const u = r.slice(2, -2), f = u.indexOf("|"), p = (f === -1 ? u : u.slice(0, f)).trim();
23
+ return q.includes(p) ? !1 : K.test(p) ? f !== -1 && u.slice(f + 1).trim() === "" : !0;
24
+ });
25
+ }
26
+ const Ce = () => {
27
+ var h, v;
28
+ const { showToaster: i } = ee(), { post: d } = Q(), { config: g } = V(), r = te(), u = Z(), f = U(), p = ((v = (h = g.value) == null ? void 0 : h.partner) == null ? void 0 : v.messageType) === G.transactional, A = async (e) => {
29
+ const t = await d(
24
30
  "/newsletter/template-library/check-template-html-body",
25
- { html: z(e) }
31
+ { html: J(e) }
26
32
  ), { status: n, message: l } = t.data;
27
- return n || a({
33
+ return n || i({
28
34
  type: c.Alert,
29
35
  message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
30
- }), r(M), l === r($) && a({
36
+ }), r(X), l === r(P) && i({
31
37
  type: c.Alert,
32
38
  message: r("newsletter.already-in-progress")
33
39
  }), n;
34
- }, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), E = (e) => ["if", "endif"].includes(e.toLowerCase()), A = (e, s) => {
40
+ }, S = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), b = (e) => ["if", "endif"].includes(e.toLowerCase()), I = (e, s) => {
35
41
  const t = e.match(/({%(.*?)%})/g);
36
42
  let n = !0;
37
43
  return t !== null && !p && t.forEach((l) => {
38
44
  const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
39
45
  if (o && o.length > 0) {
40
- const [i] = o;
41
- w(i) && !s.includes(i) && (a({
46
+ const [a] = o;
47
+ S(a) && !s.includes(a) && (i({
42
48
  type: c.Warning,
43
49
  message: r("custom-fields.invalid-custom-fields")
44
50
  }), n = !1);
45
51
  }
46
52
  }), n;
47
- }, k = async (e, s, t) => {
48
- const n = t ? await b(e) : !0;
49
- return A(e, s) && n;
50
- }, x = (e) => e.length > 0 ? !0 : (a({
53
+ }, T = async (e, s, t) => {
54
+ const n = t ? await A(e) : !0;
55
+ return I(e, s) && n;
56
+ }, w = (e) => e.length > 0 ? !0 : (i({
51
57
  type: c.Warning,
52
58
  message: r("newsletter.html-content-is-empty")
53
- }), !1), I = (e) => {
59
+ }), !1), x = (e) => {
54
60
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
55
- return s > t && a({
61
+ return s > t && i({
56
62
  type: c.Warning,
57
63
  message: r("custom-fields.missing-closing-braces")
58
- }), s < t && a({
64
+ }), s < t && i({
59
65
  type: c.Warning,
60
66
  message: r("custom-fields.missing-opening-braces")
61
67
  }), s === t;
62
- }, F = (e) => {
63
- const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
64
- return s || a({
68
+ }, _ = (e) => {
69
+ const s = oe(e).length === 0;
70
+ return s || i({
65
71
  type: c.Warning,
66
72
  message: r("custom-fields.invalid-custom-fields")
67
73
  }), s;
68
- }, T = (e, s) => {
74
+ }, k = (e, s) => {
69
75
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
70
76
  if (t && !p) {
71
- const n = new Set(s.map((i) => i.toLowerCase())), l = Q(e), o = [];
72
- if (t.forEach((i) => {
73
- const m = i.slice(2, -2).trim().toLowerCase();
74
- (!n.has(m) || m === "") && !ee(m, l) && o.push(m);
77
+ const n = new Set(s.map((a) => a.toLowerCase())), l = ne(e), o = [];
78
+ if (t.forEach((a) => {
79
+ const m = a.slice(2, -2).trim().toLowerCase();
80
+ (!n.has(m) || m === "") && !ie(m, l) && o.push(m);
75
81
  }), o.length > 0) {
76
- const i = `
82
+ const a = `
77
83
  <ul>
78
84
  ${o.map((m) => `<li>${m}</li>`).join("")}
79
85
  </ul>
80
86
  `;
81
- return a({
87
+ return i({
82
88
  type: c.Alert,
83
- message: r("custom-fields.invalid-custom-fields") + i
89
+ message: r("custom-fields.invalid-custom-fields") + a
84
90
  }), !1;
85
91
  }
86
92
  }
@@ -89,78 +95,78 @@ const ge = () => {
89
95
  const s = e.match(/{%(.*?)%}/g), t = [];
90
96
  let n = !0;
91
97
  if (s && s.forEach((l) => {
92
- const o = l.match(P), i = l.match(G), m = (o == null ? void 0 : o.join("")) || "";
93
- (!o || l !== m) && !i && (a({
98
+ const o = l.match(H), a = l.match(M), m = (o == null ? void 0 : o.join("")) || "";
99
+ (!o || l !== m) && !a && (i({
94
100
  type: c.Alert,
95
101
  message: r("newsletter.display-conditions-invalid-syntax")
96
- }), n = !1), o && o.forEach((f) => {
97
- f.trim() === "=" && (a({
102
+ }), n = !1), o && o.forEach((y) => {
103
+ y.trim() === "=" && (i({
98
104
  type: c.Alert,
99
105
  message: r("custom-conditions.wrong-equality-operators")
100
106
  }), n = !1);
101
- const v = f.match(/^[a-zA-Z]*$/g);
102
- v && v.forEach((C) => {
103
- E(C) && t.push(C);
107
+ const C = y.match(/^[a-zA-Z]*$/g);
108
+ C && C.forEach((E) => {
109
+ b(E) && t.push(E);
104
110
  });
105
111
  });
106
112
  }), t.length) {
107
- const l = t.filter((i) => i === "if"), o = t.filter((i) => i === "endif");
108
- l.length !== o.length && (a({
113
+ const l = t.filter((a) => a === "if"), o = t.filter((a) => a === "endif");
114
+ l.length !== o.length && (i({
109
115
  type: c.Alert,
110
116
  message: r("custom-conditions.missing-if-endif-tag")
111
117
  }), n = !1);
112
118
  }
113
119
  return n;
114
- }, B = (e) => {
120
+ }, N = (e) => {
115
121
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
116
- return n || a({
122
+ return n || i({
117
123
  type: c.Warning,
118
124
  message: r("custom-conditions.no-space-after-braces")
119
125
  }), n;
120
- }, W = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
126
+ }, D = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (i({
121
127
  type: c.Warning,
122
128
  message: r("custom-conditions.no-braces-inside-if-tag")
123
- }), !1) : !0, N = () => S.hasInvalidBlock() ? (a({
129
+ }), !1) : !0, F = () => f.hasInvalidBlock() ? (i({
124
130
  type: c.Alert,
125
- message: r(j)
126
- }), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
131
+ message: r(z)
132
+ }), !1) : !0, O = () => u.recommendationConfigs && Object.values(u.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (i({
127
133
  type: c.Alert,
128
134
  message: r("newsletter.fill-all-necessary-fields")
129
- }), !1) : !0, D = (e) => {
135
+ }), !1) : !0, B = (e) => {
130
136
  const s = /src="[^"]*\.(svg|pst)"/gm;
131
- return e.match(s) === null ? !0 : (a({
137
+ return e.match(s) === null ? !0 : (i({
132
138
  type: c.Alert,
133
139
  message: r("newsletter.invalid-image-type")
134
140
  }), !1);
135
141
  }, L = (e) => {
136
142
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
137
143
  return Array.from(n).find((o) => {
138
- var i;
139
- return !((i = o.id) != null && i.trim());
140
- }) ? (a({
144
+ var a;
145
+ return !((a = o.id) != null && a.trim());
146
+ }) ? (i({
141
147
  type: c.Alert,
142
148
  message: r("unsubscribe-templates.select-checkbox-groups")
143
149
  }), !1) : !0;
144
- }, V = (e) => {
150
+ }, W = (e) => {
145
151
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
146
152
  return Array.from(n).find((o) => {
147
- var i;
148
- return !((i = o.id) != null && i.trim());
149
- }) ? (a({
153
+ var a;
154
+ return !((a = o.id) != null && a.trim());
155
+ }) ? (i({
150
156
  type: c.Alert,
151
157
  message: r("unsubscribe-templates.select-radio-button-groups")
152
158
  }), !1) : !0;
153
159
  };
154
160
  return { validateHtml: async (e, s, t = !1) => {
155
- var o, i;
161
+ var o, a;
156
162
  const n = [
157
163
  ...s.map((m) => m.value),
158
- ...q,
159
- ...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
164
+ ...j,
165
+ ...((a = (o = g.value) == null ? void 0 : o.template) == null ? void 0 : a.customFieldAttributes) ?? []
160
166
  ];
161
- return await k(e, n, t) && x(e) && I(e) && F(e) && T(e, n) && R(e) && B(e) && W(e) && N() && O() && D(e) && L(e) && V(e);
167
+ return await T(e, n, t) && w(e) && x(e) && _(e) && k(e, n) && R(e) && N(e) && D(e) && F() && O() && B(e) && L(e) && W(e);
162
168
  } };
163
169
  };
164
170
  export {
165
- ge as useHtmlValidator
171
+ Ce as useHtmlValidator
166
172
  };
@@ -1,7 +1,15 @@
1
- const e = "newsletter.already-in-progress", n = "newsletter.campaign-could-not-be-saved", o = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, a = /{%( )*now( )(".*")( )*%}/gm;
1
+ const n = "newsletter.already-in-progress", e = "newsletter.campaign-could-not-be-saved", s = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, o = /{%( )*now( )(".*")( )*%}/gm, E = /\{\{[^{}]+\}\}/g, i = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, t = /^[A-Za-z0-9_.]+$/, _ = [
2
+ "ins-unsubscribe-link",
3
+ "ins-global-unsubscribe-link",
4
+ "ins-preferences-unsubscribe-link"
5
+ ];
2
6
  export {
3
- n as CampaignCouldNotBeSavedKey,
4
- e as CanNotMakeAnyChangesForRunningKey,
5
- a as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
6
- o as DISPLAY_CONDITIONS_REGEX
7
+ _ as ALLOWED_DYNAMIC_SYSTEM_TOKENS,
8
+ e as CampaignCouldNotBeSavedKey,
9
+ n as CanNotMakeAnyChangesForRunningKey,
10
+ i as DATA_ATTRIBUTE_REGEX,
11
+ o as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
12
+ s as DISPLAY_CONDITIONS_REGEX,
13
+ E as DYNAMIC_CONTENT_TAG_REGEX,
14
+ t as VALID_DYNAMIC_VARIABLE_REGEX
7
15
  };
@@ -1,40 +1,39 @@
1
- var m = Object.defineProperty;
2
- var k = (c, n, e) => n in c ? m(c, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[n] = e;
3
- var a = (c, n, e) => k(c, typeof n != "symbol" ? n + "" : n, e);
1
+ var g = Object.defineProperty;
2
+ var k = (c, n, e) => n in c ? g(c, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[n] = e;
3
+ var l = (c, n, e) => k(c, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { useToaster as B } from "../../../composables/useToaster.js";
5
5
  import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
6
6
  import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
7
- import { useEditorStore as f } from "../../../stores/editor.js";
8
- import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
9
- import { Block as L, BlockCompositionType as A, ContextActionType as h, ModificationDescription as b, BlockType as v } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
10
- import { getDefaultTemplate as I } from "./template.js";
7
+ import { useUnsubscribeStore as a } from "../../../stores/unsubscribe.js";
8
+ import { Block as L, BlockCompositionType as f, ContextActionType as h, ModificationDescription as b, BlockType as v } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
+ import { getDefaultTemplate as A } from "./template.js";
11
10
  import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
12
11
  import { parsePageList as p } from "./utils/utils.js";
13
- const T = "unsubscribe-block", g = 'a[data-unsubscribe-link="true"]', _ = ".unsubscribe-block-v2", y = "{{ins-unsubscribe-link}}", C = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", N = "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.", U = {
12
+ const y = "unsubscribe-block", m = 'a[data-unsubscribe-link="true"]', _ = ".unsubscribe-block-v2", I = "{{ins-unsubscribe-link}}", T = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", C = "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.", N = {
14
13
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
15
14
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
16
15
  };
17
- class K extends L {
16
+ class F extends L {
18
17
  constructor() {
19
18
  super();
20
- a(this, "selectEventListener", null);
21
- a(this, "cancelEventListener", null);
22
- a(this, "currentNode");
19
+ l(this, "selectEventListener", null);
20
+ l(this, "cancelEventListener", null);
21
+ l(this, "currentNode");
23
22
  // Per-block "did this instance have a link last time we saw it?" tracking.
24
23
  // Keyed by the stable `data-unsubscribe-block-id` we assign, because
25
24
  // ImmutableHtmlNode instances are recreated on every document mutation and
26
25
  // can't be used as Map keys directly. A singleton boolean here would be
27
26
  // polluted across blocks since Stripo fires onDocumentChanged per-instance.
28
- a(this, "linkStateByBlockId", /* @__PURE__ */ new Map());
27
+ l(this, "linkStateByBlockId", /* @__PURE__ */ new Map());
29
28
  }
30
29
  getId() {
31
- return T;
30
+ return y;
32
31
  }
33
32
  getIcon() {
34
33
  return "unsubscribe-icon";
35
34
  }
36
35
  getBlockCompositionType() {
37
- return A.BLOCK;
36
+ return f.BLOCK;
38
37
  }
39
38
  getName() {
40
39
  return this.api.translate("Unsubscribe Block");
@@ -43,49 +42,37 @@ class K extends L {
43
42
  return this.api.translate("Unsubscribe Block Description");
44
43
  }
45
44
  getTemplate() {
46
- return I();
45
+ return A();
47
46
  }
48
47
  getContextActionsIds() {
49
48
  return [h.MOVE, h.REMOVE];
50
49
  }
51
50
  onSelect(e) {
52
- if (this.currentNode = e, f().isPreviewModeOpen)
53
- return;
54
- const r = this._readBlockId(e) !== null, t = this._getOrAssignBlockId(e);
55
- t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), !("getAttribute" in e && e.getAttribute("data-migration")) && (r && !this._hasPageSelection(e) || (this._resetStoreState(), t && (l().pendingBlockId = t), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(t), this._checkExistingBlocks(), this._openDrawer()));
51
+ this.currentNode = e;
52
+ const t = this._getOrAssignBlockId(e);
53
+ t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
56
54
  }
57
55
  onDocumentChanged(e) {
58
- const r = this._getOrAssignBlockId(e);
59
- if (!r)
56
+ const t = this._getOrAssignBlockId(e);
57
+ if (!t)
60
58
  return;
61
- const t = this._hasUnsubscribeLink(e);
62
- this.linkStateByBlockId.get(r) === !0 && !t && this._warnLinkRemoved(), this.linkStateByBlockId.set(r, t);
59
+ const r = this._hasUnsubscribeLink(e);
60
+ this.linkStateByBlockId.get(t) === !0 && !r && this._warnLinkRemoved(), this.linkStateByBlockId.set(t, r);
63
61
  }
64
62
  onDelete(e) {
65
63
  this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
66
- const r = this._readBlockId(e);
67
- r && this.linkStateByBlockId.delete(r);
64
+ const t = this._readBlockId(e);
65
+ t && this.linkStateByBlockId.delete(t);
68
66
  }
69
67
  onDestroy() {
70
68
  this._removeEventListeners(), this.currentNode = void 0, this.linkStateByBlockId.clear();
71
69
  }
72
70
  _hasUnsubscribeLink(e) {
73
- return "querySelector" in e ? !!e.querySelector(g) : !1;
71
+ return "querySelector" in e ? !!e.querySelector(m) : !1;
74
72
  }
75
73
  _readBlockId(e) {
76
74
  return "getAttribute" in e ? e.getAttribute(i.BLOCK_ID) : null;
77
75
  }
78
- /**
79
- * True when the block has a page type and a page list — i.e. a template was
80
- * applied. A block with neither, combined with an already-present block id,
81
- * is an undo-restored orphan of a cancelled block.
82
- */
83
- _hasPageSelection(e) {
84
- if (!("getAttribute" in e))
85
- return !1;
86
- const r = e.getAttribute(i.PAGE_TYPE), t = e.getAttribute(i.PAGE_LIST);
87
- return !!r && !!t;
88
- }
89
76
  /**
90
77
  * Returns the block's stable id, assigning one via the document modifier if
91
78
  * the node has not been tagged yet. Idempotent: subsequent calls during
@@ -93,18 +80,18 @@ class K extends L {
93
80
  * `apply()`) short-circuit on the existing attribute.
94
81
  */
95
82
  _getOrAssignBlockId(e) {
96
- const r = this._readBlockId(e);
97
- if (r)
98
- return r;
83
+ const t = this._readBlockId(e);
84
+ if (t)
85
+ return t;
99
86
  if (!("getAttribute" in e))
100
87
  return null;
101
- const t = this._generateNextBlockId();
88
+ const r = this._generateNextBlockId();
102
89
  try {
103
- this.api.getDocumentModifier().modifyHtml(e).setAttribute(i.BLOCK_ID, t).apply(new b(`Assign unsubscribe block id ${t}`));
90
+ this.api.getDocumentModifier().modifyHtml(e).setAttribute(i.BLOCK_ID, r).apply(new b(`Assign unsubscribe block id ${r}`));
104
91
  } catch (s) {
105
92
  return console.warn("[UnsubscribeBlock] Failed to assign block id:", s), null;
106
93
  }
107
- return t;
94
+ return r;
108
95
  }
109
96
  /**
110
97
  * Generates a unique id by scanning the document for the highest existing
@@ -114,8 +101,8 @@ class K extends L {
114
101
  _generateNextBlockId() {
115
102
  let e = 0;
116
103
  try {
117
- const r = this.api.getDocumentRoot();
118
- r && "querySelectorAll" in r && r.querySelectorAll(_).forEach((s) => {
104
+ const t = this.api.getDocumentRoot();
105
+ t && "querySelectorAll" in t && t.querySelectorAll(_).forEach((s) => {
119
106
  if ("getAttribute" in s) {
120
107
  const o = s.getAttribute(i.BLOCK_ID), u = o ? parseInt(o) : 0;
121
108
  u > e && (e = u);
@@ -130,11 +117,11 @@ class K extends L {
130
117
  const { showToaster: e } = B();
131
118
  e({
132
119
  type: S.Warning,
133
- message: this.api.translate(N),
120
+ message: this.api.translate(C),
134
121
  actionButton: {
135
122
  text: this.api.translate("Visit Academy"),
136
123
  onClick: () => {
137
- window.open(C, "_blank", "noopener,noreferrer");
124
+ window.open(T, "_blank", "noopener,noreferrer");
138
125
  }
139
126
  }
140
127
  });
@@ -144,17 +131,16 @@ class K extends L {
144
131
  }
145
132
  _setupSelectEventListener() {
146
133
  this._removeSelectEventListener(), this.selectEventListener = (e) => {
147
- const r = e, { collectionType: t, selectedPages: s } = r.detail;
148
- this._updateBlock(t, s.join(","));
134
+ const t = e, { collectionType: r, selectedPages: s } = t.detail;
135
+ this._updateBlock(r, s.join(","));
149
136
  }, document.addEventListener(d.SELECT, this.selectEventListener);
150
137
  }
151
138
  _removeSelectEventListener() {
152
139
  this.selectEventListener && (document.removeEventListener(d.SELECT, this.selectEventListener), this.selectEventListener = null);
153
140
  }
154
- _setupCancelEventListener(e) {
155
- this._removeCancelEventListener(), this.cancelEventListener = (r) => {
156
- const { detail: t } = r, s = (t == null ? void 0 : t.blockId) ?? null;
157
- s !== null && s !== e || this._handleCancel();
141
+ _setupCancelEventListener() {
142
+ this._removeCancelEventListener(), this.cancelEventListener = () => {
143
+ this._handleCancel();
158
144
  }, document.addEventListener(d.CANCEL, this.cancelEventListener);
159
145
  }
160
146
  _removeCancelEventListener() {
@@ -172,32 +158,32 @@ class K extends L {
172
158
  _removeEventListeners() {
173
159
  this._removeSelectEventListener(), this._removeCancelEventListener();
174
160
  }
175
- _updateBlock(e, r) {
161
+ _updateBlock(e, t) {
176
162
  if (!this.currentNode || !("querySelector" in this.currentNode))
177
163
  return;
178
- const t = this.currentNode.querySelector(g);
179
- if (!t)
164
+ const r = this.currentNode.querySelector(m);
165
+ if (!r)
180
166
  return;
181
167
  const s = this._getMergeTag(e);
182
- this.api.getDocumentModifier().modifyHtml(t).setAttribute("href", s).apply(new b(`Updated unsubscribe link to ${s}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(i.PAGE_TYPE, e.toString()).setAttribute(i.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
168
+ this.api.getDocumentModifier().modifyHtml(r).setAttribute("href", s).apply(new b(`Updated unsubscribe link to ${s}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(i.PAGE_TYPE, e.toString()).setAttribute(i.PAGE_LIST, t).apply(new b("Updated unsubscribe block metadata"));
183
169
  }
184
170
  _getMergeTag(e) {
185
- return U[e] ?? y;
171
+ return N[e] ?? I;
186
172
  }
187
173
  _openDrawer() {
188
174
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
189
175
  try {
190
- const e = l();
176
+ const e = a();
191
177
  e.typeSelectionDrawerStatus = !0;
192
178
  } catch (e) {
193
179
  console.error("[UnsubscribeBlock] Failed to open drawer:", e);
194
180
  }
195
181
  }
196
182
  _checkExistingBlocks() {
197
- const e = l();
198
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(_).forEach((t) => {
199
- if ("getAttribute" in t) {
200
- const s = t.getAttribute(i.PAGE_TYPE);
183
+ const e = a();
184
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(_).forEach((r) => {
185
+ if ("getAttribute" in r) {
186
+ const s = r.getAttribute(i.PAGE_TYPE);
201
187
  if (s) {
202
188
  const o = Number(s);
203
189
  o === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : o === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
@@ -208,26 +194,26 @@ class K extends L {
208
194
  async _loadBlockState(e) {
209
195
  if (!("getAttribute" in e))
210
196
  return;
211
- const r = e.getAttribute(i.PAGE_TYPE), t = e.getAttribute(i.PAGE_LIST);
212
- if (!r || !t)
197
+ const t = e.getAttribute(i.PAGE_TYPE), r = e.getAttribute(i.PAGE_LIST);
198
+ if (!t || !r)
213
199
  return;
214
- const s = l(), o = Number(r), u = p(t);
200
+ const s = a(), o = Number(t), u = p(r);
215
201
  await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(o), s.loadSelectedTemplates(u);
216
202
  }
217
203
  _resetStoreState() {
218
- l().$reset();
204
+ a().$reset();
219
205
  }
220
206
  _removeBlockTemplatesFromStore(e) {
221
207
  if (!("getAttribute" in e))
222
208
  return;
223
- const r = e.getAttribute(i.PAGE_LIST);
224
- if (!r)
209
+ const t = e.getAttribute(i.PAGE_LIST);
210
+ if (!t)
225
211
  return;
226
- const t = l(), s = p(r);
227
- t.removeUnsubscribePages(s);
212
+ const r = a(), s = p(t);
213
+ r.removeUnsubscribePages(s);
228
214
  }
229
215
  }
230
216
  export {
231
- T as UNSUBSCRIBE_BLOCK_ID,
232
- K as UnsubscribeBlock
217
+ y as UNSUBSCRIBE_BLOCK_ID,
218
+ F as UnsubscribeBlock
233
219
  };
@@ -1,11 +1,10 @@
1
- var T = Object.defineProperty;
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";
1
+ var d = Object.defineProperty;
2
+ var h = (a, s, e) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
3
+ var u = (a, s, e) => h(a, typeof s != "symbol" ? s + "" : s, e);
5
4
  import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
6
- import { Control as g, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { DATA_ATTRIBUTES as d } from "./utils/constants.js";
8
- import { parsePageList as h } from "./utils/utils.js";
5
+ import { Control as T, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { DATA_ATTRIBUTES as p } from "./utils/constants.js";
7
+ import { parsePageList as _ } from "./utils/utils.js";
9
8
  const v = "ui-elements-unsubscribe", r = {
10
9
  SELECT_BUTTON: "selectTemplateButton",
11
10
  PREV_BUTTON: "prevButton",
@@ -13,14 +12,14 @@ const v = "ui-elements-unsubscribe", r = {
13
12
  COUNTER_TEXT: "counterText",
14
13
  PREVIEW_IMAGE: "previewImage"
15
14
  };
16
- class w extends g {
15
+ class B extends T {
17
16
  constructor() {
18
17
  super(...arguments);
19
- c(this, "currentPreviewIndex", 0);
20
- c(this, "currentNode");
21
- c(this, "currentPages");
22
- c(this, "valueChangeHandlers", []);
23
- c(this, "lastParsedAttribute");
18
+ u(this, "currentPreviewIndex", 0);
19
+ u(this, "currentNode");
20
+ u(this, "currentPages");
21
+ u(this, "valueChangeHandlers", []);
22
+ u(this, "lastParsedAttribute");
24
23
  }
25
24
  getId() {
26
25
  return v;
@@ -35,8 +34,8 @@ class w extends g {
35
34
  }
36
35
  onTemplateNodeUpdated(e) {
37
36
  if (this.currentNode = e, "getAttribute" in this.currentNode) {
38
- const t = this.currentNode.getAttribute(d.PAGE_LIST);
39
- t && (t !== this.lastParsedAttribute && (this.currentPages = h(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
37
+ const t = this.currentNode.getAttribute(p.PAGE_LIST);
38
+ t && (t !== this.lastParsedAttribute && (this.currentPages = _(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
40
39
  }
41
40
  }
42
41
  onRender() {
@@ -62,20 +61,12 @@ class w extends g {
62
61
  }
63
62
  _onButtonClick() {
64
63
  try {
65
- if (_().isPreviewModeOpen)
66
- return;
67
64
  const e = l();
68
- this._reseedSelectionFromBlock(e), e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
65
+ e.activeType = e.getSelectedCollection[this.currentPreviewIndex], e.pageSelectionUpdateStatus = !0, e.pageSelectionDrawerStatus = !0;
69
66
  } catch (e) {
70
67
  console.error("[UnsubscribeControl] Failed to open drawer:", e);
71
68
  }
72
69
  }
73
- _reseedSelectionFromBlock(e) {
74
- if (!this.currentNode || !("getAttribute" in this.currentNode))
75
- return;
76
- const t = this.currentNode.getAttribute(d.PAGE_TYPE), o = this.currentNode.getAttribute(d.PAGE_LIST);
77
- !t || !o || (e.$reset(), e.setCollectionWithoutAutoSelection(Number(t)), e.loadSelectedTemplates(h(o)));
78
- }
79
70
  _onPrevClick() {
80
71
  this.currentPreviewIndex > 0 && (this.currentPreviewIndex--, this._updatePreview(), this._updateCounter());
81
72
  }
@@ -89,21 +80,21 @@ class w extends g {
89
80
  var e;
90
81
  if ((e = this.currentPages) != null && e.length)
91
82
  try {
92
- const t = this.currentPages[this.currentPreviewIndex], u = l().getThumbnailByTemplateId(t);
93
- if (!u) {
83
+ const t = this.currentPages[this.currentPreviewIndex], o = l().getThumbnailByTemplateId(t);
84
+ if (!o) {
94
85
  console.warn("[UnsubscribeControl] No thumbnail found for page:", t);
95
86
  return;
96
87
  }
97
88
  this.api.updateValues({
98
- [r.PREVIEW_IMAGE]: u
89
+ [r.PREVIEW_IMAGE]: o
99
90
  });
100
91
  } catch (t) {
101
92
  console.error("[UnsubscribeControl] Failed to update preview:", t);
102
93
  }
103
94
  }
104
95
  _updateCounter() {
105
- const e = this.currentPreviewIndex + 1, t = this.totalTemplates, o = this.currentPreviewIndex === 0, u = this.currentPreviewIndex >= t - 1;
106
- this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, o), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, u), this.api.setUIEAttribute(
96
+ const e = this.currentPreviewIndex + 1, t = this.totalTemplates, c = this.currentPreviewIndex === 0, o = this.currentPreviewIndex >= t - 1;
97
+ this.api.setUIEAttribute(r.PREV_BUTTON, i.BUTTON.disabled, c), this.api.setUIEAttribute(r.NEXT_BUTTON, i.BUTTON.disabled, o), this.api.setUIEAttribute(
107
98
  r.COUNTER_TEXT,
108
99
  i.LABEL.text,
109
100
  `${this.api.translate("Showing")} ${e} ${this.api.translate("of")} ${t}`
@@ -144,14 +135,14 @@ class w extends g {
144
135
  </${n.LABEL}>
145
136
  `;
146
137
  }
147
- _getIconButton(e, t, o) {
148
- const u = o ? `${i.BUTTON.disabled}="true"` : "";
138
+ _getIconButton(e, t, c) {
139
+ const o = c ? `${i.BUTTON.disabled}="true"` : "";
149
140
  return `
150
141
  <${n.BUTTON}
151
142
  id="${e}"
152
143
  class="flat-inline flat-white"
153
144
  ${i.BUTTON.name}="${e}"
154
- ${u}
145
+ ${o}
155
146
  >
156
147
  <${n.ICON}
157
148
  src="${t}"
@@ -175,5 +166,5 @@ class w extends g {
175
166
  }
176
167
  export {
177
168
  v as UNSUBSCRIBE_CONTROL_ID,
178
- w as UnsubscribeControl
169
+ B as UnsubscribeControl
179
170
  };
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-1b31027d]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-1b31027d]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-1b31027d]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-1b31027d]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-1b31027d]{object-fit:cover;transform:scale(1)}[data-v-811cff80] .guido__verion-history-view-option-selection-desktop svg,[data-v-811cff80] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-811cff80] .in-segments-wrapper__button_selected,[data-v-811cff80] .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-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .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}
@@ -4,3 +4,7 @@ export declare const CampaignCouldNotBeSavedKey = "newsletter.campaign-could-not
4
4
  export declare const DISPLAY_CONDITIONS_REGEX: RegExp;
5
5
  export declare const DISPLAY_CONDITIONS_EXCEPTIONS_REGEX: RegExp;
6
6
  export declare const REMOVE_CONDITIONS_REGEX: RegExp;
7
+ export declare const DYNAMIC_CONTENT_TAG_REGEX: RegExp;
8
+ export declare const DATA_ATTRIBUTE_REGEX: RegExp;
9
+ export declare const VALID_DYNAMIC_VARIABLE_REGEX: RegExp;
10
+ export declare const ALLOWED_DYNAMIC_SYSTEM_TOKENS: string[];
@@ -20,12 +20,6 @@ export declare class UnsubscribeBlock extends Block {
20
20
  onDestroy(): void;
21
21
  private _hasUnsubscribeLink;
22
22
  private _readBlockId;
23
- /**
24
- * True when the block has a page type and a page list — i.e. a template was
25
- * applied. A block with neither, combined with an already-present block id,
26
- * is an undo-restored orphan of a cancelled block.
27
- */
28
- private _hasPageSelection;
29
23
  /**
30
24
  * Returns the block's stable id, assigning one via the document modifier if
31
25
  * the node has not been tagged yet. Idempotent: subsequent calls during
@@ -15,7 +15,6 @@ export declare class UnsubscribeControl extends Control {
15
15
  private get totalTemplates();
16
16
  private _listenToFormUpdates;
17
17
  private _onButtonClick;
18
- private _reseedSelectionFromBlock;
19
18
  private _onPrevClick;
20
19
  private _onNextClick;
21
20
  private _loadAndUpdatePreview;
@@ -10,7 +10,6 @@ interface StoreState {
10
10
  typeSelectionDrawerStatus: boolean;
11
11
  isGlobalUnsubscribeDisabled: boolean;
12
12
  isSubscriptionPreferencesCenterDisabled: boolean;
13
- pendingBlockId: string | null;
14
13
  }
15
14
  export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guidoUnsubscribe", StoreState, {
16
15
  getSelectedCollection: (state: {
@@ -36,7 +35,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
36
35
  typeSelectionDrawerStatus: boolean;
37
36
  isGlobalUnsubscribeDisabled: boolean;
38
37
  isSubscriptionPreferencesCenterDisabled: boolean;
39
- pendingBlockId: string | null;
40
38
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => number[];
41
39
  getSelectedTemplateByActiveType: (state: {
42
40
  templates: {
@@ -61,7 +59,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
61
59
  typeSelectionDrawerStatus: boolean;
62
60
  isGlobalUnsubscribeDisabled: boolean;
63
61
  isSubscriptionPreferencesCenterDisabled: boolean;
64
- pendingBlockId: string | null;
65
62
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => number;
66
63
  getTemplatesByActiveType: (state: {
67
64
  templates: {
@@ -86,7 +83,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
86
83
  typeSelectionDrawerStatus: boolean;
87
84
  isGlobalUnsubscribeDisabled: boolean;
88
85
  isSubscriptionPreferencesCenterDisabled: boolean;
89
- pendingBlockId: string | null;
90
86
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
91
87
  id: number;
92
88
  name: string;
@@ -123,7 +119,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
123
119
  typeSelectionDrawerStatus: boolean;
124
120
  isGlobalUnsubscribeDisabled: boolean;
125
121
  isSubscriptionPreferencesCenterDisabled: boolean;
126
- pendingBlockId: string | null;
127
122
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => (id: number) => string;
128
123
  getSelectedUnsubscribePagesByCollection: (state: {
129
124
  templates: {
@@ -148,7 +143,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
148
143
  typeSelectionDrawerStatus: boolean;
149
144
  isGlobalUnsubscribeDisabled: boolean;
150
145
  isSubscriptionPreferencesCenterDisabled: boolean;
151
- pendingBlockId: string | null;
152
146
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => (collectionType: number) => number[];
153
147
  isActiveTypeFirstInCollection: (state: {
154
148
  templates: {
@@ -173,7 +167,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
173
167
  typeSelectionDrawerStatus: boolean;
174
168
  isGlobalUnsubscribeDisabled: boolean;
175
169
  isSubscriptionPreferencesCenterDisabled: boolean;
176
- pendingBlockId: string | null;
177
170
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
178
171
  isActiveTypeLastInCollection: (state: {
179
172
  templates: {
@@ -198,7 +191,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
198
191
  typeSelectionDrawerStatus: boolean;
199
192
  isGlobalUnsubscribeDisabled: boolean;
200
193
  isSubscriptionPreferencesCenterDisabled: boolean;
201
- pendingBlockId: string | null;
202
194
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
203
195
  hasTemplatesByCollectionType: (state: {
204
196
  templates: {
@@ -223,7 +215,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
223
215
  typeSelectionDrawerStatus: boolean;
224
216
  isGlobalUnsubscribeDisabled: boolean;
225
217
  isSubscriptionPreferencesCenterDisabled: boolean;
226
- pendingBlockId: string | null;
227
218
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => Record<number, boolean>;
228
219
  unsubscribePagesStatus: (state: {
229
220
  templates: {
@@ -248,11 +239,10 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
248
239
  typeSelectionDrawerStatus: boolean;
249
240
  isGlobalUnsubscribeDisabled: boolean;
250
241
  isSubscriptionPreferencesCenterDisabled: boolean;
251
- pendingBlockId: string | null;
252
242
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
253
243
  }, {
254
244
  $reset(): void;
255
- fetchTemplates(force?: boolean): Promise<void>;
245
+ fetchTemplates(): Promise<void>;
256
246
  setCollection(collectionType: number): void;
257
247
  setCollectionWithoutAutoSelection(collectionType: number): void;
258
248
  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 u } from "pinia";
3
+ import { defineStore as h } from "pinia";
4
4
  let o = null;
5
5
  const r = () => ({
6
6
  templates: [],
@@ -12,9 +12,8 @@ const r = () => ({
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
- isSubscriptionPreferencesCenterDisabled: !1,
16
- pendingBlockId: null
17
- }), b = u("guidoUnsubscribe", {
15
+ isSubscriptionPreferencesCenterDisabled: !1
16
+ }), b = h("guidoUnsubscribe", {
18
17
  state: () => r(),
19
18
  getters: {
20
19
  getSelectedCollection: (e) => i[e.selectedCollectionType],
@@ -63,10 +62,10 @@ const r = () => ({
63
62
  selectedUnsubscribePages: t
64
63
  });
65
64
  },
66
- async fetchTemplates(e = !1) {
67
- !e && this.templates.length || ((e || !o) && (o = (async () => {
68
- const { getUnsubscribePages: t } = d();
69
- this.templates = await t();
65
+ async fetchTemplates() {
66
+ this.templates.length || (o || (o = (async () => {
67
+ const { getUnsubscribePages: e } = d();
68
+ this.templates = await e();
70
69
  })().finally(() => {
71
70
  o = null;
72
71
  })), await o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.7.0-beta.a1aaf44",
3
+ "version": "3.7.0-beta.a8c44c1",
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",