@mobilon-dev/chotto 0.3.75 → 0.3.77

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 (29) hide show
  1. package/dist/chotto.css +1 -1
  2. package/dist/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.js +344 -295
  3. package/dist/components/2_blocks/CommunicationPanel/CommunicationPanelAttributeIndicator.vue.js +88 -0
  4. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.js +65 -32
  5. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.js +84 -28
  6. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationChannels.js +8 -7
  7. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.js +16 -21
  8. package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.js +10 -9
  9. package/dist/components/2_blocks/CommunicationPanel/icons/CommunicationPanelCheckIcon.vue.js +1 -1
  10. package/dist/components/2_blocks/CommunicationPanel/icons/CommunicationPanelConfirmSpinner.vue2.js +15 -0
  11. package/dist/hooks/validators/chats/chatValidator.js +13 -9
  12. package/dist/themes/dark.css +1 -1
  13. package/dist/themes/default.css +1 -1
  14. package/dist/themes/glass.css +1 -1
  15. package/dist/themes/green.css +1 -1
  16. package/dist/themes/mobilon1.css +1 -1
  17. package/dist/types/apps/data/chats.d.ts +10 -0
  18. package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +7 -1
  19. package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanelAttributeIndicator.vue.d.ts +15 -0
  20. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationActions.d.ts +5 -2
  21. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.d.ts +41 -0
  22. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationMenu.d.ts +2 -7
  23. package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationSubMenu.d.ts +2 -1
  24. package/dist/types/components/2_blocks/CommunicationPanel/icons/CommunicationPanelConfirmSpinner.vue.d.ts +2 -0
  25. package/dist/types/components/2_blocks/CommunicationPanel/icons/index.d.ts +1 -0
  26. package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +7 -1
  27. package/dist/types/components/2_blocks/CommunicationPanel/styles/types.d.ts +30 -0
  28. package/dist/types/hooks/validators/chats/types.d.ts +2 -0
  29. package/package.json +1 -1
