@chat21/chat21-ionic 3.0.62 → 3.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +6 -2
- package/deploy_amazon_beta.sh +29 -0
- package/deploy_amazon_prod.sh +25 -0
- package/deploy_pre.sh +6 -78
- package/deploy_prod.sh +6 -57
- package/package.json +2 -1
- package/src/app/app.component.ts +104 -34
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +2 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +2 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +33 -21
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +34 -12
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -1
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +1 -1
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +5 -3
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +1 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +1 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +4 -4
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +1 -1
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +3 -3
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -3
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +10 -55
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +8 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -0
- package/src/app/components/image-viewer/image-viewer.component.ts +28 -10
- package/src/app/components/project-item/project-item.component.ts +6 -30
- package/src/app/components/sidebar/sidebar.component.html +2 -2
- package/src/app/components/sidebar/sidebar.component.ts +49 -83
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +17 -1
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +52 -6
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +81 -111
- package/src/app/pages/authentication/login/login.page.ts +20 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.html +40 -19
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +15 -6
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +179 -244
- package/src/app/services/nav-proxy.service.ts +15 -13
- package/src/assets/i18n/de.json +2 -1
- package/src/assets/i18n/en.json +2 -1
- package/src/assets/i18n/es.json +2 -1
- package/src/assets/i18n/fr.json +2 -1
- package/src/assets/i18n/it.json +2 -1
- package/src/assets/i18n/pt.json +2 -1
- package/src/assets/i18n/ru.json +2 -1
- package/src/assets/i18n/sr.json +2 -1
- package/src/assets/i18n/tr.json +2 -1
- package/src/assets/js/chat21client.js +1 -1
- package/src/{chat-config-mqtt-ver-uploaded.json → chat-config-mqtt-localhost.json} +10 -6
- package/src/chat-config-mqtt.json +18 -28
- package/src/chat-config-native-mqtt.json +30 -0
- package/src/chat-config-pre.json +15 -7
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +2 -3
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +20 -3
- package/src/chat21-core/providers/logger/customLogger.ts +2 -10
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +1 -1
- package/src/chat21-core/utils/utils-message.ts +102 -85
- package/src/variables.scss +4 -1
- package/src/chat-config-pre-test.json +0 -36
|
@@ -166,6 +166,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
166
166
|
public checkInternet: boolean;
|
|
167
167
|
public msgCount: number;
|
|
168
168
|
public disableTextarea: boolean;
|
|
169
|
+
appsidebarIsWide: boolean;
|
|
169
170
|
|
|
170
171
|
/**
|
|
171
172
|
* Constructor
|
|
@@ -252,8 +253,44 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
252
253
|
this.watchToConnectionStatus();
|
|
253
254
|
this.getOSCODE();
|
|
254
255
|
this.getStoredProjectAndUserRole();
|
|
256
|
+
this.listenToDsbrdPostMsgs();
|
|
255
257
|
}
|
|
256
258
|
|
|
259
|
+
listenToDsbrdPostMsgs() {
|
|
260
|
+
|
|
261
|
+
window.addEventListener("message", (event) => {
|
|
262
|
+
this.logger.log("[CONVS-DETAIL] message event ", event);
|
|
263
|
+
|
|
264
|
+
// const chat21InfoConversationEle = <HTMLElement>document.querySelector('#chat21-info-conversation');
|
|
265
|
+
// console.log('[CONVS-DETAIL] HAS CLICKED ENLARGE SIDEBAR WIDE chat21InfoConversationEle ', chat21InfoConversationEle)
|
|
266
|
+
|
|
267
|
+
// const chatAreaEle = <HTMLElement>document.querySelector('#chatArea');
|
|
268
|
+
// console.log('[CONVS-DETAIL] HAS CLICKED ENLARGE SIDEBAR WIDE chatAreaEle ', chatAreaEle)
|
|
269
|
+
|
|
270
|
+
if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === true) {
|
|
271
|
+
this.logger.log('[CONVS-DETAIL] HERE YES 1')
|
|
272
|
+
this.appsidebarIsWide = true
|
|
273
|
+
// chat21InfoConversationEle.classList.add("info-convs-apps-sidebar-wide");
|
|
274
|
+
// chatAreaEle.classList.add("chat-area-apps-sidebar-wide");
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === false) {
|
|
278
|
+
this.logger.log('[CONVS-DETAIL] HERE YES 2')
|
|
279
|
+
this.appsidebarIsWide = false
|
|
280
|
+
// chat21InfoConversationEle.classList.remove("info-convs-apps-sidebar-wide");
|
|
281
|
+
// chatAreaEle.classList.remove("chat-area-apps-sidebar-wide");
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (event && event.data && event.data.action && event.data.action === 'closeAppsSidebarWideMode' && event.data.parameter === true) {
|
|
285
|
+
this.logger.log('[CONVS-DETAIL] HERE YES 3')
|
|
286
|
+
this.appsidebarIsWide = false
|
|
287
|
+
// chat21InfoConversationEle.classList.remove("info-convs-apps-sidebar-wide");
|
|
288
|
+
// chatAreaEle.classList.remove("chat-area-apps-sidebar-wide");
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
257
294
|
getStoredProjectAndUserRole() {
|
|
258
295
|
const stored_project = localStorage.getItem('last_project')
|
|
259
296
|
// console.log('[SIDEBAR] stored_project ', stored_project)
|
|
@@ -284,10 +321,23 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
284
321
|
const conversations = this.conversationsHandlerService.conversations
|
|
285
322
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
286
323
|
this.conversation_count = conversations.length
|
|
287
|
-
this.logger.log(
|
|
288
|
-
|
|
289
|
-
this.
|
|
290
|
-
|
|
324
|
+
this.logger.log('[CONVS-DETAIL] conversation_count', this.conversation_count)
|
|
325
|
+
if (conv && conv.sender !== this.loggedUser.uid) {
|
|
326
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', conv.sender)
|
|
327
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
328
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
|
|
329
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
330
|
+
// UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
331
|
+
// AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
332
|
+
if (!this.showButtonToBottom && conv.is_new) {
|
|
333
|
+
// ARE AT THE END
|
|
334
|
+
this.updateConversationBadge()
|
|
335
|
+
}
|
|
336
|
+
if (conv.uid === this.conversationWith) {
|
|
337
|
+
this.conversationAvatar = setConversationAvatar(conv.conversation_with, conv.conversation_with_fullname, conv.channel_type)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
}
|
|
291
341
|
})
|
|
292
342
|
|
|
293
343
|
this.conversationsHandlerService.conversationRemoved.subscribe((conv) => {
|
|
@@ -295,10 +345,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
295
345
|
const conversations = this.conversationsHandlerService.conversations
|
|
296
346
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
297
347
|
this.conversation_count = conversations.length
|
|
298
|
-
this.logger.log(
|
|
299
|
-
'[CONVS-DETAIL] conversation_count',
|
|
300
|
-
this.conversation_count,
|
|
301
|
-
)
|
|
348
|
+
this.logger.log('[CONVS-DETAIL] conversation_count', this.conversation_count)
|
|
302
349
|
})
|
|
303
350
|
|
|
304
351
|
setTimeout(() => {
|
|
@@ -308,11 +355,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
308
355
|
|
|
309
356
|
getOSCODE() {
|
|
310
357
|
this.support_mode = null
|
|
311
|
-
if(
|
|
358
|
+
if (this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
|
|
312
359
|
this.support_mode = true
|
|
313
|
-
} else if (
|
|
360
|
+
} else if (this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
|
|
314
361
|
this.support_mode = false
|
|
315
|
-
} else if (
|
|
362
|
+
} else if (!this.appConfigProvider.getConfig().supportMode) {
|
|
316
363
|
this.support_mode = false
|
|
317
364
|
}
|
|
318
365
|
this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig support_mode', this.support_mode)
|
|
@@ -430,21 +477,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
430
477
|
// @ Inizialize
|
|
431
478
|
// --------------------------------------------------
|
|
432
479
|
initialize() {
|
|
433
|
-
// this.logger.log('[CONVS-DETAIL] x conversationWith getConversationDetail', this.conversationWith)
|
|
434
|
-
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationsHandlerService)
|
|
435
|
-
// this.logger.log('[CONVS-DETAIL] x this.conv_type getConversationDetail', this.conv_type)
|
|
436
|
-
|
|
437
|
-
// if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
438
|
-
// this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
439
|
-
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
440
|
-
// })
|
|
441
|
-
// }
|
|
442
|
-
// else { //get conversation from 'conversations' firebase node
|
|
443
|
-
// this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
444
|
-
// this.logger.log('[CONVS-DETAIL] x archivedConversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
445
|
-
|
|
446
|
-
// })
|
|
447
|
-
// }
|
|
448
480
|
|
|
449
481
|
this.loggedUser = this.tiledeskAuthService.getCurrentUser()
|
|
450
482
|
this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
|
|
@@ -454,7 +486,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
454
486
|
this.showMessageWelcome = false
|
|
455
487
|
|
|
456
488
|
const appconfig = this.appConfigProvider.getConfig()
|
|
457
|
-
// this.tenant = appconfig.tenant;
|
|
458
489
|
this.tenant = appconfig.firebaseConfig.tenant
|
|
459
490
|
this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant)
|
|
460
491
|
|
|
@@ -473,40 +504,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
473
504
|
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
|
|
474
505
|
} else {
|
|
475
506
|
this.isMobile = false
|
|
476
|
-
this.logger.log(
|
|
477
|
-
'[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ',
|
|
478
|
-
this.isMobile,
|
|
479
|
-
)
|
|
507
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
|
|
480
508
|
// this.openInfoConversation = true;
|
|
481
509
|
}
|
|
482
510
|
|
|
483
511
|
if (this.isMobile === false) {
|
|
484
512
|
if (checkWindowWidthIsLessThan991px()) {
|
|
485
|
-
this.logger.log(
|
|
486
|
-
'[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ',
|
|
487
|
-
checkWindowWidthIsLessThan991px(),
|
|
488
|
-
)
|
|
513
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
489
514
|
this.openInfoConversation = false // indica se è aperto il box info conversazione
|
|
490
515
|
this.isOpenInfoConversation = false
|
|
491
|
-
this.logger.log(
|
|
492
|
-
'[CONVS-DETAIL] - initialize -> openInfoConversation ',
|
|
493
|
-
this.openInfoConversation,
|
|
494
|
-
' -> isOpenInfoConversation ',
|
|
495
|
-
this.isOpenInfoConversation,
|
|
496
|
-
)
|
|
516
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
497
517
|
} else {
|
|
498
|
-
this.logger.log(
|
|
499
|
-
'[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ',
|
|
500
|
-
checkWindowWidthIsLessThan991px(),
|
|
501
|
-
)
|
|
518
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
502
519
|
this.openInfoConversation = true
|
|
503
520
|
this.isOpenInfoConversation = true
|
|
504
|
-
this.logger.log(
|
|
505
|
-
'[CONVS-DETAIL] - initialize -> openInfoConversation ',
|
|
506
|
-
this.openInfoConversation,
|
|
507
|
-
' -> isOpenInfoConversation ',
|
|
508
|
-
this.isOpenInfoConversation,
|
|
509
|
-
)
|
|
521
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
510
522
|
}
|
|
511
523
|
}
|
|
512
524
|
|
|
@@ -582,10 +594,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
582
594
|
}
|
|
583
595
|
|
|
584
596
|
returnOpenCloseInfoConversation(openInfoConversation: boolean) {
|
|
585
|
-
this.logger.log(
|
|
586
|
-
'[CONVS-DETAIL] returnOpenCloseInfoConversation - openInfoConversation ',
|
|
587
|
-
openInfoConversation,
|
|
588
|
-
)
|
|
597
|
+
this.logger.log('[CONVS-DETAIL] returnOpenCloseInfoConversation - openInfoConversation ', openInfoConversation)
|
|
589
598
|
this.resizeTextArea()
|
|
590
599
|
this.openInfoMessage = false
|
|
591
600
|
this.openInfoConversation = openInfoConversation
|
|
@@ -677,15 +686,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
677
686
|
initConversationHandler() {
|
|
678
687
|
const translationMap = this.setTranslationMapForConversationHandler()
|
|
679
688
|
this.showMessageWelcome = false
|
|
680
|
-
const handler: ConversationHandlerService = this.chatManager.getConversationHandlerByConversationId(
|
|
681
|
-
|
|
682
|
-
)
|
|
683
|
-
this.logger.log(
|
|
684
|
-
'[CONVS-DETAIL] - initConversationHandler - handler ',
|
|
685
|
-
handler,
|
|
686
|
-
' conversationWith ',
|
|
687
|
-
this.conversationWith,
|
|
688
|
-
)
|
|
689
|
+
const handler: ConversationHandlerService = this.chatManager.getConversationHandlerByConversationId(this.conversationWith)
|
|
690
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - handler ', handler, ' conversationWith ', this.conversationWith)
|
|
689
691
|
if (!handler) {
|
|
690
692
|
this.conversationHandlerService = this.conversationHandlerBuilderService.build()
|
|
691
693
|
this.conversationHandlerService.initialize(
|
|
@@ -696,15 +698,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
696
698
|
translationMap,
|
|
697
699
|
)
|
|
698
700
|
this.conversationHandlerService.connect()
|
|
699
|
-
this.logger.log(
|
|
700
|
-
'[CONVS-DETAIL] - initConversationHandler - NEW handler - conversationHandlerService',
|
|
701
|
-
this.conversationHandlerService,
|
|
702
|
-
)
|
|
701
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - NEW handler - conversationHandlerService', this.conversationHandlerService)
|
|
703
702
|
this.messages = this.conversationHandlerService.messages
|
|
704
|
-
this.logger.log(
|
|
705
|
-
'[CONVS-DETAIL] - initConversationHandler - messages: ',
|
|
706
|
-
this.messages,
|
|
707
|
-
)
|
|
703
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - messages: ', this.messages)
|
|
708
704
|
this.chatManager.addConversationHandler(this.conversationHandlerService)
|
|
709
705
|
|
|
710
706
|
// // wait 8 second and then display the message if there are no messages
|
|
@@ -773,15 +769,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
773
769
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
774
770
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
775
771
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conv_type', this.conv_type)
|
|
776
|
-
if (
|
|
777
|
-
this.conversationWith &&
|
|
778
|
-
this.conversationsHandlerService &&
|
|
779
|
-
this.conv_type === 'active'
|
|
780
|
-
) {
|
|
772
|
+
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
781
773
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
782
774
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
783
775
|
if (conv) {
|
|
784
|
-
// console.log( '[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv )
|
|
785
776
|
this.conversationAvatar = setConversationAvatar(
|
|
786
777
|
conv.conversation_with,
|
|
787
778
|
conv.conversation_with_fullname,
|
|
@@ -789,23 +780,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
789
780
|
)
|
|
790
781
|
}
|
|
791
782
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
792
|
-
}
|
|
793
|
-
)
|
|
783
|
+
})
|
|
794
784
|
} else {
|
|
795
785
|
//get conversation from 'conversations' firebase node
|
|
796
|
-
this.archivedConversationsHandlerService.getConversationDetail(
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
}
|
|
807
|
-
},
|
|
808
|
-
)
|
|
786
|
+
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
787
|
+
if (conv) {
|
|
788
|
+
// console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
|
|
789
|
+
this.conversationAvatar = setConversationAvatar(
|
|
790
|
+
conv.conversation_with,
|
|
791
|
+
conv.conversation_with_fullname,
|
|
792
|
+
conv.channel_type,
|
|
793
|
+
)
|
|
794
|
+
}
|
|
795
|
+
})
|
|
809
796
|
}
|
|
810
797
|
|
|
811
798
|
// this.conversationAvatar = setConversationAvatar(
|
|
@@ -924,81 +911,71 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
924
911
|
let subscription: any
|
|
925
912
|
let subscriptionKey: string
|
|
926
913
|
|
|
927
|
-
subscriptionKey = 'BSConversationsChanged'
|
|
928
|
-
subscription = this.subscriptions.find(
|
|
929
|
-
|
|
930
|
-
)
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}
|
|
914
|
+
// subscriptionKey = 'BSConversationsChanged'
|
|
915
|
+
// subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
916
|
+
// if (!subscription) {
|
|
917
|
+
// subscription = this.conversationsHandlerService.conversationChanged.subscribe((data: ConversationModel) => {
|
|
918
|
+
// this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid)
|
|
919
|
+
|
|
920
|
+
// if (data && data.sender !== this.loggedUser.uid) {
|
|
921
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
|
|
922
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
923
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
|
|
924
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
925
|
+
// // UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
926
|
+
// // AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
927
|
+
// if (!this.showButtonToBottom && data.is_new) {
|
|
928
|
+
// // ARE AT THE END
|
|
929
|
+
// this.updateConversationBadge()
|
|
930
|
+
// }
|
|
931
|
+
// if(data.uid === this.conversationWith){
|
|
932
|
+
// this.conversationAvatar = setConversationAvatar(
|
|
933
|
+
// data.conversation_with,
|
|
934
|
+
// data.conversation_with_fullname,
|
|
935
|
+
// data.channel_type,
|
|
936
|
+
// )
|
|
937
|
+
// }
|
|
938
|
+
|
|
939
|
+
// }
|
|
940
|
+
// })
|
|
941
|
+
// const subscribe = { key: subscriptionKey, value: subscription }
|
|
942
|
+
// this.subscriptions.push(subscribe)
|
|
943
|
+
// }
|
|
953
944
|
|
|
954
945
|
subscriptionKey = 'messageAdded'
|
|
955
|
-
subscription = this.subscriptions.find(
|
|
956
|
-
(item) => item.key === subscriptionKey,
|
|
957
|
-
)
|
|
946
|
+
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
958
947
|
if (!subscription) {
|
|
959
948
|
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService)
|
|
960
|
-
subscription = this.conversationHandlerService.messageAdded.subscribe(
|
|
961
|
-
(msg
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
)
|
|
949
|
+
subscription = this.conversationHandlerService.messageAdded.subscribe((msg: any) => {
|
|
950
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
|
|
951
|
+
if (msg) {
|
|
952
|
+
that.newMessageAdded(msg)
|
|
953
|
+
// this.setHeaderContent()
|
|
954
|
+
}
|
|
955
|
+
})
|
|
968
956
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
969
957
|
this.subscriptions.push(subscribe)
|
|
970
958
|
}
|
|
971
959
|
|
|
972
960
|
// IS USED ?
|
|
973
961
|
subscriptionKey = 'messageChanged'
|
|
974
|
-
subscription = this.subscriptions.find(
|
|
975
|
-
(item) => item.key === subscriptionKey,
|
|
976
|
-
)
|
|
962
|
+
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
977
963
|
if (!subscription) {
|
|
978
964
|
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged')
|
|
979
|
-
subscription = this.conversationHandlerService.messageChanged.subscribe(
|
|
980
|
-
(msg
|
|
981
|
-
|
|
982
|
-
'[CONVS-DETAIL] subscribe to messageChanged - msg ',
|
|
983
|
-
msg,
|
|
984
|
-
)
|
|
985
|
-
},
|
|
986
|
-
)
|
|
965
|
+
subscription = this.conversationHandlerService.messageChanged.subscribe((msg: any) => {
|
|
966
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged - msg ', msg)
|
|
967
|
+
})
|
|
987
968
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
988
969
|
this.subscriptions.push(subscribe)
|
|
989
970
|
}
|
|
990
971
|
|
|
991
972
|
subscriptionKey = 'messageRemoved'
|
|
992
|
-
subscription = this.subscriptions.find(
|
|
993
|
-
(item) => item.key === subscriptionKey,
|
|
994
|
-
)
|
|
973
|
+
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
995
974
|
if (!subscription) {
|
|
996
975
|
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved')
|
|
997
|
-
subscription = this.conversationHandlerService.messageRemoved.subscribe(
|
|
998
|
-
(messageId
|
|
999
|
-
|
|
1000
|
-
},
|
|
1001
|
-
)
|
|
976
|
+
subscription = this.conversationHandlerService.messageRemoved.subscribe((messageId: any) => {
|
|
977
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId)
|
|
978
|
+
})
|
|
1002
979
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
1003
980
|
this.subscriptions.push(subscribe)
|
|
1004
981
|
}
|
|
@@ -1008,22 +985,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1008
985
|
// if (!subscription) {
|
|
1009
986
|
// subscription =
|
|
1010
987
|
if (this.conversationWith.startsWith('group-')) {
|
|
1011
|
-
this.groupService
|
|
1012
|
-
|
|
1013
|
-
.
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
this.logger.error('[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error)
|
|
1021
|
-
},
|
|
1022
|
-
() => {
|
|
1023
|
-
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */')
|
|
1024
|
-
this.groupDetail = null
|
|
1025
|
-
},
|
|
1026
|
-
)
|
|
988
|
+
this.groupService.onGroupChange(this.conversationWith).pipe(takeUntil(this.unsubscribe$)).subscribe((groupDetail: any) => {
|
|
989
|
+
this.groupDetail = groupDetail
|
|
990
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ', this.groupDetail)
|
|
991
|
+
}, (error) => {
|
|
992
|
+
this.logger.error('[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error)
|
|
993
|
+
}, () => {
|
|
994
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */')
|
|
995
|
+
this.groupDetail = null
|
|
996
|
+
})
|
|
1027
997
|
}
|
|
1028
998
|
// const subscribe = { key: subscriptionKey, value: subscription };
|
|
1029
999
|
// this.subscriptions.push(subscribe);
|
|
@@ -1095,22 +1065,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1095
1065
|
}
|
|
1096
1066
|
|
|
1097
1067
|
updateConversationBadge() {
|
|
1098
|
-
if (
|
|
1099
|
-
this.conversationWith
|
|
1100
|
-
|
|
1101
|
-
this.
|
|
1102
|
-
) {
|
|
1103
|
-
this.conversationsHandlerService.setConversationRead(
|
|
1104
|
-
this.conversationWith,
|
|
1105
|
-
)
|
|
1106
|
-
} else if (
|
|
1107
|
-
this.conversationWith &&
|
|
1108
|
-
this.archivedConversationsHandlerService &&
|
|
1109
|
-
this.conv_type === 'archived'
|
|
1110
|
-
) {
|
|
1111
|
-
this.archivedConversationsHandlerService.setConversationRead(
|
|
1112
|
-
this.conversationWith,
|
|
1113
|
-
)
|
|
1068
|
+
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
1069
|
+
this.conversationsHandlerService.setConversationRead(this.conversationWith)
|
|
1070
|
+
} else if (this.conversationWith && this.archivedConversationsHandlerService && this.conv_type === 'archived') {
|
|
1071
|
+
this.archivedConversationsHandlerService.setConversationRead(this.conversationWith)
|
|
1114
1072
|
}
|
|
1115
1073
|
}
|
|
1116
1074
|
|
|
@@ -1157,18 +1115,14 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1157
1115
|
// }
|
|
1158
1116
|
idCurrentUser = this.loggedUser.uid
|
|
1159
1117
|
|
|
1160
|
-
if (
|
|
1161
|
-
this.loggedUser.firstname &&
|
|
1162
|
-
this.loggedUser.firstname !== undefined
|
|
1163
|
-
) {
|
|
1118
|
+
if (this.loggedUser.firstname && this.loggedUser.firstname !== undefined) {
|
|
1164
1119
|
userFullname = this.loggedUser.firstname
|
|
1165
1120
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
idCurrentUser,
|
|
1170
|
-
|
|
1171
|
-
)
|
|
1121
|
+
|
|
1122
|
+
/** DO NOT SET TYPING if message is empty */
|
|
1123
|
+
if (message !== '') {
|
|
1124
|
+
this.typingService.setTyping(this.conversationWith, message, idCurrentUser, userFullname)
|
|
1125
|
+
}
|
|
1172
1126
|
|
|
1173
1127
|
// ----------------------------------------------------------
|
|
1174
1128
|
// DISPLAY CANNED RESPONSES if message.lastIndexOf("/")
|
|
@@ -1291,15 +1245,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1291
1245
|
|
|
1292
1246
|
const conversationWith_segments = conversationWith.split('-')
|
|
1293
1247
|
// Removes the last element of the array if is = to the separator
|
|
1294
|
-
if (
|
|
1295
|
-
conversationWith_segments[conversationWith_segments.length - 1] === ''
|
|
1296
|
-
) {
|
|
1248
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
1297
1249
|
conversationWith_segments.pop()
|
|
1298
1250
|
}
|
|
1299
1251
|
|
|
1300
1252
|
if (conversationWith_segments.length === 4) {
|
|
1301
|
-
const lastArrayElement =
|
|
1302
|
-
conversationWith_segments[conversationWith_segments.length - 1]
|
|
1253
|
+
const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
|
|
1303
1254
|
this.logger.log('[CONVS-DETAIL] - lastArrayElement ', lastArrayElement)
|
|
1304
1255
|
this.logger.log('[CONVS-DETAIL] - lastArrayElement length', lastArrayElement.length)
|
|
1305
1256
|
if (lastArrayElement.length !== 32) {
|
|
@@ -1313,7 +1264,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1313
1264
|
if (conversationWith_segments.length === 4) {
|
|
1314
1265
|
projectId = conversationWith_segments[2]
|
|
1315
1266
|
this.logger.log('[CONVS-DETAIL] - loadTagsCanned projectId ', projectId)
|
|
1316
|
-
|
|
1317
1267
|
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1318
1268
|
} else {
|
|
1319
1269
|
this.getProjectIdByConversationWith(strSearch, this.conversationWith)
|
|
@@ -1323,56 +1273,41 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1323
1273
|
getProjectIdByConversationWith(strSearch, conversationWith: string) {
|
|
1324
1274
|
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
1325
1275
|
|
|
1326
|
-
this.tiledeskService
|
|
1327
|
-
.
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
1341
|
-
},
|
|
1342
|
-
() => {
|
|
1343
|
-
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
1344
|
-
},
|
|
1345
|
-
)
|
|
1276
|
+
this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe((res) => {
|
|
1277
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
|
|
1278
|
+
if (res) {
|
|
1279
|
+
const projectId = res.id_project
|
|
1280
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
|
|
1281
|
+
if (projectId) {
|
|
1282
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}, (error) => {
|
|
1286
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
1287
|
+
}, () => {
|
|
1288
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
1289
|
+
})
|
|
1346
1290
|
}
|
|
1347
1291
|
|
|
1348
1292
|
getAndShowCannedResponses(strSearch, projectId) {
|
|
1349
1293
|
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
1350
|
-
this.logger.log(
|
|
1351
|
-
'[CONVS-DETAIL] - loadTagsCanned tagsCanned.length',
|
|
1352
|
-
this.tagsCanned.length,
|
|
1353
|
-
)
|
|
1294
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned tagsCanned.length', this.tagsCanned.length)
|
|
1354
1295
|
//if(this.tagsCanned.length <= 0 ){
|
|
1355
1296
|
this.tagsCanned = []
|
|
1356
|
-
this.cannedResponsesService
|
|
1357
|
-
.getCannedResponses
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
|
|
1371
|
-
},
|
|
1372
|
-
() => {
|
|
1373
|
-
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
|
|
1374
|
-
},
|
|
1375
|
-
)
|
|
1297
|
+
this.cannedResponsesService.getCannedResponses(tiledeskToken, projectId).subscribe((res) => {
|
|
1298
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res)
|
|
1299
|
+
|
|
1300
|
+
this.tagsCanned = res
|
|
1301
|
+
this.tagsCannedCount = res.length
|
|
1302
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
|
|
1303
|
+
if (this.HIDE_CANNED_RESPONSES === false) {
|
|
1304
|
+
this.showTagsCanned(strSearch)
|
|
1305
|
+
}
|
|
1306
|
+
}, (error) => {
|
|
1307
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
|
|
1308
|
+
}, () => {
|
|
1309
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
|
|
1310
|
+
})
|
|
1376
1311
|
}
|
|
1377
1312
|
|
|
1378
1313
|
showTagsCanned(strSearch) {
|
|
@@ -1396,7 +1331,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1396
1331
|
let title = htmlEntities(this.tagsCannedFilter[i].title)
|
|
1397
1332
|
// this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
|
|
1398
1333
|
this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
|
|
1399
|
-
|
|
1334
|
+
|
|
1400
1335
|
}
|
|
1401
1336
|
if (this.tagsCannedCount === 0) {
|
|
1402
1337
|
// const button = this.renderer.createElement('button');
|
|
@@ -1406,7 +1341,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1406
1341
|
// this.renderer.listen(button, 'click', () => { alert('hi'); });
|
|
1407
1342
|
// let nocanned = {}
|
|
1408
1343
|
// if (this.USER_ROLE !== 'agent') {
|
|
1409
|
-
|
|
1344
|
+
const nocanned = {
|
|
1410
1345
|
// "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div><div class='cannedText'>" + this.translationMap.get('TO_CREATE_THEM_GO_TO_THE_PROJECT') + '</div></div>'
|
|
1411
1346
|
// <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
|
|
1412
1347
|
title:
|
|
@@ -1459,7 +1394,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1459
1394
|
// console.log('[CONVS-DETAIL] replaceTagInMessage canned ', canned)
|
|
1460
1395
|
// console.log('[CONVS-DETAIL] replaceTagInMessage canned title', canned.title)
|
|
1461
1396
|
// console.log('[CONVS-DETAIL] replaceTagInMessage canned contains nocannedTitle', canned.title.includes('nocannedTitle'))
|
|
1462
|
-
|
|
1397
|
+
|
|
1463
1398
|
const elTextArea = this.rowTextArea['el']
|
|
1464
1399
|
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1465
1400
|
|