@volo/abp.ng.chat 7.2.2 → 7.3.0-rc.2
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/README.md +128 -2
- package/config/chat-config.module.d.ts +10 -10
- package/config/components/chat-icon.component.d.ts +17 -17
- package/config/enums/index.d.ts +2 -2
- package/config/enums/policy-names.d.ts +3 -3
- package/config/enums/route-names.d.ts +3 -3
- package/config/index.d.ts +5 -5
- package/config/providers/index.d.ts +2 -2
- package/config/providers/nav-item.provider.d.ts +9 -9
- package/config/providers/route.provider.d.ts +8 -8
- package/config/public-api.d.ts +5 -5
- package/config/services/chat-config.service.d.ts +38 -38
- package/esm2022/config/chat-config.module.mjs +36 -0
- package/esm2022/config/components/chat-icon.component.mjs +64 -0
- package/{esm2020 → esm2022}/config/enums/index.mjs +2 -2
- package/{esm2020 → esm2022}/config/enums/policy-names.mjs +1 -1
- package/{esm2020 → esm2022}/config/enums/route-names.mjs +1 -1
- package/{esm2020 → esm2022}/config/providers/index.mjs +2 -2
- package/{esm2020 → esm2022}/config/providers/nav-item.provider.mjs +27 -27
- package/{esm2020 → esm2022}/config/providers/route.provider.mjs +19 -19
- package/{esm2020 → esm2022}/config/public-api.mjs +5 -5
- package/esm2022/config/services/chat-config.service.mjs +98 -0
- package/{esm2020 → esm2022}/config/volo-abp.ng.chat-config.mjs +4 -4
- package/esm2022/lib/chat-routing.module.mjs +40 -0
- package/esm2022/lib/chat.module.mjs +45 -0
- package/esm2022/lib/components/chat-contacts.component.mjs +111 -0
- package/esm2022/lib/components/chat-message-title.component.mjs +44 -0
- package/esm2022/lib/components/chat.component.mjs +204 -0
- package/esm2022/lib/components/conversation-avatar.component.mjs +63 -0
- package/{esm2020 → esm2022}/lib/components/index.mjs +4 -4
- package/{esm2020 → esm2022}/lib/enums/chat-message-side.mjs +5 -5
- package/{esm2020 → esm2022}/lib/enums/index.mjs +1 -1
- package/{esm2020 → esm2022}/lib/models/chat-contact-dto.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/chat-conversation-dto.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/chat-message-dto.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/chat-target-user-info.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/get-contacts-input.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/get-conversation-input.mjs +6 -6
- package/{esm2020 → esm2022}/lib/models/index.mjs +9 -9
- package/{esm2020 → esm2022}/lib/models/mark-conversation-as-read-input.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/send-message-input.mjs +11 -11
- package/{esm2020 → esm2022}/lib/models/send-on-enter-setting-dto.mjs +11 -11
- package/esm2022/lib/services/contact.service.mjs +21 -0
- package/esm2022/lib/services/conversation.service.mjs +27 -0
- package/{esm2020 → esm2022}/lib/services/index.mjs +3 -3
- package/esm2022/lib/services/settings.service.mjs +21 -0
- package/{esm2020 → esm2022}/proxy/lib/index.mjs +4 -4
- package/esm2022/proxy/lib/proxy/volo/chat/conversations/conversation.service.mjs +35 -0
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/conversations/index.mjs +2 -2
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/conversations/models.mjs +1 -1
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/messages/chat-message-side.enum.mjs +7 -7
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/messages/index.mjs +2 -2
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/messages/models.mjs +1 -1
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/settings/index.mjs +2 -2
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/settings/models.mjs +1 -1
- package/esm2022/proxy/lib/proxy/volo/chat/settings/settings.service.mjs +25 -0
- package/esm2022/proxy/lib/proxy/volo/chat/users/contact.service.mjs +29 -0
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/users/index.mjs +2 -2
- package/{esm2020 → esm2022}/proxy/lib/proxy/volo/chat/users/models.mjs +1 -1
- package/{esm2020 → esm2022}/proxy/public-api.mjs +1 -1
- package/{esm2020 → esm2022}/proxy/volo-abp.ng.chat-proxy.mjs +4 -4
- package/{esm2020 → esm2022}/public-api.mjs +5 -5
- package/{esm2020 → esm2022}/volo-abp.ng.chat.mjs +4 -4
- package/{fesm2020 → fesm2022}/volo-abp.ng.chat-config.mjs +186 -186
- package/{fesm2020 → fesm2022}/volo-abp.ng.chat-config.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/volo-abp.ng.chat-proxy.mjs +75 -75
- package/{fesm2020 → fesm2022}/volo-abp.ng.chat-proxy.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/volo-abp.ng.chat.mjs +531 -531
- package/{fesm2020 → fesm2022}/volo-abp.ng.chat.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/chat-routing.module.d.ts +7 -7
- package/lib/chat.module.d.ts +16 -16
- package/lib/components/chat-contacts.component.d.ts +31 -31
- package/lib/components/chat-message-title.component.d.ts +8 -8
- package/lib/components/chat.component.d.ts +47 -47
- package/lib/components/conversation-avatar.component.d.ts +14 -14
- package/lib/components/index.d.ts +4 -4
- package/lib/enums/chat-message-side.d.ts +4 -4
- package/lib/enums/index.d.ts +1 -1
- package/lib/models/chat-contact-dto.d.ts +11 -11
- package/lib/models/chat-conversation-dto.d.ts +7 -7
- package/lib/models/chat-message-dto.d.ts +9 -9
- package/lib/models/chat-target-user-info.d.ts +7 -7
- package/lib/models/get-contacts-input.d.ts +5 -5
- package/lib/models/get-conversation-input.d.ts +7 -7
- package/lib/models/index.d.ts +9 -9
- package/lib/models/mark-conversation-as-read-input.d.ts +4 -4
- package/lib/models/send-message-input.d.ts +5 -5
- package/lib/models/send-on-enter-setting-dto.d.ts +4 -4
- package/lib/services/contact.service.d.ts +13 -13
- package/lib/services/conversation.service.d.ts +17 -17
- package/lib/services/index.d.ts +3 -3
- package/lib/services/settings.service.d.ts +12 -12
- package/package.json +30 -21
- package/proxy/index.d.ts +5 -5
- package/proxy/lib/index.d.ts +4 -4
- package/proxy/lib/proxy/volo/chat/conversations/conversation.service.d.ts +14 -14
- package/proxy/lib/proxy/volo/chat/conversations/index.d.ts +2 -2
- package/proxy/lib/proxy/volo/chat/conversations/models.d.ts +13 -13
- package/proxy/lib/proxy/volo/chat/messages/chat-message-side.enum.d.ts +5 -5
- package/proxy/lib/proxy/volo/chat/messages/index.d.ts +2 -2
- package/proxy/lib/proxy/volo/chat/messages/models.d.ts +12 -12
- package/proxy/lib/proxy/volo/chat/settings/index.d.ts +2 -2
- package/proxy/lib/proxy/volo/chat/settings/models.d.ts +3 -3
- package/proxy/lib/proxy/volo/chat/settings/settings.service.d.ts +11 -11
- package/proxy/lib/proxy/volo/chat/users/contact.service.d.ts +12 -12
- package/proxy/lib/proxy/volo/chat/users/index.d.ts +2 -2
- package/proxy/lib/proxy/volo/chat/users/models.d.ts +21 -21
- package/proxy/public-api.d.ts +1 -1
- package/public-api.d.ts +5 -5
- package/esm2020/config/chat-config.module.mjs +0 -35
- package/esm2020/config/components/chat-icon.component.mjs +0 -63
- package/esm2020/config/services/chat-config.service.mjs +0 -97
- package/esm2020/lib/chat-routing.module.mjs +0 -39
- package/esm2020/lib/chat.module.mjs +0 -44
- package/esm2020/lib/components/chat-contacts.component.mjs +0 -110
- package/esm2020/lib/components/chat-message-title.component.mjs +0 -43
- package/esm2020/lib/components/chat.component.mjs +0 -203
- package/esm2020/lib/components/conversation-avatar.component.mjs +0 -62
- package/esm2020/lib/services/contact.service.mjs +0 -20
- package/esm2020/lib/services/conversation.service.mjs +0 -26
- package/esm2020/lib/services/settings.service.mjs +0 -20
- package/esm2020/proxy/lib/proxy/volo/chat/conversations/conversation.service.mjs +0 -34
- package/esm2020/proxy/lib/proxy/volo/chat/settings/settings.service.mjs +0 -24
- package/esm2020/proxy/lib/proxy/volo/chat/users/contact.service.mjs +0 -28
- package/fesm2015/volo-abp.ng.chat-config.mjs +0 -228
- package/fesm2015/volo-abp.ng.chat-config.mjs.map +0 -1
- package/fesm2015/volo-abp.ng.chat-proxy.mjs +0 -92
- package/fesm2015/volo-abp.ng.chat-proxy.mjs.map +0 -1
- package/fesm2015/volo-abp.ng.chat.mjs +0 -617
- package/fesm2015/volo-abp.ng.chat.mjs.map +0 -1
- package/proxy/src/lib/proxy/README.md +0 -17
|
@@ -11,303 +11,302 @@ import { finalize, debounceTime, takeUntil } from 'rxjs/operators';
|
|
|
11
11
|
import * as i4 from '@angular/common';
|
|
12
12
|
import * as i5 from '@angular/forms';
|
|
13
13
|
|
|
14
|
-
var ChatMessageSide;
|
|
15
|
-
(function (ChatMessageSide) {
|
|
16
|
-
ChatMessageSide[ChatMessageSide["Sender"] = 1] = "Sender";
|
|
17
|
-
ChatMessageSide[ChatMessageSide["Receiver"] = 2] = "Receiver";
|
|
14
|
+
var ChatMessageSide;
|
|
15
|
+
(function (ChatMessageSide) {
|
|
16
|
+
ChatMessageSide[ChatMessageSide["Sender"] = 1] = "Sender";
|
|
17
|
+
ChatMessageSide[ChatMessageSide["Receiver"] = 2] = "Receiver";
|
|
18
18
|
})(ChatMessageSide || (ChatMessageSide = {}));
|
|
19
19
|
|
|
20
|
-
class ConversationService {
|
|
21
|
-
constructor(restService) {
|
|
22
|
-
this.restService = restService;
|
|
23
|
-
this.apiName = 'Chat';
|
|
24
|
-
}
|
|
25
|
-
sendMessageByInput(body) {
|
|
26
|
-
return this.restService.request({ url: '/api/chat/conversation/send-message', method: 'POST', body }, { apiName: this.apiName });
|
|
27
|
-
}
|
|
28
|
-
getConversationByInput(params = {}) {
|
|
29
|
-
return this.restService.request({ url: '/api/chat/conversation/conversation', method: 'GET', params }, { apiName: this.apiName });
|
|
30
|
-
}
|
|
31
|
-
markConversationAsReadByInput(body) {
|
|
32
|
-
return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
38
|
-
type: Injectable,
|
|
39
|
-
args: [{ providedIn: 'root' }]
|
|
20
|
+
class ConversationService {
|
|
21
|
+
constructor(restService) {
|
|
22
|
+
this.restService = restService;
|
|
23
|
+
this.apiName = 'Chat';
|
|
24
|
+
}
|
|
25
|
+
sendMessageByInput(body) {
|
|
26
|
+
return this.restService.request({ url: '/api/chat/conversation/send-message', method: 'POST', body }, { apiName: this.apiName });
|
|
27
|
+
}
|
|
28
|
+
getConversationByInput(params = {}) {
|
|
29
|
+
return this.restService.request({ url: '/api/chat/conversation/conversation', method: 'GET', params }, { apiName: this.apiName });
|
|
30
|
+
}
|
|
31
|
+
markConversationAsReadByInput(body) {
|
|
32
|
+
return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
|
|
33
|
+
}
|
|
34
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConversationService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
35
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConversationService, providedIn: 'root' }); }
|
|
36
|
+
}
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConversationService, decorators: [{
|
|
38
|
+
type: Injectable,
|
|
39
|
+
args: [{ providedIn: 'root' }]
|
|
40
40
|
}], ctorParameters: function () { return [{ type: i3.RestService }]; } });
|
|
41
41
|
|
|
42
|
-
class ContactService {
|
|
43
|
-
constructor(restService) {
|
|
44
|
-
this.restService = restService;
|
|
45
|
-
this.apiName = 'Chat';
|
|
46
|
-
}
|
|
47
|
-
getContactsByInput(params = {}) {
|
|
48
|
-
return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
54
|
-
type: Injectable,
|
|
55
|
-
args: [{ providedIn: 'root' }]
|
|
42
|
+
class ContactService {
|
|
43
|
+
constructor(restService) {
|
|
44
|
+
this.restService = restService;
|
|
45
|
+
this.apiName = 'Chat';
|
|
46
|
+
}
|
|
47
|
+
getContactsByInput(params = {}) {
|
|
48
|
+
return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
|
|
49
|
+
}
|
|
50
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ContactService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
51
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ContactService, providedIn: 'root' }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ContactService, decorators: [{
|
|
54
|
+
type: Injectable,
|
|
55
|
+
args: [{ providedIn: 'root' }]
|
|
56
56
|
}], ctorParameters: function () { return [{ type: i3.RestService }]; } });
|
|
57
57
|
|
|
58
|
-
class ChatContactDto {
|
|
59
|
-
constructor(initialValues = {}) {
|
|
60
|
-
if (initialValues) {
|
|
61
|
-
for (const key in initialValues) {
|
|
62
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
63
|
-
this[key] = initialValues[key];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
58
|
+
class ChatContactDto {
|
|
59
|
+
constructor(initialValues = {}) {
|
|
60
|
+
if (initialValues) {
|
|
61
|
+
for (const key in initialValues) {
|
|
62
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
63
|
+
this[key] = initialValues[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const avatarStyles = [
|
|
71
|
-
{ color: '#ffffff', backgroundColor: '#3cb160' },
|
|
72
|
-
{ color: '#ffffff', backgroundColor: '#c373cc' },
|
|
73
|
-
{ color: '#ffffff', backgroundColor: '#2b78b3' },
|
|
74
|
-
{ color: '#ffffff', backgroundColor: '#6ac79a' },
|
|
75
|
-
{ color: '#ffffff', backgroundColor: '#aeb140' },
|
|
76
|
-
{ color: '#ffffff', backgroundColor: '#b773c0' },
|
|
77
|
-
{ color: '#ffffff', backgroundColor: '#e16d7a' },
|
|
78
|
-
{ color: '#ffffff', backgroundColor: '#ffac2a' },
|
|
79
|
-
{ color: '#ffffff', backgroundColor: '#21bbc7' },
|
|
80
|
-
{ color: '#ffffff', backgroundColor: '#59ab95' },
|
|
81
|
-
];
|
|
82
|
-
class ConversationAvatarComponent {
|
|
83
|
-
get avatarText() {
|
|
84
|
-
if (!this.contact || !this.contact.username)
|
|
85
|
-
return;
|
|
86
|
-
if (this.contact.name && this.contact.surname)
|
|
87
|
-
return this.contact.name[0] + this.contact.surname[0];
|
|
88
|
-
if (this.contact.name)
|
|
89
|
-
return this.contact.name.slice(0, 2);
|
|
90
|
-
return this.contact.username.slice(0, 2);
|
|
91
|
-
}
|
|
92
|
-
get avatarBgStyle() {
|
|
93
|
-
if (!this.contact || !this.contact.username)
|
|
94
|
-
return;
|
|
95
|
-
let hash = 0;
|
|
96
|
-
for (let i = 0; i < this.contact.username.length; i++) {
|
|
97
|
-
hash = this.contact.username.charCodeAt(i) + ((hash << 5) - hash);
|
|
98
|
-
}
|
|
99
|
-
return avatarStyles[Math.abs(hash % 10)];
|
|
100
|
-
}
|
|
101
|
-
get isSmall() {
|
|
102
|
-
return typeof this.small === 'string' || this.small;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
ConversationAvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template: `<div
|
|
70
|
+
const avatarStyles = [
|
|
71
|
+
{ color: '#ffffff', backgroundColor: '#3cb160' },
|
|
72
|
+
{ color: '#ffffff', backgroundColor: '#c373cc' },
|
|
73
|
+
{ color: '#ffffff', backgroundColor: '#2b78b3' },
|
|
74
|
+
{ color: '#ffffff', backgroundColor: '#6ac79a' },
|
|
75
|
+
{ color: '#ffffff', backgroundColor: '#aeb140' },
|
|
76
|
+
{ color: '#ffffff', backgroundColor: '#b773c0' },
|
|
77
|
+
{ color: '#ffffff', backgroundColor: '#e16d7a' },
|
|
78
|
+
{ color: '#ffffff', backgroundColor: '#ffac2a' },
|
|
79
|
+
{ color: '#ffffff', backgroundColor: '#21bbc7' },
|
|
80
|
+
{ color: '#ffffff', backgroundColor: '#59ab95' },
|
|
81
|
+
];
|
|
82
|
+
class ConversationAvatarComponent {
|
|
83
|
+
get avatarText() {
|
|
84
|
+
if (!this.contact || !this.contact.username)
|
|
85
|
+
return;
|
|
86
|
+
if (this.contact.name && this.contact.surname)
|
|
87
|
+
return this.contact.name[0] + this.contact.surname[0];
|
|
88
|
+
if (this.contact.name)
|
|
89
|
+
return this.contact.name.slice(0, 2);
|
|
90
|
+
return this.contact.username.slice(0, 2);
|
|
91
|
+
}
|
|
92
|
+
get avatarBgStyle() {
|
|
93
|
+
if (!this.contact || !this.contact.username)
|
|
94
|
+
return;
|
|
95
|
+
let hash = 0;
|
|
96
|
+
for (let i = 0; i < this.contact.username.length; i++) {
|
|
97
|
+
hash = this.contact.username.charCodeAt(i) + ((hash << 5) - hash);
|
|
98
|
+
}
|
|
99
|
+
return avatarStyles[Math.abs(hash % 10)];
|
|
100
|
+
}
|
|
101
|
+
get isSmall() {
|
|
102
|
+
return typeof this.small === 'string' || this.small;
|
|
103
|
+
}
|
|
104
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
105
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template: `<div
|
|
107
106
|
class="avatar me-2 float-start rounded-circle"
|
|
108
107
|
[class.small]="isSmall"
|
|
109
108
|
[ngStyle]="avatarBgStyle"
|
|
110
109
|
>
|
|
111
110
|
{{ avatarText }}
|
|
112
|
-
</div>`, isInline: true, styles: [".avatar{height:48px;width:48px;line-height:48px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:36px;width:36px;line-height:37px;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
</div>`, isInline: true, styles: [".avatar{height:48px;width:48px;line-height:48px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:36px;width:36px;line-height:37px;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
|
|
112
|
+
}
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
|
|
114
|
+
type: Component,
|
|
115
115
|
args: [{ selector: 'abp-conversation-avatar', template: `<div
|
|
116
116
|
class="avatar me-2 float-start rounded-circle"
|
|
117
117
|
[class.small]="isSmall"
|
|
118
118
|
[ngStyle]="avatarBgStyle"
|
|
119
119
|
>
|
|
120
120
|
{{ avatarText }}
|
|
121
|
-
</div>`, styles: [".avatar{height:48px;width:48px;line-height:48px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:36px;width:36px;line-height:37px;font-size:14px}\n"] }]
|
|
122
|
-
}], propDecorators: { contact: [{
|
|
123
|
-
type: Input
|
|
124
|
-
}], small: [{
|
|
125
|
-
type: Input
|
|
121
|
+
</div>`, styles: [".avatar{height:48px;width:48px;line-height:48px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:36px;width:36px;line-height:37px;font-size:14px}\n"] }]
|
|
122
|
+
}], propDecorators: { contact: [{
|
|
123
|
+
type: Input
|
|
124
|
+
}], small: [{
|
|
125
|
+
type: Input
|
|
126
126
|
}] } });
|
|
127
127
|
|
|
128
|
-
class ChatContactsComponent {
|
|
129
|
-
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
listenToNewMessages() {
|
|
149
|
-
this.subscription.addOne(this.chatConfigService.message$, (message = {}) => {
|
|
150
|
-
const index = this.allContacts.findIndex(cont => cont.userId === message.senderUserId);
|
|
151
|
-
const contact = {
|
|
152
|
-
userId: message.senderUserId,
|
|
153
|
-
username: message.senderUsername,
|
|
154
|
-
name: message.senderName,
|
|
155
|
-
surname: message.senderSurname,
|
|
156
|
-
lastMessage: message.text,
|
|
157
|
-
unreadMessageCount: 1,
|
|
158
|
-
lastMessageDate: new Date(),
|
|
159
|
-
lastMessageSide: ChatMessageSide.Receiver,
|
|
160
|
-
};
|
|
161
|
-
if (index > -1) {
|
|
162
|
-
this.allContacts[index] = {
|
|
163
|
-
...contact,
|
|
164
|
-
unreadMessageCount: this.selectedContact.userId === this.allContacts[index].userId
|
|
165
|
-
? 0
|
|
166
|
-
: this.allContacts[index].unreadMessageCount + 1,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
else if (!this.filter) {
|
|
170
|
-
this.allContacts.push(contact);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
ngOnInit() {
|
|
175
|
-
this.get(() => {
|
|
176
|
-
this.selectContact(this.allContacts.length ? this.allContacts[0] : {});
|
|
177
|
-
this.listenToNewMessages();
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
ngOnChanges() {
|
|
181
|
-
if (this.startConversation) {
|
|
182
|
-
this.get(() => { }, true);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
get(onSuccess, includeOtherContacts) {
|
|
186
|
-
const includeOtherContactsParam = typeof includeOtherContacts === 'boolean' ? includeOtherContacts : !!this.filter;
|
|
187
|
-
this.filter = this.filter.trim();
|
|
188
|
-
this.contactService
|
|
189
|
-
.getContactsByInput({ includeOtherContacts: includeOtherContactsParam, filter: this.filter })
|
|
190
|
-
.subscribe(res => {
|
|
191
|
-
this.allContacts = res;
|
|
192
|
-
if (onSuccess)
|
|
193
|
-
onSuccess();
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
selectContact(contact) {
|
|
197
|
-
this.selectedContact = contact;
|
|
198
|
-
this.selected.emit(contact);
|
|
199
|
-
}
|
|
200
|
-
changeLastMessageOfSelectedContact(message) {
|
|
201
|
-
this.selectedContact.lastMessage = message;
|
|
202
|
-
this.selectedContact.lastMessageDate = new Date();
|
|
203
|
-
const index = this.allContacts.findIndex(contact => contact.userId === this.selectedContact.userId);
|
|
204
|
-
this.allContacts[index] = this.selectedContact;
|
|
205
|
-
}
|
|
206
|
-
markSelectedContactAsRead() {
|
|
207
|
-
this.selectedContact.unreadMessageCount = 0;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
213
|
-
type: Component,
|
|
214
|
-
args: [{ selector: 'abp-chat-contacts', providers: [SubscriptionService], template: "<div class=\"card w-100 mb-3 mb-md-0\">\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <div class=\"mb-2 rounded-2\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <input\r\n id=\"contacts-filter\"\r\n type=\"search\"\r\n class=\"form-control form-control\"\r\n autocomplete=\"off\"\r\n spellcheck=\"false\"\r\n [(ngModel)]=\"filter\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n (input.debounce)=\"get()\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"messages-box m-0 p-0\">\r\n <div class=\"list-group rounded-3\" id=\"contact-list\">\r\n <ng-container\r\n *ngFor=\"let contact of contacts; let i = index; trackBy: trackByUserId\"\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n <div\r\n *ngIf=\"otherContacts.length\"\r\n class=\"list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-start-0 border-end-0\"\r\n >\r\n <small>{{ 'Chat::OtherContacts' | abpLocalization }}</small>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let contact of otherContacts; let i = index; trackBy: trackByUserId\"\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #contactTemplate let-contact let-i=\"index\">\r\n <a\r\n (click)=\"selectContact(contact)\"\r\n class=\"chat-contact list-group-item list-group-item-action cursor-pointer px-2 border-2 rounded-2 mb-1 mt-0 {{\r\n selectedContact.userId === contact.userId ? 'active' : ''\r\n }}\"\r\n >\r\n <div class=\"media\">\r\n <abp-conversation-avatar [contact]=\"contact\"></abp-conversation-avatar>\r\n <div class=\"media-body ms-2\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-0\">\r\n <h5 class=\"mb-0 mt-1\">\r\n <small *ngIf=\"contact.unreadMessageCount\" class=\"badge badge-success me-1\">{{\r\n contact.unreadMessageCount\r\n }}</small\r\n >{{ getContactName(contact) }}\r\n </h5>\r\n <small class=\"last-message-date\">{{ contact.lastMessageDate | date }}</small>\r\n </div>\r\n <p class=\"mb-0 small last-message\">\r\n {{\r\n contact.lastMessage?.length > 24\r\n ? (contact.lastMessage | slice: 0:23) + '...'\r\n : contact.lastMessage\r\n }}\r\n </p>\r\n </div>\r\n </div>\r\n </a>\r\n</ng-template>\r\n", styles: [".messages-box{overflow-y:scroll;max-height:calc(100vh - 254.34px)}\n"] }]
|
|
215
|
-
}], ctorParameters: function () { return [{ type: ContactService }, { type: i2.ChatConfigService }, { type: i3.SubscriptionService }]; }, propDecorators: { startConversation: [{
|
|
216
|
-
type: Input
|
|
217
|
-
}], selected: [{
|
|
218
|
-
type: Output
|
|
219
|
-
}] } });
|
|
220
|
-
function getContactName({ name, surname, username }) {
|
|
221
|
-
if (!name && !surname)
|
|
222
|
-
return username;
|
|
223
|
-
return `${name || ''} ${surname || ''}`;
|
|
128
|
+
class ChatContactsComponent {
|
|
129
|
+
get contacts() {
|
|
130
|
+
return this.allContacts
|
|
131
|
+
.filter(contact => contact.lastMessage)
|
|
132
|
+
.sort((a, b) => new Date(a.lastMessageDate).valueOf() > new Date(b.lastMessageDate).valueOf() ? -1 : 1);
|
|
133
|
+
}
|
|
134
|
+
get otherContacts() {
|
|
135
|
+
return this.allContacts.filter(contact => !contact.lastMessage);
|
|
136
|
+
}
|
|
137
|
+
constructor(contactService, chatConfigService, subscription) {
|
|
138
|
+
this.contactService = contactService;
|
|
139
|
+
this.chatConfigService = chatConfigService;
|
|
140
|
+
this.subscription = subscription;
|
|
141
|
+
this.selected = new EventEmitter();
|
|
142
|
+
this.allContacts = [];
|
|
143
|
+
this.selectedContact = {};
|
|
144
|
+
this.filter = '';
|
|
145
|
+
this.getContactName = getContactName;
|
|
146
|
+
this.trackByUserId = trackBy('userId');
|
|
147
|
+
}
|
|
148
|
+
listenToNewMessages() {
|
|
149
|
+
this.subscription.addOne(this.chatConfigService.message$, (message = {}) => {
|
|
150
|
+
const index = this.allContacts.findIndex(cont => cont.userId === message.senderUserId);
|
|
151
|
+
const contact = {
|
|
152
|
+
userId: message.senderUserId,
|
|
153
|
+
username: message.senderUsername,
|
|
154
|
+
name: message.senderName,
|
|
155
|
+
surname: message.senderSurname,
|
|
156
|
+
lastMessage: message.text,
|
|
157
|
+
unreadMessageCount: 1,
|
|
158
|
+
lastMessageDate: new Date(),
|
|
159
|
+
lastMessageSide: ChatMessageSide.Receiver,
|
|
160
|
+
};
|
|
161
|
+
if (index > -1) {
|
|
162
|
+
this.allContacts[index] = {
|
|
163
|
+
...contact,
|
|
164
|
+
unreadMessageCount: this.selectedContact.userId === this.allContacts[index].userId
|
|
165
|
+
? 0
|
|
166
|
+
: this.allContacts[index].unreadMessageCount + 1,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
else if (!this.filter) {
|
|
170
|
+
this.allContacts.push(contact);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
ngOnInit() {
|
|
175
|
+
this.get(() => {
|
|
176
|
+
this.selectContact(this.allContacts.length ? this.allContacts[0] : {});
|
|
177
|
+
this.listenToNewMessages();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
ngOnChanges() {
|
|
181
|
+
if (this.startConversation) {
|
|
182
|
+
this.get(() => { }, true);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
get(onSuccess, includeOtherContacts) {
|
|
186
|
+
const includeOtherContactsParam = typeof includeOtherContacts === 'boolean' ? includeOtherContacts : !!this.filter;
|
|
187
|
+
this.filter = this.filter.trim();
|
|
188
|
+
this.contactService
|
|
189
|
+
.getContactsByInput({ includeOtherContacts: includeOtherContactsParam, filter: this.filter })
|
|
190
|
+
.subscribe(res => {
|
|
191
|
+
this.allContacts = res;
|
|
192
|
+
if (onSuccess)
|
|
193
|
+
onSuccess();
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
selectContact(contact) {
|
|
197
|
+
this.selectedContact = contact;
|
|
198
|
+
this.selected.emit(contact);
|
|
199
|
+
}
|
|
200
|
+
changeLastMessageOfSelectedContact(message) {
|
|
201
|
+
this.selectedContact.lastMessage = message;
|
|
202
|
+
this.selectedContact.lastMessageDate = new Date();
|
|
203
|
+
const index = this.allContacts.findIndex(contact => contact.userId === this.selectedContact.userId);
|
|
204
|
+
this.allContacts[index] = this.selectedContact;
|
|
205
|
+
}
|
|
206
|
+
markSelectedContactAsRead() {
|
|
207
|
+
this.selectedContact.unreadMessageCount = 0;
|
|
208
|
+
}
|
|
209
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatContactsComponent, deps: [{ token: ContactService }, { token: i2.ChatConfigService }, { token: i3.SubscriptionService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
210
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: { startConversation: "startConversation" }, outputs: { selected: "selected" }, providers: [SubscriptionService], usesOnChanges: true, ngImport: i0, template: "<div class=\"card w-100 mb-3 mb-md-0\">\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <div class=\"mb-2 rounded-2\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <input\r\n id=\"contacts-filter\"\r\n type=\"search\"\r\n class=\"form-control form-control\"\r\n autocomplete=\"off\"\r\n spellcheck=\"false\"\r\n [(ngModel)]=\"filter\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n (input.debounce)=\"get()\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"messages-box m-0 p-0\">\r\n <div class=\"list-group rounded-3\" id=\"contact-list\">\r\n <ng-container\r\n *ngFor=\"let contact of contacts; let i = index; trackBy: trackByUserId\"\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n <div\r\n *ngIf=\"otherContacts.length\"\r\n class=\"list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-start-0 border-end-0\"\r\n >\r\n <small>{{ 'Chat::OtherContacts' | abpLocalization }}</small>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let contact of otherContacts; let i = index; trackBy: trackByUserId\"\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #contactTemplate let-contact let-i=\"index\">\r\n <a\r\n (click)=\"selectContact(contact)\"\r\n class=\"chat-contact list-group-item list-group-item-action cursor-pointer px-2 border-2 rounded-2 mb-1 mt-0 {{\r\n selectedContact.userId === contact.userId ? 'active' : ''\r\n }}\"\r\n >\r\n <div class=\"media\">\r\n <abp-conversation-avatar [contact]=\"contact\"></abp-conversation-avatar>\r\n <div class=\"media-body ms-2\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-0\">\r\n <h5 class=\"mb-0 mt-1\">\r\n <small *ngIf=\"contact.unreadMessageCount\" class=\"badge badge-success me-1\">{{\r\n contact.unreadMessageCount\r\n }}</small\r\n >{{ getContactName(contact) }}\r\n </h5>\r\n <small class=\"last-message-date\">{{ contact.lastMessageDate | date }}</small>\r\n </div>\r\n <p class=\"mb-0 small last-message\">\r\n {{\r\n contact.lastMessage?.length > 24\r\n ? (contact.lastMessage | slice: 0:23) + '...'\r\n : contact.lastMessage\r\n }}\r\n </p>\r\n </div>\r\n </div>\r\n </a>\r\n</ng-template>\r\n", styles: [".messages-box{overflow-y:scroll;max-height:calc(100vh - 254.34px)}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3.InputEventDebounceDirective, selector: "[input.debounce]", inputs: ["debounce"], outputs: ["input.debounce"] }, { kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }, { kind: "pipe", type: i4.SlicePipe, name: "slice" }, { kind: "pipe", type: i4.DatePipe, name: "date" }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
211
|
+
}
|
|
212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatContactsComponent, decorators: [{
|
|
213
|
+
type: Component,
|
|
214
|
+
args: [{ selector: 'abp-chat-contacts', providers: [SubscriptionService], template: "<div class=\"card w-100 mb-3 mb-md-0\">\r\n <div class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <div class=\"mb-2 rounded-2\">\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <input\r\n id=\"contacts-filter\"\r\n type=\"search\"\r\n class=\"form-control form-control\"\r\n autocomplete=\"off\"\r\n spellcheck=\"false\"\r\n [(ngModel)]=\"filter\"\r\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\r\n (input.debounce)=\"get()\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"messages-box m-0 p-0\">\r\n <div class=\"list-group rounded-3\" id=\"contact-list\">\r\n <ng-container\r\n *ngFor=\"let contact of contacts; let i = index; trackBy: trackByUserId\"\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n <div\r\n *ngIf=\"otherContacts.length\"\r\n class=\"list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-start-0 border-end-0\"\r\n >\r\n <small>{{ 'Chat::OtherContacts' | abpLocalization }}</small>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let contact of otherContacts; let i = index; trackBy: trackByUserId\"\r\n [ngTemplateOutlet]=\"contactTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\r\n >\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #contactTemplate let-contact let-i=\"index\">\r\n <a\r\n (click)=\"selectContact(contact)\"\r\n class=\"chat-contact list-group-item list-group-item-action cursor-pointer px-2 border-2 rounded-2 mb-1 mt-0 {{\r\n selectedContact.userId === contact.userId ? 'active' : ''\r\n }}\"\r\n >\r\n <div class=\"media\">\r\n <abp-conversation-avatar [contact]=\"contact\"></abp-conversation-avatar>\r\n <div class=\"media-body ms-2\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-0\">\r\n <h5 class=\"mb-0 mt-1\">\r\n <small *ngIf=\"contact.unreadMessageCount\" class=\"badge badge-success me-1\">{{\r\n contact.unreadMessageCount\r\n }}</small\r\n >{{ getContactName(contact) }}\r\n </h5>\r\n <small class=\"last-message-date\">{{ contact.lastMessageDate | date }}</small>\r\n </div>\r\n <p class=\"mb-0 small last-message\">\r\n {{\r\n contact.lastMessage?.length > 24\r\n ? (contact.lastMessage | slice: 0:23) + '...'\r\n : contact.lastMessage\r\n }}\r\n </p>\r\n </div>\r\n </div>\r\n </a>\r\n</ng-template>\r\n", styles: [".messages-box{overflow-y:scroll;max-height:calc(100vh - 254.34px)}\n"] }]
|
|
215
|
+
}], ctorParameters: function () { return [{ type: ContactService }, { type: i2.ChatConfigService }, { type: i3.SubscriptionService }]; }, propDecorators: { startConversation: [{
|
|
216
|
+
type: Input
|
|
217
|
+
}], selected: [{
|
|
218
|
+
type: Output
|
|
219
|
+
}] } });
|
|
220
|
+
function getContactName({ name, surname, username }) {
|
|
221
|
+
if (!name && !surname)
|
|
222
|
+
return username;
|
|
223
|
+
return `${name || ''} ${surname || ''}`;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
class ChatConversationDto {
|
|
227
|
-
constructor(initialValues = {}) {
|
|
228
|
-
if (initialValues) {
|
|
229
|
-
for (const key in initialValues) {
|
|
230
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
231
|
-
this[key] = initialValues[key];
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
226
|
+
class ChatConversationDto {
|
|
227
|
+
constructor(initialValues = {}) {
|
|
228
|
+
if (initialValues) {
|
|
229
|
+
for (const key in initialValues) {
|
|
230
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
231
|
+
this[key] = initialValues[key];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
class ChatMessageDto {
|
|
239
|
-
constructor(initialValues = {}) {
|
|
240
|
-
if (initialValues) {
|
|
241
|
-
for (const key in initialValues) {
|
|
242
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
243
|
-
this[key] = initialValues[key];
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
238
|
+
class ChatMessageDto {
|
|
239
|
+
constructor(initialValues = {}) {
|
|
240
|
+
if (initialValues) {
|
|
241
|
+
for (const key in initialValues) {
|
|
242
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
243
|
+
this[key] = initialValues[key];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
class ChatTargetUserInfo {
|
|
251
|
-
constructor(initialValues = {}) {
|
|
252
|
-
if (initialValues) {
|
|
253
|
-
for (const key in initialValues) {
|
|
254
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
255
|
-
this[key] = initialValues[key];
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
250
|
+
class ChatTargetUserInfo {
|
|
251
|
+
constructor(initialValues = {}) {
|
|
252
|
+
if (initialValues) {
|
|
253
|
+
for (const key in initialValues) {
|
|
254
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
255
|
+
this[key] = initialValues[key];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
class GetConversationInput extends PagedResultRequestDto {
|
|
263
|
-
constructor(initialValues = {}) {
|
|
264
|
-
super(initialValues);
|
|
265
|
-
}
|
|
262
|
+
class GetConversationInput extends PagedResultRequestDto {
|
|
263
|
+
constructor(initialValues = {}) {
|
|
264
|
+
super(initialValues);
|
|
265
|
+
}
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
class MarkConversationAsReadInput {
|
|
269
|
-
constructor(initialValues = {}) {
|
|
270
|
-
if (initialValues) {
|
|
271
|
-
for (const key in initialValues) {
|
|
272
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
273
|
-
this[key] = initialValues[key];
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
268
|
+
class MarkConversationAsReadInput {
|
|
269
|
+
constructor(initialValues = {}) {
|
|
270
|
+
if (initialValues) {
|
|
271
|
+
for (const key in initialValues) {
|
|
272
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
273
|
+
this[key] = initialValues[key];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
class SendMessageInput {
|
|
281
|
-
constructor(initialValues = {}) {
|
|
282
|
-
if (initialValues) {
|
|
283
|
-
for (const key in initialValues) {
|
|
284
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
285
|
-
this[key] = initialValues[key];
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
280
|
+
class SendMessageInput {
|
|
281
|
+
constructor(initialValues = {}) {
|
|
282
|
+
if (initialValues) {
|
|
283
|
+
for (const key in initialValues) {
|
|
284
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
285
|
+
this[key] = initialValues[key];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
class SendOnEnterSettingDto {
|
|
293
|
-
constructor(initialValues = {}) {
|
|
294
|
-
if (initialValues) {
|
|
295
|
-
for (const key in initialValues) {
|
|
296
|
-
if (initialValues.hasOwnProperty(key)) {
|
|
297
|
-
this[key] = initialValues[key];
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
292
|
+
class SendOnEnterSettingDto {
|
|
293
|
+
constructor(initialValues = {}) {
|
|
294
|
+
if (initialValues) {
|
|
295
|
+
for (const key in initialValues) {
|
|
296
|
+
if (initialValues.hasOwnProperty(key)) {
|
|
297
|
+
this[key] = initialValues[key];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
class ChatMessageTitleComponent {
|
|
305
|
-
get contactName() {
|
|
306
|
-
return getContactName(this.selectedContact || {});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
ChatMessageTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: { selectedContact: "selectedContact" }, ngImport: i0, template: `
|
|
304
|
+
class ChatMessageTitleComponent {
|
|
305
|
+
get contactName() {
|
|
306
|
+
return getContactName(this.selectedContact || {});
|
|
307
|
+
}
|
|
308
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatMessageTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
309
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: { selectedContact: "selectedContact" }, ngImport: i0, template: `
|
|
311
310
|
<div class="px-2 py-1 border mb-2 rounded-2">
|
|
312
311
|
<div class="row">
|
|
313
312
|
<div class="col-auto py-1 pe-0">
|
|
@@ -319,9 +318,10 @@ ChatMessageTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
319
318
|
</div>
|
|
320
319
|
</div>
|
|
321
320
|
</div>
|
|
322
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }] });
|
|
323
|
-
|
|
324
|
-
|
|
321
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }] }); }
|
|
322
|
+
}
|
|
323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatMessageTitleComponent, decorators: [{
|
|
324
|
+
type: Component,
|
|
325
325
|
args: [{ selector: 'abp-chat-message-title', template: `
|
|
326
326
|
<div class="px-2 py-1 border mb-2 rounded-2">
|
|
327
327
|
<div class="row">
|
|
@@ -334,284 +334,284 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
|
|
|
334
334
|
</div>
|
|
335
335
|
</div>
|
|
336
336
|
</div>
|
|
337
|
-
` }]
|
|
338
|
-
}], propDecorators: { selectedContact: [{
|
|
339
|
-
type: Input
|
|
337
|
+
` }]
|
|
338
|
+
}], propDecorators: { selectedContact: [{
|
|
339
|
+
type: Input
|
|
340
340
|
}] } });
|
|
341
341
|
|
|
342
|
-
const now = new Date();
|
|
343
|
-
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).valueOf();
|
|
344
|
-
class ChatComponent {
|
|
345
|
-
|
|
346
|
-
this.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
this.
|
|
350
|
-
this.
|
|
351
|
-
this.
|
|
352
|
-
this.
|
|
353
|
-
this.
|
|
354
|
-
this.
|
|
355
|
-
this.
|
|
356
|
-
this.
|
|
357
|
-
this.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
this.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
listenToChatBoxScroll() {
|
|
397
|
-
if (this.chatBoxRef) {
|
|
398
|
-
fromEvent(this.chatBoxRef.nativeElement, 'scroll')
|
|
399
|
-
.pipe(debounceTime(150), takeUntil(this.destroy$))
|
|
400
|
-
.subscribe(this.onScroll);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
listenToNewMessages() {
|
|
404
|
-
this.chatConfigService.message$
|
|
405
|
-
.pipe(takeUntil(this.destroy$))
|
|
406
|
-
.subscribe(({ senderUserId, text } = {}) => {
|
|
407
|
-
if (!this.userMessages.has(senderUserId))
|
|
408
|
-
return;
|
|
409
|
-
const isSelected = this.selectedContact.userId === senderUserId;
|
|
410
|
-
this.userMessages.get(senderUserId).push({
|
|
411
|
-
message: text,
|
|
412
|
-
messageDate: new Date(),
|
|
413
|
-
side: ChatMessageSide.Receiver,
|
|
414
|
-
isRead: isSelected,
|
|
415
|
-
readDate: isSelected ? new Date() : null,
|
|
416
|
-
});
|
|
417
|
-
this.scrollToEnd();
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
ngAfterViewInit() {
|
|
421
|
-
this.sendOnEnter =
|
|
422
|
-
(this.configState.getSetting('Volo.Chat.Messaging.SendMessageOnEnter') || '').toLowerCase() !== 'false';
|
|
423
|
-
this.listenToChatBoxScroll();
|
|
424
|
-
this.listenToNewMessages();
|
|
425
|
-
}
|
|
426
|
-
ngOnDestroy() {
|
|
427
|
-
this.destroy$.next(null);
|
|
428
|
-
this.destroy$.complete();
|
|
429
|
-
}
|
|
430
|
-
getConversation(scrollToEnd) {
|
|
431
|
-
this.allMessagesLoaded = false;
|
|
432
|
-
this.conversationService
|
|
433
|
-
.getConversationByInput({
|
|
434
|
-
skipCount: 0,
|
|
435
|
-
maxResultCount: 50,
|
|
436
|
-
targetUserId: this.selectedContact.userId,
|
|
437
|
-
})
|
|
438
|
-
.subscribe(res => {
|
|
439
|
-
this.userMessages.set(this.selectedContact.userId, res.messages.reverse());
|
|
440
|
-
if (scrollToEnd)
|
|
441
|
-
this.scrollToEnd();
|
|
442
|
-
if (this.selectedContact.unreadMessageCount)
|
|
443
|
-
this.markConversationAsRead();
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
send() {
|
|
447
|
-
if (!this.message || this.loading)
|
|
448
|
-
return;
|
|
449
|
-
this.unreadMessageCount = 0;
|
|
450
|
-
this.loading = true;
|
|
451
|
-
this.conversationService
|
|
452
|
-
.sendMessageByInput({ message: this.message, targetUserId: this.selectedContact.userId })
|
|
453
|
-
.pipe(finalize(() => (this.loading = false)))
|
|
454
|
-
.subscribe(() => {
|
|
455
|
-
this.chatContactsComponent.changeLastMessageOfSelectedContact(this.message);
|
|
456
|
-
if (!this.userMessages.has(this.selectedContact.userId)) {
|
|
457
|
-
this.userMessages.set(this.selectedContact.userId, []);
|
|
458
|
-
}
|
|
459
|
-
this.userMessages.get(this.selectedContact.userId).push({
|
|
460
|
-
message: this.message,
|
|
461
|
-
isRead: true,
|
|
462
|
-
readDate: now,
|
|
463
|
-
messageDate: now,
|
|
464
|
-
side: ChatMessageSide.Sender,
|
|
465
|
-
});
|
|
466
|
-
this.message = '';
|
|
467
|
-
this.scrollToEnd();
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
markConversationAsRead() {
|
|
471
|
-
this.conversationService
|
|
472
|
-
.markConversationAsReadByInput({ targetUserId: this.selectedContact.userId })
|
|
473
|
-
.subscribe(() => {
|
|
474
|
-
this.chatContactsComponent.markSelectedContactAsRead();
|
|
475
|
-
this.selectedContact.unreadMessageCount = 0;
|
|
476
|
-
setTimeout(() => (this.unreadMessageCount = 0), 5000);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
sendWithEnter(event) {
|
|
480
|
-
if (!this.sendOnEnter)
|
|
481
|
-
return;
|
|
482
|
-
event.preventDefault();
|
|
483
|
-
this.send();
|
|
484
|
-
}
|
|
485
|
-
onSelectContact(contact) {
|
|
486
|
-
this.selectedContact = contact;
|
|
487
|
-
this.unreadMessageCount = contact.unreadMessageCount;
|
|
488
|
-
this.scrollToEnd();
|
|
489
|
-
if (this.userMessages.has(contact.userId) || !contact.lastMessage) {
|
|
490
|
-
if (contact.unreadMessageCount)
|
|
491
|
-
this.markConversationAsRead();
|
|
492
|
-
return;
|
|
493
|
-
}
|
|
494
|
-
this.getConversation(true);
|
|
495
|
-
}
|
|
496
|
-
getDateFormat(date) {
|
|
497
|
-
date = new Date(date);
|
|
498
|
-
const messageDay = new Date(date.getFullYear(), date.getMonth(), date.getDate()).valueOf();
|
|
499
|
-
if (messageDay === today)
|
|
500
|
-
return 'shortTime';
|
|
501
|
-
return 'short';
|
|
502
|
-
}
|
|
503
|
-
scrollToEnd() {
|
|
504
|
-
setTimeout(() => {
|
|
505
|
-
const { offsetTop } = (document.querySelector('.unread-message-count-badge-wrapper') ||
|
|
506
|
-
{});
|
|
507
|
-
this.chatBoxRef?.nativeElement.scrollTo({
|
|
508
|
-
top: offsetTop ? offsetTop - 60 : this.chatBoxRef.nativeElement.scrollHeight,
|
|
509
|
-
});
|
|
510
|
-
}, 0);
|
|
511
|
-
}
|
|
512
|
-
startConversation() {
|
|
513
|
-
this.clickedStartMessage = true;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
519
|
-
type: Component,
|
|
520
|
-
args: [{ selector: 'abp-chat', template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [startConversation]=\"clickedStartMessage\"\r\n ></abp-chat-contacts>\r\n </div>\r\n <!-- /Users box-->\r\n\r\n <!-- Chat Box-->\r\n\r\n <div class=\"col-12 col-md-7 col-lg-8 d-flex align-items-stretch\">\r\n <div class=\"card w-100 mb-0\">\r\n <div *ngIf=\"selectedContact.userId\" class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <abp-chat-message-title [selectedContact]=\"selectedContact\"></abp-chat-message-title>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box mb-2\">\r\n <div class=\"chat-box-container\" id=\"chat-conversation\">\r\n <ng-container\r\n *ngFor=\"\r\n let message of selectedContactMessages;\r\n let i = index;\r\n trackBy: trackByMessageDate\r\n \"\r\n >\r\n <div\r\n *ngIf=\"selectedContactMessages.length - unreadMessageCount === i\"\r\n class=\"row justify-content-center unread-message-count-badge-wrapper\"\r\n >\r\n <h3>\r\n <span class=\"badge badge-info\">\r\n <ng-container *ngIf=\"unreadMessageCount === 1; else moreThanOne\">\r\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\r\n </ng-container>\r\n\r\n <ng-template #moreThanOne>\r\n {{\r\n 'Chat::YouHave{0}UnreadMessages'\r\n | abpLocalization: '' + unreadMessageCount\r\n }}\r\n </ng-template>\r\n </span>\r\n </h3>\r\n </div>\r\n <div\r\n *ngIf=\"{ isSender: message.side === chatMessageSide.Sender } as data\"\r\n class=\"media w-75 mw-65 w-lp-auto mb-2\"\r\n [class.ms-auto]=\"data.isSender\"\r\n >\r\n <div class=\"media-body position-relative\">\r\n <div\r\n class=\"card shadow-sm rounded py-1 px-2 py-lg-2 px-lg-3 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"message-text text-small mb-0 {{ data.isSender ? 'text-white' : 'text-muted' }}\"\r\n [innerHTML]=\"message.message\"\r\n ></p>\r\n </div>\r\n <p\r\n class=\"message-date small text-muted m-0 {{\r\n data.isSender ? 'left' : 'right'\r\n }}\"\r\n >\r\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\r\n </p>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n\r\n <!-- Typing area -->\r\n <div\r\n *ngIf=\"selectedContact?.userId\"\r\n id=\"send-message-form\"\r\n class=\"bg-light rounded-3 m-0\"\r\n >\r\n <div class=\"p-2 p-lg-3\">\r\n <textarea\r\n id=\"chat-message-box\"\r\n name=\"message\"\r\n type=\"text\"\r\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\r\n class=\"form-control rounded py-2 bg-white\"\r\n [(ngModel)]=\"message\"\r\n (keydown.enter)=\"sendWithEnter($event)\"\r\n ></textarea>\r\n <div class=\"form-check float-start mt-2\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input border shadow-sm\"\r\n id=\"send-on-enter\"\r\n [(ngModel)]=\"sendOnEnter\"\r\n />\r\n <label class=\"form-check-label\" for=\"send-on-enter\">{{\r\n 'Chat::SendOnEnter' | abpLocalization\r\n }}</label>\r\n </div>\r\n <div class=\"mt-2 text-end\">\r\n <button\r\n [disabled]=\"!message\"\r\n (click)=\"send()\"\r\n id=\"send-message-button\"\r\n type=\"button\"\r\n class=\"btn btn-primary px-3\"\r\n >\r\n {{ 'Chat::Send' | abpLocalization }}\r\n <i *ngIf=\"!loading; else loadingIcon\" class=\"fa fa-paper-plane ms-2\" aria-hidden=\"true\"></i>\r\n\r\n <ng-template #loadingIcon>\r\n <i class=\"fas fa-spinner fa-spin ms-2\" aria-hidden=\"true\"></i>\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"!selectedContact.userId\" class=\"card-body pt-5 pb-5 text-center\">\r\n <i class=\"fa fa-commenting-o fs-2\" aria-hidden=\"true\"></i>\r\n <p class=\"pb-3\">{{ 'Chat::NoMessageYet' | abpLocalization }}</p>\r\n <p>{{ 'Chat::NoMessageYetMessage' | abpLocalization }}</p>\r\n <button (click)=\"startConversation()\" type=\"button\" class=\"btn btn-primary\">\r\n {{ 'Chat::StartConversation' | abpLocalization }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <!-- /Chat Box-->\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-text{white-space:pre-line}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}\n"] }]
|
|
521
|
-
}], ctorParameters: function () { return [{ type: ConversationService }, { type: i2.ChatConfigService }, { type: i3.ConfigStateService }, { type: i3.HttpWaitService }]; }, propDecorators: { chatBoxRef: [{
|
|
522
|
-
type: ViewChild,
|
|
523
|
-
args: ['chatBox', { static: false }]
|
|
524
|
-
}], chatContactsComponent: [{
|
|
525
|
-
type: ViewChild,
|
|
526
|
-
args: [ChatContactsComponent, { static: false }]
|
|
342
|
+
const now = new Date();
|
|
343
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).valueOf();
|
|
344
|
+
class ChatComponent {
|
|
345
|
+
get selectedContactMessages() {
|
|
346
|
+
return this.userMessages.get(this.selectedContact.userId) || [];
|
|
347
|
+
}
|
|
348
|
+
constructor(conversationService, chatConfigService, configState, httpWaitService) {
|
|
349
|
+
this.conversationService = conversationService;
|
|
350
|
+
this.chatConfigService = chatConfigService;
|
|
351
|
+
this.configState = configState;
|
|
352
|
+
this.httpWaitService = httpWaitService;
|
|
353
|
+
this.selectedContact = {};
|
|
354
|
+
this.unreadMessageCount = 0;
|
|
355
|
+
this.userMessages = new Map();
|
|
356
|
+
this.chatMessageSide = ChatMessageSide;
|
|
357
|
+
this.clickedStartMessage = false;
|
|
358
|
+
this.trackByMessageDate = trackBy('messageDate');
|
|
359
|
+
this.destroy$ = new Subject();
|
|
360
|
+
this.onScroll = (event) => {
|
|
361
|
+
if (this.allMessagesLoaded ||
|
|
362
|
+
this.pagingLoading ||
|
|
363
|
+
!this.selectedContact.lastMessage ||
|
|
364
|
+
this.chatBoxRef?.nativeElement.scrollTop > 250 ||
|
|
365
|
+
this.selectedContactMessages.length % 50 !== 0) {
|
|
366
|
+
event.preventDefault();
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
this.pagingLoading = true;
|
|
370
|
+
this.conversationService
|
|
371
|
+
.getConversationByInput({
|
|
372
|
+
skipCount: this.selectedContactMessages.length,
|
|
373
|
+
maxResultCount: 50,
|
|
374
|
+
targetUserId: this.selectedContact.userId,
|
|
375
|
+
})
|
|
376
|
+
.pipe(finalize(() => (this.pagingLoading = false)))
|
|
377
|
+
.subscribe(res => {
|
|
378
|
+
if (!res.messages.length) {
|
|
379
|
+
this.allMessagesLoaded = true;
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this.userMessages.get(this.selectedContact.userId).unshift(...res.messages.reverse());
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
this.httpWaitService.addFilter([
|
|
386
|
+
{
|
|
387
|
+
method: 'POST',
|
|
388
|
+
endpoint: '/api/chat/conversation/send-message',
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
method: 'GET',
|
|
392
|
+
endpoint: '/api/chat/contact/contacts',
|
|
393
|
+
},
|
|
394
|
+
]);
|
|
395
|
+
}
|
|
396
|
+
listenToChatBoxScroll() {
|
|
397
|
+
if (this.chatBoxRef) {
|
|
398
|
+
fromEvent(this.chatBoxRef.nativeElement, 'scroll')
|
|
399
|
+
.pipe(debounceTime(150), takeUntil(this.destroy$))
|
|
400
|
+
.subscribe(this.onScroll);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
listenToNewMessages() {
|
|
404
|
+
this.chatConfigService.message$
|
|
405
|
+
.pipe(takeUntil(this.destroy$))
|
|
406
|
+
.subscribe(({ senderUserId, text } = {}) => {
|
|
407
|
+
if (!this.userMessages.has(senderUserId))
|
|
408
|
+
return;
|
|
409
|
+
const isSelected = this.selectedContact.userId === senderUserId;
|
|
410
|
+
this.userMessages.get(senderUserId).push({
|
|
411
|
+
message: text,
|
|
412
|
+
messageDate: new Date(),
|
|
413
|
+
side: ChatMessageSide.Receiver,
|
|
414
|
+
isRead: isSelected,
|
|
415
|
+
readDate: isSelected ? new Date() : null,
|
|
416
|
+
});
|
|
417
|
+
this.scrollToEnd();
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
ngAfterViewInit() {
|
|
421
|
+
this.sendOnEnter =
|
|
422
|
+
(this.configState.getSetting('Volo.Chat.Messaging.SendMessageOnEnter') || '').toLowerCase() !== 'false';
|
|
423
|
+
this.listenToChatBoxScroll();
|
|
424
|
+
this.listenToNewMessages();
|
|
425
|
+
}
|
|
426
|
+
ngOnDestroy() {
|
|
427
|
+
this.destroy$.next(null);
|
|
428
|
+
this.destroy$.complete();
|
|
429
|
+
}
|
|
430
|
+
getConversation(scrollToEnd) {
|
|
431
|
+
this.allMessagesLoaded = false;
|
|
432
|
+
this.conversationService
|
|
433
|
+
.getConversationByInput({
|
|
434
|
+
skipCount: 0,
|
|
435
|
+
maxResultCount: 50,
|
|
436
|
+
targetUserId: this.selectedContact.userId,
|
|
437
|
+
})
|
|
438
|
+
.subscribe(res => {
|
|
439
|
+
this.userMessages.set(this.selectedContact.userId, res.messages.reverse());
|
|
440
|
+
if (scrollToEnd)
|
|
441
|
+
this.scrollToEnd();
|
|
442
|
+
if (this.selectedContact.unreadMessageCount)
|
|
443
|
+
this.markConversationAsRead();
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
send() {
|
|
447
|
+
if (!this.message || this.loading)
|
|
448
|
+
return;
|
|
449
|
+
this.unreadMessageCount = 0;
|
|
450
|
+
this.loading = true;
|
|
451
|
+
this.conversationService
|
|
452
|
+
.sendMessageByInput({ message: this.message, targetUserId: this.selectedContact.userId })
|
|
453
|
+
.pipe(finalize(() => (this.loading = false)))
|
|
454
|
+
.subscribe(() => {
|
|
455
|
+
this.chatContactsComponent.changeLastMessageOfSelectedContact(this.message);
|
|
456
|
+
if (!this.userMessages.has(this.selectedContact.userId)) {
|
|
457
|
+
this.userMessages.set(this.selectedContact.userId, []);
|
|
458
|
+
}
|
|
459
|
+
this.userMessages.get(this.selectedContact.userId).push({
|
|
460
|
+
message: this.message,
|
|
461
|
+
isRead: true,
|
|
462
|
+
readDate: now,
|
|
463
|
+
messageDate: now,
|
|
464
|
+
side: ChatMessageSide.Sender,
|
|
465
|
+
});
|
|
466
|
+
this.message = '';
|
|
467
|
+
this.scrollToEnd();
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
markConversationAsRead() {
|
|
471
|
+
this.conversationService
|
|
472
|
+
.markConversationAsReadByInput({ targetUserId: this.selectedContact.userId })
|
|
473
|
+
.subscribe(() => {
|
|
474
|
+
this.chatContactsComponent.markSelectedContactAsRead();
|
|
475
|
+
this.selectedContact.unreadMessageCount = 0;
|
|
476
|
+
setTimeout(() => (this.unreadMessageCount = 0), 5000);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
sendWithEnter(event) {
|
|
480
|
+
if (!this.sendOnEnter)
|
|
481
|
+
return;
|
|
482
|
+
event.preventDefault();
|
|
483
|
+
this.send();
|
|
484
|
+
}
|
|
485
|
+
onSelectContact(contact) {
|
|
486
|
+
this.selectedContact = contact;
|
|
487
|
+
this.unreadMessageCount = contact.unreadMessageCount;
|
|
488
|
+
this.scrollToEnd();
|
|
489
|
+
if (this.userMessages.has(contact.userId) || !contact.lastMessage) {
|
|
490
|
+
if (contact.unreadMessageCount)
|
|
491
|
+
this.markConversationAsRead();
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
this.getConversation(true);
|
|
495
|
+
}
|
|
496
|
+
getDateFormat(date) {
|
|
497
|
+
date = new Date(date);
|
|
498
|
+
const messageDay = new Date(date.getFullYear(), date.getMonth(), date.getDate()).valueOf();
|
|
499
|
+
if (messageDay === today)
|
|
500
|
+
return 'shortTime';
|
|
501
|
+
return 'short';
|
|
502
|
+
}
|
|
503
|
+
scrollToEnd() {
|
|
504
|
+
setTimeout(() => {
|
|
505
|
+
const { offsetTop } = (document.querySelector('.unread-message-count-badge-wrapper') ||
|
|
506
|
+
{});
|
|
507
|
+
this.chatBoxRef?.nativeElement.scrollTo({
|
|
508
|
+
top: offsetTop ? offsetTop - 60 : this.chatBoxRef.nativeElement.scrollHeight,
|
|
509
|
+
});
|
|
510
|
+
}, 0);
|
|
511
|
+
}
|
|
512
|
+
startConversation() {
|
|
513
|
+
this.clickedStartMessage = true;
|
|
514
|
+
}
|
|
515
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatComponent, deps: [{ token: ConversationService }, { token: i2.ChatConfigService }, { token: i3.ConfigStateService }, { token: i3.HttpWaitService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
516
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: ChatComponent, selector: "abp-chat", viewQueries: [{ propertyName: "chatBoxRef", first: true, predicate: ["chatBox"], descendants: true }, { propertyName: "chatContactsComponent", first: true, predicate: ChatContactsComponent, descendants: true }], ngImport: i0, template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [startConversation]=\"clickedStartMessage\"\r\n ></abp-chat-contacts>\r\n </div>\r\n <!-- /Users box-->\r\n\r\n <!-- Chat Box-->\r\n\r\n <div class=\"col-12 col-md-7 col-lg-8 d-flex align-items-stretch\">\r\n <div class=\"card w-100 mb-0\">\r\n <div *ngIf=\"selectedContact.userId\" class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <abp-chat-message-title [selectedContact]=\"selectedContact\"></abp-chat-message-title>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box mb-2\">\r\n <div class=\"chat-box-container\" id=\"chat-conversation\">\r\n <ng-container\r\n *ngFor=\"\r\n let message of selectedContactMessages;\r\n let i = index;\r\n trackBy: trackByMessageDate\r\n \"\r\n >\r\n <div\r\n *ngIf=\"selectedContactMessages.length - unreadMessageCount === i\"\r\n class=\"row justify-content-center unread-message-count-badge-wrapper\"\r\n >\r\n <h3>\r\n <span class=\"badge badge-info\">\r\n <ng-container *ngIf=\"unreadMessageCount === 1; else moreThanOne\">\r\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\r\n </ng-container>\r\n\r\n <ng-template #moreThanOne>\r\n {{\r\n 'Chat::YouHave{0}UnreadMessages'\r\n | abpLocalization: '' + unreadMessageCount\r\n }}\r\n </ng-template>\r\n </span>\r\n </h3>\r\n </div>\r\n <div\r\n *ngIf=\"{ isSender: message.side === chatMessageSide.Sender } as data\"\r\n class=\"media w-75 mw-65 w-lp-auto mb-2\"\r\n [class.ms-auto]=\"data.isSender\"\r\n >\r\n <div class=\"media-body position-relative\">\r\n <div\r\n class=\"card shadow-sm rounded py-1 px-2 py-lg-2 px-lg-3 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"message-text text-small mb-0 {{ data.isSender ? 'text-white' : 'text-muted' }}\"\r\n [innerHTML]=\"message.message\"\r\n ></p>\r\n </div>\r\n <p\r\n class=\"message-date small text-muted m-0 {{\r\n data.isSender ? 'left' : 'right'\r\n }}\"\r\n >\r\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\r\n </p>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n\r\n <!-- Typing area -->\r\n <div\r\n *ngIf=\"selectedContact?.userId\"\r\n id=\"send-message-form\"\r\n class=\"bg-light rounded-3 m-0\"\r\n >\r\n <div class=\"p-2 p-lg-3\">\r\n <textarea\r\n id=\"chat-message-box\"\r\n name=\"message\"\r\n type=\"text\"\r\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\r\n class=\"form-control rounded py-2 bg-white\"\r\n [(ngModel)]=\"message\"\r\n (keydown.enter)=\"sendWithEnter($event)\"\r\n ></textarea>\r\n <div class=\"form-check float-start mt-2\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input border shadow-sm\"\r\n id=\"send-on-enter\"\r\n [(ngModel)]=\"sendOnEnter\"\r\n />\r\n <label class=\"form-check-label\" for=\"send-on-enter\">{{\r\n 'Chat::SendOnEnter' | abpLocalization\r\n }}</label>\r\n </div>\r\n <div class=\"mt-2 text-end\">\r\n <button\r\n [disabled]=\"!message\"\r\n (click)=\"send()\"\r\n id=\"send-message-button\"\r\n type=\"button\"\r\n class=\"btn btn-primary px-3\"\r\n >\r\n {{ 'Chat::Send' | abpLocalization }}\r\n <i *ngIf=\"!loading; else loadingIcon\" class=\"fa fa-paper-plane ms-2\" aria-hidden=\"true\"></i>\r\n\r\n <ng-template #loadingIcon>\r\n <i class=\"fas fa-spinner fa-spin ms-2\" aria-hidden=\"true\"></i>\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"!selectedContact.userId\" class=\"card-body pt-5 pb-5 text-center\">\r\n <i class=\"fa fa-commenting-o fs-2\" aria-hidden=\"true\"></i>\r\n <p class=\"pb-3\">{{ 'Chat::NoMessageYet' | abpLocalization }}</p>\r\n <p>{{ 'Chat::NoMessageYetMessage' | abpLocalization }}</p>\r\n <button (click)=\"startConversation()\" type=\"button\" class=\"btn btn-primary\">\r\n {{ 'Chat::StartConversation' | abpLocalization }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <!-- /Chat Box-->\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-text{white-space:pre-line}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ChatContactsComponent, selector: "abp-chat-contacts", inputs: ["startConversation"], outputs: ["selected"] }, { kind: "component", type: ChatMessageTitleComponent, selector: "abp-chat-message-title", inputs: ["selectedContact"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
517
|
+
}
|
|
518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatComponent, decorators: [{
|
|
519
|
+
type: Component,
|
|
520
|
+
args: [{ selector: 'abp-chat', template: "<div class=\"row entry-row\">\r\n <div class=\"col-auto\"></div>\r\n <div class=\"col-lg-auto ps-lg-0\"></div>\r\n <div class=\"col\">\r\n <div class=\"text-lg-end pt-2\" id=\"AbpContentToolbar\"></div>\r\n </div>\r\n</div>\r\n\r\n<div id=\"chat_wrapper\">\r\n <div class=\"container-fluid\">\r\n <div class=\"row\">\r\n <!-- Users box-->\r\n <div class=\"col-12 col-md-5 col-lg-4 d-flex align-items-stretch\">\r\n <abp-chat-contacts\r\n class=\"d-flex w-100\"\r\n (selected)=\"onSelectContact($event)\"\r\n [startConversation]=\"clickedStartMessage\"\r\n ></abp-chat-contacts>\r\n </div>\r\n <!-- /Users box-->\r\n\r\n <!-- Chat Box-->\r\n\r\n <div class=\"col-12 col-md-7 col-lg-8 d-flex align-items-stretch\">\r\n <div class=\"card w-100 mb-0\">\r\n <div *ngIf=\"selectedContact.userId\" class=\"card-body p-1 p-md-2 p-lg-3\">\r\n <abp-chat-message-title [selectedContact]=\"selectedContact\"></abp-chat-message-title>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box mb-2\">\r\n <div class=\"chat-box-container\" id=\"chat-conversation\">\r\n <ng-container\r\n *ngFor=\"\r\n let message of selectedContactMessages;\r\n let i = index;\r\n trackBy: trackByMessageDate\r\n \"\r\n >\r\n <div\r\n *ngIf=\"selectedContactMessages.length - unreadMessageCount === i\"\r\n class=\"row justify-content-center unread-message-count-badge-wrapper\"\r\n >\r\n <h3>\r\n <span class=\"badge badge-info\">\r\n <ng-container *ngIf=\"unreadMessageCount === 1; else moreThanOne\">\r\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\r\n </ng-container>\r\n\r\n <ng-template #moreThanOne>\r\n {{\r\n 'Chat::YouHave{0}UnreadMessages'\r\n | abpLocalization: '' + unreadMessageCount\r\n }}\r\n </ng-template>\r\n </span>\r\n </h3>\r\n </div>\r\n <div\r\n *ngIf=\"{ isSender: message.side === chatMessageSide.Sender } as data\"\r\n class=\"media w-75 mw-65 w-lp-auto mb-2\"\r\n [class.ms-auto]=\"data.isSender\"\r\n >\r\n <div class=\"media-body position-relative\">\r\n <div\r\n class=\"card shadow-sm rounded py-1 px-2 py-lg-2 px-lg-3 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"message-text text-small mb-0 {{ data.isSender ? 'text-white' : 'text-muted' }}\"\r\n [innerHTML]=\"message.message\"\r\n ></p>\r\n </div>\r\n <p\r\n class=\"message-date small text-muted m-0 {{\r\n data.isSender ? 'left' : 'right'\r\n }}\"\r\n >\r\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\r\n </p>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n\r\n <!-- Typing area -->\r\n <div\r\n *ngIf=\"selectedContact?.userId\"\r\n id=\"send-message-form\"\r\n class=\"bg-light rounded-3 m-0\"\r\n >\r\n <div class=\"p-2 p-lg-3\">\r\n <textarea\r\n id=\"chat-message-box\"\r\n name=\"message\"\r\n type=\"text\"\r\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\r\n class=\"form-control rounded py-2 bg-white\"\r\n [(ngModel)]=\"message\"\r\n (keydown.enter)=\"sendWithEnter($event)\"\r\n ></textarea>\r\n <div class=\"form-check float-start mt-2\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input border shadow-sm\"\r\n id=\"send-on-enter\"\r\n [(ngModel)]=\"sendOnEnter\"\r\n />\r\n <label class=\"form-check-label\" for=\"send-on-enter\">{{\r\n 'Chat::SendOnEnter' | abpLocalization\r\n }}</label>\r\n </div>\r\n <div class=\"mt-2 text-end\">\r\n <button\r\n [disabled]=\"!message\"\r\n (click)=\"send()\"\r\n id=\"send-message-button\"\r\n type=\"button\"\r\n class=\"btn btn-primary px-3\"\r\n >\r\n {{ 'Chat::Send' | abpLocalization }}\r\n <i *ngIf=\"!loading; else loadingIcon\" class=\"fa fa-paper-plane ms-2\" aria-hidden=\"true\"></i>\r\n\r\n <ng-template #loadingIcon>\r\n <i class=\"fas fa-spinner fa-spin ms-2\" aria-hidden=\"true\"></i>\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"!selectedContact.userId\" class=\"card-body pt-5 pb-5 text-center\">\r\n <i class=\"fa fa-commenting-o fs-2\" aria-hidden=\"true\"></i>\r\n <p class=\"pb-3\">{{ 'Chat::NoMessageYet' | abpLocalization }}</p>\r\n <p>{{ 'Chat::NoMessageYetMessage' | abpLocalization }}</p>\r\n <button (click)=\"startConversation()\" type=\"button\" class=\"btn btn-primary\">\r\n {{ 'Chat::StartConversation' | abpLocalization }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <!-- /Chat Box-->\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-text{white-space:pre-line}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}\n"] }]
|
|
521
|
+
}], ctorParameters: function () { return [{ type: ConversationService }, { type: i2.ChatConfigService }, { type: i3.ConfigStateService }, { type: i3.HttpWaitService }]; }, propDecorators: { chatBoxRef: [{
|
|
522
|
+
type: ViewChild,
|
|
523
|
+
args: ['chatBox', { static: false }]
|
|
524
|
+
}], chatContactsComponent: [{
|
|
525
|
+
type: ViewChild,
|
|
526
|
+
args: [ChatContactsComponent, { static: false }]
|
|
527
527
|
}] } });
|
|
528
528
|
|
|
529
|
-
const routes = [
|
|
530
|
-
{
|
|
531
|
-
path: '',
|
|
532
|
-
component: RouterOutletComponent,
|
|
533
|
-
canActivate: [AuthGuard, PermissionGuard],
|
|
534
|
-
children: [
|
|
535
|
-
{
|
|
536
|
-
path: '',
|
|
537
|
-
component: ReplaceableRouteContainerComponent,
|
|
538
|
-
data: {
|
|
539
|
-
requiredPolicy: 'Chat.Messaging',
|
|
540
|
-
replaceableComponent: {
|
|
541
|
-
defaultComponent: ChatComponent,
|
|
542
|
-
key: 'Chat.ChatComponent',
|
|
543
|
-
},
|
|
544
|
-
},
|
|
545
|
-
},
|
|
546
|
-
],
|
|
547
|
-
},
|
|
548
|
-
];
|
|
549
|
-
class ChatRoutingModule {
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
555
|
-
type: NgModule,
|
|
556
|
-
args: [{
|
|
557
|
-
imports: [RouterModule.forChild(routes)],
|
|
558
|
-
exports: [RouterModule],
|
|
559
|
-
}]
|
|
529
|
+
const routes = [
|
|
530
|
+
{
|
|
531
|
+
path: '',
|
|
532
|
+
component: RouterOutletComponent,
|
|
533
|
+
canActivate: [AuthGuard, PermissionGuard],
|
|
534
|
+
children: [
|
|
535
|
+
{
|
|
536
|
+
path: '',
|
|
537
|
+
component: ReplaceableRouteContainerComponent,
|
|
538
|
+
data: {
|
|
539
|
+
requiredPolicy: 'Chat.Messaging',
|
|
540
|
+
replaceableComponent: {
|
|
541
|
+
defaultComponent: ChatComponent,
|
|
542
|
+
key: 'Chat.ChatComponent',
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
],
|
|
547
|
+
},
|
|
548
|
+
];
|
|
549
|
+
class ChatRoutingModule {
|
|
550
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
551
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: ChatRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] }); }
|
|
552
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] }); }
|
|
553
|
+
}
|
|
554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatRoutingModule, decorators: [{
|
|
555
|
+
type: NgModule,
|
|
556
|
+
args: [{
|
|
557
|
+
imports: [RouterModule.forChild(routes)],
|
|
558
|
+
exports: [RouterModule],
|
|
559
|
+
}]
|
|
560
560
|
}] });
|
|
561
561
|
|
|
562
|
-
const declarations = [
|
|
563
|
-
ChatComponent,
|
|
564
|
-
ChatContactsComponent,
|
|
565
|
-
ConversationAvatarComponent,
|
|
566
|
-
ChatMessageTitleComponent,
|
|
567
|
-
];
|
|
568
|
-
class ChatModule {
|
|
569
|
-
static forChild() {
|
|
570
|
-
return {
|
|
571
|
-
ngModule: ChatModule,
|
|
572
|
-
providers: [],
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
static forLazy() {
|
|
576
|
-
return new LazyModuleFactory(ChatModule.forChild());
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
589
|
-
type: NgModule,
|
|
590
|
-
args: [{
|
|
591
|
-
declarations,
|
|
592
|
-
imports: [CoreModule, ThemeSharedModule, ChatRoutingModule],
|
|
593
|
-
exports: [...declarations],
|
|
594
|
-
}]
|
|
562
|
+
const declarations = [
|
|
563
|
+
ChatComponent,
|
|
564
|
+
ChatContactsComponent,
|
|
565
|
+
ConversationAvatarComponent,
|
|
566
|
+
ChatMessageTitleComponent,
|
|
567
|
+
];
|
|
568
|
+
class ChatModule {
|
|
569
|
+
static forChild() {
|
|
570
|
+
return {
|
|
571
|
+
ngModule: ChatModule,
|
|
572
|
+
providers: [],
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
static forLazy() {
|
|
576
|
+
return new LazyModuleFactory(ChatModule.forChild());
|
|
577
|
+
}
|
|
578
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
579
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: ChatModule, declarations: [ChatComponent,
|
|
580
|
+
ChatContactsComponent,
|
|
581
|
+
ConversationAvatarComponent,
|
|
582
|
+
ChatMessageTitleComponent], imports: [CoreModule, ThemeSharedModule, ChatRoutingModule], exports: [ChatComponent,
|
|
583
|
+
ChatContactsComponent,
|
|
584
|
+
ConversationAvatarComponent,
|
|
585
|
+
ChatMessageTitleComponent] }); }
|
|
586
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatModule, imports: [CoreModule, ThemeSharedModule, ChatRoutingModule] }); }
|
|
587
|
+
}
|
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: ChatModule, decorators: [{
|
|
589
|
+
type: NgModule,
|
|
590
|
+
args: [{
|
|
591
|
+
declarations,
|
|
592
|
+
imports: [CoreModule, ThemeSharedModule, ChatRoutingModule],
|
|
593
|
+
exports: [...declarations],
|
|
594
|
+
}]
|
|
595
595
|
}] });
|
|
596
596
|
|
|
597
|
-
class SettingsService {
|
|
598
|
-
constructor(restService) {
|
|
599
|
-
this.restService = restService;
|
|
600
|
-
this.apiName = 'Chat';
|
|
601
|
-
}
|
|
602
|
-
setSendOnEnterSettingByInput(body) {
|
|
603
|
-
return this.restService.request({ url: '/api/chat/settings/send-on-enter', method: 'POST', body }, { apiName: this.apiName });
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
609
|
-
type: Injectable,
|
|
610
|
-
args: [{ providedIn: 'root' }]
|
|
597
|
+
class SettingsService {
|
|
598
|
+
constructor(restService) {
|
|
599
|
+
this.restService = restService;
|
|
600
|
+
this.apiName = 'Chat';
|
|
601
|
+
}
|
|
602
|
+
setSendOnEnterSettingByInput(body) {
|
|
603
|
+
return this.restService.request({ url: '/api/chat/settings/send-on-enter', method: 'POST', body }, { apiName: this.apiName });
|
|
604
|
+
}
|
|
605
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SettingsService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
606
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SettingsService, providedIn: 'root' }); }
|
|
607
|
+
}
|
|
608
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: SettingsService, decorators: [{
|
|
609
|
+
type: Injectable,
|
|
610
|
+
args: [{ providedIn: 'root' }]
|
|
611
611
|
}], ctorParameters: function () { return [{ type: i3.RestService }]; } });
|
|
612
612
|
|
|
613
|
-
/**
|
|
614
|
-
* Generated bundle index. Do not edit.
|
|
613
|
+
/**
|
|
614
|
+
* Generated bundle index. Do not edit.
|
|
615
615
|
*/
|
|
616
616
|
|
|
617
617
|
export { ChatComponent, ChatContactDto, ChatContactsComponent, ChatConversationDto, ChatMessageDto, ChatMessageSide, ChatMessageTitleComponent, ChatModule, ChatTargetUserInfo, ContactService, ConversationAvatarComponent, ConversationService, GetConversationInput, MarkConversationAsReadInput, SendMessageInput, SendOnEnterSettingDto, SettingsService, getContactName };
|