@useinsider/guido 3.28.1-beta.70df1f2 → 3.28.1-beta.7539890

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +3 -0
  2. package/dist/@types/display-condition.js +45 -21
  3. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +25 -19
  4. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +72 -53
  5. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
  6. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +60 -42
  7. package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue.js +18 -0
  8. package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue2.js +25 -0
  9. package/dist/components/organisms/display-conditions/LogicBuilderField.vue.js +28 -0
  10. package/dist/components/organisms/display-conditions/LogicBuilderField.vue2.js +28 -0
  11. package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue.js +30 -0
  12. package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue2.js +32 -0
  13. package/dist/components/organisms/display-conditions/LogicBuilderRow.vue.js +28 -0
  14. package/dist/components/organisms/display-conditions/LogicBuilderRow.vue2.js +60 -0
  15. package/dist/composables/useDisplayConditionAttributes.js +20 -0
  16. package/dist/composables/useDisplayConditions.js +83 -68
  17. package/dist/composables/useScrollToInvalid.js +15 -0
  18. package/dist/enums/display-condition.js +15 -6
  19. package/dist/enums/html-validator.js +1 -1
  20. package/dist/extensions/DisplayConditions/constants.js +19 -10
  21. package/dist/extensions/DisplayConditions/control.js +84 -64
  22. package/dist/extensions/DisplayConditions/display-conditions.css.js +58 -6
  23. package/dist/extensions/DisplayConditions/extension.js +18 -14
  24. package/dist/guido.css +1 -1
  25. package/dist/node_modules/valibot/dist/index.js +118 -102
  26. package/dist/package.json.js +1 -1
  27. package/dist/services/displayConditionApi.js +18 -19
  28. package/dist/src/@types/display-condition.d.ts +67 -0
  29. package/dist/src/components/organisms/display-conditions/LogicBuilderConnector.vue.d.ts +19 -0
  30. package/dist/src/components/organisms/display-conditions/LogicBuilderField.vue.d.ts +22 -0
  31. package/dist/src/components/organisms/display-conditions/LogicBuilderGroup.vue.d.ts +24 -0
  32. package/dist/src/components/organisms/display-conditions/LogicBuilderRow.vue.d.ts +25 -0
  33. package/dist/src/composables/useDisplayConditionAttributes.d.ts +4 -0
  34. package/dist/src/composables/useDisplayConditions.d.ts +1 -1
  35. package/dist/src/composables/useScrollToInvalid.d.ts +6 -0
  36. package/dist/src/enums/display-condition.d.ts +22 -0
  37. package/dist/src/extensions/DisplayConditions/constants.d.ts +2 -0
  38. package/dist/src/extensions/DisplayConditions/control.d.ts +1 -0
  39. package/dist/src/utils/displayConditionAttributes.d.ts +7 -0
  40. package/dist/src/utils/displayConditionBuilder.d.ts +29 -0
  41. package/dist/src/utils/displayConditionRules.d.ts +12 -0
  42. package/dist/src/utils/displayConditionSummary.d.ts +11 -0
  43. package/dist/src/utils/genericUtil.d.ts +5 -3
  44. package/dist/utils/displayConditionAttributes.js +22 -0
  45. package/dist/utils/displayConditionBuilder.js +50 -0
  46. package/dist/utils/displayConditionRules.js +91 -0
  47. package/dist/utils/displayConditionSummary.js +28 -0
  48. package/dist/utils/genericUtil.js +41 -40
  49. package/package.json +2 -2
