@volo/abp.ng.chat 7.0.0-rc.3 → 7.0.0-rc.5
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/config/components/chat-icon.component.d.ts +1 -1
- package/esm2020/config/chat-config.module.mjs +4 -4
- package/esm2020/config/components/chat-icon.component.mjs +4 -4
- package/esm2020/config/services/chat-config.service.mjs +3 -3
- package/esm2020/lib/chat-routing.module.mjs +4 -4
- package/esm2020/lib/chat.module.mjs +4 -4
- package/esm2020/lib/components/chat-contacts.component.mjs +18 -10
- package/esm2020/lib/components/chat-message-title.component.mjs +3 -3
- package/esm2020/lib/components/chat.component.mjs +16 -10
- package/esm2020/lib/components/conversation-avatar.component.mjs +3 -3
- package/esm2020/lib/services/contact.service.mjs +3 -3
- package/esm2020/lib/services/conversation.service.mjs +3 -3
- package/esm2020/proxy/lib/proxy/volo/chat/conversations/conversation.service.mjs +3 -3
- package/esm2020/proxy/lib/proxy/volo/chat/settings/settings.service.mjs +3 -3
- package/esm2020/proxy/lib/proxy/volo/chat/users/contact.service.mjs +3 -3
- package/fesm2015/volo-abp.ng.chat-config.mjs +11 -11
- package/fesm2015/volo-abp.ng.chat-config.mjs.map +1 -1
- package/fesm2015/volo-abp.ng.chat-proxy.mjs +9 -9
- package/fesm2015/volo-abp.ng.chat.mjs +53 -37
- package/fesm2015/volo-abp.ng.chat.mjs.map +1 -1
- package/fesm2020/volo-abp.ng.chat-config.mjs +11 -11
- package/fesm2020/volo-abp.ng.chat-config.mjs.map +1 -1
- package/fesm2020/volo-abp.ng.chat-proxy.mjs +9 -9
- package/fesm2020/volo-abp.ng.chat.mjs +51 -37
- package/fesm2020/volo-abp.ng.chat.mjs.map +1 -1
- package/lib/components/chat-contacts.component.d.ts +6 -5
- package/lib/components/chat-message-title.component.d.ts +1 -1
- package/lib/components/chat.component.d.ts +3 -1
- package/lib/components/conversation-avatar.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -11,9 +11,9 @@ export class ContactService {
|
|
|
11
11
|
return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
15
|
-
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15
|
+
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, providedIn: 'root' });
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, decorators: [{
|
|
17
17
|
type: Injectable,
|
|
18
18
|
args: [{ providedIn: 'root' }]
|
|
19
19
|
}], ctorParameters: function () { return [{ type: i1.RestService }]; } });
|
|
@@ -17,9 +17,9 @@ export class ConversationService {
|
|
|
17
17
|
return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
21
|
-
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
20
|
+
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
21
|
+
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, providedIn: 'root' });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, decorators: [{
|
|
23
23
|
type: Injectable,
|
|
24
24
|
args: [{ providedIn: 'root' }]
|
|
25
25
|
}], ctorParameters: function () { return [{ type: i1.RestService }]; } });
|
|
@@ -23,9 +23,9 @@ export class ConversationService {
|
|
|
23
23
|
}, { apiName: this.apiName });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
27
|
-
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
26
|
+
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27
|
+
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, providedIn: 'root' });
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, decorators: [{
|
|
29
29
|
type: Injectable,
|
|
30
30
|
args: [{
|
|
31
31
|
providedIn: 'root',
|
|
@@ -13,9 +13,9 @@ export class SettingsService {
|
|
|
13
13
|
}, { apiName: this.apiName });
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
17
|
-
SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
16
|
+
SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SettingsService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
17
|
+
SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SettingsService, providedIn: 'root' });
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SettingsService, decorators: [{
|
|
19
19
|
type: Injectable,
|
|
20
20
|
args: [{
|
|
21
21
|
providedIn: 'root',
|
|
@@ -17,9 +17,9 @@ export class ContactService {
|
|
|
17
17
|
}, { apiName: this.apiName });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
21
|
-
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
20
|
+
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
21
|
+
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, providedIn: 'root' });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, decorators: [{
|
|
23
23
|
type: Injectable,
|
|
24
24
|
args: [{
|
|
25
25
|
providedIn: 'root',
|
|
@@ -90,9 +90,9 @@ class ChatConfigService {
|
|
|
90
90
|
.subscribe((count) => (this.unreadMessagesCount = count));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
ChatConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
94
|
-
ChatConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
95
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
93
|
+
ChatConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigService, deps: [{ token: i1.RestService }, { token: i3.Router }, { token: i3$1.OAuthService }, { token: i4.NavItemsService }, { token: i1.PermissionService }, { token: i1.ConfigStateService }, { token: i1.EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
94
|
+
ChatConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigService, providedIn: 'root' });
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigService, decorators: [{
|
|
96
96
|
type: Injectable,
|
|
97
97
|
args: [{
|
|
98
98
|
providedIn: 'root',
|
|
@@ -130,16 +130,16 @@ class ChatIconComponent {
|
|
|
130
130
|
this.subscription.unsubscribe();
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
ChatIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
134
|
-
ChatIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
133
|
+
ChatIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatIconComponent, deps: [{ token: ChatConfigService }, { token: i4.ToasterService }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
134
|
+
ChatIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ChatIconComponent, selector: "abp-chat-icon", ngImport: i0, template: `<div class="position-relative">
|
|
135
135
|
<a routerLink="/chat"
|
|
136
136
|
><i class="fas fa-comments fa-lg"></i>
|
|
137
137
|
<span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{
|
|
138
138
|
chatConfigService.unreadMessagesCount
|
|
139
139
|
}}</span></a
|
|
140
140
|
>
|
|
141
|
-
</div>`, isInline: true, styles: ["a{color:inherit}.badge{position:absolute;right:-10px;top:-8px}\n"], dependencies: [{ kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.
|
|
142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
141
|
+
</div>`, isInline: true, styles: ["a{color:inherit}.badge{position:absolute;right:-10px;top:-8px}\n"], dependencies: [{ kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatIconComponent, decorators: [{
|
|
143
143
|
type: Component,
|
|
144
144
|
args: [{ selector: 'abp-chat-icon', template: `<div class="position-relative">
|
|
145
145
|
<a routerLink="/chat"
|
|
@@ -202,10 +202,10 @@ class ChatConfigModule {
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
ChatConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
206
|
-
ChatConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
207
|
-
ChatConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
205
|
+
ChatConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
206
|
+
ChatConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigModule, declarations: [ChatIconComponent], imports: [CoreModule] });
|
|
207
|
+
ChatConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigModule, imports: [CoreModule] });
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatConfigModule, decorators: [{
|
|
209
209
|
type: NgModule,
|
|
210
210
|
args: [{
|
|
211
211
|
imports: [CoreModule],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volo-abp.ng.chat-config.mjs","sources":["../../../../packages/chat/config/src/services/chat-config.service.ts","../../../../packages/chat/config/src/components/chat-icon.component.ts","../../../../packages/chat/config/src/providers/nav-item.provider.ts","../../../../packages/chat/config/src/providers/route.provider.ts","../../../../packages/chat/config/src/chat-config.module.ts","../../../../packages/chat/config/src/volo-abp.ng.chat-config.ts"],"sourcesContent":["import {\r\n ConfigStateService,\r\n CurrentUserDto,\r\n EnvironmentService,\r\n PermissionService,\r\n RestService,\r\n} from '@abp/ng.core';\r\nimport { NavItemsService } from '@abp/ng.theme.shared';\r\nimport { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { OAuthService } from 'angular-oauth2-oidc';\r\nimport { Subject } from 'rxjs';\r\n\r\nconst permission = 'Chat.Messaging';\r\n\r\nexport interface ChatMessage {\r\n senderUserId: string;\r\n senderUsername: string;\r\n senderName: string;\r\n senderSurname: string;\r\n text: string;\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class ChatConfigService {\r\n apiName = 'Chat';\r\n conectedUserId: string;\r\n connection: signalR.HubConnection;\r\n message$ = new Subject<ChatMessage>();\r\n unreadMessagesCount = 0;\r\n\r\n get isChatEnabled(): boolean {\r\n return (this.configState.getFeature('Chat.Enable') || '').toLowerCase() !== 'false';\r\n }\r\n\r\n get signalRUrl() {\r\n const { apis } = this.environmentService.getEnvironment();\r\n\r\n return apis[this.apiName]?.signalRUrl || apis[this.apiName]?.url || apis.default.url;\r\n }\r\n\r\n constructor(\r\n private restService: RestService,\r\n private router: Router,\r\n private oAuthService: OAuthService,\r\n private navItems: NavItemsService,\r\n private permissionService: PermissionService,\r\n private configState: ConfigStateService,\r\n private environmentService: EnvironmentService\r\n ) {\r\n this.listenToAppConfig();\r\n }\r\n\r\n private listenToAppConfig() {\r\n this.configState\r\n .createOnUpdateStream((state) => state)\r\n .subscribe(() => {\r\n const currentUser = this.configState.getOne('currentUser') as CurrentUserDto;\r\n\r\n if (!this.isChatEnabled) {\r\n this.toggleChat();\r\n return;\r\n }\r\n\r\n if (!currentUser.isAuthenticated || !this.permissionService.getGrantedPolicy(permission)) {\r\n if (this.connection) this.connection.stop();\r\n return;\r\n }\r\n\r\n this.initSignalR(currentUser);\r\n this.setTotalUnreadMessageCount();\r\n });\r\n }\r\n\r\n private toggleChat() {\r\n if (!this.isChatEnabled && this.connection) this.connection.stop();\r\n this.navItems.patchItem('Chat.ChatIconComponent', { visible: () => this.isChatEnabled });\r\n }\r\n\r\n private initSignalR(currentUser: CurrentUserDto) {\r\n if (this.conectedUserId === currentUser.id) return;\r\n if (this.connection) this.connection.stop();\r\n\r\n this.connection = new signalR.HubConnectionBuilder()\r\n .withUrl(`${this.signalRUrl}/signalr-hubs/chat`, {\r\n accessTokenFactory: () => this.oAuthService.getAccessToken(),\r\n })\r\n .build();\r\n\r\n this.connection.on('ReceiveMessage', this.handleMessage);\r\n\r\n this.connection\r\n .start()\r\n .then(() => {\r\n this.conectedUserId = currentUser.id;\r\n })\r\n .catch((err) => {\r\n return console.error(err.toString());\r\n });\r\n }\r\n\r\n private handleMessage = (message: ChatMessage) => {\r\n this.message$.next(message);\r\n };\r\n\r\n setTotalUnreadMessageCount() {\r\n if (this.router.url === '/chat') return;\r\n\r\n this.restService\r\n .request<null, number>(\r\n { url: '/api/chat/contact/total-unread-message-count', method: 'GET' },\r\n { apiName: this.apiName }\r\n )\r\n .subscribe((count) => (this.unreadMessagesCount = count));\r\n }\r\n}\r\n","import { ToasterService } from '@abp/ng.theme.shared';\r\nimport { Component, OnDestroy } from '@angular/core';\r\nimport { NavigationEnd, Router } from '@angular/router';\r\nimport { Subscription } from 'rxjs';\r\nimport { filter } from 'rxjs/operators';\r\nimport { ChatConfigService } from '../services/chat-config.service';\r\n\r\n@Component({\r\n selector: 'abp-chat-icon',\r\n template: `<div class=\"position-relative\">\r\n <a routerLink=\"/chat\"\r\n ><i class=\"fas fa-comments fa-lg\"></i>\r\n <span *ngIf=\"chatConfigService.unreadMessagesCount\" class=\"badge badge-primary\">{{\r\n chatConfigService.unreadMessagesCount\r\n }}</span></a\r\n >\r\n </div>`,\r\n styles: [\r\n `\r\n a {\r\n color: inherit;\r\n }\r\n\r\n .badge {\r\n position: absolute;\r\n right: -10px;\r\n top: -8px;\r\n }\r\n `,\r\n ],\r\n})\r\nexport class ChatIconComponent implements OnDestroy {\r\n private subscription = new Subscription();\r\n\r\n constructor(\r\n public chatConfigService: ChatConfigService,\r\n private toaster: ToasterService,\r\n private router: Router,\r\n ) {\r\n this.listenToMessages();\r\n this.listenToRouterEvents();\r\n }\r\n\r\n private listenToMessages() {\r\n this.subscription.add(\r\n this.chatConfigService.message$\r\n .pipe(filter(() => this.router.url !== '/chat'))\r\n .subscribe(message => {\r\n const { senderName, senderSurname, senderUsername, text } = message;\r\n const sender = `${\r\n senderName ? senderName + (' ' + senderSurname || '') : senderUsername\r\n }`;\r\n const toasterMessage = `<strong>${sender}</strong>: ${\r\n text.length > 50 ? text.substring(0, 49) + '...' : text\r\n }`;\r\n this.chatConfigService.unreadMessagesCount++;\r\n this.toaster.info(toasterMessage, 'Chat::NewChatMessage', {\r\n tapToDismiss: true,\r\n });\r\n }),\r\n );\r\n }\r\n\r\n private listenToRouterEvents() {\r\n this.subscription.add(\r\n this.router.events\r\n .pipe(filter(event => event instanceof NavigationEnd && event.url === '/chat'))\r\n .subscribe(() => (this.chatConfigService.unreadMessagesCount = 0)),\r\n );\r\n }\r\n\r\n ngOnDestroy() {\r\n this.subscription.unsubscribe();\r\n }\r\n}\r\n","import { NavItemsService } from '@abp/ng.theme.shared';\r\nimport { APP_INITIALIZER } from '@angular/core';\r\nimport { ChatIconComponent } from '../components/chat-icon.component';\r\nimport { eChatPolicyNames } from '../enums/policy-names';\r\n\r\nexport const CHAT_NAV_ITEM_PROVIDERS = [\r\n { provide: APP_INITIALIZER, useFactory: configureNavItems, deps: [NavItemsService], multi: true },\r\n];\r\n\r\nexport function configureNavItems(navItems: NavItemsService) {\r\n return () => {\r\n navItems.addItems([\r\n {\r\n id: 'Chat.ChatIconComponent',\r\n requiredPolicy: eChatPolicyNames.Messaging,\r\n component: ChatIconComponent,\r\n order: 99.99,\r\n },\r\n ]);\r\n };\r\n}\r\n","import { eLayoutType, RoutesService } from '@abp/ng.core';\r\nimport { APP_INITIALIZER } from '@angular/core';\r\nimport { eChatPolicyNames } from '../enums/policy-names';\r\nimport { eChatRouteNames } from '../enums/route-names';\r\n\r\nexport const CHAT_ROUTE_PROVIDERS = [\r\n { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },\r\n];\r\n\r\nexport function configureRoutes(routes: RoutesService) {\r\n return () => {\r\n routes.add([\r\n {\r\n path: '/chat',\r\n name: eChatRouteNames.Chat,\r\n requiredPolicy: eChatPolicyNames.Messaging,\r\n layout: eLayoutType.application,\r\n iconClass: 'fa fa-comments',\r\n invisible: true,\r\n },\r\n ]);\r\n };\r\n}\r\n","import { CoreModule, noop } from '@abp/ng.core';\r\nimport { ModuleWithProviders, NgModule, APP_INITIALIZER } from '@angular/core';\r\nimport { ChatIconComponent } from './components/chat-icon.component';\r\nimport { CHAT_NAV_ITEM_PROVIDERS } from './providers/nav-item.provider';\r\nimport { CHAT_ROUTE_PROVIDERS } from './providers/route.provider';\r\nimport { ChatConfigService } from './services/chat-config.service';\r\nimport { OAuthService } from 'angular-oauth2-oidc';\r\n\r\n@NgModule({\r\n imports: [CoreModule],\r\n declarations: [ChatIconComponent]\r\n})\r\nexport class ChatConfigModule {\r\n static forRoot(): ModuleWithProviders<ChatConfigModule> {\r\n return {\r\n ngModule: ChatConfigModule,\r\n providers: [\r\n CHAT_ROUTE_PROVIDERS,\r\n CHAT_NAV_ITEM_PROVIDERS,\r\n {\r\n provide: APP_INITIALIZER,\r\n deps: [ChatConfigService, OAuthService],\r\n multi: true,\r\n useFactory: noop,\r\n },\r\n ],\r\n };\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2","i3","i1.ChatConfigService","i4"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,UAAU,GAAG,gBAAgB,CAAC;MAavB,iBAAiB,CAAA;AAiB5B,IAAA,WAAA,CACU,WAAwB,EACxB,MAAc,EACd,YAA0B,EAC1B,QAAyB,EACzB,iBAAoC,EACpC,WAA+B,EAC/B,kBAAsC,EAAA;AANtC,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAa;AACxB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;AACd,QAAA,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAc;AAC1B,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAiB;AACzB,QAAA,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAmB;AACpC,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAoB;AAC/B,QAAA,IAAkB,CAAA,kBAAA,GAAlB,kBAAkB,CAAoB;AAvB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../packages/chat/config/src/services/chat-config.service.ts","../../../../packages/chat/config/src/components/chat-icon.component.ts","../../../../packages/chat/config/src/providers/nav-item.provider.ts","../../../../packages/chat/config/src/providers/route.provider.ts","../../../../packages/chat/config/src/chat-config.module.ts","../../../../packages/chat/config/src/volo-abp.ng.chat-config.ts"],"sourcesContent":["import {\r\n ConfigStateService,\r\n CurrentUserDto,\r\n EnvironmentService,\r\n PermissionService,\r\n RestService,\r\n} from '@abp/ng.core';\r\nimport { NavItemsService } from '@abp/ng.theme.shared';\r\nimport { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { OAuthService } from 'angular-oauth2-oidc';\r\nimport { Subject } from 'rxjs';\r\n\r\nconst permission = 'Chat.Messaging';\r\n\r\nexport interface ChatMessage {\r\n senderUserId: string;\r\n senderUsername: string;\r\n senderName: string;\r\n senderSurname: string;\r\n text: string;\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class ChatConfigService {\r\n apiName = 'Chat';\r\n conectedUserId: string;\r\n connection: signalR.HubConnection;\r\n message$ = new Subject<ChatMessage>();\r\n unreadMessagesCount = 0;\r\n\r\n get isChatEnabled(): boolean {\r\n return (this.configState.getFeature('Chat.Enable') || '').toLowerCase() !== 'false';\r\n }\r\n\r\n get signalRUrl() {\r\n const { apis } = this.environmentService.getEnvironment();\r\n\r\n return apis[this.apiName]?.signalRUrl || apis[this.apiName]?.url || apis.default.url;\r\n }\r\n\r\n constructor(\r\n private restService: RestService,\r\n private router: Router,\r\n private oAuthService: OAuthService,\r\n private navItems: NavItemsService,\r\n private permissionService: PermissionService,\r\n private configState: ConfigStateService,\r\n private environmentService: EnvironmentService\r\n ) {\r\n this.listenToAppConfig();\r\n }\r\n\r\n private listenToAppConfig() {\r\n this.configState\r\n .createOnUpdateStream((state) => state)\r\n .subscribe(() => {\r\n const currentUser = this.configState.getOne('currentUser') as CurrentUserDto;\r\n\r\n if (!this.isChatEnabled) {\r\n this.toggleChat();\r\n return;\r\n }\r\n\r\n if (!currentUser.isAuthenticated || !this.permissionService.getGrantedPolicy(permission)) {\r\n if (this.connection) this.connection.stop();\r\n return;\r\n }\r\n\r\n this.initSignalR(currentUser);\r\n this.setTotalUnreadMessageCount();\r\n });\r\n }\r\n\r\n private toggleChat() {\r\n if (!this.isChatEnabled && this.connection) this.connection.stop();\r\n this.navItems.patchItem('Chat.ChatIconComponent', { visible: () => this.isChatEnabled });\r\n }\r\n\r\n private initSignalR(currentUser: CurrentUserDto) {\r\n if (this.conectedUserId === currentUser.id) return;\r\n if (this.connection) this.connection.stop();\r\n\r\n this.connection = new signalR.HubConnectionBuilder()\r\n .withUrl(`${this.signalRUrl}/signalr-hubs/chat`, {\r\n accessTokenFactory: () => this.oAuthService.getAccessToken(),\r\n })\r\n .build();\r\n\r\n this.connection.on('ReceiveMessage', this.handleMessage);\r\n\r\n this.connection\r\n .start()\r\n .then(() => {\r\n this.conectedUserId = currentUser.id;\r\n })\r\n .catch((err) => {\r\n return console.error(err.toString());\r\n });\r\n }\r\n\r\n private handleMessage = (message: ChatMessage) => {\r\n this.message$.next(message);\r\n };\r\n\r\n setTotalUnreadMessageCount() {\r\n if (this.router.url === '/chat') return;\r\n\r\n this.restService\r\n .request<null, number>(\r\n { url: '/api/chat/contact/total-unread-message-count', method: 'GET' },\r\n { apiName: this.apiName }\r\n )\r\n .subscribe((count) => (this.unreadMessagesCount = count));\r\n }\r\n}\r\n","import { ToasterService } from '@abp/ng.theme.shared';\r\nimport { Component, OnDestroy } from '@angular/core';\r\nimport { NavigationEnd, Router } from '@angular/router';\r\nimport { Subscription } from 'rxjs';\r\nimport { filter } from 'rxjs/operators';\r\nimport { ChatConfigService } from '../services/chat-config.service';\r\n\r\n@Component({\r\n selector: 'abp-chat-icon',\r\n template: `<div class=\"position-relative\">\r\n <a routerLink=\"/chat\"\r\n ><i class=\"fas fa-comments fa-lg\"></i>\r\n <span *ngIf=\"chatConfigService.unreadMessagesCount\" class=\"badge badge-primary\">{{\r\n chatConfigService.unreadMessagesCount\r\n }}</span></a\r\n >\r\n </div>`,\r\n styles: [\r\n `\r\n a {\r\n color: inherit;\r\n }\r\n\r\n .badge {\r\n position: absolute;\r\n right: -10px;\r\n top: -8px;\r\n }\r\n `,\r\n ],\r\n})\r\nexport class ChatIconComponent implements OnDestroy {\r\n private subscription = new Subscription();\r\n\r\n constructor(\r\n public chatConfigService: ChatConfigService,\r\n private toaster: ToasterService,\r\n private router: Router,\r\n ) {\r\n this.listenToMessages();\r\n this.listenToRouterEvents();\r\n }\r\n\r\n private listenToMessages() {\r\n this.subscription.add(\r\n this.chatConfigService.message$\r\n .pipe(filter(() => this.router.url !== '/chat'))\r\n .subscribe(message => {\r\n const { senderName, senderSurname, senderUsername, text } = message;\r\n const sender = `${\r\n senderName ? senderName + (' ' + senderSurname || '') : senderUsername\r\n }`;\r\n const toasterMessage = `<strong>${sender}</strong>: ${\r\n text.length > 50 ? text.substring(0, 49) + '...' : text\r\n }`;\r\n this.chatConfigService.unreadMessagesCount++;\r\n this.toaster.info(toasterMessage, 'Chat::NewChatMessage', {\r\n tapToDismiss: true,\r\n });\r\n }),\r\n );\r\n }\r\n\r\n private listenToRouterEvents() {\r\n this.subscription.add(\r\n this.router.events\r\n .pipe(filter(event => event instanceof NavigationEnd && event.url === '/chat'))\r\n .subscribe(() => (this.chatConfigService.unreadMessagesCount = 0)),\r\n );\r\n }\r\n\r\n ngOnDestroy() {\r\n this.subscription.unsubscribe();\r\n }\r\n}\r\n","import { NavItemsService } from '@abp/ng.theme.shared';\r\nimport { APP_INITIALIZER } from '@angular/core';\r\nimport { ChatIconComponent } from '../components/chat-icon.component';\r\nimport { eChatPolicyNames } from '../enums/policy-names';\r\n\r\nexport const CHAT_NAV_ITEM_PROVIDERS = [\r\n { provide: APP_INITIALIZER, useFactory: configureNavItems, deps: [NavItemsService], multi: true },\r\n];\r\n\r\nexport function configureNavItems(navItems: NavItemsService) {\r\n return () => {\r\n navItems.addItems([\r\n {\r\n id: 'Chat.ChatIconComponent',\r\n requiredPolicy: eChatPolicyNames.Messaging,\r\n component: ChatIconComponent,\r\n order: 99.99,\r\n },\r\n ]);\r\n };\r\n}\r\n","import { eLayoutType, RoutesService } from '@abp/ng.core';\r\nimport { APP_INITIALIZER } from '@angular/core';\r\nimport { eChatPolicyNames } from '../enums/policy-names';\r\nimport { eChatRouteNames } from '../enums/route-names';\r\n\r\nexport const CHAT_ROUTE_PROVIDERS = [\r\n { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },\r\n];\r\n\r\nexport function configureRoutes(routes: RoutesService) {\r\n return () => {\r\n routes.add([\r\n {\r\n path: '/chat',\r\n name: eChatRouteNames.Chat,\r\n requiredPolicy: eChatPolicyNames.Messaging,\r\n layout: eLayoutType.application,\r\n iconClass: 'fa fa-comments',\r\n invisible: true,\r\n },\r\n ]);\r\n };\r\n}\r\n","import { CoreModule, noop } from '@abp/ng.core';\r\nimport { ModuleWithProviders, NgModule, APP_INITIALIZER } from '@angular/core';\r\nimport { ChatIconComponent } from './components/chat-icon.component';\r\nimport { CHAT_NAV_ITEM_PROVIDERS } from './providers/nav-item.provider';\r\nimport { CHAT_ROUTE_PROVIDERS } from './providers/route.provider';\r\nimport { ChatConfigService } from './services/chat-config.service';\r\nimport { OAuthService } from 'angular-oauth2-oidc';\r\n\r\n@NgModule({\r\n imports: [CoreModule],\r\n declarations: [ChatIconComponent]\r\n})\r\nexport class ChatConfigModule {\r\n static forRoot(): ModuleWithProviders<ChatConfigModule> {\r\n return {\r\n ngModule: ChatConfigModule,\r\n providers: [\r\n CHAT_ROUTE_PROVIDERS,\r\n CHAT_NAV_ITEM_PROVIDERS,\r\n {\r\n provide: APP_INITIALIZER,\r\n deps: [ChatConfigService, OAuthService],\r\n multi: true,\r\n useFactory: noop,\r\n },\r\n ],\r\n };\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["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,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;8GAAhB,gBAAgB,EAAA,YAAA,EAAA,CAFV,iBAAiB,CAAA,EAAA,OAAA,EAAA,CADtB,UAAU,CAAA,EAAA,CAAA,CAAA;AAGX,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAHf,UAAU,CAAA,EAAA,CAAA,CAAA;2FAGX,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,UAAU,CAAC;oBACrB,YAAY,EAAE,CAAC,iBAAiB,CAAC;iBACpC,CAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -24,9 +24,9 @@ class ConversationService {
|
|
|
24
24
|
}, { apiName: this.apiName });
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
28
|
-
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
27
|
+
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
28
|
+
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, providedIn: 'root' });
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, decorators: [{
|
|
30
30
|
type: Injectable,
|
|
31
31
|
args: [{
|
|
32
32
|
providedIn: 'root',
|
|
@@ -51,9 +51,9 @@ class SettingsService {
|
|
|
51
51
|
}, { apiName: this.apiName });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
55
|
-
SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
56
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
54
|
+
SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SettingsService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
55
|
+
SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SettingsService, providedIn: 'root' });
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: SettingsService, decorators: [{
|
|
57
57
|
type: Injectable,
|
|
58
58
|
args: [{
|
|
59
59
|
providedIn: 'root',
|
|
@@ -75,9 +75,9 @@ class ContactService {
|
|
|
75
75
|
}, { apiName: this.apiName });
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
79
|
-
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
80
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
78
|
+
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
79
|
+
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, providedIn: 'root' });
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, decorators: [{
|
|
81
81
|
type: Injectable,
|
|
82
82
|
args: [{
|
|
83
83
|
providedIn: 'root',
|
|
@@ -26,9 +26,9 @@ class ContactService {
|
|
|
26
26
|
return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
30
|
-
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
31
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
29
|
+
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
30
|
+
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, providedIn: 'root' });
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContactService, decorators: [{
|
|
32
32
|
type: Injectable,
|
|
33
33
|
args: [{ providedIn: 'root' }]
|
|
34
34
|
}], ctorParameters: function () { return [{ type: i3.RestService }]; } });
|
|
@@ -68,15 +68,15 @@ class ConversationAvatarComponent {
|
|
|
68
68
|
return typeof this.small === 'string' || this.small;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
ConversationAvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
72
|
-
ConversationAvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
71
|
+
ConversationAvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
+
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
|
|
73
73
|
class="avatar me-2 float-start rounded-circle"
|
|
74
74
|
[class.small]="isSmall"
|
|
75
75
|
[ngStyle]="avatarBgStyle"
|
|
76
76
|
>
|
|
77
77
|
{{ avatarText }}
|
|
78
78
|
</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"] }] });
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
|
|
80
80
|
type: Component,
|
|
81
81
|
args: [{ selector: 'abp-conversation-avatar', template: `<div
|
|
82
82
|
class="avatar me-2 float-start rounded-circle"
|
|
@@ -140,10 +140,16 @@ class ChatContactsComponent {
|
|
|
140
140
|
this.listenToNewMessages();
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
ngOnChanges() {
|
|
144
|
+
if (this.startConversation) {
|
|
145
|
+
this.get(() => { }, true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
get(onSuccess, includeOtherContacts) {
|
|
149
|
+
const includeOtherContactsParam = typeof includeOtherContacts === 'boolean' ? includeOtherContacts : !!this.filter;
|
|
150
|
+
this.filter = this.filter.trim();
|
|
145
151
|
this.contactService
|
|
146
|
-
.getContactsByInput({ includeOtherContacts:
|
|
152
|
+
.getContactsByInput({ includeOtherContacts: includeOtherContactsParam, filter: this.filter })
|
|
147
153
|
.subscribe(res => {
|
|
148
154
|
this.allContacts = res;
|
|
149
155
|
if (onSuccess)
|
|
@@ -164,12 +170,14 @@ class ChatContactsComponent {
|
|
|
164
170
|
this.selectedContact.unreadMessageCount = 0;
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
|
-
ChatContactsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
168
|
-
ChatContactsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
169
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
173
|
+
ChatContactsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatContactsComponent, deps: [{ token: ContactService }, { token: i2.ChatConfigService }, { token: i3.SubscriptionService }], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
ChatContactsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", 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" }] });
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatContactsComponent, decorators: [{
|
|
170
176
|
type: Component,
|
|
171
|
-
args: [{ selector: 'abp-chat-contacts', providers: [SubscriptionService], template: "
|
|
172
|
-
}], ctorParameters: function () { return [{ type: ContactService }, { type: i2.ChatConfigService }, { type: i3.SubscriptionService }]; }, propDecorators: {
|
|
177
|
+
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"] }]
|
|
178
|
+
}], ctorParameters: function () { return [{ type: ContactService }, { type: i2.ChatConfigService }, { type: i3.SubscriptionService }]; }, propDecorators: { startConversation: [{
|
|
179
|
+
type: Input
|
|
180
|
+
}], selected: [{
|
|
173
181
|
type: Output
|
|
174
182
|
}] } });
|
|
175
183
|
function getContactName({ name, surname, username }) {
|
|
@@ -193,9 +201,9 @@ class ConversationService {
|
|
|
193
201
|
return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
|
|
194
202
|
}
|
|
195
203
|
}
|
|
196
|
-
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
197
|
-
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
204
|
+
ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
205
|
+
ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, providedIn: 'root' });
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ConversationService, decorators: [{
|
|
199
207
|
type: Injectable,
|
|
200
208
|
args: [{ providedIn: 'root' }]
|
|
201
209
|
}], ctorParameters: function () { return [{ type: i3.RestService }]; } });
|
|
@@ -205,8 +213,8 @@ class ChatMessageTitleComponent {
|
|
|
205
213
|
return getContactName(this.selectedContact || {});
|
|
206
214
|
}
|
|
207
215
|
}
|
|
208
|
-
ChatMessageTitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
209
|
-
ChatMessageTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
216
|
+
ChatMessageTitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatMessageTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
217
|
+
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: `
|
|
210
218
|
<div class="px-2 py-1 border mb-2 rounded-2">
|
|
211
219
|
<div class="row">
|
|
212
220
|
<div class="col-auto py-1 pe-0">
|
|
@@ -219,7 +227,7 @@ ChatMessageTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
219
227
|
</div>
|
|
220
228
|
</div>
|
|
221
229
|
`, isInline: true, dependencies: [{ kind: "component", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: ["contact", "small"] }] });
|
|
222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatMessageTitleComponent, decorators: [{
|
|
223
231
|
type: Component,
|
|
224
232
|
args: [{ selector: 'abp-chat-message-title', template: `
|
|
225
233
|
<div class="px-2 py-1 border mb-2 rounded-2">
|
|
@@ -250,13 +258,15 @@ class ChatComponent {
|
|
|
250
258
|
this.unreadMessageCount = 0;
|
|
251
259
|
this.userMessages = new Map();
|
|
252
260
|
this.chatMessageSide = ChatMessageSide;
|
|
261
|
+
this.clickedStartMessage = false;
|
|
253
262
|
this.trackByMessageDate = trackBy('messageDate');
|
|
254
263
|
this.destroy$ = new Subject();
|
|
255
264
|
this.onScroll = (event) => {
|
|
265
|
+
var _a;
|
|
256
266
|
if (this.allMessagesLoaded ||
|
|
257
267
|
this.pagingLoading ||
|
|
258
268
|
!this.selectedContact.lastMessage ||
|
|
259
|
-
this.chatBoxRef.nativeElement.scrollTop > 250 ||
|
|
269
|
+
((_a = this.chatBoxRef) === null || _a === void 0 ? void 0 : _a.nativeElement.scrollTop) > 250 ||
|
|
260
270
|
this.selectedContactMessages.length % 50 !== 0) {
|
|
261
271
|
event.preventDefault();
|
|
262
272
|
return;
|
|
@@ -292,9 +302,11 @@ class ChatComponent {
|
|
|
292
302
|
return this.userMessages.get(this.selectedContact.userId) || [];
|
|
293
303
|
}
|
|
294
304
|
listenToChatBoxScroll() {
|
|
295
|
-
|
|
296
|
-
.
|
|
297
|
-
|
|
305
|
+
if (this.chatBoxRef) {
|
|
306
|
+
fromEvent(this.chatBoxRef.nativeElement, 'scroll')
|
|
307
|
+
.pipe(debounceTime(150), takeUntil(this.destroy$))
|
|
308
|
+
.subscribe(this.onScroll);
|
|
309
|
+
}
|
|
298
310
|
}
|
|
299
311
|
listenToNewMessages() {
|
|
300
312
|
this.chatConfigService.message$
|
|
@@ -398,19 +410,23 @@ class ChatComponent {
|
|
|
398
410
|
}
|
|
399
411
|
scrollToEnd() {
|
|
400
412
|
setTimeout(() => {
|
|
413
|
+
var _a;
|
|
401
414
|
const { offsetTop } = (document.querySelector('.unread-message-count-badge-wrapper') ||
|
|
402
415
|
{});
|
|
403
|
-
this.chatBoxRef.nativeElement.scrollTo({
|
|
416
|
+
(_a = this.chatBoxRef) === null || _a === void 0 ? void 0 : _a.nativeElement.scrollTo({
|
|
404
417
|
top: offsetTop ? offsetTop - 60 : this.chatBoxRef.nativeElement.scrollHeight,
|
|
405
418
|
});
|
|
406
419
|
}, 0);
|
|
407
420
|
}
|
|
421
|
+
startConversation() {
|
|
422
|
+
this.clickedStartMessage = true;
|
|
423
|
+
}
|
|
408
424
|
}
|
|
409
|
-
ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
410
|
-
ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
411
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
425
|
+
ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatComponent, deps: [{ token: ConversationService }, { token: i2.ChatConfigService }, { token: i3.ConfigStateService }, { token: i3.HttpWaitService }], target: i0.ɵɵFactoryTarget.Component });
|
|
426
|
+
ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.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\">\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=\"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\"></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 *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-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" }] });
|
|
427
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatComponent, decorators: [{
|
|
412
428
|
type: Component,
|
|
413
|
-
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
|
|
429
|
+
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=\"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\"></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 *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-date{position:absolute;opacity:.35;width:100px;top:1px}.message-date.left{left:-110px;text-align:right}.message-date.right{right:-110px}\n"] }]
|
|
414
430
|
}], ctorParameters: function () { return [{ type: ConversationService }, { type: i2.ChatConfigService }, { type: i3.ConfigStateService }, { type: i3.HttpWaitService }]; }, propDecorators: { chatBoxRef: [{
|
|
415
431
|
type: ViewChild,
|
|
416
432
|
args: ['chatBox', { static: false }]
|
|
@@ -441,10 +457,10 @@ const routes = [
|
|
|
441
457
|
];
|
|
442
458
|
class ChatRoutingModule {
|
|
443
459
|
}
|
|
444
|
-
ChatRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
445
|
-
ChatRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
446
|
-
ChatRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
447
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
460
|
+
ChatRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
461
|
+
ChatRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: ChatRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] });
|
|
462
|
+
ChatRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] });
|
|
463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatRoutingModule, decorators: [{
|
|
448
464
|
type: NgModule,
|
|
449
465
|
args: [{
|
|
450
466
|
imports: [RouterModule.forChild(routes)],
|
|
@@ -469,16 +485,16 @@ class ChatModule {
|
|
|
469
485
|
return new LazyModuleFactory(ChatModule.forChild());
|
|
470
486
|
}
|
|
471
487
|
}
|
|
472
|
-
ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
473
|
-
ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
488
|
+
ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
489
|
+
ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: ChatModule, declarations: [ChatComponent,
|
|
474
490
|
ChatContactsComponent,
|
|
475
491
|
ConversationAvatarComponent,
|
|
476
492
|
ChatMessageTitleComponent], imports: [CoreModule, ThemeSharedModule, ChatRoutingModule], exports: [ChatComponent,
|
|
477
493
|
ChatContactsComponent,
|
|
478
494
|
ConversationAvatarComponent,
|
|
479
495
|
ChatMessageTitleComponent] });
|
|
480
|
-
ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
481
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
496
|
+
ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatModule, imports: [CoreModule, ThemeSharedModule, ChatRoutingModule] });
|
|
497
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChatModule, decorators: [{
|
|
482
498
|
type: NgModule,
|
|
483
499
|
args: [{
|
|
484
500
|
declarations,
|