@@ -0,0 +1,88 @@
1
+ import { computed as o, createElementBlock as i, openBlock as e, createCommentVNode as u, Fragment as y, createBlock as r, withCtx as C, createElementVNode as A, normalizeClass as p, unref as l } from "vue";
2
+ import I from "../../1_atoms/Tooltip/Tooltip.vue.js";
3
+ import f from "./icons/CommunicationPanelCheckIcon.vue.js";
4
+ import b from "./icons/CommunicationPanelConfirmSpinner.vue2.js";
5
+ import { isAttributeConfirming as S, shouldShowAttributeCheckmark as _, shouldShowBlockedIndicatorSlot as g, getAttributeCheckIndicatorClass as w, getAttributeIndicatorTooltipText as x } from "./composables/useCommunicationAttributes.js";
6
+ const B = { class: "attribute-indicator-slot" }, T = {
7
+ key: 2,
8
+ class: "blocked-indicator-mark",
9
+ "aria-hidden": "true"
10
+ }, q = {
11
+ key: 2,
12
+ class: "blocked-indicator-mark",
13
+ "aria-hidden": "true"
14
+ }, F = {
15
+ __name: "CommunicationPanelAttributeIndicator",
16
+ props: {
17
+ attribute: {
18
+ type: Object,
19
+ required: !0
20
+ },
21
+ isSelected: {
22
+ type: Boolean,
23
+ required: !1,
24
+ default: !1
25
+ },
26
+ confirmingAttributeId: {
27
+ type: String,
28
+ required: !1,
29
+ default: null
30
+ },
31
+ blockedAttributeIds: {
32
+ type: Array,
33
+ required: !1,
34
+ default: () => []
35
+ },
36
+ indicatorTooltips: {
37
+ type: Object,
38
+ required: !1,
39
+ default: () => ({})
40
+ }
41
+ },
42
+ setup(k) {
43
+ const t = k, s = o(() => ({
44
+ isSelected: t.isSelected,
45
+ confirmingAttributeId: t.confirmingAttributeId,
46
+ blockedAttributeIds: t.blockedAttributeIds ?? []
47
+ })), a = o(
48
+ () => S(t.attribute, t.confirmingAttributeId)
49
+ ), c = o(
50
+ () => _(t.attribute, t.isSelected)
51
+ ), n = o(
52
+ () => g(t.attribute, s.value)
53
+ ), h = o(() => a.value || c.value), v = o(() => h.value || n.value), d = o(() => a.value ? "confirming-indicator" : n.value ? "blocked-indicator" : w(t.attribute, t.isSelected) ?? ""), m = o(
54
+ () => x(
55
+ t.attribute,
56
+ t.indicatorTooltips,
57
+ s.value
58
+ )
59
+ );
60
+ return (P, j) => (e(), i("span", B, [
61
+ v.value ? (e(), i(y, { key: 0 }, [
62
+ m.value ? (e(), r(I, {
63
+ key: 0,
64
+ text: m.value,
65
+ position: "bottom-left",
66
+ offset: 8
67
+ }, {
68
+ default: C(() => [
69
+ A("span", {
70
+ class: p(d.value)
71
+ }, [
72
+ a.value ? (e(), r(l(b), { key: 0 })) : c.value ? (e(), r(l(f), { key: 1 })) : n.value ? (e(), i("span", T)) : u("", !0)
73
+ ], 2)
74
+ ]),
75
+ _: 1
76
+ }, 8, ["text"])) : (e(), i("span", {
77
+ key: 1,
78
+ class: p(d.value)
79
+ }, [
80
+ a.value ? (e(), r(l(b), { key: 0 })) : c.value ? (e(), r(l(f), { key: 1 })) : n.value ? (e(), i("span", q)) : u("", !0)
81
+ ], 2))
82
+ ], 64)) : u("", !0)
83
+ ]));
84
+ }
85
+ };
86
+ export {
87
+ F as default
88
+ };
@@ -1,58 +1,91 @@
1
- function P({
1
+ import { needsAttributeConfirmation as o } from "./useCommunicationAttributes.js";
2
+ function H({
2
3
  activeChannelType: l,
3
- channels: i,
4
- selectedChannel: r,
5
- selectedChannelType: c,
6
- hoveredAttribute: s,
7
- closeMenu: u,
8
- hasMultipleChannels: k,
9
- getSingleChannelForType: A,
10
- getAvailableChannels: C,
11
- isChannelEmpty: v,
12
- isNewDialog: f,
13
- showDefaultChannelTooltipWithTimer: d,
14
- clearDefaultChannelTooltip: o,
15
- emit: t
4
+ channels: t,
5
+ selectedChannel: s,
6
+ selectedChannelType: v,
7
+ hoveredAttribute: S,
8
+ confirmingAttributeId: c,
9
+ isAttributeBlocked: u,
10
+ closeMenu: a,
11
+ hasMultipleChannels: q,
12
+ getSingleChannelForType: x,
13
+ getAvailableChannels: P,
14
+ isChannelEmpty: d,
15
+ isNewDialog: h,
16
+ showDefaultChannelTooltipWithTimer: C,
17
+ clearDefaultChannelTooltip: p,
18
+ emit: f
16
19
  }) {
17
- const b = (n) => {
18
- n && (t("phone-call", {
20
+ const i = (n, e, r) => {
21
+ u(n) || (c.value = n.id, f("confirm-attribute", {
19
22
  attributeId: n.id,
20
- phoneNumber: n.data
21
- }), u());
22
- }, h = (n, e) => {
23
- t("select-attribute-channel", {
23
+ channelId: e,
24
+ channelType: r,
25
+ attribute: n
26
+ }));
27
+ }, b = (n, e, r) => {
28
+ if (o(n)) {
29
+ i(n, e, r);
30
+ return;
31
+ }
32
+ A(n, e);
33
+ }, m = (n) => {
34
+ if (!(!n || u(n))) {
35
+ if (o(n)) {
36
+ i(n, "", "phone");
37
+ return;
38
+ }
39
+ f("phone-call", {
40
+ attributeId: n.id,
41
+ phoneNumber: n.data
42
+ }), a();
43
+ }
44
+ }, A = (n, e) => {
45
+ f("select-attribute-channel", {
24
46
  attributeId: n.id,
25
47
  channelId: e
26
- }), c.value = l.value, r.value = i.value.find((a) => a.channelId === e) ?? {}, v(e) && f.value ? d() : o(), u();
48
+ }), v.value = l.value, s.value = t.value.find((r) => r.channelId === e) ?? {}, d(e) && h.value ? C() : p(), a();
27
49
  };
28
50
  return {
29
- handlePhoneCall: b,
51
+ handlePhoneCall: m,
30
52
  handleAttributeClick: (n) => {
53
+ if (c.value || u(n))
54
+ return;
31
55
  const e = l.value;
32
56
  if (e) {
33
57
  if (e === "phone") {
34
- b(n);
58
+ m(n);
35
59
  return;
36
60
  }
37
- if (!k(e)) {
38
- const a = A(e);
39
- a && h(n, a.channelId);
61
+ if (!q(e)) {
62
+ const r = x(e);
63
+ r && b(n, r.channelId, e);
40
64
  }
41
65
  }
42
66
  },
43
- selectSingleChannel: h,
67
+ selectSingleChannel: A,
44
68
  selectChannel: (n) => {
45
- s.value && (t("select-attribute-channel", {
46
- attributeId: s.value.id,
69
+ const e = S.value, r = l.value;
70
+ if (!e || !r || u(e)) {
71
+ a();
72
+ return;
73
+ }
74
+ if (o(e)) {
75
+ i(e, n, r);
76
+ return;
77
+ }
78
+ f("select-attribute-channel", {
79
+ attributeId: e.id,
47
80
  channelId: n
48
- }), c.value = l.value, r.value = i.value.find((e) => e.channelId === n) ?? {}, v(n) && f.value ? d() : o()), u();
81
+ }), v.value = r, s.value = t.value.find((g) => g.channelId === n) ?? {}, d(n) && h.value ? C() : p(), a();
49
82
  },
50
83
  availableChannels: () => {
51
84
  const n = l.value;
52
- return n ? C(n) : [];
85
+ return n ? P(n) : [];
53
86
  }
54
87
  };
55
88
  }
56
89
  export {
57
- P as useCommunicationActions
90
+ H as useCommunicationActions
58
91
  };
@@ -1,44 +1,100 @@
1
- import { computed as c, unref as m, ref as f, watch as a } from "vue";
2
- import { CHANNEL_TYPES as o } from "./useCommunicationChannels.js";
3
- function A({
4
- contactAttributes: u,
5
- frozenAttribute: s
1
+ import { computed as p, unref as A, ref as h, watch as g } from "vue";
2
+ import { CHANNEL_TYPES as t } from "./useCommunicationChannels.js";
3
+ const C = ["confirmed", "unconfirmed"];
4
+ function S(n) {
5
+ return C.includes(n);
6
+ }
7
+ function k(n) {
8
+ const e = n == null ? void 0 : n.status;
9
+ return S(e) ? `status-${e}` : null;
10
+ }
11
+ function d(n) {
12
+ return (n == null ? void 0 : n.status) === "confirmed";
13
+ }
14
+ function T(n) {
15
+ return (n == null ? void 0 : n.status) === "unconfirmed";
16
+ }
17
+ function z(n) {
18
+ return T(n);
19
+ }
20
+ function s(n, e) {
21
+ return e || d(n);
22
+ }
23
+ function v(n, e) {
24
+ return s(n, e) ? e ? "selected-indicator" : "confirmed-indicator" : null;
25
+ }
26
+ function c(n, e) {
27
+ return !e || !(n != null && n.id) ? !1 : n.id === e;
28
+ }
29
+ function m(n, e) {
30
+ return !(n != null && n.id) || !(e != null && e.length) ? !1 : e.includes(n.id);
31
+ }
32
+ function y(n, e) {
33
+ return c(n, e.confirmingAttributeId) || s(n, e.isSelected);
34
+ }
35
+ function B(n, e) {
36
+ return m(n, e.blockedAttributeIds) ? !c(n, e.confirmingAttributeId) && !s(n, e.isSelected) : !1;
37
+ }
38
+ function E(n, e) {
39
+ return c(n, e.confirmingAttributeId) ? "confirming" : m(n, e.blockedAttributeIds) ? "blocked" : y(n, e) ? e.isSelected ? "selected" : d(n) ? "confirmed" : null : null;
40
+ }
41
+ function N(n, e, u) {
42
+ const o = E(n, u);
43
+ return !o || !e ? "" : e[o] ?? "";
44
+ }
45
+ function O({
46
+ contactAttributes: n,
47
+ frozenAttribute: e
6
48
  }) {
7
- const r = c(() => m(u) ?? []), i = f(
8
- Object.fromEntries(o.map((t) => [t, []]))
9
- ), n = () => {
10
- const t = Object.fromEntries(
11
- o.map((e) => [e, []])
49
+ const u = p(() => A(n) ?? []), o = h(
50
+ Object.fromEntries(t.map((i) => [i, []]))
51
+ ), f = () => {
52
+ const i = Object.fromEntries(
53
+ t.map((r) => [r, []])
12
54
  );
13
- r.value.forEach((e) => {
14
- if (!(!e || !e.type)) {
15
- if (e.type === "telegram") {
16
- t.telegram.push(e);
55
+ u.value.forEach((r) => {
56
+ if (!(!r || !r.type)) {
57
+ if (r.type === "telegram") {
58
+ i.telegram.push(r);
17
59
  return;
18
60
  }
19
- if (e.type === "max") {
20
- t.max.push(e);
61
+ if (r.type === "max") {
62
+ i.max.push(r);
21
63
  return;
22
64
  }
23
- if (e.type === "phone") {
24
- ["whatsapp", "sms", "phone"].forEach((p) => {
25
- t[p].push(e);
65
+ if (r.type === "phone") {
66
+ ["whatsapp", "sms", "phone"].forEach((l) => {
67
+ i[l].push(r);
26
68
  });
27
69
  return;
28
70
  }
29
- t[e.type] && t[e.type].push(e);
71
+ i[r.type] && i[r.type].push(r);
30
72
  }
31
- }), i.value = t;
73
+ }), o.value = i;
32
74
  };
33
- return a(r, n, { deep: !0, immediate: !0 }), {
34
- organizedContactAttributes: i,
35
- organizeContactAttributes: n,
36
- isAttributeFrozen: (t) => {
37
- const e = s.value;
38
- return !t || !(e != null && e.id) ? !1 : t.id === e.id;
75
+ return g(u, f, { deep: !0, immediate: !0 }), {
76
+ organizedContactAttributes: o,
77
+ organizeContactAttributes: f,
78
+ isAttributeFrozen: (i) => {
79
+ const r = e.value;
80
+ return !i || !(r != null && r.id) ? !1 : i.id === r.id;
39
81
  }
40
82
  };
41
83
  }
42
84
  export {
43
- A as useCommunicationAttributes
85
+ C as CONTACT_ATTRIBUTE_STATUSES,
86
+ v as getAttributeCheckIndicatorClass,
87
+ E as getAttributeIndicatorTooltipKey,
88
+ N as getAttributeIndicatorTooltipText,
89
+ k as getAttributeStatusClass,
90
+ m as isAttributeBlocked,
91
+ d as isAttributeConfirmed,
92
+ c as isAttributeConfirming,
93
+ T as isAttributeUnconfirmed,
94
+ S as isContactAttributeStatus,
95
+ z as needsAttributeConfirmation,
96
+ s as shouldShowAttributeCheckmark,
97
+ y as shouldShowAttributeIndicator,
98
+ B as shouldShowBlockedIndicatorSlot,
99
+ O as useCommunicationAttributes
44
100
  };
@@ -1,4 +1,5 @@
1
- import { computed as l, unref as c } from "vue";
1
+ import { computed as m, unref as c } from "vue";
2
+ /* empty css */
2
3
  import P from "../icons/CommunicationPanelPhoneIcon.vue.js";
3
4
  import S from "../icons/CommunicationPanelWhatsAppIcon.vue.js";
4
5
  import M from "../icons/CommunicationPanelTelegramIcon.vue.js";
@@ -28,8 +29,8 @@ const F = ["whatsapp", "telegram", "max", "sms", "phone"], y = {
28
29
  max: "Выберите контакт и канал для отправки сообщения",
29
30
  sms: "Выберите контакт и канал для отправки сообщения"
30
31
  };
31
- function K({ channels: i, channelTooltips: u, selectedChannelType: s }) {
32
- const t = l(() => c(i) ?? []), p = l(() => c(u) ?? {}), h = l(
32
+ function O({ channels: i, channelTooltips: u, selectedChannelType: s }) {
33
+ const t = m(() => c(i) ?? []), p = m(() => c(u) ?? {}), h = m(
33
34
  () => F.map((n) => ({
34
35
  type: n,
35
36
  component: y[n]
@@ -41,7 +42,7 @@ function K({ channels: i, channelTooltips: u, selectedChannelType: s }) {
41
42
  if (!n) return null;
42
43
  const [e] = n.split(".");
43
44
  return e.includes("waba") ? "whatsapp" : e.includes("telegrambot") ? "telegram" : e;
44
- }, g = (n) => t.value.filter((e) => o(e.channelId) === n).length > 1, f = (n) => s.value === n, m = (n) => {
45
+ }, g = (n) => t.value.filter((e) => o(e.channelId) === n).length > 1, f = (n) => s.value === n, l = (n) => {
45
46
  const e = t.value.filter((I) => o(I.channelId) === n);
46
47
  return e.length === 1 ? e[0] : null;
47
48
  }, a = (n) => E[n] ?? null, r = (n) => {
@@ -54,11 +55,11 @@ function K({ channels: i, channelTooltips: u, selectedChannelType: s }) {
54
55
  getChannelTypeFromId: o,
55
56
  hasMultipleChannels: g,
56
57
  isChannelActive: f,
57
- getSingleChannelForType: m,
58
+ getSingleChannelForType: l,
58
59
  getMenuChannelIconComponent: a,
59
60
  getMenuChannelIconComponentForChannelId: r,
60
61
  getSingleMenuChannelIconComponent: (n) => {
61
- const e = m(n);
62
+ const e = l(n);
62
63
  return e ? r(e.channelId) : a(n);
63
64
  },
64
65
  getAvailableChannels: (n) => t.value.filter((e) => o(e.channelId) === n)
@@ -66,5 +67,5 @@ function K({ channels: i, channelTooltips: u, selectedChannelType: s }) {
66
67
  }
67
68
  export {
68
69
  F as CHANNEL_TYPES,
69
- K as useCommunicationChannels
70
+ O as useCommunicationChannels
70
71
  };
@@ -1,36 +1,31 @@
1
- import { ref as l } from "vue";
2
- function M({
3
- panelRef: f,
4
- channelsPanelRef: s,
5
- selectedChannelType: d,
6
- frozenAttribute: o
1
+ import { ref as n } from "vue";
2
+ function C({
3
+ panelRef: c,
4
+ selectedChannelType: i,
5
+ frozenAttribute: t
7
6
  }) {
8
- const n = l(null), h = l(null), u = l(!1), a = l(!1), i = l("0px"), c = () => {
9
- s.value && (i.value = `${s.value.offsetWidth}px`);
10
- }, t = () => {
11
- u.value = !1, n.value = null, o.value = null, a.value = !1;
7
+ const l = n(null), v = n(null), u = n(!1), a = n(!1), s = () => {
8
+ u.value = !1, l.value = null, t.value = null, a.value = !1;
12
9
  };
13
10
  return {
14
- activeChannelType: n,
15
- hoveredChannel: h,
11
+ activeChannelType: l,
12
+ hoveredChannel: v,
16
13
  showMenu: u,
17
14
  showSubMenu: a,
18
- menuWidth: i,
19
- updateMenuWidth: c,
20
15
  handleChannelClick: (e) => {
21
- if (d.value === e && n.value === e) {
22
- t();
16
+ if (i.value === e && l.value === e) {
17
+ s();
23
18
  return;
24
19
  }
25
- n.value = e, u.value = !0, a.value = !1, o.value = null, c();
20
+ l.value = e, u.value = !0, a.value = !1, t.value = null;
26
21
  },
27
- closeMenu: t,
22
+ closeMenu: s,
28
23
  handleClickOutside: (e) => {
29
- const v = f.value;
30
- v && !v.contains(e.target) && t();
24
+ const o = c.value;
25
+ o && !o.contains(e.target) && s();
31
26
  }
32
27
  };
33
28
  }
34
29
  export {
35
- M as useCommunicationMenu
30
+ C as useCommunicationMenu
36
31
  };
@@ -1,17 +1,18 @@
1
- import { ref as f } from "vue";
2
- function q({
1
+ import { ref as C } from "vue";
2
+ function N({
3
3
  activeChannelType: g,
4
4
  showSubMenu: n,
5
5
  frozenAttribute: o,
6
6
  hoveredAttribute: b,
7
- hasMultipleChannels: h
7
+ hasMultipleChannels: h,
8
+ isAttributeBlocked: M
8
9
  }) {
9
- const t = f(0);
10
+ const t = C(0);
10
11
  return {
11
12
  subMenuTop: t,
12
13
  handleAttributeMouseEnter: (e, l) => {
13
14
  const u = g.value;
14
- return !u || !h(u) ? null : (b.value = e, n.value = !0, o.value = e, l);
15
+ return !u || !h(u) || M(e) ? null : (b.value = e, n.value = !0, o.value = e, l);
15
16
  },
16
17
  handleAttributeMouseLeave: () => {
17
18
  n.value || (o.value = null);
@@ -34,10 +35,10 @@ function q({
34
35
  t.value = 0;
35
36
  return;
36
37
  }
37
- const M = i.getBoundingClientRect(), S = l.getBoundingClientRect();
38
+ const S = i.getBoundingClientRect(), y = l.getBoundingClientRect();
38
39
  let m = 0;
39
40
  if (a) {
40
- const c = a.getBoundingClientRect(), y = getComputedStyle(a), p = parseFloat(y.marginBottom || "0");
41
+ const c = a.getBoundingClientRect(), f = getComputedStyle(a), p = parseFloat(f.marginBottom || "0");
41
42
  m = c.height + (Number.isNaN(p) ? 0 : p);
42
43
  }
43
44
  let d = 0;
@@ -45,7 +46,7 @@ function q({
45
46
  const c = getComputedStyle(v);
46
47
  d = parseFloat(c.paddingTop || "0") || 0;
47
48
  }
48
- t.value = S.top - M.top - m - d - 2;
49
+ t.value = y.top - S.top - m - d - 2;
49
50
  } catch {
50
51
  t.value = 0;
51
52
  }
@@ -53,5 +54,5 @@ function q({
53
54
  };
54
55
  }
55
56
  export {
56
- q as useCommunicationSubMenu
57
+ N as useCommunicationSubMenu
57
58
  };
@@ -4,7 +4,7 @@ const r = {}, l = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: "16",
6
6
  height: "16",
7
- fill: "#007CFF",
7
+ fill: "currentColor",
8
8
  class: "bi bi-check-lg",
9
9
  viewBox: "0 0 16 16"
10
10
  };
@@ -0,0 +1,15 @@
1
+ import { createElementBlock as n, openBlock as e } from "vue";
2
+ /* empty css */
3
+ import o from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const r = {}, t = {
5
+ class: "communication-panel-confirm-spinner",
6
+ role: "status",
7
+ "aria-label": "Подтверждение"
8
+ };
9
+ function c(a, i) {
10
+ return e(), n("span", t);
11
+ }
12
+ const p = /* @__PURE__ */ o(r, [["render", c], ["__scopeId", "data-v-7347f47e"]]);
13
+ export {
14
+ p as default
15
+ };
@@ -1,22 +1,26 @@
1
- function p(e, i, t) {
1
+ function u(e, i, t) {
2
2
  const s = [], a = `chats[${i}].actions[${t}]`;
3
3
  return typeof e != "object" || e === null ? (s.push({ path: a, message: "Action должен быть объектом", value: e }), s) : ((!e.action || typeof e.action != "string") && s.push({ path: `${a}.action`, message: "Поле action обязательно и должно быть строкой", value: e.action }), (!e.title || typeof e.title != "string") && s.push({ path: `${a}.title`, message: "Поле title обязательно и должно быть строкой", value: e.title }), e.icon !== void 0 && typeof e.icon != "string" && s.push({ path: `${a}.icon`, message: "Поле icon должно быть строкой", value: e.icon }), s);
4
4
  }
5
- function u(e, i, t) {
5
+ function p(e, i, t) {
6
6
  const s = [], a = `chats[${i}].contact.attributes[${t}]`;
7
- return typeof e != "object" || e === null ? (s.push({ path: a, message: "Атрибут контакта должен быть объектом", value: e }), s) : ((!e.id || typeof e.id != "string") && s.push({ path: `${a}.id`, message: "Поле id обязательно и должно быть строкой", value: e.id }), e.type !== void 0 && typeof e.type != "string" && s.push({ path: `${a}.type`, message: "Поле type должно быть строкой", value: e.type }), e.data !== void 0 && (typeof e.data != "string" && typeof e.data != "object" ? s.push({ path: `${a}.data`, message: "Поле data должно быть строкой или объектом", value: e.data }) : typeof e.data == "object" && ((!e.data.id || typeof e.data.id != "string") && s.push({ path: `${a}.data.id`, message: "Поле data.id должно быть строкой", value: e.data.id }), (!e.data.nickname || typeof e.data.nickname != "string") && s.push({ path: `${a}.data.nickname`, message: "Поле data.nickname должно быть строкой", value: e.data.nickname }), (!e.data.phone || typeof e.data.phone != "string") && s.push({ path: `${a}.data.phone`, message: "Поле data.phone должно быть строкой", value: e.data.phone }))), (!e.value || typeof e.value != "string") && s.push({ path: `${a}.value`, message: "Поле value обязательно и должно быть строкой", value: e.value }), s);
7
+ return typeof e != "object" || e === null ? (s.push({ path: a, message: "Атрибут контакта должен быть объектом", value: e }), s) : ((!e.id || typeof e.id != "string") && s.push({ path: `${a}.id`, message: "Поле id обязательно и должно быть строкой", value: e.id }), e.type !== void 0 && typeof e.type != "string" && s.push({ path: `${a}.type`, message: "Поле type должно быть строкой", value: e.type }), e.data !== void 0 && (typeof e.data != "string" && typeof e.data != "object" ? s.push({ path: `${a}.data`, message: "Поле data должно быть строкой или объектом", value: e.data }) : typeof e.data == "object" && ((!e.data.id || typeof e.data.id != "string") && s.push({ path: `${a}.data.id`, message: "Поле data.id должно быть строкой", value: e.data.id }), (!e.data.nickname || typeof e.data.nickname != "string") && s.push({ path: `${a}.data.nickname`, message: "Поле data.nickname должно быть строкой", value: e.data.nickname }), (!e.data.phone || typeof e.data.phone != "string") && s.push({ path: `${a}.data.phone`, message: "Поле data.phone должно быть строкой", value: e.data.phone }))), (!e.value || typeof e.value != "string") && s.push({ path: `${a}.value`, message: "Поле value обязательно и должно быть строкой", value: e.value }), e.status !== void 0 && (typeof e.status != "string" || !["confirmed", "unconfirmed"].includes(e.status)) && s.push({
8
+ path: `${a}.status`,
9
+ message: 'Поле status должно быть "confirmed" или "unconfirmed"',
10
+ value: e.status
11
+ }), s);
8
12
  }
9
13
  function o(e, i) {
10
14
  const t = [], s = `chats[${i}].contact`;
11
15
  return typeof e != "object" || e === null ? (t.push({ path: s, message: "Contact должен быть объектом", value: e }), t) : e.attributes !== void 0 && !Array.isArray(e.attributes) ? (t.push({ path: `${s}.attributes`, message: "Поле attributes должно быть массивом", value: e.attributes }), t) : (e.attributes && e.attributes.forEach((a, n) => {
12
- t.push(...u(a, i, n));
16
+ t.push(...p(a, i, n));
13
17
  }), t);
14
18
  }
15
- function l(e, i, t) {
19
+ function d(e, i, t) {
16
20
  const s = [], a = `chats[${i}].dialogs[${t}]`;
17
21
  return typeof e != "object" || e === null ? (s.push({ path: a, message: "Диалог должен быть объектом", value: e }), s) : ((!e.dialogId || typeof e.dialogId != "string") && s.push({ path: `${a}.dialogId`, message: "Поле dialogId обязательно и должно быть строкой", value: e.dialogId }), (!e.name || typeof e.name != "string") && s.push({ path: `${a}.name`, message: "Поле name обязательно и должно быть строкой", value: e.name }), e["lastActivity.timestamp"] === void 0 ? s.push({ path: `${a}['lastActivity.timestamp']`, message: "Поле lastActivity.timestamp обязательно", value: e["lastActivity.timestamp"] }) : typeof e["lastActivity.timestamp"] != "number" && s.push({ path: `${a}['lastActivity.timestamp']`, message: "Поле lastActivity.timestamp должно быть числом", value: e["lastActivity.timestamp"] }), (e.isSelected === void 0 || typeof e.isSelected != "boolean") && s.push({ path: `${a}.isSelected`, message: "Поле isSelected обязательно и должно быть boolean", value: e.isSelected }), e.branchId !== void 0 && typeof e.branchId != "string" && s.push({ path: `${a}.branchId`, message: "Поле branchId должно быть строкой", value: e.branchId }), e.attributeId !== void 0 && typeof e.attributeId != "string" && s.push({ path: `${a}.attributeId`, message: "Поле attributeId должно быть строкой", value: e.attributeId }), e.channelId !== void 0 && typeof e.channelId != "string" && s.push({ path: `${a}.channelId`, message: "Поле channelId должно быть строкой", value: e.channelId }), e.icon !== void 0 && typeof e.icon != "string" && s.push({ path: `${a}.icon`, message: "Поле icon должно быть строкой", value: e.icon }), e.fullname !== void 0 && typeof e.fullname != "string" && s.push({ path: `${a}.fullname`, message: "Поле fullname должно быть строкой", value: e.fullname }), e.countUnread !== void 0 && typeof e.countUnread != "number" && s.push({ path: `${a}.countUnread`, message: "Поле countUnread должно быть числом", value: e.countUnread }), e["lastActivity.time"] !== void 0 && typeof e["lastActivity.time"] != "string" && s.push({ path: `${a}['lastActivity.time']`, message: "Поле lastActivity.time должно быть строкой", value: e["lastActivity.time"] }), s);
18
22
  }
19
- function d(e, i) {
23
+ function l(e, i) {
20
24
  const t = [], s = `chats[${i}]`;
21
25
  if (typeof e != "object" || e === null)
22
26
  return t.push({ path: s, message: "Чат должен быть объектом", value: e }), t;
@@ -29,9 +33,9 @@ function d(e, i) {
29
33
  });
30
34
  }
31
35
  return e.isFixedTop !== void 0 && typeof e.isFixedTop != "boolean" && t.push({ path: `${s}.isFixedTop`, message: "Поле isFixedTop должно быть boolean", value: e.isFixedTop }), e.isFixedBottom !== void 0 && typeof e.isFixedBottom != "boolean" && t.push({ path: `${s}.isFixedBottom`, message: "Поле isFixedBottom должно быть boolean", value: e.isFixedBottom }), e.isFixed !== void 0 && typeof e.isFixed != "boolean" && t.push({ path: `${s}.isFixed`, message: "Поле isFixed должно быть boolean", value: e.isFixed }), e.status !== void 0 && typeof e.status != "string" && t.push({ path: `${s}.status`, message: "Поле status должно быть строкой", value: e.status }), e.statusMessage !== void 0 && typeof e.statusMessage != "string" && t.push({ path: `${s}.statusMessage`, message: "Поле statusMessage должно быть строкой", value: e.statusMessage }), e.colorUnread !== void 0 && typeof e.colorUnread != "string" && t.push({ path: `${s}.colorUnread`, message: "Поле colorUnread должно быть строкой", value: e.colorUnread }), e.typing !== void 0 && typeof e.typing != "boolean" && t.push({ path: `${s}.typing`, message: "Поле typing должно быть boolean", value: e.typing }), e.metadata !== void 0 && typeof e.metadata != "string" && t.push({ path: `${s}.metadata`, message: "Поле metadata должно быть строкой", value: e.metadata }), e.dialogsExpanded !== void 0 && typeof e.dialogsExpanded != "boolean" && t.push({ path: `${s}.dialogsExpanded`, message: "Поле dialogsExpanded должно быть boolean", value: e.dialogsExpanded }), e.actions !== void 0 && (Array.isArray(e.actions) ? e.actions.forEach((a, n) => {
32
- t.push(...p(a, i, n));
36
+ t.push(...u(a, i, n));
33
37
  }) : t.push({ path: `${s}.actions`, message: "Поле actions должно быть массивом", value: e.actions })), e.dialogs !== void 0 && (Array.isArray(e.dialogs) ? e.dialogs.forEach((a, n) => {
34
- t.push(...l(a, i, n));
38
+ t.push(...d(a, i, n));
35
39
  }) : t.push({ path: `${s}.dialogs`, message: "Поле dialogs должно быть массивом", value: e.dialogs })), e.contact !== void 0 && t.push(...o(e.contact, i)), t;
36
40
  }
37
41
  function f(e) {
@@ -51,7 +55,7 @@ function f(e) {
51
55
  value: a.chatId
52
56
  }) : s.add(a.chatId));
53
57
  }), e.forEach((a, n) => {
54
- i.push(...d(a, n));
58
+ i.push(...l(a, n));
55
59
  }), {
56
60
  isValid: i.length === 0,
57
61
  errors: i,