@volo/abp.ng.chat 4.4.1 → 5.0.0-beta.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.
Files changed (73) hide show
  1. package/bundles/volo-abp.ng.chat-config.umd.js +1 -1
  2. package/bundles/volo-abp.ng.chat-proxy.umd.js +1 -0
  3. package/bundles/volo-abp.ng.chat.umd.js +1 -1
  4. package/config/chat-config.module.d.ts +6 -0
  5. package/config/components/chat-icon.component.d.ts +3 -0
  6. package/config/package.json +0 -1
  7. package/config/providers/nav-item.provider.d.ts +1 -1
  8. package/config/providers/route.provider.d.ts +1 -1
  9. package/config/services/chat-config.service.d.ts +4 -3
  10. package/config/volo-abp.ng.chat-config.d.ts +1 -2
  11. package/esm2015/config/chat-config.module.js +1 -1
  12. package/esm2015/config/components/chat-icon.component.js +1 -1
  13. package/esm2015/config/services/chat-config.service.js +1 -1
  14. package/esm2015/config/volo-abp.ng.chat-config.js +1 -1
  15. package/esm2015/lib/chat-routing.module.js +1 -1
  16. package/esm2015/lib/chat.module.js +1 -1
  17. package/esm2015/lib/components/chat-contacts.component.js +1 -1
  18. package/esm2015/lib/components/chat.component.js +1 -1
  19. package/esm2015/lib/components/conversation-avatar.component.js +1 -1
  20. package/esm2015/lib/components/index.js +1 -0
  21. package/esm2015/lib/services/contact.service.js +1 -1
  22. package/esm2015/lib/services/conversation.service.js +1 -1
  23. package/esm2015/proxy/lib/index.js +1 -0
  24. package/esm2015/proxy/lib/proxy/volo/chat/conversations/conversation.service.js +1 -0
  25. package/esm2015/proxy/lib/proxy/volo/chat/conversations/index.js +1 -0
  26. package/esm2015/proxy/lib/proxy/volo/chat/conversations/models.js +1 -0
  27. package/esm2015/proxy/lib/proxy/volo/chat/messages/chat-message-side.enum.js +1 -0
  28. package/esm2015/proxy/lib/proxy/volo/chat/messages/index.js +1 -0
  29. package/esm2015/proxy/lib/proxy/volo/chat/messages/models.js +1 -0
  30. package/esm2015/proxy/lib/proxy/volo/chat/settings/index.js +1 -0
  31. package/esm2015/proxy/lib/proxy/volo/chat/settings/models.js +1 -0
  32. package/esm2015/proxy/lib/proxy/volo/chat/settings/settings.service.js +1 -0
  33. package/esm2015/proxy/lib/proxy/volo/chat/users/contact.service.js +1 -0
  34. package/esm2015/proxy/lib/proxy/volo/chat/users/index.js +1 -0
  35. package/esm2015/proxy/lib/proxy/volo/chat/users/models.js +1 -0
  36. package/esm2015/proxy/public-api.js +1 -0
  37. package/esm2015/proxy/volo-abp.ng.chat-proxy.js +1 -0
  38. package/esm2015/public-api.js +1 -1
  39. package/esm2015/volo-abp.ng.chat.js +1 -1
  40. package/fesm2015/volo-abp.ng.chat-config.js +48 -47
  41. package/fesm2015/volo-abp.ng.chat-proxy.js +92 -0
  42. package/fesm2015/volo-abp.ng.chat.js +186 -166
  43. package/lib/chat-routing.module.d.ts +5 -0
  44. package/lib/chat.module.d.ts +10 -0
  45. package/lib/components/chat-contacts.component.d.ts +6 -1
  46. package/lib/components/chat.component.d.ts +3 -0
  47. package/lib/components/conversation-avatar.component.d.ts +3 -0
  48. package/lib/components/index.d.ts +3 -0
  49. package/lib/services/contact.service.d.ts +3 -0
  50. package/lib/services/conversation.service.d.ts +3 -0
  51. package/package.json +3 -4
  52. package/proxy/lib/index.d.ts +4 -0
  53. package/proxy/lib/proxy/volo/chat/conversations/conversation.service.d.ts +14 -0
  54. package/proxy/lib/proxy/volo/chat/conversations/index.d.ts +2 -0
  55. package/proxy/lib/proxy/volo/chat/conversations/models.d.ts +13 -0
  56. package/proxy/lib/proxy/volo/chat/messages/chat-message-side.enum.d.ts +5 -0
  57. package/proxy/lib/proxy/volo/chat/messages/index.d.ts +2 -0
  58. package/proxy/lib/proxy/volo/chat/messages/models.d.ts +12 -0
  59. package/proxy/lib/proxy/volo/chat/settings/index.d.ts +2 -0
  60. package/proxy/lib/proxy/volo/chat/settings/models.d.ts +3 -0
  61. package/proxy/lib/proxy/volo/chat/settings/settings.service.d.ts +11 -0
  62. package/proxy/lib/proxy/volo/chat/users/contact.service.d.ts +12 -0
  63. package/proxy/lib/proxy/volo/chat/users/index.d.ts +2 -0
  64. package/proxy/lib/proxy/volo/chat/users/models.d.ts +21 -0
  65. package/proxy/package.json +10 -0
  66. package/proxy/public-api.d.ts +1 -0
  67. package/proxy/volo-abp.ng.chat-proxy.d.ts +5 -0
  68. package/public-api.d.ts +1 -1
  69. package/volo-abp.ng.chat.d.ts +1 -5
  70. package/bundles/volo-abp.ng.chat-config.umd.min.js +0 -1
  71. package/bundles/volo-abp.ng.chat.umd.min.js +0 -1
  72. package/config/volo-abp.ng.chat-config.metadata.json +0 -1
  73. package/volo-abp.ng.chat.metadata.json +0 -1
