@chat21/chat21-ionic 3.0.97-rc.4 → 3.0.97-rc.5
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 +9 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/src/app/app-routing.module.ts +5 -0
- package/src/app/app.module.ts +2 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +16 -9
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +42 -1
- package/src/app/modals/send-email/send-email.module.ts +0 -10
- package/src/app/modals/send-email/send-email.page.html +5 -5
- package/src/app/modals/send-email/send-email.page.scss +18 -2
- package/src/app/modals/send-email/send-email.page.ts +15 -2
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template-routing.module.ts +17 -0
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template.module.ts +28 -0
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.html +139 -0
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.scss +340 -0
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.spec.ts +24 -0
- package/src/app/modals/send-whatsapp-template/send-whatsapp-template.page.ts +183 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.html +8 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.scss +80 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.ts +1 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.html +3 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +209 -200
- package/src/app/services/templates/templates.service.spec.ts +12 -0
- package/src/app/services/templates/templates.service.ts +42 -0
- package/src/assets/i18n/ar.json +20 -11
- package/src/assets/i18n/az.json +296 -287
- package/src/assets/i18n/de.json +20 -11
- package/src/assets/i18n/en.json +20 -11
- package/src/assets/i18n/es.json +20 -11
- package/src/assets/i18n/fr.json +20 -11
- package/src/assets/i18n/it.json +20 -11
- package/src/assets/i18n/kk.json +296 -287
- package/src/assets/i18n/pt.json +20 -11
- package/src/assets/i18n/ru.json +20 -11
- package/src/assets/i18n/sr.json +20 -11
- package/src/assets/i18n/sv.json +296 -287
- package/src/assets/i18n/tr.json +27 -18
- package/src/assets/i18n/uk.json +296 -287
- package/src/assets/i18n/uz.json +296 -287
- package/src/assets/images/whatsapp_background.png +0 -0
- package/src/chat-config-template.json +3 -1
- package/src/chat-config.json +3 -1
- package/src/chat-config-mqtt-localhost.json +0 -35
- package/src/chat-config-mqtt.json +0 -26
- package/src/chat-config-native-mqtt.json +0 -36
- package/src/chat-config-native-prod.json +0 -36
- package/src/chat-config-pre.json +0 -34
|
@@ -56,10 +56,12 @@ import {
|
|
|
56
56
|
MESSAGE_TYPE_INFO,
|
|
57
57
|
MESSAGE_TYPE_MINE,
|
|
58
58
|
MESSAGE_TYPE_OTHERS,
|
|
59
|
-
URL_SOUND_LIST_CONVERSATION,
|
|
60
|
-
TYPE_DIRECT,
|
|
59
|
+
URL_SOUND_LIST_CONVERSATION,
|
|
60
|
+
TYPE_DIRECT,
|
|
61
61
|
TYPE_MSG_EMAIL,
|
|
62
|
-
TYPE_MSG_FORM
|
|
62
|
+
TYPE_MSG_FORM,
|
|
63
|
+
CHANNEL_TYPE_TELEGRAM,
|
|
64
|
+
CHANNEL_TYPE_WHATSAPP
|
|
63
65
|
} from 'src/chat21-core/utils/constants'
|
|
64
66
|
import {
|
|
65
67
|
checkPlatformIsMobile,
|
|
@@ -124,19 +126,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
124
126
|
|
|
125
127
|
public heightMessageTextArea = ''
|
|
126
128
|
public translationsMap: Map<string, string> = new Map()
|
|
127
|
-
public translationsHeaderMap: Map<string, string> = new Map()
|
|
129
|
+
public translationsHeaderMap: Map<string, string> = new Map()
|
|
128
130
|
public translationsContentMap: Map<string, string> = new Map()
|
|
129
|
-
public translationsInfoConversationMap: Map<string, string> = new Map()
|
|
131
|
+
public translationsInfoConversationMap: Map<string, string> = new Map()
|
|
130
132
|
public conversationAvatar: any
|
|
131
|
-
public leadInfo: {lead_id: string, hasEmail: boolean
|
|
132
|
-
public liveInfo: {sourcePage: string, sourceTitle: string}
|
|
133
|
+
public leadInfo: { lead_id: string, hasEmail: boolean, email: string, projectId: string, presence: {} };
|
|
134
|
+
public liveInfo: { sourcePage: string, sourceTitle: string }
|
|
133
135
|
public member: UserModel
|
|
134
136
|
public isFileSelected: boolean
|
|
135
137
|
public showIonContent = false
|
|
136
138
|
public conv_type: string
|
|
137
139
|
|
|
138
140
|
public messageStr: string;
|
|
139
|
-
public tagsCannedFilter: Array<any
|
|
141
|
+
public tagsCannedFilter: Array<any> = [];
|
|
140
142
|
public tagsCannedCount: number;
|
|
141
143
|
public HIDE_CANNED_RESPONSES: boolean = true
|
|
142
144
|
|
|
@@ -152,6 +154,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
152
154
|
areVisibleCAR: boolean;
|
|
153
155
|
supportMode: boolean;
|
|
154
156
|
isEmailEnabled: boolean;
|
|
157
|
+
isWhatsappTemplatesEnabled: boolean;
|
|
155
158
|
//SOUND
|
|
156
159
|
setTimeoutSound: any;
|
|
157
160
|
audio: any;
|
|
@@ -258,7 +261,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
258
261
|
this.watchToConnectionStatus();
|
|
259
262
|
this.getOSCODE();
|
|
260
263
|
this.getStoredProjectAndUserRole();
|
|
261
|
-
this.listenToDsbrdPostMsgs();
|
|
264
|
+
this.listenToDsbrdPostMsgs();
|
|
262
265
|
}
|
|
263
266
|
|
|
264
267
|
listenToDsbrdPostMsgs() {
|
|
@@ -273,7 +276,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
273
276
|
// console.log('[CONVS-DETAIL] HAS CLICKED ENLARGE SIDEBAR WIDE chatAreaEle ', chatAreaEle)
|
|
274
277
|
|
|
275
278
|
if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === true) {
|
|
276
|
-
this.logger.log('[CONVS-DETAIL] openAppsSidebarWideMode EVENT-> open'
|
|
279
|
+
this.logger.log('[CONVS-DETAIL] openAppsSidebarWideMode EVENT-> open')
|
|
277
280
|
this.appsidebarIsWide = true
|
|
278
281
|
// chat21InfoConversationEle.classList.add("info-convs-apps-sidebar-wide");
|
|
279
282
|
// chatAreaEle.classList.add("chat-area-apps-sidebar-wide");
|
|
@@ -297,7 +300,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
297
300
|
|
|
298
301
|
|
|
299
302
|
getStoredProjectAndUserRole() {
|
|
300
|
-
this.events.subscribe('storage:last_project',project =>{
|
|
303
|
+
this.events.subscribe('storage:last_project', project => {
|
|
301
304
|
this.logger.log('[CONVS-DETAIL] stored_project ', project)
|
|
302
305
|
if (project && project !== 'undefined') {
|
|
303
306
|
this.USER_ROLE = project.role;
|
|
@@ -330,7 +333,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
330
333
|
// // ARE AT THE END
|
|
331
334
|
// this.updateConversationBadge()
|
|
332
335
|
// }
|
|
333
|
-
if(conv.uid && conv.uid === this.conversationWith){
|
|
336
|
+
if (conv.uid && conv.uid === this.conversationWith) {
|
|
334
337
|
this.conversationAvatar = setConversationAvatar(
|
|
335
338
|
conv.conversation_with,
|
|
336
339
|
conv.conversation_with_fullname,
|
|
@@ -379,17 +382,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
379
382
|
let car = key.split(':')
|
|
380
383
|
if (car[1] === 'F') {
|
|
381
384
|
this.areVisibleCAR = false
|
|
382
|
-
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR',this.areVisibleCAR)
|
|
385
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
383
386
|
} else {
|
|
384
387
|
this.areVisibleCAR = true
|
|
385
|
-
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR',this.areVisibleCAR)
|
|
388
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
386
389
|
}
|
|
387
390
|
}
|
|
388
391
|
})
|
|
389
392
|
|
|
390
393
|
if (!this.public_Key.includes('CAR')) {
|
|
391
394
|
this.areVisibleCAR = false
|
|
392
|
-
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR',this.areVisibleCAR)
|
|
395
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
393
396
|
}
|
|
394
397
|
} else {
|
|
395
398
|
this.areVisibleCAR = false
|
|
@@ -491,7 +494,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
491
494
|
|
|
492
495
|
this.messages = [] // list messages of conversation
|
|
493
496
|
this.isFileSelected = false // indicates if a file has been selected (image to upload)
|
|
494
|
-
this.isEmailEnabled = (this.appConfigProvider.getConfig().emailSection === 'true' || this.appConfigProvider.getConfig().emailSection === true)? true: false;
|
|
497
|
+
this.isEmailEnabled = (this.appConfigProvider.getConfig().emailSection === 'true' || this.appConfigProvider.getConfig().emailSection === true) ? true : false;
|
|
498
|
+
this.isWhatsappTemplatesEnabled = (this.appConfigProvider.getConfig().whatsappTemplatesSection === 'true' || this.appConfigProvider.getConfig().whatsappTemplatesSection === true) ? true : false;
|
|
495
499
|
|
|
496
500
|
if (checkPlatformIsMobile()) {
|
|
497
501
|
this.isMobile = true
|
|
@@ -529,8 +533,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
529
533
|
}
|
|
530
534
|
this.addEventsKeyboard()
|
|
531
535
|
this.updateConversationBadge() // AGGIORNO STATO DELLA CONVERSAZIONE A 'LETTA' (is_new = false)
|
|
532
|
-
|
|
533
|
-
|
|
536
|
+
|
|
537
|
+
|
|
534
538
|
}
|
|
535
539
|
|
|
536
540
|
_getProjectIdByConversationWith(conversationWith: string) {
|
|
@@ -542,9 +546,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
542
546
|
const projectId = res.id_project
|
|
543
547
|
this.getProjectById(tiledeskToken, projectId)
|
|
544
548
|
}
|
|
545
|
-
},(error) => {
|
|
549
|
+
}, (error) => {
|
|
546
550
|
this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
547
|
-
},() => {
|
|
551
|
+
}, () => {
|
|
548
552
|
this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',)
|
|
549
553
|
})
|
|
550
554
|
}
|
|
@@ -555,12 +559,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
555
559
|
if (res) {
|
|
556
560
|
const projectId = res.id_project
|
|
557
561
|
}
|
|
558
|
-
},(error) => {
|
|
559
|
-
this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ',error)
|
|
562
|
+
}, (error) => {
|
|
563
|
+
this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
560
564
|
if ((error.error.msg = 'you dont belong to the project.')) {
|
|
561
565
|
this.disableTextarea = true
|
|
562
566
|
}
|
|
563
|
-
},() => {
|
|
567
|
+
}, () => {
|
|
564
568
|
this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
565
569
|
})
|
|
566
570
|
}
|
|
@@ -605,7 +609,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
605
609
|
'LABEL_TO',
|
|
606
610
|
'LABEL_LAST_ACCESS',
|
|
607
611
|
'ARRAY_DAYS',
|
|
608
|
-
|
|
612
|
+
|
|
609
613
|
'ID_CONVERSATION',
|
|
610
614
|
'UPLOAD_FILE_ERROR',
|
|
611
615
|
'LABEL_ENTER_MSG',
|
|
@@ -615,7 +619,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
615
619
|
'FAILED_TO_UPLOAD_THE_FORMAT_IS NOT_SUPPORTED',
|
|
616
620
|
'NO_INFORMATION_AVAILABLE',
|
|
617
621
|
'CONTACT_ID',
|
|
618
|
-
|
|
622
|
+
|
|
619
623
|
'UPLOAD',
|
|
620
624
|
'CANNED_RESPONSES',
|
|
621
625
|
'NO_CANNED_RESPONSES',
|
|
@@ -629,19 +633,24 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
629
633
|
|
|
630
634
|
"LABEL_CHAT",
|
|
631
635
|
"LABEL_EMAIL",
|
|
632
|
-
"EMAIL_OFFLINE_TIP",
|
|
633
|
-
"EMAIL_PLACEHOLDER",
|
|
634
|
-
"EMAIL_NOT_FOUND_PLACEHOLDER",
|
|
635
|
-
"SUBJECT",
|
|
636
|
-
"MESSAGE",
|
|
637
|
-
"MESSAGE_PLACEHOLDER",
|
|
638
636
|
"LABEL_SEND",
|
|
639
|
-
"
|
|
640
|
-
"
|
|
641
|
-
"
|
|
642
|
-
"
|
|
637
|
+
"EMAIL.EMAIL_OFFLINE_TIP",
|
|
638
|
+
"EMAIL.EMAIL_PLACEHOLDER",
|
|
639
|
+
"EMAIL.EMAIL_NOT_FOUND_PLACEHOLDER",
|
|
640
|
+
"EMAIL.SUBJECT",
|
|
641
|
+
"EMAIL.MESSAGE",
|
|
642
|
+
"EMAIL.MESSAGE_PLACEHOLDER",
|
|
643
|
+
"EMAIL.SEND_EMAIL_SUCCESS",
|
|
644
|
+
"EMAIL.SEND_EMAIL_ERROR",
|
|
645
|
+
"EMAIL.SUBJECT_OFFLINE_MESSAGE",
|
|
646
|
+
"EMAIL.SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE",
|
|
647
|
+
|
|
648
|
+
"WHATSAPP.LABEL_TEMPLATES",
|
|
649
|
+
"WHATSAPP.LABEL_WA_TEMPLATES",
|
|
650
|
+
"WHATSAPP.SELECT_MESSAGE_TEMPLATE",
|
|
651
|
+
"WHATSAPP.ERROR_WHATSAPP_NOT_INSTALLED",
|
|
652
|
+
"WHATSAPP.ERROR_WHATSAPP_GENERIC_ERROR"
|
|
643
653
|
|
|
644
|
-
|
|
645
654
|
]
|
|
646
655
|
|
|
647
656
|
const keysHeader = [
|
|
@@ -676,7 +685,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
676
685
|
this.translationsHeaderMap = this.customTranslateService.translateLanguage(keysHeader)
|
|
677
686
|
this.translationsContentMap = this.customTranslateService.translateLanguage(keysContentDetail)
|
|
678
687
|
this.translationsInfoConversationMap = this.customTranslateService.translateLanguage(keysContentInfo)
|
|
679
|
-
this.logger.log('[CONVS-DETAIL] x this.translationMap ',this.translationsMap)
|
|
688
|
+
this.logger.log('[CONVS-DETAIL] x this.translationMap ', this.translationsMap)
|
|
680
689
|
}
|
|
681
690
|
|
|
682
691
|
// --------------------------------------------------------
|
|
@@ -703,28 +712,28 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
703
712
|
]
|
|
704
713
|
return this.customTranslateService.translateLanguage(keys)
|
|
705
714
|
}
|
|
706
|
-
private setStyleMap(){
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
715
|
+
private setStyleMap() {
|
|
716
|
+
// this.styleMap.set('themeColor', 'var(--basic-blue)')
|
|
717
|
+
// .set('bubbleReceivedBackground','var(--bck-msg-received)')
|
|
718
|
+
// .set('bubbleReceivedTextColor', 'var(--col-msg-received)')
|
|
719
|
+
// .set('bubbleSentBackground', 'var(--bck-msg-sent)')
|
|
720
|
+
// .set('bubbleSentTextColor', 'var(--col-msg-sent)')
|
|
721
|
+
// .set('buttonFontSize','var(--button-in-msg-font-size)')
|
|
722
|
+
// .set('buttonBackgroundColor', 'var(--buttonBackgroundColor)')
|
|
723
|
+
// .set('buttonTextColor', 'var(--buttonTextColor)')
|
|
724
|
+
// .set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
|
|
725
|
+
// .set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
|
|
726
|
+
this.styleMap.set('themeColor', '#2a69c1')
|
|
727
|
+
.set('bubbleReceivedBackground', '#f0f2f7')
|
|
728
|
+
.set('bubbleReceivedTextColor', '#06132b')
|
|
729
|
+
.set('bubbleSentBackground', '#2a6ac1')
|
|
730
|
+
.set('bubbleSentTextColor', '#ffffff')
|
|
731
|
+
.set('buttonFontSize', '15px')
|
|
732
|
+
.set('buttonBackgroundColor', '#ffffff')
|
|
733
|
+
.set('buttonTextColor', '#2a6ac1')
|
|
734
|
+
.set('buttonHoverBackgroundColor', '#2a6ac1')
|
|
735
|
+
.set('buttonHoverTextColor', ' #ffffff')
|
|
736
|
+
|
|
728
737
|
}
|
|
729
738
|
// -------------------------------------------------------------------------------------
|
|
730
739
|
// * retrieving the handler from chatManager
|
|
@@ -811,18 +820,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
811
820
|
}
|
|
812
821
|
}
|
|
813
822
|
|
|
814
|
-
onConversationLoaded(conversation): ConversationModel{
|
|
815
|
-
if(conversation.attributes && conversation.attributes['projectId']){
|
|
823
|
+
onConversationLoaded(conversation): ConversationModel {
|
|
824
|
+
if (conversation.attributes && conversation.attributes['projectId']) {
|
|
816
825
|
let project = localStorage.getItem(conversation.attributes['projectId'])
|
|
817
|
-
if(project){
|
|
826
|
+
if (project) {
|
|
818
827
|
project = JSON.parse(project)
|
|
819
828
|
conversation.attributes.project_name = project['name']
|
|
820
829
|
}
|
|
821
830
|
|
|
822
|
-
}else if(conversation.attributes) {
|
|
831
|
+
} else if (conversation.attributes) {
|
|
823
832
|
const projectId = getProjectIdSelectedConversation(this.conversationWith)
|
|
824
833
|
let project = localStorage.getItem(projectId)
|
|
825
|
-
if(project){
|
|
834
|
+
if (project) {
|
|
826
835
|
project = JSON.parse(project)
|
|
827
836
|
conversation.attributes.projectId = project['_id']
|
|
828
837
|
conversation.attributes.project_name = project['name']
|
|
@@ -850,9 +859,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
850
859
|
conv.attributes['project_name'],
|
|
851
860
|
conv.attributes['channel']
|
|
852
861
|
)
|
|
853
|
-
|
|
862
|
+
|
|
854
863
|
}
|
|
855
|
-
if(!conv){
|
|
864
|
+
if (!conv) {
|
|
856
865
|
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conv not exist --> search in archived list', this.conversationWith, this.conv_type)
|
|
857
866
|
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
858
867
|
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, conv)
|
|
@@ -869,7 +878,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
869
878
|
conv.attributes['channel']
|
|
870
879
|
)
|
|
871
880
|
let duration = getDateDifference(conv.timestamp, Date.now())
|
|
872
|
-
duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
|
|
881
|
+
duration.days > 10 && conv.channel_type !== TYPE_DIRECT ? this.disableTextarea = true : this.disableTextarea = false
|
|
873
882
|
}
|
|
874
883
|
})
|
|
875
884
|
}
|
|
@@ -891,9 +900,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
891
900
|
conv.attributes['channel']
|
|
892
901
|
)
|
|
893
902
|
let duration = getDateDifference(conv.timestamp, Date.now())
|
|
894
|
-
duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
|
|
903
|
+
duration.days > 10 && conv.channel_type !== TYPE_DIRECT ? this.disableTextarea = true : this.disableTextarea = false
|
|
895
904
|
}
|
|
896
|
-
if(!conv){
|
|
905
|
+
if (!conv) {
|
|
897
906
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
898
907
|
if (conv) {
|
|
899
908
|
this.conversation = this.onConversationLoaded(conv)
|
|
@@ -922,19 +931,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
922
931
|
}
|
|
923
932
|
|
|
924
933
|
|
|
925
|
-
getLeadDetail(){
|
|
934
|
+
getLeadDetail() {
|
|
926
935
|
const that = this;
|
|
927
|
-
if(this.channelType !== TYPE_DIRECT){
|
|
928
|
-
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
936
|
+
if (this.channelType !== TYPE_DIRECT) {
|
|
937
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
929
938
|
const projectId = getProjectIdSelectedConversation(this.conversationWith)
|
|
930
939
|
this.logger.debug('[CONVS-DETAIL] getLeadDetail - section ', projectId)
|
|
931
|
-
this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
|
|
940
|
+
this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any) => {
|
|
932
941
|
that.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
|
|
933
|
-
if(request.lead && request.lead.email){
|
|
942
|
+
if (request.lead && request.lead.email) {
|
|
934
943
|
that.leadInfo = {
|
|
935
|
-
lead_id: request.lead.lead_id,
|
|
936
|
-
hasEmail: true,
|
|
937
|
-
email: request.lead.email,
|
|
944
|
+
lead_id: request.lead.lead_id,
|
|
945
|
+
hasEmail: true,
|
|
946
|
+
email: request.lead.email,
|
|
938
947
|
projectId: projectId,
|
|
939
948
|
presence: {
|
|
940
949
|
status: 'offline'
|
|
@@ -943,56 +952,56 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
943
952
|
that.presenceService.userIsOnline(this.leadInfo.lead_id);
|
|
944
953
|
that.webSocketService.subscribeToWS_RequesterPresence(projectId, that.leadInfo.lead_id)
|
|
945
954
|
}
|
|
946
|
-
}, (error)=>{
|
|
955
|
+
}, (error) => {
|
|
947
956
|
this.logger.error('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL - ERROR ', error)
|
|
948
|
-
}, ()=>{
|
|
957
|
+
}, () => {
|
|
949
958
|
this.logger.debug('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL * COMPLETE *')
|
|
950
959
|
})
|
|
951
960
|
}
|
|
952
|
-
|
|
961
|
+
|
|
953
962
|
}
|
|
954
963
|
|
|
955
|
-
createEmailText(lastMessageText: string): string{
|
|
964
|
+
createEmailText(lastMessageText: string): string {
|
|
956
965
|
let text = ''
|
|
957
966
|
this.messages.reverse().forEach((message, index) => {
|
|
958
967
|
|
|
959
968
|
let date = new Date(message.timestamp).toDateString()
|
|
960
|
-
let time = new Date(message.timestamp).getHours() + ':'+ new Date(message.timestamp).getMinutes() + ':' + new Date(message.timestamp).getSeconds()
|
|
961
|
-
if(isInfo(message))
|
|
962
|
-
|
|
963
|
-
if(index === 0)
|
|
969
|
+
let time = new Date(message.timestamp).getHours() + ':' + new Date(message.timestamp).getMinutes() + ':' + new Date(message.timestamp).getSeconds()
|
|
970
|
+
if (isInfo(message))
|
|
971
|
+
return;
|
|
972
|
+
if (index === 0)
|
|
964
973
|
text += 'On _' + date + ' - ' + time + '_ **' + message.sender_fullname + '**' + ' replied to you' + ': ' + '\n' +
|
|
965
|
-
|
|
966
|
-
if(index === 1)
|
|
974
|
+
message.text + '\n\n\n'
|
|
975
|
+
if (index === 1)
|
|
967
976
|
text += '_______________________________________________' + '\n' +
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
if(index > 1)
|
|
971
|
-
text += '**' + message.sender_fullname + '**'
|
|
977
|
+
'**' + 'CONVERSATION HISTORY:' + '**' + '\n' +
|
|
978
|
+
'**' + message.sender_fullname + '**' + ': ' + message.text + ' _(' + date + '-' + time + ')_' + '\n'
|
|
979
|
+
if (index > 1)
|
|
980
|
+
text += '**' + message.sender_fullname + '**' + ': ' + message.text + ' _(' + date + '-' + time + ')_' + '\n'
|
|
972
981
|
})
|
|
973
982
|
return text
|
|
974
983
|
}
|
|
975
984
|
|
|
976
|
-
sendEmail(message: string): Observable<boolean>{
|
|
977
|
-
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
985
|
+
sendEmail(message: string): Observable<boolean> {
|
|
986
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
978
987
|
const emailFormGroup = {
|
|
979
988
|
to: this.leadInfo.email,
|
|
980
|
-
subject: this.translationsMap.get('SUBJECT_OFFLINE_MESSAGE'),
|
|
989
|
+
subject: this.translationsMap.get('EMAIL.SUBJECT_OFFLINE_MESSAGE'),
|
|
981
990
|
text: message,
|
|
982
991
|
request_id: this.conversationWith
|
|
983
992
|
}
|
|
984
993
|
let status = new Subject<boolean>();
|
|
985
|
-
this.tiledeskService.sendEmail(tiledeskToken, this.leadInfo.projectId, emailFormGroup).subscribe((res)=> {
|
|
994
|
+
this.tiledeskService.sendEmail(tiledeskToken, this.leadInfo.projectId, emailFormGroup).subscribe((res) => {
|
|
986
995
|
this.logger.debug('[SEND-EMAIL-MODAL] subscribe to sendEmail API response -->', res)
|
|
987
|
-
if(res && res.queued){
|
|
988
|
-
this.presentToast(this.translationsMap.get('SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE'), 'success', '', 2000)
|
|
996
|
+
if (res && res.queued) {
|
|
997
|
+
this.presentToast(this.translationsMap.get('EMAIL.SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE'), 'success', '', 2000)
|
|
989
998
|
status.next(true)
|
|
990
999
|
}
|
|
991
|
-
},(error)=> {
|
|
1000
|
+
}, (error) => {
|
|
992
1001
|
this.logger.error('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL - ERROR ', error)
|
|
993
|
-
this.presentToast(this.translationsMap.get('SEND_EMAIL_ERROR'), 'danger', '', 2000)
|
|
1002
|
+
this.presentToast(this.translationsMap.get('EMAIL.SEND_EMAIL_ERROR'), 'danger', '', 2000)
|
|
994
1003
|
status.next(false)
|
|
995
|
-
}, ()=> {
|
|
1004
|
+
}, () => {
|
|
996
1005
|
this.logger.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL /* COMPLETE */')
|
|
997
1006
|
})
|
|
998
1007
|
return status.asObservable();
|
|
@@ -1059,27 +1068,27 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1059
1068
|
msg = `[${metadata.name}](${metadata.src})`
|
|
1060
1069
|
}
|
|
1061
1070
|
}
|
|
1062
|
-
this.conversation.attributes && this.conversation.attributes['channel']? attributes.channel = this.conversation.attributes['channel']: null;
|
|
1071
|
+
this.conversation.attributes && this.conversation.attributes['channel'] ? attributes.channel = this.conversation.attributes['channel'] : null;
|
|
1063
1072
|
metadata ? (metadata = metadata) : (metadata = '')
|
|
1064
|
-
this.logger.log('[CONVS-DETAIL] attributes--->>>> 1111',this.conversation.attributes, attributes)
|
|
1073
|
+
this.logger.log('[CONVS-DETAIL] attributes--->>>> 1111', this.conversation.attributes, attributes)
|
|
1065
1074
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser)
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
const emailSectionMsg = (attributes && attributes['offline_channel']===TYPE_MSG_EMAIL)
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
const emailSectionMsg = (attributes && attributes['offline_channel'] === TYPE_MSG_EMAIL)
|
|
1078
|
+
const channelIsNotEmailOrFormOrWhatsapp = (attributes && attributes['channel'] && (attributes['channel'] === TYPE_MSG_EMAIL || attributes['channel'] === TYPE_MSG_FORM || attributes['channel'] === CHANNEL_TYPE_WHATSAPP))
|
|
1079
|
+
|
|
1071
1080
|
if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
|
|
1072
1081
|
|
|
1073
|
-
|
|
1074
|
-
if(this.isEmailEnabled &&
|
|
1075
|
-
|
|
1076
|
-
|
|
1082
|
+
|
|
1083
|
+
if (this.isEmailEnabled &&
|
|
1084
|
+
this.leadInfo && this.leadInfo.presence && this.leadInfo.presence['status'] === 'offline' &&
|
|
1085
|
+
this.leadInfo.email && !emailSectionMsg && !channelIsNotEmailOrFormOrWhatsapp) {
|
|
1077
1086
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1078
1087
|
let msgText = this.createEmailText(msg)
|
|
1079
1088
|
this.sendEmail(msgText).subscribe(status => {
|
|
1080
|
-
if(status){
|
|
1089
|
+
if (status) {
|
|
1081
1090
|
//SEND MESSAGE ALSO AS EMAIL
|
|
1082
|
-
attributes['offline_channel']= 'offline_'+TYPE_MSG_EMAIL
|
|
1091
|
+
attributes['offline_channel'] = 'offline_' + TYPE_MSG_EMAIL
|
|
1083
1092
|
}
|
|
1084
1093
|
|
|
1085
1094
|
this.conversationHandlerService.sendMessage(
|
|
@@ -1094,7 +1103,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1094
1103
|
attributes,
|
|
1095
1104
|
)
|
|
1096
1105
|
})
|
|
1097
|
-
}else {
|
|
1106
|
+
} else {
|
|
1098
1107
|
//send STANDARD TEXT MESSAGE
|
|
1099
1108
|
this.conversationHandlerService.sendMessage(
|
|
1100
1109
|
msg,
|
|
@@ -1177,7 +1186,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1177
1186
|
subscriptionKey = 'conversationTyping';
|
|
1178
1187
|
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
1179
1188
|
if (!subscription) {
|
|
1180
|
-
subscription =
|
|
1189
|
+
subscription = this.typingService.BSIsTyping.pipe(takeUntil(this.unsubscribe$)).subscribe((data: any) => {
|
|
1181
1190
|
this.logger.debug('[CONVS-DETAIL] ***** BSIsTyping *****', data);
|
|
1182
1191
|
if (data) {
|
|
1183
1192
|
const isTypingUid = data.uid; //support-group-...
|
|
@@ -1186,7 +1195,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1186
1195
|
}
|
|
1187
1196
|
}
|
|
1188
1197
|
});
|
|
1189
|
-
const subscribe = {key: subscriptionKey, value: subscription };
|
|
1198
|
+
const subscribe = { key: subscriptionKey, value: subscription };
|
|
1190
1199
|
this.subscriptions.push(subscribe);
|
|
1191
1200
|
}
|
|
1192
1201
|
|
|
@@ -1199,7 +1208,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1199
1208
|
const userId = data.uid;
|
|
1200
1209
|
const isOnline = data.isOnline;
|
|
1201
1210
|
if (this.leadInfo && this.leadInfo.lead_id === userId) {
|
|
1202
|
-
this.leadInfo.presence['status'] = isOnline? 'online': 'offline';
|
|
1211
|
+
this.leadInfo.presence['status'] = isOnline ? 'online' : 'offline';
|
|
1203
1212
|
}
|
|
1204
1213
|
}
|
|
1205
1214
|
});
|
|
@@ -1245,7 +1254,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1245
1254
|
})
|
|
1246
1255
|
}
|
|
1247
1256
|
|
|
1248
|
-
updateLeadInfo(msg){
|
|
1257
|
+
updateLeadInfo(msg) {
|
|
1249
1258
|
if (msg.attributes && msg.attributes.hasOwnProperty("updateUserFullname")) {
|
|
1250
1259
|
const userFullname = msg.attributes['updateUserFullname'];
|
|
1251
1260
|
this.logger.debug('[CONVS-DETAIL] newMessageAdded --> updateUserFullname', userFullname)
|
|
@@ -1277,12 +1286,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1277
1286
|
}
|
|
1278
1287
|
}
|
|
1279
1288
|
|
|
1280
|
-
updateLiveInfo(msg){
|
|
1281
|
-
if(msg.attributes && msg.attributes.hasOwnProperty("sourcePage")){
|
|
1282
|
-
this.liveInfo = { sourcePage: msg.attributes['sourcePage'], sourceTitle: null}
|
|
1289
|
+
updateLiveInfo(msg) {
|
|
1290
|
+
if (msg.attributes && msg.attributes.hasOwnProperty("sourcePage")) {
|
|
1291
|
+
this.liveInfo = { sourcePage: msg.attributes['sourcePage'], sourceTitle: null }
|
|
1283
1292
|
}
|
|
1284
|
-
if(msg.attributes && msg.attributes.hasOwnProperty("sourceTitle")){
|
|
1285
|
-
this.liveInfo = { sourcePage: msg.attributes['sourcePage'], sourceTitle: msg.attributes['sourceTitle']}
|
|
1293
|
+
if (msg.attributes && msg.attributes.hasOwnProperty("sourceTitle")) {
|
|
1294
|
+
this.liveInfo = { sourcePage: msg.attributes['sourcePage'], sourceTitle: msg.attributes['sourceTitle'] }
|
|
1286
1295
|
}
|
|
1287
1296
|
}
|
|
1288
1297
|
|
|
@@ -1297,9 +1306,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1297
1306
|
subscription.value.unsubscribe() // vedere come fare l'unsubscribe!!!!
|
|
1298
1307
|
})
|
|
1299
1308
|
this.subscriptions = []
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1309
|
+
if (this.leadInfo) {
|
|
1310
|
+
this.webSocketService.unsubscribeToWS_RequesterPresence(this.leadInfo.projectId, this.leadInfo.lead_id)
|
|
1311
|
+
}
|
|
1303
1312
|
|
|
1304
1313
|
// https://www.w3schools.com/jsref/met_element_removeeventlistener.asp
|
|
1305
1314
|
window.removeEventListener('keyboardWillShow', null)
|
|
@@ -1434,8 +1443,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1434
1443
|
// Hide / display Canned when the SLASH has POSITION POS 0 and checking if there is a space after the SLASH (in this case it will be hidden)
|
|
1435
1444
|
// ------------------------------------------------------------------------------------------------------------------------------------------
|
|
1436
1445
|
|
|
1437
|
-
var after_slash = message.substring(
|
|
1438
|
-
if (pos === 0 && after_slash.length === 1 && after_slash.trim() === ''
|
|
1446
|
+
var after_slash = message.substring(message.lastIndexOf('/') + 1, message.length)
|
|
1447
|
+
if (pos === 0 && after_slash.length === 1 && after_slash.trim() === '') {
|
|
1439
1448
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ')
|
|
1440
1449
|
this.HIDE_CANNED_RESPONSES = true
|
|
1441
1450
|
// this.tagsCannedFilter = []
|
|
@@ -1445,27 +1454,27 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1445
1454
|
}
|
|
1446
1455
|
|
|
1447
1456
|
if (pos > 0) {
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
}
|
|
1457
|
+
// // ------------------------------------------------------------------------------------------------------------------------------------------
|
|
1458
|
+
// // Hide / display Canned when the SLASH has POSITION POS > and checking if there is a space after the SLASH (in this case they it be hidden)
|
|
1459
|
+
// // and if there is not a space before the SLASH (in this it will be hidden)
|
|
1460
|
+
// // ------------------------------------------------------------------------------------------------------------------------------------------
|
|
1461
|
+
|
|
1462
|
+
let beforeSlash = message.substr(0, pos)
|
|
1463
|
+
let afterSlash = message.substr(pos + 1)
|
|
1464
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea * POS ', pos)
|
|
1465
|
+
|
|
1466
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
|
|
1467
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
|
|
1468
|
+
|
|
1469
|
+
if (beforeSlash[beforeSlash.length - 1].indexOf(' ') >= 0 && afterSlash === '') {
|
|
1470
|
+
this.HIDE_CANNED_RESPONSES = false
|
|
1471
|
+
} else if (beforeSlash[beforeSlash.length - 1].indexOf(' ') < 0 && afterSlash === '') {
|
|
1472
|
+
this.HIDE_CANNED_RESPONSES = true
|
|
1473
|
+
} else if (beforeSlash[beforeSlash.length - 1].indexOf(' ') >= 0 && afterSlash === ' ') {
|
|
1474
|
+
this.HIDE_CANNED_RESPONSES = true
|
|
1475
|
+
// this.tagsCannedFilter = []
|
|
1468
1476
|
}
|
|
1477
|
+
}
|
|
1469
1478
|
} else {
|
|
1470
1479
|
// this.tagsCannedFilter = []
|
|
1471
1480
|
}
|
|
@@ -1478,7 +1487,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1478
1487
|
}
|
|
1479
1488
|
}
|
|
1480
1489
|
|
|
1481
|
-
|
|
1490
|
+
|
|
1482
1491
|
|
|
1483
1492
|
toggleSidebar() {
|
|
1484
1493
|
// console.log('[CONVS-DETAIL] has clicked test')
|
|
@@ -1494,12 +1503,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1494
1503
|
return str
|
|
1495
1504
|
}
|
|
1496
1505
|
|
|
1497
|
-
onLoadedCannedResponses(event){
|
|
1498
|
-
this.logger.log('[CONVS-DETAIL] onLoadedCannedResponses --> ',event)
|
|
1499
|
-
if(event && event.length > 0
|
|
1506
|
+
onLoadedCannedResponses(event) {
|
|
1507
|
+
this.logger.log('[CONVS-DETAIL] onLoadedCannedResponses --> ', event)
|
|
1508
|
+
if (event && event.length > 0) {
|
|
1500
1509
|
this.tagsCannedFilter = event
|
|
1501
1510
|
this.tagsCannedCount = event.length
|
|
1502
|
-
}
|
|
1511
|
+
}
|
|
1503
1512
|
}
|
|
1504
1513
|
|
|
1505
1514
|
replaceTagInMessage(canned, event?) {
|
|
@@ -1531,11 +1540,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1531
1540
|
// textArea.setFocus()
|
|
1532
1541
|
// // this.resizeTextArea()
|
|
1533
1542
|
// }, 200)
|
|
1534
|
-
|
|
1543
|
+
|
|
1535
1544
|
}
|
|
1536
1545
|
|
|
1537
1546
|
|
|
1538
|
-
closeListCannedResponse(){
|
|
1547
|
+
closeListCannedResponse() {
|
|
1539
1548
|
this.logger.log('[CONVS-DETAIL] close list canned . . . ')
|
|
1540
1549
|
this.HIDE_CANNED_RESPONSES = true
|
|
1541
1550
|
this.tagsCannedFilter = []
|
|
@@ -1567,10 +1576,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1567
1576
|
|
|
1568
1577
|
//HIDE_CANNED_RESPONSES: true --> not show CANNED component
|
|
1569
1578
|
//HIDE_CANNED_RESPONSES: false --> show CANNED component and place '/' char in textarea
|
|
1570
|
-
if(!this.HIDE_CANNED_RESPONSES){
|
|
1579
|
+
if (!this.HIDE_CANNED_RESPONSES) {
|
|
1571
1580
|
const elTextArea = this.rowTextArea['el']
|
|
1572
1581
|
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1573
|
-
if(elTextArea){
|
|
1582
|
+
if (elTextArea) {
|
|
1574
1583
|
// console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
|
|
1575
1584
|
var lastChar = textArea.value[textArea.value.length - 1]
|
|
1576
1585
|
this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar --- textArea ', lastChar, textArea)
|
|
@@ -1631,7 +1640,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1631
1640
|
}
|
|
1632
1641
|
}
|
|
1633
1642
|
|
|
1634
|
-
|
|
1643
|
+
|
|
1635
1644
|
// ----------------------------------------------------------
|
|
1636
1645
|
// ./end CANNED RESPONSES methods
|
|
1637
1646
|
// ----------------------------------------------------------
|
|
@@ -1754,7 +1763,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1754
1763
|
}
|
|
1755
1764
|
|
|
1756
1765
|
//DESKTOP HANDLER
|
|
1757
|
-
onOpenCloseInfoConversation(event){
|
|
1766
|
+
onOpenCloseInfoConversation(event) {
|
|
1758
1767
|
this.logger.debug('[CONVS-DETAIL] onOpenCloseInfoConversation - openInfoConversation ', event)
|
|
1759
1768
|
this.resizeTextArea()
|
|
1760
1769
|
this.openInfoConversation = event
|
|
@@ -1762,16 +1771,16 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1762
1771
|
}
|
|
1763
1772
|
|
|
1764
1773
|
//MOBILE HANDLER
|
|
1765
|
-
onOpenInfoConversation(event){
|
|
1774
|
+
onOpenInfoConversation(event) {
|
|
1766
1775
|
this.logger.debug('[CONVS-DETAIL] onOpenCloseInfoConversation - openInfoConversation ', event)
|
|
1767
1776
|
this.resizeTextArea()
|
|
1768
1777
|
this.openInfoConversation = event
|
|
1769
1778
|
this.USER_HAS_OPENED_CLOSE_INFO_CONV = true
|
|
1770
1779
|
}
|
|
1771
1780
|
|
|
1772
|
-
onOpenFooterSection(event: string){
|
|
1781
|
+
onOpenFooterSection(event: string) {
|
|
1773
1782
|
this.logger.debug('[CONVS-DETAIL] onOpenFooterSection - section ', event)
|
|
1774
|
-
if(event === 'email'){
|
|
1783
|
+
if (event === 'email' || event === 'templates') {
|
|
1775
1784
|
this.getLeadDetail()
|
|
1776
1785
|
}
|
|
1777
1786
|
}
|
|
@@ -1842,7 +1851,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1842
1851
|
* FIREBY BY: click event ScrollToBottom bottom-right icon button
|
|
1843
1852
|
*/
|
|
1844
1853
|
public actionScrollBottom() {
|
|
1845
|
-
this.logger.log('[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ',this.ionContentChatArea)
|
|
1854
|
+
this.logger.log('[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ', this.ionContentChatArea)
|
|
1846
1855
|
// const that = this;
|
|
1847
1856
|
this.showButtonToBottom = false
|
|
1848
1857
|
this.updateConversationBadge()
|
|
@@ -1880,36 +1889,36 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1880
1889
|
|
|
1881
1890
|
checkAcceptedFile(draggedFileMimeType) {
|
|
1882
1891
|
let isAcceptFile = false
|
|
1883
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ',this.appConfigProvider.getConfig().fileUploadAccept)
|
|
1892
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept)
|
|
1884
1893
|
const accept_files = this.appConfigProvider.getConfig().fileUploadAccept
|
|
1885
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - mimeType: ',draggedFileMimeType)
|
|
1894
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - mimeType: ', draggedFileMimeType)
|
|
1886
1895
|
if (accept_files === '*/*') {
|
|
1887
1896
|
isAcceptFile = true
|
|
1888
1897
|
return isAcceptFile
|
|
1889
1898
|
} else if (accept_files !== '*/*') {
|
|
1890
|
-
this.logger.log(
|
|
1899
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept typeof accept_files ', typeof accept_files)
|
|
1891
1900
|
const accept_files_array = accept_files.split(',')
|
|
1892
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array ',accept_files_array)
|
|
1893
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array typeof: ',typeof accept_files_array)
|
|
1901
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array ', accept_files_array)
|
|
1902
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array)
|
|
1894
1903
|
|
|
1895
1904
|
accept_files_array.forEach((accept_file) => {
|
|
1896
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file ',accept_file)
|
|
1905
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file ', accept_file)
|
|
1897
1906
|
const accept_file_segment = accept_file.split('/')
|
|
1898
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file_segment ',accept_file_segment)
|
|
1907
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file_segment ', accept_file_segment)
|
|
1899
1908
|
if (accept_file_segment[1] === '*') {
|
|
1900
1909
|
if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
|
|
1901
1910
|
isAcceptFile = true
|
|
1902
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1911
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile)
|
|
1903
1912
|
return isAcceptFile
|
|
1904
1913
|
} else {
|
|
1905
1914
|
isAcceptFile = false
|
|
1906
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1915
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile)
|
|
1907
1916
|
return isAcceptFile
|
|
1908
1917
|
}
|
|
1909
1918
|
} else if (accept_file_segment[1] !== '*') {
|
|
1910
1919
|
if (draggedFileMimeType === accept_file) {
|
|
1911
1920
|
isAcceptFile = true
|
|
1912
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
|
|
1921
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile)
|
|
1913
1922
|
return isAcceptFile
|
|
1914
1923
|
}
|
|
1915
1924
|
}
|
|
@@ -1922,7 +1931,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1922
1931
|
|
|
1923
1932
|
initializeTyping() {
|
|
1924
1933
|
this.logger.debug('[CONVS-DETAIL] membersconversation', this.membersConversation)
|
|
1925
|
-
if(this.loggedUser){
|
|
1934
|
+
if (this.loggedUser) {
|
|
1926
1935
|
this.membersConversation.push(this.loggedUser.uid)
|
|
1927
1936
|
//this.setSubscriptions();
|
|
1928
1937
|
this.typingService.isTyping(this.conversationWith, this.loggedUser.uid, this.isDirect);
|
|
@@ -1941,19 +1950,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1941
1950
|
if (data.nameUserTypingNow) {
|
|
1942
1951
|
this.nameUserTypingNow = data.nameUserTypingNow;
|
|
1943
1952
|
}
|
|
1944
|
-
if (data.uidUserTypingNow){
|
|
1953
|
+
if (data.uidUserTypingNow) {
|
|
1945
1954
|
this.idUserTypingNow = data.uidUserTypingNow
|
|
1946
1955
|
}
|
|
1947
1956
|
this.logger.debug('[CONV-COMP] subscribeTypings data:', data);
|
|
1948
1957
|
const userTyping = this.membersConversation.includes(key);
|
|
1949
|
-
if (
|
|
1958
|
+
if (!userTyping && key) {
|
|
1950
1959
|
this.isTypings = true;
|
|
1951
1960
|
setTimeout(function () {
|
|
1952
1961
|
that.scrollBottom(0)
|
|
1953
1962
|
}, 0);
|
|
1954
1963
|
// clearTimeout(this.setTimeoutWritingMessages);
|
|
1955
1964
|
this.setTimeoutWritingMessages = setTimeout(() => {
|
|
1956
|
-
|
|
1965
|
+
that.isTypings = false;
|
|
1957
1966
|
}, waitTime);
|
|
1958
1967
|
// this.initiTimeout(waitTime)
|
|
1959
1968
|
}
|
|
@@ -1963,29 +1972,29 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1963
1972
|
|
|
1964
1973
|
}
|
|
1965
1974
|
|
|
1966
|
-
initiTimeout(waitTime){
|
|
1975
|
+
initiTimeout(waitTime) {
|
|
1967
1976
|
const that = this;
|
|
1968
1977
|
this.setTimeoutWritingMessages = setTimeout(() => {
|
|
1969
1978
|
that.isTypings = false;
|
|
1970
1979
|
}, waitTime);
|
|
1971
1980
|
}
|
|
1972
1981
|
|
|
1973
|
-
resetTimeout(){
|
|
1982
|
+
resetTimeout() {
|
|
1974
1983
|
this.isTypings = false
|
|
1975
1984
|
this.setTimeoutWritingMessages = null;
|
|
1976
1985
|
clearTimeout(this.setTimeoutWritingMessages)
|
|
1977
1986
|
}
|
|
1978
1987
|
|
|
1979
1988
|
|
|
1980
|
-
segmentNewAgentMessage(conversation: ConversationModel){
|
|
1989
|
+
segmentNewAgentMessage(conversation: ConversationModel) {
|
|
1981
1990
|
let user = this.loggedUser
|
|
1982
|
-
if(window['analytics']){
|
|
1991
|
+
if (window['analytics']) {
|
|
1983
1992
|
try {
|
|
1984
1993
|
window['analytics'].page("Chat Conversation Detail Page, Message Sent", {});
|
|
1985
1994
|
} catch (err) {
|
|
1986
1995
|
this.logger.error('Event:Message Sent [page] error', err);
|
|
1987
1996
|
}
|
|
1988
|
-
|
|
1997
|
+
|
|
1989
1998
|
try {
|
|
1990
1999
|
window['analytics'].identify(user.uid, {
|
|
1991
2000
|
name: user.firstname + ' ' + user.lastname,
|
|
@@ -1995,7 +2004,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1995
2004
|
} catch (err) {
|
|
1996
2005
|
this.logger.error('Event:Message Sent [identify] error', err);
|
|
1997
2006
|
}
|
|
1998
|
-
|
|
2007
|
+
|
|
1999
2008
|
try {
|
|
2000
2009
|
window['analytics'].track('Message Sent', {
|
|
2001
2010
|
"username": user.firstname + ' ' + user.lastname,
|
|
@@ -2003,21 +2012,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
2003
2012
|
"conversation_id": conversation.uid,
|
|
2004
2013
|
"channel_type": conversation.channel_type,
|
|
2005
2014
|
"conversation_with": conversation.conversation_with,
|
|
2006
|
-
"department_name":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentName: null,
|
|
2007
|
-
"department_id":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentId: null,
|
|
2015
|
+
"department_name": (conversation.channel_type !== TYPE_DIRECT) ? conversation.attributes.departmentName : null,
|
|
2016
|
+
"department_id": (conversation.channel_type !== TYPE_DIRECT) ? conversation.attributes.departmentId : null,
|
|
2008
2017
|
},
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2018
|
+
{
|
|
2019
|
+
"context": {
|
|
2020
|
+
"groupId": (conversation.channel_type !== TYPE_DIRECT) ? conversation.attributes.projectId : null
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
2014
2023
|
} catch (err) {
|
|
2015
2024
|
this.logger.error('Event:Message Sent [track] error', err);
|
|
2016
2025
|
}
|
|
2017
|
-
|
|
2026
|
+
|
|
2018
2027
|
try {
|
|
2019
2028
|
window['analytics'].group(conversation.attributes.projectId, {
|
|
2020
|
-
name: (conversation.attributes.project_name)? conversation.attributes.project_name : null,
|
|
2029
|
+
name: (conversation.attributes.project_name) ? conversation.attributes.project_name : null,
|
|
2021
2030
|
// plan: projectProfileName,
|
|
2022
2031
|
});
|
|
2023
2032
|
} catch (err) {
|
|
@@ -2036,9 +2045,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
2036
2045
|
|
|
2037
2046
|
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev ', ev)
|
|
2038
2047
|
const fileList = ev.dataTransfer.files
|
|
2039
|
-
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev.dataTransfer.files ',fileList)
|
|
2048
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP ev.dataTransfer.files ', fileList)
|
|
2040
2049
|
this.isHovering = false
|
|
2041
|
-
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP isHovering ',this.isHovering)
|
|
2050
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP isHovering ', this.isHovering)
|
|
2042
2051
|
if (fileList.length > 0) {
|
|
2043
2052
|
const file: File = fileList[0]
|
|
2044
2053
|
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP file ', file)
|
|
@@ -2050,12 +2059,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
2050
2059
|
// this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
2051
2060
|
// this.checkAcceptedFile(mimeType);
|
|
2052
2061
|
const isAccepted = this.checkAcceptedFile(mimeType)
|
|
2053
|
-
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',isAccepted)
|
|
2062
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP', isAccepted)
|
|
2054
2063
|
if (isAccepted === true) {
|
|
2055
2064
|
this.handleDropEvent(ev)
|
|
2056
2065
|
} else {
|
|
2057
|
-
this.logger.log(
|
|
2058
|
-
this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000
|
|
2066
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType, 'NOT SUPPORTED FILE TYPE')
|
|
2067
|
+
this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger', 'toast-custom-class', 5000)
|
|
2059
2068
|
// this.presentToastOnlyImageFilesAreAllowedToDrag()
|
|
2060
2069
|
}
|
|
2061
2070
|
}
|
|
@@ -2072,7 +2081,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
2072
2081
|
ev.stopPropagation()
|
|
2073
2082
|
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop ev ', ev)
|
|
2074
2083
|
this.isHovering = true
|
|
2075
|
-
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop isHovering ',this.isHovering)
|
|
2084
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragover) allowDrop isHovering ', this.isHovering)
|
|
2076
2085
|
}
|
|
2077
2086
|
|
|
2078
2087
|
// DRAG LEAVE (WHEN LEAVE FROM THE DROP ZONE)
|
|
@@ -2081,10 +2090,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
2081
2090
|
ev.stopPropagation()
|
|
2082
2091
|
this.logger.log('[CONVS-DETAIL] ----> FILE - (dragleave) drag ev ', ev)
|
|
2083
2092
|
this.isHovering = false
|
|
2084
|
-
this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ',this.isHovering)
|
|
2093
|
+
this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ', this.isHovering)
|
|
2085
2094
|
}
|
|
2086
2095
|
|
|
2087
|
-
async presentToast(message: string, color: string, cssClass: string, duration: number = 2000, position: 'top' | 'bottom' | 'middle'= 'bottom'){
|
|
2096
|
+
async presentToast(message: string, color: string, cssClass: string, duration: number = 2000, position: 'top' | 'bottom' | 'middle' = 'bottom') {
|
|
2088
2097
|
const toast = await this.toastController.create({
|
|
2089
2098
|
message: message,
|
|
2090
2099
|
duration: duration,
|