@volo/abp.ng.chat 5.0.0-rc.1 → 5.1.1

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 (111) hide show
  1. package/README.md +3 -3
  2. package/config/package.json +5 -5
  3. package/esm2020/config/chat-config.module.mjs +36 -0
  4. package/esm2020/config/components/chat-icon.component.mjs +79 -0
  5. package/esm2020/config/enums/index.mjs +3 -0
  6. package/esm2020/config/enums/policy-names.mjs +2 -0
  7. package/esm2020/config/enums/route-names.mjs +2 -0
  8. package/esm2020/config/providers/index.mjs +3 -0
  9. package/esm2020/config/providers/nav-item.provider.mjs +19 -0
  10. package/esm2020/config/providers/route.provider.mjs +20 -0
  11. package/esm2020/config/public-api.mjs +6 -0
  12. package/esm2020/config/services/chat-config.service.mjs +97 -0
  13. package/esm2020/config/volo-abp.ng.chat-config.mjs +5 -0
  14. package/esm2020/lib/chat-routing.module.mjs +39 -0
  15. package/esm2020/lib/chat.module.mjs +32 -0
  16. package/esm2020/lib/components/chat-contacts.component.mjs +111 -0
  17. package/esm2020/lib/components/chat.component.mjs +223 -0
  18. package/esm2020/lib/components/conversation-avatar.component.mjs +85 -0
  19. package/esm2020/lib/components/index.mjs +4 -0
  20. package/esm2020/lib/enums/chat-message-side.mjs +6 -0
  21. package/esm2020/lib/models/chat-contact-dto.mjs +12 -0
  22. package/esm2020/lib/models/chat-conversation-dto.mjs +12 -0
  23. package/esm2020/lib/models/chat-message-dto.mjs +12 -0
  24. package/esm2020/lib/models/chat-target-user-info.mjs +12 -0
  25. package/esm2020/lib/models/get-contacts-input.mjs +12 -0
  26. package/esm2020/lib/models/get-conversation-input.mjs +7 -0
  27. package/esm2020/lib/models/mark-conversation-as-read-input.mjs +12 -0
  28. package/esm2020/lib/models/send-message-input.mjs +12 -0
  29. package/esm2020/lib/services/contact.service.mjs +20 -0
  30. package/esm2020/lib/services/conversation.service.mjs +26 -0
  31. package/esm2020/proxy/lib/index.mjs +5 -0
  32. package/esm2020/proxy/lib/proxy/volo/chat/conversations/conversation.service.mjs +34 -0
  33. package/esm2020/proxy/lib/proxy/volo/chat/conversations/index.mjs +3 -0
  34. package/esm2020/proxy/lib/proxy/volo/chat/conversations/models.mjs +2 -0
  35. package/esm2020/proxy/lib/proxy/volo/chat/messages/chat-message-side.enum.mjs +8 -0
  36. package/esm2020/proxy/lib/proxy/volo/chat/messages/index.mjs +3 -0
  37. package/esm2020/proxy/lib/proxy/volo/chat/messages/models.mjs +2 -0
  38. package/esm2020/proxy/lib/proxy/volo/chat/settings/index.mjs +3 -0
  39. package/esm2020/proxy/lib/proxy/volo/chat/settings/models.mjs +2 -0
  40. package/esm2020/proxy/lib/proxy/volo/chat/settings/settings.service.mjs +24 -0
  41. package/esm2020/proxy/lib/proxy/volo/chat/users/contact.service.mjs +28 -0
  42. package/esm2020/proxy/lib/proxy/volo/chat/users/index.mjs +3 -0
  43. package/esm2020/proxy/lib/proxy/volo/chat/users/models.mjs +2 -0
  44. package/esm2020/proxy/public-api.mjs +2 -0
  45. package/esm2020/proxy/volo-abp.ng.chat-proxy.mjs +5 -0
  46. package/esm2020/public-api.mjs +3 -0
  47. package/esm2020/volo-abp.ng.chat.mjs +5 -0
  48. package/fesm2015/{volo-abp.ng.chat-config.js → volo-abp.ng.chat-config.mjs} +37 -38
  49. package/fesm2015/volo-abp.ng.chat-config.mjs.map +1 -0
  50. package/fesm2015/{volo-abp.ng.chat-proxy.js → volo-abp.ng.chat-proxy.mjs} +12 -12
  51. package/fesm2015/volo-abp.ng.chat-proxy.mjs.map +1 -0
  52. package/fesm2015/volo-abp.ng.chat.mjs +504 -0
  53. package/fesm2015/volo-abp.ng.chat.mjs.map +1 -0
  54. package/fesm2020/volo-abp.ng.chat-config.mjs +236 -0
  55. package/fesm2020/volo-abp.ng.chat-config.mjs.map +1 -0
  56. package/fesm2020/volo-abp.ng.chat-proxy.mjs +92 -0
  57. package/fesm2020/volo-abp.ng.chat-proxy.mjs.map +1 -0
  58. package/fesm2020/volo-abp.ng.chat.mjs +519 -0
  59. package/fesm2020/volo-abp.ng.chat.mjs.map +1 -0
  60. package/package.json +35 -10
  61. package/proxy/package.json +5 -5
  62. package/proxy/src/lib/proxy/README.md +17 -0
  63. package/bundles/volo-abp.ng.chat-config.umd.js +0 -1
  64. package/bundles/volo-abp.ng.chat-proxy.umd.js +0 -1
  65. package/bundles/volo-abp.ng.chat.umd.js +0 -1
  66. package/esm2015/config/chat-config.module.js +0 -1
  67. package/esm2015/config/components/chat-icon.component.js +0 -1
  68. package/esm2015/config/enums/index.js +0 -1
  69. package/esm2015/config/enums/policy-names.js +0 -1
  70. package/esm2015/config/enums/route-names.js +0 -1
  71. package/esm2015/config/providers/index.js +0 -1
  72. package/esm2015/config/providers/nav-item.provider.js +0 -1
  73. package/esm2015/config/providers/route.provider.js +0 -1
  74. package/esm2015/config/public-api.js +0 -1
  75. package/esm2015/config/services/chat-config.service.js +0 -1
  76. package/esm2015/config/volo-abp.ng.chat-config.js +0 -1
  77. package/esm2015/lib/chat-routing.module.js +0 -1
  78. package/esm2015/lib/chat.module.js +0 -1
  79. package/esm2015/lib/components/chat-contacts.component.js +0 -1
  80. package/esm2015/lib/components/chat.component.js +0 -1
  81. package/esm2015/lib/components/conversation-avatar.component.js +0 -1
  82. package/esm2015/lib/components/index.js +0 -1
  83. package/esm2015/lib/enums/chat-message-side.js +0 -1
  84. package/esm2015/lib/models/chat-contact-dto.js +0 -1
  85. package/esm2015/lib/models/chat-conversation-dto.js +0 -1
  86. package/esm2015/lib/models/chat-message-dto.js +0 -1
  87. package/esm2015/lib/models/chat-target-user-info.js +0 -1
  88. package/esm2015/lib/models/get-contacts-input.js +0 -1
  89. package/esm2015/lib/models/get-conversation-input.js +0 -1
  90. package/esm2015/lib/models/mark-conversation-as-read-input.js +0 -1
  91. package/esm2015/lib/models/send-message-input.js +0 -1
  92. package/esm2015/lib/services/contact.service.js +0 -1
  93. package/esm2015/lib/services/conversation.service.js +0 -1
  94. package/esm2015/proxy/lib/index.js +0 -1
  95. package/esm2015/proxy/lib/proxy/volo/chat/conversations/conversation.service.js +0 -1
  96. package/esm2015/proxy/lib/proxy/volo/chat/conversations/index.js +0 -1
  97. package/esm2015/proxy/lib/proxy/volo/chat/conversations/models.js +0 -1
  98. package/esm2015/proxy/lib/proxy/volo/chat/messages/chat-message-side.enum.js +0 -1
  99. package/esm2015/proxy/lib/proxy/volo/chat/messages/index.js +0 -1
  100. package/esm2015/proxy/lib/proxy/volo/chat/messages/models.js +0 -1
  101. package/esm2015/proxy/lib/proxy/volo/chat/settings/index.js +0 -1
  102. package/esm2015/proxy/lib/proxy/volo/chat/settings/models.js +0 -1
  103. package/esm2015/proxy/lib/proxy/volo/chat/settings/settings.service.js +0 -1
  104. package/esm2015/proxy/lib/proxy/volo/chat/users/contact.service.js +0 -1
  105. package/esm2015/proxy/lib/proxy/volo/chat/users/index.js +0 -1
  106. package/esm2015/proxy/lib/proxy/volo/chat/users/models.js +0 -1
  107. package/esm2015/proxy/public-api.js +0 -1
  108. package/esm2015/proxy/volo-abp.ng.chat-proxy.js +0 -1
  109. package/esm2015/public-api.js +0 -1
  110. package/esm2015/volo-abp.ng.chat.js +0 -1
  111. package/fesm2015/volo-abp.ng.chat.js +0 -525
