@posiwise/messaging-module 0.0.98 → 0.0.99

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,643 +1,870 @@
1
- import { ScrollingModule } from '@angular/cdk/scrolling';
2
- import * as i3 from '@angular/common';
3
- import { CommonModule } from '@angular/common';
4
- import * as i0 from '@angular/core';
5
- import { ViewChild, Component, NgModule } from '@angular/core';
6
- import * as i4 from '@angular/forms';
7
- import { FormsModule } from '@angular/forms';
8
- import * as i1$1 from '@angular/router';
9
- import { RouterModule } from '@angular/router';
10
- import * as i10 from '@posiwise/pipes';
11
- import { PipesModule } from '@posiwise/pipes';
12
- import { NgxFileDropModule } from 'ngx-file-drop';
13
- import * as i9 from 'ngx-infinite-scroll';
14
- import { InfiniteScrollModule } from 'ngx-infinite-scroll';
15
- import * as i7 from 'primeng/autocomplete';
16
- import { AutoCompleteModule } from 'primeng/autocomplete';
17
- import * as i5 from 'primeng/progressspinner';
18
- import { ProgressSpinnerModule } from 'primeng/progressspinner';
19
- import * as i8 from '@ctrl/ngx-emoji-mart';
20
- import { PickerModule } from '@ctrl/ngx-emoji-mart';
21
- import { EmojiModule } from '@ctrl/ngx-emoji-mart/ngx-emoji';
22
- import { AppBaseComponent } from '@posiwise/app-base-component';
23
- import * as i1 from '@posiwise/common-services';
24
- import { PermissionService } from '@posiwise/common-services';
25
- import { ATTACHMENT_TYPE, ChatUser, Conversation, SOCKET_TYPE } from '@posiwise/common-utilities';
26
- import groupBy from 'lodash/groupBy';
27
- import sortBy from 'lodash/sortBy';
28
- import uniqBy from 'lodash/uniqBy';
29
- import moment from 'moment';
30
- import { lastValueFrom } from 'rxjs';
31
- import * as i2 from '@posiwise/shared-components';
32
- import * as i6 from 'primeng/api';
33
-
34
- class ChatBoxComponent extends AppBaseComponent {
35
- constructor(elRef, // NOSONAR
36
- mailboxService, profileService, socketService, scriptLoader, injector, cdr, confirmDialog) {
37
- super(injector);
38
- this.elRef = elRef;
39
- this.mailboxService = mailboxService;
40
- this.profileService = profileService;
41
- this.socketService = socketService;
42
- this.scriptLoader = scriptLoader;
43
- this.cdr = cdr;
44
- this.confirmDialog = confirmDialog;
45
- this.ObjectKeys = Object.keys;
46
- this.showEmoji = false;
47
- // Conversation list
48
- this.pristineConversation = [];
49
- this.isDrift = true;
50
- this.units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
51
- this.initialLoad = true;
52
- this.selectedIndex = 0;
53
- this.totalMessages = 0;
54
- this.currentThreads = [];
55
- this.conversations = [];
56
- // Boolean to unsubscribe on Destroy
57
- // List of messages per conversation Id
58
- this.messagesGroupedByDate = {};
59
- this.recipients = [];
60
- this.files = [];
61
- this.attachedFiles = [];
62
- this.isChatLoading = true;
63
- this.currentPage = 1;
64
- this.isLoaded = true;
65
- this.throttle = 300;
66
- this.scrollUpDistance = 2;
67
- this.scrollDistance = 1;
68
- this.ATTACHMENT_TYPE = ATTACHMENT_TYPE;
69
- }
70
- onImgError(event, fallbackSrc) {
71
- const img = event.target;
72
- if (!img)
73
- return;
74
- if (img.src?.endsWith(fallbackSrc))
75
- return;
76
- img.src = fallbackSrc;
77
- }
78
- onUp(_ev, conversationId) {
79
- this.currentPage++;
80
- const totalPages = Math.ceil(this.totalMessages / 10);
81
- // Prevent API call if all messages have been fetched
82
- if (this.currentPage <= totalPages) {
83
- this.loadMore(conversationId, this.currentPage);
84
- }
85
- }
86
- ngOnInit() {
87
- this.waitForJQuery(() => {
88
- this.scriptLoader.loadScriptOnce('head', '/assets/js/chat.js');
89
- });
90
- this.listenToNewMessage();
91
- this.subscriptionId = PermissionService.selectedSubscription?.id;
92
- this.userStore().subscribe(resp => {
93
- this.currentUser = resp;
94
- if (this.currentUser) {
95
- this.mailboxService
96
- .getConversations()
97
- .subscribe((response) => {
98
- if (response?.length) {
99
- let raw;
100
- if (this.conversations.length > 0) {
101
- raw = this.conversations.find(x => x?.id === null);
102
- }
103
- response.forEach(x => {
104
- x.datetime = x.latest_message.created_at;
105
- });
106
- const chats = sortBy(response, 'datetime').reverse();
107
- this.pristineConversation = chats;
108
- this.conversations = [...chats];
109
- if (raw) {
110
- this.conversations.unshift(raw);
111
- }
112
- this.parseConversation();
113
- setTimeout(() => this.filterConversations());
114
- }
115
- if (this.initialLoad) {
116
- this.checkIfNewConversation();
117
- }
118
- else {
119
- this.activateThread();
120
- }
121
- this.cdr.markForCheck();
122
- })
123
- .add(() => {
124
- this.isChatLoading = false;
125
- this.initialLoad = false;
126
- this.cdr.markForCheck();
127
- });
128
- }
129
- this.cdr.markForCheck();
130
- });
131
- }
132
- filterConversations() {
133
- this.conversations = this.conversations.filter(conversation => conversation.to);
134
- }
135
- ngDoCheck() {
136
- // Hiding Drift messenger for Chat-box (Drift service shut down - kept for future chat widget alternative)
137
- if (window['jQuery'] && this.isDrift) {
138
- if ($('#drift-widget-container').length > 0 && $('#drift-widget-container:visible')) {
139
- this.isDrift = false;
140
- $('#drift-widget-container').hide();
141
- }
142
- }
143
- }
144
- ngOnDestroy() {
145
- if (window['jQuery']) {
146
- $('.drift-widget-container').show();
147
- }
148
- }
149
- parseConversation() {
150
- this.conversations.forEach((element, index) => {
151
- element.to = element.participants.find(x => x?.id !== this.currentUser?.id);
152
- element.from = element.participants.find(x => x?.id === this.currentUser?.id);
153
- if (index === 0) {
154
- this.currentUserImg = element.from?.avatar ?? '/assets/img/icons/male.png';
155
- }
156
- });
157
- }
158
- activateThread() {
159
- setTimeout(() => {
160
- if (window['jQuery']) {
161
- const selector = `.list-group-item:nth-child(${this.selectedIndex + 1})`;
162
- $(selector)
163
- .removeClass('no-border')
164
- .addClass('list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2');
165
- }
166
- });
167
- }
168
- checkIfNewConversation() {
169
- this.route.fragment.subscribe((fragment) => {
170
- if (fragment) {
171
- // Check for existing conversation
172
- const existingConversation = this.conversations.find(x => x.to?.slug === fragment);
173
- if (existingConversation) {
174
- this.otherUser = existingConversation.to;
175
- // sets the active tab when navigate to chat page
176
- this.setActive(existingConversation);
177
- }
178
- else {
179
- this.newParticipant(fragment);
180
- }
181
- }
182
- else if (this.conversations.length > 0) {
183
- this.router.navigate(['/message'], { fragment: this.conversations[0].to?.slug });
184
- }
185
- this.cdr.markForCheck();
186
- });
187
- }
188
- onParticipantClick(conversation) {
189
- this.otherUser = conversation.participants.find(x => x?.id !== this.currentUser?.id);
190
- const slug = this.otherUser?.slug;
191
- this.clearUnreadCount();
192
- this.router.navigate(['/message'], { fragment: slug });
193
- }
194
- newParticipant(slug) {
195
- this.profileService.getUserProfile(slug).subscribe(response => {
196
- this.otherUser = response;
197
- const to = new ChatUser(response?.id, response?.first_name, response?.slug, response?.email, response?.avatar ? response?.avatar[0]?.url : '', new Date());
198
- const from = new ChatUser(this.currentUser?.id, this.currentUser?.firstName, this.currentUser?.slug, this.currentUser?.email, this.currentUser?.avatar
199
- ? this.currentUser?.avatar[0].url
200
- : '/assets/img/icons/male.png', new Date());
201
- const newConversation = new Conversation(null, 1, null, 'chat', [to, from], null, 0, from, to);
202
- this.conversations.unshift(newConversation);
203
- this.setActive(this.conversations[0]);
204
- this.cdr.markForCheck();
205
- });
206
- }
207
- // chat user list click event function
208
- setActive(conversation) {
209
- this.currentPage = 0;
210
- this.currentThreads = [];
211
- this.totalMessages = 0;
212
- this.otherUser = conversation.participants.find(x => x?.id !== this.currentUser?.id);
213
- this.selectedConversationId = conversation?.id;
214
- this.currentConversation = conversation;
215
- const hElement = this.elRef.nativeElement;
216
- // now you can simply get your elements with their class name
217
- const allAnchors = hElement.getElementsByClassName('list-group-item');
218
- // do something with selected elements
219
- Array.from(allAnchors).forEach((item) => {
220
- item.setAttribute('class', 'list-group-item no-border');
221
- });
222
- const index = this.conversations.findIndex(x => x?.to?.id === this.otherUser?.id) || 0;
223
- setTimeout(() => {
224
- if (window['jQuery']) {
225
- $(`.list-group-item:nth-child(${index + 1})`)
226
- .removeClass('no-border')
227
- .addClass('list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2');
228
- this.selectedIndex = $('.list-group-item.border-right-2').index();
229
- }
230
- }, 500);
231
- this.markAsRead(conversation?.id);
232
- this.getMessage(conversation?.id);
233
- }
234
- search(searchTxt) {
235
- if (searchTxt?.value?.length > 2) {
236
- this.conversations = this.pristineConversation.filter(x => x.to.slug.includes(searchTxt.value) ?? x.to?.email.includes(searchTxt.value));
237
- }
238
- else {
239
- this.conversations = this.pristineConversation;
240
- }
241
- }
242
- // Socket For Listening to new Message
243
- listenToNewMessage() {
244
- this.socketService.webSocket$.subscribe((result) => {
245
- if (result.event === SOCKET_TYPE.MSG) {
246
- if (result?.new_conversation === 'false') {
247
- const newMessage = result?.data;
248
- newMessage.formattedDate = moment(new Date(newMessage.created_at)).format('YYYYMMDD');
249
- // Append the new message to conversation
250
- const conversation = this.conversations.find(x => x?.id === result?.id);
251
- if (conversation) {
252
- conversation.latest_message = result.data;
253
- conversation.created_at = newMessage.created_at;
254
- conversation.unread_count += 1;
255
- }
256
- if (newMessage.conversation_id === this.selectedConversationId &&
257
- newMessage.formattedDate in this.messagesGroupedByDate) {
258
- this.messagesGroupedByDate[newMessage.formattedDate].push(newMessage);
259
- this.animateOnScroll();
260
- }
261
- }
262
- else if (result && typeof result.new_conversation === 'object') {
263
- this.conversations.unshift(result.new_conversation);
264
- this.parseConversation();
265
- }
266
- }
267
- this.cdr.markForCheck();
268
- });
269
- }
270
- getMessage(messageId, reload = true) {
271
- if (reload) {
272
- this.messagesGroupedByDate = null;
273
- }
274
- if (messageId) {
275
- this.isLoaded = false;
276
- this.mailboxService
277
- .getMessages(messageId)
278
- .subscribe(response => {
279
- if (response) {
280
- this.totalMessages = response.object_count;
281
- this.currentThreads = response.messages;
282
- const ifExist = this.conversations.some(x => x?.id === response?.id);
283
- if (!ifExist) {
284
- this.conversations.find(x => x?.id === null).id = response?.id;
285
- }
286
- const messages = sortBy(response.messages, 'created_at');
287
- messages.forEach(msg => {
288
- msg.messageType = msg.attachment.url
289
- ? this.getMessageType(msg.attachment.url)
290
- : null;
291
- });
292
- this.messagesGroupedByDate = groupBy(messages, (o) => {
293
- return moment(o.created_at).format('YYYYMMDD');
294
- });
295
- // Append the latest message to conversation list
296
- const current = this.conversations.find(x => x?.id === response?.id).latest_message;
297
- if (current) {
298
- current.body = response.messages[0].body;
299
- current.created_at = response.messages[0].created_at;
300
- }
301
- }
302
- this.cdr.markForCheck();
303
- })
304
- .add(() => {
305
- this.isChatLoading = false;
306
- this.isLoaded = true;
307
- this.animateOnScroll();
308
- this.cdr.markForCheck();
309
- });
310
- }
311
- }
312
- loadMore(conversationId, pageNumber, pageSize = 10) {
313
- this.mailboxService
314
- .getMessages(conversationId, pageNumber, pageSize)
315
- .subscribe(response => {
316
- if (response) {
317
- this.currentThreads = uniqBy(this.currentThreads.concat(response.messages), 'id');
318
- const messages = sortBy(this.currentThreads, 'created_at');
319
- this.messagesGroupedByDate = groupBy(messages, (o) => {
320
- return moment(o.created_at).format('YYYYMMDD');
321
- });
322
- }
323
- this.cdr.markForCheck();
324
- });
325
- }
326
- clearUnreadCount() {
327
- this.mailboxService.decrementUnreadCount(this.currentConversation?.unread_count);
328
- if (this.currentConversation?.['unread_count']) {
329
- this.currentConversation['unread_count'] = 0;
330
- }
331
- }
332
- onSendMessage() {
333
- const text = this.messageInputRef.nativeElement.value;
334
- const formData = new FormData();
335
- formData.append('to', this.otherUser?.email);
336
- formData.append('message', text);
337
- formData.append('type', '1');
338
- formData.append('subscription_id', `${this.subscriptionId}`);
339
- if (this.files?.length) {
340
- this.isFileUploading = true;
341
- formData.append('file', this.files[0], this.files[0].name);
342
- }
343
- if (text || this.files.length > 0) {
344
- this.mailboxService
345
- .postMessage(formData)
346
- .subscribe(response => {
347
- this.files = [];
348
- this.attachedFiles = [];
349
- this.messageInputRef.nativeElement.value = '';
350
- this.messageInputRef.nativeElement.focus();
351
- this.getMessage(response.conversation_id, false);
352
- this.cdr.markForCheck();
353
- })
354
- .add(() => {
355
- this.isFileUploading = false;
356
- this.cdr.markForCheck();
357
- });
358
- }
359
- }
360
- markAsRead(conversationId) {
361
- if (conversationId) {
362
- this.clearUnreadCount();
363
- this.mailboxService.markAsRead(conversationId).subscribe(() => {
364
- this.conversations.find(x => x?.id === conversationId).unread_count = 0;
365
- this.cdr.markForCheck();
366
- });
367
- }
368
- }
369
- transform(bytes = 0, precision = 2) {
370
- // eslint-disable-next-line no-restricted-globals
371
- if (Number.isNaN(Number.parseFloat(String(bytes))) || !Number.isFinite(bytes)) {
372
- return '?';
373
- }
374
- let unit = 0;
375
- while (bytes >= 1024) {
376
- bytes /= 1024;
377
- unit++;
378
- }
379
- return `${bytes.toFixed(+precision)} ${this.units[unit]}`;
380
- }
381
- dropped(files) {
382
- // eslint-disable-next-line no-restricted-syntax
383
- for (const droppedFile of files) {
384
- // Is it a file?
385
- if (droppedFile.fileEntry.isFile) {
386
- const fileEntry = droppedFile.fileEntry;
387
- fileEntry.file((file) => {
388
- this.files.push(file);
389
- this.attachedFiles.push({
390
- name: file.name,
391
- size: this.transform(Number(file.size))
392
- });
393
- });
394
- }
395
- }
396
- }
397
- onRemoveAttachment(item) {
398
- this.files = this.files.filter(x => x.name !== item.name);
399
- this.attachedFiles = this.attachedFiles.filter(x => x.name !== item.name);
400
- }
401
- fileOver(_event) {
402
- console.log();
403
- }
404
- onEmojiSelect($event) {
405
- this.messageInputRef.nativeElement.value += $event.emoji.native;
406
- this.showEmoji = false;
407
- }
408
- fileChangeListener($event) {
409
- const file = $event.target.files[0];
410
- this.files.push(file);
411
- this.attachedFiles.push({
412
- name: file.name,
413
- size: this.transform(Number(file.size / 1024))
414
- });
415
- }
416
- toggleSidebar() {
417
- if (window['jQuery']) {
418
- $('.chat-sidebar').removeClass('d-none d-sm-none').addClass('d-block d-sm-block');
419
- $('.content-overlay').addClass('show');
420
- }
421
- }
422
- trackByMessageId(_index, item) {
423
- return item?.id;
424
- }
425
- trackConversationKey(conversation) {
426
- return conversation?.id ?? conversation?.to?.slug ?? conversation?.to?.id ?? '';
427
- }
428
- animateOnScroll() {
429
- setTimeout(() => {
430
- if (window['jQuery'] && $('#chats-wrapper')?.length) {
431
- $('#chats-wrapper')
432
- .stop()
433
- .animate({
434
- scrollTop: $('#chats-wrapper')[0].scrollHeight
435
- }, 800);
436
- }
437
- });
438
- }
439
- getMessageType(filename) {
440
- const ext = this.getExtension(filename);
441
- switch (ext.toLowerCase()) {
442
- case 'jpg':
443
- case 'gif':
444
- case 'bmp':
445
- case 'png':
446
- return ATTACHMENT_TYPE.IMG;
447
- case 'm4v':
448
- case 'avi':
449
- case 'mpg':
450
- case 'mp4':
451
- return ATTACHMENT_TYPE.VIDEO;
452
- default:
453
- return '';
454
- }
455
- }
456
- getExtension(filename) {
457
- const parts = filename.split('.');
458
- return parts[parts.length - 1];
459
- }
460
- recipientSearch() {
461
- lastValueFrom(this.mailboxService.getRecipient({
462
- page: 1,
463
- page_size: 20,
464
- subscription_id: PermissionService.selectedSubscription?.id,
465
- search: this.searchText
466
- })).then(response => {
467
- this.recipients = response.filter(x => x?.id !== this.currentUser?.id);
468
- this.cdr.markForCheck();
469
- });
470
- }
471
- onMemberSelection(member) {
472
- this.otherUser = member;
473
- this.router.navigate(['/message'], { fragment: member.slug });
474
- }
475
- onDeleteMessage(message) {
476
- this.confirmDialog
477
- .confirmDelete({
478
- textKey: 'Common.Confirm.Delete.TextSimple',
479
- textParams: { entityType: 'message' }
480
- })
481
- .then(ok => {
482
- if (!ok) {
483
- return;
484
- }
485
- this.mailboxService
486
- .deleteMessage(this.selectedConversationId, message?.id)
487
- .subscribe(response => {
488
- if (response?.status_code === 200) {
489
- const createdAt = moment(message.created_at).format('YYYYMMDD');
490
- // eslint-disable-next-line no-restricted-syntax
491
- for (const property in this.messagesGroupedByDate) {
492
- if (property === createdAt) {
493
- this.messagesGroupedByDate[property] =
494
- this.messagesGroupedByDate[property].filter(x => x?.id !== message?.id);
495
- }
496
- }
497
- }
498
- this.cdr.markForCheck();
499
- });
500
- });
501
- }
502
- waitForJQuery(callback) {
503
- let attempts = 0;
504
- const maxAttempts = 100; // 10 seconds max wait time
505
- const checkJQuery = () => {
506
- if (window['jQuery']) {
507
- console.log('jQuery detected, loading chat.js');
508
- callback();
509
- }
510
- else if (attempts < maxAttempts) {
511
- attempts++;
512
- setTimeout(checkJQuery, 100);
513
- }
514
- else {
515
- console.log('jQuery not available, loading it now for chatbox');
516
- // Load jQuery since it's needed
517
- this.loadJQueryForChatbox(callback);
518
- }
519
- };
520
- checkJQuery();
521
- }
522
- loadJQueryForChatbox(callback) {
523
- const jquerySrc = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js';
524
- const script = document.createElement('script');
525
- script.src = jquerySrc;
526
- script.crossOrigin = 'anonymous';
527
- script.async = false;
528
- script.onload = () => {
529
- console.log('jQuery loaded for chatbox');
530
- callback();
531
- };
532
- script.onerror = () => {
533
- console.error('Failed to load jQuery for chatbox');
534
- // Try fallback
535
- const fallbackScript = document.createElement('script');
536
- fallbackScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js';
537
- fallbackScript.integrity =
538
- 'sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK';
539
- fallbackScript.crossOrigin = 'anonymous';
540
- fallbackScript.async = false;
541
- fallbackScript.onload = () => {
542
- console.log('jQuery loaded from Google CDN for chatbox');
543
- callback();
544
- };
545
- fallbackScript.onerror = () => {
546
- console.error('All jQuery CDNs failed for chatbox');
547
- };
548
- document.head.appendChild(fallbackScript);
549
- };
550
- document.head.appendChild(script);
551
- }
552
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: ChatBoxComponent, deps: [{ token: i0.ElementRef }, { token: i1.MailBoxService }, { token: i1.ProfileService }, { token: i1.WebsocketService }, { token: i1.ScriptLoaderService }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: i2.ConfirmDialogService }], target: i0.ɵɵFactoryTarget.Component }); }
553
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: ChatBoxComponent, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "messageInputRef", first: true, predicate: ["messageInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"chat-application mt-5\">\n <div class=\"content-overlay\"></div>\n\n @if (isChatLoading) {\n <div class=\"text-center\">\n <p-progressSpinner> </p-progressSpinner>\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-autoComplete appendTo=\"body\" inputId=\"chatbox-search-member\"\n [(ngModel)]=\"searchText\"\n #searchTxt\n placeholder=\"Search members...\"\n [ngModelOptions]=\"{ standalone: true }\"\n optionLabel=\"first_name\"\n (onSelect)=\"onMemberSelection(searchText)\"\n [suggestions]=\"recipients\"\n (completeMethod)=\"recipientSearch()\">\n <ng-template let-item\n pTemplate=\"item\">\n <div>\n {{ item.first_name + ' ' }}\n {{ item.last_name ? item.last_name : '' }}\n </div>\n </ng-template>\n </p-autoComplete>\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=\"avatar\" />\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=\"avatar\"\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=\"avatar\" />\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=\"avatar\" />\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=\"message attachment\"\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=\"English\" />\n Your browser does not support the video\n tag.\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\">No message history.</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=\"Pick your emoji\u2026\"\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\" aria-label=\"Insert emoji\" (click)=\"showEmoji = !showEmoji\">\uD83D\uDE42</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">Type your message</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n placeholder=\"Type your message here...\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n aria-label=\"Type your message here...\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">Attach file</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 aria-label=\"File Input\" />\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\">Send</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=\"No Chat\" />\n </div>\n <div class=\"h4 mt-4\">No messages yet!</div>\n <div class=\"mt-3\">\n <p>It looks like you haven't shared or received any messages yet.</p>\n <p>\n Start typing the name of the member you want to send a message to\n in the chat search field and send them a message.\n </p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n", 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);--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"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner, p-progress-spinner, p-progressspinner", inputs: ["styleClass", "strokeWidth", "fill", "animationDuration", "ariaLabel"] }, { kind: "directive", type: i6.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i7.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "minQueryLength", "delay", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "addOnTab", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "addOnBlur", "separator", "appendTo", "motionOptions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onAdd", "onFocus", "onBlur", "onDropdownClick", "onClear", "onInputKeydown", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "component", type: i8.PickerComponent, selector: "emoji-mart", inputs: ["perLine", "totalFrequentLines", "i18n", "style", "title", "emoji", "darkMode", "color", "hideObsolete", "categories", "activeCategories", "set", "skin", "isNative", "emojiSize", "sheetSize", "emojisToShowFilter", "showPreview", "emojiTooltip", "autoFocus", "custom", "hideRecent", "imageUrlFn", "include", "exclude", "notFoundEmoji", "categoriesIcons", "searchIcons", "useButton", "enableFrequentEmojiSort", "enableSearch", "showSingleCategory", "virtualize", "virtualizeOffset", "recent", "backgroundImageFn"], outputs: ["emojiClick", "emojiSelect", "skinChange"] }, { kind: "directive", type: i9.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "pipe", type: i3.DatePipe, name: "date" }, { kind: "pipe", type: i10.TextTruncatePipe, name: "textTruncate" }, { kind: "pipe", type: i10.CommonPipe, name: "common" }] }); }
554
- }
555
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: ChatBoxComponent, decorators: [{
556
- type: Component,
557
- args: [{ standalone: false, template: "<div class=\"chat-application mt-5\">\n <div class=\"content-overlay\"></div>\n\n @if (isChatLoading) {\n <div class=\"text-center\">\n <p-progressSpinner> </p-progressSpinner>\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-autoComplete appendTo=\"body\" inputId=\"chatbox-search-member\"\n [(ngModel)]=\"searchText\"\n #searchTxt\n placeholder=\"Search members...\"\n [ngModelOptions]=\"{ standalone: true }\"\n optionLabel=\"first_name\"\n (onSelect)=\"onMemberSelection(searchText)\"\n [suggestions]=\"recipients\"\n (completeMethod)=\"recipientSearch()\">\n <ng-template let-item\n pTemplate=\"item\">\n <div>\n {{ item.first_name + ' ' }}\n {{ item.last_name ? item.last_name : '' }}\n </div>\n </ng-template>\n </p-autoComplete>\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=\"avatar\" />\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=\"avatar\"\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=\"avatar\" />\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=\"avatar\" />\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=\"message attachment\"\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=\"English\" />\n Your browser does not support the video\n tag.\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\">No message history.</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=\"Pick your emoji\u2026\"\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\" aria-label=\"Insert emoji\" (click)=\"showEmoji = !showEmoji\">\uD83D\uDE42</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">Type your message</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n placeholder=\"Type your message here...\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n aria-label=\"Type your message here...\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">Attach file</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 aria-label=\"File Input\" />\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\">Send</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=\"No Chat\" />\n </div>\n <div class=\"h4 mt-4\">No messages yet!</div>\n <div class=\"mt-3\">\n <p>It looks like you haven't shared or received any messages yet.</p>\n <p>\n Start typing the name of the member you want to send a message to\n in the chat search field and send them a message.\n </p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n", 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);--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"] }]
558
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MailBoxService }, { type: i1.ProfileService }, { type: i1.WebsocketService }, { type: i1.ScriptLoaderService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i2.ConfirmDialogService }], propDecorators: { messageInputRef: [{
559
- type: ViewChild,
560
- args: ['messageInput', { static: false }]
561
- }] } });
562
-
563
- const routes = [
564
- {
565
- path: '',
566
- component: ChatBoxComponent,
567
- data: {
568
- title: 'Chat'
569
- }
570
- },
571
- {
572
- path: ':memberId',
573
- component: ChatBoxComponent,
574
- data: {
575
- title: 'Chat'
576
- }
577
- }
578
- ];
579
- class MessageRoutingModule {
580
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MessageRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
581
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.19", ngImport: i0, type: MessageRoutingModule, imports: [i1$1.RouterModule], exports: [RouterModule] }); }
582
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MessageRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] }); }
583
- }
584
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MessageRoutingModule, decorators: [{
585
- type: NgModule,
586
- args: [{
587
- imports: [RouterModule.forChild(routes)],
588
- exports: [RouterModule]
589
- }]
590
- }] });
591
-
592
- class MessagingModule {
593
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MessagingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
594
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.19", ngImport: i0, type: MessagingModule, declarations: [ChatBoxComponent], imports: [CommonModule,
595
- PipesModule,
596
- FormsModule,
597
- MessageRoutingModule,
598
- ProgressSpinnerModule,
599
- AutoCompleteModule,
600
- PickerModule,
601
- EmojiModule,
602
- NgxFileDropModule,
603
- InfiniteScrollModule,
604
- ScrollingModule], exports: [RouterModule, ChatBoxComponent] }); }
605
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MessagingModule, imports: [CommonModule,
606
- PipesModule,
607
- FormsModule,
608
- MessageRoutingModule,
609
- ProgressSpinnerModule,
610
- AutoCompleteModule,
611
- PickerModule,
612
- EmojiModule,
613
- NgxFileDropModule,
614
- InfiniteScrollModule,
615
- ScrollingModule, RouterModule] }); }
616
- }
617
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: MessagingModule, decorators: [{
618
- type: NgModule,
619
- args: [{
620
- imports: [
621
- CommonModule,
622
- PipesModule,
623
- FormsModule,
624
- MessageRoutingModule,
625
- ProgressSpinnerModule,
626
- AutoCompleteModule,
627
- PickerModule,
628
- EmojiModule,
629
- NgxFileDropModule,
630
- InfiniteScrollModule,
631
- ScrollingModule
632
- ],
633
- declarations: [ChatBoxComponent],
634
- exports: [RouterModule, ChatBoxComponent]
635
- }]
636
- }] });
637
-
638
- /**
639
- * Generated bundle index. Do not edit.
640
- */
641
-
1
+ import { ScrollingModule } from "@angular/cdk/scrolling";
2
+ import * as i3 from "@angular/common";
3
+ import { CommonModule } from "@angular/common";
4
+ import * as i0 from "@angular/core";
5
+ import { Component, NgModule, ViewChild } from "@angular/core";
6
+ import * as i4 from "@angular/forms";
7
+ import { FormsModule } from "@angular/forms";
8
+ import * as i1 from "@angular/router";
9
+ import { RouterModule } from "@angular/router";
10
+ import * as i9 from "@posiwise/pipes";
11
+ import { PipesModule } from "@posiwise/pipes";
12
+ import { NgxFileDropModule } from "ngx-file-drop";
13
+ import * as i8 from "ngx-infinite-scroll";
14
+ import { InfiniteScrollModule } from "ngx-infinite-scroll";
15
+ import * as i6 from "primeng/autocomplete";
16
+ import { AutoCompleteModule } from "primeng/autocomplete";
17
+ import * as i5 from "primeng/progressspinner";
18
+ import { ProgressSpinnerModule } from "primeng/progressspinner";
19
+ import * as i7 from "@ctrl/ngx-emoji-mart";
20
+ import { PickerModule } from "@ctrl/ngx-emoji-mart";
21
+ import { EmojiModule } from "@ctrl/ngx-emoji-mart/ngx-emoji";
22
+ import { AppBaseComponent } from "@posiwise/app-base-component";
23
+ import * as i1$1 from "@posiwise/common-services";
24
+ import { PermissionService } from "@posiwise/common-services";
25
+ import { ATTACHMENT_TYPE, ChatUser, Conversation, SOCKET_TYPE } from "@posiwise/common-utilities";
26
+ import groupBy from "lodash/groupBy";
27
+ import sortBy from "lodash/sortBy";
28
+ import uniqBy from "lodash/uniqBy";
29
+ import moment from "moment";
30
+ import { lastValueFrom } from "rxjs";
31
+ import * as i2 from "@posiwise/shared-components";
32
+ var ChatBoxComponent = class ChatBoxComponent extends AppBaseComponent {
33
+ constructor(elRef, mailboxService, profileService, socketService, scriptLoader, injector, cdr, confirmDialog) {
34
+ super(injector);
35
+ this.elRef = elRef;
36
+ this.mailboxService = mailboxService;
37
+ this.profileService = profileService;
38
+ this.socketService = socketService;
39
+ this.scriptLoader = scriptLoader;
40
+ this.cdr = cdr;
41
+ this.confirmDialog = confirmDialog;
42
+ this.ObjectKeys = Object.keys;
43
+ this.showEmoji = false;
44
+ this.pristineConversation = [];
45
+ this.isDrift = true;
46
+ this.units = [
47
+ "B",
48
+ "KB",
49
+ "MB",
50
+ "GB",
51
+ "TB",
52
+ "PB"
53
+ ];
54
+ this.initialLoad = true;
55
+ this.selectedIndex = 0;
56
+ this.totalMessages = 0;
57
+ this.currentThreads = [];
58
+ this.conversations = [];
59
+ this.messagesGroupedByDate = {};
60
+ this.recipients = [];
61
+ this.files = [];
62
+ this.attachedFiles = [];
63
+ this.isChatLoading = true;
64
+ this.currentPage = 1;
65
+ this.isLoaded = true;
66
+ this.throttle = 300;
67
+ this.scrollUpDistance = 2;
68
+ this.scrollDistance = 1;
69
+ this.ATTACHMENT_TYPE = ATTACHMENT_TYPE;
70
+ }
71
+ onImgError(event, fallbackSrc) {
72
+ const img = event.target;
73
+ if (!img) return;
74
+ if (img.src?.endsWith(fallbackSrc)) return;
75
+ img.src = fallbackSrc;
76
+ }
77
+ onUp(_ev, conversationId) {
78
+ this.currentPage++;
79
+ const totalPages = Math.ceil(this.totalMessages / 10);
80
+ if (this.currentPage <= totalPages) this.loadMore(conversationId, this.currentPage);
81
+ }
82
+ ngOnInit() {
83
+ this.waitForJQuery(() => {
84
+ this.scriptLoader.loadScriptOnce("head", "/assets/js/chat.js");
85
+ });
86
+ this.listenToNewMessage();
87
+ this.subscriptionId = PermissionService.selectedSubscription?.id;
88
+ this.userStore().subscribe((resp) => {
89
+ this.currentUser = resp;
90
+ if (this.currentUser) this.mailboxService.getConversations().subscribe((response) => {
91
+ if (response?.length) {
92
+ let raw;
93
+ if (this.conversations.length > 0) raw = this.conversations.find((x) => x?.id === null);
94
+ response.forEach((x) => {
95
+ x.datetime = x.latest_message.created_at;
96
+ });
97
+ const chats = sortBy(response, "datetime").reverse();
98
+ this.pristineConversation = chats;
99
+ this.conversations = [...chats];
100
+ if (raw) this.conversations.unshift(raw);
101
+ this.parseConversation();
102
+ setTimeout(() => this.filterConversations());
103
+ }
104
+ if (this.initialLoad) this.checkIfNewConversation();
105
+ else this.activateThread();
106
+ this.cdr.markForCheck();
107
+ }).add(() => {
108
+ this.isChatLoading = false;
109
+ this.initialLoad = false;
110
+ this.cdr.markForCheck();
111
+ });
112
+ this.cdr.markForCheck();
113
+ });
114
+ }
115
+ filterConversations() {
116
+ this.conversations = this.conversations.filter((conversation) => conversation.to);
117
+ }
118
+ ngDoCheck() {
119
+ if (window["jQuery"] && this.isDrift) {
120
+ if ($("#drift-widget-container").length > 0 && $("#drift-widget-container:visible")) {
121
+ this.isDrift = false;
122
+ $("#drift-widget-container").hide();
123
+ }
124
+ }
125
+ }
126
+ ngOnDestroy() {
127
+ if (window["jQuery"]) $(".drift-widget-container").show();
128
+ }
129
+ parseConversation() {
130
+ this.conversations.forEach((element, index) => {
131
+ element.to = element.participants.find((x) => x?.id !== this.currentUser?.id);
132
+ element.from = element.participants.find((x) => x?.id === this.currentUser?.id);
133
+ if (index === 0) this.currentUserImg = element.from?.avatar ?? "/assets/img/icons/male.png";
134
+ });
135
+ }
136
+ activateThread() {
137
+ setTimeout(() => {
138
+ if (window["jQuery"]) {
139
+ const selector = `.list-group-item:nth-child(${this.selectedIndex + 1})`;
140
+ $(selector).removeClass("no-border").addClass("list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2");
141
+ }
142
+ });
143
+ }
144
+ checkIfNewConversation() {
145
+ this.route.fragment.subscribe((fragment) => {
146
+ if (fragment) {
147
+ const existingConversation = this.conversations.find((x) => x.to?.slug === fragment);
148
+ if (existingConversation) {
149
+ this.otherUser = existingConversation.to;
150
+ this.setActive(existingConversation);
151
+ } else this.newParticipant(fragment);
152
+ } else if (this.conversations.length > 0) this.router.navigate(["/message"], { fragment: this.conversations[0].to?.slug });
153
+ this.cdr.markForCheck();
154
+ });
155
+ }
156
+ onParticipantClick(conversation) {
157
+ this.otherUser = conversation.participants.find((x) => x?.id !== this.currentUser?.id);
158
+ const slug = this.otherUser?.slug;
159
+ this.clearUnreadCount();
160
+ this.router.navigate(["/message"], { fragment: slug });
161
+ }
162
+ newParticipant(slug) {
163
+ this.profileService.getUserProfile(slug).subscribe((response) => {
164
+ this.otherUser = response;
165
+ const to = new ChatUser(response?.id, response?.first_name, response?.slug, response?.email, response?.avatar ? response?.avatar[0]?.url : "", /* @__PURE__ */ new Date());
166
+ const from = new ChatUser(this.currentUser?.id, this.currentUser?.firstName, this.currentUser?.slug, this.currentUser?.email, this.currentUser?.avatar ? this.currentUser?.avatar[0].url : "/assets/img/icons/male.png", /* @__PURE__ */ new Date());
167
+ const newConversation = new Conversation(null, 1, null, "chat", [to, from], null, 0, from, to);
168
+ this.conversations.unshift(newConversation);
169
+ this.setActive(this.conversations[0]);
170
+ this.cdr.markForCheck();
171
+ });
172
+ }
173
+ setActive(conversation) {
174
+ this.currentPage = 0;
175
+ this.currentThreads = [];
176
+ this.totalMessages = 0;
177
+ this.otherUser = conversation.participants.find((x) => x?.id !== this.currentUser?.id);
178
+ this.selectedConversationId = conversation?.id;
179
+ this.currentConversation = conversation;
180
+ const allAnchors = this.elRef.nativeElement.getElementsByClassName("list-group-item");
181
+ Array.from(allAnchors).forEach((item) => {
182
+ item.setAttribute("class", "list-group-item no-border");
183
+ });
184
+ const index = this.conversations.findIndex((x) => x?.to?.id === this.otherUser?.id) || 0;
185
+ setTimeout(() => {
186
+ if (window["jQuery"]) {
187
+ $(`.list-group-item:nth-child(${index + 1})`).removeClass("no-border").addClass("list-group-item bg-blue-grey bg-lighten-5 border-right-primary border-right-2");
188
+ this.selectedIndex = $(".list-group-item.border-right-2").index();
189
+ }
190
+ }, 500);
191
+ this.markAsRead(conversation?.id);
192
+ this.getMessage(conversation?.id);
193
+ }
194
+ search(searchTxt) {
195
+ if (searchTxt?.value?.length > 2) this.conversations = this.pristineConversation.filter((x) => x.to.slug.includes(searchTxt.value) ?? x.to?.email.includes(searchTxt.value));
196
+ else this.conversations = this.pristineConversation;
197
+ }
198
+ listenToNewMessage() {
199
+ this.socketService.webSocket$.subscribe((result) => {
200
+ if (result.event === SOCKET_TYPE.MSG) {
201
+ if (result?.new_conversation === "false") {
202
+ const newMessage = result?.data;
203
+ newMessage.formattedDate = moment(new Date(newMessage.created_at)).format("YYYYMMDD");
204
+ const conversation = this.conversations.find((x) => x?.id === result?.id);
205
+ if (conversation) {
206
+ conversation.latest_message = result.data;
207
+ conversation.created_at = newMessage.created_at;
208
+ conversation.unread_count += 1;
209
+ }
210
+ if (newMessage.conversation_id === this.selectedConversationId && newMessage.formattedDate in this.messagesGroupedByDate) {
211
+ this.messagesGroupedByDate[newMessage.formattedDate].push(newMessage);
212
+ this.animateOnScroll();
213
+ }
214
+ } else if (result && typeof result.new_conversation === "object") {
215
+ this.conversations.unshift(result.new_conversation);
216
+ this.parseConversation();
217
+ }
218
+ }
219
+ this.cdr.markForCheck();
220
+ });
221
+ }
222
+ getMessage(messageId, reload = true) {
223
+ if (reload) this.messagesGroupedByDate = null;
224
+ if (messageId) {
225
+ this.isLoaded = false;
226
+ this.mailboxService.getMessages(messageId).subscribe((response) => {
227
+ if (response) {
228
+ this.totalMessages = response.object_count;
229
+ this.currentThreads = response.messages;
230
+ if (!this.conversations.some((x) => x?.id === response?.id)) this.conversations.find((x) => x?.id === null).id = response?.id;
231
+ const messages = sortBy(response.messages, "created_at");
232
+ messages.forEach((msg) => {
233
+ msg.messageType = msg.attachment.url ? this.getMessageType(msg.attachment.url) : null;
234
+ });
235
+ this.messagesGroupedByDate = groupBy(messages, (o) => {
236
+ return moment(o.created_at).format("YYYYMMDD");
237
+ });
238
+ const current = this.conversations.find((x) => x?.id === response?.id).latest_message;
239
+ if (current) {
240
+ current.body = response.messages[0].body;
241
+ current.created_at = response.messages[0].created_at;
242
+ }
243
+ }
244
+ this.cdr.markForCheck();
245
+ }).add(() => {
246
+ this.isChatLoading = false;
247
+ this.isLoaded = true;
248
+ this.animateOnScroll();
249
+ this.cdr.markForCheck();
250
+ });
251
+ }
252
+ }
253
+ loadMore(conversationId, pageNumber, pageSize = 10) {
254
+ this.mailboxService.getMessages(conversationId, pageNumber, pageSize).subscribe((response) => {
255
+ if (response) {
256
+ this.currentThreads = uniqBy(this.currentThreads.concat(response.messages), "id");
257
+ const messages = sortBy(this.currentThreads, "created_at");
258
+ this.messagesGroupedByDate = groupBy(messages, (o) => {
259
+ return moment(o.created_at).format("YYYYMMDD");
260
+ });
261
+ }
262
+ this.cdr.markForCheck();
263
+ });
264
+ }
265
+ clearUnreadCount() {
266
+ this.mailboxService.decrementUnreadCount(this.currentConversation?.unread_count);
267
+ if (this.currentConversation?.["unread_count"]) this.currentConversation["unread_count"] = 0;
268
+ }
269
+ onSendMessage() {
270
+ const text = this.messageInputRef.nativeElement.value;
271
+ const formData = new FormData();
272
+ formData.append("to", this.otherUser?.email);
273
+ formData.append("message", text);
274
+ formData.append("type", "1");
275
+ formData.append("subscription_id", `${this.subscriptionId}`);
276
+ if (this.files?.length) {
277
+ this.isFileUploading = true;
278
+ formData.append("file", this.files[0], this.files[0].name);
279
+ }
280
+ if (text || this.files.length > 0) this.mailboxService.postMessage(formData).subscribe((response) => {
281
+ this.files = [];
282
+ this.attachedFiles = [];
283
+ this.messageInputRef.nativeElement.value = "";
284
+ this.messageInputRef.nativeElement.focus();
285
+ this.getMessage(response.conversation_id, false);
286
+ this.cdr.markForCheck();
287
+ }).add(() => {
288
+ this.isFileUploading = false;
289
+ this.cdr.markForCheck();
290
+ });
291
+ }
292
+ markAsRead(conversationId) {
293
+ if (conversationId) {
294
+ this.clearUnreadCount();
295
+ this.mailboxService.markAsRead(conversationId).subscribe(() => {
296
+ this.conversations.find((x) => x?.id === conversationId).unread_count = 0;
297
+ this.cdr.markForCheck();
298
+ });
299
+ }
300
+ }
301
+ transform(bytes = 0, precision = 2) {
302
+ if (Number.isNaN(Number.parseFloat(String(bytes))) || !Number.isFinite(bytes)) return "?";
303
+ let unit = 0;
304
+ while (bytes >= 1024) {
305
+ bytes /= 1024;
306
+ unit++;
307
+ }
308
+ return `${bytes.toFixed(+precision)} ${this.units[unit]}`;
309
+ }
310
+ dropped(files) {
311
+ for (const droppedFile of files) if (droppedFile.fileEntry.isFile) droppedFile.fileEntry.file((file) => {
312
+ this.files.push(file);
313
+ this.attachedFiles.push({
314
+ name: file.name,
315
+ size: this.transform(Number(file.size))
316
+ });
317
+ });
318
+ }
319
+ onRemoveAttachment(item) {
320
+ this.files = this.files.filter((x) => x.name !== item.name);
321
+ this.attachedFiles = this.attachedFiles.filter((x) => x.name !== item.name);
322
+ }
323
+ fileOver(_event) {
324
+ console.log();
325
+ }
326
+ onEmojiSelect($event) {
327
+ this.messageInputRef.nativeElement.value += $event.emoji.native;
328
+ this.showEmoji = false;
329
+ }
330
+ fileChangeListener($event) {
331
+ const file = $event.target.files[0];
332
+ this.files.push(file);
333
+ this.attachedFiles.push({
334
+ name: file.name,
335
+ size: this.transform(Number(file.size / 1024))
336
+ });
337
+ }
338
+ toggleSidebar() {
339
+ if (window["jQuery"]) {
340
+ $(".chat-sidebar").removeClass("d-none d-sm-none").addClass("d-block d-sm-block");
341
+ $(".content-overlay").addClass("show");
342
+ }
343
+ }
344
+ trackByMessageId(_index, item) {
345
+ return item?.id;
346
+ }
347
+ trackConversationKey(conversation) {
348
+ return conversation?.id ?? conversation?.to?.slug ?? conversation?.to?.id ?? "";
349
+ }
350
+ animateOnScroll() {
351
+ setTimeout(() => {
352
+ if (window["jQuery"] && $("#chats-wrapper")?.length) $("#chats-wrapper").stop().animate({ scrollTop: $("#chats-wrapper")[0].scrollHeight }, 800);
353
+ });
354
+ }
355
+ getMessageType(filename) {
356
+ switch (this.getExtension(filename).toLowerCase()) {
357
+ case "jpg":
358
+ case "gif":
359
+ case "bmp":
360
+ case "png": return ATTACHMENT_TYPE.IMG;
361
+ case "m4v":
362
+ case "avi":
363
+ case "mpg":
364
+ case "mp4": return ATTACHMENT_TYPE.VIDEO;
365
+ default: return "";
366
+ }
367
+ }
368
+ getExtension(filename) {
369
+ const parts = filename.split(".");
370
+ return parts[parts.length - 1];
371
+ }
372
+ recipientSearch() {
373
+ lastValueFrom(this.mailboxService.getRecipient({
374
+ page: 1,
375
+ page_size: 20,
376
+ subscription_id: PermissionService.selectedSubscription?.id,
377
+ search: this.searchText
378
+ })).then((response) => {
379
+ this.recipients = response.filter((x) => x?.id !== this.currentUser?.id);
380
+ this.cdr.markForCheck();
381
+ });
382
+ }
383
+ onMemberSelection(member) {
384
+ this.otherUser = member;
385
+ this.router.navigate(["/message"], { fragment: member.slug });
386
+ }
387
+ onDeleteMessage(message) {
388
+ this.confirmDialog.confirmDelete({
389
+ textKey: "Common.Confirm.Delete.TextSimple",
390
+ textParams: { entityType: "message" }
391
+ }).then((ok) => {
392
+ if (!ok) return;
393
+ this.mailboxService.deleteMessage(this.selectedConversationId, message?.id).subscribe((response) => {
394
+ if (response?.status_code === 200) {
395
+ const createdAt = moment(message.created_at).format("YYYYMMDD");
396
+ for (const property in this.messagesGroupedByDate) if (property === createdAt) this.messagesGroupedByDate[property] = this.messagesGroupedByDate[property].filter((x) => x?.id !== message?.id);
397
+ }
398
+ this.cdr.markForCheck();
399
+ });
400
+ });
401
+ }
402
+ waitForJQuery(callback) {
403
+ let attempts = 0;
404
+ const maxAttempts = 100;
405
+ const checkJQuery = () => {
406
+ if (window["jQuery"]) {
407
+ console.log("jQuery detected, loading chat.js");
408
+ callback();
409
+ } else if (attempts < maxAttempts) {
410
+ attempts++;
411
+ setTimeout(checkJQuery, 100);
412
+ } else {
413
+ console.log("jQuery not available, loading it now for chatbox");
414
+ this.loadJQueryForChatbox(callback);
415
+ }
416
+ };
417
+ checkJQuery();
418
+ }
419
+ loadJQueryForChatbox(callback) {
420
+ const jquerySrc = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js";
421
+ const script = document.createElement("script");
422
+ script.src = jquerySrc;
423
+ script.crossOrigin = "anonymous";
424
+ script.async = false;
425
+ script.onload = () => {
426
+ console.log("jQuery loaded for chatbox");
427
+ callback();
428
+ };
429
+ script.onerror = () => {
430
+ console.error("Failed to load jQuery for chatbox");
431
+ const fallbackScript = document.createElement("script");
432
+ fallbackScript.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js";
433
+ fallbackScript.integrity = "sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK";
434
+ fallbackScript.crossOrigin = "anonymous";
435
+ fallbackScript.async = false;
436
+ fallbackScript.onload = () => {
437
+ console.log("jQuery loaded from Google CDN for chatbox");
438
+ callback();
439
+ };
440
+ fallbackScript.onerror = () => {
441
+ console.error("All jQuery CDNs failed for chatbox");
442
+ };
443
+ document.head.appendChild(fallbackScript);
444
+ };
445
+ document.head.appendChild(script);
446
+ }
447
+ static {
448
+ this.ɵfac = i0.ɵɵngDeclareFactory({
449
+ minVersion: "12.0.0",
450
+ version: "22.2.0",
451
+ ngImport: i0,
452
+ type: ChatBoxComponent,
453
+ deps: [
454
+ { token: i0.ElementRef },
455
+ { token: i1$1.MailBoxService },
456
+ { token: i1$1.ProfileService },
457
+ { token: i1$1.WebsocketService },
458
+ { token: i1$1.ScriptLoaderService },
459
+ { token: i0.Injector },
460
+ { token: i0.ChangeDetectorRef },
461
+ { token: i2.ConfirmDialogService }
462
+ ],
463
+ target: i0.ɵɵFactoryTarget.Component
464
+ });
465
+ }
466
+ static {
467
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
468
+ minVersion: "17.0.0",
469
+ version: "22.2.0",
470
+ type: ChatBoxComponent,
471
+ isStandalone: false,
472
+ selector: "ng-component",
473
+ viewQueries: [{
474
+ propertyName: "messageInputRef",
475
+ first: true,
476
+ predicate: ["messageInput"],
477
+ descendants: true
478
+ }],
479
+ usesInheritance: true,
480
+ ngImport: i0,
481
+ 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=\"Search members...\"\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=\"avatar\" />\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=\"avatar\"\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=\"avatar\" />\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=\"avatar\" />\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=\"message attachment\"\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=\"English\" />\n Your browser does not support the video\n tag.\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\">No message history.</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=\"Pick your emoji…\"\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\" aria-label=\"Insert emoji\" (click)=\"showEmoji = !showEmoji\">🙂</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">Type your message</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n placeholder=\"Type your message here...\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n aria-label=\"Type your message here...\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">Attach file</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 aria-label=\"File Input\" />\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\">Send</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=\"No Chat\" />\n </div>\n <div class=\"h4 mt-4\">No messages yet!</div>\n <div class=\"mt-3\">\n <p>It looks like you haven't shared or received any messages yet.</p>\n <p>\n Start typing the name of the member you want to send a message to\n in the chat search field and send them a message.\n </p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n",
482
+ 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);--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"],
483
+ dependencies: [
484
+ {
485
+ kind: "directive",
486
+ type: i3.NgClass,
487
+ selector: "[ngClass]",
488
+ inputs: ["class", "ngClass"]
489
+ },
490
+ {
491
+ kind: "directive",
492
+ type: i4.ɵNgNoValidate,
493
+ selector: "form:not([ngNoForm]):not([ngNativeValidate])"
494
+ },
495
+ {
496
+ kind: "directive",
497
+ type: i4.NgControlStatus,
498
+ selector: "[formControlName],[ngModel],[formControl]"
499
+ },
500
+ {
501
+ kind: "directive",
502
+ type: i4.NgControlStatusGroup,
503
+ selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
504
+ },
505
+ {
506
+ kind: "directive",
507
+ type: i4.NgModel,
508
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
509
+ inputs: [
510
+ "name",
511
+ "disabled",
512
+ "ngModel",
513
+ "ngModelOptions"
514
+ ],
515
+ outputs: ["ngModelChange"],
516
+ exportAs: ["ngModel"]
517
+ },
518
+ {
519
+ kind: "directive",
520
+ type: i4.NgForm,
521
+ selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
522
+ inputs: ["ngFormOptions"],
523
+ outputs: ["ngSubmit"],
524
+ exportAs: ["ngForm"]
525
+ },
526
+ {
527
+ kind: "component",
528
+ type: i5.ProgressSpinner,
529
+ selector: "p-progress-spinner, p-progressspinner",
530
+ inputs: [
531
+ "value",
532
+ "strokeWidth",
533
+ "animationDuration",
534
+ "min",
535
+ "max",
536
+ "ariaLabel",
537
+ "fill"
538
+ ]
539
+ },
540
+ {
541
+ kind: "component",
542
+ type: i6.AutoComplete,
543
+ selector: "p-autocomplete, p-auto-complete",
544
+ inputs: [
545
+ "minQueryLength",
546
+ "delay",
547
+ "panelStyle",
548
+ "panelStyleClass",
549
+ "inputStyle",
550
+ "inputId",
551
+ "inputStyleClass",
552
+ "placeholder",
553
+ "readonly",
554
+ "scrollHeight",
555
+ "lazy",
556
+ "virtualScroll",
557
+ "virtualScrollItemSize",
558
+ "virtualScrollOptions",
559
+ "autoHighlight",
560
+ "forceSelection",
561
+ "type",
562
+ "autoZIndex",
563
+ "baseZIndex",
564
+ "ariaLabel",
565
+ "dropdownAriaLabel",
566
+ "ariaLabelledBy",
567
+ "dropdownIcon",
568
+ "unique",
569
+ "group",
570
+ "completeOnFocus",
571
+ "showClear",
572
+ "dropdown",
573
+ "showEmptyMessage",
574
+ "dropdownMode",
575
+ "multiple",
576
+ "addOnTab",
577
+ "tabindex",
578
+ "dataKey",
579
+ "emptyMessage",
580
+ "autofocus",
581
+ "autocomplete",
582
+ "optionGroupChildren",
583
+ "optionGroupLabel",
584
+ "overlayOptions",
585
+ "suggestions",
586
+ "optionLabel",
587
+ "optionValue",
588
+ "id",
589
+ "searchMessage",
590
+ "emptySelectionMessage",
591
+ "selectionMessage",
592
+ "autoOptionFocus",
593
+ "selectOnFocus",
594
+ "searchLocale",
595
+ "optionDisabled",
596
+ "focusOnHover",
597
+ "typeahead",
598
+ "addOnBlur",
599
+ "separator",
600
+ "appendTo",
601
+ "motionOptions"
602
+ ],
603
+ outputs: [
604
+ "completeMethod",
605
+ "onSelect",
606
+ "onUnselect",
607
+ "onAdd",
608
+ "onFocus",
609
+ "onBlur",
610
+ "onDropdownClick",
611
+ "onClear",
612
+ "onInputKeydown",
613
+ "onKeyUp",
614
+ "onShow",
615
+ "onHide",
616
+ "onLazyLoad"
617
+ ]
618
+ },
619
+ {
620
+ kind: "component",
621
+ type: i7.PickerComponent,
622
+ selector: "emoji-mart",
623
+ inputs: [
624
+ "perLine",
625
+ "totalFrequentLines",
626
+ "i18n",
627
+ "style",
628
+ "title",
629
+ "emoji",
630
+ "darkMode",
631
+ "color",
632
+ "hideObsolete",
633
+ "categories",
634
+ "activeCategories",
635
+ "set",
636
+ "skin",
637
+ "isNative",
638
+ "emojiSize",
639
+ "sheetSize",
640
+ "emojisToShowFilter",
641
+ "showPreview",
642
+ "emojiTooltip",
643
+ "autoFocus",
644
+ "custom",
645
+ "hideRecent",
646
+ "imageUrlFn",
647
+ "include",
648
+ "exclude",
649
+ "notFoundEmoji",
650
+ "categoriesIcons",
651
+ "searchIcons",
652
+ "useButton",
653
+ "enableFrequentEmojiSort",
654
+ "enableSearch",
655
+ "showSingleCategory",
656
+ "virtualize",
657
+ "virtualizeOffset",
658
+ "recent",
659
+ "backgroundImageFn"
660
+ ],
661
+ outputs: [
662
+ "emojiClick",
663
+ "emojiSelect",
664
+ "skinChange"
665
+ ]
666
+ },
667
+ {
668
+ kind: "directive",
669
+ type: i8.InfiniteScrollDirective,
670
+ selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]",
671
+ inputs: [
672
+ "infiniteScrollDistance",
673
+ "infiniteScrollUpDistance",
674
+ "infiniteScrollThrottle",
675
+ "infiniteScrollDisabled",
676
+ "infiniteScrollContainer",
677
+ "scrollWindow",
678
+ "immediateCheck",
679
+ "horizontal",
680
+ "alwaysCallback",
681
+ "fromRoot"
682
+ ],
683
+ outputs: ["scrolled", "scrolledUp"]
684
+ },
685
+ {
686
+ kind: "pipe",
687
+ type: i3.DatePipe,
688
+ name: "date"
689
+ },
690
+ {
691
+ kind: "pipe",
692
+ type: i9.TextTruncatePipe,
693
+ name: "textTruncate"
694
+ },
695
+ {
696
+ kind: "pipe",
697
+ type: i9.CommonPipe,
698
+ name: "common"
699
+ }
700
+ ]
701
+ });
702
+ }
703
+ };
704
+ i0.ɵɵngDeclareClassMetadata({
705
+ minVersion: "12.0.0",
706
+ version: "22.2.0",
707
+ ngImport: i0,
708
+ type: ChatBoxComponent,
709
+ decorators: [{
710
+ type: Component,
711
+ args: [{
712
+ standalone: false,
713
+ 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=\"Search members...\"\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=\"avatar\" />\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=\"avatar\"\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=\"avatar\" />\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=\"avatar\" />\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=\"message attachment\"\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=\"English\" />\n Your browser does not support the video\n tag.\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\">No message history.</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=\"Pick your emoji…\"\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\" aria-label=\"Insert emoji\" (click)=\"showEmoji = !showEmoji\">🙂</button>\n </div>\n <label for=\"chatbox-message-input\" class=\"visually-hidden\">Type your message</label>\n <input type=\"text\"\n id=\"chatbox-message-input\"\n name=\"chatbox-message-input\"\n class=\"form-control\"\n autocomplete=\"off\"\n placeholder=\"Type your message here...\"\n (keydown.enter)=\"onSendMessage(); $event.preventDefault()\"\n #messageInput\n aria-label=\"Type your message here...\" />\n <div class=\"form-control-position control-position-right\">\n <div class=\"image-upload\">\n <label for=\"file-input\">\n <span class=\"visually-hidden\">Attach file</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 aria-label=\"File Input\" />\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\">Send</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=\"No Chat\" />\n </div>\n <div class=\"h4 mt-4\">No messages yet!</div>\n <div class=\"mt-3\">\n <p>It looks like you haven't shared or received any messages yet.</p>\n <p>\n Start typing the name of the member you want to send a message to\n in the chat search field and send them a message.\n </p>\n </div>\n </div>\n </div>\n </div>\n }\n }\n</div>\n",
714
+ 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);--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"]
715
+ }]
716
+ }],
717
+ ctorParameters: () => [
718
+ { type: i0.ElementRef },
719
+ { type: i1$1.MailBoxService },
720
+ { type: i1$1.ProfileService },
721
+ { type: i1$1.WebsocketService },
722
+ { type: i1$1.ScriptLoaderService },
723
+ { type: i0.Injector },
724
+ { type: i0.ChangeDetectorRef },
725
+ { type: i2.ConfirmDialogService }
726
+ ],
727
+ propDecorators: { messageInputRef: [{
728
+ type: ViewChild,
729
+ args: ["messageInput", { static: false }]
730
+ }] }
731
+ });
732
+ const routes = [{
733
+ path: "",
734
+ component: ChatBoxComponent,
735
+ data: { title: "Chat" }
736
+ }, {
737
+ path: ":memberId",
738
+ component: ChatBoxComponent,
739
+ data: { title: "Chat" }
740
+ }];
741
+ var MessageRoutingModule = class MessageRoutingModule {
742
+ static {
743
+ this.ɵfac = i0.ɵɵngDeclareFactory({
744
+ minVersion: "12.0.0",
745
+ version: "22.2.0",
746
+ ngImport: i0,
747
+ type: MessageRoutingModule,
748
+ deps: [],
749
+ target: i0.ɵɵFactoryTarget.NgModule
750
+ });
751
+ }
752
+ static {
753
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
754
+ minVersion: "14.0.0",
755
+ version: "22.2.0",
756
+ ngImport: i0,
757
+ type: MessageRoutingModule,
758
+ imports: [i1.RouterModule],
759
+ exports: [RouterModule]
760
+ });
761
+ }
762
+ static {
763
+ this.ɵinj = i0.ɵɵngDeclareInjector({
764
+ minVersion: "12.0.0",
765
+ version: "22.2.0",
766
+ ngImport: i0,
767
+ type: MessageRoutingModule,
768
+ imports: [RouterModule.forChild(routes), RouterModule]
769
+ });
770
+ }
771
+ };
772
+ i0.ɵɵngDeclareClassMetadata({
773
+ minVersion: "12.0.0",
774
+ version: "22.2.0",
775
+ ngImport: i0,
776
+ type: MessageRoutingModule,
777
+ decorators: [{
778
+ type: NgModule,
779
+ args: [{
780
+ imports: [RouterModule.forChild(routes)],
781
+ exports: [RouterModule]
782
+ }]
783
+ }]
784
+ });
785
+ var MessagingModule = class MessagingModule {
786
+ static {
787
+ this.ɵfac = i0.ɵɵngDeclareFactory({
788
+ minVersion: "12.0.0",
789
+ version: "22.2.0",
790
+ ngImport: i0,
791
+ type: MessagingModule,
792
+ deps: [],
793
+ target: i0.ɵɵFactoryTarget.NgModule
794
+ });
795
+ }
796
+ static {
797
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
798
+ minVersion: "14.0.0",
799
+ version: "22.2.0",
800
+ ngImport: i0,
801
+ type: MessagingModule,
802
+ declarations: [ChatBoxComponent],
803
+ imports: [
804
+ CommonModule,
805
+ PipesModule,
806
+ FormsModule,
807
+ MessageRoutingModule,
808
+ ProgressSpinnerModule,
809
+ AutoCompleteModule,
810
+ PickerModule,
811
+ EmojiModule,
812
+ NgxFileDropModule,
813
+ InfiniteScrollModule,
814
+ ScrollingModule
815
+ ],
816
+ exports: [RouterModule, ChatBoxComponent]
817
+ });
818
+ }
819
+ static {
820
+ this.ɵinj = i0.ɵɵngDeclareInjector({
821
+ minVersion: "12.0.0",
822
+ version: "22.2.0",
823
+ ngImport: i0,
824
+ type: MessagingModule,
825
+ imports: [
826
+ CommonModule,
827
+ PipesModule,
828
+ FormsModule,
829
+ MessageRoutingModule,
830
+ ProgressSpinnerModule,
831
+ AutoCompleteModule,
832
+ PickerModule,
833
+ EmojiModule,
834
+ NgxFileDropModule,
835
+ InfiniteScrollModule,
836
+ ScrollingModule,
837
+ RouterModule
838
+ ]
839
+ });
840
+ }
841
+ };
842
+ i0.ɵɵngDeclareClassMetadata({
843
+ minVersion: "12.0.0",
844
+ version: "22.2.0",
845
+ ngImport: i0,
846
+ type: MessagingModule,
847
+ decorators: [{
848
+ type: NgModule,
849
+ args: [{
850
+ imports: [
851
+ CommonModule,
852
+ PipesModule,
853
+ FormsModule,
854
+ MessageRoutingModule,
855
+ ProgressSpinnerModule,
856
+ AutoCompleteModule,
857
+ PickerModule,
858
+ EmojiModule,
859
+ NgxFileDropModule,
860
+ InfiniteScrollModule,
861
+ ScrollingModule
862
+ ],
863
+ declarations: [ChatBoxComponent],
864
+ exports: [RouterModule, ChatBoxComponent]
865
+ }]
866
+ }]
867
+ });
642
868
  export { ChatBoxComponent, MessagingModule };
643
- //# sourceMappingURL=posiwise-messaging-module.mjs.map
869
+
870
+ //# sourceMappingURL=posiwise-messaging-module.mjs.map