@posiwise/messaging-module 0.0.101 → 0.0.102
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.
|
@@ -1,46 +1,40 @@
|
|
|
1
1
|
import { ScrollingModule } from "@angular/cdk/scrolling";
|
|
2
|
-
import
|
|
3
|
-
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { CommonModule, DatePipe, NgClass } from "@angular/common";
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
|
-
import { Component, NgModule, ViewChild } from "@angular/core";
|
|
6
|
-
import * as
|
|
4
|
+
import { ChangeDetectorRef, Component, ElementRef, NgModule, ViewChild, inject } from "@angular/core";
|
|
5
|
+
import * as i1$1 from "@angular/forms";
|
|
7
6
|
import { FormsModule } from "@angular/forms";
|
|
8
7
|
import * as i1 from "@angular/router";
|
|
9
8
|
import { RouterModule } from "@angular/router";
|
|
10
9
|
import { CoreTranslocoModule } from "@posiwise/core-transloco";
|
|
11
|
-
import
|
|
12
|
-
import { PipesModule } from "@posiwise/pipes";
|
|
10
|
+
import { CommonPipe, PipesModule, TextTruncatePipe } from "@posiwise/pipes";
|
|
13
11
|
import { NgxFileDropModule } from "ngx-file-drop";
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import * as i5 from "primeng/progressspinner";
|
|
19
|
-
import { ProgressSpinnerModule } from "primeng/progressspinner";
|
|
20
|
-
import * as i7 from "@ctrl/ngx-emoji-mart";
|
|
21
|
-
import { PickerModule } from "@ctrl/ngx-emoji-mart";
|
|
12
|
+
import { InfiniteScrollDirective, InfiniteScrollModule } from "ngx-infinite-scroll";
|
|
13
|
+
import { AutoComplete, AutoCompleteModule } from "primeng/autocomplete";
|
|
14
|
+
import { ProgressSpinner, ProgressSpinnerModule } from "primeng/progressspinner";
|
|
15
|
+
import { PickerComponent, PickerModule } from "@ctrl/ngx-emoji-mart";
|
|
22
16
|
import { EmojiModule } from "@ctrl/ngx-emoji-mart/ngx-emoji";
|
|
23
17
|
import { AppBaseComponent } from "@posiwise/app-base-component";
|
|
24
|
-
import
|
|
25
|
-
import { PermissionService } from "@posiwise/common-services";
|
|
18
|
+
import { MailBoxService, PermissionService, ProfileService, ScriptLoaderService, WebsocketService } from "@posiwise/common-services";
|
|
26
19
|
import { ATTACHMENT_TYPE, ChatUser, Conversation, SOCKET_TYPE } from "@posiwise/common-utilities";
|
|
20
|
+
import { ConfirmDialogService } from "@posiwise/shared-components";
|
|
27
21
|
import groupBy from "lodash/groupBy";
|
|
28
22
|
import sortBy from "lodash/sortBy";
|
|
29
23
|
import uniqBy from "lodash/uniqBy";
|
|
30
24
|
import moment from "moment";
|
|
25
|
+
import { Bind } from "primeng/bind";
|
|
31
26
|
import { lastValueFrom } from "rxjs";
|
|
32
|
-
import
|
|
33
|
-
import * as i9 from "@jsverse/transloco";
|
|
27
|
+
import { TranslocoPipe } from "@jsverse/transloco";
|
|
34
28
|
var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
35
|
-
constructor(
|
|
36
|
-
super(
|
|
37
|
-
this.elRef =
|
|
38
|
-
this.mailboxService =
|
|
39
|
-
this.profileService =
|
|
40
|
-
this.socketService =
|
|
41
|
-
this.scriptLoader =
|
|
42
|
-
this.cdr =
|
|
43
|
-
this.confirmDialog =
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.elRef = inject(ElementRef);
|
|
32
|
+
this.mailboxService = inject(MailBoxService);
|
|
33
|
+
this.profileService = inject(ProfileService);
|
|
34
|
+
this.socketService = inject(WebsocketService);
|
|
35
|
+
this.scriptLoader = inject(ScriptLoaderService);
|
|
36
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
37
|
+
this.confirmDialog = inject(ConfirmDialogService);
|
|
44
38
|
this.ObjectKeys = Object.keys;
|
|
45
39
|
this.showEmoji = false;
|
|
46
40
|
this.pristineConversation = [];
|
|
@@ -452,16 +446,7 @@ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
|
452
446
|
version: "22.2.3",
|
|
453
447
|
ngImport: i0,
|
|
454
448
|
type: ChatBoxComponent,
|
|
455
|
-
deps:
|
|
456
|
-
{ token: i0.ElementRef },
|
|
457
|
-
{ token: i1$1.MailBoxService },
|
|
458
|
-
{ token: i1$1.ProfileService },
|
|
459
|
-
{ token: i1$1.WebsocketService },
|
|
460
|
-
{ token: i1$1.ScriptLoaderService },
|
|
461
|
-
{ token: i0.Injector },
|
|
462
|
-
{ token: i0.ChangeDetectorRef },
|
|
463
|
-
{ token: i2.ConfirmDialogService }
|
|
464
|
-
],
|
|
449
|
+
deps: null,
|
|
465
450
|
target: i0.ɵɵFactoryTarget.Component
|
|
466
451
|
});
|
|
467
452
|
}
|
|
@@ -470,7 +455,7 @@ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
|
470
455
|
minVersion: "17.0.0",
|
|
471
456
|
version: "22.2.3",
|
|
472
457
|
type: ChatBoxComponent,
|
|
473
|
-
isStandalone:
|
|
458
|
+
isStandalone: true,
|
|
474
459
|
selector: "ng-component",
|
|
475
460
|
viewQueries: [{
|
|
476
461
|
propertyName: "messageInputRef",
|
|
@@ -483,51 +468,9 @@ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
|
483
468
|
template: "<div class=\"chat-application mt-5\">\n <div class=\"content-overlay\"></div>\n\n @if (isChatLoading) {\n <div class=\"text-center\">\n <p-progress-spinner> </p-progress-spinner>\n </div>\n }\n\n @if (!isChatLoading) {\n <div class=\"chat-sidebar float-start d-none d-sm-none d-md-block d-lg-block\">\n <div class=\"chat-sidebar-content\">\n <div class=\"chat-fixed-search p-2\">\n <div class=\"d-flex\">\n <p-auto-complete appendTo=\"body\" inputId=\"chatbox-search-member\"\n [(ngModel)]=\"searchText\"\n #searchTxt\n [placeholder]=\"'Messaging.Chatbox.SearchMembers' | transloco\"\n [ngModelOptions]=\"{ standalone: true }\"\n optionLabel=\"first_name\"\n (onSelect)=\"onMemberSelection(searchText)\"\n [suggestions]=\"recipients\"\n (completeMethod)=\"recipientSearch()\">\n <ng-template let-item #item>\n <div>\n {{ item.first_name + ' ' }}\n {{ item.last_name ? item.last_name : '' }}\n </div>\n </ng-template>\n </p-auto-complete>\n </div>\n </div>\n\n <!-- Thread/conversation List -->\n <div id=\"users-list\"\n class=\"list-group position-relative\">\n @if (conversations?.length) {\n <div class=\"users-list-padding\">\n @for (conversation of conversations; track trackConversationKey(conversation)) {\n <a class=\"list-group-item no-border\"\n (click)=\"onParticipantClick(conversation)\">\n <div class=\"d-flex\">\n <span class=\"avatar avatar-md avatar-away\">\n @if (conversation?.to?.avatar) {\n <img [src]=\"conversation.to?.avatar\"\n width=\"40\"\n height=\"40\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n conversation?.participants\n ? conversation.to?.slug.charAt(0).toUpperCase()\n : conversation.to?.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n </span>\n <div class=\"clearfix\">\n <h6 class=\"list-group-item-heading mb-1\">\n {{\n conversation.to?.name\n ? conversation.to?.name\n : conversation.to?.slug\n }}\n <span class=\"font-small-3 float-end ms-5 ps-5\">\n @if (conversation?.unread_count) {\n <span class=\"badge bg-primary rounded-pill bg-primary mx-1\">\n {{ conversation.unread_count }}\n </span>\n }\n {{ conversation.created_at | date: 'shortTime' }}\n </span>\n </h6>\n <p class=\"list-group-item-text text-muted\">\n {{ conversation?.latest_message?.body | textTruncate: 25 }}\n </p>\n </div>\n </div>\n </a>\n }\n </div>\n }\n </div>\n </div>\n </div>\n\n @if (conversations?.length) {\n <!-- Chat Header -->\n @if (otherUser) {\n <div class=\"chat-name p-2 bg-white\">\n <div class=\"d-flex\">\n <span class=\"chat-app-sidebar-toggle ft-align-justify font-large-1 me-2 d-none d-block d-sm-block d-md-none\"\n (keydown.enter)=\"toggleSidebar()\"\n (click)=\"toggleSidebar()\"></span>\n <div class=\"clearfix\">\n @if (currentConversation?.to?.avatar) {\n <img [src]=\"currentConversation?.to?.avatar\"\n width=\"40\"\n height=\"40\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\" />\n } @else {\n @if (currentUser) {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n otherUser?.name\n ? otherUser.name.charAt(0).toUpperCase()\n : otherUser.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n }\n\n @if (currentUser) {\n <strong class=\"mt-2\">{{\n otherUser.name ? otherUser.name : otherUser.slug\n }}</strong>\n }\n </div>\n </div>\n </div>\n }\n\n <!-- Chat Window -->\n <div class=\"chat-app-window\"\n id=\"chats-wrapper\"\n #scrollMe\n infinite-scroll\n [infiniteScrollDistance]=\"scrollDistance\"\n [scrollWindow]=\"false\"\n [infiniteScrollUpDistance]=\"scrollUpDistance\"\n [infiniteScrollThrottle]=\"throttle\"\n [alwaysCallback]=\"true\"\n (scrolledUp)=\"onUp($event, selectedConversationId)\">\n <div class=\"chats\">\n <!-- Shows Message -->\n @if (!isLoaded) {\n <div class=\"spinner\"></div>\n }\n @if (messagesGroupedByDate) {\n @for (item of ObjectKeys(messagesGroupedByDate); track item) {\n <strong class=\"badge bg-secondary mb-1\">{{\n messagesGroupedByDate[item][0]?.created_at | date\n }}</strong>\n <!-- Every Message -->\n @for (message of messagesGroupedByDate[item]; track message.id) {\n <div class=\"chat\"\n [ngClass]=\"{\n 'chat-left ms-2': message.sender_id !== currentUser.id,\n 'me-2': message.sender_id === currentUser.id\n }\">\n @if (message.body || message.attachment?.url) {\n <div class=\"chat-avatar\">\n <a class=\"avatar\"\n data-toggle=\"tooltip\"\n data-placement=\"right\"\n data-original-title=\"\">\n <!-- Setting up Avatar Image for Logged In User -->\n @if (message.sender_id === currentUser.id) {\n @if (currentUserImg) {\n <img [src]=\"currentUserImg\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar bg-brown\">\n <strong>{{\n currentUser?.name\n ? currentUser.name\n .charAt(0)\n .toUpperCase()\n : currentUser.slug\n .charAt(0)\n .toUpperCase()\n }}\n </strong>\n </div>\n }\n }\n\n <!-- Participant -->\n @if (message.sender_id !== currentUser.id) {\n @if (currentUser && otherUser?.avatar) {\n <img [src]=\"otherUser?.avatar\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar\">\n <strong>{{\n otherUser?.name\n ? otherUser.name\n .charAt(0)\n .toUpperCase()\n : otherUser.slug\n .charAt(0)\n .toUpperCase()\n }}</strong>\n </div>\n }\n }\n </a>\n </div>\n <div class=\"chat-body\">\n @if (!message?.attachment?.url) {\n <div class=\"chat-content attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.sender_id === currentUser.id && message.is_open) {\n <i\n class=\"fa fa-check-double msg-double-check\"\n ></i>\n }\n <p>{{ message.body }}</p>\n </div>\n } @else {\n <div class=\"chat-content with-attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.attachment) {\n <div class=\"message-attachment\">\n <i>\n @if (message?.messageType === ATTACHMENT_TYPE.IMG) {\n <img\n [src]=\"message.attachment.url\"\n class=\"img-thumbnail\"\n [alt]=\"'Messaging.Chatbox.AttachmentAlt' | transloco\"\n />\n }\n @if (message?.messageType === ATTACHMENT_TYPE.VIDEO) {\n <video\n width=\"320\"\n height=\"240\"\n controls\n class=\"img-thumbnail\"\n >\n <source\n [src]=\"message.attachment.url\"\n type=\"video/mp4\"\n />\n <track kind=\"subtitles\" srclang=\"en\" [label]=\"'Messaging.Chatbox.SubtitlesEnglish' | transloco\" />\n {{ 'Messaging.Chatbox.VideoNotSupported' | transloco }}\n </video>\n }\n <a\n [attr.href]=\"message.attachment.url\"\n target=\"_blank\"\n >\n <i\n class=\"fa fa-file-download me-2\"\n aria-hidden=\"true\"\n ></i>\n {{\n message.attachment.url\n | common: 'filename'\n }}</a>\n </i>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n }\n }\n\n @if (!messagesGroupedByDate && isLoaded) {\n <div class=\"mt-3 text-center\">{{ 'Messaging.Chatbox.NoHistory' | transloco }}</div>\n }\n\n @if (isFileUploading) {\n <i class=\"fa fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n\n <!-- Shows Metadata of the file being uploaded -->\n <div class=\"compose-message-attachment\">\n <div class=\"m-0\">\n @for (item of attachedFiles; track $index) {\n <div class=\"card px-3 py-2 m-0 mb-1\">\n <div class=\"card-body\">\n <div class=\"d-inline-block file-name\">{{ item.name }}</div>\n <div class=\"d-inline-block file-size\">{{ item.size }}</div>\n <div class=\"d-inline-block float-end file-remove\"\n (keydown.enter)=\"onRemoveAttachment(item)\"\n (click)=\"onRemoveAttachment(item)\">\n\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n\n <div [hidden]=\"!showEmoji\">\n <emoji-mart [title]=\"'Messaging.Chatbox.PickEmoji' | transloco\"\n set=\"facebook\"\n [showPreview]=\"false\"\n (emojiSelect)=\"onEmojiSelect($event)\"\n [emojiSize]=\"30\">\n </emoji-mart>\n </div>\n\n <!-- Compose Text box area -->\n <div class=\"chat-app-form bg-blue-grey bg-lighten-5\">\n <form class=\"chat-app-input row\">\n <fieldset class=\"mb-3 position-relative has-icon-left col-10 m-0 mb-1\">\n <div class=\"form-control-position emoji-container\">\n <button type=\"button\" class=\"emoji-toggle-btn\" [attr.aria-label]=\"'Messaging.Chatbox.InsertEmoji' | transloco\" (click)=\"showEmoji = !showEmoji\">🙂</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">{{ 'Messaging.Chatbox.MessageLabel' | transloco }}</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n [placeholder]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n [attr.aria-label]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">{{ 'BrainChat.AttachFile' | transloco }}</span>\n <i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>\n <input\n id=\"file-input\"\n name=\"file-input\"\n type=\"file\"\n (change)=\"fileChangeListener($event)\"\n size=\"60\"\n [attr.aria-label]=\"'Messaging.Chatbox.FileInput' | transloco\" />\n </label>\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"mb-3 position-relative has-icon-left col-2 m-0 mb-1\">\n <button type=\"button\"\n class=\"btn btn-primary d-lg-flex align-items-center btn-send\"\n (click)=\"onSendMessage()\">\n <i class=\"fa fa-paper-plane\"></i><span class=\"d-none d-lg-block ms-1\">{{ 'Messaging.Chatbox.Send' | transloco }}</span>\n </button>\n </fieldset>\n </form>\n </div>\n } @else {\n <div class=\"container-fluid pw-tab overflow-hidden no-message-center\">\n <div class=\"dashboard\">\n <div class=\"dashboard-body text-center mt-5\">\n <div>\n <img src=\"/assets/img/icons/empty-chat-icon.png\"\n [alt]=\"'Messaging.Chatbox.EmptyAlt' | transloco\" />\n </div>\n <div class=\"h4 mt-4\">{{ 'Messaging.Chatbox.Empty.Title' | transloco }}</div>\n <div class=\"mt-3\">\n <p>{{ 'Messaging.Chatbox.Empty.Text' | transloco }}</p>\n <p>{{ 'Messaging.Chatbox.Empty.Hint' | transloco }}</p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n",
|
|
484
469
|
styles: ["@charset \"UTF-8\";:root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_sub_bg: color-mix(in srgb, var(--first, rgb(23 105 225)) 85%, #000000);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255);--dashboard_bg: rgb(255 255 255);--pw-hairline: #e2e5ea;--public-btn-radius: 24px}:host ::ng-deep .chat-application{height:calc(100vh - 92px);position:relative}#drift-widget-container{display:none!important}#file-input{height:0;visibility:hidden;width:0}.message-attachment{color:#fff}.emoji-toggle-btn{background:transparent;border:0;color:#676767;cursor:pointer;font-size:20px;line-height:1;padding:4px 6px}.compose-message-attachment{bottom:0;color:#676767;left:0;position:absolute;width:55%}.compose-message-attachment .file-name{font-size:14px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:400px}.compose-message-attachment .file-size{width:100px}.compose-message-attachment .file-remove{width:45px}.compose-message-attachment .file-remove i{margin-left:37px;margin-top:7px}.fa-spinner{font-size:24px}.fa-paperclip{font-size:19px;margin-top:7px;width:13px}.dummy-avatar{background-color:#ff586b;border-radius:50%;color:#fff;font-size:18px;height:40px;line-height:40px;text-align:center;width:40px;display:inline-block}.card{border:1px solid rgb(204,204,204)}.msg-double-check{color:#4fc3f7;font-size:10px;left:-13px;position:absolute;top:11px}.btn-delete{display:none;left:-85px;position:absolute;top:11px}.chat-body:hover .btn-delete{display:block!important}.bg-brown{background-color:#cc6000}.btn-send{border-radius:5px;padding:7px 13px}@keyframes spinner{to{transform:rotate(360deg)}}.spinner{animation:spinner .6s linear infinite!important;border:3px solid rgb(204,204,204);border-radius:50%;border-top-color:#000;box-sizing:border-box;content:\"\";height:50px;left:50%;margin-left:-10px;margin-top:-10px;position:absolute;top:10%;width:50px}@media(min-width:768px){.no-message-center{margin-left:auto;width:calc(100% - 300px)}}\n"],
|
|
485
470
|
dependencies: [
|
|
486
|
-
{
|
|
487
|
-
kind: "directive",
|
|
488
|
-
type: i3.NgClass,
|
|
489
|
-
selector: "[ngClass]",
|
|
490
|
-
inputs: ["class", "ngClass"]
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
kind: "directive",
|
|
494
|
-
type: i4.ɵNgNoValidate,
|
|
495
|
-
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
kind: "directive",
|
|
499
|
-
type: i4.NgControlStatus,
|
|
500
|
-
selector: "[formControlName],[ngModel],[formControl]"
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
kind: "directive",
|
|
504
|
-
type: i4.NgControlStatusGroup,
|
|
505
|
-
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
kind: "directive",
|
|
509
|
-
type: i4.NgModel,
|
|
510
|
-
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
511
|
-
inputs: [
|
|
512
|
-
"name",
|
|
513
|
-
"disabled",
|
|
514
|
-
"ngModel",
|
|
515
|
-
"ngModelOptions"
|
|
516
|
-
],
|
|
517
|
-
outputs: ["ngModelChange"],
|
|
518
|
-
exportAs: ["ngModel"]
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
kind: "directive",
|
|
522
|
-
type: i4.NgForm,
|
|
523
|
-
selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
|
|
524
|
-
inputs: ["ngFormOptions"],
|
|
525
|
-
outputs: ["ngSubmit"],
|
|
526
|
-
exportAs: ["ngForm"]
|
|
527
|
-
},
|
|
528
471
|
{
|
|
529
472
|
kind: "component",
|
|
530
|
-
type:
|
|
473
|
+
type: ProgressSpinner,
|
|
531
474
|
selector: "p-progress-spinner, p-progressspinner",
|
|
532
475
|
inputs: [
|
|
533
476
|
"value",
|
|
@@ -541,7 +484,7 @@ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
|
541
484
|
},
|
|
542
485
|
{
|
|
543
486
|
kind: "component",
|
|
544
|
-
type:
|
|
487
|
+
type: AutoComplete,
|
|
545
488
|
selector: "p-autocomplete, p-auto-complete",
|
|
546
489
|
inputs: [
|
|
547
490
|
"minQueryLength",
|
|
@@ -618,9 +561,73 @@ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
|
618
561
|
"onLazyLoad"
|
|
619
562
|
]
|
|
620
563
|
},
|
|
564
|
+
{
|
|
565
|
+
kind: "ngmodule",
|
|
566
|
+
type: FormsModule
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
kind: "directive",
|
|
570
|
+
type: i1$1.ɵNgNoValidate,
|
|
571
|
+
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
kind: "directive",
|
|
575
|
+
type: i1$1.NgControlStatus,
|
|
576
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
kind: "directive",
|
|
580
|
+
type: i1$1.NgControlStatusGroup,
|
|
581
|
+
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
kind: "directive",
|
|
585
|
+
type: i1$1.NgModel,
|
|
586
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
587
|
+
inputs: [
|
|
588
|
+
"name",
|
|
589
|
+
"disabled",
|
|
590
|
+
"ngModel",
|
|
591
|
+
"ngModelOptions"
|
|
592
|
+
],
|
|
593
|
+
outputs: ["ngModelChange"],
|
|
594
|
+
exportAs: ["ngModel"]
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
kind: "directive",
|
|
598
|
+
type: i1$1.NgForm,
|
|
599
|
+
selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
|
|
600
|
+
inputs: ["ngFormOptions"],
|
|
601
|
+
outputs: ["ngSubmit"],
|
|
602
|
+
exportAs: ["ngForm"]
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
kind: "directive",
|
|
606
|
+
type: InfiniteScrollDirective,
|
|
607
|
+
selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]",
|
|
608
|
+
inputs: [
|
|
609
|
+
"infiniteScrollDistance",
|
|
610
|
+
"infiniteScrollUpDistance",
|
|
611
|
+
"infiniteScrollThrottle",
|
|
612
|
+
"infiniteScrollDisabled",
|
|
613
|
+
"infiniteScrollContainer",
|
|
614
|
+
"scrollWindow",
|
|
615
|
+
"immediateCheck",
|
|
616
|
+
"horizontal",
|
|
617
|
+
"alwaysCallback",
|
|
618
|
+
"fromRoot"
|
|
619
|
+
],
|
|
620
|
+
outputs: ["scrolled", "scrolledUp"]
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
kind: "directive",
|
|
624
|
+
type: NgClass,
|
|
625
|
+
selector: "[ngClass]",
|
|
626
|
+
inputs: ["class", "ngClass"]
|
|
627
|
+
},
|
|
621
628
|
{
|
|
622
629
|
kind: "component",
|
|
623
|
-
type:
|
|
630
|
+
type: PickerComponent,
|
|
624
631
|
selector: "emoji-mart",
|
|
625
632
|
inputs: [
|
|
626
633
|
"perLine",
|
|
@@ -666,42 +673,24 @@ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
|
|
|
666
673
|
"skinChange"
|
|
667
674
|
]
|
|
668
675
|
},
|
|
669
|
-
{
|
|
670
|
-
kind: "directive",
|
|
671
|
-
type: i8.InfiniteScrollDirective,
|
|
672
|
-
selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]",
|
|
673
|
-
inputs: [
|
|
674
|
-
"infiniteScrollDistance",
|
|
675
|
-
"infiniteScrollUpDistance",
|
|
676
|
-
"infiniteScrollThrottle",
|
|
677
|
-
"infiniteScrollDisabled",
|
|
678
|
-
"infiniteScrollContainer",
|
|
679
|
-
"scrollWindow",
|
|
680
|
-
"immediateCheck",
|
|
681
|
-
"horizontal",
|
|
682
|
-
"alwaysCallback",
|
|
683
|
-
"fromRoot"
|
|
684
|
-
],
|
|
685
|
-
outputs: ["scrolled", "scrolledUp"]
|
|
686
|
-
},
|
|
687
676
|
{
|
|
688
677
|
kind: "pipe",
|
|
689
|
-
type:
|
|
678
|
+
type: DatePipe,
|
|
690
679
|
name: "date"
|
|
691
680
|
},
|
|
692
681
|
{
|
|
693
682
|
kind: "pipe",
|
|
694
|
-
type:
|
|
683
|
+
type: TranslocoPipe,
|
|
695
684
|
name: "transloco"
|
|
696
685
|
},
|
|
697
686
|
{
|
|
698
687
|
kind: "pipe",
|
|
699
|
-
type:
|
|
688
|
+
type: TextTruncatePipe,
|
|
700
689
|
name: "textTruncate"
|
|
701
690
|
},
|
|
702
691
|
{
|
|
703
692
|
kind: "pipe",
|
|
704
|
-
type:
|
|
693
|
+
type: CommonPipe,
|
|
705
694
|
name: "common"
|
|
706
695
|
}
|
|
707
696
|
]
|
|
@@ -716,21 +705,23 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
716
705
|
decorators: [{
|
|
717
706
|
type: Component,
|
|
718
707
|
args: [{
|
|
719
|
-
|
|
708
|
+
imports: [
|
|
709
|
+
Bind,
|
|
710
|
+
ProgressSpinner,
|
|
711
|
+
AutoComplete,
|
|
712
|
+
FormsModule,
|
|
713
|
+
InfiniteScrollDirective,
|
|
714
|
+
NgClass,
|
|
715
|
+
PickerComponent,
|
|
716
|
+
DatePipe,
|
|
717
|
+
TranslocoPipe,
|
|
718
|
+
TextTruncatePipe,
|
|
719
|
+
CommonPipe
|
|
720
|
+
],
|
|
720
721
|
template: "<div class=\"chat-application mt-5\">\n <div class=\"content-overlay\"></div>\n\n @if (isChatLoading) {\n <div class=\"text-center\">\n <p-progress-spinner> </p-progress-spinner>\n </div>\n }\n\n @if (!isChatLoading) {\n <div class=\"chat-sidebar float-start d-none d-sm-none d-md-block d-lg-block\">\n <div class=\"chat-sidebar-content\">\n <div class=\"chat-fixed-search p-2\">\n <div class=\"d-flex\">\n <p-auto-complete appendTo=\"body\" inputId=\"chatbox-search-member\"\n [(ngModel)]=\"searchText\"\n #searchTxt\n [placeholder]=\"'Messaging.Chatbox.SearchMembers' | transloco\"\n [ngModelOptions]=\"{ standalone: true }\"\n optionLabel=\"first_name\"\n (onSelect)=\"onMemberSelection(searchText)\"\n [suggestions]=\"recipients\"\n (completeMethod)=\"recipientSearch()\">\n <ng-template let-item #item>\n <div>\n {{ item.first_name + ' ' }}\n {{ item.last_name ? item.last_name : '' }}\n </div>\n </ng-template>\n </p-auto-complete>\n </div>\n </div>\n\n <!-- Thread/conversation List -->\n <div id=\"users-list\"\n class=\"list-group position-relative\">\n @if (conversations?.length) {\n <div class=\"users-list-padding\">\n @for (conversation of conversations; track trackConversationKey(conversation)) {\n <a class=\"list-group-item no-border\"\n (click)=\"onParticipantClick(conversation)\">\n <div class=\"d-flex\">\n <span class=\"avatar avatar-md avatar-away\">\n @if (conversation?.to?.avatar) {\n <img [src]=\"conversation.to?.avatar\"\n width=\"40\"\n height=\"40\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n conversation?.participants\n ? conversation.to?.slug.charAt(0).toUpperCase()\n : conversation.to?.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n </span>\n <div class=\"clearfix\">\n <h6 class=\"list-group-item-heading mb-1\">\n {{\n conversation.to?.name\n ? conversation.to?.name\n : conversation.to?.slug\n }}\n <span class=\"font-small-3 float-end ms-5 ps-5\">\n @if (conversation?.unread_count) {\n <span class=\"badge bg-primary rounded-pill bg-primary mx-1\">\n {{ conversation.unread_count }}\n </span>\n }\n {{ conversation.created_at | date: 'shortTime' }}\n </span>\n </h6>\n <p class=\"list-group-item-text text-muted\">\n {{ conversation?.latest_message?.body | textTruncate: 25 }}\n </p>\n </div>\n </div>\n </a>\n }\n </div>\n }\n </div>\n </div>\n </div>\n\n @if (conversations?.length) {\n <!-- Chat Header -->\n @if (otherUser) {\n <div class=\"chat-name p-2 bg-white\">\n <div class=\"d-flex\">\n <span class=\"chat-app-sidebar-toggle ft-align-justify font-large-1 me-2 d-none d-block d-sm-block d-md-none\"\n (keydown.enter)=\"toggleSidebar()\"\n (click)=\"toggleSidebar()\"></span>\n <div class=\"clearfix\">\n @if (currentConversation?.to?.avatar) {\n <img [src]=\"currentConversation?.to?.avatar\"\n width=\"40\"\n height=\"40\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\" />\n } @else {\n @if (currentUser) {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n otherUser?.name\n ? otherUser.name.charAt(0).toUpperCase()\n : otherUser.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n }\n\n @if (currentUser) {\n <strong class=\"mt-2\">{{\n otherUser.name ? otherUser.name : otherUser.slug\n }}</strong>\n }\n </div>\n </div>\n </div>\n }\n\n <!-- Chat Window -->\n <div class=\"chat-app-window\"\n id=\"chats-wrapper\"\n #scrollMe\n infinite-scroll\n [infiniteScrollDistance]=\"scrollDistance\"\n [scrollWindow]=\"false\"\n [infiniteScrollUpDistance]=\"scrollUpDistance\"\n [infiniteScrollThrottle]=\"throttle\"\n [alwaysCallback]=\"true\"\n (scrolledUp)=\"onUp($event, selectedConversationId)\">\n <div class=\"chats\">\n <!-- Shows Message -->\n @if (!isLoaded) {\n <div class=\"spinner\"></div>\n }\n @if (messagesGroupedByDate) {\n @for (item of ObjectKeys(messagesGroupedByDate); track item) {\n <strong class=\"badge bg-secondary mb-1\">{{\n messagesGroupedByDate[item][0]?.created_at | date\n }}</strong>\n <!-- Every Message -->\n @for (message of messagesGroupedByDate[item]; track message.id) {\n <div class=\"chat\"\n [ngClass]=\"{\n 'chat-left ms-2': message.sender_id !== currentUser.id,\n 'me-2': message.sender_id === currentUser.id\n }\">\n @if (message.body || message.attachment?.url) {\n <div class=\"chat-avatar\">\n <a class=\"avatar\"\n data-toggle=\"tooltip\"\n data-placement=\"right\"\n data-original-title=\"\">\n <!-- Setting up Avatar Image for Logged In User -->\n @if (message.sender_id === currentUser.id) {\n @if (currentUserImg) {\n <img [src]=\"currentUserImg\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar bg-brown\">\n <strong>{{\n currentUser?.name\n ? currentUser.name\n .charAt(0)\n .toUpperCase()\n : currentUser.slug\n .charAt(0)\n .toUpperCase()\n }}\n </strong>\n </div>\n }\n }\n\n <!-- Participant -->\n @if (message.sender_id !== currentUser.id) {\n @if (currentUser && otherUser?.avatar) {\n <img [src]=\"otherUser?.avatar\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar\">\n <strong>{{\n otherUser?.name\n ? otherUser.name\n .charAt(0)\n .toUpperCase()\n : otherUser.slug\n .charAt(0)\n .toUpperCase()\n }}</strong>\n </div>\n }\n }\n </a>\n </div>\n <div class=\"chat-body\">\n @if (!message?.attachment?.url) {\n <div class=\"chat-content attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.sender_id === currentUser.id && message.is_open) {\n <i\n class=\"fa fa-check-double msg-double-check\"\n ></i>\n }\n <p>{{ message.body }}</p>\n </div>\n } @else {\n <div class=\"chat-content with-attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.attachment) {\n <div class=\"message-attachment\">\n <i>\n @if (message?.messageType === ATTACHMENT_TYPE.IMG) {\n <img\n [src]=\"message.attachment.url\"\n class=\"img-thumbnail\"\n [alt]=\"'Messaging.Chatbox.AttachmentAlt' | transloco\"\n />\n }\n @if (message?.messageType === ATTACHMENT_TYPE.VIDEO) {\n <video\n width=\"320\"\n height=\"240\"\n controls\n class=\"img-thumbnail\"\n >\n <source\n [src]=\"message.attachment.url\"\n type=\"video/mp4\"\n />\n <track kind=\"subtitles\" srclang=\"en\" [label]=\"'Messaging.Chatbox.SubtitlesEnglish' | transloco\" />\n {{ 'Messaging.Chatbox.VideoNotSupported' | transloco }}\n </video>\n }\n <a\n [attr.href]=\"message.attachment.url\"\n target=\"_blank\"\n >\n <i\n class=\"fa fa-file-download me-2\"\n aria-hidden=\"true\"\n ></i>\n {{\n message.attachment.url\n | common: 'filename'\n }}</a>\n </i>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n }\n }\n\n @if (!messagesGroupedByDate && isLoaded) {\n <div class=\"mt-3 text-center\">{{ 'Messaging.Chatbox.NoHistory' | transloco }}</div>\n }\n\n @if (isFileUploading) {\n <i class=\"fa fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n\n <!-- Shows Metadata of the file being uploaded -->\n <div class=\"compose-message-attachment\">\n <div class=\"m-0\">\n @for (item of attachedFiles; track $index) {\n <div class=\"card px-3 py-2 m-0 mb-1\">\n <div class=\"card-body\">\n <div class=\"d-inline-block file-name\">{{ item.name }}</div>\n <div class=\"d-inline-block file-size\">{{ item.size }}</div>\n <div class=\"d-inline-block float-end file-remove\"\n (keydown.enter)=\"onRemoveAttachment(item)\"\n (click)=\"onRemoveAttachment(item)\">\n\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n\n <div [hidden]=\"!showEmoji\">\n <emoji-mart [title]=\"'Messaging.Chatbox.PickEmoji' | transloco\"\n set=\"facebook\"\n [showPreview]=\"false\"\n (emojiSelect)=\"onEmojiSelect($event)\"\n [emojiSize]=\"30\">\n </emoji-mart>\n </div>\n\n <!-- Compose Text box area -->\n <div class=\"chat-app-form bg-blue-grey bg-lighten-5\">\n <form class=\"chat-app-input row\">\n <fieldset class=\"mb-3 position-relative has-icon-left col-10 m-0 mb-1\">\n <div class=\"form-control-position emoji-container\">\n <button type=\"button\" class=\"emoji-toggle-btn\" [attr.aria-label]=\"'Messaging.Chatbox.InsertEmoji' | transloco\" (click)=\"showEmoji = !showEmoji\">🙂</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">{{ 'Messaging.Chatbox.MessageLabel' | transloco }}</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n [placeholder]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n [attr.aria-label]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">{{ 'BrainChat.AttachFile' | transloco }}</span>\n <i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>\n <input\n id=\"file-input\"\n name=\"file-input\"\n type=\"file\"\n (change)=\"fileChangeListener($event)\"\n size=\"60\"\n [attr.aria-label]=\"'Messaging.Chatbox.FileInput' | transloco\" />\n </label>\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"mb-3 position-relative has-icon-left col-2 m-0 mb-1\">\n <button type=\"button\"\n class=\"btn btn-primary d-lg-flex align-items-center btn-send\"\n (click)=\"onSendMessage()\">\n <i class=\"fa fa-paper-plane\"></i><span class=\"d-none d-lg-block ms-1\">{{ 'Messaging.Chatbox.Send' | transloco }}</span>\n </button>\n </fieldset>\n </form>\n </div>\n } @else {\n <div class=\"container-fluid pw-tab overflow-hidden no-message-center\">\n <div class=\"dashboard\">\n <div class=\"dashboard-body text-center mt-5\">\n <div>\n <img src=\"/assets/img/icons/empty-chat-icon.png\"\n [alt]=\"'Messaging.Chatbox.EmptyAlt' | transloco\" />\n </div>\n <div class=\"h4 mt-4\">{{ 'Messaging.Chatbox.Empty.Title' | transloco }}</div>\n <div class=\"mt-3\">\n <p>{{ 'Messaging.Chatbox.Empty.Text' | transloco }}</p>\n <p>{{ 'Messaging.Chatbox.Empty.Hint' | transloco }}</p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n",
|
|
721
722
|
styles: ["@charset \"UTF-8\";:root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_sub_bg: color-mix(in srgb, var(--first, rgb(23 105 225)) 85%, #000000);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255);--dashboard_bg: rgb(255 255 255);--pw-hairline: #e2e5ea;--public-btn-radius: 24px}:host ::ng-deep .chat-application{height:calc(100vh - 92px);position:relative}#drift-widget-container{display:none!important}#file-input{height:0;visibility:hidden;width:0}.message-attachment{color:#fff}.emoji-toggle-btn{background:transparent;border:0;color:#676767;cursor:pointer;font-size:20px;line-height:1;padding:4px 6px}.compose-message-attachment{bottom:0;color:#676767;left:0;position:absolute;width:55%}.compose-message-attachment .file-name{font-size:14px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:400px}.compose-message-attachment .file-size{width:100px}.compose-message-attachment .file-remove{width:45px}.compose-message-attachment .file-remove i{margin-left:37px;margin-top:7px}.fa-spinner{font-size:24px}.fa-paperclip{font-size:19px;margin-top:7px;width:13px}.dummy-avatar{background-color:#ff586b;border-radius:50%;color:#fff;font-size:18px;height:40px;line-height:40px;text-align:center;width:40px;display:inline-block}.card{border:1px solid rgb(204,204,204)}.msg-double-check{color:#4fc3f7;font-size:10px;left:-13px;position:absolute;top:11px}.btn-delete{display:none;left:-85px;position:absolute;top:11px}.chat-body:hover .btn-delete{display:block!important}.bg-brown{background-color:#cc6000}.btn-send{border-radius:5px;padding:7px 13px}@keyframes spinner{to{transform:rotate(360deg)}}.spinner{animation:spinner .6s linear infinite!important;border:3px solid rgb(204,204,204);border-radius:50%;border-top-color:#000;box-sizing:border-box;content:\"\";height:50px;left:50%;margin-left:-10px;margin-top:-10px;position:absolute;top:10%;width:50px}@media(min-width:768px){.no-message-center{margin-left:auto;width:calc(100% - 300px)}}\n"]
|
|
722
723
|
}]
|
|
723
724
|
}],
|
|
724
|
-
ctorParameters: () => [
|
|
725
|
-
{ type: i0.ElementRef },
|
|
726
|
-
{ type: i1$1.MailBoxService },
|
|
727
|
-
{ type: i1$1.ProfileService },
|
|
728
|
-
{ type: i1$1.WebsocketService },
|
|
729
|
-
{ type: i1$1.ScriptLoaderService },
|
|
730
|
-
{ type: i0.Injector },
|
|
731
|
-
{ type: i0.ChangeDetectorRef },
|
|
732
|
-
{ type: i2.ConfirmDialogService }
|
|
733
|
-
],
|
|
734
725
|
propDecorators: { messageInputRef: [{
|
|
735
726
|
type: ViewChild,
|
|
736
727
|
args: ["messageInput", { static: false }]
|
|
@@ -812,7 +803,6 @@ var MessagingModule = class MessagingModule {
|
|
|
812
803
|
version: "22.2.3",
|
|
813
804
|
ngImport: i0,
|
|
814
805
|
type: MessagingModule,
|
|
815
|
-
declarations: [ChatBoxComponent],
|
|
816
806
|
imports: [
|
|
817
807
|
CommonModule,
|
|
818
808
|
CoreTranslocoModule,
|
|
@@ -825,7 +815,8 @@ var MessagingModule = class MessagingModule {
|
|
|
825
815
|
EmojiModule,
|
|
826
816
|
NgxFileDropModule,
|
|
827
817
|
InfiniteScrollModule,
|
|
828
|
-
ScrollingModule
|
|
818
|
+
ScrollingModule,
|
|
819
|
+
ChatBoxComponent
|
|
829
820
|
],
|
|
830
821
|
exports: [RouterModule, ChatBoxComponent]
|
|
831
822
|
});
|
|
@@ -849,6 +840,7 @@ var MessagingModule = class MessagingModule {
|
|
|
849
840
|
NgxFileDropModule,
|
|
850
841
|
InfiniteScrollModule,
|
|
851
842
|
ScrollingModule,
|
|
843
|
+
ChatBoxComponent,
|
|
852
844
|
RouterModule
|
|
853
845
|
]
|
|
854
846
|
});
|
|
@@ -874,9 +866,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
874
866
|
EmojiModule,
|
|
875
867
|
NgxFileDropModule,
|
|
876
868
|
InfiniteScrollModule,
|
|
877
|
-
ScrollingModule
|
|
869
|
+
ScrollingModule,
|
|
870
|
+
ChatBoxComponent
|
|
878
871
|
],
|
|
879
|
-
declarations: [ChatBoxComponent],
|
|
880
872
|
exports: [RouterModule, ChatBoxComponent]
|
|
881
873
|
}]
|
|
882
874
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posiwise-messaging-module.mjs","names":["i1"],"sources":["../../../../libs/messaging-module/src/lib/chatbox/chatbox.component.ts","../../../../libs/messaging-module/src/lib/chatbox/chatbox.component.html","../../../../libs/messaging-module/src/lib/messaging-routing.module.ts","../../../../libs/messaging-module/src/lib/messaging.module.ts"],"sourcesContent":["import {\n ChangeDetectorRef,\n Component,\n DoCheck,\n ElementRef,\n Injector,\n OnDestroy,\n OnInit,\n ViewChild\n} from '@angular/core';\n\nimport { AppBaseComponent } from '@posiwise/app-base-component';\nimport {\n MailBoxService,\n PermissionService,\n ProfileService,\n ScriptLoaderService,\n WebsocketService\n} from '@posiwise/common-services';\nimport { ATTACHMENT_TYPE, ChatUser, Conversation, SOCKET_TYPE } from '@posiwise/common-utilities';\nimport { ConfirmDialogService } from '@posiwise/shared-components';\n\nimport groupBy from 'lodash/groupBy';\nimport sortBy from 'lodash/sortBy';\nimport uniqBy from 'lodash/uniqBy';\nimport moment from 'moment';\nimport { FileSystemFileEntry } from 'ngx-file-drop';\nimport { lastValueFrom } from 'rxjs';\n\nimport { ExtendedConversation, MessageChatUser } from '../shared/chatbox.interface';\n\n@Component({\n templateUrl: './chatbox.component.html',\n styleUrls: ['./chatbox.component.scss'],\n\n standalone: false\n})\nexport class ChatBoxComponent extends AppBaseComponent implements OnInit, OnDestroy, DoCheck {\n // Message Box Template Ref\n @ViewChild('messageInput', { static: false })\n messageInputRef: ElementRef;\n\n // File Upload Progress spinner\n isFileUploading: boolean;\n\n ObjectKeys = Object.keys;\n\n showEmoji = false;\n\n selectedConversationId: number;\n\n currentConversation: Conversation;\n\n // logged user\n currentUser: MessageChatUser;\n\n currentUserImg: string;\n\n // Conversation list\n private pristineConversation: Conversation[] = [];\n private isDrift = true;\n private readonly units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n private initialLoad = true;\n private selectedIndex = 0;\n private totalMessages = 0;\n private currentThreads = [];\n\n conversations: Conversation[] = [];\n\n // Active Chat User => other participant\n otherUser: ChatUser;\n\n // Boolean to unsubscribe on Destroy\n // List of messages per conversation Id\n messagesGroupedByDate = {};\n\n searchText: string;\n\n recipients = [];\n\n files = [];\n\n attachedFiles: { name: string; size: string }[] = [];\n\n isChatLoading = true;\n\n currentPage = 1;\n\n isLoaded = true;\n\n throttle = 300;\n\n scrollUpDistance = 2;\n\n scrollDistance = 1;\n subscriptionId: number;\n ATTACHMENT_TYPE = ATTACHMENT_TYPE;\n\n constructor(\n private elRef: ElementRef, // NOSONAR\n private readonly mailboxService: MailBoxService,\n private readonly profileService: ProfileService,\n private readonly socketService: WebsocketService,\n private readonly scriptLoader: ScriptLoaderService,\n injector: Injector,\n private readonly cdr: ChangeDetectorRef,\n private readonly confirmDialog: ConfirmDialogService\n ) {\n super(injector);\n }\n\n onImgError(event: Event, fallbackSrc: string): void {\n const img = event.target as HTMLImageElement | null;\n if (!img) return;\n if (img.src?.endsWith(fallbackSrc)) return;\n img.src = fallbackSrc;\n }\n\n onUp(_ev, conversationId) {\n this.currentPage++;\n const totalPages = Math.ceil(this.totalMessages / 10);\n // Prevent API call if all messages have been fetched\n if (this.currentPage <= totalPages) {\n this.loadMore(conversationId, this.currentPage);\n }\n }\n\n ngOnInit() {\n this.waitForJQuery(() => {\n this.scriptLoader.loadScriptOnce('head', '/assets/js/chat.js');\n });\n this.listenToNewMessage();\n this.subscriptionId = PermissionService.selectedSubscription?.id;\n this.userStore().subscribe(resp => {\n this.currentUser = resp;\n if (this.currentUser) {\n this.mailboxService\n .getConversations()\n .subscribe((response: ExtendedConversation[]) => {\n if (response?.length) {\n let raw;\n if (this.conversations.length > 0) {\n raw = this.conversations.find(x => x?.id === null);\n }\n response.forEach(x => {\n x.datetime = x.latest_message.created_at;\n });\n const chats = sortBy(response, 'datetime').reverse();\n this.pristineConversation = chats;\n this.conversations = [...chats];\n\n if (raw) {\n this.conversations.unshift(raw);\n }\n\n this.parseConversation();\n setTimeout(() => this.filterConversations());\n }\n\n if (this.initialLoad) {\n this.checkIfNewConversation();\n } else {\n this.activateThread();\n }\n this.cdr.markForCheck();\n })\n .add(() => {\n this.isChatLoading = false;\n this.initialLoad = false;\n this.cdr.markForCheck();\n });\n }\n this.cdr.markForCheck();\n });\n }\n private filterConversations(): void {\n this.conversations = this.conversations.filter(conversation => conversation.to);\n }\n ngDoCheck() {\n // Hiding Drift messenger for Chat-box (Drift service shut down - kept for future chat widget alternative)\n if (window['jQuery'] && this.isDrift) {\n if ($('#drift-widget-container').length > 0 && $('#drift-widget-container:visible')) {\n this.isDrift = false;\n $('#drift-widget-container').hide();\n }\n }\n }\n\n override ngOnDestroy(): void {\n if (window['jQuery']) {\n $('.drift-widget-container').show();\n }\n }\n\n private parseConversation() {\n this.conversations.forEach((element: Conversation, index) => {\n element.to = element.participants.find(x => x?.id !== this.currentUser?.id);\n element.from = element.participants.find(x => x?.id === this.currentUser?.id);\n if (index === 0) {\n this.currentUserImg = element.from?.avatar ?? '/assets/img/icons/male.png';\n }\n });\n }\n\n private activateThread() {\n setTimeout(() => {\n if (window['jQuery']) {\n const selector = `.list-group-item:nth-child(${this.selectedIndex + 1})`;\n $(selector)\n .removeClass('no-border')\n .addClass(\n 'list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2'\n );\n }\n });\n }\n\n private checkIfNewConversation() {\n this.route.fragment.subscribe((fragment: string) => {\n if (fragment) {\n // Check for existing conversation\n const existingConversation = this.conversations.find(x => x.to?.slug === fragment);\n if (existingConversation) {\n this.otherUser = existingConversation.to;\n // sets the active tab when navigate to chat page\n this.setActive(existingConversation);\n } else {\n this.newParticipant(fragment);\n }\n } else if (this.conversations.length > 0) {\n this.router.navigate(['/message'], { fragment: this.conversations[0].to?.slug });\n }\n this.cdr.markForCheck();\n });\n }\n\n onParticipantClick(conversation) {\n this.otherUser = conversation.participants.find(x => x?.id !== this.currentUser?.id);\n const slug = this.otherUser?.slug;\n this.clearUnreadCount();\n this.router.navigate(['/message'], { fragment: slug });\n }\n\n private newParticipant(slug) {\n this.profileService.getUserProfile(slug).subscribe(response => {\n this.otherUser = response;\n\n const to = new ChatUser(\n response?.id,\n response?.first_name,\n response?.slug,\n response?.email,\n response?.avatar ? response?.avatar[0]?.url : '',\n new Date()\n );\n\n const from = new ChatUser(\n this.currentUser?.id,\n this.currentUser?.firstName,\n this.currentUser?.slug,\n this.currentUser?.email,\n this.currentUser?.avatar\n ? this.currentUser?.avatar[0].url\n : '/assets/img/icons/male.png',\n new Date()\n );\n\n const newConversation = new Conversation(\n null,\n 1,\n null,\n 'chat',\n [to, from],\n null,\n 0,\n from,\n to\n );\n\n this.conversations.unshift(newConversation);\n this.setActive(this.conversations[0]);\n this.cdr.markForCheck();\n });\n }\n\n // chat user list click event function\n private setActive(conversation) {\n this.currentPage = 0;\n this.currentThreads = [];\n this.totalMessages = 0;\n this.otherUser = conversation.participants.find(x => x?.id !== this.currentUser?.id);\n\n this.selectedConversationId = conversation?.id;\n this.currentConversation = conversation;\n\n const hElement: HTMLElement = this.elRef.nativeElement;\n // now you can simply get your elements with their class name\n const allAnchors = hElement.getElementsByClassName('list-group-item');\n // do something with selected elements\n Array.from(allAnchors).forEach((item: Element) => {\n item.setAttribute('class', 'list-group-item no-border');\n });\n\n const index = this.conversations.findIndex(x => x?.to?.id === this.otherUser?.id) || 0;\n setTimeout(() => {\n if (window['jQuery']) {\n $(`.list-group-item:nth-child(${index + 1})`)\n .removeClass('no-border')\n .addClass(\n 'list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2'\n );\n this.selectedIndex = $('.list-group-item.border-right-2').index();\n }\n }, 500);\n\n this.markAsRead(conversation?.id);\n this.getMessage(conversation?.id);\n }\n\n search(searchTxt) {\n if (searchTxt?.value?.length > 2) {\n this.conversations = this.pristineConversation.filter(\n x => x.to.slug.includes(searchTxt.value) ?? x.to?.email.includes(searchTxt.value)\n );\n } else {\n this.conversations = this.pristineConversation;\n }\n }\n\n // Socket For Listening to new Message\n private listenToNewMessage() {\n this.socketService.webSocket$.subscribe(\n (result: {\n event: string;\n new_conversation: string;\n data: {\n formattedDate: string;\n created_at: string;\n conversation_id: number;\n };\n id: number;\n }) => {\n if (result.event === SOCKET_TYPE.MSG) {\n if (result?.new_conversation === 'false') {\n const newMessage = result?.data;\n newMessage.formattedDate = moment(new Date(newMessage.created_at)).format(\n 'YYYYMMDD'\n );\n\n // Append the new message to conversation\n const conversation = this.conversations.find(x => x?.id === result?.id);\n if (conversation) {\n conversation.latest_message = result.data;\n conversation.created_at = newMessage.created_at;\n conversation.unread_count += 1;\n }\n\n if (\n newMessage.conversation_id === this.selectedConversationId &&\n newMessage.formattedDate in this.messagesGroupedByDate\n ) {\n this.messagesGroupedByDate[newMessage.formattedDate].push(newMessage);\n this.animateOnScroll();\n }\n } else if (result && typeof result.new_conversation === 'object') {\n this.conversations.unshift(result.new_conversation);\n this.parseConversation();\n }\n }\n this.cdr.markForCheck();\n }\n );\n }\n\n getMessage(messageId, reload = true) {\n if (reload) {\n this.messagesGroupedByDate = null;\n }\n if (messageId) {\n this.isLoaded = false;\n\n this.mailboxService\n .getMessages(messageId)\n .subscribe(response => {\n if (response) {\n this.totalMessages = response.object_count;\n this.currentThreads = response.messages;\n const ifExist = this.conversations.some(x => x?.id === response?.id);\n if (!ifExist) {\n this.conversations.find(x => x?.id === null).id = response?.id;\n }\n\n const messages = sortBy(response.messages, 'created_at');\n\n messages.forEach(msg => {\n msg.messageType = msg.attachment.url\n ? this.getMessageType(msg.attachment.url)\n : null;\n });\n this.messagesGroupedByDate = groupBy(messages, (o: Conversation) => {\n return moment(o.created_at).format('YYYYMMDD');\n });\n\n // Append the latest message to conversation list\n const current = this.conversations.find(\n x => x?.id === response?.id\n ).latest_message;\n if (current) {\n current.body = response.messages[0].body;\n current.created_at = response.messages[0].created_at;\n }\n }\n this.cdr.markForCheck();\n })\n .add(() => {\n this.isChatLoading = false;\n this.isLoaded = true;\n this.animateOnScroll();\n this.cdr.markForCheck();\n });\n }\n }\n\n private loadMore(conversationId, pageNumber, pageSize = 10) {\n this.mailboxService\n .getMessages(conversationId, pageNumber, pageSize)\n .subscribe(response => {\n if (response) {\n this.currentThreads = uniqBy(\n this.currentThreads.concat(response.messages),\n 'id'\n );\n const messages = sortBy(this.currentThreads, 'created_at');\n this.messagesGroupedByDate = groupBy(messages, (o: Conversation) => {\n return moment(o.created_at).format('YYYYMMDD');\n });\n }\n this.cdr.markForCheck();\n });\n }\n\n private clearUnreadCount() {\n this.mailboxService.decrementUnreadCount(this.currentConversation?.unread_count);\n if (this.currentConversation?.['unread_count']) {\n this.currentConversation['unread_count'] = 0;\n }\n }\n\n onSendMessage() {\n const text = this.messageInputRef.nativeElement.value;\n const formData = new FormData();\n formData.append('to', this.otherUser?.email);\n formData.append('message', text);\n formData.append('type', '1');\n formData.append('subscription_id', `${this.subscriptionId}`);\n\n if (this.files?.length) {\n this.isFileUploading = true;\n formData.append('file', this.files[0], this.files[0].name);\n }\n\n if (text || this.files.length > 0) {\n this.mailboxService\n .postMessage(formData)\n .subscribe(response => {\n this.files = [];\n this.attachedFiles = [];\n this.messageInputRef.nativeElement.value = '';\n this.messageInputRef.nativeElement.focus();\n this.getMessage(response.conversation_id, false);\n this.cdr.markForCheck();\n })\n .add(() => {\n this.isFileUploading = false;\n this.cdr.markForCheck();\n });\n }\n }\n\n private markAsRead(conversationId) {\n if (conversationId) {\n this.clearUnreadCount();\n this.mailboxService.markAsRead(conversationId).subscribe(() => {\n this.conversations.find(x => x?.id === conversationId).unread_count = 0;\n this.cdr.markForCheck();\n });\n }\n }\n\n private transform(bytes = 0, precision = 2) {\n // eslint-disable-next-line no-restricted-globals\n if (Number.isNaN(Number.parseFloat(String(bytes))) || !Number.isFinite(bytes)) {\n return '?';\n }\n let unit = 0;\n\n while (bytes >= 1024) {\n bytes /= 1024;\n unit++;\n }\n\n return `${bytes.toFixed(+precision)} ${this.units[unit]}`;\n }\n\n dropped(files) {\n // eslint-disable-next-line no-restricted-syntax\n for (const droppedFile of files) {\n // Is it a file?\n if (droppedFile.fileEntry.isFile) {\n const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;\n fileEntry.file((file: File) => {\n this.files.push(file);\n this.attachedFiles.push({\n name: file.name,\n size: this.transform(Number(file.size))\n });\n });\n }\n }\n }\n\n onRemoveAttachment(item) {\n this.files = this.files.filter(x => x.name !== item.name);\n this.attachedFiles = this.attachedFiles.filter(x => x.name !== item.name);\n }\n\n fileOver(_event) {\n console.log();\n }\n\n onEmojiSelect($event) {\n this.messageInputRef.nativeElement.value += $event.emoji.native;\n this.showEmoji = false;\n }\n\n fileChangeListener($event) {\n const file: File = $event.target.files[0];\n this.files.push(file);\n this.attachedFiles.push({\n name: file.name,\n size: this.transform(Number(file.size / 1024))\n });\n }\n\n toggleSidebar() {\n if (window['jQuery']) {\n $('.chat-sidebar').removeClass('d-none d-sm-none').addClass('d-block d-sm-block');\n $('.content-overlay').addClass('show');\n }\n }\n\n trackByMessageId(_index, item) {\n return item?.id;\n }\n\n trackConversationKey(conversation: Conversation): string | number {\n return conversation?.id ?? conversation?.to?.slug ?? conversation?.to?.id ?? '';\n }\n\n private animateOnScroll() {\n setTimeout(() => {\n if (window['jQuery'] && $('#chats-wrapper')?.length) {\n $('#chats-wrapper')\n .stop()\n .animate(\n {\n scrollTop: $('#chats-wrapper')[0].scrollHeight\n },\n 800\n );\n }\n });\n }\n\n private getMessageType(filename): string {\n const ext = this.getExtension(filename);\n switch (ext.toLowerCase()) {\n case 'jpg':\n case 'gif':\n case 'bmp':\n case 'png':\n return ATTACHMENT_TYPE.IMG;\n case 'm4v':\n case 'avi':\n case 'mpg':\n case 'mp4':\n return ATTACHMENT_TYPE.VIDEO;\n default:\n return '';\n }\n }\n\n private getExtension(filename) {\n const parts = filename.split('.');\n\n return parts[parts.length - 1];\n }\n\n recipientSearch() {\n lastValueFrom(\n this.mailboxService.getRecipient({\n page: 1,\n page_size: 20,\n subscription_id: PermissionService.selectedSubscription?.id,\n search: this.searchText\n })\n ).then(response => {\n this.recipients = response.filter(x => x?.id !== this.currentUser?.id);\n this.cdr.markForCheck();\n });\n }\n\n onMemberSelection(member) {\n this.otherUser = member;\n this.router.navigate(['/message'], { fragment: member.slug });\n }\n\n onDeleteMessage(message) {\n this.confirmDialog\n .confirmDelete({\n textKey: 'Common.Confirm.Delete.TextSimple',\n textParams: { entityType: 'message' }\n })\n .then(ok => {\n if (!ok) {\n return;\n }\n this.mailboxService\n .deleteMessage(this.selectedConversationId, message?.id)\n .subscribe(response => {\n if (response?.status_code === 200) {\n const createdAt = moment(message.created_at).format('YYYYMMDD');\n // eslint-disable-next-line no-restricted-syntax\n for (const property in this.messagesGroupedByDate) {\n if (property === createdAt) {\n this.messagesGroupedByDate[property] =\n this.messagesGroupedByDate[property].filter(\n x => x?.id !== message?.id\n );\n }\n }\n }\n this.cdr.markForCheck();\n });\n });\n }\n\n private waitForJQuery(callback: () => void): void {\n let attempts = 0;\n const maxAttempts = 100; // 10 seconds max wait time\n\n const checkJQuery = () => {\n if (window['jQuery']) {\n console.log('jQuery detected, loading chat.js');\n callback();\n } else if (attempts < maxAttempts) {\n attempts++;\n setTimeout(checkJQuery, 100);\n } else {\n console.log('jQuery not available, loading it now for chatbox');\n // Load jQuery since it's needed\n this.loadJQueryForChatbox(callback);\n }\n };\n checkJQuery();\n }\n\n private loadJQueryForChatbox(callback: () => void): void {\n const jquerySrc = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js';\n const script = document.createElement('script');\n script.src = jquerySrc;\n script.crossOrigin = 'anonymous';\n script.async = false;\n script.onload = () => {\n console.log('jQuery loaded for chatbox');\n callback();\n };\n script.onerror = () => {\n console.error('Failed to load jQuery for chatbox');\n // Try fallback\n const fallbackScript = document.createElement('script');\n fallbackScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js';\n fallbackScript.integrity =\n 'sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK';\n fallbackScript.crossOrigin = 'anonymous';\n fallbackScript.async = false;\n fallbackScript.onload = () => {\n console.log('jQuery loaded from Google CDN for chatbox');\n callback();\n };\n fallbackScript.onerror = () => {\n console.error('All jQuery CDNs failed for chatbox');\n };\n document.head.appendChild(fallbackScript);\n };\n document.head.appendChild(script);\n }\n}\n","<div class=\"chat-application mt-5\">\n <div class=\"content-overlay\"></div>\n\n @if (isChatLoading) {\n <div class=\"text-center\">\n <p-progress-spinner> </p-progress-spinner>\n </div>\n }\n\n @if (!isChatLoading) {\n <div class=\"chat-sidebar float-start d-none d-sm-none d-md-block d-lg-block\">\n <div class=\"chat-sidebar-content\">\n <div class=\"chat-fixed-search p-2\">\n <div class=\"d-flex\">\n <p-auto-complete appendTo=\"body\" inputId=\"chatbox-search-member\"\n [(ngModel)]=\"searchText\"\n #searchTxt\n [placeholder]=\"'Messaging.Chatbox.SearchMembers' | transloco\"\n [ngModelOptions]=\"{ standalone: true }\"\n optionLabel=\"first_name\"\n (onSelect)=\"onMemberSelection(searchText)\"\n [suggestions]=\"recipients\"\n (completeMethod)=\"recipientSearch()\">\n <ng-template let-item #item>\n <div>\n {{ item.first_name + ' ' }}\n {{ item.last_name ? item.last_name : '' }}\n </div>\n </ng-template>\n </p-auto-complete>\n </div>\n </div>\n\n <!-- Thread/conversation List -->\n <div id=\"users-list\"\n class=\"list-group position-relative\">\n @if (conversations?.length) {\n <div class=\"users-list-padding\">\n @for (conversation of conversations; track trackConversationKey(conversation)) {\n <a class=\"list-group-item no-border\"\n (click)=\"onParticipantClick(conversation)\">\n <div class=\"d-flex\">\n <span class=\"avatar avatar-md avatar-away\">\n @if (conversation?.to?.avatar) {\n <img [src]=\"conversation.to?.avatar\"\n width=\"40\"\n height=\"40\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n conversation?.participants\n ? conversation.to?.slug.charAt(0).toUpperCase()\n : conversation.to?.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n </span>\n <div class=\"clearfix\">\n <h6 class=\"list-group-item-heading mb-1\">\n {{\n conversation.to?.name\n ? conversation.to?.name\n : conversation.to?.slug\n }}\n <span class=\"font-small-3 float-end ms-5 ps-5\">\n @if (conversation?.unread_count) {\n <span class=\"badge bg-primary rounded-pill bg-primary mx-1\">\n {{ conversation.unread_count }}\n </span>\n }\n {{ conversation.created_at | date: 'shortTime' }}\n </span>\n </h6>\n <p class=\"list-group-item-text text-muted\">\n {{ conversation?.latest_message?.body | textTruncate: 25 }}\n </p>\n </div>\n </div>\n </a>\n }\n </div>\n }\n </div>\n </div>\n </div>\n\n @if (conversations?.length) {\n <!-- Chat Header -->\n @if (otherUser) {\n <div class=\"chat-name p-2 bg-white\">\n <div class=\"d-flex\">\n <span class=\"chat-app-sidebar-toggle ft-align-justify font-large-1 me-2 d-none d-block d-sm-block d-md-none\"\n (keydown.enter)=\"toggleSidebar()\"\n (click)=\"toggleSidebar()\"></span>\n <div class=\"clearfix\">\n @if (currentConversation?.to?.avatar) {\n <img [src]=\"currentConversation?.to?.avatar\"\n width=\"40\"\n height=\"40\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\" />\n } @else {\n @if (currentUser) {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n otherUser?.name\n ? otherUser.name.charAt(0).toUpperCase()\n : otherUser.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n }\n\n @if (currentUser) {\n <strong class=\"mt-2\">{{\n otherUser.name ? otherUser.name : otherUser.slug\n }}</strong>\n }\n </div>\n </div>\n </div>\n }\n\n <!-- Chat Window -->\n <div class=\"chat-app-window\"\n id=\"chats-wrapper\"\n #scrollMe\n infinite-scroll\n [infiniteScrollDistance]=\"scrollDistance\"\n [scrollWindow]=\"false\"\n [infiniteScrollUpDistance]=\"scrollUpDistance\"\n [infiniteScrollThrottle]=\"throttle\"\n [alwaysCallback]=\"true\"\n (scrolledUp)=\"onUp($event, selectedConversationId)\">\n <div class=\"chats\">\n <!-- Shows Message -->\n @if (!isLoaded) {\n <div class=\"spinner\"></div>\n }\n @if (messagesGroupedByDate) {\n @for (item of ObjectKeys(messagesGroupedByDate); track item) {\n <strong class=\"badge bg-secondary mb-1\">{{\n messagesGroupedByDate[item][0]?.created_at | date\n }}</strong>\n <!-- Every Message -->\n @for (message of messagesGroupedByDate[item]; track message.id) {\n <div class=\"chat\"\n [ngClass]=\"{\n 'chat-left ms-2': message.sender_id !== currentUser.id,\n 'me-2': message.sender_id === currentUser.id\n }\">\n @if (message.body || message.attachment?.url) {\n <div class=\"chat-avatar\">\n <a class=\"avatar\"\n data-toggle=\"tooltip\"\n data-placement=\"right\"\n data-original-title=\"\">\n <!-- Setting up Avatar Image for Logged In User -->\n @if (message.sender_id === currentUser.id) {\n @if (currentUserImg) {\n <img [src]=\"currentUserImg\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar bg-brown\">\n <strong>{{\n currentUser?.name\n ? currentUser.name\n .charAt(0)\n .toUpperCase()\n : currentUser.slug\n .charAt(0)\n .toUpperCase()\n }}\n </strong>\n </div>\n }\n }\n\n <!-- Participant -->\n @if (message.sender_id !== currentUser.id) {\n @if (currentUser && otherUser?.avatar) {\n <img [src]=\"otherUser?.avatar\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar\">\n <strong>{{\n otherUser?.name\n ? otherUser.name\n .charAt(0)\n .toUpperCase()\n : otherUser.slug\n .charAt(0)\n .toUpperCase()\n }}</strong>\n </div>\n }\n }\n </a>\n </div>\n <div class=\"chat-body\">\n @if (!message?.attachment?.url) {\n <div class=\"chat-content attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.sender_id === currentUser.id && message.is_open) {\n <i\n class=\"fa fa-check-double msg-double-check\"\n ></i>\n }\n <p>{{ message.body }}</p>\n </div>\n } @else {\n <div class=\"chat-content with-attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.attachment) {\n <div class=\"message-attachment\">\n <i>\n @if (message?.messageType === ATTACHMENT_TYPE.IMG) {\n <img\n [src]=\"message.attachment.url\"\n class=\"img-thumbnail\"\n [alt]=\"'Messaging.Chatbox.AttachmentAlt' | transloco\"\n />\n }\n @if (message?.messageType === ATTACHMENT_TYPE.VIDEO) {\n <video\n width=\"320\"\n height=\"240\"\n controls\n class=\"img-thumbnail\"\n >\n <source\n [src]=\"message.attachment.url\"\n type=\"video/mp4\"\n />\n <track kind=\"subtitles\" srclang=\"en\" [label]=\"'Messaging.Chatbox.SubtitlesEnglish' | transloco\" />\n {{ 'Messaging.Chatbox.VideoNotSupported' | transloco }}\n </video>\n }\n <a\n [attr.href]=\"message.attachment.url\"\n target=\"_blank\"\n >\n <i\n class=\"fa fa-file-download me-2\"\n aria-hidden=\"true\"\n ></i>\n {{\n message.attachment.url\n | common: 'filename'\n }}</a>\n </i>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n }\n }\n\n @if (!messagesGroupedByDate && isLoaded) {\n <div class=\"mt-3 text-center\">{{ 'Messaging.Chatbox.NoHistory' | transloco }}</div>\n }\n\n @if (isFileUploading) {\n <i class=\"fa fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n\n <!-- Shows Metadata of the file being uploaded -->\n <div class=\"compose-message-attachment\">\n <div class=\"m-0\">\n @for (item of attachedFiles; track $index) {\n <div class=\"card px-3 py-2 m-0 mb-1\">\n <div class=\"card-body\">\n <div class=\"d-inline-block file-name\">{{ item.name }}</div>\n <div class=\"d-inline-block file-size\">{{ item.size }}</div>\n <div class=\"d-inline-block float-end file-remove\"\n (keydown.enter)=\"onRemoveAttachment(item)\"\n (click)=\"onRemoveAttachment(item)\">\n\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n\n <div [hidden]=\"!showEmoji\">\n <emoji-mart [title]=\"'Messaging.Chatbox.PickEmoji' | transloco\"\n set=\"facebook\"\n [showPreview]=\"false\"\n (emojiSelect)=\"onEmojiSelect($event)\"\n [emojiSize]=\"30\">\n </emoji-mart>\n </div>\n\n <!-- Compose Text box area -->\n <div class=\"chat-app-form bg-blue-grey bg-lighten-5\">\n <form class=\"chat-app-input row\">\n <fieldset class=\"mb-3 position-relative has-icon-left col-10 m-0 mb-1\">\n <div class=\"form-control-position emoji-container\">\n <button type=\"button\" class=\"emoji-toggle-btn\" [attr.aria-label]=\"'Messaging.Chatbox.InsertEmoji' | transloco\" (click)=\"showEmoji = !showEmoji\">🙂</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">{{ 'Messaging.Chatbox.MessageLabel' | transloco }}</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n [placeholder]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n [attr.aria-label]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">{{ 'BrainChat.AttachFile' | transloco }}</span>\n <i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>\n <input\n id=\"file-input\"\n name=\"file-input\"\n type=\"file\"\n (change)=\"fileChangeListener($event)\"\n size=\"60\"\n [attr.aria-label]=\"'Messaging.Chatbox.FileInput' | transloco\" />\n </label>\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"mb-3 position-relative has-icon-left col-2 m-0 mb-1\">\n <button type=\"button\"\n class=\"btn btn-primary d-lg-flex align-items-center btn-send\"\n (click)=\"onSendMessage()\">\n <i class=\"fa fa-paper-plane\"></i><span class=\"d-none d-lg-block ms-1\">{{ 'Messaging.Chatbox.Send' | transloco }}</span>\n </button>\n </fieldset>\n </form>\n </div>\n } @else {\n <div class=\"container-fluid pw-tab overflow-hidden no-message-center\">\n <div class=\"dashboard\">\n <div class=\"dashboard-body text-center mt-5\">\n <div>\n <img src=\"/assets/img/icons/empty-chat-icon.png\"\n [alt]=\"'Messaging.Chatbox.EmptyAlt' | transloco\" />\n </div>\n <div class=\"h4 mt-4\">{{ 'Messaging.Chatbox.Empty.Title' | transloco }}</div>\n <div class=\"mt-3\">\n <p>{{ 'Messaging.Chatbox.Empty.Text' | transloco }}</p>\n <p>{{ 'Messaging.Chatbox.Empty.Hint' | transloco }}</p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n","import { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\n\nimport { ChatBoxComponent } from './chatbox/chatbox.component';\n\nconst routes: Routes = [\n {\n path: '',\n component: ChatBoxComponent,\n data: {\n title: 'Chat',\n titleKey: 'Menu.Chat'\n }\n },\n {\n path: ':memberId',\n component: ChatBoxComponent,\n data: {\n title: 'Chat',\n titleKey: 'Menu.Chat'\n }\n }\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule]\n})\nexport class MessageRoutingModule {}\n","import { ScrollingModule } from '@angular/cdk/scrolling';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { RouterModule } from '@angular/router';\n\nimport { CoreTranslocoModule } from '@posiwise/core-transloco';\nimport { PipesModule } from '@posiwise/pipes';\n\nimport { NgxFileDropModule } from 'ngx-file-drop';\nimport { InfiniteScrollModule } from 'ngx-infinite-scroll';\nimport { AutoCompleteModule } from 'primeng/autocomplete';\nimport { ProgressSpinnerModule } from 'primeng/progressspinner';\n\nimport { PickerModule } from '@ctrl/ngx-emoji-mart';\nimport { EmojiModule } from '@ctrl/ngx-emoji-mart/ngx-emoji';\n\nimport { ChatBoxComponent } from './chatbox/chatbox.component';\nimport { MessageRoutingModule } from './messaging-routing.module';\n\n@NgModule({\n imports: [\n CommonModule,\n CoreTranslocoModule,\n PipesModule,\n FormsModule,\n MessageRoutingModule,\n ProgressSpinnerModule,\n AutoCompleteModule,\n PickerModule,\n EmojiModule,\n NgxFileDropModule,\n InfiniteScrollModule,\n ScrollingModule\n ],\n declarations: [ChatBoxComponent],\n exports: [RouterModule, ChatBoxComponent]\n})\nexport class MessagingModule {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,mBAAb,MAAa,yBAAyB,iBAAgB;CA6DlD,YACY,OACS,gBACA,gBACA,eACA,cACjB,UACiB,KACA,eAAmC;EAEpD,MAAM,QAAQ;EATN,KAAA,QAAA;EACS,KAAA,iBAAA;EACA,KAAA,iBAAA;EACA,KAAA,gBAAA;EACA,KAAA,eAAA;EAEA,KAAA,MAAA;EACA,KAAA,gBAAA;EA7DrB,KAAA,aAAa,OAAO;EAEpB,KAAA,YAAY;EAYJ,KAAA,uBAAuC,CAAA;EACvC,KAAA,UAAU;EACD,KAAA,QAAQ;GAAC;GAAK;GAAM;GAAM;GAAM;GAAM;EAAI;EACnD,KAAA,cAAc;EACd,KAAA,gBAAgB;EAChB,KAAA,gBAAgB;EAChB,KAAA,iBAAiB,CAAA;EAEzB,KAAA,gBAAgC,CAAA;EAOhC,KAAA,wBAAwB,CAAA;EAIxB,KAAA,aAAa,CAAA;EAEb,KAAA,QAAQ,CAAA;EAER,KAAA,gBAAkD,CAAA;EAElD,KAAA,gBAAgB;EAEhB,KAAA,cAAc;EAEd,KAAA,WAAW;EAEX,KAAA,WAAW;EAEX,KAAA,mBAAmB;EAEnB,KAAA,iBAAiB;EAEjB,KAAA,kBAAkB;CAalB;CAEA,WAAW,OAAc,aAAmB;EACxC,MAAM,MAAM,MAAM;EAClB,IAAI,CAAC,KAAK;EACV,IAAI,IAAI,KAAK,SAAS,WAAW,GA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HT,gBAAgB;GAAA,SAAA;IAb3B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GAAe;GAAA,SAAA,CAGT,cAAc,gBAAgB;EAAA,CAAA;CAAA;CAE/B;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAe,SAAA;IAhBpB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGM;GAAY;EAAA,CAAA;CAAA;;AAEb,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAlB3B,MAAA;EAAS,MAAA,CAAA;GACN,SAAS;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACH;GACD,cAAc,CAAC,gBAAgB;GAC/B,SAAS,CAAC,cAAc,gBAAgB;EAC3C,CAAA"}
|
|
1
|
+
{"version":3,"file":"posiwise-messaging-module.mjs","names":["i1"],"sources":["../../../../libs/messaging-module/src/lib/chatbox/chatbox.component.ts","../../../../libs/messaging-module/src/lib/chatbox/chatbox.component.html","../../../../libs/messaging-module/src/lib/messaging-routing.module.ts","../../../../libs/messaging-module/src/lib/messaging.module.ts"],"sourcesContent":["import { DatePipe, NgClass } from '@angular/common';\nimport {\n ChangeDetectorRef,\n Component,\n DoCheck,\n ElementRef,\n inject,\n OnDestroy,\n OnInit,\n ViewChild\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { AppBaseComponent } from '@posiwise/app-base-component';\nimport {\n MailBoxService,\n PermissionService,\n ProfileService,\n ScriptLoaderService,\n WebsocketService\n} from '@posiwise/common-services';\nimport { ATTACHMENT_TYPE, ChatUser, Conversation, SOCKET_TYPE } from '@posiwise/common-utilities';\nimport { CommonPipe, TextTruncatePipe } from '@posiwise/pipes';\nimport { ConfirmDialogService } from '@posiwise/shared-components';\n\nimport groupBy from 'lodash/groupBy';\nimport sortBy from 'lodash/sortBy';\nimport uniqBy from 'lodash/uniqBy';\nimport moment from 'moment';\nimport { FileSystemFileEntry } from 'ngx-file-drop';\nimport { InfiniteScrollDirective } from 'ngx-infinite-scroll';\nimport { AutoComplete } from 'primeng/autocomplete';\nimport { Bind } from 'primeng/bind';\nimport { ProgressSpinner } from 'primeng/progressspinner';\nimport { lastValueFrom } from 'rxjs';\n\nimport { PickerComponent } from '@ctrl/ngx-emoji-mart';\nimport { TranslocoPipe } from '@jsverse/transloco';\n\nimport { ExtendedConversation, MessageChatUser } from '../shared/chatbox.interface';\n\n@Component({\n templateUrl: './chatbox.component.html',\n styleUrls: ['./chatbox.component.scss'],\n imports: [\n Bind,\n ProgressSpinner,\n AutoComplete,\n FormsModule,\n InfiniteScrollDirective,\n NgClass,\n PickerComponent,\n DatePipe,\n TranslocoPipe,\n TextTruncatePipe,\n CommonPipe\n ]\n})\nexport class ChatBoxComponent extends AppBaseComponent implements OnInit, OnDestroy, DoCheck {\n private elRef = inject(ElementRef);\n private readonly mailboxService = inject(MailBoxService);\n private readonly profileService = inject(ProfileService);\n private readonly socketService = inject(WebsocketService);\n private readonly scriptLoader = inject(ScriptLoaderService);\n private readonly cdr = inject(ChangeDetectorRef);\n private readonly confirmDialog = inject(ConfirmDialogService);\n\n // Message Box Template Ref\n @ViewChild('messageInput', { static: false })\n messageInputRef: ElementRef;\n\n // File Upload Progress spinner\n isFileUploading: boolean;\n\n ObjectKeys = Object.keys;\n\n showEmoji = false;\n\n selectedConversationId: number;\n\n currentConversation: Conversation;\n\n // logged user\n currentUser: MessageChatUser;\n\n currentUserImg: string;\n\n // Conversation list\n private pristineConversation: Conversation[] = [];\n private isDrift = true;\n private readonly units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n private initialLoad = true;\n private selectedIndex = 0;\n private totalMessages = 0;\n private currentThreads = [];\n\n conversations: Conversation[] = [];\n\n // Active Chat User => other participant\n otherUser: ChatUser;\n\n // Boolean to unsubscribe on Destroy\n // List of messages per conversation Id\n messagesGroupedByDate = {};\n\n searchText: string;\n\n recipients = [];\n\n files = [];\n\n attachedFiles: { name: string; size: string }[] = [];\n\n isChatLoading = true;\n\n currentPage = 1;\n\n isLoaded = true;\n\n throttle = 300;\n\n scrollUpDistance = 2;\n\n scrollDistance = 1;\n subscriptionId: number;\n ATTACHMENT_TYPE = ATTACHMENT_TYPE;\n\n onImgError(event: Event, fallbackSrc: string): void {\n const img = event.target as HTMLImageElement | null;\n if (!img) return;\n if (img.src?.endsWith(fallbackSrc)) return;\n img.src = fallbackSrc;\n }\n\n onUp(_ev, conversationId) {\n this.currentPage++;\n const totalPages = Math.ceil(this.totalMessages / 10);\n // Prevent API call if all messages have been fetched\n if (this.currentPage <= totalPages) {\n this.loadMore(conversationId, this.currentPage);\n }\n }\n\n ngOnInit() {\n this.waitForJQuery(() => {\n this.scriptLoader.loadScriptOnce('head', '/assets/js/chat.js');\n });\n this.listenToNewMessage();\n this.subscriptionId = PermissionService.selectedSubscription?.id;\n this.userStore().subscribe(resp => {\n this.currentUser = resp;\n if (this.currentUser) {\n this.mailboxService\n .getConversations()\n .subscribe((response: ExtendedConversation[]) => {\n if (response?.length) {\n let raw;\n if (this.conversations.length > 0) {\n raw = this.conversations.find(x => x?.id === null);\n }\n response.forEach(x => {\n x.datetime = x.latest_message.created_at;\n });\n const chats = sortBy(response, 'datetime').reverse();\n this.pristineConversation = chats;\n this.conversations = [...chats];\n\n if (raw) {\n this.conversations.unshift(raw);\n }\n\n this.parseConversation();\n setTimeout(() => this.filterConversations());\n }\n\n if (this.initialLoad) {\n this.checkIfNewConversation();\n } else {\n this.activateThread();\n }\n this.cdr.markForCheck();\n })\n .add(() => {\n this.isChatLoading = false;\n this.initialLoad = false;\n this.cdr.markForCheck();\n });\n }\n this.cdr.markForCheck();\n });\n }\n private filterConversations(): void {\n this.conversations = this.conversations.filter(conversation => conversation.to);\n }\n ngDoCheck() {\n // Hiding Drift messenger for Chat-box (Drift service shut down - kept for future chat widget alternative)\n if (window['jQuery'] && this.isDrift) {\n if ($('#drift-widget-container').length > 0 && $('#drift-widget-container:visible')) {\n this.isDrift = false;\n $('#drift-widget-container').hide();\n }\n }\n }\n\n override ngOnDestroy(): void {\n if (window['jQuery']) {\n $('.drift-widget-container').show();\n }\n }\n\n private parseConversation() {\n this.conversations.forEach((element: Conversation, index) => {\n element.to = element.participants.find(x => x?.id !== this.currentUser?.id);\n element.from = element.participants.find(x => x?.id === this.currentUser?.id);\n if (index === 0) {\n this.currentUserImg = element.from?.avatar ?? '/assets/img/icons/male.png';\n }\n });\n }\n\n private activateThread() {\n setTimeout(() => {\n if (window['jQuery']) {\n const selector = `.list-group-item:nth-child(${this.selectedIndex + 1})`;\n $(selector)\n .removeClass('no-border')\n .addClass(\n 'list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2'\n );\n }\n });\n }\n\n private checkIfNewConversation() {\n this.route.fragment.subscribe((fragment: string) => {\n if (fragment) {\n // Check for existing conversation\n const existingConversation = this.conversations.find(x => x.to?.slug === fragment);\n if (existingConversation) {\n this.otherUser = existingConversation.to;\n // sets the active tab when navigate to chat page\n this.setActive(existingConversation);\n } else {\n this.newParticipant(fragment);\n }\n } else if (this.conversations.length > 0) {\n this.router.navigate(['/message'], { fragment: this.conversations[0].to?.slug });\n }\n this.cdr.markForCheck();\n });\n }\n\n onParticipantClick(conversation) {\n this.otherUser = conversation.participants.find(x => x?.id !== this.currentUser?.id);\n const slug = this.otherUser?.slug;\n this.clearUnreadCount();\n this.router.navigate(['/message'], { fragment: slug });\n }\n\n private newParticipant(slug) {\n this.profileService.getUserProfile(slug).subscribe(response => {\n this.otherUser = response;\n\n const to = new ChatUser(\n response?.id,\n response?.first_name,\n response?.slug,\n response?.email,\n response?.avatar ? response?.avatar[0]?.url : '',\n new Date()\n );\n\n const from = new ChatUser(\n this.currentUser?.id,\n this.currentUser?.firstName,\n this.currentUser?.slug,\n this.currentUser?.email,\n this.currentUser?.avatar\n ? this.currentUser?.avatar[0].url\n : '/assets/img/icons/male.png',\n new Date()\n );\n\n const newConversation = new Conversation(\n null,\n 1,\n null,\n 'chat',\n [to, from],\n null,\n 0,\n from,\n to\n );\n\n this.conversations.unshift(newConversation);\n this.setActive(this.conversations[0]);\n this.cdr.markForCheck();\n });\n }\n\n // chat user list click event function\n private setActive(conversation) {\n this.currentPage = 0;\n this.currentThreads = [];\n this.totalMessages = 0;\n this.otherUser = conversation.participants.find(x => x?.id !== this.currentUser?.id);\n\n this.selectedConversationId = conversation?.id;\n this.currentConversation = conversation;\n\n const hElement: HTMLElement = this.elRef.nativeElement;\n // now you can simply get your elements with their class name\n const allAnchors = hElement.getElementsByClassName('list-group-item');\n // do something with selected elements\n Array.from(allAnchors).forEach((item: Element) => {\n item.setAttribute('class', 'list-group-item no-border');\n });\n\n const index = this.conversations.findIndex(x => x?.to?.id === this.otherUser?.id) || 0;\n setTimeout(() => {\n if (window['jQuery']) {\n $(`.list-group-item:nth-child(${index + 1})`)\n .removeClass('no-border')\n .addClass(\n 'list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2'\n );\n this.selectedIndex = $('.list-group-item.border-right-2').index();\n }\n }, 500);\n\n this.markAsRead(conversation?.id);\n this.getMessage(conversation?.id);\n }\n\n search(searchTxt) {\n if (searchTxt?.value?.length > 2) {\n this.conversations = this.pristineConversation.filter(\n x => x.to.slug.includes(searchTxt.value) ?? x.to?.email.includes(searchTxt.value)\n );\n } else {\n this.conversations = this.pristineConversation;\n }\n }\n\n // Socket For Listening to new Message\n private listenToNewMessage() {\n this.socketService.webSocket$.subscribe(\n (result: {\n event: string;\n new_conversation: string;\n data: {\n formattedDate: string;\n created_at: string;\n conversation_id: number;\n };\n id: number;\n }) => {\n if (result.event === SOCKET_TYPE.MSG) {\n if (result?.new_conversation === 'false') {\n const newMessage = result?.data;\n newMessage.formattedDate = moment(new Date(newMessage.created_at)).format(\n 'YYYYMMDD'\n );\n\n // Append the new message to conversation\n const conversation = this.conversations.find(x => x?.id === result?.id);\n if (conversation) {\n conversation.latest_message = result.data;\n conversation.created_at = newMessage.created_at;\n conversation.unread_count += 1;\n }\n\n if (\n newMessage.conversation_id === this.selectedConversationId &&\n newMessage.formattedDate in this.messagesGroupedByDate\n ) {\n this.messagesGroupedByDate[newMessage.formattedDate].push(newMessage);\n this.animateOnScroll();\n }\n } else if (result && typeof result.new_conversation === 'object') {\n this.conversations.unshift(result.new_conversation);\n this.parseConversation();\n }\n }\n this.cdr.markForCheck();\n }\n );\n }\n\n getMessage(messageId, reload = true) {\n if (reload) {\n this.messagesGroupedByDate = null;\n }\n if (messageId) {\n this.isLoaded = false;\n\n this.mailboxService\n .getMessages(messageId)\n .subscribe(response => {\n if (response) {\n this.totalMessages = response.object_count;\n this.currentThreads = response.messages;\n const ifExist = this.conversations.some(x => x?.id === response?.id);\n if (!ifExist) {\n this.conversations.find(x => x?.id === null).id = response?.id;\n }\n\n const messages = sortBy(response.messages, 'created_at');\n\n messages.forEach(msg => {\n msg.messageType = msg.attachment.url\n ? this.getMessageType(msg.attachment.url)\n : null;\n });\n this.messagesGroupedByDate = groupBy(messages, (o: Conversation) => {\n return moment(o.created_at).format('YYYYMMDD');\n });\n\n // Append the latest message to conversation list\n const current = this.conversations.find(\n x => x?.id === response?.id\n ).latest_message;\n if (current) {\n current.body = response.messages[0].body;\n current.created_at = response.messages[0].created_at;\n }\n }\n this.cdr.markForCheck();\n })\n .add(() => {\n this.isChatLoading = false;\n this.isLoaded = true;\n this.animateOnScroll();\n this.cdr.markForCheck();\n });\n }\n }\n\n private loadMore(conversationId, pageNumber, pageSize = 10) {\n this.mailboxService\n .getMessages(conversationId, pageNumber, pageSize)\n .subscribe(response => {\n if (response) {\n this.currentThreads = uniqBy(\n this.currentThreads.concat(response.messages),\n 'id'\n );\n const messages = sortBy(this.currentThreads, 'created_at');\n this.messagesGroupedByDate = groupBy(messages, (o: Conversation) => {\n return moment(o.created_at).format('YYYYMMDD');\n });\n }\n this.cdr.markForCheck();\n });\n }\n\n private clearUnreadCount() {\n this.mailboxService.decrementUnreadCount(this.currentConversation?.unread_count);\n if (this.currentConversation?.['unread_count']) {\n this.currentConversation['unread_count'] = 0;\n }\n }\n\n onSendMessage() {\n const text = this.messageInputRef.nativeElement.value;\n const formData = new FormData();\n formData.append('to', this.otherUser?.email);\n formData.append('message', text);\n formData.append('type', '1');\n formData.append('subscription_id', `${this.subscriptionId}`);\n\n if (this.files?.length) {\n this.isFileUploading = true;\n formData.append('file', this.files[0], this.files[0].name);\n }\n\n if (text || this.files.length > 0) {\n this.mailboxService\n .postMessage(formData)\n .subscribe(response => {\n this.files = [];\n this.attachedFiles = [];\n this.messageInputRef.nativeElement.value = '';\n this.messageInputRef.nativeElement.focus();\n this.getMessage(response.conversation_id, false);\n this.cdr.markForCheck();\n })\n .add(() => {\n this.isFileUploading = false;\n this.cdr.markForCheck();\n });\n }\n }\n\n private markAsRead(conversationId) {\n if (conversationId) {\n this.clearUnreadCount();\n this.mailboxService.markAsRead(conversationId).subscribe(() => {\n this.conversations.find(x => x?.id === conversationId).unread_count = 0;\n this.cdr.markForCheck();\n });\n }\n }\n\n private transform(bytes = 0, precision = 2) {\n // eslint-disable-next-line no-restricted-globals\n if (Number.isNaN(Number.parseFloat(String(bytes))) || !Number.isFinite(bytes)) {\n return '?';\n }\n let unit = 0;\n\n while (bytes >= 1024) {\n bytes /= 1024;\n unit++;\n }\n\n return `${bytes.toFixed(+precision)} ${this.units[unit]}`;\n }\n\n dropped(files) {\n // eslint-disable-next-line no-restricted-syntax\n for (const droppedFile of files) {\n // Is it a file?\n if (droppedFile.fileEntry.isFile) {\n const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;\n fileEntry.file((file: File) => {\n this.files.push(file);\n this.attachedFiles.push({\n name: file.name,\n size: this.transform(Number(file.size))\n });\n });\n }\n }\n }\n\n onRemoveAttachment(item) {\n this.files = this.files.filter(x => x.name !== item.name);\n this.attachedFiles = this.attachedFiles.filter(x => x.name !== item.name);\n }\n\n fileOver(_event) {\n console.log();\n }\n\n onEmojiSelect($event) {\n this.messageInputRef.nativeElement.value += $event.emoji.native;\n this.showEmoji = false;\n }\n\n fileChangeListener($event) {\n const file: File = $event.target.files[0];\n this.files.push(file);\n this.attachedFiles.push({\n name: file.name,\n size: this.transform(Number(file.size / 1024))\n });\n }\n\n toggleSidebar() {\n if (window['jQuery']) {\n $('.chat-sidebar').removeClass('d-none d-sm-none').addClass('d-block d-sm-block');\n $('.content-overlay').addClass('show');\n }\n }\n\n trackByMessageId(_index, item) {\n return item?.id;\n }\n\n trackConversationKey(conversation: Conversation): string | number {\n return conversation?.id ?? conversation?.to?.slug ?? conversation?.to?.id ?? '';\n }\n\n private animateOnScroll() {\n setTimeout(() => {\n if (window['jQuery'] && $('#chats-wrapper')?.length) {\n $('#chats-wrapper')\n .stop()\n .animate(\n {\n scrollTop: $('#chats-wrapper')[0].scrollHeight\n },\n 800\n );\n }\n });\n }\n\n private getMessageType(filename): string {\n const ext = this.getExtension(filename);\n switch (ext.toLowerCase()) {\n case 'jpg':\n case 'gif':\n case 'bmp':\n case 'png':\n return ATTACHMENT_TYPE.IMG;\n case 'm4v':\n case 'avi':\n case 'mpg':\n case 'mp4':\n return ATTACHMENT_TYPE.VIDEO;\n default:\n return '';\n }\n }\n\n private getExtension(filename) {\n const parts = filename.split('.');\n\n return parts[parts.length - 1];\n }\n\n recipientSearch() {\n lastValueFrom(\n this.mailboxService.getRecipient({\n page: 1,\n page_size: 20,\n subscription_id: PermissionService.selectedSubscription?.id,\n search: this.searchText\n })\n ).then(response => {\n this.recipients = response.filter(x => x?.id !== this.currentUser?.id);\n this.cdr.markForCheck();\n });\n }\n\n onMemberSelection(member) {\n this.otherUser = member;\n this.router.navigate(['/message'], { fragment: member.slug });\n }\n\n onDeleteMessage(message) {\n this.confirmDialog\n .confirmDelete({\n textKey: 'Common.Confirm.Delete.TextSimple',\n textParams: { entityType: 'message' }\n })\n .then(ok => {\n if (!ok) {\n return;\n }\n this.mailboxService\n .deleteMessage(this.selectedConversationId, message?.id)\n .subscribe(response => {\n if (response?.status_code === 200) {\n const createdAt = moment(message.created_at).format('YYYYMMDD');\n // eslint-disable-next-line no-restricted-syntax\n for (const property in this.messagesGroupedByDate) {\n if (property === createdAt) {\n this.messagesGroupedByDate[property] =\n this.messagesGroupedByDate[property].filter(\n x => x?.id !== message?.id\n );\n }\n }\n }\n this.cdr.markForCheck();\n });\n });\n }\n\n private waitForJQuery(callback: () => void): void {\n let attempts = 0;\n const maxAttempts = 100; // 10 seconds max wait time\n\n const checkJQuery = () => {\n if (window['jQuery']) {\n console.log('jQuery detected, loading chat.js');\n callback();\n } else if (attempts < maxAttempts) {\n attempts++;\n setTimeout(checkJQuery, 100);\n } else {\n console.log('jQuery not available, loading it now for chatbox');\n // Load jQuery since it's needed\n this.loadJQueryForChatbox(callback);\n }\n };\n checkJQuery();\n }\n\n private loadJQueryForChatbox(callback: () => void): void {\n const jquerySrc = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js';\n const script = document.createElement('script');\n script.src = jquerySrc;\n script.crossOrigin = 'anonymous';\n script.async = false;\n script.onload = () => {\n console.log('jQuery loaded for chatbox');\n callback();\n };\n script.onerror = () => {\n console.error('Failed to load jQuery for chatbox');\n // Try fallback\n const fallbackScript = document.createElement('script');\n fallbackScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js';\n fallbackScript.integrity =\n 'sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK';\n fallbackScript.crossOrigin = 'anonymous';\n fallbackScript.async = false;\n fallbackScript.onload = () => {\n console.log('jQuery loaded from Google CDN for chatbox');\n callback();\n };\n fallbackScript.onerror = () => {\n console.error('All jQuery CDNs failed for chatbox');\n };\n document.head.appendChild(fallbackScript);\n };\n document.head.appendChild(script);\n }\n}\n","<div class=\"chat-application mt-5\">\n <div class=\"content-overlay\"></div>\n\n @if (isChatLoading) {\n <div class=\"text-center\">\n <p-progress-spinner> </p-progress-spinner>\n </div>\n }\n\n @if (!isChatLoading) {\n <div class=\"chat-sidebar float-start d-none d-sm-none d-md-block d-lg-block\">\n <div class=\"chat-sidebar-content\">\n <div class=\"chat-fixed-search p-2\">\n <div class=\"d-flex\">\n <p-auto-complete appendTo=\"body\" inputId=\"chatbox-search-member\"\n [(ngModel)]=\"searchText\"\n #searchTxt\n [placeholder]=\"'Messaging.Chatbox.SearchMembers' | transloco\"\n [ngModelOptions]=\"{ standalone: true }\"\n optionLabel=\"first_name\"\n (onSelect)=\"onMemberSelection(searchText)\"\n [suggestions]=\"recipients\"\n (completeMethod)=\"recipientSearch()\">\n <ng-template let-item #item>\n <div>\n {{ item.first_name + ' ' }}\n {{ item.last_name ? item.last_name : '' }}\n </div>\n </ng-template>\n </p-auto-complete>\n </div>\n </div>\n\n <!-- Thread/conversation List -->\n <div id=\"users-list\"\n class=\"list-group position-relative\">\n @if (conversations?.length) {\n <div class=\"users-list-padding\">\n @for (conversation of conversations; track trackConversationKey(conversation)) {\n <a class=\"list-group-item no-border\"\n (click)=\"onParticipantClick(conversation)\">\n <div class=\"d-flex\">\n <span class=\"avatar avatar-md avatar-away\">\n @if (conversation?.to?.avatar) {\n <img [src]=\"conversation.to?.avatar\"\n width=\"40\"\n height=\"40\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n conversation?.participants\n ? conversation.to?.slug.charAt(0).toUpperCase()\n : conversation.to?.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n </span>\n <div class=\"clearfix\">\n <h6 class=\"list-group-item-heading mb-1\">\n {{\n conversation.to?.name\n ? conversation.to?.name\n : conversation.to?.slug\n }}\n <span class=\"font-small-3 float-end ms-5 ps-5\">\n @if (conversation?.unread_count) {\n <span class=\"badge bg-primary rounded-pill bg-primary mx-1\">\n {{ conversation.unread_count }}\n </span>\n }\n {{ conversation.created_at | date: 'shortTime' }}\n </span>\n </h6>\n <p class=\"list-group-item-text text-muted\">\n {{ conversation?.latest_message?.body | textTruncate: 25 }}\n </p>\n </div>\n </div>\n </a>\n }\n </div>\n }\n </div>\n </div>\n </div>\n\n @if (conversations?.length) {\n <!-- Chat Header -->\n @if (otherUser) {\n <div class=\"chat-name p-2 bg-white\">\n <div class=\"d-flex\">\n <span class=\"chat-app-sidebar-toggle ft-align-justify font-large-1 me-2 d-none d-block d-sm-block d-md-none\"\n (keydown.enter)=\"toggleSidebar()\"\n (click)=\"toggleSidebar()\"></span>\n <div class=\"clearfix\">\n @if (currentConversation?.to?.avatar) {\n <img [src]=\"currentConversation?.to?.avatar\"\n width=\"40\"\n height=\"40\"\n class=\"rounded-circle me-1\"\n [alt]=\"'User.Profile.Avatar' | transloco\"\n role=\"presentation\"\n (error)=\"onImgError($event, '/assets/img/icons/male.png')\" />\n } @else {\n @if (currentUser) {\n <div class=\"dummy-avatar me-2\">\n <strong>{{\n otherUser?.name\n ? otherUser.name.charAt(0).toUpperCase()\n : otherUser.slug.charAt(0).toUpperCase()\n }}</strong>\n </div>\n }\n }\n\n @if (currentUser) {\n <strong class=\"mt-2\">{{\n otherUser.name ? otherUser.name : otherUser.slug\n }}</strong>\n }\n </div>\n </div>\n </div>\n }\n\n <!-- Chat Window -->\n <div class=\"chat-app-window\"\n id=\"chats-wrapper\"\n #scrollMe\n infinite-scroll\n [infiniteScrollDistance]=\"scrollDistance\"\n [scrollWindow]=\"false\"\n [infiniteScrollUpDistance]=\"scrollUpDistance\"\n [infiniteScrollThrottle]=\"throttle\"\n [alwaysCallback]=\"true\"\n (scrolledUp)=\"onUp($event, selectedConversationId)\">\n <div class=\"chats\">\n <!-- Shows Message -->\n @if (!isLoaded) {\n <div class=\"spinner\"></div>\n }\n @if (messagesGroupedByDate) {\n @for (item of ObjectKeys(messagesGroupedByDate); track item) {\n <strong class=\"badge bg-secondary mb-1\">{{\n messagesGroupedByDate[item][0]?.created_at | date\n }}</strong>\n <!-- Every Message -->\n @for (message of messagesGroupedByDate[item]; track message.id) {\n <div class=\"chat\"\n [ngClass]=\"{\n 'chat-left ms-2': message.sender_id !== currentUser.id,\n 'me-2': message.sender_id === currentUser.id\n }\">\n @if (message.body || message.attachment?.url) {\n <div class=\"chat-avatar\">\n <a class=\"avatar\"\n data-toggle=\"tooltip\"\n data-placement=\"right\"\n data-original-title=\"\">\n <!-- Setting up Avatar Image for Logged In User -->\n @if (message.sender_id === currentUser.id) {\n @if (currentUserImg) {\n <img [src]=\"currentUserImg\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar bg-brown\">\n <strong>{{\n currentUser?.name\n ? currentUser.name\n .charAt(0)\n .toUpperCase()\n : currentUser.slug\n .charAt(0)\n .toUpperCase()\n }}\n </strong>\n </div>\n }\n }\n\n <!-- Participant -->\n @if (message.sender_id !== currentUser.id) {\n @if (currentUser && otherUser?.avatar) {\n <img [src]=\"otherUser?.avatar\"\n class=\"d-flex height-50 rounded-circle\"\n [alt]=\"'User.Profile.Avatar' | transloco\" />\n } @else {\n <div class=\"dummy-avatar\">\n <strong>{{\n otherUser?.name\n ? otherUser.name\n .charAt(0)\n .toUpperCase()\n : otherUser.slug\n .charAt(0)\n .toUpperCase()\n }}</strong>\n </div>\n }\n }\n </a>\n </div>\n <div class=\"chat-body\">\n @if (!message?.attachment?.url) {\n <div class=\"chat-content attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.sender_id === currentUser.id && message.is_open) {\n <i\n class=\"fa fa-check-double msg-double-check\"\n ></i>\n }\n <p>{{ message.body }}</p>\n </div>\n } @else {\n <div class=\"chat-content with-attachment\">\n <small class=\"message-time\">{{\n message.created_at | date: 'shortTime'\n }}</small>\n @if (message.sender_id === currentUser.id) {\n <i\n class=\"far fa-trash-alt btn-delete danger\"\n aria-hidden=\"true\"\n (click)=\"onDeleteMessage(message)\"\n (keydown.enter)=\"onDeleteMessage(message)\"\n ></i>\n }\n @if (message.attachment) {\n <div class=\"message-attachment\">\n <i>\n @if (message?.messageType === ATTACHMENT_TYPE.IMG) {\n <img\n [src]=\"message.attachment.url\"\n class=\"img-thumbnail\"\n [alt]=\"'Messaging.Chatbox.AttachmentAlt' | transloco\"\n />\n }\n @if (message?.messageType === ATTACHMENT_TYPE.VIDEO) {\n <video\n width=\"320\"\n height=\"240\"\n controls\n class=\"img-thumbnail\"\n >\n <source\n [src]=\"message.attachment.url\"\n type=\"video/mp4\"\n />\n <track kind=\"subtitles\" srclang=\"en\" [label]=\"'Messaging.Chatbox.SubtitlesEnglish' | transloco\" />\n {{ 'Messaging.Chatbox.VideoNotSupported' | transloco }}\n </video>\n }\n <a\n [attr.href]=\"message.attachment.url\"\n target=\"_blank\"\n >\n <i\n class=\"fa fa-file-download me-2\"\n aria-hidden=\"true\"\n ></i>\n {{\n message.attachment.url\n | common: 'filename'\n }}</a>\n </i>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n }\n }\n\n @if (!messagesGroupedByDate && isLoaded) {\n <div class=\"mt-3 text-center\">{{ 'Messaging.Chatbox.NoHistory' | transloco }}</div>\n }\n\n @if (isFileUploading) {\n <i class=\"fa fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n\n <!-- Shows Metadata of the file being uploaded -->\n <div class=\"compose-message-attachment\">\n <div class=\"m-0\">\n @for (item of attachedFiles; track $index) {\n <div class=\"card px-3 py-2 m-0 mb-1\">\n <div class=\"card-body\">\n <div class=\"d-inline-block file-name\">{{ item.name }}</div>\n <div class=\"d-inline-block file-size\">{{ item.size }}</div>\n <div class=\"d-inline-block float-end file-remove\"\n (keydown.enter)=\"onRemoveAttachment(item)\"\n (click)=\"onRemoveAttachment(item)\">\n\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n\n <div [hidden]=\"!showEmoji\">\n <emoji-mart [title]=\"'Messaging.Chatbox.PickEmoji' | transloco\"\n set=\"facebook\"\n [showPreview]=\"false\"\n (emojiSelect)=\"onEmojiSelect($event)\"\n [emojiSize]=\"30\">\n </emoji-mart>\n </div>\n\n <!-- Compose Text box area -->\n <div class=\"chat-app-form bg-blue-grey bg-lighten-5\">\n <form class=\"chat-app-input row\">\n <fieldset class=\"mb-3 position-relative has-icon-left col-10 m-0 mb-1\">\n <div class=\"form-control-position emoji-container\">\n <button type=\"button\" class=\"emoji-toggle-btn\" [attr.aria-label]=\"'Messaging.Chatbox.InsertEmoji' | transloco\" (click)=\"showEmoji = !showEmoji\">🙂</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">{{ 'Messaging.Chatbox.MessageLabel' | transloco }}</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n [placeholder]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n [attr.aria-label]=\"'Messaging.Chatbox.MessagePlaceholder' | transloco\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">{{ 'BrainChat.AttachFile' | transloco }}</span>\n <i class=\"fa fa-paperclip\" aria-hidden=\"true\"></i>\n <input\n id=\"file-input\"\n name=\"file-input\"\n type=\"file\"\n (change)=\"fileChangeListener($event)\"\n size=\"60\"\n [attr.aria-label]=\"'Messaging.Chatbox.FileInput' | transloco\" />\n </label>\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"mb-3 position-relative has-icon-left col-2 m-0 mb-1\">\n <button type=\"button\"\n class=\"btn btn-primary d-lg-flex align-items-center btn-send\"\n (click)=\"onSendMessage()\">\n <i class=\"fa fa-paper-plane\"></i><span class=\"d-none d-lg-block ms-1\">{{ 'Messaging.Chatbox.Send' | transloco }}</span>\n </button>\n </fieldset>\n </form>\n </div>\n } @else {\n <div class=\"container-fluid pw-tab overflow-hidden no-message-center\">\n <div class=\"dashboard\">\n <div class=\"dashboard-body text-center mt-5\">\n <div>\n <img src=\"/assets/img/icons/empty-chat-icon.png\"\n [alt]=\"'Messaging.Chatbox.EmptyAlt' | transloco\" />\n </div>\n <div class=\"h4 mt-4\">{{ 'Messaging.Chatbox.Empty.Title' | transloco }}</div>\n <div class=\"mt-3\">\n <p>{{ 'Messaging.Chatbox.Empty.Text' | transloco }}</p>\n <p>{{ 'Messaging.Chatbox.Empty.Hint' | transloco }}</p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n","import { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\n\nimport { ChatBoxComponent } from './chatbox/chatbox.component';\n\nconst routes: Routes = [\n {\n path: '',\n component: ChatBoxComponent,\n data: {\n title: 'Chat',\n titleKey: 'Menu.Chat'\n }\n },\n {\n path: ':memberId',\n component: ChatBoxComponent,\n data: {\n title: 'Chat',\n titleKey: 'Menu.Chat'\n }\n }\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule]\n})\nexport class MessageRoutingModule {}\n","import { ScrollingModule } from '@angular/cdk/scrolling';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { RouterModule } from '@angular/router';\n\nimport { CoreTranslocoModule } from '@posiwise/core-transloco';\nimport { PipesModule } from '@posiwise/pipes';\n\nimport { NgxFileDropModule } from 'ngx-file-drop';\nimport { InfiniteScrollModule } from 'ngx-infinite-scroll';\nimport { AutoCompleteModule } from 'primeng/autocomplete';\nimport { ProgressSpinnerModule } from 'primeng/progressspinner';\n\nimport { PickerModule } from '@ctrl/ngx-emoji-mart';\nimport { EmojiModule } from '@ctrl/ngx-emoji-mart/ngx-emoji';\n\nimport { ChatBoxComponent } from './chatbox/chatbox.component';\nimport { MessageRoutingModule } from './messaging-routing.module';\n\n@NgModule({\n imports: [\n CommonModule,\n CoreTranslocoModule,\n PipesModule,\n FormsModule,\n MessageRoutingModule,\n ProgressSpinnerModule,\n AutoCompleteModule,\n PickerModule,\n EmojiModule,\n NgxFileDropModule,\n InfiniteScrollModule,\n ScrollingModule,\n ChatBoxComponent\n ],\n exports: [RouterModule, ChatBoxComponent]\n})\nexport class MessagingModule {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAa,mBAAb,MAAa,yBAAyB,iBAAgB;CAjBtD,cAAA;;EAkBY,KAAA,QAAQ,OAAO,UAAU;EAChB,KAAA,iBAAiB,OAAO,cAAc;EACtC,KAAA,iBAAiB,OAAO,cAAc;EACtC,KAAA,gBAAgB,OAAO,gBAAgB;EACvC,KAAA,eAAe,OAAO,mBAAmB;EACzC,KAAA,MAAM,OAAO,iBAAiB;EAC9B,KAAA,gBAAgB,OAAO,oBAAoB;EAS5D,KAAA,aAAa,OAAO;EAEpB,KAAA,YAAY;EAYJ,KAAA,uBAAuC,CAAA;EACvC,KAAA,UAAU;EACD,KAAA,QAAQ;GAAC;GAAK;GAAM;GAAM;GAAM;GAAM;EAAI;EACnD,KAAA,cAAc;EACd,KAAA,gBAAgB;EAChB,KAAA,gBAAgB;EAChB,KAAA,iBAAiB,CAAA;EAEzB,KAAA,gBAAgC,CAAA;EAOhC,KAAA,wBAAwB,CAAA;EAIxB,KAAA,aAAa,CAAA;EAEb,KAAA,QAAQ,CAAA;EAER,KAAA,gBAAkD,CAAA;EAElD,KAAA,gBAAgB;EAEhB,KAAA,cAAc;EAEd,KAAA,WAAW;EAEX,KAAA,WAAW;EAEX,KAAA,mBAAmB;EAEnB,KAAA,iBAAiB;EAEjB,KAAA,kBAA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BAAgB;EAAA,CAAA;CAAA;CAE/B;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAe,SAAA;IAhBpB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEM;GAAY;EAAA,CAAA;CAAA;;AAEb,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAlB3B,MAAA;EAAS,MAAA,CAAA;GACN,SAAS;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACH;GACD,SAAS,CAAC,cAAc,gBAAgB;EAC3C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import {
|
|
2
|
+
import { DoCheck, ElementRef, OnDestroy, OnInit } from "@angular/core";
|
|
3
|
+
import * as i1 from "@angular/common";
|
|
4
|
+
import * as i2 from "@posiwise/core-transloco";
|
|
5
|
+
import * as i3 from "@posiwise/pipes";
|
|
6
|
+
import * as i4 from "@angular/forms";
|
|
7
|
+
import * as i1$1 from "@angular/router";
|
|
8
|
+
import * as i6 from "primeng/progressspinner";
|
|
9
|
+
import * as i7 from "primeng/autocomplete";
|
|
10
|
+
import * as i8 from "@ctrl/ngx-emoji-mart";
|
|
11
|
+
import * as i9 from "@ctrl/ngx-emoji-mart/ngx-emoji";
|
|
12
|
+
import * as i10 from "ngx-file-drop";
|
|
13
|
+
import * as i11 from "ngx-infinite-scroll";
|
|
14
|
+
import * as i12 from "@angular/cdk/scrolling";
|
|
3
15
|
import { AppBaseComponent } from "@posiwise/app-base-component";
|
|
4
|
-
import { MailBoxService, ProfileService, ScriptLoaderService, WebsocketService } from "@posiwise/common-services";
|
|
5
16
|
import { ATTACHMENT_TYPE, ChatUser, Conversation } from "@posiwise/common-utilities";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import * as i9 from "@ctrl/ngx-emoji-mart";
|
|
15
|
-
import * as i10 from "@ctrl/ngx-emoji-mart/ngx-emoji";
|
|
16
|
-
import * as i11 from "ngx-file-drop";
|
|
17
|
-
import * as i12 from "ngx-infinite-scroll";
|
|
18
|
-
import * as i13 from "@angular/cdk/scrolling";
|
|
17
|
+
declare namespace messaging_routing_module_d_exports {
|
|
18
|
+
export { MessageRoutingModule };
|
|
19
|
+
}
|
|
20
|
+
declare class MessageRoutingModule {
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MessageRoutingModule, never>;
|
|
22
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<MessageRoutingModule, never, [typeof i1$1.RouterModule], [typeof i1$1.RouterModule]>;
|
|
23
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<MessageRoutingModule>;
|
|
24
|
+
}
|
|
19
25
|
interface MessageChatUser {
|
|
20
26
|
avatar?: {
|
|
21
27
|
url: string;
|
|
@@ -120,8 +126,6 @@ export declare class ChatBoxComponent extends AppBaseComponent implements OnInit
|
|
|
120
126
|
scrollDistance: number;
|
|
121
127
|
subscriptionId: number;
|
|
122
128
|
ATTACHMENT_TYPE: typeof ATTACHMENT_TYPE;
|
|
123
|
-
constructor(elRef: ElementRef // NOSONAR
|
|
124
|
-
, mailboxService: MailBoxService, profileService: ProfileService, socketService: WebsocketService, scriptLoader: ScriptLoaderService, injector: Injector, cdr: ChangeDetectorRef, confirmDialog: ConfirmDialogService);
|
|
125
129
|
onImgError(event: Event, fallbackSrc: string): void;
|
|
126
130
|
onUp(_ev: any, conversationId: any): void;
|
|
127
131
|
ngOnInit(): void;
|
|
@@ -159,18 +163,10 @@ export declare class ChatBoxComponent extends AppBaseComponent implements OnInit
|
|
|
159
163
|
private waitForJQuery;
|
|
160
164
|
private loadJQueryForChatbox;
|
|
161
165
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChatBoxComponent, never>;
|
|
162
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ChatBoxComponent, "ng-component", never, {}, {}, never, never,
|
|
163
|
-
}
|
|
164
|
-
declare namespace messaging_routing_module_d_exports {
|
|
165
|
-
export { MessageRoutingModule };
|
|
166
|
-
}
|
|
167
|
-
declare class MessageRoutingModule {
|
|
168
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MessageRoutingModule, never>;
|
|
169
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<MessageRoutingModule, never, [typeof i1.RouterModule], [typeof i1.RouterModule]>;
|
|
170
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<MessageRoutingModule>;
|
|
166
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatBoxComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
171
167
|
}
|
|
172
168
|
export declare class MessagingModule {
|
|
173
169
|
static ɵfac: i0.ɵɵFactoryDeclaration<MessagingModule, never>;
|
|
174
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<MessagingModule,
|
|
170
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<MessagingModule, never, [typeof i1.CommonModule, typeof i2.CoreTranslocoModule, typeof i3.PipesModule, typeof i4.FormsModule, typeof MessageRoutingModule, typeof i6.ProgressSpinnerModule, typeof i7.AutoCompleteModule, typeof i8.PickerModule, typeof i9.EmojiModule, typeof i10.NgxFileDropModule, typeof i11.InfiniteScrollModule, typeof i12.ScrollingModule, typeof ChatBoxComponent], [typeof i1$1.RouterModule, typeof ChatBoxComponent]>;
|
|
175
171
|
static ɵinj: i0.ɵɵInjectorDeclaration<MessagingModule>;
|
|
176
172
|
}
|