@@ -0,0 +1,28 @@
1
+ import l from "./LogicBuilderRow.vue2.js";
2
+ /* empty css */
3
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var i = function() {
5
+ var t = this, a = t._self._c, e = t._self._setupProxy;
6
+ return a("div", { staticClass: "guido-logic-builder-row", attrs: { "data-rule-attribute": t.row.attribute } }, [a(e.InSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("property"), "search-status": "", "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.propertyOptions, "placeholder-text": e.trans(`${e.KEY}.select-property`), state: e.fieldState(t.errors.attribute), "state-message": t.errors.attribute ? e.trans(`${e.KEY}.error-property-required`) : "", value: e.selectedProperty }, on: { select: e.selectProperty } }, "InSelect", e.invalidFieldAttrs(t.errors.attribute), !1)), a(e.InSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("operator"), "search-status": "", "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.operatorOptions, "placeholder-text": e.trans(`${e.KEY}.select-operator`), state: e.fieldState(t.errors.operator), "state-message": t.errors.operator ? e.trans(`${e.KEY}.error-operator-required`) : "", value: e.selectedOperator }, on: { select: e.selectOperator } }, "InSelect", e.invalidFieldAttrs(t.errors.operator), !1)), e.valueKind === "multi-select" ? a(e.InMultiSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.valueOptions, "placeholder-text": e.trans(`${e.KEY}.enter-value`), "select-all-option-status": !1, state: e.fieldState(t.errors.value), "state-message": e.valueError, value: e.selectedValues }, on: { change: e.selectValues } }, "InMultiSelect", e.invalidFieldAttrs(t.errors.value), !1)) : e.valueKind === "tags" ? a("div", { staticClass: "guido-logic-builder-row__field", on: { paste: e.pasteTags } }, [a(e.InTags, t._b({ attrs: { id: e.fieldId("value"), "allow-duplicates": !1, disable: t.disabled, invalid: !!t.errors.value, "invalid-message": e.valueError, placeholder: e.trans(`${e.KEY}.enter-value`), validate: e.validateTag, value: t.row.values }, on: { input: e.updateTags } }, "InTags", e.invalidFieldAttrs(t.errors.value), !1))], 1) : e.valueKind === "select" ? a(e.InSelect, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), "button-status": !1, "disabled-status": t.disabled, "label-status": !1, options: e.valueOptions, "placeholder-text": e.trans(`${e.KEY}.enter-value`), state: e.fieldState(t.errors.value), "state-message": e.valueError, value: e.selectedValues }, on: { select: function(s) {
7
+ return e.update({ values: [s.value] });
8
+ } } }, "InSelect", e.invalidFieldAttrs(t.errors.value), !1)) : e.valueKind === "date" ? a(e.InDatePickerV2, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), "single-date-picker-status": "", "disabled-status": t.disabled, "label-status": !1, locale: e.datePickerLocale, name: e.fieldId("value"), "placeholder-text": e.trans(`${e.KEY}.enter-value`), state: e.fieldState(t.errors.value), "state-message": e.valueError, value: e.isoToPickerDate(t.row.values[0] ?? "") }, on: { apply: function(s) {
9
+ e.update({ values: [e.pickerDateToIso(s)] });
10
+ } } }, "InDatePickerV2", e.invalidFieldAttrs(t.errors.value), !1)) : a(e.InBasicTextInput, t._b({ staticClass: "guido-logic-builder-row__field", attrs: { id: e.fieldId("value"), type: "text", "character-counter-status": !1, "disabled-status": t.disabled, "label-status": !1, name: e.fieldId("value"), "placeholder-text": e.trans(`${e.KEY}.enter-value`), "state-message": e.valueError, states: e.fieldState(t.errors.value), "tooltip-status": !1, value: t.row.values[0] ?? "" }, on: { input: function(s) {
11
+ return e.update({ values: [s] });
12
+ } } }, "InBasicTextInput", e.invalidFieldAttrs(t.errors.value), !1)), a("div", { staticClass: "guido-logic-builder-row__actions" }, [a(e.InButtonV2, { attrs: { id: e.fieldId("duplicate"), "left-icon": "line-copy", styling: "ghost", type: "primary", "disabled-status": t.disabled, "label-text-status": !1 }, on: { click: function(s) {
13
+ return e.emit("duplicate");
14
+ } } }), a(e.InButtonV2, { attrs: { id: e.fieldId("remove"), "left-icon": "line-delete", styling: "ghost", type: "danger", "disabled-status": t.disabled || t.removeDisabled, "label-text-status": !1 }, on: { click: function(s) {
15
+ return e.emit("remove");
16
+ } } })], 1)], 1);
17
+ }, o = [], d = /* @__PURE__ */ r(
18
+ l,
19
+ i,
20
+ o,
21
+ !1,
22
+ null,
23
+ "8a2effc2"
24
+ );
25
+ const p = d.exports;
26
+ export {
27
+ p as default
28
+ };
@@ -0,0 +1,60 @@
1
+ import { defineComponent as V, computed as a } from "vue";
2
+ import { DISPLAY_CONDITIONS_TRANS_KEY as u } from "../../../composables/useDisplayConditions.js";
3
+ import { invalidFieldAttrs as B } from "../../../composables/useScrollToInvalid.js";
4
+ import { useTranslations as E } from "../../../composables/useTranslations.js";
5
+ import { locale as F } from "../../../utils/dateUtil.js";
6
+ import { isMultiValue as M, withAttribute as N, withOperator as K } from "../../../utils/displayConditionBuilder.js";
7
+ import { operatorsFor as L, isValidRuleValue as Y } from "../../../utils/displayConditionRules.js";
8
+ import { OPERATOR_TRANS_SUFFIX as C } from "../../../utils/displayConditionSummary.js";
9
+ import { InTags as q, InSelect as G, InMultiSelect as U, InDatePickerV2 as X, InButtonV2 as j, InBasicTextInput as z } from "@useinsider/design-system-vue";
10
+ const lt = /* @__PURE__ */ V({
11
+ __name: "LogicBuilderRow",
12
+ props: {
13
+ row: null,
14
+ errors: null,
15
+ customAttributes: null,
16
+ defaultAttributes: null,
17
+ disabled: { type: Boolean },
18
+ removeDisabled: { type: Boolean }
19
+ },
20
+ emits: ["update", "duplicate", "remove"],
21
+ setup(y, { emit: i }) {
22
+ const e = y, l = E(), A = F(), $ = (t) => `guido__display-condition-rule-${t}-${e.row.id}`, m = (t) => ({ text: t.label, value: t.key }), T = a(() => [
23
+ { text: l(`${u}.custom-attributes`), value: "guido-custom-attributes", list: e.customAttributes },
24
+ { text: l(`${u}.default-attributes`), value: "guido-default-attributes", list: e.defaultAttributes }
25
+ ].filter(({ list: t }) => t.length).map(({ text: t, value: r, list: o }) => ({ text: t, value: r, children: o.map(m) }))), p = a(() => [...e.customAttributes, ...e.defaultAttributes].find((t) => t.key === e.row.attribute)), g = a(() => {
26
+ var t;
27
+ return e.row.attribute ? [{ text: ((t = p.value) == null ? void 0 : t.label) ?? e.row.attribute, value: e.row.attribute }] : [];
28
+ }), v = a(() => L(e.row.type).map((t) => ({
29
+ text: l(`${u}.operator-${C[t]}`),
30
+ value: t
31
+ }))), _ = a(() => v.value.filter((t) => t.value === e.row.operator)), n = a(() => {
32
+ var t;
33
+ return e.row.type === "boolean" ? [
34
+ { text: l(`${u}.value-true`), value: "true" },
35
+ { text: l(`${u}.value-false`), value: "false" }
36
+ ] : (((t = p.value) == null ? void 0 : t.options) ?? []).map((r) => ({ text: r.label, value: r.value }));
37
+ }), f = a(() => M(e.row.operator)), x = a(() => n.value.filter((t) => e.row.values.includes(t.value))), I = a(() => f.value ? n.value.length ? "multi-select" : "tags" : n.value.length ? "select" : e.row.type === "date" ? "date" : "text"), O = a(() => e.errors.value ? e.row.values.some((t) => t.trim()) ? l(`${u}.error-value-invalid`) : l(`${u}.error-value-required`) : ""), S = (t) => t ? "error" : "default", c = (t) => i("update", { ...e.row, ...t }), k = (t) => {
38
+ const r = [...e.customAttributes, ...e.defaultAttributes].find((o) => o.key === t.value);
39
+ r && r.key !== e.row.attribute && i("update", N(e.row, r));
40
+ }, D = (t) => c({ values: t.map((r) => r.value) }), h = (t) => {
41
+ t.value !== e.row.operator && i("update", K(e.row, t.value));
42
+ }, P = (t) => {
43
+ const [r, o, s] = t.split("-");
44
+ return r && o && s ? `${o}/${s}/${r}` : "";
45
+ }, R = (t) => {
46
+ const [r, o, s] = t.split("/");
47
+ return s && r && o ? `${s}-${r.padStart(2, "0")}-${o.padStart(2, "0")}` : "";
48
+ }, d = /[,\r\n]/, b = (t) => Y(e.row.type, t), w = (t) => c({
49
+ values: [...new Set(t.flatMap((r) => r.split(d)).map((r) => r.trim()).filter(b))]
50
+ });
51
+ return { __sfc: !0, props: e, emit: i, trans: l, datePickerLocale: A, fieldId: $, toOption: m, propertyOptions: T, attribute: p, selectedProperty: g, operatorOptions: v, selectedOperator: _, valueOptions: n, isMulti: f, selectedValues: x, valueKind: I, valueError: O, fieldState: S, update: c, selectProperty: k, selectValues: D, selectOperator: h, isoToPickerDate: P, pickerDateToIso: R, TAG_SEPARATOR: d, validateTag: b, updateTags: w, pasteTags: (t) => {
52
+ var o;
53
+ const r = ((o = t.clipboardData) == null ? void 0 : o.getData("text")) ?? "";
54
+ d.test(r) && (t.preventDefault(), w([...e.row.values, r]));
55
+ }, KEY: u, invalidFieldAttrs: B, InBasicTextInput: z, InButtonV2: j, InDatePickerV2: X, InMultiSelect: U, InSelect: G, InTags: q };
56
+ }
57
+ });
58
+ export {
59
+ lt as default
60
+ };
@@ -0,0 +1,20 @@
1
+ import { useTranslations as i } from "./useTranslations.js";
2
+ import { useConfigStore as n } from "../stores/config.js";
3
+ import { resolveDisplayConditionAttributes as e } from "../utils/displayConditionAttributes.js";
4
+ import { computed as s } from "vue";
5
+ const m = (t = i()) => {
6
+ var r;
7
+ const o = n();
8
+ return e(
9
+ (r = o.template) == null ? void 0 : r.dynamicContentList,
10
+ o.partnerName,
11
+ t
12
+ );
13
+ }, f = () => {
14
+ const t = i();
15
+ return s(() => m(t));
16
+ };
17
+ export {
18
+ m as getDisplayConditionAttributes,
19
+ f as useDisplayConditionAttributes
20
+ };
@@ -1,34 +1,48 @@
1
- import { useToaster as M } from "./useToaster.js";
2
- import { useTranslations as x } from "./useTranslations.js";
3
- import { ACADEMY_LINKS as L } from "../enums/academy.js";
4
- import { DisplayConditionSourceType as y, DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as I } from "../enums/display-condition.js";
5
- import { ToasterTypeOptions as l } from "../enums/toaster.js";
6
- import { useDisplayConditionApi as O } from "../services/displayConditionApi.js";
1
+ import { useToaster as L } from "./useToaster.js";
2
+ import { useTranslations as M } from "./useTranslations.js";
3
+ import { ACADEMY_LINKS as O } from "../enums/academy.js";
4
+ import { DisplayConditionSourceType as E, DISPLAY_CONDITION_LIMITS as a, DisplayConditionEvent as C } from "../enums/display-condition.js";
5
+ import { ToasterTypeOptions as u } from "../enums/toaster.js";
6
+ import { useDisplayConditionApi as B } from "../services/displayConditionApi.js";
7
7
  import { useConfigStore as q } from "../stores/config.js";
