@mobilon-dev/chotto 0.3.77 → 0.3.79
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.
- package/dist/chotto.css +1 -1
- package/dist/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.js +292 -270
- package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.js +60 -62
- package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationChannels.js +73 -49
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/components/2_blocks/CommunicationPanel/CommunicationPanel.vue.d.ts +4 -0
- package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.d.ts +5 -3
- package/dist/types/components/2_blocks/CommunicationPanel/composables/useCommunicationChannels.d.ts +16 -2
- package/dist/types/components/2_blocks/CommunicationPanel/stories/CommunicationPanel.stories.d.ts +8 -0
- package/dist/types/components/2_blocks/CommunicationPanel/styles/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/components/2_blocks/CommunicationPanel/composables/useCommunicationAttributes.js
CHANGED
|
@@ -1,100 +1,98 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return C.includes(n);
|
|
1
|
+
import { computed as A, unref as a, ref as y, watch as g } from "vue";
|
|
2
|
+
const T = ["confirmed", "unconfirmed"];
|
|
3
|
+
function w(n) {
|
|
4
|
+
return T.includes(n);
|
|
6
5
|
}
|
|
7
|
-
function
|
|
6
|
+
function B(n) {
|
|
8
7
|
const e = n == null ? void 0 : n.status;
|
|
9
|
-
return
|
|
8
|
+
return w(e) ? `status-${e}` : null;
|
|
10
9
|
}
|
|
11
|
-
function
|
|
10
|
+
function C(n) {
|
|
12
11
|
return (n == null ? void 0 : n.status) === "confirmed";
|
|
13
12
|
}
|
|
14
|
-
function
|
|
13
|
+
function E(n) {
|
|
15
14
|
return (n == null ? void 0 : n.status) === "unconfirmed";
|
|
16
15
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
16
|
+
function O(n) {
|
|
17
|
+
return E(n);
|
|
19
18
|
}
|
|
20
|
-
function
|
|
21
|
-
return e ||
|
|
19
|
+
function d(n, e) {
|
|
20
|
+
return e || C(n);
|
|
22
21
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
22
|
+
function U(n, e) {
|
|
23
|
+
return d(n, e) ? e ? "selected-indicator" : "confirmed-indicator" : null;
|
|
25
24
|
}
|
|
26
|
-
function
|
|
25
|
+
function l(n, e) {
|
|
27
26
|
return !e || !(n != null && n.id) ? !1 : n.id === e;
|
|
28
27
|
}
|
|
29
|
-
function
|
|
28
|
+
function S(n, e) {
|
|
30
29
|
return !(n != null && n.id) || !(e != null && e.length) ? !1 : e.includes(n.id);
|
|
31
30
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
31
|
+
function v(n, e) {
|
|
32
|
+
return l(n, e.confirmingAttributeId) || d(n, e.isSelected);
|
|
34
33
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
34
|
+
function F(n, e) {
|
|
35
|
+
return S(n, e.blockedAttributeIds) ? !l(n, e.confirmingAttributeId) && !d(n, e.isSelected) : !1;
|
|
37
36
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
37
|
+
function z(n, e) {
|
|
38
|
+
return l(n, e.confirmingAttributeId) ? "confirming" : S(n, e.blockedAttributeIds) ? "blocked" : v(n, e) ? e.isSelected ? "selected" : C(n) ? "confirmed" : null : null;
|
|
40
39
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
return !
|
|
40
|
+
function L(n, e, c) {
|
|
41
|
+
const s = z(n, c);
|
|
42
|
+
return !s || !e ? "" : e[s] ?? "";
|
|
44
43
|
}
|
|
45
|
-
function
|
|
44
|
+
function _({
|
|
46
45
|
contactAttributes: n,
|
|
47
|
-
|
|
46
|
+
panelChannelTypes: e,
|
|
47
|
+
frozenAttribute: c
|
|
48
48
|
}) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
),
|
|
52
|
-
const i =
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
u.value.forEach((r) => {
|
|
49
|
+
const s = A(() => a(n) ?? []), f = A(() => a(e) ?? []), m = (o) => Object.fromEntries(o.map((i) => [i, []])), p = y(
|
|
50
|
+
m(f.value)
|
|
51
|
+
), t = () => {
|
|
52
|
+
const o = f.value, i = m(o), u = new Set(o);
|
|
53
|
+
s.value.forEach((r) => {
|
|
56
54
|
if (!(!r || !r.type)) {
|
|
57
55
|
if (r.type === "telegram") {
|
|
58
|
-
i.telegram.push(r);
|
|
56
|
+
u.has("telegram") && i.telegram.push(r);
|
|
59
57
|
return;
|
|
60
58
|
}
|
|
61
59
|
if (r.type === "max") {
|
|
62
|
-
i.max.push(r);
|
|
60
|
+
u.has("max") && i.max.push(r);
|
|
63
61
|
return;
|
|
64
62
|
}
|
|
65
63
|
if (r.type === "phone") {
|
|
66
|
-
["whatsapp", "sms", "phone"].forEach((
|
|
67
|
-
i[
|
|
64
|
+
["whatsapp", "sms", "phone"].forEach((h) => {
|
|
65
|
+
u.has(h) && i[h].push(r);
|
|
68
66
|
});
|
|
69
67
|
return;
|
|
70
68
|
}
|
|
71
|
-
i[r.type] && i[r.type].push(r);
|
|
69
|
+
u.has(r.type) && i[r.type] && i[r.type].push(r);
|
|
72
70
|
}
|
|
73
|
-
}),
|
|
71
|
+
}), p.value = i;
|
|
74
72
|
};
|
|
75
|
-
return g(
|
|
76
|
-
organizedContactAttributes:
|
|
77
|
-
organizeContactAttributes:
|
|
78
|
-
isAttributeFrozen: (
|
|
79
|
-
const
|
|
80
|
-
return !
|
|
73
|
+
return g(s, t, { deep: !0, immediate: !0 }), g(f, t), {
|
|
74
|
+
organizedContactAttributes: p,
|
|
75
|
+
organizeContactAttributes: t,
|
|
76
|
+
isAttributeFrozen: (o) => {
|
|
77
|
+
const i = c.value;
|
|
78
|
+
return !o || !(i != null && i.id) ? !1 : o.id === i.id;
|
|
81
79
|
}
|
|
82
80
|
};
|
|
83
81
|
}
|
|
84
82
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
T as CONTACT_ATTRIBUTE_STATUSES,
|
|
84
|
+
U as getAttributeCheckIndicatorClass,
|
|
85
|
+
z as getAttributeIndicatorTooltipKey,
|
|
86
|
+
L as getAttributeIndicatorTooltipText,
|
|
87
|
+
B as getAttributeStatusClass,
|
|
88
|
+
S as isAttributeBlocked,
|
|
89
|
+
C as isAttributeConfirmed,
|
|
90
|
+
l as isAttributeConfirming,
|
|
91
|
+
E as isAttributeUnconfirmed,
|
|
92
|
+
w as isContactAttributeStatus,
|
|
93
|
+
O as needsAttributeConfirmation,
|
|
94
|
+
d as shouldShowAttributeCheckmark,
|
|
95
|
+
v as shouldShowAttributeIndicator,
|
|
96
|
+
F as shouldShowBlockedIndicatorSlot,
|
|
97
|
+
_ as useCommunicationAttributes
|
|
100
98
|
};
|
|
@@ -1,71 +1,95 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as c, unref as i } from "vue";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
import M from "../icons/CommunicationPanelPhoneIcon.vue.js";
|
|
4
|
+
import b from "../icons/CommunicationPanelWhatsAppIcon.vue.js";
|
|
5
|
+
import w from "../icons/CommunicationPanelTelegramIcon.vue.js";
|
|
6
|
+
import x from "../icons/CommunicationPanelMaxIcon.vue.js";
|
|
7
|
+
import A from "../icons/CommunicationPanelSMSIcon.vue.js";
|
|
8
|
+
import y from "../icons/CommunicationPanelSubmenuPhoneIcon.vue.js";
|
|
9
|
+
import E from "../icons/CommunicationPanelSubmenuWhatsAppIcon.vue.js";
|
|
10
|
+
import F from "../icons/CommunicationPanelSubmenuTelegramIcon.vue.js";
|
|
11
|
+
import L from "../icons/CommunicationPanelSubmenuMaxIcon.vue.js";
|
|
12
|
+
import N from "../icons/CommunicationPanelSubmenuSMSIcon.vue.js";
|
|
13
|
+
const I = ["whatsapp", "telegram", "max", "sms", "phone"], _ = ["max", "telegram", "whatsapp", "sms", "phone"];
|
|
14
|
+
function g(a) {
|
|
15
|
+
return I.includes(a);
|
|
16
|
+
}
|
|
17
|
+
function D(a, r) {
|
|
18
|
+
const u = (a ?? _).filter(g), m = r === void 0 ? [...I] : r.filter(g), p = new Set(m), t = /* @__PURE__ */ new Set(), l = [];
|
|
19
|
+
for (const o of u)
|
|
20
|
+
p.has(o) && !t.has(o) && (t.add(o), l.push(o));
|
|
21
|
+
for (const o of m)
|
|
22
|
+
t.has(o) || (t.add(o), l.push(o));
|
|
23
|
+
return l;
|
|
24
|
+
}
|
|
25
|
+
const H = {
|
|
26
|
+
phone: M,
|
|
27
|
+
whatsapp: b,
|
|
28
|
+
telegram: w,
|
|
29
|
+
max: x,
|
|
24
30
|
sms: A
|
|
25
|
-
},
|
|
31
|
+
}, R = {
|
|
32
|
+
phone: y,
|
|
33
|
+
whatsapp: E,
|
|
34
|
+
telegram: F,
|
|
35
|
+
max: L,
|
|
36
|
+
sms: N
|
|
37
|
+
}, W = {
|
|
26
38
|
phone: "Позвонить",
|
|
27
39
|
whatsapp: "Выберите контакт и канал для отправки сообщения",
|
|
28
40
|
telegram: "Выберите контакт и канал для отправки сообщения",
|
|
29
41
|
max: "Выберите контакт и канал для отправки сообщения",
|
|
30
42
|
sms: "Выберите контакт и канал для отправки сообщения"
|
|
31
43
|
};
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
function Z({
|
|
45
|
+
channels: a,
|
|
46
|
+
channelTooltips: r,
|
|
47
|
+
channelOrder: u,
|
|
48
|
+
visibleChannelTypes: m,
|
|
49
|
+
selectedChannelType: p
|
|
50
|
+
}) {
|
|
51
|
+
const t = c(() => i(a) ?? []), l = c(() => i(r) ?? {}), o = c(
|
|
52
|
+
() => D(i(u), i(m))
|
|
53
|
+
), d = c(
|
|
54
|
+
() => o.value.map((n) => ({
|
|
35
55
|
type: n,
|
|
36
|
-
component:
|
|
56
|
+
component: H[n]
|
|
37
57
|
}))
|
|
38
|
-
),
|
|
39
|
-
const e =
|
|
40
|
-
return e || (
|
|
41
|
-
},
|
|
58
|
+
), S = (n) => {
|
|
59
|
+
const e = l.value[n];
|
|
60
|
+
return e || (W[n] ?? "");
|
|
61
|
+
}, s = (n) => {
|
|
42
62
|
if (!n) return null;
|
|
43
63
|
const [e] = n.split(".");
|
|
44
64
|
return e.includes("waba") ? "whatsapp" : e.includes("telegrambot") ? "telegram" : e;
|
|
45
|
-
},
|
|
46
|
-
const e = t.value.filter((
|
|
65
|
+
}, P = (n) => t.value.filter((e) => s(e.channelId) === n).length > 1, T = (n) => p.value === n, C = (n) => {
|
|
66
|
+
const e = t.value.filter((v) => s(v.channelId) === n);
|
|
47
67
|
return e.length === 1 ? e[0] : null;
|
|
48
|
-
},
|
|
49
|
-
const e =
|
|
50
|
-
return e ?
|
|
68
|
+
}, h = (n) => R[n] ?? null, f = (n) => {
|
|
69
|
+
const e = s(n);
|
|
70
|
+
return e ? h(e) : null;
|
|
51
71
|
};
|
|
52
72
|
return {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
panelChannelTypes: o,
|
|
74
|
+
channelsTypes: d,
|
|
75
|
+
getTooltipText: S,
|
|
76
|
+
getChannelTypeFromId: s,
|
|
77
|
+
hasMultipleChannels: P,
|
|
78
|
+
isChannelActive: T,
|
|
79
|
+
getSingleChannelForType: C,
|
|
80
|
+
getMenuChannelIconComponent: h,
|
|
81
|
+
getMenuChannelIconComponentForChannelId: f,
|
|
61
82
|
getSingleMenuChannelIconComponent: (n) => {
|
|
62
|
-
const e =
|
|
63
|
-
return e ?
|
|
83
|
+
const e = C(n);
|
|
84
|
+
return e ? f(e.channelId) : h(n);
|
|
64
85
|
},
|
|
65
|
-
getAvailableChannels: (n) => t.value.filter((e) =>
|
|
86
|
+
getAvailableChannels: (n) => t.value.filter((e) => s(e.channelId) === n)
|
|
66
87
|
};
|
|
67
88
|
}
|
|
68
89
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
90
|
+
I as CHANNEL_TYPES,
|
|
91
|
+
_ as DEFAULT_CHANNEL_ORDER,
|
|
92
|
+
g as isChannelType,
|
|
93
|
+
D as resolvePanelChannelTypes,
|
|
94
|
+
Z as useCommunicationChannels
|
|
71
95
|
};
|