@@ -0,0 +1,504 @@
1
+ import * as i3 from '@abp/ng.core';
2
+ import { trackBy, SubscriptionService, RouterOutletComponent, AuthGuard, PermissionGuard, ReplaceableRouteContainerComponent, LazyModuleFactory, CoreModule } from '@abp/ng.core';
3
+ import { ThemeSharedModule } from '@abp/ng.theme.shared';
4
+ import * as i0 from '@angular/core';
5
+ import { Injectable, Component, Input, EventEmitter, Output, ViewChild, NgModule } from '@angular/core';
6
+ import * as i1 from '@angular/router';
7
+ import { RouterModule } from '@angular/router';
8
+ import { Subject, fromEvent } from 'rxjs';
9
+ import { finalize, debounceTime, takeUntil } from 'rxjs/operators';
10
+ import * as i2 from '@volo/abp.ng.chat/config';
11
+ import * as i6 from '@angular/common';
12
+ import * as i7 from '@angular/forms';
13
+
14
+ var ChatMessageSide;
15
+ (function (ChatMessageSide) {
16
+ ChatMessageSide[ChatMessageSide["Sender"] = 1] = "Sender";
17
+ ChatMessageSide[ChatMessageSide["Receiver"] = 2] = "Receiver";
18
+ })(ChatMessageSide || (ChatMessageSide = {}));
19
+
20
+ class ContactService {
21
+ constructor(restService) {
22
+ this.restService = restService;
23
+ this.apiName = 'Chat';
24
+ }
25
+ getContactsByInput(params = {}) {
26
+ return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
27
+ }
28
+ }
29
+ ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
30
+ ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactService, providedIn: 'root' });
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactService, decorators: [{
32
+ type: Injectable,
33
+ args: [{ providedIn: 'root' }]
34
+ }], ctorParameters: function () { return [{ type: i3.RestService }]; } });
35
+
36
+ const avatarStyles = [
37
+ { color: '#ffffff', backgroundColor: '#3cb160' },
38
+ { color: '#ffffff', backgroundColor: '#c373cc' },
39
+ { color: '#ffffff', backgroundColor: '#2b78b3' },
40
+ { color: '#ffffff', backgroundColor: '#6ac79a' },
41
+ { color: '#ffffff', backgroundColor: '#aeb140' },
42
+ { color: '#ffffff', backgroundColor: '#b773c0' },
43
+ { color: '#ffffff', backgroundColor: '#e16d7a' },
44
+ { color: '#ffffff', backgroundColor: '#ffac2a' },
45
+ { color: '#ffffff', backgroundColor: '#21bbc7' },
46
+ { color: '#ffffff', backgroundColor: '#59ab95' },
47
+ ];
48
+ class ConversationAvatarComponent {
49
+ get avatarText() {
50
+ if (!this.contact || !this.contact.username)
51
+ return;
52
+ if (this.contact.name && this.contact.surname)
53
+ return this.contact.name[0] + this.contact.surname[0];
54
+ if (this.contact.name)
55
+ return this.contact.name.slice(0, 2);
56
+ return this.contact.username.slice(0, 2);
57
+ }
58
+ get avatarBgStyle() {
59
+ if (!this.contact || !this.contact.username)
60
+ return;
61
+ let hash = 0;
62
+ for (let i = 0; i < this.contact.username.length; i++) {
63
+ hash = this.contact.username.charCodeAt(i) + ((hash << 5) - hash);
64
+ }
65
+ return avatarStyles[Math.abs(hash % 10)];
66
+ }
67
+ get isSmall() {
68
+ return typeof this.small === 'string' || this.small;
69
+ }
70
+ }
71
+ ConversationAvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
72
+ ConversationAvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template: `<div
73
+ class="avatar mx-auto rounded-circle"
74
+ [class.small]="isSmall"
75
+ [ngStyle]="avatarBgStyle"
76
+ >
77
+ {{ avatarText }}
78
+ </div>`, isInline: true, styles: [".avatar{height:40px;width:40px;line-height:40px;font-size:16px;font-weight:700;text-align:center;text-transform:uppercase}.avatar.small{height:27px;width:27px;line-height:27px;font-size:14px}\n"], directives: [{ type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
79
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
80
+ type: Component,
81
+ args: [{
82
+ selector: 'abp-conversation-avatar',
83
+ template: `<div
84
+ class="avatar mx-auto rounded-circle"
85
+ [class.small]="isSmall"
86
+ [ngStyle]="avatarBgStyle"
87
+ >
88
+ {{ avatarText }}
89
+ </div>`,
90
+ styles: [
91
+ `
92
+ .avatar {
93
+ height: 40px;
94
+ width: 40px;
95
+ line-height: 40px;
96
+ font-size: 16px;
97
+ font-weight: 700;
98
+ text-align: center;
99
+ text-transform: uppercase;
100
+ }
101
+
102
+ .avatar.small {
103
+ height: 27px;
104
+ width: 27px;
105
+ line-height: 27px;
106
+ font-size: 14px;
107
+ }
108
+ `,
109
+ ],
110
+ }]
111
+ }], propDecorators: { contact: [{
112
+ type: Input
113
+ }], small: [{
114
+ type: Input
115
+ }] } });
116
+
117
+ class ChatContactsComponent {
118
+ constructor(contactService, chatConfigService, subscription) {
119
+ this.contactService = contactService;
120
+ this.chatConfigService = chatConfigService;
121
+ this.subscription = subscription;
122
+ this.selected = new EventEmitter();
123
+ this.allContacts = [];
124
+ this.selectedContact = {};
125
+ this.filter = '';
126
+ this.getContactName = getContactName;
127
+ this.trackByUserId = trackBy('userId');
128
+ }
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
+ listenToNewMessages() {
138
+ this.subscription.addOne(this.chatConfigService.message$, (message = {}) => {
139
+ const index = this.allContacts.findIndex((cont) => cont.userId === message.senderUserId);
140
+ const contact = {
141
+ userId: message.senderUserId,
142
+ username: message.senderUsername,
143
+ name: message.senderName,
144
+ surname: message.senderSurname,
145
+ lastMessage: message.text,
146
+ unreadMessageCount: 1,
147
+ lastMessageDate: new Date(),
148
+ lastMessageSide: ChatMessageSide.Receiver,
149
+ };
150
+ if (index > -1) {
151
+ this.allContacts[index] = Object.assign(Object.assign({}, contact), { unreadMessageCount: this.selectedContact.userId === this.allContacts[index].userId
152
+ ? 0
153
+ : this.allContacts[index].unreadMessageCount + 1 });
154
+ }
155
+ else if (!this.filter) {
156
+ this.allContacts.push(contact);
157
+ }
158
+ });
159
+ }
160
+ ngOnInit() {
161
+ this.get(() => {
162
+ this.selectContact(this.allContacts.length ? this.allContacts[0] : {});
163
+ this.listenToNewMessages();
164
+ });
165
+ }
166
+ ngOnDestroy() { }
167
+ get(onSuccess) {
168
+ this.contactService
169
+ .getContactsByInput({ includeOtherContacts: !!this.filter, filter: this.filter })
170
+ .subscribe((res) => {
171
+ if (!res.length)
172
+ return;
173
+ this.allContacts = res;
174
+ if (onSuccess)
175
+ onSuccess();
176
+ });
177
+ }
178
+ selectContact(contact) {
179
+ this.selectedContact = contact;
180
+ this.selected.emit(contact);
181
+ }
182
+ changeLastMessageOfSelectedContact(message) {
183
+ this.selectedContact.lastMessage = message;
184
+ this.selectedContact.lastMessageDate = new Date();
185
+ const index = this.allContacts.findIndex((contact) => contact.userId === this.selectedContact.userId);
186
+ this.allContacts[index] = this.selectedContact;
187
+ }
188
+ markSelectedContactAsRead() {
189
+ this.selectedContact.unreadMessageCount = 0;
190
+ }
191
+ }
192
+ ChatContactsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatContactsComponent, deps: [{ token: ContactService }, { token: i2.ChatConfigService }, { token: i3.SubscriptionService }], target: i0.ɵɵFactoryTarget.Component });
193
+ ChatContactsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ChatContactsComponent, selector: "abp-chat-contacts", outputs: { selected: "selected" }, providers: [SubscriptionService], ngImport: i0, template: "<div class=\"border-end\">\r\n <div class=\"p-3 bg-light border-bottom\">\r\n <div class=\"form-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-sm\"\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-0\" 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\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 px-4 rounded-0 border-start-0 pointer {{\r\n selectedContact.userId === contact.userId ? 'active text-white' : ''\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 d-none d-md-block\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-1\">\r\n <h6 class=\"mb-0\">\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 </h6>\r\n <small class=\"small font-weight-bold last-message-date\">{{\r\n contact.lastMessageDate | date\r\n }}</small>\r\n </div>\r\n <p class=\"mb-0 text-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"], components: [{ type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }], directives: [{ type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3.InputEventDebounceDirective, selector: "[input.debounce]", inputs: ["debounce"], outputs: ["input.debounce"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "abpLocalization": i3.LocalizationPipe, "date": i6.DatePipe, "slice": i6.SlicePipe } });
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatContactsComponent, decorators: [{
195
+ type: Component,
196
+ args: [{ selector: 'abp-chat-contacts', styles: [
197
+ `
198
+ .messages-box {
199
+ overflow-y: scroll;
200
+ max-height: calc(100vh - 254.34px);
201
+ }
202
+ `,
203
+ ], providers: [SubscriptionService], template: "<div class=\"border-end\">\r\n <div class=\"p-3 bg-light border-bottom\">\r\n <div class=\"form-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-sm\"\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-0\" 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\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 px-4 rounded-0 border-start-0 pointer {{\r\n selectedContact.userId === contact.userId ? 'active text-white' : ''\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 d-none d-md-block\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-1\">\r\n <h6 class=\"mb-0\">\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 </h6>\r\n <small class=\"small font-weight-bold last-message-date\">{{\r\n contact.lastMessageDate | date\r\n }}</small>\r\n </div>\r\n <p class=\"mb-0 text-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" }]
204
+ }], ctorParameters: function () { return [{ type: ContactService }, { type: i2.ChatConfigService }, { type: i3.SubscriptionService }]; }, propDecorators: { selected: [{
205
+ type: Output
206
+ }] } });
207
+ function getContactName({ name, surname, username }) {
208
+ if (!name && !surname)
209
+ return username;
210
+ return `${name || ''} ${surname || ''}`;
211
+ }
212
+
213
+ class ConversationService {
214
+ constructor(restService) {
215
+ this.restService = restService;
216
+ this.apiName = 'Chat';
217
+ }
218
+ sendMessageByInput(body) {
219
+ return this.restService.request({ url: '/api/chat/conversation/send-message', method: 'POST', body }, { apiName: this.apiName });
220
+ }
221
+ getConversationByInput(params = {}) {
222
+ return this.restService.request({ url: '/api/chat/conversation/conversation', method: 'GET', params }, { apiName: this.apiName });
223
+ }
224
+ markConversationAsReadByInput(body) {
225
+ return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
226
+ }
227
+ }
228
+ ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConversationService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
229
+ ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConversationService, providedIn: 'root' });
230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ConversationService, decorators: [{
231
+ type: Injectable,
232
+ args: [{ providedIn: 'root' }]
233
+ }], ctorParameters: function () { return [{ type: i3.RestService }]; } });
234
+
235
+ const now = new Date();
236
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).valueOf();
237
+ class ChatComponent {
238
+ constructor(conversationService, chatConfigService, configState, httpWaitService) {
239
+ this.conversationService = conversationService;
240
+ this.chatConfigService = chatConfigService;
241
+ this.configState = configState;
242
+ this.httpWaitService = httpWaitService;
243
+ this.selectedContact = {};
244
+ this.unreadMessageCount = 0;
245
+ this.userMessages = new Map();
246
+ this.chatMessageSide = ChatMessageSide;
247
+ this.trackByMessageDate = trackBy('messageDate');
248
+ this.destroy$ = new Subject();
249
+ this.onScroll = (event) => {
250
+ if (this.allMessagesLoaded ||
251
+ this.pagingLoading ||
252
+ !this.selectedContact.lastMessage ||
253
+ this.chatBoxRef.nativeElement.scrollTop > 250 ||
254
+ this.selectedContactMessages.length % 50 !== 0) {
255
+ event.preventDefault();
256
+ return;
257
+ }
258
+ this.pagingLoading = true;
259
+ this.conversationService
260
+ .getConversationByInput({
261
+ skipCount: this.selectedContactMessages.length,
262
+ maxResultCount: 50,
263
+ targetUserId: this.selectedContact.userId,
264
+ })
265
+ .pipe(finalize(() => (this.pagingLoading = false)))
266
+ .subscribe((res) => {
267
+ if (!res.messages.length) {
268
+ this.allMessagesLoaded = true;
269
+ return;
270
+ }
271
+ this.userMessages.get(this.selectedContact.userId).unshift(...res.messages.reverse());
272
+ });
273
+ };
274
+ this.httpWaitService.addFilter([
275
+ {
276
+ method: 'POST',
277
+ endpoint: '/api/chat/conversation/send-message',
278
+ },
279
+ {
280
+ method: 'GET',
281
+ endpoint: '/api/chat/contact/contacts',
282
+ },
283
+ ]);
284
+ }
285
+ get contactName() {
286
+ return getContactName(this.selectedContact || {});
287
+ }
288
+ get selectedContactMessages() {
289
+ return this.userMessages.get(this.selectedContact.userId) || [];
290
+ }
291
+ listenToChatBoxScroll() {
292
+ fromEvent(this.chatBoxRef.nativeElement, 'scroll')
293
+ .pipe(debounceTime(150), takeUntil(this.destroy$))
294
+ .subscribe(this.onScroll);
295
+ }
296
+ listenToNewMessages() {
297
+ this.chatConfigService.message$
298
+ .pipe(takeUntil(this.destroy$))
299
+ .subscribe(({ senderUserId, text } = {}) => {
300
+ if (!this.userMessages.has(senderUserId))
301
+ return;
302
+ const isSelected = this.selectedContact.userId === senderUserId;
303
+ this.userMessages.get(senderUserId).push({
304
+ message: text,
305
+ messageDate: new Date(),
306
+ side: ChatMessageSide.Receiver,
307
+ isRead: isSelected,
308
+ readDate: isSelected ? new Date() : null,
309
+ });
310
+ this.scrollToEnd();
311
+ });
312
+ }
313
+ ngAfterViewInit() {
314
+ this.sendOnEnter =
315
+ (this.configState.getSetting('Volo.Chat.Messaging.SendMessageOnEnter') || '').toLowerCase() !== 'false';
316
+ this.listenToChatBoxScroll();
317
+ this.listenToNewMessages();
318
+ }
319
+ ngOnDestroy() {
320
+ this.destroy$.next();
321
+ this.destroy$.complete();
322
+ }
323
+ getConversation(scrollToEnd) {
324
+ this.allMessagesLoaded = false;
325
+ this.conversationService
326
+ .getConversationByInput({
327
+ skipCount: 0,
328
+ maxResultCount: 50,
329
+ targetUserId: this.selectedContact.userId,
330
+ })
331
+ .subscribe((res) => {
332
+ this.userMessages.set(this.selectedContact.userId, res.messages.reverse());
333
+ if (scrollToEnd)
334
+ this.scrollToEnd();
335
+ if (this.selectedContact.unreadMessageCount)
336
+ this.markConversationAsRead();
337
+ });
338
+ }
339
+ send() {
340
+ if (!this.message || this.loading)
341
+ return;
342
+ this.unreadMessageCount = 0;
343
+ this.loading = true;
344
+ this.conversationService
345
+ .sendMessageByInput({ message: this.message, targetUserId: this.selectedContact.userId })
346
+ .pipe(finalize(() => (this.loading = false)))
347
+ .subscribe(() => {
348
+ this.chatContactsComponent.changeLastMessageOfSelectedContact(this.message);
349
+ if (!this.userMessages.has(this.selectedContact.userId)) {
350
+ this.userMessages.set(this.selectedContact.userId, []);
351
+ }
352
+ this.userMessages.get(this.selectedContact.userId).push({
353
+ message: this.message,
354
+ isRead: true,
355
+ readDate: now,
356
+ messageDate: now,
357
+ side: ChatMessageSide.Sender,
358
+ });
359
+ this.message = '';
360
+ this.scrollToEnd();
361
+ });
362
+ }
363
+ markConversationAsRead() {
364
+ this.conversationService
365
+ .markConversationAsReadByInput({ targetUserId: this.selectedContact.userId })
366
+ .subscribe(() => {
367
+ this.chatContactsComponent.markSelectedContactAsRead();
368
+ this.selectedContact.unreadMessageCount = 0;
369
+ setTimeout(() => (this.unreadMessageCount = 0), 5000);
370
+ });
371
+ }
372
+ sendWithEnter(event) {
373
+ if (!this.sendOnEnter)
374
+ return;
375
+ event.preventDefault();
376
+ this.send();
377
+ }
378
+ onSelectContact(contact) {
379
+ this.selectedContact = contact;
380
+ this.unreadMessageCount = contact.unreadMessageCount;
381
+ this.scrollToEnd();
382
+ if (this.userMessages.has(contact.userId) || !contact.lastMessage) {
383
+ if (contact.unreadMessageCount)
384
+ this.markConversationAsRead();
385
+ return;
386
+ }
387
+ this.getConversation(true);
388
+ }
389
+ getDateFormat(date) {
390
+ date = new Date(date);
391
+ const messageDay = new Date(date.getFullYear(), date.getMonth(), date.getDate()).valueOf();
392
+ if (messageDay === today)
393
+ return 'shortTime';
394
+ return 'short';
395
+ }
396
+ scrollToEnd() {
397
+ setTimeout(() => {
398
+ const { offsetTop } = (document.querySelector('.unread-message-count-badge-wrapper') ||
399
+ {});
400
+ this.chatBoxRef.nativeElement.scrollTo({
401
+ top: offsetTop ? offsetTop - 60 : this.chatBoxRef.nativeElement.scrollHeight,
402
+ });
403
+ }, 0);
404
+ }
405
+ }
406
+ ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatComponent, deps: [{ token: ConversationService }, { token: i2.ChatConfigService }, { token: i3.ConfigStateService }, { token: i3.HttpWaitService }], target: i0.ɵɵFactoryTarget.Component });
407
+ ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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 rounded-lg overflow-hidden shadow bor der\">\r\n <div class=\"col-3 col-md-5 col-lg-4 px-0\">\r\n <abp-chat-contacts (selected)=\"onSelectContact($event)\"></abp-chat-contacts>\r\n </div>\r\n\r\n <!-- Chat Box-->\r\n <div class=\"col-9 col-md-7 col-lg-8 px-0\">\r\n <div class=\"p-3 bg-light border-bottom\">\r\n <div class=\"form-row\">\r\n <div class=\"col\">\r\n <div class=\"form-row\">\r\n <div class=\"col-auto\">\r\n <abp-conversation-avatar\r\n small\r\n [contact]=\"selectedContact\"\r\n ></abp-conversation-avatar>\r\n </div>\r\n <div class=\"col pt-1\" style=\"line-height: 1.2\">\r\n <strong id=\"conversation-title\" class=\"font-weight-bold\">{{ contactName }}</strong\r\n ><br />\r\n <small id=\"conversation-info\"></small>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box m-0 p-0\">\r\n <div class=\"chat-box-container p-4\" [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' | abpLocalization: '' + unreadMessageCount\r\n }}\r\n </ng-template>\r\n </span>\r\n </h3>\r\n </div>\r\n\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=\"shadow rounded py-3 px-4 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"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 {{ data.isSender ? 'left' : 'right' }}\"\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 *ngIf=\"selectedContact?.userId\" id=\"send-message-form\" class=\"bg-light border-top m-0\">\r\n <div class=\"p-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-checkbox float-start mt-3\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input me-1\"\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\"></i>\r\n\r\n <ng-template #loadingIcon>\r\n <i class=\"fas fa-spinner fa-spin ms-2\"></i>\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".chat-box{height:calc(100vh - 390px);overflow-y:scroll}.message-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}\n"], components: [{ type: ChatContactsComponent, selector: "abp-chat-contacts", outputs: ["selected"] }, { type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }], pipes: { "abpLocalization": i3.LocalizationPipe, "date": i6.DatePipe } });
408
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatComponent, decorators: [{
409
+ type: Component,
410
+ args: [{ selector: 'abp-chat', styles: [
411
+ `
412
+ .chat-box {
413
+ height: calc(100vh - 390px);
414
+ overflow-y: scroll;
415
+ }
416
+
417
+ .message-date {
418
+ position: absolute;
419
+ opacity: 0.35;
420
+ width: 100px;
421
+ top: 1px;
422
+ }
423
+
424
+ .message-date.left {
425
+ left: -110px;
426
+ text-align: right;
427
+ }
428
+
429
+ .message-date.right {
430
+ right: -110px;
431
+ }
432
+ `,
433
+ ], 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 rounded-lg overflow-hidden shadow bor der\">\r\n <div class=\"col-3 col-md-5 col-lg-4 px-0\">\r\n <abp-chat-contacts (selected)=\"onSelectContact($event)\"></abp-chat-contacts>\r\n </div>\r\n\r\n <!-- Chat Box-->\r\n <div class=\"col-9 col-md-7 col-lg-8 px-0\">\r\n <div class=\"p-3 bg-light border-bottom\">\r\n <div class=\"form-row\">\r\n <div class=\"col\">\r\n <div class=\"form-row\">\r\n <div class=\"col-auto\">\r\n <abp-conversation-avatar\r\n small\r\n [contact]=\"selectedContact\"\r\n ></abp-conversation-avatar>\r\n </div>\r\n <div class=\"col pt-1\" style=\"line-height: 1.2\">\r\n <strong id=\"conversation-title\" class=\"font-weight-bold\">{{ contactName }}</strong\r\n ><br />\r\n <small id=\"conversation-info\"></small>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box m-0 p-0\">\r\n <div class=\"chat-box-container p-4\" [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' | abpLocalization: '' + unreadMessageCount\r\n }}\r\n </ng-template>\r\n </span>\r\n </h3>\r\n </div>\r\n\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=\"shadow rounded py-3 px-4 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"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 {{ data.isSender ? 'left' : 'right' }}\"\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 *ngIf=\"selectedContact?.userId\" id=\"send-message-form\" class=\"bg-light border-top m-0\">\r\n <div class=\"p-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-checkbox float-start mt-3\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input me-1\"\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\"></i>\r\n\r\n <ng-template #loadingIcon>\r\n <i class=\"fas fa-spinner fa-spin ms-2\"></i>\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n" }]
434
+ }], ctorParameters: function () { return [{ type: ConversationService }, { type: i2.ChatConfigService }, { type: i3.ConfigStateService }, { type: i3.HttpWaitService }]; }, propDecorators: { chatBoxRef: [{
435
+ type: ViewChild,
436
+ args: ['chatBox', { static: false }]
437
+ }], chatContactsComponent: [{
438
+ type: ViewChild,
439
+ args: [ChatContactsComponent, { static: false }]
440
+ }] } });
441
+
442
+ const routes = [
443
+ {
444
+ path: '',
445
+ component: RouterOutletComponent,
446
+ canActivate: [AuthGuard, PermissionGuard],
447
+ children: [
448
+ {
449
+ path: '',
450
+ component: ReplaceableRouteContainerComponent,
451
+ data: {
452
+ requiredPolicy: 'Chat.Messaging',
453
+ replaceableComponent: {
454
+ defaultComponent: ChatComponent,
455
+ key: 'Chat.ChatComponent',
456
+ },
457
+ },
458
+ },
459
+ ],
460
+ },
461
+ ];
462
+ class ChatRoutingModule {
463
+ }
464
+ ChatRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
465
+ ChatRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] });
466
+ ChatRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatRoutingModule, imports: [[RouterModule.forChild(routes)], RouterModule] });
467
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatRoutingModule, decorators: [{
468
+ type: NgModule,
469
+ args: [{
470
+ imports: [RouterModule.forChild(routes)],
471
+ exports: [RouterModule],
472
+ }]
473
+ }] });
474
+
475
+ const declarations = [ChatComponent, ChatContactsComponent, ConversationAvatarComponent];
476
+ class ChatModule {
477
+ static forChild() {
478
+ return {
479
+ ngModule: ChatModule,
480
+ providers: [],
481
+ };
482
+ }
483
+ static forLazy() {
484
+ return new LazyModuleFactory(ChatModule.forChild());
485
+ }
486
+ }
487
+ ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
488
+ ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatModule, declarations: [ChatComponent, ChatContactsComponent, ConversationAvatarComponent], imports: [CoreModule, ThemeSharedModule, ChatRoutingModule], exports: [ChatComponent, ChatContactsComponent, ConversationAvatarComponent] });
489
+ ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatModule, imports: [[CoreModule, ThemeSharedModule, ChatRoutingModule]] });
490
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ChatModule, decorators: [{
491
+ type: NgModule,
492
+ args: [{
493
+ declarations,
494
+ imports: [CoreModule, ThemeSharedModule, ChatRoutingModule],
495
+ exports: [...declarations],
496
+ }]
497
+ }] });
498
+
499
+ /**
500
+ * Generated bundle index. Do not edit.
501
+ */
502
+
503
+ export { ChatComponent, ChatContactsComponent, ChatModule, ConversationAvatarComponent, getContactName };
504
+ //# sourceMappingURL=volo-abp.ng.chat.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"volo-abp.ng.chat.mjs","sources":["../../../../packages/chat/src/lib/enums/chat-message-side.ts","../../../../packages/chat/src/lib/services/contact.service.ts","../../../../packages/chat/src/lib/components/conversation-avatar.component.ts","../../../../packages/chat/src/lib/components/chat-contacts.component.ts","../../../../packages/chat/src/lib/components/chat-contacts.component.html","../../../../packages/chat/src/lib/services/conversation.service.ts","../../../../packages/chat/src/lib/components/chat.component.ts","../../../../packages/chat/src/lib/components/chat.component.html","../../../../packages/chat/src/lib/chat-routing.module.ts","../../../../packages/chat/src/lib/chat.module.ts","../../../../packages/chat/src/volo-abp.ng.chat.ts"],"sourcesContent":["export enum ChatMessageSide {\r\n Sender = 1,\r\n Receiver = 2,\r\n}\r\n","import { RestService } from '@abp/ng.core';\r\nimport { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { GetContactsInput } from '../models/get-contacts-input';\r\nimport { ChatContactDto } from '../models/chat-contact-dto';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ContactService {\r\n apiName = 'Chat';\r\n\r\n constructor(private restService: RestService) {}\r\n\r\n getContactsByInput(params = {} as GetContactsInput): Observable<ChatContactDto[]> {\r\n return this.restService.request(\r\n { url: '/api/chat/contact/contacts', method: 'GET', params },\r\n { apiName: this.apiName }\r\n );\r\n }\r\n}\r\n","import { Component, OnInit, Input } from '@angular/core';\r\nimport { ChatContactDto } from '../models/chat-contact-dto';\r\n\r\nconst avatarStyles = [\r\n { color: '#ffffff', backgroundColor: '#3cb160' },\r\n { color: '#ffffff', backgroundColor: '#c373cc' },\r\n { color: '#ffffff', backgroundColor: '#2b78b3' },\r\n { color: '#ffffff', backgroundColor: '#6ac79a' },\r\n { color: '#ffffff', backgroundColor: '#aeb140' },\r\n { color: '#ffffff', backgroundColor: '#b773c0' },\r\n { color: '#ffffff', backgroundColor: '#e16d7a' },\r\n { color: '#ffffff', backgroundColor: '#ffac2a' },\r\n { color: '#ffffff', backgroundColor: '#21bbc7' },\r\n { color: '#ffffff', backgroundColor: '#59ab95' },\r\n];\r\n\r\n@Component({\r\n selector: 'abp-conversation-avatar',\r\n template: `<div\r\n class=\"avatar mx-auto rounded-circle\"\r\n [class.small]=\"isSmall\"\r\n [ngStyle]=\"avatarBgStyle\"\r\n >\r\n {{ avatarText }}\r\n </div>`,\r\n styles: [\r\n `\r\n .avatar {\r\n height: 40px;\r\n width: 40px;\r\n line-height: 40px;\r\n font-size: 16px;\r\n font-weight: 700;\r\n text-align: center;\r\n text-transform: uppercase;\r\n }\r\n\r\n .avatar.small {\r\n height: 27px;\r\n width: 27px;\r\n line-height: 27px;\r\n font-size: 14px;\r\n }\r\n `,\r\n ],\r\n})\r\nexport class ConversationAvatarComponent {\r\n @Input()\r\n contact: ChatContactDto;\r\n\r\n @Input()\r\n small: boolean | string;\r\n\r\n get avatarText(): string {\r\n if (!this.contact || !this.contact.username) return;\r\n if (this.contact.name && this.contact.surname)\r\n return this.contact.name[0] + this.contact.surname[0];\r\n if (this.contact.name) return this.contact.name.slice(0, 2);\r\n return this.contact.username.slice(0, 2);\r\n }\r\n\r\n get avatarBgStyle() {\r\n if (!this.contact || !this.contact.username) return;\r\n\r\n let hash = 0;\r\n for (let i = 0; i < this.contact.username.length; i++) {\r\n hash = this.contact.username.charCodeAt(i) + ((hash << 5) - hash);\r\n }\r\n return avatarStyles[Math.abs(hash % 10)];\r\n }\r\n\r\n get isSmall() {\r\n return typeof this.small === 'string' || this.small;\r\n }\r\n}\r\n","import { SubscriptionService, trackBy } from '@abp/ng.core';\r\nimport { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';\r\nimport { ChatConfigService, ChatMessage } from '@volo/abp.ng.chat/config';\r\nimport { ChatMessageSide } from '../enums/chat-message-side';\r\nimport { ChatContactDto } from '../models/chat-contact-dto';\r\nimport { ContactService } from '../services/contact.service';\r\n\r\n@Component({\r\n selector: 'abp-chat-contacts',\r\n templateUrl: 'chat-contacts.component.html',\r\n styles: [\r\n `\r\n .messages-box {\r\n overflow-y: scroll;\r\n max-height: calc(100vh - 254.34px);\r\n }\r\n `,\r\n ],\r\n providers: [SubscriptionService],\r\n})\r\nexport class ChatContactsComponent implements OnInit, OnDestroy {\r\n @Output()\r\n selected = new EventEmitter<ChatContactDto>();\r\n allContacts: ChatContactDto[] = [];\r\n selectedContact = {} as ChatContactDto;\r\n filter = '';\r\n\r\n getContactName = getContactName;\r\n trackByUserId = trackBy<ChatContactDto>('userId');\r\n\r\n get contacts(): ChatContactDto[] {\r\n return this.allContacts\r\n .filter((contact) => contact.lastMessage)\r\n .sort((a, b) =>\r\n new Date(a.lastMessageDate).valueOf() > new Date(b.lastMessageDate).valueOf() ? -1 : 1\r\n );\r\n }\r\n\r\n get otherContacts(): ChatContactDto[] {\r\n return this.allContacts.filter((contact) => !contact.lastMessage);\r\n }\r\n\r\n constructor(\r\n private contactService: ContactService,\r\n private chatConfigService: ChatConfigService,\r\n private subscription: SubscriptionService\r\n ) {}\r\n\r\n private listenToNewMessages() {\r\n this.subscription.addOne(this.chatConfigService.message$, (message = {} as ChatMessage) => {\r\n const index = this.allContacts.findIndex((cont) => cont.userId === message.senderUserId);\r\n\r\n const contact = {\r\n userId: message.senderUserId,\r\n username: message.senderUsername,\r\n name: message.senderName,\r\n surname: message.senderSurname,\r\n lastMessage: message.text,\r\n unreadMessageCount: 1,\r\n lastMessageDate: new Date(),\r\n lastMessageSide: ChatMessageSide.Receiver,\r\n };\r\n\r\n if (index > -1) {\r\n this.allContacts[index] = {\r\n ...contact,\r\n unreadMessageCount:\r\n this.selectedContact.userId === this.allContacts[index].userId\r\n ? 0\r\n : this.allContacts[index].unreadMessageCount + 1,\r\n };\r\n } else if (!this.filter) {\r\n this.allContacts.push(contact);\r\n }\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.get(() => {\r\n this.selectContact(this.allContacts.length ? this.allContacts[0] : ({} as ChatContactDto));\r\n this.listenToNewMessages();\r\n });\r\n }\r\n\r\n ngOnDestroy() {}\r\n\r\n get(onSuccess?: Function) {\r\n this.contactService\r\n .getContactsByInput({ includeOtherContacts: !!this.filter, filter: this.filter })\r\n .subscribe((res) => {\r\n if (!res.length) return;\r\n\r\n this.allContacts = res;\r\n if (onSuccess) onSuccess();\r\n });\r\n }\r\n\r\n selectContact(contact: ChatContactDto) {\r\n this.selectedContact = contact;\r\n this.selected.emit(contact);\r\n }\r\n\r\n changeLastMessageOfSelectedContact(message: string) {\r\n this.selectedContact.lastMessage = message;\r\n this.selectedContact.lastMessageDate = new Date();\r\n\r\n const index = this.allContacts.findIndex(\r\n (contact) => contact.userId === this.selectedContact.userId\r\n );\r\n\r\n this.allContacts[index] = this.selectedContact;\r\n }\r\n\r\n markSelectedContactAsRead() {\r\n this.selectedContact.unreadMessageCount = 0;\r\n }\r\n}\r\n\r\nexport function getContactName({ name, surname, username }: ChatContactDto) {\r\n if (!name && !surname) return username;\r\n\r\n return `${name || ''} ${surname || ''}`;\r\n}\r\n","<div class=\"border-end\">\r\n <div class=\"p-3 bg-light border-bottom\">\r\n <div class=\"form-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-sm\"\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-0\" 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\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 px-4 rounded-0 border-start-0 pointer {{\r\n selectedContact.userId === contact.userId ? 'active text-white' : ''\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 d-none d-md-block\">\r\n <div class=\"d-flex align-items-center justify-content-between mb-1\">\r\n <h6 class=\"mb-0\">\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 </h6>\r\n <small class=\"small font-weight-bold last-message-date\">{{\r\n contact.lastMessageDate | date\r\n }}</small>\r\n </div>\r\n <p class=\"mb-0 text-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","import { RestService } from '@abp/ng.core';\r\nimport { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { SendMessageInput } from '../models/send-message-input';\r\nimport { GetConversationInput } from '../models/get-conversation-input';\r\nimport { MarkConversationAsReadInput } from '../models/mark-conversation-as-read-input';\r\nimport { ChatConversationDto } from '../models/chat-conversation-dto';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ConversationService {\r\n apiName = 'Chat';\r\n\r\n constructor(private restService: RestService) {}\r\n\r\n sendMessageByInput(body: SendMessageInput): Observable<void> {\r\n return this.restService.request(\r\n { url: '/api/chat/conversation/send-message', method: 'POST', body },\r\n { apiName: this.apiName }\r\n );\r\n }\r\n getConversationByInput(params = {} as GetConversationInput): Observable<ChatConversationDto> {\r\n return this.restService.request(\r\n { url: '/api/chat/conversation/conversation', method: 'GET', params },\r\n { apiName: this.apiName }\r\n );\r\n }\r\n markConversationAsReadByInput(body: MarkConversationAsReadInput): Observable<void> {\r\n return this.restService.request(\r\n { url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body },\r\n { apiName: this.apiName }\r\n );\r\n }\r\n}\r\n","import { ConfigStateService, HttpWaitService, trackBy } from '@abp/ng.core';\r\nimport { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';\r\nimport { ChatConfigService, ChatMessage } from '@volo/abp.ng.chat/config';\r\nimport { fromEvent, Subject } from 'rxjs';\r\nimport { debounceTime, finalize, takeUntil } from 'rxjs/operators';\r\nimport { ChatMessageSide } from '../enums/chat-message-side';\r\nimport { ChatContactDto } from '../models/chat-contact-dto';\r\nimport { ChatMessageDto } from '../models/chat-message-dto';\r\nimport { ConversationService } from '../services/conversation.service';\r\nimport { ChatContactsComponent, getContactName } from './chat-contacts.component';\r\n\r\nconst now = new Date();\r\nconst today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).valueOf();\r\n\r\n@Component({\r\n selector: 'abp-chat',\r\n templateUrl: 'chat.component.html',\r\n styles: [\r\n `\r\n .chat-box {\r\n height: calc(100vh - 390px);\r\n overflow-y: scroll;\r\n }\r\n\r\n .message-date {\r\n position: absolute;\r\n opacity: 0.35;\r\n width: 100px;\r\n top: 1px;\r\n }\r\n\r\n .message-date.left {\r\n left: -110px;\r\n text-align: right;\r\n }\r\n\r\n .message-date.right {\r\n right: -110px;\r\n }\r\n `,\r\n ],\r\n})\r\nexport class ChatComponent implements AfterViewInit, OnDestroy {\r\n selectedContact = {} as ChatContactDto;\r\n unreadMessageCount = 0;\r\n userMessages = new Map<string, ChatMessageDto[]>();\r\n chatMessageSide = ChatMessageSide;\r\n message: string;\r\n sendOnEnter: boolean;\r\n loading: boolean;\r\n pagingLoading: boolean;\r\n allMessagesLoaded: boolean;\r\n\r\n @ViewChild('chatBox', { static: false })\r\n chatBoxRef: ElementRef<HTMLDivElement>;\r\n\r\n @ViewChild(ChatContactsComponent, { static: false })\r\n chatContactsComponent: ChatContactsComponent;\r\n\r\n trackByMessageDate = trackBy<ChatMessageDto>('messageDate');\r\n\r\n destroy$ = new Subject();\r\n\r\n get contactName(): string {\r\n return getContactName(this.selectedContact || ({} as ChatContactDto));\r\n }\r\n\r\n get selectedContactMessages(): ChatMessageDto[] {\r\n return this.userMessages.get(this.selectedContact.userId) || [];\r\n }\r\n\r\n constructor(\r\n private conversationService: ConversationService,\r\n private chatConfigService: ChatConfigService,\r\n private configState: ConfigStateService,\r\n private httpWaitService: HttpWaitService\r\n ) {\r\n this.httpWaitService.addFilter([\r\n {\r\n method: 'POST',\r\n endpoint: '/api/chat/conversation/send-message',\r\n },\r\n {\r\n method: 'GET',\r\n endpoint: '/api/chat/contact/contacts',\r\n },\r\n ]);\r\n }\r\n\r\n private listenToChatBoxScroll() {\r\n fromEvent(this.chatBoxRef.nativeElement, 'scroll')\r\n .pipe(debounceTime(150), takeUntil(this.destroy$))\r\n .subscribe(this.onScroll);\r\n }\r\n\r\n private listenToNewMessages() {\r\n this.chatConfigService.message$\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(({ senderUserId, text } = {} as ChatMessage) => {\r\n if (!this.userMessages.has(senderUserId)) return;\r\n\r\n const isSelected = this.selectedContact.userId === senderUserId;\r\n this.userMessages.get(senderUserId).push({\r\n message: text,\r\n messageDate: new Date(),\r\n side: ChatMessageSide.Receiver,\r\n isRead: isSelected,\r\n readDate: isSelected ? new Date() : null,\r\n });\r\n this.scrollToEnd();\r\n });\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.sendOnEnter =\r\n (\r\n this.configState.getSetting('Volo.Chat.Messaging.SendMessageOnEnter') || ''\r\n ).toLowerCase() !== 'false';\r\n\r\n this.listenToChatBoxScroll();\r\n this.listenToNewMessages();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy$.next();\r\n this.destroy$.complete();\r\n }\r\n\r\n getConversation(scrollToEnd: boolean) {\r\n this.allMessagesLoaded = false;\r\n this.conversationService\r\n .getConversationByInput({\r\n skipCount: 0,\r\n maxResultCount: 50,\r\n targetUserId: this.selectedContact.userId,\r\n })\r\n .subscribe((res) => {\r\n this.userMessages.set(this.selectedContact.userId, res.messages.reverse());\r\n if (scrollToEnd) this.scrollToEnd();\r\n if (this.selectedContact.unreadMessageCount) this.markConversationAsRead();\r\n });\r\n }\r\n\r\n send() {\r\n if (!this.message || this.loading) return;\r\n\r\n this.unreadMessageCount = 0;\r\n this.loading = true;\r\n this.conversationService\r\n .sendMessageByInput({ message: this.message, targetUserId: this.selectedContact.userId })\r\n .pipe(finalize(() => (this.loading = false)))\r\n .subscribe(() => {\r\n this.chatContactsComponent.changeLastMessageOfSelectedContact(this.message);\r\n\r\n if (!this.userMessages.has(this.selectedContact.userId)) {\r\n this.userMessages.set(this.selectedContact.userId, []);\r\n }\r\n\r\n this.userMessages.get(this.selectedContact.userId).push({\r\n message: this.message,\r\n isRead: true,\r\n readDate: now,\r\n messageDate: now,\r\n side: ChatMessageSide.Sender,\r\n });\r\n\r\n this.message = '';\r\n this.scrollToEnd();\r\n });\r\n }\r\n\r\n markConversationAsRead() {\r\n this.conversationService\r\n .markConversationAsReadByInput({ targetUserId: this.selectedContact.userId })\r\n .subscribe(() => {\r\n this.chatContactsComponent.markSelectedContactAsRead();\r\n this.selectedContact.unreadMessageCount = 0;\r\n setTimeout(() => (this.unreadMessageCount = 0), 5000);\r\n });\r\n }\r\n\r\n sendWithEnter(event: KeyboardEvent) {\r\n if (!this.sendOnEnter) return;\r\n\r\n event.preventDefault();\r\n this.send();\r\n }\r\n\r\n onSelectContact(contact: ChatContactDto) {\r\n this.selectedContact = contact;\r\n this.unreadMessageCount = contact.unreadMessageCount;\r\n this.scrollToEnd();\r\n\r\n if (this.userMessages.has(contact.userId) || !contact.lastMessage) {\r\n if (contact.unreadMessageCount) this.markConversationAsRead();\r\n return;\r\n }\r\n this.getConversation(true);\r\n }\r\n\r\n getDateFormat(date: string | Date): string {\r\n date = new Date(date);\r\n const messageDay = new Date(date.getFullYear(), date.getMonth(), date.getDate()).valueOf();\r\n\r\n if (messageDay === today) return 'shortTime';\r\n\r\n return 'short';\r\n }\r\n\r\n scrollToEnd() {\r\n setTimeout(() => {\r\n const { offsetTop } = (document.querySelector('.unread-message-count-badge-wrapper') ||\r\n {}) as HTMLDivElement;\r\n\r\n this.chatBoxRef.nativeElement.scrollTo({\r\n top: offsetTop ? offsetTop - 60 : this.chatBoxRef.nativeElement.scrollHeight,\r\n });\r\n }, 0);\r\n }\r\n\r\n onScroll = (event: Event) => {\r\n if (\r\n this.allMessagesLoaded ||\r\n this.pagingLoading ||\r\n !this.selectedContact.lastMessage ||\r\n this.chatBoxRef.nativeElement.scrollTop > 250 ||\r\n this.selectedContactMessages.length % 50 !== 0\r\n ) {\r\n event.preventDefault();\r\n return;\r\n }\r\n\r\n this.pagingLoading = true;\r\n this.conversationService\r\n .getConversationByInput({\r\n skipCount: this.selectedContactMessages.length,\r\n maxResultCount: 50,\r\n targetUserId: this.selectedContact.userId,\r\n })\r\n .pipe(finalize(() => (this.pagingLoading = false)))\r\n .subscribe((res) => {\r\n if (!res.messages.length) {\r\n this.allMessagesLoaded = true;\r\n return;\r\n }\r\n this.userMessages.get(this.selectedContact.userId).unshift(...res.messages.reverse());\r\n });\r\n };\r\n}\r\n","<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 rounded-lg overflow-hidden shadow bor der\">\r\n <div class=\"col-3 col-md-5 col-lg-4 px-0\">\r\n <abp-chat-contacts (selected)=\"onSelectContact($event)\"></abp-chat-contacts>\r\n </div>\r\n\r\n <!-- Chat Box-->\r\n <div class=\"col-9 col-md-7 col-lg-8 px-0\">\r\n <div class=\"p-3 bg-light border-bottom\">\r\n <div class=\"form-row\">\r\n <div class=\"col\">\r\n <div class=\"form-row\">\r\n <div class=\"col-auto\">\r\n <abp-conversation-avatar\r\n small\r\n [contact]=\"selectedContact\"\r\n ></abp-conversation-avatar>\r\n </div>\r\n <div class=\"col pt-1\" style=\"line-height: 1.2\">\r\n <strong id=\"conversation-title\" class=\"font-weight-bold\">{{ contactName }}</strong\r\n ><br />\r\n <small id=\"conversation-info\"></small>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box m-0 p-0\">\r\n <div class=\"chat-box-container p-4\" [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' | abpLocalization: '' + unreadMessageCount\r\n }}\r\n </ng-template>\r\n </span>\r\n </h3>\r\n </div>\r\n\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=\"shadow rounded py-3 px-4 mb-1 {{\r\n data.isSender ? 'bg-primary' : 'bg-light'\r\n }}\"\r\n >\r\n <p\r\n class=\"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 {{ data.isSender ? 'left' : 'right' }}\"\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 *ngIf=\"selectedContact?.userId\" id=\"send-message-form\" class=\"bg-light border-top m-0\">\r\n <div class=\"p-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-checkbox float-start mt-3\">\r\n <input\r\n type=\"checkbox\"\r\n class=\"form-check-input me-1\"\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\"></i>\r\n\r\n <ng-template #loadingIcon>\r\n <i class=\"fas fa-spinner fa-spin ms-2\"></i>\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n","import {\r\n AuthGuard,\r\n PermissionGuard,\r\n ReplaceableComponents,\r\n ReplaceableRouteContainerComponent,\r\n RouterOutletComponent,\r\n} from '@abp/ng.core';\r\nimport { NgModule } from '@angular/core';\r\nimport { RouterModule, Routes } from '@angular/router';\r\nimport { ChatComponent } from './components/chat.component';\r\n\r\nconst routes: Routes = [\r\n {\r\n path: '',\r\n component: RouterOutletComponent,\r\n canActivate: [AuthGuard, PermissionGuard],\r\n children: [\r\n {\r\n path: '',\r\n component: ReplaceableRouteContainerComponent,\r\n data: {\r\n requiredPolicy: 'Chat.Messaging',\r\n replaceableComponent: {\r\n defaultComponent: ChatComponent,\r\n key: 'Chat.ChatComponent',\r\n } as ReplaceableComponents.RouteData<ChatComponent>,\r\n },\r\n },\r\n ],\r\n },\r\n];\r\n\r\n@NgModule({\r\n imports: [RouterModule.forChild(routes)],\r\n exports: [RouterModule],\r\n})\r\nexport class ChatRoutingModule {}\r\n","import { CoreModule, LazyModuleFactory } from '@abp/ng.core';\r\nimport { ThemeSharedModule } from '@abp/ng.theme.shared';\r\nimport { ModuleWithProviders, NgModule, NgModuleFactory } from '@angular/core';\r\nimport { ChatRoutingModule } from './chat-routing.module';\r\nimport { ChatContactsComponent } from './components/chat-contacts.component';\r\nimport { ChatComponent } from './components/chat.component';\r\nimport { ConversationAvatarComponent } from './components/conversation-avatar.component';\r\n\r\nconst declarations = [ChatComponent, ChatContactsComponent, ConversationAvatarComponent];\r\n\r\n@NgModule({\r\n declarations,\r\n imports: [CoreModule, ThemeSharedModule, ChatRoutingModule],\r\n exports: [...declarations],\r\n})\r\nexport class ChatModule {\r\n static forChild(): ModuleWithProviders<ChatModule> {\r\n return {\r\n ngModule: ChatModule,\r\n providers: [],\r\n };\r\n }\r\n\r\n static forLazy(): NgModuleFactory<ChatModule> {\r\n return new LazyModuleFactory(ChatModule.forChild());\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,IAAY,eAGX;AAHD,W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