8
- import { useDisplayConditionStore as P } from "../stores/display-condition.js";
9
- import { findInvalidCodeFields as Y, nextConditionId as w } from "../utils/displayCondition.js";
10
- import { escapeHtml as R } from "../utils/htmlEscape.js";
11
- import { computed as b } from "vue";
12
- const B = "email-editor.display-conditions", i = B, F = 409, S = (n, m, r) => ({
13
- id: w(),
14
- name: n.name.trim(),
15
- description: n.description.trim(),
16
- beforeScript: n.codeBefore,
17
- afterScript: n.codeAfter,
18
- extraData: JSON.stringify(r === void 0 ? { source: m } : { source: m, savedId: r })
19
- }), v = (n) => ({
20
- name: n.name,
21
- description: n.description,
22
- codeBefore: n.codeBefore,
23
- codeAfter: n.codeAfter
24
- }), ne = () => {
25
- const n = P(), m = q(), r = O(), o = x(), { showToaster: p } = M(), u = b(
26
- () => m.isFeatureEnabled("liquidSyntax") ? "liquid" : "pongo"
27
- ), f = (e) => {
8
+ import { useDisplayConditionStore as R } from "../stores/display-condition.js";
9
+ import { findInvalidCodeFields as P, nextConditionId as Y } from "../utils/displayCondition.js";
10
+ import { parseRuleTree as b, compileRuleTree as k } from "../utils/displayConditionRules.js";
11
+ import { escapeHtml as F } from "../utils/htmlEscape.js";
12
+ import { computed as X } from "vue";
13
+ const w = "email-editor.display-conditions", i = w, K = 409, I = (n) => {
14
+ const l = n.method === "logicBuilder";
15
+ return {
16
+ name: n.name,
17
+ description: n.description,
18
+ method: n.method,
19
+ codeBefore: l ? "" : n.codeBefore,
20
+ codeAfter: l ? "" : n.codeAfter,
21
+ rules: l ? b(n.codeBefore) : null
22
+ };
23
+ }, se = () => {
24
+ const n = R(), l = q(), y = B(), o = M(), { showToaster: p } = L(), d = X(
25
+ () => l.isFeatureEnabled("liquidSyntax") ? "liquid" : "pongo"
26
+ ), h = (e) => {
28
27
  const t = { condition: e };
29
- return document.dispatchEvent(new CustomEvent(I.APPLY, { detail: t })), n.close(), t.applied === !0;
30
- }, D = () => {
31
- n.view !== "none" && (document.dispatchEvent(new CustomEvent(I.CANCEL)), n.close());
28
+ return document.dispatchEvent(new CustomEvent(C.APPLY, { detail: t })), n.close(), t.applied === !0;
29
+ }, D = (e, t, r) => {
30
+ const c = Y(), f = r === void 0 ? { source: t } : { source: t, savedId: r }, s = { id: c, name: e.name.trim(), description: e.description.trim() };
31
+ return e.method !== "logicBuilder" ? {
32
+ ...s,
33
+ beforeScript: e.codeBefore,
34
+ afterScript: e.codeAfter,
35
+ extraData: JSON.stringify(f)
36
+ } : e.rules ? {
37
+ ...s,
38
+ ...k(e.rules, d.value, `dc${c}`),
39
+ extraData: JSON.stringify({ ...f, method: "logicBuilder", rules: e.rules })
40
+ } : null;
41
+ }, A = (e, t, r) => {
42
+ const c = D(e, t, r);
43
+ return c ? h(c) : !1;
44
+ }, g = () => {
45
+ n.view !== "none" && (document.dispatchEvent(new CustomEvent(C.CANCEL)), n.close());
32
46
  }, N = (e) => {
33
47
  if (e.mode === "select") {
34
48
  n.openSelect();
@@ -39,71 +53,72 @@ const B = "email-editor.display-conditions", i = B, F = 409, S = (n, m, r) => ({
39
53
  const e = ++n.listRequest;
40
54
  n.listStatus = "loading";
41
55
  try {
42
- const t = await r.list(u.value);
56
+ const t = await y.list(d.value);
43
57
  e === n.listRequest && (n.list = t, n.listStatus = "loaded");
44
58
  } catch (t) {
45
59
  console.warn("Display conditions could not be loaded.", t), e === n.listRequest && (n.listStatus = "error");
46
60
  }
47
- }, h = (e) => {
48
- const t = {}, d = e.name.trim();
49
- d ? d.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : d.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
50
- const { DESCRIPTION_MAX: C } = s;
51
- e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
52
- const g = Y(e.codeBefore, e.codeAfter, u.value);
53
- return ["codeBefore", "codeAfter"].forEach((a) => {
54
- e[a].trim() ? g.includes(a) ? t[a] = o(`${i}.error-code-invalid`) : e[a].length > s.CODE_MAX && (t[a] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[a] = o(`${i}.error-code-required`);
61
+ }, T = (e) => {
62
+ const t = {}, r = e.name.trim();
63
+ r ? r.length < a.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: a.NAME_MIN }) : r.length > a.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: a.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
64
+ const { DESCRIPTION_MAX: c } = a;
65
+ if (e.description.trim().length > c && (t.description = o(`${i}.error-description-max`, { max: c })), e.method === "logicBuilder")
66
+ return t;
67
+ const f = P(e.codeBefore, e.codeAfter, d.value);
68
+ return ["codeBefore", "codeAfter"].forEach((s) => {
69
+ e[s].trim() ? f.includes(s) ? t[s] = o(`${i}.error-code-invalid`) : e[s].length > a.CODE_MAX && (t[s] = o(`${i}.error-code-max`, { max: a.CODE_MAX })) : t[s] = o(`${i}.error-code-required`);
55
70
  }), t;
56
- }, A = (e, t) => {
57
- p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
58
- }, T = (e) => o(
71
+ }, S = (e, t) => {
72
+ p(e ? { type: u.Success, message: t } : { type: u.Error, message: o("products.something-went-wrong") });
73
+ }, _ = (e) => o(
59
74
  `${i}.${e}`,
60
75
  {
61
- academyLink: `<a href="${L.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
76
+ academyLink: `<a href="${O.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
62
77
  }
63
- ), _ = () => {
64
- p({ type: l.Error, message: o(`${i}.validation-failed`) });
65
- }, c = (e) => ({ name: R(e) }), E = (e, t) => {
66
- e != null && e.authReported || (console.warn(t, e), p({ type: l.Error, message: t }));
78
+ ), x = () => {
79
+ p({ type: u.Error, message: o(`${i}.validation-failed`) });
80
+ }, m = (e) => ({ name: F(e) }), v = (e, t) => {
81
+ e != null && e.authReported || (console.warn(t, e), p({ type: u.Error, message: t }));
67
82
  };
68
83
  return {
69
- syntax: u,
84
+ syntax: d,
70
85
  handleOpen: N,
71
- cancel: D,
86
+ cancel: g,
72
87
  loadList: $,
73
- validate: h,
74
- notifyInvalid: _,
75
- describeWithAcademyLink: T,
88
+ validate: T,
89
+ notifyInvalid: x,
90
+ describeWithAcademyLink: _,
76
91
  createInline: (e) => {
77
- A(
78
- f(S(e, y.INLINE)),
79
- o(`${i}.created`, c(e.name.trim()))
92
+ S(
93
+ A(e, E.INLINE),
94
+ o(`${i}.created`, m(e.name.trim()))
80
95
  );
81
96
  },
82
97
  createAndSave: async (e) => {
83
98
  try {
84
- const t = await r.create(e, u.value);
85
- return n.list = [t, ...n.list.filter((d) => d.id !== t.id)], A(
86
- f(S(v(t), y.SAVED, t.id)),
87
- o(`${i}.created-and-saved`, c(t.name))
99
+ const t = await y.create(e, d.value);
100
+ return n.list = [t, ...n.list.filter((r) => r.id !== t.id)], S(
101
+ A(I(t), E.SAVED, t.id),
102
+ o(`${i}.created-and-saved`, m(t.name))
88
103
  ), {};
89
104
  } catch (t) {
90
- return (t == null ? void 0 : t.status) === F ? { name: o(`${i}.error-name-exists`) } : (E(t, o(`${i}.save-failed`, c(e.name.trim()))), null);
105
+ return (t == null ? void 0 : t.status) === K ? { name: o(`${i}.error-name-exists`) } : (v(t, o(`${i}.save-failed`, m(e.name.trim()))), null);
91
106
  }
92
107
  },
93
108
  select: (e) => {
94
- A(
95
- f(S(v(e), y.SAVED, e.id)),
96
- o(`${i}.applied`, c(e.name))
109
+ S(
110
+ A(I(e), E.SAVED, e.id),
111
+ o(`${i}.applied`, m(e.name))
97
112
  );
98
113
  },
99
114
  deleteSaved: async (e) => {
100
115
  try {
101
- await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
102
- type: l.Success,
103
- message: o(`${i}.deleted`, c(e.name))
116
+ await y.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
117
+ type: u.Success,
118
+ message: o(`${i}.deleted`, m(e.name))
104
119
  });
105
120
  } catch (t) {
106
- E(t, o(`${i}.delete-failed`));
121
+ v(t, o(`${i}.delete-failed`));
107
122
  } finally {
108
123
  n.pendingDelete = null;
109
124
  }
@@ -111,6 +126,6 @@ const B = "email-editor.display-conditions", i = B, F = 409, S = (n, m, r) => ({
111
126
  };
112
127
  };
113
128
  export {
114
- B as DISPLAY_CONDITIONS_TRANS_KEY,
115
- ne as useDisplayConditions
129
+ w as DISPLAY_CONDITIONS_TRANS_KEY,
130
+ se as useDisplayConditions
116
131
  };
@@ -0,0 +1,15 @@
1
+ import { nextTick as i } from "vue";
2
+ const r = "data-guido-invalid", a = (e) => e ? { [r]: "true" } : {}, n = () => {
3
+ var e;
4
+ return ((e = window.matchMedia) == null ? void 0 : e.call(window, "(prefers-reduced-motion: reduce)").matches) ?? !1;
5
+ }, l = (e) => ({ scrollToFirstInvalid: async () => {
6
+ var o;
7
+ await i();
8
+ const t = (o = e.value) == null ? void 0 : o.querySelector(`[${r}]`);
9
+ return t ? (t.scrollIntoView({ behavior: n() ? "auto" : "smooth", block: "center" }), !0) : !1;
10
+ } });
11
+ export {
12
+ r as INVALID_FIELD_ATTR,
13
+ a as invalidFieldAttrs,
14
+ l as useScrollToInvalid
15
+ };
@@ -1,12 +1,21 @@
1
- var N = /* @__PURE__ */ ((I) => (I.OPEN = "display-condition:open", I.APPLY = "display-condition:apply", I.CANCEL = "display-condition:cancel", I))(N || {}), A = /* @__PURE__ */ ((I) => (I.INLINE = "inline", I.SAVED = "saved", I))(A || {});
2
- const M = {
1
+ var n = /* @__PURE__ */ ((e) => (e.OPEN = "display-condition:open", e.APPLY = "display-condition:apply", e.CANCEL = "display-condition:cancel", e))(n || {}), a = /* @__PURE__ */ ((e) => (e.INLINE = "inline", e.SAVED = "saved", e))(a || {});
2
+ const l = {
3
3
  NAME_MIN: 2,
4
4
  NAME_MAX: 40,
5
5
  DESCRIPTION_MAX: 200,
6
6
  CODE_MAX: 65535
7
- };
7
+ }, o = [
8
+ { key: "email", labelKey: "condition.email" },
9
+ { key: "name", labelKey: "condition.name" },
10
+ { key: "surname", labelKey: "condition.surname" },
11
+ { key: "phone_number", labelKey: "condition.phone-number" },
12
+ { key: "uuid", labelKey: "condition.uuid" },
13
+ { key: "language", labelKey: "condition.language" },
14
+ { key: "country", labelKey: "condition.country" }
15
+ ];
8
16
  export {
9
- M as DISPLAY_CONDITION_LIMITS,
10
- N as DisplayConditionEvent,
11
- A as DisplayConditionSourceType
17
+ o as DISPLAY_CONDITION_DEFAULT_ATTRIBUTES,
18
+ l as DISPLAY_CONDITION_LIMITS,
19
+ n as DisplayConditionEvent,
20
+ a as DisplayConditionSourceType
12
21
  };
@@ -1,4 +1,4 @@
1
- const n = "newsletter.already-in-progress", s = "newsletter.campaign-could-not-be-saved", e = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, E = /{%( )*now( )(".*")( )*%}/gm, o = /{%(?:(?!{%)[\s\S])*?%}/g, _ = /\{\{[^{}]+\}\}/g, t = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, i = /^[A-Za-z0-9_.]+$/, a = [
1
+ const n = "newsletter.already-in-progress", s = "newsletter.campaign-could-not-be-saved", e = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|(\(|\))|([^”\s\n]+)|(({%)|( %}))/gm, E = /{%( )*now( )(".*")( )*%}/gm, o = /{%(?:(?!{%)[\s\S])*?%}/g, _ = /\{\{[^{}]+\}\}/g, t = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, i = /^[A-Za-z0-9_.]+$/, a = [
2
2
  "ins-unsubscribe-link",
3
3
  "ins-global-unsubscribe-link",
4
4
  "ins-preferences-unsubscribe-link",
@@ -1,10 +1,10 @@
1
1
  import { BlockType as o } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const n = "conditions", t = "guido-display-conditions-control", d = 10, s = [o.STRIPE, o.STRUCTURE, o.CONTAINER], c = {
2
+ const n = "conditions", t = "guido-display-conditions-control", s = 10, d = [o.STRIPE, o.STRUCTURE, o.CONTAINER], e = {
3
3
  PLUS: "guido-display-condition-plus",
4
4
  EDIT: "guido-display-condition-edit",
5
5
  TRASH: "guido-display-condition-trash",
6
6
  CHEVRON: "guido-display-condition-chevron"
7
- }, e = {
7
+ }, c = {
8
8
  ADD: "guidoDisplayConditionAdd",
9
9
  CREATE: "guidoDisplayConditionCreate",
10
10
  SELECT: "guidoDisplayConditionSelect",
@@ -12,15 +12,24 @@ const n = "conditions", t = "guido-display-conditions-control", d = 10, s = [o.S
12
12
  SHOW_LESS: "guidoDisplayConditionShowLess",
13
13
  EDIT: "guidoDisplayConditionEdit",
14
14
  REMOVE: "guidoDisplayConditionRemove"
15
- }, C = ["applyConditionSwitcher", "applyCondition", "displayConditions"], a = "You can add Display Condition by selecting an existing condition or creating a new one to show specific content.", O = "You can create or select a display condition to control content visibility based on your recipients' properties or events.";
15
+ }, a = ["applyConditionSwitcher", "applyCondition", "displayConditions"], O = "You can add Display Condition by selecting an existing condition or creating a new one to show specific content.", C = "You can create or select a display condition to control content visibility based on your recipients' properties or events.", p = "Show this block if recipient meet the condition below", I = {
16
+ is: "is",
17
+ "is-not": "is not",
18
+ contains: "contain",
19
+ "not-contains": "doesn't contain",
20
+ "is-one-of": "is one of",
21
+ "is-not-one-of": "is not one of"
22
+ };
16
23
  export {
17
- O as APPLIED_DESCRIPTION,
18
- C as BUILT_IN_CONDITION_CONTROLS,
24
+ C as APPLIED_DESCRIPTION,
25
+ a as BUILT_IN_CONDITION_CONTROLS,
19
26
  t as CONDITIONS_CONTROL_ID,
20
27
  n as CONDITIONS_TAB_ID,
21
- s as CONDITION_BLOCK_TYPES,
22
- e as CONDITION_BUTTONS,
23
- c as CONDITION_ICONS,
24
- a as EMPTY_DESCRIPTION,
25
- d as MAX_COLLAPSED_LINES
28
+ d as CONDITION_BLOCK_TYPES,
29
+ c as CONDITION_BUTTONS,
30
+ e as CONDITION_ICONS,
31
+ O as EMPTY_DESCRIPTION,
32
+ s as MAX_COLLAPSED_LINES,
33
+ I as OPERATOR_LABELS,
34
+ p as RULES_INTRO
26
35
  };