@useinsider/guido 3.20.1-beta.da6efd5 → 3.20.1-beta.dfc8426

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.
@@ -22,7 +22,7 @@ var n = function() {
22
22
  s,
23
23
  !1,
24
24
  null,
25
- "23accd91"
25
+ "a4b2ccb9"
26
26
  );
27
27
  const f = d.exports;
28
28
  export {
@@ -10,9 +10,9 @@ import E from "./CodeEditorField.vue.js";
10
10
  const J = /* @__PURE__ */ D({
11
11
  __name: "DisplayConditionCreateDrawer",
12
12
  setup(Y) {
13
- const i = "email-editor.display-conditions", n = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
14
- C(() => c.isCreateOpen, (r) => {
15
- if (!r)
13
+ const r = "email-editor.display-conditions", i = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
14
+ C(() => c.isCreateOpen, (n) => {
15
+ if (!n)
16
16
  return;
17
17
  const { editing: t } = c;
18
18
  Object.assign(e, t ? {
@@ -22,39 +22,39 @@ const J = /* @__PURE__ */ D({
22
22
  codeAfter: t.afterScript
23
23
  } : d()), o.value = {}, a.value = !1;
24
24
  }, { immediate: !0 });
25
- const g = u(() => n(`${i}.create-description`, {
26
- academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${n(`${i}.academy`)}</a>`
25
+ const g = u(() => i(`${r}.create-description`, {
26
+ academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${i(`${r}.academy`)}</a>`
27
27
  })), S = u(() => ({
28
28
  cancelOrBackButton: {
29
29
  styling: "ghost",
30
30
  type: "secondary",
31
- labelText: n(`${i}.cancel`),
31
+ labelText: i(`${r}.cancel`),
32
32
  disabledStatus: a.value
33
33
  },
34
34
  secondaryButton: {
35
35
  styling: "solid",
36
36
  type: "subtle-primary",
37
- labelText: n(`${i}.create-and-save`),
37
+ labelText: i(`${r}.create-and-save`),
38
38
  loadingStatus: a.value
39
39
  },
40
40
  primaryButton: {
41
41
  styling: "solid",
42
42
  type: "primary",
43
- labelText: n(`${i}.create`),
43
+ labelText: i(`${r}.create`),
44
44
  disabledStatus: a.value
45
45
  }
46
- })), B = (r, t) => {
47
- t !== e[r] && (e[r] = t, o.value[r] && (o.value = { ...o.value, [r]: void 0 }));
48
- }, A = u(() => `${n(`${i}.condition-description`)} <span class="guido-display-condition-create__optional">(${n(`${i}.optional`)})</span>`);
49
- return { __sfc: !0, KEY: i, trans: n, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (r) => {
46
+ })), B = (n, t) => {
47
+ t !== e[n] && (e[n] = t, o.value[n] && (o.value = { ...o.value, [n]: void 0 }));
48
+ }, A = u(() => `${i(`${r}.condition-description`)} <span class="guido-display-condition-create__optional">(${i(`${r}.optional`)})</span>`);
49
+ return { __sfc: !0, KEY: r, trans: i, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (n) => {
50
50
  var I, b;
51
51
  if (a.value)
52
52
  return;
53
- if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e, r), Object.keys(o.value).length) {
53
+ if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e), Object.keys(o.value).length) {
54
54
  l();
55
55
  return;
56
56
  }
57
- if (r === "inline") {
57
+ if (n === "inline") {
58
58
  f({ ...e });
59
59
  return;
60
60
  }
@@ -1,13 +1,13 @@
1
1
  import a from "./DisplayConditionSelectDrawer.vue2.js";
2
2
  /* empty css */
3
- import d from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
3
+ import o from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var d = function() {
5
5
  var s = this, i = s._self._c, t = s._self._setupProxy;
6
- return i("div", { staticClass: "guido-display-condition-select-root" }, [i(t.WpDrawer, { attrs: { id: "guido__display-condition-select-drawer", "description-status": "", "class-name": "guido-display-condition-select-drawer", size: "large", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isSelectOpen, "title-text": t.trans(`${t.KEY}.select-title`) }, on: { cancelOrBackButtonEvent: t.cancel, onCloseEvent: t.cancel } }, [i("div", { staticClass: "guido-display-condition-select" }, [i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "disabled-status": t.store.listStatus !== "loaded" || !t.store.list.length, "label-status": !1, "placeholder-text": t.trans(`${t.KEY}.search`), "tooltip-status": !1, value: t.search }, on: { input: function(e) {
6
+ return i("div", { staticClass: "guido-display-condition-select-root" }, [i(t.WpDrawer, { attrs: { id: "guido__display-condition-select-drawer", "description-status": "", "class-name": "guido-display-condition-select-drawer", size: "large", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isSelectOpen, "title-text": t.trans(`${t.KEY}.select-title`) }, on: { cancelOrBackButtonEvent: t.cancel, onCloseEvent: t.cancel } }, [i("div", { staticClass: "guido-display-condition-select" }, [t.store.listStatus === "loaded" && t.store.list.length ? i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "label-status": !1, "placeholder-text": t.trans(`${t.KEY}.search`), "tooltip-status": !1, value: t.search }, on: { input: function(e) {
7
7
  t.search = e;
8
- } } }), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? i("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(3, function(e) {
9
- return i(t.InSkeleton, { key: e, attrs: { sizing: { width: 857, height: 78 } } });
10
- }), 1) : t.store.listStatus === "error" ? i(t.InNoData, { attrs: { id: "guido__display-condition-error", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.retry`), description: t.trans(`${t.KEY}.error-load`) }, on: { click: t.loadList } }) : t.store.list.length ? t.filteredList.length ? i("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(e) {
8
+ } } }) : s._e(), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? i("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(t.SKELETON_HEIGHTS, function(e, n) {
9
+ return i(t.InSkeleton, { key: n, attrs: { sizing: { width: 856, height: e } } });
10
+ }), 1) : t.store.listStatus === "error" ? i(t.InNoData, { attrs: { id: "guido__display-condition-error", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.retry`), description: t.trans(`${t.KEY}.error-load`), title: t.trans(`${t.KEY}.error-load-title`) }, on: { click: t.loadList } }) : t.store.list.length ? t.filteredList.length ? i("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(e) {
11
11
  return i("li", { key: e.id, staticClass: "guido-display-condition-card", attrs: { "data-condition-id": e.id } }, [i("div", { staticClass: "guido-display-condition-card__header" }, [i("div", { staticClass: "guido-display-condition-card__text" }, [i("p", { staticClass: "guido-display-condition-card__name" }, [s._v(" " + s._s(e.name) + " ")]), e.description ? i("p", { staticClass: "guido-display-condition-card__description" }, [s._v(" " + s._s(e.description) + " ")]) : s._e()]), i("div", { staticClass: "guido-display-condition-card__actions" }, [i("div", { staticClass: "guido-display-condition-card__split" }, [i(t.InButtonV2, { attrs: { id: `guido__display-condition-select-${e.id}`, type: "subtle-primary", "label-text": t.trans(`${t.KEY}.select`) }, on: { click: function(n) {
12
12
  return t.select(e);
13
13
  } } }), i(t.InButtonV2, { attrs: { id: `guido__display-condition-menu-${e.id}`, "left-icon": "filled-dropdown-down", type: "subtle-primary", "label-text-status": !1 }, on: { click: function(n) {
@@ -17,16 +17,16 @@ var o = function() {
17
17
  } } }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete`)) + " ")])]) : s._e()], 1), i("span", { staticClass: "guido-display-condition-card__divider" }), i("button", { staticClass: "guido-display-condition-card__expand", attrs: { id: `guido__display-condition-expand-${e.id}`, type: "button", "aria-expanded": t.expandedId === e.id ? "true" : "false", "aria-label": t.trans(`${t.KEY}.preview`) }, on: { click: function(n) {
18
18
  return t.toggleExpanded(e);
19
19
  } } }, [i(t.InIcons, { attrs: { name: t.expandedId === e.id ? "filled-dropdown-up" : "filled-dropdown-down" } })], 1)])]), t.expandedId === e.id ? i("pre", { staticClass: "guido-display-condition-card__code" }, [s._v(s._s(t.codeOf(e)))]) : s._e()]);
20
- }), 0) : i(t.InNoData, { attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.create-new`), description: t.trans(`${t.KEY}.empty-description`), title: t.trans(`${t.KEY}.empty-title`) }, on: { click: function(e) {
20
+ }), 0) : i(t.InNoData, { attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-personalization", "button-text": t.trans(`${t.KEY}.create-new`), description: t.trans(`${t.KEY}.empty-description`), title: t.trans(`${t.KEY}.empty-title`) }, on: { click: function(e) {
21
21
  return t.store.openCreate();
22
22
  } } })], 1)]), t.store.pendingDelete ? i("div", { staticClass: "guido-display-condition-select__delete-modal" }, [i(t.WpModal, { attrs: { id: "guido__display-condition-delete-modal", size: "X-small", state: "danger", "close-on-outside-click": !1, "footer-button-options": t.deleteModalButtons, title: t.trans(`${t.KEY}.delete-confirm-title`) }, on: { close: t.closeDeleteModal, "primary-action": t.confirmDelete } }, [i("p", { staticClass: "guido-display-condition-select__delete-text" }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete-confirm-description`, { name: t.store.pendingDelete.name })) + " ")])])], 1) : s._e()], 1);
23
- }, l = [], c = /* @__PURE__ */ d(
23
+ }, l = [], c = /* @__PURE__ */ o(
24
24
  a,
25
- o,
25
+ d,
26
26
  l,
27
27
  !1,
28
28
  null,
29
- "2561eb6a"
29
+ "10ac7a13"
30
30
  );
31
31
  const y = c.exports;
32
32
  export {
@@ -1,31 +1,31 @@
1
- import { defineComponent as I, ref as i, watch as _, computed as r } from "vue";
1
+ import { defineComponent as _, ref as i, watch as S, computed as c } from "vue";
2
2
  import B from "../../wrappers/WpDrawer.vue.js";
3
3
  import L from "../../wrappers/WpModal.vue.js";
4
- import { useDisplayConditions as S } from "../../../composables/useDisplayConditions.js";
5
- import { useTranslations as x } from "../../../composables/useTranslations.js";
6
- import { ACADEMY_LINKS as $ } from "../../../enums/academy.js";
7
- import { useDisplayConditionStore as C } from "../../../stores/display-condition.js";
8
- import { InSkeleton as M, InNoData as O, InIcons as T, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
9
- const H = /* @__PURE__ */ I({
4
+ import { useDisplayConditions as x } from "../../../composables/useDisplayConditions.js";
5
+ import { useTranslations as O } from "../../../composables/useTranslations.js";
6
+ import { ACADEMY_LINKS as T } from "../../../enums/academy.js";
7
+ import { useDisplayConditionStore as $ } from "../../../stores/display-condition.js";
8
+ import { InSkeleton as C, InNoData as E, InIcons as M, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
9
+ const J = /* @__PURE__ */ _({
10
10
  __name: "DisplayConditionSelectDrawer",
11
11
  setup(h) {
12
- const o = "email-editor.display-conditions", l = x(), t = C(), { loadList: d, select: m, deleteSaved: u, cancel: f } = S(), c = i(""), s = i(null), a = i(null), n = i(!1);
13
- _(() => t.isSelectOpen, (e) => {
14
- e && (c.value = "", s.value = null, a.value = null, d());
12
+ const o = "email-editor.display-conditions", m = [40, 76, 76, 76], l = O(), t = $(), { loadList: d, select: f, deleteSaved: u, cancel: g } = x(), r = i(""), s = i(null), a = i(null), n = i(!1);
13
+ S(() => t.isSelectOpen, (e) => {
14
+ e && (r.value = "", s.value = null, a.value = null, d());
15
15
  }, { immediate: !0 });
16
- const g = r(() => {
17
- const e = c.value.trim().toLocaleLowerCase();
16
+ const D = c(() => {
17
+ const e = r.value.trim().toLocaleLowerCase();
18
18
  return e ? t.list.filter((p) => `${p.name} ${p.description}`.toLocaleLowerCase().includes(e)) : t.list;
19
- }), D = r(() => l(`${o}.select-description`, {
20
- academyLink: `<a href="${$.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${l(`${o}.academy`)}</a>`
21
- })), v = r(() => ({
19
+ }), v = c(() => l(`${o}.select-description`, {
20
+ academyLink: `<a href="${T.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${l(`${o}.academy`)}</a>`
21
+ })), y = c(() => ({
22
22
  cancelOrBackButton: {
23
23
  styling: "ghost",
24
24
  type: "secondary",
25
25
  labelText: l(`${o}.back`),
26
26
  leftIcon: "line-arrow-left"
27
27
  }
28
- })), y = r(() => ({
28
+ })), I = c(() => ({
29
29
  cancelOrBackButton: {
30
30
  type: "secondary",
31
31
  styling: "ghost",
@@ -38,7 +38,7 @@ const H = /* @__PURE__ */ I({
38
38
  loadingStatus: n.value
39
39
  }
40
40
  }));
41
- return { __sfc: !0, KEY: o, trans: l, store: t, loadList: d, select: m, deleteSaved: u, cancel: f, search: c, expandedId: s, menuId: a, isDeleting: n, filteredList: g, descriptionText: D, footerButtonGroupOptions: v, deleteModalButtons: y, toggleExpanded: (e) => {
41
+ return { __sfc: !0, KEY: o, SKELETON_HEIGHTS: m, trans: l, store: t, loadList: d, select: f, deleteSaved: u, cancel: g, search: r, expandedId: s, menuId: a, isDeleting: n, filteredList: D, descriptionText: v, footerButtonGroupOptions: y, deleteModalButtons: I, toggleExpanded: (e) => {
42
42
  s.value = s.value === e.id ? null : e.id;
43
43
  }, toggleMenu: (e) => {
44
44
  a.value = a.value === e.id ? null : e.id;
@@ -49,9 +49,9 @@ const H = /* @__PURE__ */ I({
49
49
  }, closeDeleteModal: () => {
50
50
  n.value || (t.pendingDelete = null);
51
51
  }, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
52
- `), WpDrawer: B, WpModal: L, InBasicTextInput: k, InButtonV2: b, InIcons: T, InNoData: O, InSkeleton: M };
52
+ `), WpDrawer: B, WpModal: L, InBasicTextInput: k, InButtonV2: b, InIcons: M, InNoData: E, InSkeleton: C };
53
53
  }
54
54
  });
55
55
  export {
56
- H as default
56
+ J as default
57
57
  };
@@ -1,105 +1,96 @@
1
- import { useToaster as x } from "./useToaster.js";
2
- import { useTranslations as M } from "./useTranslations.js";
3
- import { DISPLAY_CONDITION_LIMITS as r, DisplayConditionEvent as E } from "../enums/display-condition.js";
4
- import { ToasterTypeOptions as l } from "../enums/toaster.js";
5
- import { useDisplayConditionApi as N } from "../services/displayConditionApi.js";
6
- import { useConfigStore as T } from "../stores/config.js";
1
+ import { useToaster as T } from "./useToaster.js";
2
+ import { useTranslations as x } from "./useTranslations.js";
3
+ import { DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as S } from "../enums/display-condition.js";
4
+ import { ToasterTypeOptions as d } from "../enums/toaster.js";
5
+ import { useDisplayConditionApi as M } from "../services/displayConditionApi.js";
6
+ import { useConfigStore as N } from "../stores/config.js";
7
7
  import { useDisplayConditionStore as _ } from "../stores/display-condition.js";
8
- import { parseSource as O, findInvalidCodeFields as B } from "../utils/displayCondition.js";
9
- import { escapeHtml as L } from "../utils/htmlEscape.js";
10
- import { computed as X } from "vue";
11
- const i = "email-editor.display-conditions", y = (n, f, a) => ({
12
- id: f,
8
+ import { findInvalidCodeFields as O, nextConditionId as L } from "../utils/displayCondition.js";
9
+ import { escapeHtml as B } from "../utils/htmlEscape.js";
10
+ import { computed as P } from "vue";
11
+ const i = "email-editor.display-conditions", X = 409, y = (n, p, r) => ({
12
+ id: L(),
13
13
  name: n.name.trim(),
14
14
  description: n.description.trim(),
15
15
  beforeScript: n.codeBefore,
16
16
  afterScript: n.codeAfter,
17
- extraData: JSON.stringify({ source: a })
18
- }), Q = () => {
19
- const n = _(), f = T(), a = N(), o = M(), { showToaster: c } = x(), p = X(() => {
17
+ extraData: JSON.stringify(r === void 0 ? { source: p } : { source: p, savedId: r })
18
+ }), C = (n) => ({
19
+ name: n.name,
20
+ description: n.description,
21
+ codeBefore: n.codeBefore,
22
+ codeAfter: n.codeAfter
23
+ }), U = () => {
24
+ const n = _(), p = N(), r = M(), o = x(), { showToaster: a } = T(), u = P(() => {
20
25
  var e;
21
- return (e = f.features) != null && e.liquidSyntax ? "liquid" : "pongo";
22
- }), v = (e) => {
26
+ return (e = p.features) != null && e.liquidSyntax ? "liquid" : "pongo";
27
+ }), f = (e) => {
23
28
  const t = { condition: e };
24
- document.dispatchEvent(new CustomEvent(E.APPLY, { detail: t })), n.close();
25
- }, g = () => {
26
- n.view !== "none" && (document.dispatchEvent(new CustomEvent(E.CANCEL)), n.close());
27
- }, C = (e) => {
29
+ document.dispatchEvent(new CustomEvent(S.APPLY, { detail: t })), n.close();
30
+ }, E = () => {
31
+ n.view !== "none" && (document.dispatchEvent(new CustomEvent(S.CANCEL)), n.close());
32
+ }, $ = (e) => {
28
33
  if (e.mode === "select") {
29
34
  n.openSelect();
30
35
  return;
31
36
  }
32
37
  n.openCreate(e.mode === "edit" ? e.current : null);
33
- }, $ = async () => {
38
+ }, g = async () => {
34
39
  n.listStatus = "loading";
35
40
  try {
36
- const e = await a.list(p.value);
37
- n.list = e.data, n.listStatus = "loaded";
41
+ n.list = await r.list(u.value), n.listStatus = "loaded";
38
42
  } catch (e) {
39
43
  console.warn("Display conditions could not be loaded.", e), n.listStatus = "error";
40
44
  }
41
- }, h = (e, t) => {
42
- const s = {}, u = e.name.trim();
43
- t === "save" && !u ? s.name = o(`${i}.error-name-required`) : u && u.length < r.NAME_MIN ? s.name = o(`${i}.error-name-min`, { min: r.NAME_MIN }) : u.length > r.NAME_MAX && (s.name = o(`${i}.error-name-max`, { max: r.NAME_MAX }));
44
- const { DESCRIPTION_MAX: S } = r;
45
- e.description.trim().length > S && (s.description = o(`${i}.error-description-max`, { max: S }));
46
- const I = B(e.codeBefore, e.codeAfter);
47
- return ["codeBefore", "codeAfter"].forEach((d) => {
48
- e[d].trim() ? I.includes(d) ? s[d] = o(`${i}.error-code-invalid`) : e[d].length > r.CODE_MAX && (s[d] = o(`${i}.error-code-max`, { max: r.CODE_MAX })) : s[d] = o(`${i}.error-code-required`);
49
- }), s;
50
- }, D = () => {
51
- c({ type: l.Error, message: o(`${i}.validation-failed`) });
52
- }, m = (e) => ({ name: L(e) }), A = (e, t) => {
53
- e != null && e.authReported || (console.warn(t, e), c({ type: l.Error, message: t }));
45
+ }, h = (e) => {
46
+ const t = {}, m = e.name.trim();
47
+ m ? m.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : m.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
48
+ const { DESCRIPTION_MAX: A } = s;
49
+ e.description.trim().length > A && (t.description = o(`${i}.error-description-max`, { max: A }));
50
+ const D = O(e.codeBefore, e.codeAfter);
51
+ return ["codeBefore", "codeAfter"].forEach((c) => {
52
+ e[c].trim() ? D.includes(c) ? t[c] = o(`${i}.error-code-invalid`) : e[c].length > s.CODE_MAX && (t[c] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[c] = o(`${i}.error-code-required`);
53
+ }), t;
54
+ }, I = () => {
55
+ a({ type: d.Error, message: o(`${i}.validation-failed`) });
56
+ }, l = (e) => ({ name: B(e) }), v = (e, t) => {
57
+ e != null && e.authReported || (console.warn(t, e), a({ type: d.Error, message: t }));
54
58
  };
55
59
  return {
56
- syntax: p,
57
- handleOpen: C,
58
- cancel: g,
59
- loadList: $,
60
+ syntax: u,
61
+ handleOpen: $,
62
+ cancel: E,
63
+ loadList: g,
60
64
  validate: h,
61
- notifyInvalid: D,
65
+ notifyInvalid: I,
62
66
  createInline: (e) => {
63
- const t = n.editing && O(n.editing) === "inline" ? n.editing.id : Date.now();
64
- v(y(e, t, "inline")), c({
65
- type: l.Success,
66
- message: o(`${i}.created`, m(e.name.trim()))
67
+ f(y(e, "inline")), a({
68
+ type: d.Success,
69
+ message: o(`${i}.created`, l(e.name.trim()))
67
70
  });
68
71
  },
69
72
  createAndSave: async (e) => {
70
73
  try {
71
- if (await a.nameExists(e.name, p.value))
72
- return { name: o(`${i}.error-name-exists`) };
73
- const t = await a.create(e, p.value);
74
- return n.list = [t, ...n.list.filter((s) => s.id !== t.id)], v(y({
75
- name: t.name,
76
- description: t.description,
77
- codeBefore: t.codeBefore,
78
- codeAfter: t.codeAfter
79
- }, t.id, "saved")), c({
80
- type: l.Success,
81
- message: o(`${i}.created-and-saved`, m(t.name))
74
+ const t = await r.create(e, u.value);
75
+ return n.list = [t, ...n.list.filter((m) => m.id !== t.id)], f(y(C(t), "saved", t.id)), a({
76
+ type: d.Success,
77
+ message: o(`${i}.created-and-saved`, l(t.name))
82
78
  }), {};
83
79
  } catch (t) {
84
- return A(t, o(`${i}.save-failed`, m(e.name.trim()))), null;
80
+ return (t == null ? void 0 : t.status) === X ? { name: o(`${i}.error-name-exists`) } : (v(t, o(`${i}.save-failed`, l(e.name.trim()))), null);
85
81
  }
86
82
  },
87
83
  select: (e) => {
88
- v(y({
89
- name: e.name,
90
- description: e.description,
91
- codeBefore: e.codeBefore,
92
- codeAfter: e.codeAfter
93
- }, e.id, "saved")), c({ type: l.Success, message: o(`${i}.applied`, m(e.name)) });
84
+ f(y(C(e), "saved", e.id)), a({ type: d.Success, message: o(`${i}.applied`, l(e.name)) });
94
85
  },
95
86
  deleteSaved: async (e) => {
96
87
  try {
97
- await a.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), c({
98
- type: l.Success,
99
- message: o(`${i}.deleted`, m(e.name))
88
+ await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), a({
89
+ type: d.Success,
90
+ message: o(`${i}.deleted`, l(e.name))
100
91
  });
101
92
  } catch (t) {
102
- A(t, o(`${i}.delete-failed`));
93
+ v(t, o(`${i}.delete-failed`));
103
94
  } finally {
104
95
  n.pendingDelete = null;
105
96
  }
@@ -107,5 +98,5 @@ const i = "email-editor.display-conditions", y = (n, f, a) => ({
107
98
  };
108
99
  };
109
100
  export {
110
- Q as useDisplayConditions
101
+ U as useDisplayConditions
111
102
  };
@@ -1,19 +1,20 @@
1
- var $ = Object.defineProperty;
2
- var S = (d, s, t) => s in d ? $(d, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[s] = t;
3
- var h = (d, s, t) => S(d, typeof s != "symbol" ? s + "" : s, t);
4
- import { CommonControl as O } from "../Blocks/common-control.js";
5
- import { parseSource as N } from "../../utils/displayCondition.js";
6
- import { escapeHtml as C } from "../../utils/htmlEscape.js";
7
- import { ModificationDescription as D, UIElementType as b, UEAttr as w } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { requestDisplayCondition as I } from "./bridge.js";
9
- import { CONDITIONS_CONTROL_ID as x, APPLIED_DESCRIPTION as E, EMPTY_DESCRIPTION as T, MAX_COLLAPSED_LINES as v, CONDITION_ICONS as g } from "./constants.js";
10
- const p = ".guido-display-conditions", M = { id: 0, name: "", description: "", beforeScript: "", afterScript: "" }, _ = (d) => `<${b.ICON} ${w.ICON.src}="${d}"></${b.ICON}>`, l = (d, s, t, i = !1) => `<button type="button" class="${s}" id="${d}"${i ? " hidden" : ""}>${t}</button>`;
11
- class B extends O {
1
+ var O = Object.defineProperty;
2
+ var $ = (o, s, i) => s in o ? O(o, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[s] = i;
3
+ var u = (o, s, i) => $(o, typeof s != "symbol" ? s + "" : s, i);
4
+ import { CommonControl as S } from "../Blocks/common-control.js";
5
+ import { toAppliedCondition as w, parseSource as N } from "../../utils/displayCondition.js";
6
+ import { escapeHtml as f } from "../../utils/htmlEscape.js";
7
+ import { ModificationDescription as D, UIElementType as b, UEAttr as I } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
+ import { requestDisplayCondition as E } from "./bridge.js";
9
+ import { CONDITIONS_CONTROL_ID as x, APPLIED_DESCRIPTION as M, EMPTY_DESCRIPTION as T, MAX_COLLAPSED_LINES as v, CONDITION_ICONS as g } from "./constants.js";
10
+ const r = ".guido-display-conditions", L = { id: 0, name: "", description: "", beforeScript: "", afterScript: "" }, _ = (o) => `<${b.ICON} ${I.ICON.src}="${o}"></${b.ICON}>`, c = (o, s, i, t = !1) => `<button type="button" class="${s}" id="${o}"${t ? " hidden" : ""}>${i}</button>`;
11
+ class B extends S {
12
12
  constructor() {
13
13
  super(...arguments);
14
- h(this, "expanded", !1);
15
- h(this, "listeners", []);
16
- h(this, "resizeObserver", null);
14
+ u(this, "expanded", !1);
15
+ u(this, "listeners", []);
16
+ u(this, "resizeObserver", null);
17
+ u(this, "detachOutsideClick", null);
17
18
  }
18
19
  getId() {
19
20
  return x;
@@ -26,18 +27,18 @@ class B extends O {
26
27
  <p class="guido-display-conditions__description" data-dc-description></p>
27
28
  </div>
28
29
  <div class="guido-display-conditions__empty" data-dc-empty>
29
- ${l(
30
+ ${c(
30
31
  "guido__btn-add-display-condition",
31
32
  "guido-display-conditions__add",
32
33
  `${_(g.PLUS)}<span>${this.api.translate("Add Display Condition")}</span>`
33
34
  )}
34
35
  <div class="guido-display-conditions__menu" data-dc-menu hidden>
35
- ${l(
36
+ ${c(
36
37
  "guido__btn-display-condition-create",
37
38
  "guido-display-conditions__menu-item",
38
39
  this.api.translate("Create New Condition")
39
40
  )}
40
- ${l(
41
+ ${c(
41
42
  "guido__btn-display-condition-select",
42
43
  "guido-display-conditions__menu-item",
43
44
  this.api.translate("Select Saved Condition")
@@ -57,7 +58,7 @@ class B extends O {
57
58
  </p>
58
59
  <pre class="guido-display-conditions__code" data-dc-after></pre>
59
60
  </div>
60
- ${l(
61
+ ${c(
61
62
  "guido__btn-display-condition-toggle",
62
63
  "guido-display-conditions__toggle",
63
64
  `${_(g.CHEVRON)}<span data-dc-toggle-label></span>`,
@@ -65,12 +66,12 @@ class B extends O {
65
66
  )}
66
67
  </div>
67
68
  <div class="guido-display-conditions__actions">
68
- ${l(
69
+ ${c(
69
70
  "guido__btn-edit-display-condition",
70
71
  "guido-display-conditions__action guido-display-conditions__action--edit",
71
72
  `${_(g.EDIT)}<span>${this.api.translate("Edit")}</span>`
72
73
  )}
73
- ${l(
74
+ ${c(
74
75
  "guido__btn-remove-display-condition",
75
76
  "guido-display-conditions__action guido-display-conditions__action--remove",
76
77
  `${_(g.TRASH)}<span>${this.api.translate("Remove")}</span>`
@@ -85,82 +86,90 @@ class B extends O {
85
86
  this.expanded = !this.expanded, this.paint();
86
87
  }), this.observeCodeSize(), this.paint();
87
88
  }
88
- onTemplateNodeUpdated(t) {
89
- const i = t !== this.currentNode;
90
- super.onTemplateNodeUpdated(t), i && (this.expanded = !1), this.paint();
89
+ onTemplateNodeUpdated(i) {
90
+ const t = i !== this.currentNode;
91
+ super.onTemplateNodeUpdated(i), t && (this.expanded = !1, this.toggleMenu(!1)), this.paint();
91
92
  }
92
93
  onDestroy() {
93
94
  super.onDestroy(), this.teardown();
94
95
  }
95
96
  getCondition() {
96
- var e;
97
- const t = this.currentNode, i = (e = t == null ? void 0 : t.getDisplayCondition) == null ? void 0 : e.call(t);
98
- return !i || !(i.name || i.beforeScript || i.afterScript) ? null : { ...i, description: i.description ?? "" };
97
+ var t;
98
+ const i = this.currentNode;
99
+ return w((t = i == null ? void 0 : i.getDisplayCondition) == null ? void 0 : t.call(i));
99
100
  }
100
- toggleMenu(t) {
101
- var n, o;
102
- const i = (n = this.getContainer()) == null ? void 0 : n.querySelector(`${p} [data-dc-menu]`);
103
- if (!i)
101
+ toggleMenu(i) {
102
+ var n, d, a;
103
+ const t = (n = this.getContainer()) == null ? void 0 : n.querySelector(`${r} [data-dc-menu]`);
104
+ if (!t)
104
105
  return;
105
- i.hidden = t === void 0 ? !i.hidden : !t;
106
- const e = (o = this.getContainer()) == null ? void 0 : o.querySelector(`${p} #guido__btn-add-display-condition`);
107
- i.style.width = !i.hidden && e ? `${e.getBoundingClientRect().width}px` : "";
108
- }
109
- openDrawer(t) {
110
- this.toggleMenu(!1), I(
111
- { mode: t, current: t === "edit" ? this.getCondition() : null },
112
- { onApply: (i) => this.applyCondition(i) }
106
+ t.hidden = i === void 0 ? !t.hidden : !i, (d = this.detachOutsideClick) == null || d.call(this), t.hidden || this.listenOutsideClick();
107
+ const e = (a = this.getContainer()) == null ? void 0 : a.querySelector(`${r} #guido__btn-add-display-condition`);
108
+ t.style.width = !t.hidden && e ? `${e.getBoundingClientRect().width}px` : "";
109
+ }
110
+ listenOutsideClick() {
111
+ const i = this.getContainer(), t = (e) => {
112
+ e.composedPath().some((d) => d instanceof HTMLElement && d.matches(`${r} [data-dc-menu], ${r} #guido__btn-add-display-condition`)) || this.toggleMenu(!1);
113
+ };
114
+ i == null || i.addEventListener("pointerdown", t, !0), this.detachOutsideClick = () => {
115
+ i == null || i.removeEventListener("pointerdown", t, !0), this.detachOutsideClick = null;
116
+ };
117
+ }
118
+ openDrawer(i) {
119
+ this.toggleMenu(!1), E(
120
+ { mode: i, current: i === "edit" ? this.getCondition() : null },
121
+ { onApply: (t) => this.applyCondition(t) }
113
122
  );
114
123
  }
115
- applyCondition(t) {
124
+ applyCondition(i) {
116
125
  if (!this.currentNode)
117
126
  return;
118
- const i = this.api.getDocumentModifier().modifyHtml(this.currentNode);
119
- t ? i.setDisplayCondition(t) : i.setDisplayCondition(M), i.apply(new D(
120
- t ? `Set display condition ${t.name}` : "Remove display condition"
127
+ const t = this.api.getDocumentModifier().modifyHtml(this.currentNode);
128
+ i ? t.setDisplayCondition(i) : t.setDisplayCondition(L), t.apply(new D(
129
+ i ? `Set display condition ${i.name}` : "Remove display condition"
121
130
  ));
122
131
  }
123
- wire(t, i) {
132
+ wire(i, t) {
124
133
  var n;
125
- const e = (n = this.getContainer()) == null ? void 0 : n.querySelector(`${p} ${t}`);
126
- e && (e.addEventListener("click", i), this.listeners.push({ element: e, handler: i }));
134
+ const e = (n = this.getContainer()) == null ? void 0 : n.querySelector(`${r} ${i}`);
135
+ e && (e.addEventListener("click", t), this.listeners.push({ element: e, handler: t }));
127
136
  }
128
137
  teardown() {
129
- var t;
130
- this.listeners.forEach(({ element: i, handler: e }) => i.removeEventListener("click", e)), this.listeners = [], (t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = null;
138
+ var i, t;
139
+ this.listeners.forEach(({ element: e, handler: n }) => e.removeEventListener("click", n)), this.listeners = [], (i = this.resizeObserver) == null || i.disconnect(), this.resizeObserver = null, (t = this.detachOutsideClick) == null || t.call(this);
131
140
  }
132
141
  // Line counts depend on layout: the panel font loads late and the panel can be resized.
133
142
  observeCodeSize() {
134
- var i;
135
- const t = (i = this.getContainer()) == null ? void 0 : i.querySelectorAll(`${p} .guido-display-conditions__code`);
136
- !(t != null && t.length) || typeof ResizeObserver > "u" || (this.resizeObserver = new ResizeObserver(() => this.paint()), t.forEach((e) => {
143
+ var t;
144
+ const i = (t = this.getContainer()) == null ? void 0 : t.querySelectorAll(`${r} .guido-display-conditions__code`);
145
+ !(i != null && i.length) || typeof ResizeObserver > "u" || (this.resizeObserver = new ResizeObserver(() => this.paint()), i.forEach((e) => {
137
146
  var n;
138
147
  return (n = this.resizeObserver) == null ? void 0 : n.observe(e);
139
148
  }));
140
149
  }
141
150
  paint() {
142
- var f;
143
- const t = (f = this.getContainer()) == null ? void 0 : f.querySelector(p);
144
- if (!t)
151
+ var C;
152
+ const i = (C = this.getContainer()) == null ? void 0 : C.querySelector(r);
153
+ if (!i)
145
154
  return;
146
- const i = this.getCondition(), e = (u) => t.querySelector(u);
147
- if (e("[data-dc-empty]").hidden = !!i, e("[data-dc-applied]").hidden = !i, e("[data-dc-description]").textContent = this.api.translate(i ? E : T), !i)
155
+ const t = this.getCondition(), e = (h) => i.querySelector(h);
156
+ if (e("[data-dc-empty]").hidden = !!t, e("[data-dc-applied]").hidden = !t, e("[data-dc-description]").textContent = this.api.translate(t ? M : T), !t)
148
157
  return;
149
- e("[data-dc-name]").textContent = i.name, e("#guido__btn-edit-display-condition").hidden = N(i) !== "inline";
150
- const n = e("[data-dc-sections]"), o = e("[data-dc-before]"), a = e("[data-dc-after]");
151
- o.innerHTML = C(i.beforeScript), a.innerHTML = C(i.afterScript), a.hidden = !i.afterScript, e("[data-dc-after-label]").hidden = !i.afterScript, n.style.maxHeight = "";
152
- const r = parseFloat(getComputedStyle(o).lineHeight) || 24, c = (u) => u.hidden ? 0 : Math.round(u.scrollHeight / r), y = c(o) + c(a) > v, m = e("#guido__btn-display-condition-toggle");
153
- m.hidden = !y, m.classList.toggle("is-expanded", this.expanded), e("[data-dc-toggle-label]").textContent = this.api.translate(this.expanded ? "Show Less" : "Show More"), y && !this.expanded && (n.style.maxHeight = `${this.collapsedHeight(n, [o, a], r)}px`);
158
+ e("[data-dc-name]").textContent = t.name, e("#guido__btn-edit-display-condition").hidden = N(t) !== "inline";
159
+ const n = e("[data-dc-sections]"), d = e("[data-dc-before]"), a = e("[data-dc-after]");
160
+ d.innerHTML = f(t.beforeScript), a.innerHTML = f(t.afterScript), a.hidden = !t.afterScript, e("[data-dc-after-label]").hidden = !t.afterScript, n.style.maxHeight = "";
161
+ const l = parseFloat(getComputedStyle(d).lineHeight) || 24, p = (h) => h.hidden ? 0 : Math.round(h.scrollHeight / l), y = p(d) + p(a) > v, m = e("#guido__btn-display-condition-toggle");
162
+ m.hidden = !y, m.classList.toggle("is-expanded", this.expanded), e("[data-dc-toggle-label]").textContent = this.api.translate(this.expanded ? "Show Less" : "Show More"), y && !this.expanded && (n.style.maxHeight = `${this.collapsedHeight(n, [d, a], l)}px`);
154
163
  }
155
164
  // Labels do not count toward the line limit, so the cut lands after the 10th rendered code line.
156
- collapsedHeight(t, i, e) {
157
- const { top: n } = t.getBoundingClientRect();
158
- let o = v, a = 0;
159
- return i.filter((r) => !r.hidden).forEach((r) => {
160
- if (o <= 0)
165
+ collapsedHeight(i, t, e) {
166
+ const { top: n } = i.getBoundingClientRect();
167
+ let d = v, a = 0;
168
+ return t.filter((l) => !l.hidden).forEach((l) => {
169
+ if (d <= 0)
161
170
  return;
162
- const c = Math.min(o, Math.round(r.scrollHeight / e));
163
- a = r.getBoundingClientRect().top - n + c * e, o -= c;
171
+ const p = Math.min(d, Math.round(l.scrollHeight / e));
172
+ a = l.getBoundingClientRect().top - n + p * e, d -= p;
164
173
  }), a;
165
174
  }
166
175
  }
@@ -1,15 +1,17 @@
1
- import { ExternalDisplayConditionsLibrary as r } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { requestDisplayCondition as o } from "./bridge.js";
3
- class p extends r {
1
+ import { toAppliedCondition as s, parseSource as a } from "../../utils/displayCondition.js";
2
+ import { ExternalDisplayConditionsLibrary as l } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { requestDisplayCondition as p } from "./bridge.js";
4
+ class m extends l {
4
5
  getCategoryName() {
5
6
  return this.api.translate("Insider Display Conditions");
6
7
  }
7
- openExternalDisplayConditionsDialog(t, i, e) {
8
- o(
9
- { mode: t ? "edit" : "select", current: t ?? null },
8
+ openExternalDisplayConditionsDialog(o, r, t) {
9
+ const e = s(o), n = a(e) === "inline";
10
+ p(
11
+ { mode: n ? "edit" : "select", current: n ? e : null },
10
12
  {
11
- onApply: (n) => n ? i(n) : e(),
12
- onCancel: e
13
+ onApply: (i) => i ? r(i) : t(),
14
+ onCancel: t
13
15
  }
14
16
  );
15
17
  }
@@ -21,5 +23,5 @@ class p extends r {
21
23
  }
22
24
  }
23
25
  export {
24
- p as DisplayConditionsLibrary
26
+ m as DisplayConditionsLibrary
25
27
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .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-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__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-2cccbd44]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-c5ff3804]{gap:16px}.validation-error-row[data-v-c5ff3804]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-c5ff3804]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-c5ff3804]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-22e84203]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-22e84203]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-22e84203]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.guido-code-editor-field__label[data-v-e96c7aa3]{margin:0 0 8px;color:#2c3546;font-size:13px;line-height:16px}[data-v-23accd91] .guido-display-condition-academy{color:#0a2ecc;text-decoration:underline}[data-v-23accd91] .guido-display-condition-create__optional{color:#666}.guido-display-condition-create__separator[data-v-23accd91]{height:1px;margin:0 0 24px;background-image:linear-gradient(to right,#91949F 1px,transparent 1px);background-size:5px 1px}.guido-display-condition-create__method-title[data-v-23accd91]{margin:0 0 24px;color:#292929;font-size:13px;font-weight:600;letter-spacing:1.2px;line-height:20px;text-transform:uppercase}.guido-display-condition-create__methods[data-v-23accd91]{display:flex;gap:16px;margin-bottom:24px}[data-v-2561eb6a] .guido-display-condition-academy{color:#0a2ecc;text-decoration:underline}.guido-display-condition-select-root[data-v-2561eb6a] .in-drawer__footer{justify-content:flex-start}.guido-display-condition-select__delete-modal[data-v-2561eb6a]{position:relative;z-index:145}.guido-display-condition-select__delete-modal[data-v-2561eb6a] .in-modal-v2-wrapper__header-title{margin-bottom:0}.guido-display-condition-select__delete-text[data-v-2561eb6a]{margin:0;color:#292929}.guido-display-condition-select__list[data-v-2561eb6a]{display:flex;flex-direction:column;gap:24px;margin:0;padding:0;list-style:none}.guido-display-condition-card[data-v-2561eb6a]{border:1px solid #E1E1E1;border-radius:4px;background-color:#fff}.guido-display-condition-card__header[data-v-2561eb6a]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px}.guido-display-condition-card__text[data-v-2561eb6a]{min-width:0}.guido-display-condition-card__name[data-v-2561eb6a]{margin:0;overflow:hidden;color:#292929;font-size:16px;font-weight:600;line-height:24px;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__description[data-v-2561eb6a]{margin:4px 0 0;overflow:hidden;color:#666;font-size:13px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__actions[data-v-2561eb6a]{display:flex;flex-shrink:0;align-items:center;gap:16px}.guido-display-condition-card__split[data-v-2561eb6a]{position:relative;display:flex;gap:1px}.guido-display-condition-card__menu[data-v-2561eb6a]{position:absolute;z-index:2;top:calc(100% + 2px);right:0;min-width:115px;padding:4px 0;border-radius:4px;background-color:#fff;box-shadow:0 4px 16px #22293829}.guido-display-condition-card__menu-item[data-v-2561eb6a]{width:100%;padding:8px 16px;border:0;background:none;color:#222938;cursor:pointer;font-size:14px;line-height:24px;text-align:left}.guido-display-condition-card__menu-item[data-v-2561eb6a]:hover,.guido-display-condition-card__menu-item[data-v-2561eb6a]:focus-visible{background-color:#eff2f4}.guido-display-condition-card__divider[data-v-2561eb6a]{width:1px;height:24px;background-color:#dcdee6}.guido-display-condition-card__expand[data-v-2561eb6a]{display:flex;padding:0;border:0;background:none;cursor:pointer}.guido-display-condition-card__code[data-v-2561eb6a]{margin:1px 15px 15px;padding:8px;border:1px solid #E1E1E1;border-radius:4px;background-color:#fff;color:#101727;font-family:inherit;font-size:15px;line-height:24px;white-space:pre-wrap;word-break:break-word}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
1
+ @charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-b8f24f34] .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-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__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-2cccbd44]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-c5ff3804]{gap:16px}.validation-error-row[data-v-c5ff3804]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-c5ff3804]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-c5ff3804]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-22e84203]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-22e84203]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-22e84203]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.guido-code-editor-field__label[data-v-e96c7aa3]{margin:0 0 8px;color:#2c3546;font-size:13px;line-height:16px}[data-v-a4b2ccb9] .guido-display-condition-academy{color:#0a2ecc;text-decoration:underline}[data-v-a4b2ccb9] .guido-display-condition-create__optional{color:#666}.guido-display-condition-create__separator[data-v-a4b2ccb9]{height:1px;margin:0 0 24px;background-image:linear-gradient(to right,#91949F 1px,transparent 1px);background-size:5px 1px}.guido-display-condition-create__method-title[data-v-a4b2ccb9]{margin:0 0 24px;color:#292929;font-size:13px;font-weight:600;letter-spacing:1.2px;line-height:20px;text-transform:uppercase}.guido-display-condition-create__methods[data-v-a4b2ccb9]{display:flex;gap:16px;margin-bottom:24px}[data-v-10ac7a13] .guido-display-condition-academy{color:#0a2ecc;text-decoration:underline}.guido-display-condition-select-root[data-v-10ac7a13] .in-drawer__footer{justify-content:flex-start}.guido-display-condition-select__delete-modal[data-v-10ac7a13]{position:relative;z-index:145}.guido-display-condition-select__delete-modal[data-v-10ac7a13] .in-modal-v2-wrapper__header-title{margin-bottom:0}.guido-display-condition-select__delete-text[data-v-10ac7a13]{margin:0;color:#292929}.guido-display-condition-select__list[data-v-10ac7a13]{display:flex;flex-direction:column;gap:24px;margin:0;padding:0;list-style:none}.guido-display-condition-card[data-v-10ac7a13]{border:1px solid #E1E1E1;border-radius:4px;background-color:#fff}.guido-display-condition-card__header[data-v-10ac7a13]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px}.guido-display-condition-card__text[data-v-10ac7a13]{min-width:0}.guido-display-condition-card__name[data-v-10ac7a13]{margin:0;overflow:hidden;color:#292929;font-size:16px;font-weight:600;line-height:24px;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__description[data-v-10ac7a13]{margin:4px 0 0;overflow:hidden;color:#666;font-size:13px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__actions[data-v-10ac7a13]{display:flex;flex-shrink:0;align-items:center;gap:16px}.guido-display-condition-card__split[data-v-10ac7a13]{position:relative;display:flex;gap:1px}.guido-display-condition-card__menu[data-v-10ac7a13]{position:absolute;z-index:2;top:calc(100% + 2px);right:0;min-width:115px;padding:4px 0;border-radius:4px;background-color:#fff;box-shadow:0 4px 16px #22293829}.guido-display-condition-card__menu-item[data-v-10ac7a13]{width:100%;padding:8px 16px;border:0;background:none;color:#222938;cursor:pointer;font-size:14px;line-height:24px;text-align:left}.guido-display-condition-card__menu-item[data-v-10ac7a13]:hover,.guido-display-condition-card__menu-item[data-v-10ac7a13]:focus-visible{background-color:#eff2f4}.guido-display-condition-card__divider[data-v-10ac7a13]{width:1px;height:24px;background-color:#dcdee6}.guido-display-condition-card__expand[data-v-10ac7a13]{display:flex;padding:0;border:0;background:none;cursor:pointer}.guido-display-condition-card__code[data-v-10ac7a13]{margin:1px 15px 15px;padding:8px;border:1px solid #E1E1E1;border-radius:4px;background-color:#fff;color:#101727;font-family:inherit;font-size:15px;line-height:24px;white-space:pre-wrap;word-break:break-word}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
@@ -1,19 +1,25 @@
1
- import { useHttp as c } from "../composables/useHttp.js";
2
- import { SavedDisplayConditionSchema as m, DisplayConditionListResponseSchema as d } from "../@types/display-condition.js";
3
- import { parse as i } from "../node_modules/valibot/dist/index.js";
4
- const n = "/email-proxy/v1/display-conditions", p = 100, A = () => {
5
- const { get: a, post: s, delete: r } = c();
6
- return { list: async (t) => {
7
- const e = new URLSearchParams({
8
- page: "1",
9
- limit: String(p),
1
+ import { useHttp as d } from "../composables/useHttp.js";
2
+ import { SavedDisplayConditionSchema as p, DisplayConditionListResponseSchema as y } from "../@types/display-condition.js";
3
+ import { parse as r } from "../node_modules/valibot/dist/index.js";
4
+ const i = "/email-proxy/v1/display-conditions", S = 100, P = () => {
5
+ const { get: s, post: c, delete: m } = d(), n = async (t, e) => {
6
+ const o = new URLSearchParams({
7
+ page: String(e),
8
+ limit: String(S),
10
9
  sortColumn: "id",
11
10
  sortDirection: "desc",
12
11
  "filter[syntax]": t
13
- }), { data: o } = await a(`${n}?${e.toString()}`);
14
- return i(d, o);
12
+ }), { data: a } = await s(`${i}?${o.toString()}`);
13
+ return r(y, a);
14
+ };
15
+ return { list: async (t) => {
16
+ const e = await n(t, 1), o = await Promise.all(Array.from(
17
+ { length: Math.max(e.meta.lastPage - 1, 0) },
18
+ (a, l) => n(t, l + 2)
19
+ ));
20
+ return [e, ...o].flatMap((a) => a.data);
15
21
  }, create: async (t, e) => {
16
- const { data: o } = await s(n, {
22
+ const { data: o } = await c(i, {
17
23
  name: t.name.trim(),
18
24
  description: t.description.trim() || null,
19
25
  syntax: e,
@@ -21,19 +27,13 @@ const n = "/email-proxy/v1/display-conditions", p = 100, A = () => {
21
27
  codeBefore: t.codeBefore,
22
28
  codeAfter: t.codeAfter
23
29
  });
24
- return i(m, o.data);
25
- }, nameExists: async (t, e) => {
26
- const { data: o } = await s(`${n}/name-check`, {
27
- name: t.trim(),
28
- syntax: e
29
- });
30
- return o.data.exists;
30
+ return r(p, o.data);
31
31
  }, remove: async (t) => {
32
- await r(`${n}/${t}`);
32
+ await m(`${i}/${t}`);
33
33
  } };
34
34
  };
35
35
  export {
36
- p as DISPLAY_CONDITIONS_PAGE_LIMIT,
37
- n as DISPLAY_CONDITIONS_URL,
38
- A as useDisplayConditionApi
36
+ S as DISPLAY_CONDITIONS_PAGE_LIMIT,
37
+ i as DISPLAY_CONDITIONS_URL,
38
+ P as useDisplayConditionApi
39
39
  };
@@ -7,7 +7,7 @@ export declare const useDisplayConditions: () => {
7
7
  handleOpen: (detail: DisplayConditionOpenDetail) => void;
8
8
  cancel: () => void;
9
9
  loadList: () => Promise<void>;
10
- validate: (draft: DisplayConditionDraft, intent: CreateIntent) => DraftErrors;
10
+ validate: (draft: DisplayConditionDraft) => DraftErrors;
11
11
  notifyInvalid: () => void;
12
12
  createInline: (draft: DisplayConditionDraft) => void;
13
13
  createAndSave: (draft: DisplayConditionDraft) => Promise<DraftErrors | null>;
@@ -4,6 +4,7 @@ export declare class DisplayConditionsControl extends CommonControl {
4
4
  private expanded;
5
5
  private listeners;
6
6
  private resizeObserver;
7
+ private detachOutsideClick;
7
8
  getId(): string;
8
9
  getTemplate(): string;
9
10
  onRender(): void;
@@ -11,6 +12,7 @@ export declare class DisplayConditionsControl extends CommonControl {
11
12
  onDestroy(): void;
12
13
  private getCondition;
13
14
  private toggleMenu;
15
+ private listenOutsideClick;
14
16
  private openDrawer;
15
17
  private applyCondition;
16
18
  private wire;
@@ -1,9 +1,8 @@
1
- import type { DisplayConditionDraft, DisplayConditionListResponse, DisplayConditionSyntax, SavedDisplayCondition } from '@@/Types/display-condition';
1
+ import type { DisplayConditionDraft, DisplayConditionSyntax, SavedDisplayCondition } from '@@/Types/display-condition';
2
2
  export declare const DISPLAY_CONDITIONS_URL = "/email-proxy/v1/display-conditions";
3
3
  export declare const DISPLAY_CONDITIONS_PAGE_LIMIT = 100;
4
4
  export declare const useDisplayConditionApi: () => {
5
- list: (syntax: DisplayConditionSyntax) => Promise<DisplayConditionListResponse>;
5
+ list: (syntax: DisplayConditionSyntax) => Promise<SavedDisplayCondition[]>;
6
6
  create: (draft: DisplayConditionDraft, syntax: DisplayConditionSyntax) => Promise<SavedDisplayCondition>;
7
- nameExists: (name: string, syntax: DisplayConditionSyntax) => Promise<boolean>;
8
7
  remove: (id: number) => Promise<void>;
9
8
  };
@@ -1,4 +1,10 @@
1
1
  import type { AppliedDisplayCondition, DisplayConditionSource } from '@@/Types/display-condition';
2
2
  export declare const parseSource: (condition: AppliedDisplayCondition | null | undefined) => DisplayConditionSource | null;
3
+ type ConditionLike = Omit<AppliedDisplayCondition, 'description'> & {
4
+ description?: string | null;
5
+ };
6
+ export declare const toAppliedCondition: (condition: ConditionLike | null | undefined) => AppliedDisplayCondition | null;
7
+ export declare const nextConditionId: () => number;
3
8
  export type CodeField = 'codeBefore' | 'codeAfter';
4
9
  export declare const findInvalidCodeFields: (codeBefore: string, codeAfter: string) => CodeField[];
10
+ export {};
@@ -1,21 +1,26 @@
1
- import { DisplayConditionSourceType as i } from "../enums/display-condition.js";
2
- const S = (s) => {
3
- if (!s)
1
+ import { DisplayConditionSourceType as d } from "../enums/display-condition.js";
2
+ const m = (e) => {
3
+ if (!e)
4
4
  return null;
5
5
  try {
6
- return JSON.parse(s.extraData ?? "{}").source === i.INLINE ? "inline" : "saved";
6
+ return JSON.parse(e.extraData ?? "{}").source === d.INLINE ? "inline" : "saved";
7
7
  } catch {
8
8
  return "saved";
9
9
  }
10
- }, l = /{%-?\s*(\w+)[\s\S]*?-?%}/g, d = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, a = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), f = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), h = (s) => /{%|%}|{{|}}/.test(s.replace(d, "")), A = (s, o) => {
10
+ }, E = (e) => !e || !(e.name || e.beforeScript || e.afterScript) ? null : { ...e, description: e.description ?? "" };
11
+ let o = 0;
12
+ const w = () => (o = Math.max(Date.now(), o + 1), o), f = /{%-?\s*(\w+)[\s\S]*?-?%}/g, p = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, u = /{%-?\s*(comment|raw)\s*-?%}[\s\S]*?{%-?\s*end\1\s*-?%}/g, l = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), h = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), S = (e) => /{%|%}|{{|}}/.test(e.replace(p, "")), C = (e, c) => {
11
13
  const t = /* @__PURE__ */ new Set(), r = [];
12
- return [["codeBefore", s], ["codeAfter", o]].forEach(([n, c]) => {
13
- h(c) && t.add(n), Array.from(c.matchAll(l), (e) => e[1]).forEach((e) => {
14
- a.has(e) ? r.push(e) : e.startsWith("end") && a.has(e.slice(3)) ? r.pop() !== e.slice(3) && t.add(n) : f.has(e) && !r.length && t.add(n);
14
+ return [["codeBefore", e], ["codeAfter", c]].forEach(([n, i]) => {
15
+ const a = i.replace(u, "");
16
+ S(a) && t.add(n), Array.from(a.matchAll(f), (s) => s[1]).forEach((s) => {
17
+ l.has(s) ? r.push(s) : s.startsWith("end") && l.has(s.slice(3)) ? r.pop() !== s.slice(3) && t.add(n) : h.has(s) && !r.length && t.add(n);
15
18
  });
16
19
  }), r.length && t.add("codeAfter"), [...t];
17
20
  };
18
21
  export {
19
- A as findInvalidCodeFields,
20
- S as parseSource
22
+ C as findInvalidCodeFields,
23
+ w as nextConditionId,
24
+ m as parseSource,
25
+ E as toAppliedCondition
21
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.20.1-beta.da6efd5",
3
+ "version": "3.20.1-beta.dfc8426",
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",