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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,3 @@
1
- # Chat
1
+ # @volo/abp.ng.chat
2
+
3
+ Visit [ABP documentation](https://docs.abp.io)
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@abp/ng.theme.shared"),require("@angular/core"),require("@angular/router"),require("rxjs"),require("rxjs/operators"),require("@microsoft/signalr"),require("@abp/ng.core"),require("angular-oauth2-oidc"),require("@angular/common")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat/config",["exports","@abp/ng.theme.shared","@angular/core","@angular/router","rxjs","rxjs/operators","@microsoft/signalr","@abp/ng.core","angular-oauth2-oidc","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).volo=e.volo||{},e.volo.abp=e.volo.abp||{},e.volo.abp.ng=e.volo.abp.ng||{},e.volo.abp.ng.chat=e.volo.abp.ng.chat||{},e.volo.abp.ng.chat.config={}),e.i4,e.ng.core,e.ng.router,e.rxjs,e.rxjs.operators,e.signalR,e.i1,e.i3$1,e.ng.common)}(this,(function(e,t,n,r,o,i,a,s,c,u){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var g=p(t),l=p(n),h=p(r),d=p(a),f=p(s),v=p(c),m=p(u),b=function(){function e(e,t,n,r,i,a,s){var c=this;this.restService=e,this.router=t,this.oAuthService=n,this.navItems=r,this.permissionService=i,this.configState=a,this.environmentService=s,this.apiName="Chat",this.message$=new o.Subject,this.unreadMessagesCount=0,this.handleMessage=function(e){c.message$.next(e)},this.listenToAppConfig()}return Object.defineProperty(e.prototype,"isChatEnabled",{get:function(){return"false"!==(this.configState.getFeature("Chat.Enable")||"").toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"signalRUrl",{get:function(){var e,t,n=this.environmentService.getEnvironment().apis;return(null===(e=n[this.apiName])||void 0===e?void 0:e.signalRUrl)||(null===(t=n[this.apiName])||void 0===t?void 0:t.url)||n.default.url},enumerable:!1,configurable:!0}),e.prototype.listenToAppConfig=function(){var e=this;this.configState.createOnUpdateStream((function(e){return e})).subscribe((function(){var t=e.configState.getOne("currentUser");e.isChatEnabled?t.isAuthenticated&&e.permissionService.getGrantedPolicy("Chat.Messaging")?(e.initSignalR(t),e.setTotalUnreadMessageCount()):e.connection&&e.connection.stop():e.toggleChat()}))},e.prototype.toggleChat=function(){var e=this;!this.isChatEnabled&&this.connection&&this.connection.stop(),this.navItems.patchItem("Chat.ChatIconComponent",{visible:function(){return e.isChatEnabled}})},e.prototype.initSignalR=function(e){var t=this;this.conectedUserId!==e.id&&(this.connection&&this.connection.stop(),this.connection=(new d.HubConnectionBuilder).withUrl(this.signalRUrl+"/signalr-hubs/chat",{accessTokenFactory:function(){return t.oAuthService.getAccessToken()}}).build(),this.connection.on("ReceiveMessage",this.handleMessage),this.connection.start().then((function(){t.conectedUserId=e.id})).catch((function(e){return console.error(e.toString())})))},e.prototype.setTotalUnreadMessageCount=function(){var e=this;"/chat"!==this.router.url&&this.restService.request({url:"/api/chat/contact/total-unread-message-count",method:"GET"},{apiName:this.apiName}).subscribe((function(t){return e.unreadMessagesCount=t}))},e}();b.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:b,deps:[{token:f.RestService},{token:h.Router},{token:v.OAuthService},{token:g.NavItemsService},{token:f.PermissionService},{token:f.ConfigStateService},{token:f.EnvironmentService}],target:l.ɵɵFactoryTarget.Injectable}),b.ɵprov=l.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:b,providedIn:"root"}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:b,decorators:[{type:n.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:f.RestService},{type:h.Router},{type:v.OAuthService},{type:g.NavItemsService},{type:f.PermissionService},{type:f.ConfigStateService},{type:f.EnvironmentService}]}});var y=function(){function e(e,t,n){this.chatConfigService=e,this.toaster=t,this.router=n,this.subscription=new o.Subscription,this.listenToMessages(),this.listenToRouterEvents()}return e.prototype.listenToMessages=function(){var e=this;this.subscription.add(this.chatConfigService.message$.pipe(i.filter((function(){return"/chat"!==e.router.url}))).subscribe((function(t){var n=t.senderName,r=t.senderSurname,o=t.senderUsername,i=t.text,a="<strong>"+(""+(n?n+(" "+r||""):o))+"</strong>: "+(i.length>50?i.substring(0,49)+"...":i);e.chatConfigService.unreadMessagesCount++,e.toaster.info(a,"Chat::NewChatMessage",{tapToDismiss:!0})})))},e.prototype.listenToRouterEvents=function(){var e=this;this.subscription.add(this.router.events.pipe(i.filter((function(e){return e instanceof r.NavigationEnd&&"/chat"===e.url}))).subscribe((function(){return e.chatConfigService.unreadMessagesCount=0})))},e.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},e}();y.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:y,deps:[{token:b},{token:g.ToasterService},{token:h.Router}],target:l.ɵɵFactoryTarget.Component}),y.ɵcmp=l.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:y,selector:"abp-chat-icon",ngImport:l,template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',isInline:!0,styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "],directives:[{type:h.RouterLinkWithHref,selector:"a[routerLink],area[routerLink]",inputs:["routerLink","target","queryParams","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state","relativeTo"]},{type:m.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:y,decorators:[{type:n.Component,args:[{selector:"abp-chat-icon",template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "]}]}],ctorParameters:function(){return[{type:b},{type:g.ToasterService},{type:h.Router}]}});var C=[{provide:n.APP_INITIALIZER,useFactory:I,deps:[t.NavItemsService],multi:!0}];function I(e){return function(){e.addItems([{id:"Chat.ChatIconComponent",requiredPolicy:"Chat.Messaging",component:y,order:99.99}])}}var S=[{provide:n.APP_INITIALIZER,useFactory:M,deps:[s.RoutesService],multi:!0}];function M(e){return function(){e.add([{path:"/chat",name:"Chat",requiredPolicy:"Chat.Messaging",layout:"application",iconClass:"fas fa-envelope",invisible:!0}])}}var T=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[S,C,{provide:n.APP_INITIALIZER,deps:[b,c.OAuthService],multi:!0,useFactory:s.noop}]}},e}();T.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:T,deps:[],target:l.ɵɵFactoryTarget.NgModule}),T.ɵmod=l.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:T,declarations:[y],imports:[s.CoreModule]}),T.ɵinj=l.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:T,imports:[[s.CoreModule]]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:l,type:T,decorators:[{type:n.NgModule,args:[{imports:[s.CoreModule],declarations:[y],entryComponents:[y]}]}]}),e.CHAT_NAV_ITEM_PROVIDERS=C,e.CHAT_ROUTE_PROVIDERS=S,e.ChatConfigModule=T,e.ChatConfigService=b,e.ChatIconComponent=y,e.configureNavItems=I,e.configureRoutes=M,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@abp/ng.theme.shared"),require("@angular/core"),require("@angular/router"),require("rxjs"),require("rxjs/operators"),require("@microsoft/signalr"),require("@abp/ng.core"),require("angular-oauth2-oidc"),require("@angular/common")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat/config",["exports","@abp/ng.theme.shared","@angular/core","@angular/router","rxjs","rxjs/operators","@microsoft/signalr","@abp/ng.core","angular-oauth2-oidc","@angular/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).volo=e.volo||{},e.volo.abp=e.volo.abp||{},e.volo.abp.ng=e.volo.abp.ng||{},e.volo.abp.ng.chat=e.volo.abp.ng.chat||{},e.volo.abp.ng.chat.config={}),e.i4,e.ng.core,e.ng.router,e.rxjs,e.rxjs.operators,e.signalR,e.i1,e.i3$1,e.ng.common)}(this,(function(e,t,n,r,o,i,a,s,c,u){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var g=p(t),l=p(n),h=p(r),d=p(a),f=p(s),v=p(c),m=p(u),b=function(){function e(e,t,n,r,i,a,s){var c=this;this.restService=e,this.router=t,this.oAuthService=n,this.navItems=r,this.permissionService=i,this.configState=a,this.environmentService=s,this.apiName="Chat",this.message$=new o.Subject,this.unreadMessagesCount=0,this.handleMessage=function(e){c.message$.next(e)},this.listenToAppConfig()}return Object.defineProperty(e.prototype,"isChatEnabled",{get:function(){return"false"!==(this.configState.getFeature("Chat.Enable")||"").toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"signalRUrl",{get:function(){var e,t,n=this.environmentService.getEnvironment().apis;return(null===(e=n[this.apiName])||void 0===e?void 0:e.signalRUrl)||(null===(t=n[this.apiName])||void 0===t?void 0:t.url)||n.default.url},enumerable:!1,configurable:!0}),e.prototype.listenToAppConfig=function(){var e=this;this.configState.createOnUpdateStream((function(e){return e})).subscribe((function(){var t=e.configState.getOne("currentUser");e.isChatEnabled?t.isAuthenticated&&e.permissionService.getGrantedPolicy("Chat.Messaging")?(e.initSignalR(t),e.setTotalUnreadMessageCount()):e.connection&&e.connection.stop():e.toggleChat()}))},e.prototype.toggleChat=function(){var e=this;!this.isChatEnabled&&this.connection&&this.connection.stop(),this.navItems.patchItem("Chat.ChatIconComponent",{visible:function(){return e.isChatEnabled}})},e.prototype.initSignalR=function(e){var t=this;this.conectedUserId!==e.id&&(this.connection&&this.connection.stop(),this.connection=(new d.HubConnectionBuilder).withUrl(this.signalRUrl+"/signalr-hubs/chat",{accessTokenFactory:function(){return t.oAuthService.getAccessToken()}}).build(),this.connection.on("ReceiveMessage",this.handleMessage),this.connection.start().then((function(){t.conectedUserId=e.id})).catch((function(e){return console.error(e.toString())})))},e.prototype.setTotalUnreadMessageCount=function(){var e=this;"/chat"!==this.router.url&&this.restService.request({url:"/api/chat/contact/total-unread-message-count",method:"GET"},{apiName:this.apiName}).subscribe((function(t){return e.unreadMessagesCount=t}))},e}();b.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:b,deps:[{token:f.RestService},{token:h.Router},{token:v.OAuthService},{token:g.NavItemsService},{token:f.PermissionService},{token:f.ConfigStateService},{token:f.EnvironmentService}],target:l.ɵɵFactoryTarget.Injectable}),b.ɵprov=l.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:b,providedIn:"root"}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:b,decorators:[{type:n.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:f.RestService},{type:h.Router},{type:v.OAuthService},{type:g.NavItemsService},{type:f.PermissionService},{type:f.ConfigStateService},{type:f.EnvironmentService}]}});var y=function(){function e(e,t,n){this.chatConfigService=e,this.toaster=t,this.router=n,this.subscription=new o.Subscription,this.listenToMessages(),this.listenToRouterEvents()}return e.prototype.listenToMessages=function(){var e=this;this.subscription.add(this.chatConfigService.message$.pipe(i.filter((function(){return"/chat"!==e.router.url}))).subscribe((function(t){var n=t.senderName,r=t.senderSurname,o=t.senderUsername,i=t.text,a="<strong>"+(""+(n?n+(" "+r||""):o))+"</strong>: "+(i.length>50?i.substring(0,49)+"...":i);e.chatConfigService.unreadMessagesCount++,e.toaster.info(a,"Chat::NewChatMessage",{tapToDismiss:!0})})))},e.prototype.listenToRouterEvents=function(){var e=this;this.subscription.add(this.router.events.pipe(i.filter((function(e){return e instanceof r.NavigationEnd&&"/chat"===e.url}))).subscribe((function(){return e.chatConfigService.unreadMessagesCount=0})))},e.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},e}();y.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:y,deps:[{token:b},{token:g.ToasterService},{token:h.Router}],target:l.ɵɵFactoryTarget.Component}),y.ɵcmp=l.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:y,selector:"abp-chat-icon",ngImport:l,template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',isInline:!0,styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "],directives:[{type:h.RouterLinkWithHref,selector:"a[routerLink],area[routerLink]",inputs:["routerLink","target","queryParams","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state","relativeTo"]},{type:m.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:y,decorators:[{type:n.Component,args:[{selector:"abp-chat-icon",template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "]}]}],ctorParameters:function(){return[{type:b},{type:g.ToasterService},{type:h.Router}]}});var C=[{provide:n.APP_INITIALIZER,useFactory:I,deps:[t.NavItemsService],multi:!0}];function I(e){return function(){e.addItems([{id:"Chat.ChatIconComponent",requiredPolicy:"Chat.Messaging",component:y,order:99.99}])}}var S=[{provide:n.APP_INITIALIZER,useFactory:M,deps:[s.RoutesService],multi:!0}];function M(e){return function(){e.add([{path:"/chat",name:"Chat",requiredPolicy:"Chat.Messaging",layout:"application",iconClass:"fas fa-envelope",invisible:!0}])}}var T=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[S,C,{provide:n.APP_INITIALIZER,deps:[b,c.OAuthService],multi:!0,useFactory:s.noop}]}},e}();T.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:T,deps:[],target:l.ɵɵFactoryTarget.NgModule}),T.ɵmod=l.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:T,declarations:[y],imports:[s.CoreModule]}),T.ɵinj=l.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:T,imports:[[s.CoreModule]]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:l,type:T,decorators:[{type:n.NgModule,args:[{imports:[s.CoreModule],declarations:[y],entryComponents:[y]}]}]}),e.CHAT_NAV_ITEM_PROVIDERS=C,e.CHAT_ROUTE_PROVIDERS=S,e.ChatConfigModule=T,e.ChatConfigService=b,e.ChatIconComponent=y,e.configureNavItems=I,e.configureRoutes=M,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@abp/ng.core")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat/proxy",["exports","@angular/core","@abp/ng.core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).volo=e.volo||{},e.volo.abp=e.volo.abp||{},e.volo.abp.ng=e.volo.abp.ng||{},e.volo.abp.ng.chat=e.volo.abp.ng.chat||{},e.volo.abp.ng.chat.proxy={}),e.ng.core,e.i1)}(this,(function(e,t,r){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n,o=a(t),i=a(r),s=function(e){var t=this;this.restService=e,this.apiName="Chat",this.getConversation=function(e){return t.restService.request({method:"GET",url:"/api/chat/conversation/conversation",params:{targetUserId:e.targetUserId,skipCount:e.skipCount,maxResultCount:e.maxResultCount}},{apiName:t.apiName})},this.markConversationAsRead=function(e){return t.restService.request({method:"POST",url:"/api/chat/conversation/mark-conversation-as-read",body:e},{apiName:t.apiName})},this.sendMessage=function(e){return t.restService.request({method:"POST",url:"/api/chat/conversation/send-message",body:e},{apiName:t.apiName})}};s.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:s,deps:[{token:i.RestService}],target:o.ɵɵFactoryTarget.Injectable}),s.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:s,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:s,decorators:[{type:t.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i.RestService}]}}),e.ChatMessageSide=void 0,(n=e.ChatMessageSide||(e.ChatMessageSide={}))[n.Sender=1]="Sender",n[n.Receiver=2]="Receiver";var c=r.mapEnumToOptions(e.ChatMessageSide),p=function(e){var t=this;this.restService=e,this.apiName="Chat",this.setSendOnEnterSetting=function(e){return t.restService.request({method:"POST",url:"/api/chat/settings/send-on-enter",body:e},{apiName:t.apiName})}};p.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:p,deps:[{token:i.RestService}],target:o.ɵɵFactoryTarget.Injectable}),p.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:p,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:p,decorators:[{type:t.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i.RestService}]}});var u=function(e){var t=this;this.restService=e,this.apiName="Chat",this.getContacts=function(e){return t.restService.request({method:"GET",url:"/api/chat/contact/contacts",params:{filter:e.filter,includeOtherContacts:e.includeOtherContacts}},{apiName:t.apiName})},this.getTotalUnreadMessageCount=function(){return t.restService.request({method:"GET",url:"/api/chat/contact/total-unread-message-count"},{apiName:t.apiName})}};u.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:u,deps:[{token:i.RestService}],target:o.ɵɵFactoryTarget.Injectable}),u.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:u,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:o,type:u,decorators:[{type:t.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i.RestService}]}}),e.ContactService=u,e.ConversationService=s,e.SettingsService=p,e.chatMessageSideOptions=c,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@abp/ng.core")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat/proxy",["exports","@angular/core","@abp/ng.core"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).volo=e.volo||{},e.volo.abp=e.volo.abp||{},e.volo.abp.ng=e.volo.abp.ng||{},e.volo.abp.ng.chat=e.volo.abp.ng.chat||{},e.volo.abp.ng.chat.proxy={}),e.ng.core,e.i1)}(this,(function(e,t,r){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n,o=a(t),i=a(r),s=function(e){var t=this;this.restService=e,this.apiName="Chat",this.getConversation=function(e){return t.restService.request({method:"GET",url:"/api/chat/conversation/conversation",params:{targetUserId:e.targetUserId,skipCount:e.skipCount,maxResultCount:e.maxResultCount}},{apiName:t.apiName})},this.markConversationAsRead=function(e){return t.restService.request({method:"POST",url:"/api/chat/conversation/mark-conversation-as-read",body:e},{apiName:t.apiName})},this.sendMessage=function(e){return t.restService.request({method:"POST",url:"/api/chat/conversation/send-message",body:e},{apiName:t.apiName})}};s.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:s,deps:[{token:i.RestService}],target:o.ɵɵFactoryTarget.Injectable}),s.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:s,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:s,decorators:[{type:t.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i.RestService}]}}),e.ChatMessageSide=void 0,(n=e.ChatMessageSide||(e.ChatMessageSide={}))[n.Sender=1]="Sender",n[n.Receiver=2]="Receiver";var c=r.mapEnumToOptions(e.ChatMessageSide),p=function(e){var t=this;this.restService=e,this.apiName="Chat",this.setSendOnEnterSetting=function(e){return t.restService.request({method:"POST",url:"/api/chat/settings/send-on-enter",body:e},{apiName:t.apiName})}};p.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:p,deps:[{token:i.RestService}],target:o.ɵɵFactoryTarget.Injectable}),p.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:p,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:p,decorators:[{type:t.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i.RestService}]}});var u=function(e){var t=this;this.restService=e,this.apiName="Chat",this.getContacts=function(e){return t.restService.request({method:"GET",url:"/api/chat/contact/contacts",params:{filter:e.filter,includeOtherContacts:e.includeOtherContacts}},{apiName:t.apiName})},this.getTotalUnreadMessageCount=function(){return t.restService.request({method:"GET",url:"/api/chat/contact/total-unread-message-count"},{apiName:t.apiName})}};u.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:u,deps:[{token:i.RestService}],target:o.ɵɵFactoryTarget.Injectable}),u.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:u,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:o,type:u,decorators:[{type:t.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i.RestService}]}}),e.ContactService=u,e.ConversationService=s,e.SettingsService=p,e.chatMessageSideOptions=c,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@abp/ng.core"),require("@abp/ng.theme.shared"),require("@angular/core"),require("@angular/router"),require("rxjs"),require("rxjs/operators"),require("@volo/abp.ng.chat/config"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat",["exports","@abp/ng.core","@abp/ng.theme.shared","@angular/core","@angular/router","rxjs","rxjs/operators","@volo/abp.ng.chat/config","@angular/common","@angular/forms"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).volo=e.volo||{},e.volo.abp=e.volo.abp||{},e.volo.abp.ng=e.volo.abp.ng||{},e.volo.abp.ng.chat={}),e.i3,e.ng_theme_shared,e.ng.core,e.ng.router,e.rxjs,e.rxjs.operators,e.volo.abp.ng.chat.config,e.ng.common,e.ng.forms)}(this,(function(e,t,n,a,o,s,r,c,i,l){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var d=p(t),g=p(a),u=p(o),m=p(c),f=p(i),h=p(l);Object.create;function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,o,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(a=s.next()).done;)r.push(a.value)}catch(e){o={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return r}function y(e,t,n){if(n||2===arguments.length)for(var a,o=0,s=t.length;o<s;o++)!a&&o in t||(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))}var C;Object.create;!function(e){e[e.Sender=1]="Sender",e[e.Receiver=2]="Receiver"}(C||(C={}));var b=function(){function e(e){this.restService=e,this.apiName="Chat"}return e.prototype.getContactsByInput=function(e){return void 0===e&&(e={}),this.restService.request({url:"/api/chat/contact/contacts",method:"GET",params:e},{apiName:this.apiName})},e}();b.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:b,deps:[{token:d.RestService}],target:g.ɵɵFactoryTarget.Injectable}),b.ɵprov=g.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:b,providedIn:"root"}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:b,decorators:[{type:a.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:d.RestService}]}});var x=[{color:"#ffffff",backgroundColor:"#3cb160"},{color:"#ffffff",backgroundColor:"#c373cc"},{color:"#ffffff",backgroundColor:"#2b78b3"},{color:"#ffffff",backgroundColor:"#6ac79a"},{color:"#ffffff",backgroundColor:"#aeb140"},{color:"#ffffff",backgroundColor:"#b773c0"},{color:"#ffffff",backgroundColor:"#e16d7a"},{color:"#ffffff",backgroundColor:"#ffac2a"},{color:"#ffffff",backgroundColor:"#21bbc7"},{color:"#ffffff",backgroundColor:"#59ab95"}],M=function(){function e(){}return Object.defineProperty(e.prototype,"avatarText",{get:function(){if(this.contact&&this.contact.username)return this.contact.name&&this.contact.surname?this.contact.name[0]+this.contact.surname[0]:this.contact.name?this.contact.name.slice(0,2):this.contact.username.slice(0,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"avatarBgStyle",{get:function(){if(this.contact&&this.contact.username){for(var e=0,t=0;t<this.contact.username.length;t++)e=this.contact.username.charCodeAt(t)+((e<<5)-e);return x[Math.abs(e%10)]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSmall",{get:function(){return"string"==typeof this.small||this.small},enumerable:!1,configurable:!0}),e}();M.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:M,deps:[],target:g.ɵɵFactoryTarget.Component}),M.ɵcmp=g.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:M,selector:"abp-conversation-avatar",inputs:{contact:"contact",small:"small"},ngImport:g,template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',isInline:!0,styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "],directives:[{type:f.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:M,decorators:[{type:a.Component,args:[{selector:"abp-conversation-avatar",template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "]}]}],propDecorators:{contact:[{type:a.Input}],small:[{type:a.Input}]}});var I=function(){function e(e,n,o){this.contactService=e,this.chatConfigService=n,this.subscription=o,this.selected=new a.EventEmitter,this.allContacts=[],this.selectedContact={},this.filter="",this.getContactName=S,this.trackByUserId=t.trackBy("userId")}return Object.defineProperty(e.prototype,"contacts",{get:function(){return this.allContacts.filter((function(e){return e.lastMessage})).sort((function(e,t){return new Date(e.lastMessageDate).valueOf()>new Date(t.lastMessageDate).valueOf()?-1:1}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"otherContacts",{get:function(){return this.allContacts.filter((function(e){return!e.lastMessage}))},enumerable:!1,configurable:!0}),e.prototype.listenToNewMessages=function(){var e=this;this.subscription.addOne(this.chatConfigService.message$,(function(t){void 0===t&&(t={});var n=e.allContacts.findIndex((function(e){return e.userId===t.senderUserId})),a={userId:t.senderUserId,username:t.senderUsername,name:t.senderName,surname:t.senderSurname,lastMessage:t.text,unreadMessageCount:1,lastMessageDate:new Date,lastMessageSide:C.Receiver};n>-1?e.allContacts[n]=Object.assign(Object.assign({},a),{unreadMessageCount:e.selectedContact.userId===e.allContacts[n].userId?0:e.allContacts[n].unreadMessageCount+1}):e.filter||e.allContacts.push(a)}))},e.prototype.ngOnInit=function(){var e=this;this.get((function(){e.selectContact(e.allContacts.length?e.allContacts[0]:{}),e.listenToNewMessages()}))},e.prototype.ngOnDestroy=function(){},e.prototype.get=function(e){var t=this;this.contactService.getContactsByInput({includeOtherContacts:!!this.filter,filter:this.filter}).subscribe((function(n){n.length&&(t.allContacts=n,e&&e())}))},e.prototype.selectContact=function(e){this.selectedContact=e,this.selected.emit(e)},e.prototype.changeLastMessageOfSelectedContact=function(e){var t=this;this.selectedContact.lastMessage=e,this.selectedContact.lastMessageDate=new Date;var n=this.allContacts.findIndex((function(e){return e.userId===t.selectedContact.userId}));this.allContacts[n]=this.selectedContact},e.prototype.markSelectedContactAsRead=function(){this.selectedContact.unreadMessageCount=0},e}();function S(e){var t=e.name,n=e.surname,a=e.username;return t||n?(t||"")+" "+(n||""):a}I.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:I,deps:[{token:b},{token:m.ChatConfigService},{token:d.SubscriptionService}],target:g.ɵɵFactoryTarget.Component}),I.ɵcmp=g.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:I,selector:"abp-chat-contacts",outputs:{selected:"selected"},providers:[t.SubscriptionService],ngImport:g,template:'<div class="border-right">\n <div class="p-3 bg-light border-bottom">\n <div class="form-row">\n <div class="col">\n <input\n id="contacts-filter"\n type="search"\n class="form-control form-control-sm"\n autocomplete="off"\n spellcheck="false"\n [(ngModel)]="filter"\n [placeholder]="\'Chat::SearchInContacts\' | abpLocalization"\n [attr.aria-label]="\'Chat::SearchInContacts\' | abpLocalization"\n (input.debounce)="get()"\n />\n </div>\n </div>\n </div>\n\n <div class="messages-box m-0 p-0">\n <div class="list-group rounded-0" id="contact-list">\n <ng-container\n *ngFor="let contact of contacts; let i = index; trackBy: trackByUserId"\n [ngTemplateOutlet]="contactTemplate"\n [ngTemplateOutletContext]="{ $implicit: contact, index: i }"\n >\n </ng-container>\n <div\n *ngIf="otherContacts.length"\n class="list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-left-0 border-right-0"\n >\n <small>{{ \'Chat::OtherContacts\' | abpLocalization }}</small>\n </div>\n <ng-container\n *ngFor="let contact of otherContacts; let i = index; trackBy: trackByUserId"\n [ngTemplateOutlet]="contactTemplate"\n [ngTemplateOutletContext]="{ $implicit: contact, index: i }"\n >\n </ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #contactTemplate let-contact let-i="index">\n <a\n (click)="selectContact(contact)"\n class="chat-contact list-group-item list-group-item-action px-4 rounded-0 border-left-0 pointer {{\n selectedContact.userId === contact.userId ? \'active text-white\' : \'\'\n }}"\n ><div class="media">\n <abp-conversation-avatar [contact]="contact"></abp-conversation-avatar>\n <div class="media-body ml-2 d-none d-md-block">\n <div class="d-flex align-items-center justify-content-between mb-1">\n <h6 class="mb-0">\n <small *ngIf="contact.unreadMessageCount" class="badge badge-success mr-1">{{\n contact.unreadMessageCount\n }}</small\n >{{ getContactName(contact) }}\n </h6>\n <small class="small font-weight-bold last-message-date">{{\n contact.lastMessageDate | date\n }}</small>\n </div>\n <p class="mb-0 text-small last-message">\n {{\n contact.lastMessage?.length > 24\n ? (contact.lastMessage | slice: 0:23) + \'...\'\n : contact.lastMessage\n }}\n </p>\n </div>\n </div>\n </a>\n</ng-template>\n',styles:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],components:[{type:M,selector:"abp-conversation-avatar",inputs:["contact","small"]}],directives:[{type:h.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:h.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{type:h.NgModel,selector:"[ngModel]:not([formControlName]):not([formControl])",inputs:["name","disabled","ngModel","ngModelOptions"],outputs:["ngModelChange"],exportAs:["ngModel"]},{type:d.InputEventDebounceDirective,selector:"[input.debounce]",inputs:["debounce"],outputs:["input.debounce"]},{type:f.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:f.NgTemplateOutlet,selector:"[ngTemplateOutlet]",inputs:["ngTemplateOutletContext","ngTemplateOutlet"]},{type:f.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}],pipes:{abpLocalization:d.LocalizationPipe,date:f.DatePipe,slice:f.SlicePipe}}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:I,decorators:[{type:a.Component,args:[{selector:"abp-chat-contacts",templateUrl:"chat-contacts.component.html",styles:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],providers:[t.SubscriptionService]}]}],ctorParameters:function(){return[{type:b},{type:m.ChatConfigService},{type:d.SubscriptionService}]},propDecorators:{selected:[{type:a.Output}]}});var D=function(){function e(e){this.restService=e,this.apiName="Chat"}return e.prototype.sendMessageByInput=function(e){return this.restService.request({url:"/api/chat/conversation/send-message",method:"POST",body:e},{apiName:this.apiName})},e.prototype.getConversationByInput=function(e){return void 0===e&&(e={}),this.restService.request({url:"/api/chat/conversation/conversation",method:"GET",params:e},{apiName:this.apiName})},e.prototype.markConversationAsReadByInput=function(e){return this.restService.request({url:"/api/chat/conversation/mark-conversation-as-read",method:"POST",body:e},{apiName:this.apiName})},e}();D.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:D,deps:[{token:d.RestService}],target:g.ɵɵFactoryTarget.Injectable}),D.ɵprov=g.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:D,providedIn:"root"}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:D,decorators:[{type:a.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:d.RestService}]}});var k=new Date,T=new Date(k.getFullYear(),k.getMonth(),k.getDate()).valueOf(),w=function(){function e(e,n,a,o){var c=this;this.conversationService=e,this.chatConfigService=n,this.configState=a,this.httpWaitService=o,this.selectedContact={},this.unreadMessageCount=0,this.userMessages=new Map,this.chatMessageSide=C,this.trackByMessageDate=t.trackBy("messageDate"),this.destroy$=new s.Subject,this.onScroll=function(e){c.allMessagesLoaded||c.pagingLoading||!c.selectedContact.lastMessage||c.chatBoxRef.nativeElement.scrollTop>250||c.selectedContactMessages.length%50!=0?e.preventDefault():(c.pagingLoading=!0,c.conversationService.getConversationByInput({skipCount:c.selectedContactMessages.length,maxResultCount:50,targetUserId:c.selectedContact.userId}).pipe(r.finalize((function(){return c.pagingLoading=!1}))).subscribe((function(e){var t;e.messages.length?(t=c.userMessages.get(c.selectedContact.userId)).unshift.apply(t,y([],v(e.messages.reverse()))):c.allMessagesLoaded=!0})))},this.httpWaitService.addFilter([{method:"POST",endpoint:"/api/chat/conversation/send-message"},{method:"GET",endpoint:"/api/chat/contact/contacts"}])}return Object.defineProperty(e.prototype,"contactName",{get:function(){return S(this.selectedContact||{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedContactMessages",{get:function(){return this.userMessages.get(this.selectedContact.userId)||[]},enumerable:!1,configurable:!0}),e.prototype.listenToChatBoxScroll=function(){s.fromEvent(this.chatBoxRef.nativeElement,"scroll").pipe(r.debounceTime(150),r.takeUntil(this.destroy$)).subscribe(this.onScroll)},e.prototype.listenToNewMessages=function(){var e=this;this.chatConfigService.message$.pipe(r.takeUntil(this.destroy$)).subscribe((function(t){var n=void 0===t?{}:t,a=n.senderUserId,o=n.text;if(e.userMessages.has(a)){var s=e.selectedContact.userId===a;e.userMessages.get(a).push({message:o,messageDate:new Date,side:C.Receiver,isRead:s,readDate:s?new Date:null}),e.scrollToEnd()}}))},e.prototype.ngAfterViewInit=function(){this.sendOnEnter="false"!==(this.configState.getSetting("Volo.Chat.Messaging.SendMessageOnEnter")||"").toLowerCase(),this.listenToChatBoxScroll(),this.listenToNewMessages()},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.prototype.getConversation=function(e){var t=this;this.allMessagesLoaded=!1,this.conversationService.getConversationByInput({skipCount:0,maxResultCount:50,targetUserId:this.selectedContact.userId}).subscribe((function(n){t.userMessages.set(t.selectedContact.userId,n.messages.reverse()),e&&t.scrollToEnd(),t.selectedContact.unreadMessageCount&&t.markConversationAsRead()}))},e.prototype.send=function(){var e=this;this.message&&!this.loading&&(this.unreadMessageCount=0,this.loading=!0,this.conversationService.sendMessageByInput({message:this.message,targetUserId:this.selectedContact.userId}).pipe(r.finalize((function(){return e.loading=!1}))).subscribe((function(){e.chatContactsComponent.changeLastMessageOfSelectedContact(e.message),e.userMessages.has(e.selectedContact.userId)||e.userMessages.set(e.selectedContact.userId,[]),e.userMessages.get(e.selectedContact.userId).push({message:e.message,isRead:!0,readDate:k,messageDate:k,side:C.Sender}),e.message="",e.scrollToEnd()})))},e.prototype.markConversationAsRead=function(){var e=this;this.conversationService.markConversationAsReadByInput({targetUserId:this.selectedContact.userId}).subscribe((function(){e.chatContactsComponent.markSelectedContactAsRead(),e.selectedContact.unreadMessageCount=0,setTimeout((function(){return e.unreadMessageCount=0}),5e3)}))},e.prototype.sendWithEnter=function(e){this.sendOnEnter&&(e.preventDefault(),this.send())},e.prototype.onSelectContact=function(e){this.selectedContact=e,this.unreadMessageCount=e.unreadMessageCount,this.scrollToEnd(),!this.userMessages.has(e.userId)&&e.lastMessage?this.getConversation(!0):e.unreadMessageCount&&this.markConversationAsRead()},e.prototype.getDateFormat=function(e){return e=new Date(e),new Date(e.getFullYear(),e.getMonth(),e.getDate()).valueOf()===T?"shortTime":"short"},e.prototype.scrollToEnd=function(){var e=this;setTimeout((function(){var t=(document.querySelector(".unread-message-count-badge-wrapper")||{}).offsetTop;e.chatBoxRef.nativeElement.scrollTo({top:t?t-60:e.chatBoxRef.nativeElement.scrollHeight})}),0)},e}();w.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:w,deps:[{token:D},{token:m.ChatConfigService},{token:d.ConfigStateService},{token:d.HttpWaitService}],target:g.ɵɵFactoryTarget.Component}),w.ɵcmp=g.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:w,selector:"abp-chat",viewQueries:[{propertyName:"chatBoxRef",first:!0,predicate:["chatBox"],descendants:!0},{propertyName:"chatContactsComponent",first:!0,predicate:I,descendants:!0}],ngImport:g,template:'<div class="row entry-row">\n <div class="col-auto"></div>\n <div class="col-lg-auto pl-lg-0"></div>\n <div class="col">\n <div class="text-lg-right pt-2" id="AbpContentToolbar"></div>\n </div>\n</div>\n\n<div id="chat_wrapper">\n <div class="container-fluid">\n <div class="row rounded-lg overflow-hidden shadow bor der">\n <div class="col-3 col-md-5 col-lg-4 px-0">\n <abp-chat-contacts (selected)="onSelectContact($event)"></abp-chat-contacts>\n </div>\n\n \x3c!-- Chat Box--\x3e\n <div class="col-9 col-md-7 col-lg-8 px-0">\n <div class="p-3 bg-light border-bottom">\n <div class="form-row">\n <div class="col">\n <div class="form-row">\n <div class="col-auto">\n <abp-conversation-avatar\n small\n [contact]="selectedContact"\n ></abp-conversation-avatar>\n </div>\n <div class="col pt-1" style="line-height: 1.2;">\n <strong id="conversation-title" class="font-weight-bold">{{ contactName }}</strong\n ><br />\n <small id="conversation-info"></small>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div #chatBox id="chat-conversation-wrapper" class="chat-box m-0 p-0">\n <div class="chat-box-container p-4" [id]="\'chat-conversation\'">\n <ng-container\n *ngFor="\n let message of selectedContactMessages;\n let i = index;\n trackBy: trackByMessageDate\n "\n >\n <div\n *ngIf="selectedContactMessages.length - unreadMessageCount === i"\n class="row justify-content-center unread-message-count-badge-wrapper"\n >\n <h3>\n <span class="badge badge-info">\n <ng-container *ngIf="unreadMessageCount === 1; else moreThanOne">\n {{ \'Chat::YouHaveAnUnreadMessage\' | abpLocalization }}\n </ng-container>\n\n <ng-template #moreThanOne>\n {{\n \'Chat::YouHave{0}UnreadMessages\' | abpLocalization: \'\' + unreadMessageCount\n }}\n </ng-template>\n </span>\n </h3>\n </div>\n\n <div\n *ngIf="{ isSender: message.side === chatMessageSide.Sender } as data"\n class="media w-75 mw-65 w-lp-auto mb-2"\n [class.ml-auto]="data.isSender"\n >\n <div class="media-body position-relative">\n <div\n class="shadow rounded py-3 px-4 mb-1 {{\n data.isSender ? \'bg-primary\' : \'bg-light\'\n }}"\n >\n <p\n class="text-small mb-0 {{ data.isSender ? \'text-white\' : \'text-muted\' }}"\n [innerHTML]="message.message"\n ></p>\n </div>\n <p\n class="message-date small text-muted m-0 {{ data.isSender ? \'left\' : \'right\' }}"\n >\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\n </p>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n\n \x3c!-- Typing area --\x3e\n <div *ngIf="selectedContact?.userId" id="send-message-form" class="bg-light border-top m-0">\n <div class="p-3">\n <textarea\n id="chat-message-box"\n name="message"\n type="text"\n [placeholder]="\'Chat::TypeMessage\' | abpLocalization"\n class="form-control rounded py-2 bg-white"\n [(ngModel)]="message"\n (keydown.enter)="sendWithEnter($event)"\n ></textarea>\n <div class="custom-control custom-checkbox float-left mt-3">\n <input\n type="checkbox"\n class="custom-control-input"\n id="send-on-enter"\n [(ngModel)]="sendOnEnter"\n />\n <label class="custom-control-label" for="send-on-enter">{{\n \'Chat::SendOnEnter\' | abpLocalization\n }}</label>\n </div>\n <div class="mt-2 text-right">\n <button\n [disabled]="!message"\n (click)="send()"\n id="send-message-button"\n type="button"\n class="btn btn-primary px-3"\n >\n {{ \'Chat::Send\' | abpLocalization }}\n <i *ngIf="!loading; else loadingIcon" class="fa fa-paper-plane ml-2"></i>\n\n <ng-template #loadingIcon>\n <i class="fas fa-spinner fa-spin ml-2"></i>\n </ng-template>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n',styles:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "],components:[{type:I,selector:"abp-chat-contacts",outputs:["selected"]},{type:M,selector:"abp-conversation-avatar",inputs:["contact","small"]}],directives:[{type:f.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:f.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:h.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:h.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{type:h.NgModel,selector:"[ngModel]:not([formControlName]):not([formControl])",inputs:["name","disabled","ngModel","ngModelOptions"],outputs:["ngModelChange"],exportAs:["ngModel"]},{type:h.CheckboxControlValueAccessor,selector:"input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]"}],pipes:{abpLocalization:d.LocalizationPipe,date:f.DatePipe}}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:w,decorators:[{type:a.Component,args:[{selector:"abp-chat",templateUrl:"chat.component.html",styles:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "]}]}],ctorParameters:function(){return[{type:D},{type:m.ChatConfigService},{type:d.ConfigStateService},{type:d.HttpWaitService}]},propDecorators:{chatBoxRef:[{type:a.ViewChild,args:["chatBox",{static:!1}]}],chatContactsComponent:[{type:a.ViewChild,args:[I,{static:!1}]}]}});var O=[{path:"",component:t.DynamicLayoutComponent,canActivate:[t.AuthGuard,t.PermissionGuard],children:[{path:"",component:t.ReplaceableRouteContainerComponent,data:{requiredPolicy:"Chat.Messaging",replaceableComponent:{defaultComponent:w,key:"Chat.ChatComponent"}}}]}],N=function(){};N.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:N,deps:[],target:g.ɵɵFactoryTarget.NgModule}),N.ɵmod=g.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:N,imports:[u.RouterModule],exports:[o.RouterModule]}),N.ɵinj=g.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:N,imports:[[o.RouterModule.forChild(O)],o.RouterModule]}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:N,decorators:[{type:a.NgModule,args:[{imports:[o.RouterModule.forChild(O)],exports:[o.RouterModule]}]}]});var j=[w,I,M],B=function(){function e(){}return e.forChild=function(){return{ngModule:e,providers:[]}},e.forLazy=function(){return new t.LazyModuleFactory(e.forChild())},e}();B.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:B,deps:[],target:g.ɵɵFactoryTarget.NgModule}),B.ɵmod=g.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:B,declarations:[w,I,M],imports:[t.CoreModule,n.ThemeSharedModule,N],exports:[w,I,M]}),B.ɵinj=g.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:B,imports:[[t.CoreModule,n.ThemeSharedModule,N]]}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:g,type:B,decorators:[{type:a.NgModule,args:[{declarations:j,imports:[t.CoreModule,n.ThemeSharedModule,N],exports:y([],v(j))}]}]}),e.ChatComponent=w,e.ChatContactsComponent=I,e.ChatModule=B,e.ConversationAvatarComponent=M,e.getContactName=S,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@abp/ng.core"),require("@abp/ng.theme.shared"),require("@angular/core"),require("@angular/router"),require("rxjs"),require("rxjs/operators"),require("@volo/abp.ng.chat/config"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat",["exports","@abp/ng.core","@abp/ng.theme.shared","@angular/core","@angular/router","rxjs","rxjs/operators","@volo/abp.ng.chat/config","@angular/common","@angular/forms"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).volo=e.volo||{},e.volo.abp=e.volo.abp||{},e.volo.abp.ng=e.volo.abp.ng||{},e.volo.abp.ng.chat={}),e.i3,e.ng_theme_shared,e.ng.core,e.ng.router,e.rxjs,e.rxjs.operators,e.volo.abp.ng.chat.config,e.ng.common,e.ng.forms)}(this,(function(e,t,n,r,a,o,s,c,i,l){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var d=p(t),g=p(r),u=p(a),m=p(c),f=p(i),h=p(l);Object.create;function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return s}function C(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var y;Object.create;!function(e){e[e.Sender=1]="Sender",e[e.Receiver=2]="Receiver"}(y||(y={}));var b=function(){function e(e){this.restService=e,this.apiName="Chat"}return e.prototype.getContactsByInput=function(e){return void 0===e&&(e={}),this.restService.request({url:"/api/chat/contact/contacts",method:"GET",params:e},{apiName:this.apiName})},e}();b.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:b,deps:[{token:d.RestService}],target:g.ɵɵFactoryTarget.Injectable}),b.ɵprov=g.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:b,providedIn:"root"}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:b,decorators:[{type:r.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:d.RestService}]}});var x=[{color:"#ffffff",backgroundColor:"#3cb160"},{color:"#ffffff",backgroundColor:"#c373cc"},{color:"#ffffff",backgroundColor:"#2b78b3"},{color:"#ffffff",backgroundColor:"#6ac79a"},{color:"#ffffff",backgroundColor:"#aeb140"},{color:"#ffffff",backgroundColor:"#b773c0"},{color:"#ffffff",backgroundColor:"#e16d7a"},{color:"#ffffff",backgroundColor:"#ffac2a"},{color:"#ffffff",backgroundColor:"#21bbc7"},{color:"#ffffff",backgroundColor:"#59ab95"}],M=function(){function e(){}return Object.defineProperty(e.prototype,"avatarText",{get:function(){if(this.contact&&this.contact.username)return this.contact.name&&this.contact.surname?this.contact.name[0]+this.contact.surname[0]:this.contact.name?this.contact.name.slice(0,2):this.contact.username.slice(0,2)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"avatarBgStyle",{get:function(){if(this.contact&&this.contact.username){for(var e=0,t=0;t<this.contact.username.length;t++)e=this.contact.username.charCodeAt(t)+((e<<5)-e);return x[Math.abs(e%10)]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSmall",{get:function(){return"string"==typeof this.small||this.small},enumerable:!1,configurable:!0}),e}();M.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:M,deps:[],target:g.ɵɵFactoryTarget.Component}),M.ɵcmp=g.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:M,selector:"abp-conversation-avatar",inputs:{contact:"contact",small:"small"},ngImport:g,template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',isInline:!0,styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "],directives:[{type:f.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:M,decorators:[{type:r.Component,args:[{selector:"abp-conversation-avatar",template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "]}]}],propDecorators:{contact:[{type:r.Input}],small:[{type:r.Input}]}});var I=function(){function e(e,n,a){this.contactService=e,this.chatConfigService=n,this.subscription=a,this.selected=new r.EventEmitter,this.allContacts=[],this.selectedContact={},this.filter="",this.getContactName=S,this.trackByUserId=t.trackBy("userId")}return Object.defineProperty(e.prototype,"contacts",{get:function(){return this.allContacts.filter((function(e){return e.lastMessage})).sort((function(e,t){return new Date(e.lastMessageDate).valueOf()>new Date(t.lastMessageDate).valueOf()?-1:1}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"otherContacts",{get:function(){return this.allContacts.filter((function(e){return!e.lastMessage}))},enumerable:!1,configurable:!0}),e.prototype.listenToNewMessages=function(){var e=this;this.subscription.addOne(this.chatConfigService.message$,(function(t){void 0===t&&(t={});var n=e.allContacts.findIndex((function(e){return e.userId===t.senderUserId})),r={userId:t.senderUserId,username:t.senderUsername,name:t.senderName,surname:t.senderSurname,lastMessage:t.text,unreadMessageCount:1,lastMessageDate:new Date,lastMessageSide:y.Receiver};n>-1?e.allContacts[n]=Object.assign(Object.assign({},r),{unreadMessageCount:e.selectedContact.userId===e.allContacts[n].userId?0:e.allContacts[n].unreadMessageCount+1}):e.filter||e.allContacts.push(r)}))},e.prototype.ngOnInit=function(){var e=this;this.get((function(){e.selectContact(e.allContacts.length?e.allContacts[0]:{}),e.listenToNewMessages()}))},e.prototype.ngOnDestroy=function(){},e.prototype.get=function(e){var t=this;this.contactService.getContactsByInput({includeOtherContacts:!!this.filter,filter:this.filter}).subscribe((function(n){n.length&&(t.allContacts=n,e&&e())}))},e.prototype.selectContact=function(e){this.selectedContact=e,this.selected.emit(e)},e.prototype.changeLastMessageOfSelectedContact=function(e){var t=this;this.selectedContact.lastMessage=e,this.selectedContact.lastMessageDate=new Date;var n=this.allContacts.findIndex((function(e){return e.userId===t.selectedContact.userId}));this.allContacts[n]=this.selectedContact},e.prototype.markSelectedContactAsRead=function(){this.selectedContact.unreadMessageCount=0},e}();function S(e){var t=e.name,n=e.surname,r=e.username;return t||n?(t||"")+" "+(n||""):r}I.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:I,deps:[{token:b},{token:m.ChatConfigService},{token:d.SubscriptionService}],target:g.ɵɵFactoryTarget.Component}),I.ɵcmp=g.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:I,selector:"abp-chat-contacts",outputs:{selected:"selected"},providers:[t.SubscriptionService],ngImport:g,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:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],components:[{type:M,selector:"abp-conversation-avatar",inputs:["contact","small"]}],directives:[{type:h.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:h.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{type:h.NgModel,selector:"[ngModel]:not([formControlName]):not([formControl])",inputs:["name","disabled","ngModel","ngModelOptions"],outputs:["ngModelChange"],exportAs:["ngModel"]},{type:d.InputEventDebounceDirective,selector:"[input.debounce]",inputs:["debounce"],outputs:["input.debounce"]},{type:f.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:f.NgTemplateOutlet,selector:"[ngTemplateOutlet]",inputs:["ngTemplateOutletContext","ngTemplateOutlet"]},{type:f.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}],pipes:{abpLocalization:d.LocalizationPipe,date:f.DatePipe,slice:f.SlicePipe}}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:I,decorators:[{type:r.Component,args:[{selector:"abp-chat-contacts",templateUrl:"chat-contacts.component.html",styles:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],providers:[t.SubscriptionService]}]}],ctorParameters:function(){return[{type:b},{type:m.ChatConfigService},{type:d.SubscriptionService}]},propDecorators:{selected:[{type:r.Output}]}});var D=function(){function e(e){this.restService=e,this.apiName="Chat"}return e.prototype.sendMessageByInput=function(e){return this.restService.request({url:"/api/chat/conversation/send-message",method:"POST",body:e},{apiName:this.apiName})},e.prototype.getConversationByInput=function(e){return void 0===e&&(e={}),this.restService.request({url:"/api/chat/conversation/conversation",method:"GET",params:e},{apiName:this.apiName})},e.prototype.markConversationAsReadByInput=function(e){return this.restService.request({url:"/api/chat/conversation/mark-conversation-as-read",method:"POST",body:e},{apiName:this.apiName})},e}();D.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:D,deps:[{token:d.RestService}],target:g.ɵɵFactoryTarget.Injectable}),D.ɵprov=g.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:D,providedIn:"root"}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:D,decorators:[{type:r.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:d.RestService}]}});var k=new Date,T=new Date(k.getFullYear(),k.getMonth(),k.getDate()).valueOf(),w=function(){function e(e,n,r,a){var c=this;this.conversationService=e,this.chatConfigService=n,this.configState=r,this.httpWaitService=a,this.selectedContact={},this.unreadMessageCount=0,this.userMessages=new Map,this.chatMessageSide=y,this.trackByMessageDate=t.trackBy("messageDate"),this.destroy$=new o.Subject,this.onScroll=function(e){c.allMessagesLoaded||c.pagingLoading||!c.selectedContact.lastMessage||c.chatBoxRef.nativeElement.scrollTop>250||c.selectedContactMessages.length%50!=0?e.preventDefault():(c.pagingLoading=!0,c.conversationService.getConversationByInput({skipCount:c.selectedContactMessages.length,maxResultCount:50,targetUserId:c.selectedContact.userId}).pipe(s.finalize((function(){return c.pagingLoading=!1}))).subscribe((function(e){var t;e.messages.length?(t=c.userMessages.get(c.selectedContact.userId)).unshift.apply(t,C([],v(e.messages.reverse()))):c.allMessagesLoaded=!0})))},this.httpWaitService.addFilter([{method:"POST",endpoint:"/api/chat/conversation/send-message"},{method:"GET",endpoint:"/api/chat/contact/contacts"}])}return Object.defineProperty(e.prototype,"contactName",{get:function(){return S(this.selectedContact||{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectedContactMessages",{get:function(){return this.userMessages.get(this.selectedContact.userId)||[]},enumerable:!1,configurable:!0}),e.prototype.listenToChatBoxScroll=function(){o.fromEvent(this.chatBoxRef.nativeElement,"scroll").pipe(s.debounceTime(150),s.takeUntil(this.destroy$)).subscribe(this.onScroll)},e.prototype.listenToNewMessages=function(){var e=this;this.chatConfigService.message$.pipe(s.takeUntil(this.destroy$)).subscribe((function(t){var n=void 0===t?{}:t,r=n.senderUserId,a=n.text;if(e.userMessages.has(r)){var o=e.selectedContact.userId===r;e.userMessages.get(r).push({message:a,messageDate:new Date,side:y.Receiver,isRead:o,readDate:o?new Date:null}),e.scrollToEnd()}}))},e.prototype.ngAfterViewInit=function(){this.sendOnEnter="false"!==(this.configState.getSetting("Volo.Chat.Messaging.SendMessageOnEnter")||"").toLowerCase(),this.listenToChatBoxScroll(),this.listenToNewMessages()},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.prototype.getConversation=function(e){var t=this;this.allMessagesLoaded=!1,this.conversationService.getConversationByInput({skipCount:0,maxResultCount:50,targetUserId:this.selectedContact.userId}).subscribe((function(n){t.userMessages.set(t.selectedContact.userId,n.messages.reverse()),e&&t.scrollToEnd(),t.selectedContact.unreadMessageCount&&t.markConversationAsRead()}))},e.prototype.send=function(){var e=this;this.message&&!this.loading&&(this.unreadMessageCount=0,this.loading=!0,this.conversationService.sendMessageByInput({message:this.message,targetUserId:this.selectedContact.userId}).pipe(s.finalize((function(){return e.loading=!1}))).subscribe((function(){e.chatContactsComponent.changeLastMessageOfSelectedContact(e.message),e.userMessages.has(e.selectedContact.userId)||e.userMessages.set(e.selectedContact.userId,[]),e.userMessages.get(e.selectedContact.userId).push({message:e.message,isRead:!0,readDate:k,messageDate:k,side:y.Sender}),e.message="",e.scrollToEnd()})))},e.prototype.markConversationAsRead=function(){var e=this;this.conversationService.markConversationAsReadByInput({targetUserId:this.selectedContact.userId}).subscribe((function(){e.chatContactsComponent.markSelectedContactAsRead(),e.selectedContact.unreadMessageCount=0,setTimeout((function(){return e.unreadMessageCount=0}),5e3)}))},e.prototype.sendWithEnter=function(e){this.sendOnEnter&&(e.preventDefault(),this.send())},e.prototype.onSelectContact=function(e){this.selectedContact=e,this.unreadMessageCount=e.unreadMessageCount,this.scrollToEnd(),!this.userMessages.has(e.userId)&&e.lastMessage?this.getConversation(!0):e.unreadMessageCount&&this.markConversationAsRead()},e.prototype.getDateFormat=function(e){return e=new Date(e),new Date(e.getFullYear(),e.getMonth(),e.getDate()).valueOf()===T?"shortTime":"short"},e.prototype.scrollToEnd=function(){var e=this;setTimeout((function(){var t=(document.querySelector(".unread-message-count-badge-wrapper")||{}).offsetTop;e.chatBoxRef.nativeElement.scrollTo({top:t?t-60:e.chatBoxRef.nativeElement.scrollHeight})}),0)},e}();w.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:w,deps:[{token:D},{token:m.ChatConfigService},{token:d.ConfigStateService},{token:d.HttpWaitService}],target:g.ɵɵFactoryTarget.Component}),w.ɵcmp=g.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:w,selector:"abp-chat",viewQueries:[{propertyName:"chatBoxRef",first:!0,predicate:["chatBox"],descendants:!0},{propertyName:"chatContactsComponent",first:!0,predicate:I,descendants:!0}],ngImport:g,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 \x3c!-- Chat Box--\x3e\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 \x3c!-- Typing area --\x3e\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:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "],components:[{type:I,selector:"abp-chat-contacts",outputs:["selected"]},{type:M,selector:"abp-conversation-avatar",inputs:["contact","small"]}],directives:[{type:f.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:f.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:h.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:h.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{type:h.NgModel,selector:"[ngModel]:not([formControlName]):not([formControl])",inputs:["name","disabled","ngModel","ngModelOptions"],outputs:["ngModelChange"],exportAs:["ngModel"]},{type:h.CheckboxControlValueAccessor,selector:"input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]"}],pipes:{abpLocalization:d.LocalizationPipe,date:f.DatePipe}}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:w,decorators:[{type:r.Component,args:[{selector:"abp-chat",templateUrl:"chat.component.html",styles:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "]}]}],ctorParameters:function(){return[{type:D},{type:m.ChatConfigService},{type:d.ConfigStateService},{type:d.HttpWaitService}]},propDecorators:{chatBoxRef:[{type:r.ViewChild,args:["chatBox",{static:!1}]}],chatContactsComponent:[{type:r.ViewChild,args:[I,{static:!1}]}]}});var O=[{path:"",component:t.RouterOutletComponent,canActivate:[t.AuthGuard,t.PermissionGuard],children:[{path:"",component:t.ReplaceableRouteContainerComponent,data:{requiredPolicy:"Chat.Messaging",replaceableComponent:{defaultComponent:w,key:"Chat.ChatComponent"}}}]}],N=function(){};N.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:N,deps:[],target:g.ɵɵFactoryTarget.NgModule}),N.ɵmod=g.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:N,imports:[u.RouterModule],exports:[a.RouterModule]}),N.ɵinj=g.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:N,imports:[[a.RouterModule.forChild(O)],a.RouterModule]}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:N,decorators:[{type:r.NgModule,args:[{imports:[a.RouterModule.forChild(O)],exports:[a.RouterModule]}]}]});var j=[w,I,M],B=function(){function e(){}return e.forChild=function(){return{ngModule:e,providers:[]}},e.forLazy=function(){return new t.LazyModuleFactory(e.forChild())},e}();B.ɵfac=g.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:B,deps:[],target:g.ɵɵFactoryTarget.NgModule}),B.ɵmod=g.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:B,declarations:[w,I,M],imports:[t.CoreModule,n.ThemeSharedModule,N],exports:[w,I,M]}),B.ɵinj=g.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:B,imports:[[t.CoreModule,n.ThemeSharedModule,N]]}),g.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:g,type:B,decorators:[{type:r.NgModule,args:[{declarations:j,imports:[t.CoreModule,n.ThemeSharedModule,N],exports:C([],v(j))}]}]}),e.ChatComponent=w,e.ChatContactsComponent=I,e.ChatModule=B,e.ConversationAvatarComponent=M,e.getContactName=S,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +1 @@
1
- import{CoreModule,noop}from"@abp/ng.core";import{NgModule,APP_INITIALIZER}from"@angular/core";import{ChatIconComponent}from"./components/chat-icon.component";import{CHAT_NAV_ITEM_PROVIDERS}from"./providers/nav-item.provider";import{CHAT_ROUTE_PROVIDERS}from"./providers/route.provider";import{ChatConfigService}from"./services/chat-config.service";import{OAuthService}from"angular-oauth2-oidc";import*as i0 from"@angular/core";export class ChatConfigModule{static forRoot(){return{ngModule:ChatConfigModule,providers:[CHAT_ROUTE_PROVIDERS,CHAT_NAV_ITEM_PROVIDERS,{provide:APP_INITIALIZER,deps:[ChatConfigService,OAuthService],multi:!0,useFactory:noop}]}}}ChatConfigModule.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigModule,deps:[],target:i0.ɵɵFactoryTarget.NgModule}),ChatConfigModule.ɵmod=i0.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigModule,declarations:[ChatIconComponent],imports:[CoreModule]}),ChatConfigModule.ɵinj=i0.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigModule,imports:[[CoreModule]]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigModule,decorators:[{type:NgModule,args:[{imports:[CoreModule],declarations:[ChatIconComponent],entryComponents:[ChatIconComponent]}]}]});
1
+ import{CoreModule,noop}from"@abp/ng.core";import{NgModule,APP_INITIALIZER}from"@angular/core";import{ChatIconComponent}from"./components/chat-icon.component";import{CHAT_NAV_ITEM_PROVIDERS}from"./providers/nav-item.provider";import{CHAT_ROUTE_PROVIDERS}from"./providers/route.provider";import{ChatConfigService}from"./services/chat-config.service";import{OAuthService}from"angular-oauth2-oidc";import*as i0 from"@angular/core";export class ChatConfigModule{static forRoot(){return{ngModule:ChatConfigModule,providers:[CHAT_ROUTE_PROVIDERS,CHAT_NAV_ITEM_PROVIDERS,{provide:APP_INITIALIZER,deps:[ChatConfigService,OAuthService],multi:!0,useFactory:noop}]}}}ChatConfigModule.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigModule,deps:[],target:i0.ɵɵFactoryTarget.NgModule}),ChatConfigModule.ɵmod=i0.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigModule,declarations:[ChatIconComponent],imports:[CoreModule]}),ChatConfigModule.ɵinj=i0.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigModule,imports:[[CoreModule]]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigModule,decorators:[{type:NgModule,args:[{imports:[CoreModule],declarations:[ChatIconComponent],entryComponents:[ChatIconComponent]}]}]});
@@ -1 +1 @@
1
- import{ToasterService}from"@abp/ng.theme.shared";import{Component}from"@angular/core";import{NavigationEnd,Router}from"@angular/router";import{Subscription}from"rxjs";import{filter}from"rxjs/operators";import{ChatConfigService}from"../services/chat-config.service";import*as i0 from"@angular/core";import*as i1 from"../services/chat-config.service";import*as i2 from"@abp/ng.theme.shared";import*as i3 from"@angular/router";import*as i4 from"@angular/common";export class ChatIconComponent{constructor(e,t,n){this.chatConfigService=e,this.toaster=t,this.router=n,this.subscription=new Subscription,this.listenToMessages(),this.listenToRouterEvents()}listenToMessages(){this.subscription.add(this.chatConfigService.message$.pipe(filter(()=>"/chat"!==this.router.url)).subscribe(e=>{const{senderName:t,senderSurname:n,senderUsername:r,text:i}=e,o=`<strong>${""+(t?t+(" "+n||""):r)}</strong>: ${i.length>50?i.substring(0,49)+"...":i}`;this.chatConfigService.unreadMessagesCount++,this.toaster.info(o,"Chat::NewChatMessage",{tapToDismiss:!0})}))}listenToRouterEvents(){this.subscription.add(this.router.events.pipe(filter(e=>e instanceof NavigationEnd&&"/chat"===e.url)).subscribe(()=>this.chatConfigService.unreadMessagesCount=0))}ngOnDestroy(){this.subscription.unsubscribe()}}ChatIconComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatIconComponent,deps:[{token:i1.ChatConfigService},{token:i2.ToasterService},{token:i3.Router}],target:i0.ɵɵFactoryTarget.Component}),ChatIconComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:ChatIconComponent,selector:"abp-chat-icon",ngImport:i0,template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',isInline:!0,styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "],directives:[{type:i3.RouterLinkWithHref,selector:"a[routerLink],area[routerLink]",inputs:["routerLink","target","queryParams","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state","relativeTo"]},{type:i4.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatIconComponent,decorators:[{type:Component,args:[{selector:"abp-chat-icon",template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "]}]}],ctorParameters:function(){return[{type:i1.ChatConfigService},{type:i2.ToasterService},{type:i3.Router}]}});
1
+ import{ToasterService}from"@abp/ng.theme.shared";import{Component}from"@angular/core";import{NavigationEnd,Router}from"@angular/router";import{Subscription}from"rxjs";import{filter}from"rxjs/operators";import{ChatConfigService}from"../services/chat-config.service";import*as i0 from"@angular/core";import*as i1 from"../services/chat-config.service";import*as i2 from"@abp/ng.theme.shared";import*as i3 from"@angular/router";import*as i4 from"@angular/common";export class ChatIconComponent{constructor(e,t,n){this.chatConfigService=e,this.toaster=t,this.router=n,this.subscription=new Subscription,this.listenToMessages(),this.listenToRouterEvents()}listenToMessages(){this.subscription.add(this.chatConfigService.message$.pipe(filter(()=>"/chat"!==this.router.url)).subscribe(e=>{const{senderName:t,senderSurname:n,senderUsername:r,text:i}=e,o=`<strong>${""+(t?t+(" "+n||""):r)}</strong>: ${i.length>50?i.substring(0,49)+"...":i}`;this.chatConfigService.unreadMessagesCount++,this.toaster.info(o,"Chat::NewChatMessage",{tapToDismiss:!0})}))}listenToRouterEvents(){this.subscription.add(this.router.events.pipe(filter(e=>e instanceof NavigationEnd&&"/chat"===e.url)).subscribe(()=>this.chatConfigService.unreadMessagesCount=0))}ngOnDestroy(){this.subscription.unsubscribe()}}ChatIconComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatIconComponent,deps:[{token:i1.ChatConfigService},{token:i2.ToasterService},{token:i3.Router}],target:i0.ɵɵFactoryTarget.Component}),ChatIconComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:ChatIconComponent,selector:"abp-chat-icon",ngImport:i0,template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',isInline:!0,styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "],directives:[{type:i3.RouterLinkWithHref,selector:"a[routerLink],area[routerLink]",inputs:["routerLink","target","queryParams","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state","relativeTo"]},{type:i4.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatIconComponent,decorators:[{type:Component,args:[{selector:"abp-chat-icon",template:'<div class="position-relative">\n <a routerLink="/chat"\n ><i class="fas fa-envelope fa-lg"></i>\n <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{\n chatConfigService.unreadMessagesCount\n }}</span></a\n >\n </div>',styles:["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "]}]}],ctorParameters:function(){return[{type:i1.ChatConfigService},{type:i2.ToasterService},{type:i3.Router}]}});
@@ -1 +1 @@
1
- import{ConfigStateService,EnvironmentService,PermissionService,RestService}from"@abp/ng.core";import{NavItemsService}from"@abp/ng.theme.shared";import{Injectable}from"@angular/core";import{Router}from"@angular/router";import*as signalR from"@microsoft/signalr";import{OAuthService}from"angular-oauth2-oidc";import{Subject}from"rxjs";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";import*as i2 from"@angular/router";import*as i3 from"angular-oauth2-oidc";import*as i4 from"@abp/ng.theme.shared";const permission="Chat.Messaging";export class ChatConfigService{constructor(e,t,i,n,r,o,s){this.restService=e,this.router=t,this.oAuthService=i,this.navItems=n,this.permissionService=r,this.configState=o,this.environmentService=s,this.apiName="Chat",this.message$=new Subject,this.unreadMessagesCount=0,this.handleMessage=e=>{this.message$.next(e)},this.listenToAppConfig()}get isChatEnabled(){return"false"!==(this.configState.getFeature("Chat.Enable")||"").toLowerCase()}get signalRUrl(){var e,t;const{apis:i}=this.environmentService.getEnvironment();return(null===(e=i[this.apiName])||void 0===e?void 0:e.signalRUrl)||(null===(t=i[this.apiName])||void 0===t?void 0:t.url)||i.default.url}listenToAppConfig(){this.configState.createOnUpdateStream(e=>e).subscribe(()=>{const e=this.configState.getOne("currentUser");this.isChatEnabled?e.isAuthenticated&&this.permissionService.getGrantedPolicy(permission)?(this.initSignalR(e),this.setTotalUnreadMessageCount()):this.connection&&this.connection.stop():this.toggleChat()})}toggleChat(){!this.isChatEnabled&&this.connection&&this.connection.stop(),this.navItems.patchItem("Chat.ChatIconComponent",{visible:()=>this.isChatEnabled})}initSignalR(e){this.conectedUserId!==e.id&&(this.connection&&this.connection.stop(),this.connection=(new signalR.HubConnectionBuilder).withUrl(this.signalRUrl+"/signalr-hubs/chat",{accessTokenFactory:()=>this.oAuthService.getAccessToken()}).build(),this.connection.on("ReceiveMessage",this.handleMessage),this.connection.start().then(()=>{this.conectedUserId=e.id}).catch(e=>console.error(e.toString())))}setTotalUnreadMessageCount(){"/chat"!==this.router.url&&this.restService.request({url:"/api/chat/contact/total-unread-message-count",method:"GET"},{apiName:this.apiName}).subscribe(e=>this.unreadMessagesCount=e)}}ChatConfigService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigService,deps:[{token:i1.RestService},{token:i2.Router},{token:i3.OAuthService},{token:i4.NavItemsService},{token:i1.PermissionService},{token:i1.ConfigStateService},{token:i1.EnvironmentService}],target:i0.ɵɵFactoryTarget.Injectable}),ChatConfigService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatConfigService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService},{type:i2.Router},{type:i3.OAuthService},{type:i4.NavItemsService},{type:i1.PermissionService},{type:i1.ConfigStateService},{type:i1.EnvironmentService}]}});
1
+ import{ConfigStateService,EnvironmentService,PermissionService,RestService}from"@abp/ng.core";import{NavItemsService}from"@abp/ng.theme.shared";import{Injectable}from"@angular/core";import{Router}from"@angular/router";import*as signalR from"@microsoft/signalr";import{OAuthService}from"angular-oauth2-oidc";import{Subject}from"rxjs";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";import*as i2 from"@angular/router";import*as i3 from"angular-oauth2-oidc";import*as i4 from"@abp/ng.theme.shared";const permission="Chat.Messaging";export class ChatConfigService{constructor(e,t,i,n,r,o,s){this.restService=e,this.router=t,this.oAuthService=i,this.navItems=n,this.permissionService=r,this.configState=o,this.environmentService=s,this.apiName="Chat",this.message$=new Subject,this.unreadMessagesCount=0,this.handleMessage=e=>{this.message$.next(e)},this.listenToAppConfig()}get isChatEnabled(){return"false"!==(this.configState.getFeature("Chat.Enable")||"").toLowerCase()}get signalRUrl(){var e,t;const{apis:i}=this.environmentService.getEnvironment();return(null===(e=i[this.apiName])||void 0===e?void 0:e.signalRUrl)||(null===(t=i[this.apiName])||void 0===t?void 0:t.url)||i.default.url}listenToAppConfig(){this.configState.createOnUpdateStream(e=>e).subscribe(()=>{const e=this.configState.getOne("currentUser");this.isChatEnabled?e.isAuthenticated&&this.permissionService.getGrantedPolicy(permission)?(this.initSignalR(e),this.setTotalUnreadMessageCount()):this.connection&&this.connection.stop():this.toggleChat()})}toggleChat(){!this.isChatEnabled&&this.connection&&this.connection.stop(),this.navItems.patchItem("Chat.ChatIconComponent",{visible:()=>this.isChatEnabled})}initSignalR(e){this.conectedUserId!==e.id&&(this.connection&&this.connection.stop(),this.connection=(new signalR.HubConnectionBuilder).withUrl(this.signalRUrl+"/signalr-hubs/chat",{accessTokenFactory:()=>this.oAuthService.getAccessToken()}).build(),this.connection.on("ReceiveMessage",this.handleMessage),this.connection.start().then(()=>{this.conectedUserId=e.id}).catch(e=>console.error(e.toString())))}setTotalUnreadMessageCount(){"/chat"!==this.router.url&&this.restService.request({url:"/api/chat/contact/total-unread-message-count",method:"GET"},{apiName:this.apiName}).subscribe(e=>this.unreadMessagesCount=e)}}ChatConfigService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigService,deps:[{token:i1.RestService},{token:i2.Router},{token:i3.OAuthService},{token:i4.NavItemsService},{token:i1.PermissionService},{token:i1.ConfigStateService},{token:i1.EnvironmentService}],target:i0.ɵɵFactoryTarget.Injectable}),ChatConfigService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatConfigService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService},{type:i2.Router},{type:i3.OAuthService},{type:i4.NavItemsService},{type:i1.PermissionService},{type:i1.ConfigStateService},{type:i1.EnvironmentService}]}});
@@ -1 +1 @@
1
- import{AuthGuard,DynamicLayoutComponent,PermissionGuard,ReplaceableRouteContainerComponent}from"@abp/ng.core";import{NgModule}from"@angular/core";import{RouterModule}from"@angular/router";import{ChatComponent}from"./components/chat.component";import*as i0 from"@angular/core";import*as i1 from"@angular/router";const routes=[{path:"",component:DynamicLayoutComponent,canActivate:[AuthGuard,PermissionGuard],children:[{path:"",component:ReplaceableRouteContainerComponent,data:{requiredPolicy:"Chat.Messaging",replaceableComponent:{defaultComponent:ChatComponent,key:"Chat.ChatComponent"}}}]}];export class ChatRoutingModule{}ChatRoutingModule.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatRoutingModule,deps:[],target:i0.ɵɵFactoryTarget.NgModule}),ChatRoutingModule.ɵmod=i0.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatRoutingModule,imports:[i1.RouterModule],exports:[RouterModule]}),ChatRoutingModule.ɵinj=i0.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatRoutingModule,imports:[[RouterModule.forChild(routes)],RouterModule]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatRoutingModule,decorators:[{type:NgModule,args:[{imports:[RouterModule.forChild(routes)],exports:[RouterModule]}]}]});
1
+ import{AuthGuard,PermissionGuard,ReplaceableRouteContainerComponent,RouterOutletComponent}from"@abp/ng.core";import{NgModule}from"@angular/core";import{RouterModule}from"@angular/router";import{ChatComponent}from"./components/chat.component";import*as i0 from"@angular/core";import*as i1 from"@angular/router";const routes=[{path:"",component:RouterOutletComponent,canActivate:[AuthGuard,PermissionGuard],children:[{path:"",component:ReplaceableRouteContainerComponent,data:{requiredPolicy:"Chat.Messaging",replaceableComponent:{defaultComponent:ChatComponent,key:"Chat.ChatComponent"}}}]}];export class ChatRoutingModule{}ChatRoutingModule.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatRoutingModule,deps:[],target:i0.ɵɵFactoryTarget.NgModule}),ChatRoutingModule.ɵmod=i0.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatRoutingModule,imports:[i1.RouterModule],exports:[RouterModule]}),ChatRoutingModule.ɵinj=i0.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatRoutingModule,imports:[[RouterModule.forChild(routes)],RouterModule]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatRoutingModule,decorators:[{type:NgModule,args:[{imports:[RouterModule.forChild(routes)],exports:[RouterModule]}]}]});
@@ -1 +1 @@
1
- import{CoreModule,LazyModuleFactory}from"@abp/ng.core";import{ThemeSharedModule}from"@abp/ng.theme.shared";import{NgModule}from"@angular/core";import{ChatRoutingModule}from"./chat-routing.module";import{ChatContactsComponent}from"./components/chat-contacts.component";import{ChatComponent}from"./components/chat.component";import{ConversationAvatarComponent}from"./components/conversation-avatar.component";import*as i0 from"@angular/core";const declarations=[ChatComponent,ChatContactsComponent,ConversationAvatarComponent];export class ChatModule{static forChild(){return{ngModule:ChatModule,providers:[]}}static forLazy(){return new LazyModuleFactory(ChatModule.forChild())}}ChatModule.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatModule,deps:[],target:i0.ɵɵFactoryTarget.NgModule}),ChatModule.ɵmod=i0.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatModule,declarations:[ChatComponent,ChatContactsComponent,ConversationAvatarComponent],imports:[CoreModule,ThemeSharedModule,ChatRoutingModule],exports:[ChatComponent,ChatContactsComponent,ConversationAvatarComponent]}),ChatModule.ɵinj=i0.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatModule,imports:[[CoreModule,ThemeSharedModule,ChatRoutingModule]]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatModule,decorators:[{type:NgModule,args:[{declarations:declarations,imports:[CoreModule,ThemeSharedModule,ChatRoutingModule],exports:[...declarations]}]}]});
1
+ import{CoreModule,LazyModuleFactory}from"@abp/ng.core";import{ThemeSharedModule}from"@abp/ng.theme.shared";import{NgModule}from"@angular/core";import{ChatRoutingModule}from"./chat-routing.module";import{ChatContactsComponent}from"./components/chat-contacts.component";import{ChatComponent}from"./components/chat.component";import{ConversationAvatarComponent}from"./components/conversation-avatar.component";import*as i0 from"@angular/core";const declarations=[ChatComponent,ChatContactsComponent,ConversationAvatarComponent];export class ChatModule{static forChild(){return{ngModule:ChatModule,providers:[]}}static forLazy(){return new LazyModuleFactory(ChatModule.forChild())}}ChatModule.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatModule,deps:[],target:i0.ɵɵFactoryTarget.NgModule}),ChatModule.ɵmod=i0.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatModule,declarations:[ChatComponent,ChatContactsComponent,ConversationAvatarComponent],imports:[CoreModule,ThemeSharedModule,ChatRoutingModule],exports:[ChatComponent,ChatContactsComponent,ConversationAvatarComponent]}),ChatModule.ɵinj=i0.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatModule,imports:[[CoreModule,ThemeSharedModule,ChatRoutingModule]]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatModule,decorators:[{type:NgModule,args:[{declarations:declarations,imports:[CoreModule,ThemeSharedModule,ChatRoutingModule],exports:[...declarations]}]}]});
@@ -1 +1 @@
1
- import{SubscriptionService,trackBy}from"@abp/ng.core";import{Component,EventEmitter,Output}from"@angular/core";import{ChatConfigService}from"@volo/abp.ng.chat/config";import{ChatMessageSide}from"../enums/chat-message-side";import{ContactService}from"../services/contact.service";import*as i0 from"@angular/core";import*as i1 from"../services/contact.service";import*as i2 from"@volo/abp.ng.chat/config";import*as i3 from"@abp/ng.core";import*as i4 from"./conversation-avatar.component";import*as i5 from"@angular/forms";import*as i6 from"@angular/common";export class ChatContactsComponent{constructor(t,e,n){this.contactService=t,this.chatConfigService=e,this.subscription=n,this.selected=new EventEmitter,this.allContacts=[],this.selectedContact={},this.filter="",this.getContactName=getContactName,this.trackByUserId=trackBy("userId")}get contacts(){return this.allContacts.filter(t=>t.lastMessage).sort((t,e)=>new Date(t.lastMessageDate).valueOf()>new Date(e.lastMessageDate).valueOf()?-1:1)}get otherContacts(){return this.allContacts.filter(t=>!t.lastMessage)}listenToNewMessages(){this.subscription.addOne(this.chatConfigService.message$,(t={})=>{const e=this.allContacts.findIndex(e=>e.userId===t.senderUserId),n={userId:t.senderUserId,username:t.senderUsername,name:t.senderName,surname:t.senderSurname,lastMessage:t.text,unreadMessageCount:1,lastMessageDate:new Date,lastMessageSide:ChatMessageSide.Receiver};e>-1?this.allContacts[e]=Object.assign(Object.assign({},n),{unreadMessageCount:this.selectedContact.userId===this.allContacts[e].userId?0:this.allContacts[e].unreadMessageCount+1}):this.filter||this.allContacts.push(n)})}ngOnInit(){this.get(()=>{this.selectContact(this.allContacts.length?this.allContacts[0]:{}),this.listenToNewMessages()})}ngOnDestroy(){}get(t){this.contactService.getContactsByInput({includeOtherContacts:!!this.filter,filter:this.filter}).subscribe(e=>{e.length&&(this.allContacts=e,t&&t())})}selectContact(t){this.selectedContact=t,this.selected.emit(t)}changeLastMessageOfSelectedContact(t){this.selectedContact.lastMessage=t,this.selectedContact.lastMessageDate=new Date;const e=this.allContacts.findIndex(t=>t.userId===this.selectedContact.userId);this.allContacts[e]=this.selectedContact}markSelectedContactAsRead(){this.selectedContact.unreadMessageCount=0}}ChatContactsComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatContactsComponent,deps:[{token:i1.ContactService},{token:i2.ChatConfigService},{token:i3.SubscriptionService}],target:i0.ɵɵFactoryTarget.Component}),ChatContactsComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:ChatContactsComponent,selector:"abp-chat-contacts",outputs:{selected:"selected"},providers:[SubscriptionService],ngImport:i0,template:'<div class="border-right">\n <div class="p-3 bg-light border-bottom">\n <div class="form-row">\n <div class="col">\n <input\n id="contacts-filter"\n type="search"\n class="form-control form-control-sm"\n autocomplete="off"\n spellcheck="false"\n [(ngModel)]="filter"\n [placeholder]="\'Chat::SearchInContacts\' | abpLocalization"\n [attr.aria-label]="\'Chat::SearchInContacts\' | abpLocalization"\n (input.debounce)="get()"\n />\n </div>\n </div>\n </div>\n\n <div class="messages-box m-0 p-0">\n <div class="list-group rounded-0" id="contact-list">\n <ng-container\n *ngFor="let contact of contacts; let i = index; trackBy: trackByUserId"\n [ngTemplateOutlet]="contactTemplate"\n [ngTemplateOutletContext]="{ $implicit: contact, index: i }"\n >\n </ng-container>\n <div\n *ngIf="otherContacts.length"\n class="list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-left-0 border-right-0"\n >\n <small>{{ \'Chat::OtherContacts\' | abpLocalization }}</small>\n </div>\n <ng-container\n *ngFor="let contact of otherContacts; let i = index; trackBy: trackByUserId"\n [ngTemplateOutlet]="contactTemplate"\n [ngTemplateOutletContext]="{ $implicit: contact, index: i }"\n >\n </ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #contactTemplate let-contact let-i="index">\n <a\n (click)="selectContact(contact)"\n class="chat-contact list-group-item list-group-item-action px-4 rounded-0 border-left-0 pointer {{\n selectedContact.userId === contact.userId ? \'active text-white\' : \'\'\n }}"\n ><div class="media">\n <abp-conversation-avatar [contact]="contact"></abp-conversation-avatar>\n <div class="media-body ml-2 d-none d-md-block">\n <div class="d-flex align-items-center justify-content-between mb-1">\n <h6 class="mb-0">\n <small *ngIf="contact.unreadMessageCount" class="badge badge-success mr-1">{{\n contact.unreadMessageCount\n }}</small\n >{{ getContactName(contact) }}\n </h6>\n <small class="small font-weight-bold last-message-date">{{\n contact.lastMessageDate | date\n }}</small>\n </div>\n <p class="mb-0 text-small last-message">\n {{\n contact.lastMessage?.length > 24\n ? (contact.lastMessage | slice: 0:23) + \'...\'\n : contact.lastMessage\n }}\n </p>\n </div>\n </div>\n </a>\n</ng-template>\n',styles:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],components:[{type:i4.ConversationAvatarComponent,selector:"abp-conversation-avatar",inputs:["contact","small"]}],directives:[{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]"},{type:i5.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{type:i5.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}}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatContactsComponent,decorators:[{type:Component,args:[{selector:"abp-chat-contacts",templateUrl:"chat-contacts.component.html",styles:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],providers:[SubscriptionService]}]}],ctorParameters:function(){return[{type:i1.ContactService},{type:i2.ChatConfigService},{type:i3.SubscriptionService}]},propDecorators:{selected:[{type:Output}]}});export function getContactName({name:t,surname:e,username:n}){return t||e?`${t||""} ${e||""}`:n}
1
+ import{SubscriptionService,trackBy}from"@abp/ng.core";import{Component,EventEmitter,Output}from"@angular/core";import{ChatConfigService}from"@volo/abp.ng.chat/config";import{ChatMessageSide}from"../enums/chat-message-side";import{ContactService}from"../services/contact.service";import*as i0 from"@angular/core";import*as i1 from"../services/contact.service";import*as i2 from"@volo/abp.ng.chat/config";import*as i3 from"@abp/ng.core";import*as i4 from"./conversation-avatar.component";import*as i5 from"@angular/forms";import*as i6 from"@angular/common";export class ChatContactsComponent{constructor(t,e,n){this.contactService=t,this.chatConfigService=e,this.subscription=n,this.selected=new EventEmitter,this.allContacts=[],this.selectedContact={},this.filter="",this.getContactName=getContactName,this.trackByUserId=trackBy("userId")}get contacts(){return this.allContacts.filter(t=>t.lastMessage).sort((t,e)=>new Date(t.lastMessageDate).valueOf()>new Date(e.lastMessageDate).valueOf()?-1:1)}get otherContacts(){return this.allContacts.filter(t=>!t.lastMessage)}listenToNewMessages(){this.subscription.addOne(this.chatConfigService.message$,(t={})=>{const e=this.allContacts.findIndex(e=>e.userId===t.senderUserId),n={userId:t.senderUserId,username:t.senderUsername,name:t.senderName,surname:t.senderSurname,lastMessage:t.text,unreadMessageCount:1,lastMessageDate:new Date,lastMessageSide:ChatMessageSide.Receiver};e>-1?this.allContacts[e]=Object.assign(Object.assign({},n),{unreadMessageCount:this.selectedContact.userId===this.allContacts[e].userId?0:this.allContacts[e].unreadMessageCount+1}):this.filter||this.allContacts.push(n)})}ngOnInit(){this.get(()=>{this.selectContact(this.allContacts.length?this.allContacts[0]:{}),this.listenToNewMessages()})}ngOnDestroy(){}get(t){this.contactService.getContactsByInput({includeOtherContacts:!!this.filter,filter:this.filter}).subscribe(e=>{e.length&&(this.allContacts=e,t&&t())})}selectContact(t){this.selectedContact=t,this.selected.emit(t)}changeLastMessageOfSelectedContact(t){this.selectedContact.lastMessage=t,this.selectedContact.lastMessageDate=new Date;const e=this.allContacts.findIndex(t=>t.userId===this.selectedContact.userId);this.allContacts[e]=this.selectedContact}markSelectedContactAsRead(){this.selectedContact.unreadMessageCount=0}}ChatContactsComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatContactsComponent,deps:[{token:i1.ContactService},{token:i2.ChatConfigService},{token:i3.SubscriptionService}],target:i0.ɵɵFactoryTarget.Component}),ChatContactsComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",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:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],components:[{type:i4.ConversationAvatarComponent,selector:"abp-conversation-avatar",inputs:["contact","small"]}],directives:[{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]"},{type:i5.NgControlStatus,selector:"[formControlName],[ngModel],[formControl]"},{type:i5.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}}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatContactsComponent,decorators:[{type:Component,args:[{selector:"abp-chat-contacts",templateUrl:"chat-contacts.component.html",styles:["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\n "],providers:[SubscriptionService]}]}],ctorParameters:function(){return[{type:i1.ContactService},{type:i2.ChatConfigService},{type:i3.SubscriptionService}]},propDecorators:{selected:[{type:Output}]}});export function getContactName({name:t,surname:e,username:n}){return t||e?`${t||""} ${e||""}`:n}
@@ -1 +1 @@
1
- import{ConfigStateService,HttpWaitService,trackBy}from"@abp/ng.core";import{Component,ElementRef,ViewChild}from"@angular/core";import{ChatConfigService}from"@volo/abp.ng.chat/config";import{fromEvent,Subject}from"rxjs";import{debounceTime,finalize,takeUntil}from"rxjs/operators";import{ChatMessageSide}from"../enums/chat-message-side";import{ConversationService}from"../services/conversation.service";import{ChatContactsComponent,getContactName}from"./chat-contacts.component";import*as i0 from"@angular/core";import*as i1 from"../services/conversation.service";import*as i2 from"@volo/abp.ng.chat/config";import*as i3 from"@abp/ng.core";import*as i4 from"./chat-contacts.component";import*as i5 from"./conversation-avatar.component";import*as i6 from"@angular/common";import*as i7 from"@angular/forms";const now=new Date,today=new Date(now.getFullYear(),now.getMonth(),now.getDate()).valueOf();export class ChatComponent{constructor(e,t,n,s){this.conversationService=e,this.chatConfigService=t,this.configState=n,this.httpWaitService=s,this.selectedContact={},this.unreadMessageCount=0,this.userMessages=new Map,this.chatMessageSide=ChatMessageSide,this.trackByMessageDate=trackBy("messageDate"),this.destroy$=new Subject,this.onScroll=e=>{this.allMessagesLoaded||this.pagingLoading||!this.selectedContact.lastMessage||this.chatBoxRef.nativeElement.scrollTop>250||this.selectedContactMessages.length%50!=0?e.preventDefault():(this.pagingLoading=!0,this.conversationService.getConversationByInput({skipCount:this.selectedContactMessages.length,maxResultCount:50,targetUserId:this.selectedContact.userId}).pipe(finalize(()=>this.pagingLoading=!1)).subscribe(e=>{e.messages.length?this.userMessages.get(this.selectedContact.userId).unshift(...e.messages.reverse()):this.allMessagesLoaded=!0}))},this.httpWaitService.addFilter([{method:"POST",endpoint:"/api/chat/conversation/send-message"},{method:"GET",endpoint:"/api/chat/contact/contacts"}])}get contactName(){return getContactName(this.selectedContact||{})}get selectedContactMessages(){return this.userMessages.get(this.selectedContact.userId)||[]}listenToChatBoxScroll(){fromEvent(this.chatBoxRef.nativeElement,"scroll").pipe(debounceTime(150),takeUntil(this.destroy$)).subscribe(this.onScroll)}listenToNewMessages(){this.chatConfigService.message$.pipe(takeUntil(this.destroy$)).subscribe(({senderUserId:e,text:t}={})=>{if(!this.userMessages.has(e))return;const n=this.selectedContact.userId===e;this.userMessages.get(e).push({message:t,messageDate:new Date,side:ChatMessageSide.Receiver,isRead:n,readDate:n?new Date:null}),this.scrollToEnd()})}ngAfterViewInit(){this.sendOnEnter="false"!==(this.configState.getSetting("Volo.Chat.Messaging.SendMessageOnEnter")||"").toLowerCase(),this.listenToChatBoxScroll(),this.listenToNewMessages()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getConversation(e){this.allMessagesLoaded=!1,this.conversationService.getConversationByInput({skipCount:0,maxResultCount:50,targetUserId:this.selectedContact.userId}).subscribe(t=>{this.userMessages.set(this.selectedContact.userId,t.messages.reverse()),e&&this.scrollToEnd(),this.selectedContact.unreadMessageCount&&this.markConversationAsRead()})}send(){this.message&&!this.loading&&(this.unreadMessageCount=0,this.loading=!0,this.conversationService.sendMessageByInput({message:this.message,targetUserId:this.selectedContact.userId}).pipe(finalize(()=>this.loading=!1)).subscribe(()=>{this.chatContactsComponent.changeLastMessageOfSelectedContact(this.message),this.userMessages.has(this.selectedContact.userId)||this.userMessages.set(this.selectedContact.userId,[]),this.userMessages.get(this.selectedContact.userId).push({message:this.message,isRead:!0,readDate:now,messageDate:now,side:ChatMessageSide.Sender}),this.message="",this.scrollToEnd()}))}markConversationAsRead(){this.conversationService.markConversationAsReadByInput({targetUserId:this.selectedContact.userId}).subscribe(()=>{this.chatContactsComponent.markSelectedContactAsRead(),this.selectedContact.unreadMessageCount=0,setTimeout(()=>this.unreadMessageCount=0,5e3)})}sendWithEnter(e){this.sendOnEnter&&(e.preventDefault(),this.send())}onSelectContact(e){this.selectedContact=e,this.unreadMessageCount=e.unreadMessageCount,this.scrollToEnd(),!this.userMessages.has(e.userId)&&e.lastMessage?this.getConversation(!0):e.unreadMessageCount&&this.markConversationAsRead()}getDateFormat(e){e=new Date(e);return new Date(e.getFullYear(),e.getMonth(),e.getDate()).valueOf()===today?"shortTime":"short"}scrollToEnd(){setTimeout(()=>{const{offsetTop:e}=document.querySelector(".unread-message-count-badge-wrapper")||{};this.chatBoxRef.nativeElement.scrollTo({top:e?e-60:this.chatBoxRef.nativeElement.scrollHeight})},0)}}ChatComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatComponent,deps:[{token:i1.ConversationService},{token:i2.ChatConfigService},{token:i3.ConfigStateService},{token:i3.HttpWaitService}],target:i0.ɵɵFactoryTarget.Component}),ChatComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:ChatComponent,selector:"abp-chat",viewQueries:[{propertyName:"chatBoxRef",first:!0,predicate:["chatBox"],descendants:!0},{propertyName:"chatContactsComponent",first:!0,predicate:ChatContactsComponent,descendants:!0}],ngImport:i0,template:'<div class="row entry-row">\n <div class="col-auto"></div>\n <div class="col-lg-auto pl-lg-0"></div>\n <div class="col">\n <div class="text-lg-right pt-2" id="AbpContentToolbar"></div>\n </div>\n</div>\n\n<div id="chat_wrapper">\n <div class="container-fluid">\n <div class="row rounded-lg overflow-hidden shadow bor der">\n <div class="col-3 col-md-5 col-lg-4 px-0">\n <abp-chat-contacts (selected)="onSelectContact($event)"></abp-chat-contacts>\n </div>\n\n \x3c!-- Chat Box--\x3e\n <div class="col-9 col-md-7 col-lg-8 px-0">\n <div class="p-3 bg-light border-bottom">\n <div class="form-row">\n <div class="col">\n <div class="form-row">\n <div class="col-auto">\n <abp-conversation-avatar\n small\n [contact]="selectedContact"\n ></abp-conversation-avatar>\n </div>\n <div class="col pt-1" style="line-height: 1.2;">\n <strong id="conversation-title" class="font-weight-bold">{{ contactName }}</strong\n ><br />\n <small id="conversation-info"></small>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div #chatBox id="chat-conversation-wrapper" class="chat-box m-0 p-0">\n <div class="chat-box-container p-4" [id]="\'chat-conversation\'">\n <ng-container\n *ngFor="\n let message of selectedContactMessages;\n let i = index;\n trackBy: trackByMessageDate\n "\n >\n <div\n *ngIf="selectedContactMessages.length - unreadMessageCount === i"\n class="row justify-content-center unread-message-count-badge-wrapper"\n >\n <h3>\n <span class="badge badge-info">\n <ng-container *ngIf="unreadMessageCount === 1; else moreThanOne">\n {{ \'Chat::YouHaveAnUnreadMessage\' | abpLocalization }}\n </ng-container>\n\n <ng-template #moreThanOne>\n {{\n \'Chat::YouHave{0}UnreadMessages\' | abpLocalization: \'\' + unreadMessageCount\n }}\n </ng-template>\n </span>\n </h3>\n </div>\n\n <div\n *ngIf="{ isSender: message.side === chatMessageSide.Sender } as data"\n class="media w-75 mw-65 w-lp-auto mb-2"\n [class.ml-auto]="data.isSender"\n >\n <div class="media-body position-relative">\n <div\n class="shadow rounded py-3 px-4 mb-1 {{\n data.isSender ? \'bg-primary\' : \'bg-light\'\n }}"\n >\n <p\n class="text-small mb-0 {{ data.isSender ? \'text-white\' : \'text-muted\' }}"\n [innerHTML]="message.message"\n ></p>\n </div>\n <p\n class="message-date small text-muted m-0 {{ data.isSender ? \'left\' : \'right\' }}"\n >\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\n </p>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n\n \x3c!-- Typing area --\x3e\n <div *ngIf="selectedContact?.userId" id="send-message-form" class="bg-light border-top m-0">\n <div class="p-3">\n <textarea\n id="chat-message-box"\n name="message"\n type="text"\n [placeholder]="\'Chat::TypeMessage\' | abpLocalization"\n class="form-control rounded py-2 bg-white"\n [(ngModel)]="message"\n (keydown.enter)="sendWithEnter($event)"\n ></textarea>\n <div class="custom-control custom-checkbox float-left mt-3">\n <input\n type="checkbox"\n class="custom-control-input"\n id="send-on-enter"\n [(ngModel)]="sendOnEnter"\n />\n <label class="custom-control-label" for="send-on-enter">{{\n \'Chat::SendOnEnter\' | abpLocalization\n }}</label>\n </div>\n <div class="mt-2 text-right">\n <button\n [disabled]="!message"\n (click)="send()"\n id="send-message-button"\n type="button"\n class="btn btn-primary px-3"\n >\n {{ \'Chat::Send\' | abpLocalization }}\n <i *ngIf="!loading; else loadingIcon" class="fa fa-paper-plane ml-2"></i>\n\n <ng-template #loadingIcon>\n <i class="fas fa-spinner fa-spin ml-2"></i>\n </ng-template>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n',styles:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "],components:[{type:i4.ChatContactsComponent,selector:"abp-chat-contacts",outputs:["selected"]},{type:i5.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}}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ChatComponent,decorators:[{type:Component,args:[{selector:"abp-chat",templateUrl:"chat.component.html",styles:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "]}]}],ctorParameters:function(){return[{type:i1.ConversationService},{type:i2.ChatConfigService},{type:i3.ConfigStateService},{type:i3.HttpWaitService}]},propDecorators:{chatBoxRef:[{type:ViewChild,args:["chatBox",{static:!1}]}],chatContactsComponent:[{type:ViewChild,args:[ChatContactsComponent,{static:!1}]}]}});
1
+ import{ConfigStateService,HttpWaitService,trackBy}from"@abp/ng.core";import{Component,ElementRef,ViewChild}from"@angular/core";import{ChatConfigService}from"@volo/abp.ng.chat/config";import{fromEvent,Subject}from"rxjs";import{debounceTime,finalize,takeUntil}from"rxjs/operators";import{ChatMessageSide}from"../enums/chat-message-side";import{ConversationService}from"../services/conversation.service";import{ChatContactsComponent,getContactName}from"./chat-contacts.component";import*as i0 from"@angular/core";import*as i1 from"../services/conversation.service";import*as i2 from"@volo/abp.ng.chat/config";import*as i3 from"@abp/ng.core";import*as i4 from"./chat-contacts.component";import*as i5 from"./conversation-avatar.component";import*as i6 from"@angular/common";import*as i7 from"@angular/forms";const now=new Date,today=new Date(now.getFullYear(),now.getMonth(),now.getDate()).valueOf();export class ChatComponent{constructor(e,t,n,s){this.conversationService=e,this.chatConfigService=t,this.configState=n,this.httpWaitService=s,this.selectedContact={},this.unreadMessageCount=0,this.userMessages=new Map,this.chatMessageSide=ChatMessageSide,this.trackByMessageDate=trackBy("messageDate"),this.destroy$=new Subject,this.onScroll=e=>{this.allMessagesLoaded||this.pagingLoading||!this.selectedContact.lastMessage||this.chatBoxRef.nativeElement.scrollTop>250||this.selectedContactMessages.length%50!=0?e.preventDefault():(this.pagingLoading=!0,this.conversationService.getConversationByInput({skipCount:this.selectedContactMessages.length,maxResultCount:50,targetUserId:this.selectedContact.userId}).pipe(finalize(()=>this.pagingLoading=!1)).subscribe(e=>{e.messages.length?this.userMessages.get(this.selectedContact.userId).unshift(...e.messages.reverse()):this.allMessagesLoaded=!0}))},this.httpWaitService.addFilter([{method:"POST",endpoint:"/api/chat/conversation/send-message"},{method:"GET",endpoint:"/api/chat/contact/contacts"}])}get contactName(){return getContactName(this.selectedContact||{})}get selectedContactMessages(){return this.userMessages.get(this.selectedContact.userId)||[]}listenToChatBoxScroll(){fromEvent(this.chatBoxRef.nativeElement,"scroll").pipe(debounceTime(150),takeUntil(this.destroy$)).subscribe(this.onScroll)}listenToNewMessages(){this.chatConfigService.message$.pipe(takeUntil(this.destroy$)).subscribe(({senderUserId:e,text:t}={})=>{if(!this.userMessages.has(e))return;const n=this.selectedContact.userId===e;this.userMessages.get(e).push({message:t,messageDate:new Date,side:ChatMessageSide.Receiver,isRead:n,readDate:n?new Date:null}),this.scrollToEnd()})}ngAfterViewInit(){this.sendOnEnter="false"!==(this.configState.getSetting("Volo.Chat.Messaging.SendMessageOnEnter")||"").toLowerCase(),this.listenToChatBoxScroll(),this.listenToNewMessages()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}getConversation(e){this.allMessagesLoaded=!1,this.conversationService.getConversationByInput({skipCount:0,maxResultCount:50,targetUserId:this.selectedContact.userId}).subscribe(t=>{this.userMessages.set(this.selectedContact.userId,t.messages.reverse()),e&&this.scrollToEnd(),this.selectedContact.unreadMessageCount&&this.markConversationAsRead()})}send(){this.message&&!this.loading&&(this.unreadMessageCount=0,this.loading=!0,this.conversationService.sendMessageByInput({message:this.message,targetUserId:this.selectedContact.userId}).pipe(finalize(()=>this.loading=!1)).subscribe(()=>{this.chatContactsComponent.changeLastMessageOfSelectedContact(this.message),this.userMessages.has(this.selectedContact.userId)||this.userMessages.set(this.selectedContact.userId,[]),this.userMessages.get(this.selectedContact.userId).push({message:this.message,isRead:!0,readDate:now,messageDate:now,side:ChatMessageSide.Sender}),this.message="",this.scrollToEnd()}))}markConversationAsRead(){this.conversationService.markConversationAsReadByInput({targetUserId:this.selectedContact.userId}).subscribe(()=>{this.chatContactsComponent.markSelectedContactAsRead(),this.selectedContact.unreadMessageCount=0,setTimeout(()=>this.unreadMessageCount=0,5e3)})}sendWithEnter(e){this.sendOnEnter&&(e.preventDefault(),this.send())}onSelectContact(e){this.selectedContact=e,this.unreadMessageCount=e.unreadMessageCount,this.scrollToEnd(),!this.userMessages.has(e.userId)&&e.lastMessage?this.getConversation(!0):e.unreadMessageCount&&this.markConversationAsRead()}getDateFormat(e){e=new Date(e);return new Date(e.getFullYear(),e.getMonth(),e.getDate()).valueOf()===today?"shortTime":"short"}scrollToEnd(){setTimeout(()=>{const{offsetTop:e}=document.querySelector(".unread-message-count-badge-wrapper")||{};this.chatBoxRef.nativeElement.scrollTo({top:e?e-60:this.chatBoxRef.nativeElement.scrollHeight})},0)}}ChatComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatComponent,deps:[{token:i1.ConversationService},{token:i2.ChatConfigService},{token:i3.ConfigStateService},{token:i3.HttpWaitService}],target:i0.ɵɵFactoryTarget.Component}),ChatComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:ChatComponent,selector:"abp-chat",viewQueries:[{propertyName:"chatBoxRef",first:!0,predicate:["chatBox"],descendants:!0},{propertyName:"chatContactsComponent",first:!0,predicate:ChatContactsComponent,descendants:!0}],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 \x3c!-- Chat Box--\x3e\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 \x3c!-- Typing area --\x3e\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:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "],components:[{type:i4.ChatContactsComponent,selector:"abp-chat-contacts",outputs:["selected"]},{type:i5.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}}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ChatComponent,decorators:[{type:Component,args:[{selector:"abp-chat",templateUrl:"chat.component.html",styles:["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\n "]}]}],ctorParameters:function(){return[{type:i1.ConversationService},{type:i2.ChatConfigService},{type:i3.ConfigStateService},{type:i3.HttpWaitService}]},propDecorators:{chatBoxRef:[{type:ViewChild,args:["chatBox",{static:!1}]}],chatContactsComponent:[{type:ViewChild,args:[ChatContactsComponent,{static:!1}]}]}});
@@ -1 +1 @@
1
- import{Component,Input}from"@angular/core";import{ChatContactDto}from"../models/chat-contact-dto";import*as i0 from"@angular/core";import*as i1 from"@angular/common";const avatarStyles=[{color:"#ffffff",backgroundColor:"#3cb160"},{color:"#ffffff",backgroundColor:"#c373cc"},{color:"#ffffff",backgroundColor:"#2b78b3"},{color:"#ffffff",backgroundColor:"#6ac79a"},{color:"#ffffff",backgroundColor:"#aeb140"},{color:"#ffffff",backgroundColor:"#b773c0"},{color:"#ffffff",backgroundColor:"#e16d7a"},{color:"#ffffff",backgroundColor:"#ffac2a"},{color:"#ffffff",backgroundColor:"#21bbc7"},{color:"#ffffff",backgroundColor:"#59ab95"}];export class ConversationAvatarComponent{get avatarText(){if(this.contact&&this.contact.username)return this.contact.name&&this.contact.surname?this.contact.name[0]+this.contact.surname[0]:this.contact.name?this.contact.name.slice(0,2):this.contact.username.slice(0,2)}get avatarBgStyle(){if(!this.contact||!this.contact.username)return;let t=0;for(let n=0;n<this.contact.username.length;n++)t=this.contact.username.charCodeAt(n)+((t<<5)-t);return avatarStyles[Math.abs(t%10)]}get isSmall(){return"string"==typeof this.small||this.small}}ConversationAvatarComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationAvatarComponent,deps:[],target:i0.ɵɵFactoryTarget.Component}),ConversationAvatarComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.9",type:ConversationAvatarComponent,selector:"abp-conversation-avatar",inputs:{contact:"contact",small:"small"},ngImport:i0,template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',isInline:!0,styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "],directives:[{type:i1.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationAvatarComponent,decorators:[{type:Component,args:[{selector:"abp-conversation-avatar",template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "]}]}],propDecorators:{contact:[{type:Input}],small:[{type:Input}]}});
1
+ import{Component,Input}from"@angular/core";import{ChatContactDto}from"../models/chat-contact-dto";import*as i0 from"@angular/core";import*as i1 from"@angular/common";const avatarStyles=[{color:"#ffffff",backgroundColor:"#3cb160"},{color:"#ffffff",backgroundColor:"#c373cc"},{color:"#ffffff",backgroundColor:"#2b78b3"},{color:"#ffffff",backgroundColor:"#6ac79a"},{color:"#ffffff",backgroundColor:"#aeb140"},{color:"#ffffff",backgroundColor:"#b773c0"},{color:"#ffffff",backgroundColor:"#e16d7a"},{color:"#ffffff",backgroundColor:"#ffac2a"},{color:"#ffffff",backgroundColor:"#21bbc7"},{color:"#ffffff",backgroundColor:"#59ab95"}];export class ConversationAvatarComponent{get avatarText(){if(this.contact&&this.contact.username)return this.contact.name&&this.contact.surname?this.contact.name[0]+this.contact.surname[0]:this.contact.name?this.contact.name.slice(0,2):this.contact.username.slice(0,2)}get avatarBgStyle(){if(!this.contact||!this.contact.username)return;let t=0;for(let n=0;n<this.contact.username.length;n++)t=this.contact.username.charCodeAt(n)+((t<<5)-t);return avatarStyles[Math.abs(t%10)]}get isSmall(){return"string"==typeof this.small||this.small}}ConversationAvatarComponent.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationAvatarComponent,deps:[],target:i0.ɵɵFactoryTarget.Component}),ConversationAvatarComponent.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.0",type:ConversationAvatarComponent,selector:"abp-conversation-avatar",inputs:{contact:"contact",small:"small"},ngImport:i0,template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',isInline:!0,styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "],directives:[{type:i1.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationAvatarComponent,decorators:[{type:Component,args:[{selector:"abp-conversation-avatar",template:'<div\n class="avatar mx-auto rounded-circle"\n [class.small]="isSmall"\n [ngStyle]="avatarBgStyle"\n >\n {{ avatarText }}\n </div>',styles:["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "]}]}],propDecorators:{contact:[{type:Input}],small:[{type:Input}]}});
@@ -1 +1 @@
1
- import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ContactService{constructor(e){this.restService=e,this.apiName="Chat"}getContactsByInput(e={}){return this.restService.request({url:"/api/chat/contact/contacts",method:"GET",params:e},{apiName:this.apiName})}}ContactService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ContactService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ContactService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ContactService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ContactService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
1
+ import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ContactService{constructor(e){this.restService=e,this.apiName="Chat"}getContactsByInput(e={}){return this.restService.request({url:"/api/chat/contact/contacts",method:"GET",params:e},{apiName:this.apiName})}}ContactService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ContactService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ContactService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ContactService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ContactService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
@@ -1 +1 @@
1
- import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ConversationService{constructor(e){this.restService=e,this.apiName="Chat"}sendMessageByInput(e){return this.restService.request({url:"/api/chat/conversation/send-message",method:"POST",body:e},{apiName:this.apiName})}getConversationByInput(e={}){return this.restService.request({url:"/api/chat/conversation/conversation",method:"GET",params:e},{apiName:this.apiName})}markConversationAsReadByInput(e){return this.restService.request({url:"/api/chat/conversation/mark-conversation-as-read",method:"POST",body:e},{apiName:this.apiName})}}ConversationService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ConversationService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
1
+ import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ConversationService{constructor(e){this.restService=e,this.apiName="Chat"}sendMessageByInput(e){return this.restService.request({url:"/api/chat/conversation/send-message",method:"POST",body:e},{apiName:this.apiName})}getConversationByInput(e={}){return this.restService.request({url:"/api/chat/conversation/conversation",method:"GET",params:e},{apiName:this.apiName})}markConversationAsReadByInput(e){return this.restService.request({url:"/api/chat/conversation/mark-conversation-as-read",method:"POST",body:e},{apiName:this.apiName})}}ConversationService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ConversationService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
@@ -1 +1 @@
1
- import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ConversationService{constructor(e){this.restService=e,this.apiName="Chat",this.getConversation=e=>this.restService.request({method:"GET",url:"/api/chat/conversation/conversation",params:{targetUserId:e.targetUserId,skipCount:e.skipCount,maxResultCount:e.maxResultCount}},{apiName:this.apiName}),this.markConversationAsRead=e=>this.restService.request({method:"POST",url:"/api/chat/conversation/mark-conversation-as-read",body:e},{apiName:this.apiName}),this.sendMessage=e=>this.restService.request({method:"POST",url:"/api/chat/conversation/send-message",body:e},{apiName:this.apiName})}}ConversationService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ConversationService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ConversationService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
1
+ import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ConversationService{constructor(e){this.restService=e,this.apiName="Chat",this.getConversation=e=>this.restService.request({method:"GET",url:"/api/chat/conversation/conversation",params:{targetUserId:e.targetUserId,skipCount:e.skipCount,maxResultCount:e.maxResultCount}},{apiName:this.apiName}),this.markConversationAsRead=e=>this.restService.request({method:"POST",url:"/api/chat/conversation/mark-conversation-as-read",body:e},{apiName:this.apiName}),this.sendMessage=e=>this.restService.request({method:"POST",url:"/api/chat/conversation/send-message",body:e},{apiName:this.apiName})}}ConversationService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ConversationService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ConversationService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
@@ -1 +1 @@
1
- import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class SettingsService{constructor(e){this.restService=e,this.apiName="Chat",this.setSendOnEnterSetting=e=>this.restService.request({method:"POST",url:"/api/chat/settings/send-on-enter",body:e},{apiName:this.apiName})}}SettingsService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:SettingsService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),SettingsService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:SettingsService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:SettingsService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
1
+ import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class SettingsService{constructor(e){this.restService=e,this.apiName="Chat",this.setSendOnEnterSetting=e=>this.restService.request({method:"POST",url:"/api/chat/settings/send-on-enter",body:e},{apiName:this.apiName})}}SettingsService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:SettingsService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),SettingsService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:SettingsService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:SettingsService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
@@ -1 +1 @@
1
- import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ContactService{constructor(e){this.restService=e,this.apiName="Chat",this.getContacts=e=>this.restService.request({method:"GET",url:"/api/chat/contact/contacts",params:{filter:e.filter,includeOtherContacts:e.includeOtherContacts}},{apiName:this.apiName}),this.getTotalUnreadMessageCount=()=>this.restService.request({method:"GET",url:"/api/chat/contact/total-unread-message-count"},{apiName:this.apiName})}}ContactService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ContactService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ContactService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ContactService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.9",ngImport:i0,type:ContactService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
1
+ import{RestService}from"@abp/ng.core";import{Injectable}from"@angular/core";import*as i0 from"@angular/core";import*as i1 from"@abp/ng.core";export class ContactService{constructor(e){this.restService=e,this.apiName="Chat",this.getContacts=e=>this.restService.request({method:"GET",url:"/api/chat/contact/contacts",params:{filter:e.filter,includeOtherContacts:e.includeOtherContacts}},{apiName:this.apiName}),this.getTotalUnreadMessageCount=()=>this.restService.request({method:"GET",url:"/api/chat/contact/total-unread-message-count"},{apiName:this.apiName})}}ContactService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ContactService,deps:[{token:i1.RestService}],target:i0.ɵɵFactoryTarget.Injectable}),ContactService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ContactService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.0",ngImport:i0,type:ContactService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.RestService}]}});
@@ -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: "12.2.9", 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: "12.2.9", ngImport: i0, type: ChatConfigService, providedIn: 'root' });
95
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatConfigService, decorators: [{
93
+ ChatConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", 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: "12.2.0", ngImport: i0, type: ChatConfigService, providedIn: 'root' });
95
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatConfigService, decorators: [{
96
96
  type: Injectable,
97
97
  args: [{
98
98
  providedIn: 'root',
@@ -130,38 +130,38 @@ class ChatIconComponent {
130
130
  this.subscription.unsubscribe();
131
131
  }
132
132
  }
133
- ChatIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatIconComponent, deps: [{ token: ChatConfigService }, { token: i4.ToasterService }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
134
- ChatIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", type: ChatIconComponent, selector: "abp-chat-icon", ngImport: i0, template: `<div class="position-relative">
135
- <a routerLink="/chat"
136
- ><i class="fas fa-envelope fa-lg"></i>
137
- <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{
138
- chatConfigService.unreadMessagesCount
139
- }}</span></a
140
- >
133
+ ChatIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatIconComponent, deps: [{ token: ChatConfigService }, { token: i4.ToasterService }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
134
+ ChatIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", type: ChatIconComponent, selector: "abp-chat-icon", ngImport: i0, template: `<div class="position-relative">
135
+ <a routerLink="/chat"
136
+ ><i class="fas fa-envelope fa-lg"></i>
137
+ <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{
138
+ chatConfigService.unreadMessagesCount
139
+ }}</span></a
140
+ >
141
141
  </div>`, isInline: true, styles: ["\n a {\n color: inherit;\n }\n\n .badge {\n position: absolute;\n right: -10px;\n top: -8px;\n }\n "], directives: [{ type: i3.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
142
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatIconComponent, decorators: [{
142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatIconComponent, decorators: [{
143
143
  type: Component,
144
144
  args: [{
145
145
  selector: 'abp-chat-icon',
146
- template: `<div class="position-relative">
147
- <a routerLink="/chat"
148
- ><i class="fas fa-envelope fa-lg"></i>
149
- <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{
150
- chatConfigService.unreadMessagesCount
151
- }}</span></a
152
- >
146
+ template: `<div class="position-relative">
147
+ <a routerLink="/chat"
148
+ ><i class="fas fa-envelope fa-lg"></i>
149
+ <span *ngIf="chatConfigService.unreadMessagesCount" class="badge badge-primary">{{
150
+ chatConfigService.unreadMessagesCount
151
+ }}</span></a
152
+ >
153
153
  </div>`,
154
154
  styles: [
155
- `
156
- a {
157
- color: inherit;
158
- }
159
-
160
- .badge {
161
- position: absolute;
162
- right: -10px;
163
- top: -8px;
164
- }
155
+ `
156
+ a {
157
+ color: inherit;
158
+ }
159
+
160
+ .badge {
161
+ position: absolute;
162
+ right: -10px;
163
+ top: -8px;
164
+ }
165
165
  `,
166
166
  ],
167
167
  }]
@@ -218,10 +218,10 @@ class ChatConfigModule {
218
218
  };
219
219
  }
220
220
  }
221
- ChatConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatConfigModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
222
- ChatConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatConfigModule, declarations: [ChatIconComponent], imports: [CoreModule] });
223
- ChatConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatConfigModule, imports: [[CoreModule]] });
224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatConfigModule, decorators: [{
221
+ ChatConfigModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatConfigModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
222
+ ChatConfigModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatConfigModule, declarations: [ChatIconComponent], imports: [CoreModule] });
223
+ ChatConfigModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatConfigModule, imports: [[CoreModule]] });
224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatConfigModule, decorators: [{
225
225
  type: NgModule,
226
226
  args: [{
227
227
  imports: [CoreModule],
@@ -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: "12.2.9", ngImport: i0, type: ConversationService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
28
- ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationService, providedIn: 'root' });
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationService, decorators: [{
27
+ ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
28
+ ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationService, providedIn: 'root' });
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", 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: "12.2.9", ngImport: i0, type: SettingsService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
55
- SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: SettingsService, providedIn: 'root' });
56
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: SettingsService, decorators: [{
54
+ SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: SettingsService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
55
+ SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: SettingsService, providedIn: 'root' });
56
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", 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: "12.2.9", ngImport: i0, type: ContactService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
79
- ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ContactService, providedIn: 'root' });
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ContactService, decorators: [{
78
+ ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ContactService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
79
+ ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ContactService, providedIn: 'root' });
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ContactService, decorators: [{
81
81
  type: Injectable,
82
82
  args: [{
83
83
  providedIn: 'root',
@@ -1,5 +1,5 @@
1
1
  import * as i3 from '@abp/ng.core';
2
- import { trackBy, SubscriptionService, DynamicLayoutComponent, AuthGuard, PermissionGuard, ReplaceableRouteContainerComponent, LazyModuleFactory, CoreModule } from '@abp/ng.core';
2
+ import { trackBy, SubscriptionService, RouterOutletComponent, AuthGuard, PermissionGuard, ReplaceableRouteContainerComponent, LazyModuleFactory, CoreModule } from '@abp/ng.core';
3
3
  import { ThemeSharedModule } from '@abp/ng.theme.shared';
4
4
  import * as i0 from '@angular/core';
5
5
  import { Injectable, Component, Input, EventEmitter, Output, ViewChild, NgModule } from '@angular/core';
@@ -32,9 +32,9 @@ class ConversationService {
32
32
  return this.restService.request({ url: '/api/chat/conversation/mark-conversation-as-read', method: 'POST', body }, { apiName: this.apiName });
33
33
  }
34
34
  }
35
- ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
36
- ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationService, providedIn: 'root' });
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationService, decorators: [{
35
+ ConversationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
36
+ ConversationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationService, providedIn: 'root' });
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationService, decorators: [{
38
38
  type: Injectable,
39
39
  args: [{ providedIn: 'root' }]
40
40
  }], ctorParameters: function () { return [{ type: i3.RestService }]; } });
@@ -48,9 +48,9 @@ class ContactService {
48
48
  return this.restService.request({ url: '/api/chat/contact/contacts', method: 'GET', params }, { apiName: this.apiName });
49
49
  }
50
50
  }
51
- ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ContactService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
52
- ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ContactService, providedIn: 'root' });
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ContactService, decorators: [{
51
+ ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ContactService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
52
+ ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ContactService, providedIn: 'root' });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ContactService, decorators: [{
54
54
  type: Injectable,
55
55
  args: [{ providedIn: 'root' }]
56
56
  }], ctorParameters: function () { return [{ type: i3.RestService }]; } });
@@ -102,43 +102,43 @@ class ConversationAvatarComponent {
102
102
  return typeof this.small === 'string' || this.small;
103
103
  }
104
104
  }
105
- ConversationAvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
106
- ConversationAvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template: `<div
107
- class="avatar mx-auto rounded-circle"
108
- [class.small]="isSmall"
109
- [ngStyle]="avatarBgStyle"
110
- >
111
- {{ avatarText }}
105
+ ConversationAvatarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationAvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
106
+ ConversationAvatarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", type: ConversationAvatarComponent, selector: "abp-conversation-avatar", inputs: { contact: "contact", small: "small" }, ngImport: i0, template: `<div
107
+ class="avatar mx-auto rounded-circle"
108
+ [class.small]="isSmall"
109
+ [ngStyle]="avatarBgStyle"
110
+ >
111
+ {{ avatarText }}
112
112
  </div>`, isInline: true, styles: ["\n .avatar {\n height: 40px;\n width: 40px;\n line-height: 40px;\n font-size: 16px;\n font-weight: 700;\n text-align: center;\n text-transform: uppercase;\n }\n\n .avatar.small {\n height: 27px;\n width: 27px;\n line-height: 27px;\n font-size: 14px;\n }\n "], directives: [{ type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ConversationAvatarComponent, decorators: [{
114
114
  type: Component,
115
115
  args: [{
116
116
  selector: 'abp-conversation-avatar',
117
- template: `<div
118
- class="avatar mx-auto rounded-circle"
119
- [class.small]="isSmall"
120
- [ngStyle]="avatarBgStyle"
121
- >
122
- {{ avatarText }}
117
+ template: `<div
118
+ class="avatar mx-auto rounded-circle"
119
+ [class.small]="isSmall"
120
+ [ngStyle]="avatarBgStyle"
121
+ >
122
+ {{ avatarText }}
123
123
  </div>`,
124
124
  styles: [
125
- `
126
- .avatar {
127
- height: 40px;
128
- width: 40px;
129
- line-height: 40px;
130
- font-size: 16px;
131
- font-weight: 700;
132
- text-align: center;
133
- text-transform: uppercase;
134
- }
135
-
136
- .avatar.small {
137
- height: 27px;
138
- width: 27px;
139
- line-height: 27px;
140
- font-size: 14px;
141
- }
125
+ `
126
+ .avatar {
127
+ height: 40px;
128
+ width: 40px;
129
+ line-height: 40px;
130
+ font-size: 16px;
131
+ font-weight: 700;
132
+ text-align: center;
133
+ text-transform: uppercase;
134
+ }
135
+
136
+ .avatar.small {
137
+ height: 27px;
138
+ width: 27px;
139
+ line-height: 27px;
140
+ font-size: 14px;
141
+ }
142
142
  `,
143
143
  ],
144
144
  }]
@@ -223,19 +223,19 @@ class ChatContactsComponent {
223
223
  this.selectedContact.unreadMessageCount = 0;
224
224
  }
225
225
  }
226
- ChatContactsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatContactsComponent, deps: [{ token: ContactService }, { token: i2.ChatConfigService }, { token: i3.SubscriptionService }], target: i0.ɵɵFactoryTarget.Component });
227
- ChatContactsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", type: ChatContactsComponent, selector: "abp-chat-contacts", outputs: { selected: "selected" }, providers: [SubscriptionService], ngImport: i0, template: "<div class=\"border-right\">\n <div class=\"p-3 bg-light border-bottom\">\n <div class=\"form-row\">\n <div class=\"col\">\n <input\n id=\"contacts-filter\"\n type=\"search\"\n class=\"form-control form-control-sm\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [(ngModel)]=\"filter\"\n [placeholder]=\"'Chat::SearchInContacts' | abpLocalization\"\n [attr.aria-label]=\"'Chat::SearchInContacts' | abpLocalization\"\n (input.debounce)=\"get()\"\n />\n </div>\n </div>\n </div>\n\n <div class=\"messages-box m-0 p-0\">\n <div class=\"list-group rounded-0\" id=\"contact-list\">\n <ng-container\n *ngFor=\"let contact of contacts; let i = index; trackBy: trackByUserId\"\n [ngTemplateOutlet]=\"contactTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\n >\n </ng-container>\n <div\n *ngIf=\"otherContacts.length\"\n class=\"list-group-item px-2 py-1 bg-light text-muted text-center font-size-sm text-uppercase border-left-0 border-right-0\"\n >\n <small>{{ 'Chat::OtherContacts' | abpLocalization }}</small>\n </div>\n <ng-container\n *ngFor=\"let contact of otherContacts; let i = index; trackBy: trackByUserId\"\n [ngTemplateOutlet]=\"contactTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: contact, index: i }\"\n >\n </ng-container>\n </div>\n </div>\n</div>\n\n<ng-template #contactTemplate let-contact let-i=\"index\">\n <a\n (click)=\"selectContact(contact)\"\n class=\"chat-contact list-group-item list-group-item-action px-4 rounded-0 border-left-0 pointer {{\n selectedContact.userId === contact.userId ? 'active text-white' : ''\n }}\"\n ><div class=\"media\">\n <abp-conversation-avatar [contact]=\"contact\"></abp-conversation-avatar>\n <div class=\"media-body ml-2 d-none d-md-block\">\n <div class=\"d-flex align-items-center justify-content-between mb-1\">\n <h6 class=\"mb-0\">\n <small *ngIf=\"contact.unreadMessageCount\" class=\"badge badge-success mr-1\">{{\n contact.unreadMessageCount\n }}</small\n >{{ getContactName(contact) }}\n </h6>\n <small class=\"small font-weight-bold last-message-date\">{{\n contact.lastMessageDate | date\n }}</small>\n </div>\n <p class=\"mb-0 text-small last-message\">\n {{\n contact.lastMessage?.length > 24\n ? (contact.lastMessage | slice: 0:23) + '...'\n : contact.lastMessage\n }}\n </p>\n </div>\n </div>\n </a>\n</ng-template>\n", styles: ["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\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 } });
228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatContactsComponent, decorators: [{
226
+ ChatContactsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatContactsComponent, deps: [{ token: ContactService }, { token: i2.ChatConfigService }, { token: i3.SubscriptionService }], target: i0.ɵɵFactoryTarget.Component });
227
+ ChatContactsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", 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: ["\n .messages-box {\n overflow-y: scroll;\n max-height: calc(100vh - 254.34px);\n }\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 } });
228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatContactsComponent, decorators: [{
229
229
  type: Component,
230
230
  args: [{
231
231
  selector: 'abp-chat-contacts',
232
232
  templateUrl: 'chat-contacts.component.html',
233
233
  styles: [
234
- `
235
- .messages-box {
236
- overflow-y: scroll;
237
- max-height: calc(100vh - 254.34px);
238
- }
234
+ `
235
+ .messages-box {
236
+ overflow-y: scroll;
237
+ max-height: calc(100vh - 254.34px);
238
+ }
239
239
  `,
240
240
  ],
241
241
  providers: [SubscriptionService],
@@ -420,35 +420,35 @@ class ChatComponent {
420
420
  }, 0);
421
421
  }
422
422
  }
423
- ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatComponent, deps: [{ token: ConversationService }, { token: i2.ChatConfigService }, { token: i3.ConfigStateService }, { token: i3.HttpWaitService }], target: i0.ɵɵFactoryTarget.Component });
424
- ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", 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\">\n <div class=\"col-auto\"></div>\n <div class=\"col-lg-auto pl-lg-0\"></div>\n <div class=\"col\">\n <div class=\"text-lg-right pt-2\" id=\"AbpContentToolbar\"></div>\n </div>\n</div>\n\n<div id=\"chat_wrapper\">\n <div class=\"container-fluid\">\n <div class=\"row rounded-lg overflow-hidden shadow bor der\">\n <div class=\"col-3 col-md-5 col-lg-4 px-0\">\n <abp-chat-contacts (selected)=\"onSelectContact($event)\"></abp-chat-contacts>\n </div>\n\n <!-- Chat Box-->\n <div class=\"col-9 col-md-7 col-lg-8 px-0\">\n <div class=\"p-3 bg-light border-bottom\">\n <div class=\"form-row\">\n <div class=\"col\">\n <div class=\"form-row\">\n <div class=\"col-auto\">\n <abp-conversation-avatar\n small\n [contact]=\"selectedContact\"\n ></abp-conversation-avatar>\n </div>\n <div class=\"col pt-1\" style=\"line-height: 1.2;\">\n <strong id=\"conversation-title\" class=\"font-weight-bold\">{{ contactName }}</strong\n ><br />\n <small id=\"conversation-info\"></small>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div #chatBox id=\"chat-conversation-wrapper\" class=\"chat-box m-0 p-0\">\n <div class=\"chat-box-container p-4\" [id]=\"'chat-conversation'\">\n <ng-container\n *ngFor=\"\n let message of selectedContactMessages;\n let i = index;\n trackBy: trackByMessageDate\n \"\n >\n <div\n *ngIf=\"selectedContactMessages.length - unreadMessageCount === i\"\n class=\"row justify-content-center unread-message-count-badge-wrapper\"\n >\n <h3>\n <span class=\"badge badge-info\">\n <ng-container *ngIf=\"unreadMessageCount === 1; else moreThanOne\">\n {{ 'Chat::YouHaveAnUnreadMessage' | abpLocalization }}\n </ng-container>\n\n <ng-template #moreThanOne>\n {{\n 'Chat::YouHave{0}UnreadMessages' | abpLocalization: '' + unreadMessageCount\n }}\n </ng-template>\n </span>\n </h3>\n </div>\n\n <div\n *ngIf=\"{ isSender: message.side === chatMessageSide.Sender } as data\"\n class=\"media w-75 mw-65 w-lp-auto mb-2\"\n [class.ml-auto]=\"data.isSender\"\n >\n <div class=\"media-body position-relative\">\n <div\n class=\"shadow rounded py-3 px-4 mb-1 {{\n data.isSender ? 'bg-primary' : 'bg-light'\n }}\"\n >\n <p\n class=\"text-small mb-0 {{ data.isSender ? 'text-white' : 'text-muted' }}\"\n [innerHTML]=\"message.message\"\n ></p>\n </div>\n <p\n class=\"message-date small text-muted m-0 {{ data.isSender ? 'left' : 'right' }}\"\n >\n {{ message.messageDate | date: getDateFormat(message.messageDate) }}\n </p>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n\n <!-- Typing area -->\n <div *ngIf=\"selectedContact?.userId\" id=\"send-message-form\" class=\"bg-light border-top m-0\">\n <div class=\"p-3\">\n <textarea\n id=\"chat-message-box\"\n name=\"message\"\n type=\"text\"\n [placeholder]=\"'Chat::TypeMessage' | abpLocalization\"\n class=\"form-control rounded py-2 bg-white\"\n [(ngModel)]=\"message\"\n (keydown.enter)=\"sendWithEnter($event)\"\n ></textarea>\n <div class=\"custom-control custom-checkbox float-left mt-3\">\n <input\n type=\"checkbox\"\n class=\"custom-control-input\"\n id=\"send-on-enter\"\n [(ngModel)]=\"sendOnEnter\"\n />\n <label class=\"custom-control-label\" for=\"send-on-enter\">{{\n 'Chat::SendOnEnter' | abpLocalization\n }}</label>\n </div>\n <div class=\"mt-2 text-right\">\n <button\n [disabled]=\"!message\"\n (click)=\"send()\"\n id=\"send-message-button\"\n type=\"button\"\n class=\"btn btn-primary px-3\"\n >\n {{ 'Chat::Send' | abpLocalization }}\n <i *ngIf=\"!loading; else loadingIcon\" class=\"fa fa-paper-plane ml-2\"></i>\n\n <ng-template #loadingIcon>\n <i class=\"fas fa-spinner fa-spin ml-2\"></i>\n </ng-template>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n", styles: ["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\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 } });
425
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatComponent, decorators: [{
423
+ ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatComponent, deps: [{ token: ConversationService }, { token: i2.ChatConfigService }, { token: i3.ConfigStateService }, { token: i3.HttpWaitService }], target: i0.ɵɵFactoryTarget.Component });
424
+ ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", 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: ["\n .chat-box {\n height: calc(100vh - 390px);\n overflow-y: scroll;\n }\n\n .message-date {\n position: absolute;\n opacity: 0.35;\n width: 100px;\n top: 1px;\n }\n\n .message-date.left {\n left: -110px;\n text-align: right;\n }\n\n .message-date.right {\n right: -110px;\n }\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 } });
425
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatComponent, decorators: [{
426
426
  type: Component,
427
427
  args: [{
428
428
  selector: 'abp-chat',
429
429
  templateUrl: 'chat.component.html',
430
430
  styles: [
431
- `
432
- .chat-box {
433
- height: calc(100vh - 390px);
434
- overflow-y: scroll;
435
- }
436
-
437
- .message-date {
438
- position: absolute;
439
- opacity: 0.35;
440
- width: 100px;
441
- top: 1px;
442
- }
443
-
444
- .message-date.left {
445
- left: -110px;
446
- text-align: right;
447
- }
448
-
449
- .message-date.right {
450
- right: -110px;
451
- }
431
+ `
432
+ .chat-box {
433
+ height: calc(100vh - 390px);
434
+ overflow-y: scroll;
435
+ }
436
+
437
+ .message-date {
438
+ position: absolute;
439
+ opacity: 0.35;
440
+ width: 100px;
441
+ top: 1px;
442
+ }
443
+
444
+ .message-date.left {
445
+ left: -110px;
446
+ text-align: right;
447
+ }
448
+
449
+ .message-date.right {
450
+ right: -110px;
451
+ }
452
452
  `,
453
453
  ],
454
454
  }]
@@ -463,7 +463,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImpor
463
463
  const routes = [
464
464
  {
465
465
  path: '',
466
- component: DynamicLayoutComponent,
466
+ component: RouterOutletComponent,
467
467
  canActivate: [AuthGuard, PermissionGuard],
468
468
  children: [
469
469
  {
@@ -482,10 +482,10 @@ const routes = [
482
482
  ];
483
483
  class ChatRoutingModule {
484
484
  }
485
- ChatRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
486
- ChatRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] });
487
- ChatRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatRoutingModule, imports: [[RouterModule.forChild(routes)], RouterModule] });
488
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatRoutingModule, decorators: [{
485
+ ChatRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
486
+ ChatRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] });
487
+ ChatRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatRoutingModule, imports: [[RouterModule.forChild(routes)], RouterModule] });
488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatRoutingModule, decorators: [{
489
489
  type: NgModule,
490
490
  args: [{
491
491
  imports: [RouterModule.forChild(routes)],
@@ -505,10 +505,10 @@ class ChatModule {
505
505
  return new LazyModuleFactory(ChatModule.forChild());
506
506
  }
507
507
  }
508
- ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
509
- ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatModule, declarations: [ChatComponent, ChatContactsComponent, ConversationAvatarComponent], imports: [CoreModule, ThemeSharedModule, ChatRoutingModule], exports: [ChatComponent, ChatContactsComponent, ConversationAvatarComponent] });
510
- ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatModule, imports: [[CoreModule, ThemeSharedModule, ChatRoutingModule]] });
511
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: ChatModule, decorators: [{
508
+ ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
509
+ ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatModule, declarations: [ChatComponent, ChatContactsComponent, ConversationAvatarComponent], imports: [CoreModule, ThemeSharedModule, ChatRoutingModule], exports: [ChatComponent, ChatContactsComponent, ConversationAvatarComponent] });
510
+ ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatModule, imports: [[CoreModule, ThemeSharedModule, ChatRoutingModule]] });
511
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChatModule, decorators: [{
512
512
  type: NgModule,
513
513
  args: [{
514
514
  declarations,
package/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "@volo/abp.ng.chat",
3
- "version": "5.0.0-beta.1",
4
- "publishConfig": {
5
- "access": "public"
3
+ "version": "5.0.0-rc.2",
4
+ "peerDependencies": {
5
+ "@angular/common": "^12.2.0",
6
+ "@angular/core": "^12.2.0"
6
7
  },
7
8
  "dependencies": {
8
- "@microsoft/signalr": "^3.1.4",
9
- "tslib": "^2.2.0"
10
- },
11
- "peerDependencies": {
12
- "@abp/ng.theme.shared": ">=5.0.0-beta.1-1",
13
- "angular-oauth2-oidc": ">=9.0.0"
9
+ "tslib": "^2.3.0"
14
10
  },
15
11
  "main": "bundles/volo-abp.ng.chat.umd.js",
16
12
  "module": "fesm2015/volo-abp.ng.chat.js",