@@ -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("@abp/ng.core"),require("@microsoft/signalr"),require("@ngxs/store"),require("angular-oauth2-oidc")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat/config",["exports","@abp/ng.theme.shared","@angular/core","@angular/router","rxjs","rxjs/operators","@abp/ng.core","@microsoft/signalr","@ngxs/store","angular-oauth2-oidc"],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.i5,e.ng.core,e.ng.router,e.rxjs,e.rxjs.operators,e.i1,e.signalR,e.i3,e.i4)}(this,(function(e,t,n,i,r,o,s,a,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 i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var h=p(t),l=p(n),g=p(i),f=p(s),d=p(a),v=p(c),b=p(u),m=function(){function e(e,t,n,i,o,s,a,c){var u=this;this.restService=e,this.router=t,this.store=n,this.oAuthService=i,this.navItems=o,this.permissionService=s,this.configState=a,this.environmentService=c,this.apiName="Chat",this.message$=new r.Subject,this.unreadMessagesCount=0,this.handleMessage=function(e){u.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}();m.ɵprov=l.ɵɵdefineInjectable({factory:function(){return new m(l.ɵɵinject(f.RestService),l.ɵɵinject(g.Router),l.ɵɵinject(v.Store),l.ɵɵinject(b.OAuthService),l.ɵɵinject(h.NavItemsService),l.ɵɵinject(f.PermissionService),l.ɵɵinject(f.ConfigStateService),l.ɵɵinject(f.EnvironmentService))},token:m,providedIn:"root"}),m.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],m.ctorParameters=function(){return[{type:s.RestService},{type:i.Router},{type:c.Store},{type:u.OAuthService},{type:t.NavItemsService},{type:s.PermissionService},{type:s.ConfigStateService},{type:s.EnvironmentService}]};var C=function(){function e(e,t,n){this.chatConfigService=e,this.toaster=t,this.router=n,this.subscription=new r.Subscription,this.listenToMessages(),this.listenToRouterEvents()}return e.prototype.listenToMessages=function(){var e=this;this.subscription.add(this.chatConfigService.message$.pipe(o.filter((function(){return"/chat"!==e.router.url}))).subscribe((function(t){var n=t.senderName,i=t.senderSurname,r=t.senderUsername,o=t.text,s="<strong>"+(""+(n?n+(" "+i||""):r))+"</strong>: "+(o.length>50?o.substring(0,49)+"...":o);e.chatConfigService.unreadMessagesCount++,e.toaster.info(s,"Chat::NewChatMessage",{tapToDismiss:!0})})))},e.prototype.listenToRouterEvents=function(){var e=this;this.subscription.add(this.router.events.pipe(o.filter((function(e){return e instanceof i.NavigationEnd&&"/chat"===e.url}))).subscribe((function(){return e.chatConfigService.unreadMessagesCount=0})))},e.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},e}();C.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 "]}]}],C.ctorParameters=function(){return[{type:m},{type:t.ToasterService},{type:i.Router}]};var S=[{provide:n.APP_INITIALIZER,useFactory:y,deps:[t.NavItemsService],multi:!0}];function y(e){return function(){e.addItems([{id:"Chat.ChatIconComponent",requiredPolicy:"Chat.Messaging",component:C,order:99.99}])}}var I=[{provide:n.APP_INITIALIZER,useFactory:j,deps:[s.RoutesService],multi:!0}];function j(e){return function(){e.add([{path:"/chat",name:"Chat",requiredPolicy:"Chat.Messaging",layout:"application",iconClass:"fas fa-envelope",invisible:!0}])}}var R=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[I,S,{provide:n.APP_INITIALIZER,deps:[m,u.OAuthService],multi:!0,useFactory:s.noop}]}},e}();R.decorators=[{type:n.NgModule,args:[{imports:[s.CoreModule],declarations:[C],entryComponents:[C]}]}],e.CHAT_NAV_ITEM_PROVIDERS=S,e.CHAT_ROUTE_PROVIDERS=I,e.ChatConfigModule=R,e.ChatConfigService=m,e.ChatIconComponent=C,e.configureNavItems=y,e.configureRoutes=j,e.ɵa=I,e.ɵb=j,e.ɵc=S,e.ɵd=y,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.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})}));
@@ -0,0 +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 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@abp/ng.core"),require("@angular/core"),require("@volo/abp.ng.chat/config"),require("rxjs"),require("rxjs/operators"),require("@abp/ng.theme.shared"),require("@angular/router")):"function"==typeof define&&define.amd?define("@volo/abp.ng.chat",["exports","@abp/ng.core","@angular/core","@volo/abp.ng.chat/config","rxjs","rxjs/operators","@abp/ng.theme.shared","@angular/router"],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.i1,e.ng.core,e.volo.abp.ng.chat.config,e.rxjs,e.rxjs.operators,e.ng_theme_shared,e.ng.router)}(this,(function(e,t,n,a,s,o,r,c){"use strict";function i(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 l=i(t),d=i(n);Object.create;function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,s,o=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)r.push(a.value)}catch(e){s={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}return r}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e}var p;Object.create;!function(e){e[e.Sender=1]="Sender",e[e.Receiver=2]="Receiver"}(p||(p={}));var f=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}();f.ɵprov=d.ɵɵdefineInjectable({factory:function(){return new f(d.ɵɵinject(l.RestService))},token:f,providedIn:"root"}),f.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],f.ctorParameters=function(){return[{type:t.RestService}]};var h=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}();h.ɵprov=d.ɵɵdefineInjectable({factory:function(){return new h(d.ɵɵinject(l.RestService))},token:h,providedIn:"root"}),h.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],h.ctorParameters=function(){return[{type:t.RestService}]};var m=function(){function e(e,a){this.contactService=e,this.chatConfigService=a,this.selected=new n.EventEmitter,this.allContacts=[],this.selectedContact={},this.filter="",this.getContactName=v,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.chatConfigService.message$.pipe(t.takeUntilDestroy(this)).subscribe((function(t){var n=void 0===t?{}:t,a=n.senderName,s=n.senderSurname,o=n.senderUserId,r=n.senderUsername,c=n.text,i=e.allContacts.findIndex((function(e){return e.userId===o})),l={userId:o,username:r,name:a,surname:s,lastMessage:c,unreadMessageCount:1,lastMessageDate:new Date,lastMessageSide:p.Receiver};i>-1?e.allContacts[i]=Object.assign(Object.assign({},l),{unreadMessageCount:e.selectedContact.userId===e.allContacts[i].userId?0:e.allContacts[i].unreadMessageCount+1}):e.filter||e.allContacts.push(l)}))},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 v(e){var t=e.name,n=e.surname,a=e.username;return t||n?(t||"")+" "+(n||""):a}m.decorators=[{type:n.Component,args:[{selector:"abp-chat-contacts",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 "]}]}],m.ctorParameters=function(){return[{type:h},{type:a.ChatConfigService}]},m.propDecorators={selected:[{type:n.Output}]};var b=new Date,C=new Date(b.getFullYear(),b.getMonth(),b.getDate()).valueOf(),y=function(){function e(e,n,a,r){var c=this;this.conversationService=e,this.chatConfigService=n,this.configState=a,this.httpWaitService=r,this.selectedContact={},this.unreadMessageCount=0,this.userMessages=new Map,this.chatMessageSide=p,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(o.finalize((function(){return c.pagingLoading=!1}))).subscribe((function(e){var t;e.messages.length?(t=c.userMessages.get(c.selectedContact.userId)).unshift.apply(t,g(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 v(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(o.debounceTime(150),o.takeUntil(this.destroy$)).subscribe(this.onScroll)},e.prototype.listenToNewMessages=function(){var e=this;this.chatConfigService.message$.pipe(o.takeUntil(this.destroy$)).subscribe((function(t){var n=void 0===t?{}:t,a=n.senderUserId,s=n.text;if(e.userMessages.has(a)){var o=e.selectedContact.userId===a;e.userMessages.get(a).push({message:s,messageDate:new Date,side:p.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(o.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:b,messageDate:b,side:p.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()===C?"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}();y.decorators=[{type:n.Component,args:[{selector:"abp-chat",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 "]}]}],y.ctorParameters=function(){return[{type:f},{type:a.ChatConfigService},{type:t.ConfigStateService},{type:t.HttpWaitService}]},y.propDecorators={chatBoxRef:[{type:n.ViewChild,args:["chatBox",{static:!1}]}],chatContactsComponent:[{type:n.ViewChild,args:[m,{static:!1}]}]};var x={requiredPolicy:"Chat.Messaging",replaceableComponent:{defaultComponent:y,key:"Chat.ChatComponent"}},M=[{path:"",component:t.DynamicLayoutComponent,canActivate:[t.AuthGuard,t.PermissionGuard],children:[{path:"",component:t.ReplaceableRouteContainerComponent,data:x}]}],S=function(){};S.decorators=[{type:n.NgModule,args:[{imports:[c.RouterModule.forChild(M)],exports:[c.RouterModule]}]}];var I=[{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"}],w=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 I[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}();w.decorators=[{type:n.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 "]}]}],w.propDecorators={contact:[{type:n.Input}],small:[{type:n.Input}]};var k=[y,m,w],O=function(){function e(){}return e.forChild=function(){return{ngModule:e,providers:[]}},e.forLazy=function(){return new t.LazyModuleFactory(e.forChild())},e}();O.decorators=[{type:n.NgModule,args:[{declarations:k,imports:[t.CoreModule,r.ThemeSharedModule,S],exports:g(k)}]}],e.ChatComponent=y,e.ChatModule=O,e.ɵa=m,e.ɵb=h,e.ɵc=f,e.ɵd=w,e.ɵe=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,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,4 +1,10 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "./components/chat-icon.component";
4
+ import * as i2 from "@abp/ng.core";
2
5
  export declare class ChatConfigModule {
3
6
  static forRoot(): ModuleWithProviders<ChatConfigModule>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatConfigModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ChatConfigModule, [typeof i1.ChatIconComponent], [typeof i2.CoreModule], never>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<ChatConfigModule>;
4
10
  }
@@ -2,6 +2,7 @@ import { ToasterService } from '@abp/ng.theme.shared';
2
2
  import { OnDestroy } from '@angular/core';
3
3
  import { Router } from '@angular/router';
4
4
  import { ChatConfigService } from '../services/chat-config.service';
5
+ import * as i0 from "@angular/core";
5
6
  export declare class ChatIconComponent implements OnDestroy {
6
7
  chatConfigService: ChatConfigService;
7
8
  private toaster;
@@ -11,4 +12,6 @@ export declare class ChatIconComponent implements OnDestroy {
11
12
  private listenToMessages;
12
13
  private listenToRouterEvents;
13
14
  ngOnDestroy(): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatIconComponent, never>;
16
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChatIconComponent, "abp-chat-icon", never, {}, {}, never, never>;
14
17
  }
@@ -5,7 +5,6 @@
5
5
  "esm2015": "../esm2015/config/volo-abp.ng.chat-config.js",
6
6
  "fesm2015": "../fesm2015/volo-abp.ng.chat-config.js",
7
7
  "typings": "volo-abp.ng.chat-config.d.ts",
8
- "metadata": "volo-abp.ng.chat-config.metadata.json",
9
8
  "sideEffects": false,
10
9
  "name": "@volo/abp.ng.chat/config"
11
10
  }
@@ -1,6 +1,6 @@
1
1
  import { NavItemsService } from '@abp/ng.theme.shared';
2
2
  export declare const CHAT_NAV_ITEM_PROVIDERS: {
3
- provide: import("@angular/core").InjectionToken<(() => void)[]>;
3
+ provide: import("@angular/core").InjectionToken<readonly (() => void | import("rxjs").Observable<unknown> | Promise<unknown>)[]>;
4
4
  useFactory: typeof configureNavItems;
5
5
  deps: (typeof NavItemsService)[];
6
6
  multi: boolean;
@@ -1,6 +1,6 @@
1
1
  import { RoutesService } from '@abp/ng.core';
2
2
  export declare const CHAT_ROUTE_PROVIDERS: {
3
- provide: import("@angular/core").InjectionToken<(() => void)[]>;
3
+ provide: import("@angular/core").InjectionToken<readonly (() => void | import("rxjs").Observable<unknown> | Promise<unknown>)[]>;
4
4
  useFactory: typeof configureRoutes;
5
5
  deps: (typeof RoutesService)[];
6
6
  multi: boolean;
@@ -2,9 +2,9 @@ import { ConfigStateService, EnvironmentService, PermissionService, RestService
2
2
  import { NavItemsService } from '@abp/ng.theme.shared';
3
3
  import { Router } from '@angular/router';
4
4
  import * as signalR from '@microsoft/signalr';
5
- import { Store } from '@ngxs/store';
6
5
  import { OAuthService } from 'angular-oauth2-oidc';
7
6
  import { Subject } from 'rxjs';
7
+ import * as i0 from "@angular/core";
8
8
  export interface ChatMessage {
9
9
  senderUserId: string;
10
10
  senderUsername: string;
@@ -15,7 +15,6 @@ export interface ChatMessage {
15
15
  export declare class ChatConfigService {
16
16
  private restService;
17
17
  private router;
18
- private store;
19
18
  private oAuthService;
20
19
  private navItems;
21
20
  private permissionService;
@@ -28,10 +27,12 @@ export declare class ChatConfigService {
28
27
  unreadMessagesCount: number;
29
28
  get isChatEnabled(): boolean;
30
29
  get signalRUrl(): string;
31
- constructor(restService: RestService, router: Router, store: Store, oAuthService: OAuthService, navItems: NavItemsService, permissionService: PermissionService, configState: ConfigStateService, environmentService: EnvironmentService);
30
+ constructor(restService: RestService, router: Router, oAuthService: OAuthService, navItems: NavItemsService, permissionService: PermissionService, configState: ConfigStateService, environmentService: EnvironmentService);
32
31
  private listenToAppConfig;
33
32
  private toggleChat;
34
33
  private initSignalR;
35
34
  private handleMessage;
36
35
  setTotalUnreadMessageCount(): void;
36
+ static ɵfac: i0.ɵɵFactoryDeclaration<ChatConfigService, never>;
37
+ static ɵprov: i0.ɵɵInjectableDeclaration<ChatConfigService>;
37
38
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@volo/abp.ng.chat/config" />
4
5
  export * from './public-api';
5
- export { CHAT_NAV_ITEM_PROVIDERS as ɵc, configureNavItems as ɵd } from './providers/nav-item.provider';
6
- export { CHAT_ROUTE_PROVIDERS as ɵa, configureRoutes as ɵb } from './providers/route.provider';
@@ -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";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.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.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 +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";export class ChatIconComponent{constructor(e,t,s){this.chatConfigService=e,this.toaster=t,this.router=s,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:s,senderUsername:n,text:r}=e,i=`<strong>${""+(t?t+(" "+s||""):n)}</strong>: ${r.length>50?r.substring(0,49)+"...":r}`;this.chatConfigService.unreadMessagesCount++,this.toaster.info(i,"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.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 "]}]}],ChatIconComponent.ctorParameters=()=>[{type:ChatConfigService},{type:ToasterService},{type: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.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 +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{Store}from"@ngxs/store";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"@ngxs/store";import*as i4 from"angular-oauth2-oidc";import*as i5 from"@abp/ng.theme.shared";const permission="Chat.Messaging";export class ChatConfigService{constructor(e,t,i,r,n,o,s,a){this.restService=e,this.router=t,this.store=i,this.oAuthService=r,this.navItems=n,this.permissionService=o,this.configState=s,this.environmentService=a,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.ɵprov=i0.ɵɵdefineInjectable({factory:function(){return new ChatConfigService(i0.ɵɵinject(i1.RestService),i0.ɵɵinject(i2.Router),i0.ɵɵinject(i3.Store),i0.ɵɵinject(i4.OAuthService),i0.ɵɵinject(i5.NavItemsService),i0.ɵɵinject(i1.PermissionService),i0.ɵɵinject(i1.ConfigStateService),i0.ɵɵinject(i1.EnvironmentService))},token:ChatConfigService,providedIn:"root"}),ChatConfigService.decorators=[{type:Injectable,args:[{providedIn:"root"}]}],ChatConfigService.ctorParameters=()=>[{type:RestService},{type:Router},{type:Store},{type:OAuthService},{type:NavItemsService},{type:PermissionService},{type:ConfigStateService},{type: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.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 +1 @@
1
- export*from"./public-api";export{CHAT_NAV_ITEM_PROVIDERS as ɵc,configureNavItems as ɵd}from"./providers/nav-item.provider";export{CHAT_ROUTE_PROVIDERS as ɵa,configureRoutes as ɵb}from"./providers/route.provider";
1
+ export*from"./public-api";
@@ -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";const ɵ0={requiredPolicy:"Chat.Messaging",replaceableComponent:{defaultComponent:ChatComponent,key:"Chat.ChatComponent"}},routes=[{path:"",component:DynamicLayoutComponent,canActivate:[AuthGuard,PermissionGuard],children:[{path:"",component:ReplaceableRouteContainerComponent,data:ɵ0}]}];export class ChatRoutingModule{}ChatRoutingModule.decorators=[{type:NgModule,args:[{imports:[RouterModule.forChild(routes)],exports:[RouterModule]}]}];export{ɵ0};
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 +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";const declarations=[ChatComponent,ChatContactsComponent,ConversationAvatarComponent];export class ChatModule{static forChild(){return{ngModule:ChatModule,providers:[]}}static forLazy(){return new LazyModuleFactory(ChatModule.forChild())}}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.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 +1 @@
1
- import{takeUntilDestroy,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";export class ChatContactsComponent{constructor(t,e){this.contactService=t,this.chatConfigService=e,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.chatConfigService.message$.pipe(takeUntilDestroy(this)).subscribe(({senderName:t,senderSurname:e,senderUserId:n,senderUsername:a,text:s}={})=>{const c=this.allContacts.findIndex(t=>t.userId===n),o={userId:n,username:a,name:t,surname:e,lastMessage:s,unreadMessageCount:1,lastMessageDate:new Date,lastMessageSide:ChatMessageSide.Receiver};c>-1?this.allContacts[c]=Object.assign(Object.assign({},o),{unreadMessageCount:this.selectedContact.userId===this.allContacts[c].userId?0:this.allContacts[c].unreadMessageCount+1}):this.filter||this.allContacts.push(o)})}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.decorators=[{type:Component,args:[{selector:"abp-chat-contacts",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 "]}]}],ChatContactsComponent.ctorParameters=()=>[{type:ContactService},{type:ChatConfigService}],ChatContactsComponent.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.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 +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";const now=new Date,today=new Date(now.getFullYear(),now.getMonth(),now.getDate()).valueOf();export class ChatComponent{constructor(e,t,s,n){this.conversationService=e,this.chatConfigService=t,this.configState=s,this.httpWaitService=n,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 s=this.selectedContact.userId===e;this.userMessages.get(e).push({message:t,messageDate:new Date,side:ChatMessageSide.Receiver,isRead:s,readDate:s?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.decorators=[{type:Component,args:[{selector:"abp-chat",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 "]}]}],ChatComponent.ctorParameters=()=>[{type:ConversationService},{type:ChatConfigService},{type:ConfigStateService},{type:HttpWaitService}],ChatComponent.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.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 +1 @@
1
- import{Component,Input}from"@angular/core";import{ChatContactDto}from"../models/chat-contact-dto";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 a=0;a<this.contact.username.length;a++)t=this.contact.username.charCodeAt(a)+((t<<5)-t);return avatarStyles[Math.abs(t%10)]}get isSmall(){return"string"==typeof this.small||this.small}}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 "]}]}],ConversationAvatarComponent.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.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}]}});
@@ -0,0 +1 @@
1
+ export*from"./chat.component";export*from"./chat-contacts.component";export*from"./conversation-avatar.component";
@@ -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.ɵprov=i0.ɵɵdefineInjectable({factory:function(){return new ContactService(i0.ɵɵinject(i1.RestService))},token:ContactService,providedIn:"root"}),ContactService.decorators=[{type:Injectable,args:[{providedIn:"root"}]}],ContactService.ctorParameters=()=>[{type: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.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 +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.ɵprov=i0.ɵɵdefineInjectable({factory:function(){return new ConversationService(i0.ɵɵinject(i1.RestService))},token:ConversationService,providedIn:"root"}),ConversationService.decorators=[{type:Injectable,args:[{providedIn:"root"}]}],ConversationService.ctorParameters=()=>[{type: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.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}]}});
@@ -0,0 +1 @@
1
+ export*from"./proxy/volo/chat/conversations";export*from"./proxy/volo/chat/messages";export*from"./proxy/volo/chat/settings";export*from"./proxy/volo/chat/users";
@@ -0,0 +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}]}});
@@ -0,0 +1 @@
1
+ export*from"./conversation.service";export*from"./models";
@@ -0,0 +1 @@
1
+ import{mapEnumToOptions}from"@abp/ng.core";export var ChatMessageSide;!function(e){e[e.Sender=1]="Sender",e[e.Receiver=2]="Receiver"}(ChatMessageSide||(ChatMessageSide={}));export const chatMessageSideOptions=mapEnumToOptions(ChatMessageSide);
@@ -0,0 +1 @@
1
+ export*from"./chat-message-side.enum";export*from"./models";
@@ -0,0 +1 @@
1
+ export*from"./models";export*from"./settings.service";
@@ -0,0 +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}]}});
@@ -0,0 +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}]}});
@@ -0,0 +1 @@
1
+ export*from"./contact.service";export*from"./models";
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1 @@
1
+ export*from"./lib/index";
@@ -0,0 +1 @@
1
+ export*from"./public-api";
@@ -1 +1 @@
1
- export*from"./lib/components/chat.component";export*from"./lib/chat.module";
1
+ export*from"./lib/chat.module";export*from"./lib/components";
@@ -1 +1 @@
1
- export*from"./public-api";export{ChatRoutingModule as ɵe}from"./lib/chat-routing.module";export{ChatContactsComponent as ɵa}from"./lib/components/chat-contacts.component";export{ConversationAvatarComponent as ɵd}from"./lib/components/conversation-avatar.component";export{ContactService as ɵb}from"./lib/services/contact.service";export{ConversationService as ɵc}from"./lib/services/conversation.service";
1
+ export*from"./public-api";