@chat21/chat21-ionic 3.0.61-rc8 → 3.0.62
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 +81 -0
- package/README.md +6 -0
- package/angular.json +2 -0
- package/config.xml +0 -1
- package/deploy_pre.sh +1 -1
- package/deploy_prod.sh +1 -1
- package/env.sample +1 -1
- package/package.json +4 -4
- package/src/app/app-routing.module.ts +15 -0
- package/src/app/app.component.ts +12 -9
- package/src/app/app.module.ts +11 -3
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +36 -25
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +160 -50
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +108 -18
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +21 -36
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +19 -7
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +35 -40
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -1
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +13 -10
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -2
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +142 -71
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +57 -20
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +32 -9
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +98 -24
- package/src/app/components/ddp-header/ddp-header.component.html +9 -2
- package/src/app/components/ddp-header/ddp-header.component.ts +93 -18
- package/src/app/components/project-item/project-item.component.html +1 -1
- package/src/app/components/project-item/project-item.component.scss +1 -1
- package/src/app/components/project-item/project-item.component.ts +3 -3
- package/src/app/components/sidebar/sidebar.component.html +65 -52
- package/src/app/components/sidebar/sidebar.component.scss +23 -0
- package/src/app/components/sidebar/sidebar.component.ts +74 -26
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +20 -9
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +30 -5
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +24 -8
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +5 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.html +19 -10
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +229 -389
- package/src/app/pages/conversations-list/conversations-list.page.ts +646 -454
- package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
- package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
- package/src/app/pages/create-requester/create-requester-routing.module.ts +17 -0
- package/src/app/pages/create-requester/create-requester.module.ts +28 -0
- package/src/app/pages/create-requester/create-requester.page.html +67 -0
- package/src/app/pages/create-requester/create-requester.page.scss +30 -0
- package/src/app/pages/create-requester/create-requester.page.spec.ts +24 -0
- package/src/app/pages/create-requester/create-requester.page.ts +138 -0
- package/src/app/pages/create-ticket/create-ticket-routing.module.ts +17 -0
- package/src/app/pages/create-ticket/create-ticket.module.ts +28 -0
- package/src/app/pages/create-ticket/create-ticket.page.html +171 -0
- package/src/app/pages/create-ticket/create-ticket.page.scss +52 -0
- package/src/app/pages/create-ticket/create-ticket.page.spec.ts +24 -0
- package/src/app/pages/create-ticket/create-ticket.page.ts +432 -0
- package/src/app/pages/loader-preview/loader-preview.page.ts +2 -11
- package/src/app/pages/profile-info/profile-info.page.html +2 -2
- package/src/app/pages/profile-info/profile-info.page.scss +12 -1
- package/src/app/services/tiledesk/tiledesk.service.ts +190 -0
- package/src/app/shared/shared.module.ts +1 -1
- package/src/assets/i18n/de.json +37 -1
- package/src/assets/i18n/en.json +37 -1
- package/src/assets/i18n/es.json +38 -2
- package/src/assets/i18n/fr.json +38 -2
- package/src/assets/i18n/it.json +38 -2
- package/src/assets/i18n/pt.json +38 -2
- package/src/assets/i18n/ru.json +38 -2
- package/src/assets/i18n/sr.json +38 -2
- package/src/assets/i18n/tr.json +37 -1
- package/src/assets/images/default-avatar-x-select.png +0 -0
- package/src/assets/images/priority_icons/high.svg +3 -0
- package/src/assets/images/priority_icons/high_v2.svg +14 -0
- package/src/assets/images/priority_icons/low.svg +10 -0
- package/src/assets/images/priority_icons/low_v2.svg +14 -0
- package/src/assets/images/priority_icons/medium.svg +16 -0
- package/src/assets/images/priority_icons/medium_v2.svg +11 -0
- package/src/assets/images/priority_icons/urgent.svg +4 -0
- package/src/assets/images/priority_icons/urgent_v2.svg +16 -0
- package/src/chat-config-mqtt.json +25 -16
- package/src/chat-config-pre-test.json +1 -1
- package/src/chat-config-template.json +5 -4
- package/src/chat-config.json +1 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +8 -3
- package/src/chat21-core/utils/constants.ts +2 -0
- package/src/chat21-core/utils/utils-message.ts +19 -0
- package/src/global.scss +33 -9
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Directive,
|
|
10
10
|
HostListener,
|
|
11
11
|
ChangeDetectorRef,
|
|
12
|
+
Renderer2,
|
|
12
13
|
} from '@angular/core'
|
|
13
14
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'
|
|
14
15
|
import {
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
NavController,
|
|
21
22
|
IonContent,
|
|
22
23
|
IonTextarea,
|
|
24
|
+
IonButton,
|
|
23
25
|
} from '@ionic/angular'
|
|
24
26
|
|
|
25
27
|
// models
|
|
@@ -42,10 +44,10 @@ import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/a
|
|
|
42
44
|
import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service'
|
|
43
45
|
import { ContactsService } from 'src/app/services/contacts/contacts.service'
|
|
44
46
|
import { CannedResponsesService } from '../../services/canned-responses/canned-responses.service'
|
|
45
|
-
import { compareValues } from '../../../chat21-core/utils/utils'
|
|
47
|
+
import { compareValues, htmlEntities } from '../../../chat21-core/utils/utils'
|
|
46
48
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
|
|
47
49
|
import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service'
|
|
48
|
-
|
|
50
|
+
import { CreateCannedResponsePage } from 'src/app/pages/create-canned-response/create-canned-response.page'
|
|
49
51
|
// utils
|
|
50
52
|
import {
|
|
51
53
|
TYPE_MSG_TEXT,
|
|
@@ -82,11 +84,12 @@ import { ScrollbarThemeDirective } from 'src/app/utils/scrollbar-theme.directive
|
|
|
82
84
|
templateUrl: './conversation-detail.page.html',
|
|
83
85
|
styleUrls: ['./conversation-detail.page.scss'],
|
|
84
86
|
})
|
|
85
|
-
export class ConversationDetailPage
|
|
86
|
-
implements OnInit, OnDestroy, AfterViewInit {
|
|
87
|
+
export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit {
|
|
87
88
|
@ViewChild('ionContentChatArea', { static: false })
|
|
88
89
|
ionContentChatArea: IonContent
|
|
89
90
|
@ViewChild('rowMessageTextArea', { static: false }) rowTextArea: ElementRef
|
|
91
|
+
@ViewChild('noCannedTitle', { static: false }) noCannedTitle: ElementRef
|
|
92
|
+
|
|
90
93
|
|
|
91
94
|
// @ViewChild('info_content', { static: false }) info_content_child : InfoContentComponent;
|
|
92
95
|
|
|
@@ -138,28 +141,31 @@ export class ConversationDetailPage
|
|
|
138
141
|
MESSAGE_TYPE_OTHERS = MESSAGE_TYPE_OTHERS
|
|
139
142
|
|
|
140
143
|
arrowkeyLocation = -1
|
|
141
|
-
public_Key: any
|
|
142
|
-
areVisibleCAR: boolean
|
|
144
|
+
public_Key: any;
|
|
145
|
+
areVisibleCAR: boolean;
|
|
146
|
+
support_mode: boolean;
|
|
143
147
|
//SOUND
|
|
144
|
-
setTimeoutSound: any
|
|
145
|
-
audio: any
|
|
146
|
-
isOpenInfoConversation: boolean
|
|
147
|
-
USER_HAS_OPENED_CLOSE_INFO_CONV: boolean = false
|
|
148
|
-
isHovering: boolean = false
|
|
149
|
-
conversation_count: number
|
|
150
|
-
showSpinner: boolean = true
|
|
151
|
-
dropEvent: any
|
|
148
|
+
setTimeoutSound: any;
|
|
149
|
+
audio: any;
|
|
150
|
+
isOpenInfoConversation: boolean;
|
|
151
|
+
USER_HAS_OPENED_CLOSE_INFO_CONV: boolean = false;
|
|
152
|
+
isHovering: boolean = false;
|
|
153
|
+
conversation_count: number;
|
|
154
|
+
showSpinner: boolean = true;
|
|
155
|
+
dropEvent: any;
|
|
156
|
+
conversation: any;
|
|
157
|
+
USER_ROLE: string;
|
|
152
158
|
isMine = isMine
|
|
153
159
|
isInfo = isInfo
|
|
154
160
|
isFirstMessage = isFirstMessage
|
|
155
161
|
messageType = messageType
|
|
156
162
|
// info_content_child_enabled: boolean = false
|
|
157
|
-
private logger: LoggerService = LoggerInstance.getInstance()
|
|
163
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
158
164
|
|
|
159
|
-
public isOnline: boolean = true
|
|
160
|
-
public checkInternet: boolean
|
|
161
|
-
public msgCount: number
|
|
162
|
-
public disableTextarea: boolean
|
|
165
|
+
public isOnline: boolean = true;
|
|
166
|
+
public checkInternet: boolean;
|
|
167
|
+
public msgCount: number;
|
|
168
|
+
public disableTextarea: boolean;
|
|
163
169
|
|
|
164
170
|
/**
|
|
165
171
|
* Constructor
|
|
@@ -208,6 +214,8 @@ export class ConversationDetailPage
|
|
|
208
214
|
public tiledeskService: TiledeskService,
|
|
209
215
|
private networkService: NetworkService,
|
|
210
216
|
private events: EventsService,
|
|
217
|
+
private renderer: Renderer2,
|
|
218
|
+
private el: ElementRef
|
|
211
219
|
) {
|
|
212
220
|
// Change list on date change
|
|
213
221
|
this.route.paramMap.subscribe((params) => {
|
|
@@ -240,9 +248,26 @@ export class ConversationDetailPage
|
|
|
240
248
|
|
|
241
249
|
// }
|
|
242
250
|
// });
|
|
243
|
-
this.getConversations()
|
|
244
|
-
this.watchToConnectionStatus()
|
|
245
|
-
this.getOSCODE()
|
|
251
|
+
this.getConversations();
|
|
252
|
+
this.watchToConnectionStatus();
|
|
253
|
+
this.getOSCODE();
|
|
254
|
+
this.getStoredProjectAndUserRole();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
getStoredProjectAndUserRole() {
|
|
258
|
+
const stored_project = localStorage.getItem('last_project')
|
|
259
|
+
// console.log('[SIDEBAR] stored_project ', stored_project)
|
|
260
|
+
if (stored_project && stored_project !== undefined) {
|
|
261
|
+
const project = JSON.parse(stored_project)
|
|
262
|
+
// this.logger.log('[CONVS-DETAIL] project ', project)
|
|
263
|
+
|
|
264
|
+
// this.project_id = project.id_project.id
|
|
265
|
+
// this.logger.log('[CONVS-DETAIL] project_id ', this.project_id)
|
|
266
|
+
|
|
267
|
+
this.USER_ROLE = project.role;
|
|
268
|
+
// this.USER_ROLE = 'agent';
|
|
269
|
+
this.logger.log('[CONVS-DETAIL] USER_ROLE ', this.USER_ROLE)
|
|
270
|
+
}
|
|
246
271
|
}
|
|
247
272
|
|
|
248
273
|
getConversations() {
|
|
@@ -251,10 +276,7 @@ export class ConversationDetailPage
|
|
|
251
276
|
const conversations = this.conversationsHandlerService.conversations
|
|
252
277
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
253
278
|
this.conversation_count = conversations.length
|
|
254
|
-
this.logger.log(
|
|
255
|
-
'[CONVS-DETAIL] conversation_count',
|
|
256
|
-
this.conversation_count,
|
|
257
|
-
)
|
|
279
|
+
this.logger.log('[CONVS-DETAIL] conversation_count', this.conversation_count)
|
|
258
280
|
})
|
|
259
281
|
|
|
260
282
|
this.conversationsHandlerService.conversationChanged.subscribe((conv) => {
|
|
@@ -285,11 +307,17 @@ export class ConversationDetailPage
|
|
|
285
307
|
}
|
|
286
308
|
|
|
287
309
|
getOSCODE() {
|
|
310
|
+
this.support_mode = null
|
|
311
|
+
if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
|
|
312
|
+
this.support_mode = true
|
|
313
|
+
} else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
|
|
314
|
+
this.support_mode = false
|
|
315
|
+
} else if ( !this.appConfigProvider.getConfig().supportMode ) {
|
|
316
|
+
this.support_mode = false
|
|
317
|
+
}
|
|
318
|
+
this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig support_mode', this.support_mode)
|
|
288
319
|
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK
|
|
289
|
-
this.logger.log(
|
|
290
|
-
'[CONVS-DETAIL] AppConfigService getAppConfig public_Key',
|
|
291
|
-
this.public_Key,
|
|
292
|
-
)
|
|
320
|
+
this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key)
|
|
293
321
|
|
|
294
322
|
if (this.public_Key) {
|
|
295
323
|
let keys = this.public_Key.split('-')
|
|
@@ -354,15 +382,9 @@ export class ConversationDetailPage
|
|
|
354
382
|
|
|
355
383
|
ionViewWillEnter() {
|
|
356
384
|
// this.info_content_child_enabled = true;
|
|
357
|
-
this.logger.log(
|
|
358
|
-
'[CONVS-DETAIL] TEST > ionViewWillEnter - convId ',
|
|
359
|
-
this.conversationWith,
|
|
360
|
-
)
|
|
385
|
+
this.logger.log('[CONVS-DETAIL] TEST > ionViewWillEnter - convId ', this.conversationWith)
|
|
361
386
|
this.loggedUser = this.tiledeskAuthService.getCurrentUser()
|
|
362
|
-
this.logger.log(
|
|
363
|
-
'[CONVS-DETAIL] ionViewWillEnter loggedUser: ',
|
|
364
|
-
this.loggedUser,
|
|
365
|
-
)
|
|
387
|
+
this.logger.log('[CONVS-DETAIL] ionViewWillEnter loggedUser: ', this.loggedUser)
|
|
366
388
|
this.listnerStart()
|
|
367
389
|
}
|
|
368
390
|
|
|
@@ -425,10 +447,7 @@ export class ConversationDetailPage
|
|
|
425
447
|
// }
|
|
426
448
|
|
|
427
449
|
this.loggedUser = this.tiledeskAuthService.getCurrentUser()
|
|
428
|
-
this.logger.log(
|
|
429
|
-
'[CONVS-DETAIL] - initialize -> loggedUser: ',
|
|
430
|
-
this.loggedUser,
|
|
431
|
-
)
|
|
450
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
|
|
432
451
|
this.translations()
|
|
433
452
|
// this.conversationSelected = localStorage.getItem('conversationSelected');
|
|
434
453
|
this.showButtonToBottom = false
|
|
@@ -437,17 +456,9 @@ export class ConversationDetailPage
|
|
|
437
456
|
const appconfig = this.appConfigProvider.getConfig()
|
|
438
457
|
// this.tenant = appconfig.tenant;
|
|
439
458
|
this.tenant = appconfig.firebaseConfig.tenant
|
|
440
|
-
this.logger.log(
|
|
441
|
-
'[CONVS-DETAIL] - initialize -> firebaseConfig tenant ',
|
|
442
|
-
this.tenant,
|
|
443
|
-
)
|
|
459
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant)
|
|
444
460
|
|
|
445
|
-
this.logger.log(
|
|
446
|
-
'[CONVS-DETAIL] - initialize -> conversationWith: ',
|
|
447
|
-
this.conversationWith,
|
|
448
|
-
' -> conversationWithFullname: ',
|
|
449
|
-
this.conversationWithFullname,
|
|
450
|
-
)
|
|
461
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> conversationWith: ', this.conversationWith, ' -> conversationWithFullname: ', this.conversationWithFullname)
|
|
451
462
|
this.subscriptions = []
|
|
452
463
|
this.setHeightTextArea()
|
|
453
464
|
this.tagsCanned = [] // list of canned
|
|
@@ -459,10 +470,7 @@ export class ConversationDetailPage
|
|
|
459
470
|
if (checkPlatformIsMobile()) {
|
|
460
471
|
this.isMobile = true
|
|
461
472
|
// this.openInfoConversation = false; // indica se è aperto il box info conversazione
|
|
462
|
-
this.logger.log(
|
|
463
|
-
'[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ',
|
|
464
|
-
this.isMobile,
|
|
465
|
-
)
|
|
473
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
|
|
466
474
|
} else {
|
|
467
475
|
this.isMobile = false
|
|
468
476
|
this.logger.log(
|
|
@@ -526,24 +534,15 @@ export class ConversationDetailPage
|
|
|
526
534
|
.getProjectIdByConvRecipient(tiledeskToken, conversationWith)
|
|
527
535
|
.subscribe(
|
|
528
536
|
(res) => {
|
|
529
|
-
this.logger.log(
|
|
530
|
-
'[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT RES',
|
|
531
|
-
res,
|
|
532
|
-
)
|
|
537
|
+
this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT RES', res)
|
|
533
538
|
if (res) {
|
|
534
539
|
const projectId = res.id_project
|
|
535
|
-
this.logger.log(
|
|
536
|
-
'[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT projectId ',
|
|
537
|
-
projectId,
|
|
538
|
-
)
|
|
540
|
+
this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
|
|
539
541
|
this.getProjectById(tiledeskToken, projectId)
|
|
540
542
|
}
|
|
541
543
|
},
|
|
542
544
|
(error) => {
|
|
543
|
-
this.logger.error(
|
|
544
|
-
'[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ',
|
|
545
|
-
error,
|
|
546
|
-
)
|
|
545
|
+
this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
547
546
|
},
|
|
548
547
|
() => {
|
|
549
548
|
this.logger.log(
|
|
@@ -637,6 +636,7 @@ export class ConversationDetailPage
|
|
|
637
636
|
'YES_CANNED_RESPONSES',
|
|
638
637
|
'THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE',
|
|
639
638
|
'TO_CREATE_THEM_GO_TO_THE_PROJECT',
|
|
639
|
+
"AddNewCannedResponse"
|
|
640
640
|
]
|
|
641
641
|
|
|
642
642
|
this.translationMap = this.customTranslateService.translateLanguage(keys)
|
|
@@ -709,49 +709,24 @@ export class ConversationDetailPage
|
|
|
709
709
|
|
|
710
710
|
// // wait 8 second and then display the message if there are no messages
|
|
711
711
|
const that = this
|
|
712
|
-
this.logger.log(
|
|
713
|
-
|
|
714
|
-
that.messages,
|
|
715
|
-
)
|
|
716
|
-
this.logger.log(
|
|
717
|
-
'[CONVS-DETAIL] - initConversationHandler that.messages.length ',
|
|
718
|
-
that.messages.length,
|
|
719
|
-
)
|
|
712
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages)
|
|
713
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length)
|
|
720
714
|
this.msgCount = that.messages.length
|
|
721
715
|
setTimeout(() => {
|
|
722
716
|
if (!that.messages || that.messages.length === 0) {
|
|
723
717
|
this.showIonContent = true
|
|
724
718
|
that.showMessageWelcome = true
|
|
725
|
-
this.logger.log(
|
|
726
|
-
'[CONVS-DETAIL] - initConversationHandler - showMessageWelcome: ',
|
|
727
|
-
that.showMessageWelcome,
|
|
728
|
-
)
|
|
719
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - showMessageWelcome: ', that.showMessageWelcome)
|
|
729
720
|
}
|
|
730
721
|
}, 8000)
|
|
731
722
|
} else {
|
|
732
|
-
this.logger.log(
|
|
733
|
-
'[CONVS-DETAIL] - initConversationHandler (else) - conversationHandlerService ',
|
|
734
|
-
this.conversationHandlerService,
|
|
735
|
-
' handler',
|
|
736
|
-
handler,
|
|
737
|
-
)
|
|
723
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - conversationHandlerService ', this.conversationHandlerService, ' handler', handler)
|
|
738
724
|
this.conversationHandlerService = handler
|
|
739
725
|
this.messages = this.conversationHandlerService.messages
|
|
740
|
-
this.logger.log(
|
|
741
|
-
|
|
742
|
-
this.messages,
|
|
743
|
-
)
|
|
744
|
-
this.logger.log(
|
|
745
|
-
'[CONVS-DETAIL] - initConversationHandler (else) - this.showMessageWelcome: ',
|
|
746
|
-
this.showMessageWelcome,
|
|
747
|
-
)
|
|
726
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - this.messages: ', this.messages)
|
|
727
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - this.showMessageWelcome: ', this.showMessageWelcome)
|
|
748
728
|
}
|
|
749
|
-
this.logger.log(
|
|
750
|
-
'[CONVS-DETAIL] - initConversationHandler (else) - message ',
|
|
751
|
-
this.messages,
|
|
752
|
-
' showIonContent',
|
|
753
|
-
this.showIonContent,
|
|
754
|
-
)
|
|
729
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - message ', this.messages, ' showIonContent', this.showIonContent)
|
|
755
730
|
}
|
|
756
731
|
|
|
757
732
|
initGroupsHandler() {
|
|
@@ -760,12 +735,7 @@ export class ConversationDetailPage
|
|
|
760
735
|
this.conversationWith.startsWith('group-')
|
|
761
736
|
) {
|
|
762
737
|
this.groupService.initialize(this.tenant, this.loggedUser.uid)
|
|
763
|
-
this.logger.log(
|
|
764
|
-
'[CONVS-DETAIL] - initGroupsHandler - tenant',
|
|
765
|
-
this.tenant,
|
|
766
|
-
' loggedUser UID',
|
|
767
|
-
this.loggedUser.uid,
|
|
768
|
-
)
|
|
738
|
+
this.logger.log('[CONVS-DETAIL] - initGroupsHandler - tenant', this.tenant, ' loggedUser UID', this.loggedUser.uid)
|
|
769
739
|
}
|
|
770
740
|
}
|
|
771
741
|
|
|
@@ -790,16 +760,10 @@ export class ConversationDetailPage
|
|
|
790
760
|
// startConversation
|
|
791
761
|
// ---------------------------------
|
|
792
762
|
startConversation() {
|
|
793
|
-
|
|
794
|
-
'[CONVS-DETAIL] - startConversation conversationWith: ',
|
|
795
|
-
this.conversationWith,
|
|
796
|
-
)
|
|
763
|
+
// console.log( '[CONVS-DETAIL] - startConversation conversationWith: ', this.conversationWith )
|
|
797
764
|
if (this.conversationWith) {
|
|
798
765
|
this.channelType = setChannelType(this.conversationWith)
|
|
799
|
-
this.logger.log(
|
|
800
|
-
'[CONVS-DETAIL] - startConversation channelType : ',
|
|
801
|
-
this.channelType,
|
|
802
|
-
)
|
|
766
|
+
this.logger.log('[CONVS-DETAIL] - startConversation channelType : ', this.channelType)
|
|
803
767
|
// this.selectInfoContentTypeComponent();
|
|
804
768
|
this.setHeaderContent()
|
|
805
769
|
}
|
|
@@ -814,29 +778,18 @@ export class ConversationDetailPage
|
|
|
814
778
|
this.conversationsHandlerService &&
|
|
815
779
|
this.conv_type === 'active'
|
|
816
780
|
) {
|
|
817
|
-
this.logger.log(
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
'[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)',
|
|
826
|
-
this.conversationWith,
|
|
827
|
-
conv,
|
|
828
|
-
)
|
|
829
|
-
this.conversationAvatar = setConversationAvatar(
|
|
830
|
-
conv.conversation_with,
|
|
831
|
-
conv.conversation_with_fullname,
|
|
832
|
-
conv.channel_type,
|
|
833
|
-
)
|
|
834
|
-
}
|
|
835
|
-
this.logger.log(
|
|
836
|
-
'[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ',
|
|
837
|
-
this.conversationAvatar,
|
|
781
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
782
|
+
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
783
|
+
if (conv) {
|
|
784
|
+
// console.log( '[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv )
|
|
785
|
+
this.conversationAvatar = setConversationAvatar(
|
|
786
|
+
conv.conversation_with,
|
|
787
|
+
conv.conversation_with_fullname,
|
|
788
|
+
conv.channel_type,
|
|
838
789
|
)
|
|
839
|
-
}
|
|
790
|
+
}
|
|
791
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
792
|
+
},
|
|
840
793
|
)
|
|
841
794
|
} else {
|
|
842
795
|
//get conversation from 'conversations' firebase node
|
|
@@ -844,11 +797,7 @@ export class ConversationDetailPage
|
|
|
844
797
|
this.conversationWith,
|
|
845
798
|
(conv) => {
|
|
846
799
|
if (conv) {
|
|
847
|
-
|
|
848
|
-
'[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)',
|
|
849
|
-
this.conversationWith,
|
|
850
|
-
conv,
|
|
851
|
-
)
|
|
800
|
+
// console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
|
|
852
801
|
this.conversationAvatar = setConversationAvatar(
|
|
853
802
|
conv.conversation_with,
|
|
854
803
|
conv.conversation_with_fullname,
|
|
@@ -868,17 +817,9 @@ export class ConversationDetailPage
|
|
|
868
817
|
}
|
|
869
818
|
|
|
870
819
|
returnSendMessage(e: any) {
|
|
871
|
-
this.logger.log(
|
|
872
|
-
'[CONVS-DETAIL] - returnSendMessage event',
|
|
873
|
-
e,
|
|
874
|
-
' - conversationWith',
|
|
875
|
-
this.conversationWith,
|
|
876
|
-
)
|
|
820
|
+
this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith)
|
|
877
821
|
|
|
878
|
-
this.logger.log(
|
|
879
|
-
'[CONVS-DETAIL] - returnSendMessage event message',
|
|
880
|
-
e.message,
|
|
881
|
-
)
|
|
822
|
+
this.logger.log('[CONVS-DETAIL] - returnSendMessage event message', e.message)
|
|
882
823
|
try {
|
|
883
824
|
let message = ''
|
|
884
825
|
if (e.message) {
|
|
@@ -957,14 +898,7 @@ export class ConversationDetailPage
|
|
|
957
898
|
// }
|
|
958
899
|
|
|
959
900
|
metadata ? (metadata = metadata) : (metadata = '')
|
|
960
|
-
this.logger.log(
|
|
961
|
-
'[CONVS-DETAIL] - SEND MESSAGE msg: ',
|
|
962
|
-
msg,
|
|
963
|
-
' - messages: ',
|
|
964
|
-
this.messages,
|
|
965
|
-
' - loggedUser: ',
|
|
966
|
-
this.loggedUser,
|
|
967
|
-
)
|
|
901
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser)
|
|
968
902
|
|
|
969
903
|
if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
|
|
970
904
|
this.conversationHandlerService.sendMessage(
|
|
@@ -997,30 +931,13 @@ export class ConversationDetailPage
|
|
|
997
931
|
if (!subscription) {
|
|
998
932
|
subscription = this.conversationsHandlerService.conversationChanged.subscribe(
|
|
999
933
|
(data: ConversationModel) => {
|
|
1000
|
-
this.logger.log(
|
|
1001
|
-
'[CONVS-DETAIL] subscribe BSConversationsChanged data ',
|
|
1002
|
-
data,
|
|
1003
|
-
' this.loggedUser.uid:',
|
|
1004
|
-
this.loggedUser.uid,
|
|
1005
|
-
)
|
|
934
|
+
this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid)
|
|
1006
935
|
|
|
1007
936
|
if (data && data.sender !== this.loggedUser.uid) {
|
|
1008
|
-
this.logger.log(
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
)
|
|
1012
|
-
this.logger.log(
|
|
1013
|
-
'[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ',
|
|
1014
|
-
this.loggedUser.uid,
|
|
1015
|
-
)
|
|
1016
|
-
this.logger.log(
|
|
1017
|
-
'[CONVS-DETAIL] subscribe to BSConversationsChange is_new ',
|
|
1018
|
-
data.is_new,
|
|
1019
|
-
)
|
|
1020
|
-
this.logger.log(
|
|
1021
|
-
'[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ',
|
|
1022
|
-
this.showButtonToBottom,
|
|
1023
|
-
)
|
|
937
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
|
|
938
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
939
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
|
|
940
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
1024
941
|
// UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
1025
942
|
// AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
1026
943
|
if (!this.showButtonToBottom && data.is_new) {
|
|
@@ -1039,16 +956,10 @@ export class ConversationDetailPage
|
|
|
1039
956
|
(item) => item.key === subscriptionKey,
|
|
1040
957
|
)
|
|
1041
958
|
if (!subscription) {
|
|
1042
|
-
this.logger.log(
|
|
1043
|
-
'[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService',
|
|
1044
|
-
this.conversationHandlerService,
|
|
1045
|
-
)
|
|
959
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService)
|
|
1046
960
|
subscription = this.conversationHandlerService.messageAdded.subscribe(
|
|
1047
961
|
(msg: any) => {
|
|
1048
|
-
this.logger.log(
|
|
1049
|
-
'[CONVS-DETAIL] subscribe to messageAdded - msg ',
|
|
1050
|
-
msg,
|
|
1051
|
-
)
|
|
962
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
|
|
1052
963
|
if (msg) {
|
|
1053
964
|
that.newMessageAdded(msg)
|
|
1054
965
|
}
|
|
@@ -1085,10 +996,7 @@ export class ConversationDetailPage
|
|
|
1085
996
|
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved')
|
|
1086
997
|
subscription = this.conversationHandlerService.messageRemoved.subscribe(
|
|
1087
998
|
(messageId: any) => {
|
|
1088
|
-
this.logger.log(
|
|
1089
|
-
'[CONVS-DETAIL] subscribe to messageRemoved - messageId ',
|
|
1090
|
-
messageId,
|
|
1091
|
-
)
|
|
999
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId)
|
|
1092
1000
|
},
|
|
1093
1001
|
)
|
|
1094
1002
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
@@ -1106,21 +1014,13 @@ export class ConversationDetailPage
|
|
|
1106
1014
|
.subscribe(
|
|
1107
1015
|
(groupDetail: any) => {
|
|
1108
1016
|
this.groupDetail = groupDetail
|
|
1109
|
-
this.logger.log(
|
|
1110
|
-
'[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ',
|
|
1111
|
-
this.groupDetail,
|
|
1112
|
-
)
|
|
1017
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ', this.groupDetail)
|
|
1113
1018
|
},
|
|
1114
1019
|
(error) => {
|
|
1115
|
-
this.logger.error(
|
|
1116
|
-
'I[CONVS-DETAIL] subscribe to onGroupChange - ERROR ',
|
|
1117
|
-
error,
|
|
1118
|
-
)
|
|
1020
|
+
this.logger.error('[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error)
|
|
1119
1021
|
},
|
|
1120
1022
|
() => {
|
|
1121
|
-
this.logger.log(
|
|
1122
|
-
'[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */',
|
|
1123
|
-
)
|
|
1023
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */')
|
|
1124
1024
|
this.groupDetail = null
|
|
1125
1025
|
},
|
|
1126
1026
|
)
|
|
@@ -1241,31 +1141,13 @@ export class ConversationDetailPage
|
|
|
1241
1141
|
|
|
1242
1142
|
this.heightMessageTextArea = height.toString() //e.target.scrollHeight + 20;
|
|
1243
1143
|
const message = e.msg
|
|
1244
|
-
this.logger.log(
|
|
1245
|
-
'[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ',
|
|
1246
|
-
this.heightMessageTextArea,
|
|
1247
|
-
)
|
|
1144
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ', this.heightMessageTextArea)
|
|
1248
1145
|
|
|
1249
|
-
this.logger.log(
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
)
|
|
1253
|
-
this.logger.log(
|
|
1254
|
-
'[CONVS-DETAIL] returnChangeTextArea loggedUser uid:',
|
|
1255
|
-
this.loggedUser.uid,
|
|
1256
|
-
)
|
|
1257
|
-
this.logger.log(
|
|
1258
|
-
'[CONVS-DETAIL] returnChangeTextArea loggedUser firstname:',
|
|
1259
|
-
this.loggedUser.firstname,
|
|
1260
|
-
)
|
|
1261
|
-
this.logger.log(
|
|
1262
|
-
'[CONVS-DETAIL] returnChangeTextArea conversationSelected uid:',
|
|
1263
|
-
this.conversationWith,
|
|
1264
|
-
)
|
|
1265
|
-
this.logger.log(
|
|
1266
|
-
'[CONVS-DETAIL] returnChangeTextArea channelType:',
|
|
1267
|
-
this.channelType,
|
|
1268
|
-
)
|
|
1146
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea e.detail.value', e.msg)
|
|
1147
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea loggedUser uid:', this.loggedUser.uid)
|
|
1148
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea loggedUser firstname:', this.loggedUser.firstname)
|
|
1149
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea conversationSelected uid:', this.conversationWith)
|
|
1150
|
+
this.logger.log('[CONVS-DETAIL] returnChangeTextArea channelType:', this.channelType)
|
|
1269
1151
|
let idCurrentUser = ''
|
|
1270
1152
|
let userFullname = ''
|
|
1271
1153
|
|
|
@@ -1291,14 +1173,11 @@ export class ConversationDetailPage
|
|
|
1291
1173
|
// ----------------------------------------------------------
|
|
1292
1174
|
// DISPLAY CANNED RESPONSES if message.lastIndexOf("/")
|
|
1293
1175
|
// ----------------------------------------------------------
|
|
1294
|
-
if (this.areVisibleCAR) {
|
|
1176
|
+
if (this.areVisibleCAR && this.support_mode === true) {
|
|
1295
1177
|
setTimeout(() => {
|
|
1296
1178
|
if (this.conversationWith.startsWith('support-group')) {
|
|
1297
1179
|
const pos = message.lastIndexOf('/')
|
|
1298
|
-
this.logger.log(
|
|
1299
|
-
'[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / (using lastIndexOf) ',
|
|
1300
|
-
pos,
|
|
1301
|
-
)
|
|
1180
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / (using lastIndexOf) ', pos)
|
|
1302
1181
|
|
|
1303
1182
|
if (pos === -1) {
|
|
1304
1183
|
this.tagsCannedFilter = []
|
|
@@ -1318,10 +1197,7 @@ export class ConversationDetailPage
|
|
|
1318
1197
|
|
|
1319
1198
|
if (pos >= 0) {
|
|
1320
1199
|
var strSearch = message.substr(pos + 1)
|
|
1321
|
-
this.logger.log(
|
|
1322
|
-
'[CONVS-DETAIL] - returnChangeTextArea - canned responses strSearch ',
|
|
1323
|
-
strSearch,
|
|
1324
|
-
)
|
|
1200
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea - canned responses strSearch ', strSearch)
|
|
1325
1201
|
|
|
1326
1202
|
// --------------------------------------------
|
|
1327
1203
|
// Load canned responses
|
|
@@ -1341,15 +1217,11 @@ export class ConversationDetailPage
|
|
|
1341
1217
|
after_slash.length === 1 &&
|
|
1342
1218
|
after_slash.trim() === ''
|
|
1343
1219
|
) {
|
|
1344
|
-
this.logger.log(
|
|
1345
|
-
'[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ',
|
|
1346
|
-
)
|
|
1220
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ')
|
|
1347
1221
|
this.HIDE_CANNED_RESPONSES = true
|
|
1348
1222
|
this.tagsCannedFilter = []
|
|
1349
1223
|
} else if (pos === 0 && after_slash.length === 0) {
|
|
1350
|
-
this.logger.log(
|
|
1351
|
-
'[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after',
|
|
1352
|
-
)
|
|
1224
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after')
|
|
1353
1225
|
this.HIDE_CANNED_RESPONSES = false
|
|
1354
1226
|
}
|
|
1355
1227
|
|
|
@@ -1361,29 +1233,14 @@ export class ConversationDetailPage
|
|
|
1361
1233
|
|
|
1362
1234
|
let beforeSlash = message.substr(pos - 1)
|
|
1363
1235
|
let afterSlash = message.substr(pos + 1)
|
|
1364
|
-
this.logger.log(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
)
|
|
1368
|
-
|
|
1369
|
-
this.logger.log(
|
|
1370
|
-
'[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash',
|
|
1371
|
-
beforeSlash,
|
|
1372
|
-
)
|
|
1373
|
-
this.logger.log(
|
|
1374
|
-
'[CONVS-DETAIL] - returnChangeTextArea --> afterSlash',
|
|
1375
|
-
afterSlash,
|
|
1376
|
-
)
|
|
1236
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea * POS ', pos)
|
|
1237
|
+
|
|
1238
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
|
|
1239
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
|
|
1377
1240
|
var afterSlashParts = afterSlash.split('/')
|
|
1378
1241
|
var beforeSlashParts = beforeSlash.split('/')
|
|
1379
|
-
this.logger.log(
|
|
1380
|
-
|
|
1381
|
-
afterSlashParts,
|
|
1382
|
-
)
|
|
1383
|
-
this.logger.log(
|
|
1384
|
-
'[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts',
|
|
1385
|
-
beforeSlashParts,
|
|
1386
|
-
)
|
|
1242
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash parts', afterSlashParts)
|
|
1243
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts', beforeSlashParts)
|
|
1387
1244
|
|
|
1388
1245
|
if (beforeSlashParts.length === 2) {
|
|
1389
1246
|
if (
|
|
@@ -1401,16 +1258,12 @@ export class ConversationDetailPage
|
|
|
1401
1258
|
) {
|
|
1402
1259
|
this.HIDE_CANNED_RESPONSES = true
|
|
1403
1260
|
this.tagsCannedFilter = []
|
|
1404
|
-
this.logger.log(
|
|
1405
|
-
'[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not',
|
|
1406
|
-
)
|
|
1261
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not')
|
|
1407
1262
|
} else if (
|
|
1408
1263
|
beforeSlashParts[0].indexOf(' ') >= 0 &&
|
|
1409
1264
|
afterSlashParts[0] === ' '
|
|
1410
1265
|
) {
|
|
1411
|
-
this.logger.log(
|
|
1412
|
-
'[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES',
|
|
1413
|
-
)
|
|
1266
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES')
|
|
1414
1267
|
this.HIDE_CANNED_RESPONSES = true
|
|
1415
1268
|
this.tagsCannedFilter = []
|
|
1416
1269
|
}
|
|
@@ -1433,14 +1286,8 @@ export class ConversationDetailPage
|
|
|
1433
1286
|
// ----------------------------------------------------------
|
|
1434
1287
|
loadTagsCanned(strSearch, conversationWith) {
|
|
1435
1288
|
this.logger.log('[CONVS-DETAIL] - loadTagsCanned strSearch ', strSearch)
|
|
1436
|
-
this.logger.log(
|
|
1437
|
-
|
|
1438
|
-
this.groupDetail,
|
|
1439
|
-
)
|
|
1440
|
-
this.logger.log(
|
|
1441
|
-
'[CONVS-DETAIL] - loadTagsCanned conversationWith ',
|
|
1442
|
-
conversationWith,
|
|
1443
|
-
)
|
|
1289
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned groupDetail ', this.groupDetail)
|
|
1290
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned conversationWith ', conversationWith)
|
|
1444
1291
|
|
|
1445
1292
|
const conversationWith_segments = conversationWith.split('-')
|
|
1446
1293
|
// Removes the last element of the array if is = to the separator
|
|
@@ -1454,19 +1301,13 @@ export class ConversationDetailPage
|
|
|
1454
1301
|
const lastArrayElement =
|
|
1455
1302
|
conversationWith_segments[conversationWith_segments.length - 1]
|
|
1456
1303
|
this.logger.log('[CONVS-DETAIL] - lastArrayElement ', lastArrayElement)
|
|
1457
|
-
this.logger.log(
|
|
1458
|
-
'[CONVS-DETAIL] - lastArrayElement length',
|
|
1459
|
-
lastArrayElement.length,
|
|
1460
|
-
)
|
|
1304
|
+
this.logger.log('[CONVS-DETAIL] - lastArrayElement length', lastArrayElement.length)
|
|
1461
1305
|
if (lastArrayElement.length !== 32) {
|
|
1462
1306
|
conversationWith_segments.pop()
|
|
1463
1307
|
}
|
|
1464
1308
|
}
|
|
1465
1309
|
|
|
1466
|
-
this.logger.log(
|
|
1467
|
-
'[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ',
|
|
1468
|
-
conversationWith_segments,
|
|
1469
|
-
)
|
|
1310
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ', conversationWith_segments)
|
|
1470
1311
|
let projectId = ''
|
|
1471
1312
|
|
|
1472
1313
|
if (conversationWith_segments.length === 4) {
|
|
@@ -1486,31 +1327,20 @@ export class ConversationDetailPage
|
|
|
1486
1327
|
.getProjectIdByConvRecipient(tiledeskToken, conversationWith)
|
|
1487
1328
|
.subscribe(
|
|
1488
1329
|
(res) => {
|
|
1489
|
-
this.logger.log(
|
|
1490
|
-
'[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES',
|
|
1491
|
-
res,
|
|
1492
|
-
)
|
|
1330
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
|
|
1493
1331
|
if (res) {
|
|
1494
1332
|
const projectId = res.id_project
|
|
1495
|
-
this.logger.log(
|
|
1496
|
-
'[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ',
|
|
1497
|
-
projectId,
|
|
1498
|
-
)
|
|
1333
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
|
|
1499
1334
|
if (projectId) {
|
|
1500
1335
|
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1501
1336
|
}
|
|
1502
1337
|
}
|
|
1503
1338
|
},
|
|
1504
1339
|
(error) => {
|
|
1505
|
-
this.logger.error(
|
|
1506
|
-
'[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ',
|
|
1507
|
-
error,
|
|
1508
|
-
)
|
|
1340
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
1509
1341
|
},
|
|
1510
1342
|
() => {
|
|
1511
|
-
this.logger.log(
|
|
1512
|
-
'[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',
|
|
1513
|
-
)
|
|
1343
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
1514
1344
|
},
|
|
1515
1345
|
)
|
|
1516
1346
|
}
|
|
@@ -1527,31 +1357,20 @@ export class ConversationDetailPage
|
|
|
1527
1357
|
.getCannedResponses(tiledeskToken, projectId)
|
|
1528
1358
|
.subscribe(
|
|
1529
1359
|
(res) => {
|
|
1530
|
-
this.logger.log(
|
|
1531
|
-
'[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES',
|
|
1532
|
-
res,
|
|
1533
|
-
)
|
|
1360
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res)
|
|
1534
1361
|
|
|
1535
1362
|
this.tagsCanned = res
|
|
1536
1363
|
this.tagsCannedCount = res.length
|
|
1537
|
-
this.logger.log(
|
|
1538
|
-
'[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount',
|
|
1539
|
-
this.tagsCannedCount,
|
|
1540
|
-
)
|
|
1364
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
|
|
1541
1365
|
if (this.HIDE_CANNED_RESPONSES === false) {
|
|
1542
1366
|
this.showTagsCanned(strSearch)
|
|
1543
1367
|
}
|
|
1544
1368
|
},
|
|
1545
1369
|
(error) => {
|
|
1546
|
-
this.logger.error(
|
|
1547
|
-
'[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ',
|
|
1548
|
-
error,
|
|
1549
|
-
)
|
|
1370
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
|
|
1550
1371
|
},
|
|
1551
1372
|
() => {
|
|
1552
|
-
this.logger.log(
|
|
1553
|
-
'[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *',
|
|
1554
|
-
)
|
|
1373
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
|
|
1555
1374
|
},
|
|
1556
1375
|
)
|
|
1557
1376
|
}
|
|
@@ -1560,16 +1379,10 @@ export class ConversationDetailPage
|
|
|
1560
1379
|
this.logger.log('[CONVS-DETAIL] - showTagsCanned strSearch ', strSearch)
|
|
1561
1380
|
this.tagsCannedFilter = []
|
|
1562
1381
|
var tagsCannedClone = JSON.parse(JSON.stringify(this.tagsCanned))
|
|
1563
|
-
this.logger.log(
|
|
1564
|
-
'[CONVS-DETAIL] - showTagsCanned tagsCannedClone ',
|
|
1565
|
-
tagsCannedClone,
|
|
1566
|
-
)
|
|
1382
|
+
this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedClone ', tagsCannedClone)
|
|
1567
1383
|
//this.logger.log("that.contacts lenght:: ", strSearch);
|
|
1568
1384
|
this.tagsCannedFilter = this.filterItems(tagsCannedClone, strSearch)
|
|
1569
|
-
this.logger.log(
|
|
1570
|
-
'[CONVS-DETAIL] - showTagsCanned tagsCannedFilter ',
|
|
1571
|
-
this.tagsCannedFilter,
|
|
1572
|
-
)
|
|
1385
|
+
this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedFilter ', this.tagsCannedFilter)
|
|
1573
1386
|
|
|
1574
1387
|
this.tagsCannedFilter.sort(compareValues('title', 'asc'))
|
|
1575
1388
|
var strReplace = strSearch
|
|
@@ -1577,40 +1390,47 @@ export class ConversationDetailPage
|
|
|
1577
1390
|
strReplace = "<b class='highlight-search-string'>" + strSearch + '</b>'
|
|
1578
1391
|
}
|
|
1579
1392
|
for (var i = 0; i < this.tagsCannedFilter.length; i++) {
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
this.tagsCannedFilter[i].title =
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
.toString()
|
|
1588
|
-
.replace(strSearch, strReplace.trim()) +
|
|
1589
|
-
'</div>' +
|
|
1590
|
-
textCanned +
|
|
1591
|
-
'</div>'
|
|
1393
|
+
let text = htmlEntities(this.tagsCannedFilter[i].text);
|
|
1394
|
+
// const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(this.tagsCannedFilter[i].text) + '</div>'
|
|
1395
|
+
const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(text) + '</div>'
|
|
1396
|
+
let title = htmlEntities(this.tagsCannedFilter[i].title)
|
|
1397
|
+
// this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
|
|
1398
|
+
this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
|
|
1399
|
+
|
|
1592
1400
|
}
|
|
1593
1401
|
if (this.tagsCannedCount === 0) {
|
|
1594
|
-
const
|
|
1402
|
+
// const button = this.renderer.createElement('button');
|
|
1403
|
+
// const buttonText = this.renderer.createText('Click me');
|
|
1404
|
+
// this.renderer.appendChild(button, buttonText);
|
|
1405
|
+
// console.log('[CONVS-DETAIL] - this.el.nativeElement ', this.el.nativeElement)
|
|
1406
|
+
// this.renderer.listen(button, 'click', () => { alert('hi'); });
|
|
1407
|
+
// let nocanned = {}
|
|
1408
|
+
// if (this.USER_ROLE !== 'agent') {
|
|
1409
|
+
const nocanned = {
|
|
1410
|
+
// "<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
|
+
// <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
|
|
1595
1412
|
title:
|
|
1596
|
-
"<div class='cannedContent'><div class='cannedTitle nocannedTitle'>" +
|
|
1597
|
-
this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') +
|
|
1598
|
-
".</div><div class='cannedText'>" +
|
|
1599
|
-
this.translationMap.get('TO_CREATE_THEM_GO_TO_THE_PROJECT') +
|
|
1600
|
-
'</div></div>',
|
|
1413
|
+
"<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
|
|
1601
1414
|
text: 'There are no canned responses available',
|
|
1602
1415
|
}
|
|
1416
|
+
// } else if (this.USER_ROLE === 'agent') {
|
|
1417
|
+
// nocanned = {
|
|
1418
|
+
// // "<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>'
|
|
1419
|
+
// title:
|
|
1420
|
+
// "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
|
|
1421
|
+
// text: 'There are no canned responses available',
|
|
1422
|
+
// }
|
|
1423
|
+
// }
|
|
1603
1424
|
this.tagsCannedFilter.push(nocanned)
|
|
1604
1425
|
}
|
|
1605
1426
|
}
|
|
1606
1427
|
|
|
1428
|
+
toggleSidebar() {
|
|
1429
|
+
// console.log('[CONVS-DETAIL] has clicked test')
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1607
1432
|
filterItems(items, searchTerm) {
|
|
1608
|
-
this.logger.log(
|
|
1609
|
-
'[CONVS-DETAIL] filterItems tagsCannedClone ',
|
|
1610
|
-
items,
|
|
1611
|
-
' searchTerm: ',
|
|
1612
|
-
searchTerm,
|
|
1613
|
-
)
|
|
1433
|
+
this.logger.log('[CONVS-DETAIL] filterItems tagsCannedClone ', items, ' searchTerm: ', searchTerm)
|
|
1614
1434
|
//this.logger.log("filterItems::: ",searchTerm);
|
|
1615
1435
|
return items.filter((item) => {
|
|
1616
1436
|
//this.logger.log("filterItems::: ", item.title.toString().toLowerCase());
|
|
@@ -1634,46 +1454,69 @@ export class ConversationDetailPage
|
|
|
1634
1454
|
}
|
|
1635
1455
|
|
|
1636
1456
|
replaceTagInMessage(canned, event) {
|
|
1637
|
-
this.
|
|
1638
|
-
|
|
1639
|
-
|
|
1457
|
+
if (this.tagsCannedCount > 0) {
|
|
1458
|
+
// console.log('[CONVS-DETAIL] replaceTagInMessage event ', event)
|
|
1459
|
+
// console.log('[CONVS-DETAIL] replaceTagInMessage canned ', canned)
|
|
1460
|
+
// console.log('[CONVS-DETAIL] replaceTagInMessage canned title', canned.title)
|
|
1461
|
+
// console.log('[CONVS-DETAIL] replaceTagInMessage canned contains nocannedTitle', canned.title.includes('nocannedTitle'))
|
|
1462
|
+
|
|
1463
|
+
const elTextArea = this.rowTextArea['el']
|
|
1464
|
+
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1640
1465
|
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
'[CONVS-DETAIL] replaceTagInMessage textArea value',
|
|
1644
|
-
textArea.value,
|
|
1645
|
-
)
|
|
1466
|
+
// console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
|
|
1467
|
+
// console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
|
|
1646
1468
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1469
|
+
// var lastChar = textArea.value.substr(-1); // Selects the last character
|
|
1470
|
+
// if (lastChar === '/') {
|
|
1471
|
+
// textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
|
|
1472
|
+
// }
|
|
1473
|
+
// this.insertAtCursor(this.textArea, textArea.value)
|
|
1474
|
+
|
|
1475
|
+
this.arrowkeyLocation = -1
|
|
1476
|
+
this.tagsCannedFilter = []
|
|
1477
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned text ', canned.text)
|
|
1478
|
+
|
|
1479
|
+
// replace text
|
|
1480
|
+
var pos = textArea.value.lastIndexOf('/')
|
|
1481
|
+
var strSearch = textArea.value.substr(pos)
|
|
1482
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strSearch)
|
|
1483
|
+
|
|
1484
|
+
var strTEMP = textArea.value.replace(strSearch, canned.text)
|
|
1485
|
+
strTEMP = this.replacePlaceholderInCanned(strTEMP)
|
|
1486
|
+
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
|
|
1487
|
+
// strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1488
|
+
// textArea.value = '';
|
|
1489
|
+
// that.messageString = strTEMP;
|
|
1490
|
+
textArea.value = strTEMP
|
|
1491
|
+
setTimeout(() => {
|
|
1492
|
+
// textArea.focus();
|
|
1493
|
+
textArea.setFocus()
|
|
1494
|
+
this.resizeTextArea()
|
|
1495
|
+
}, 200)
|
|
1496
|
+
}
|
|
1497
|
+
else {
|
|
1498
|
+
this.logger.log('[CONVS-DETAIL] THERE IS NOT CANNED ', canned.text)
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1652
1501
|
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
)
|
|
1502
|
+
async presentCreateCannedResponseModal(): Promise<any> {
|
|
1503
|
+
const elTextArea = this.rowTextArea['el']
|
|
1504
|
+
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1505
|
+
textArea.value = ''
|
|
1506
|
+
|
|
1507
|
+
// console.log('[CONVS-DETAIL] PRESENT CREATE CANNED RESPONSE MODAL ')
|
|
1508
|
+
const attributes = { conversationWith: this.conversationWith }
|
|
1509
|
+
const modal: HTMLIonModalElement = await this.modalController.create({
|
|
1510
|
+
component: CreateCannedResponsePage,
|
|
1511
|
+
componentProps: attributes,
|
|
1512
|
+
swipeToClose: false,
|
|
1513
|
+
backdropDismiss: false,
|
|
1514
|
+
})
|
|
1515
|
+
modal.onDidDismiss().then((dataReturned: any) => {
|
|
1516
|
+
this.logger.log('[CONVS-DETAIL] ', dataReturned.data)
|
|
1517
|
+
})
|
|
1659
1518
|
|
|
1660
|
-
|
|
1661
|
-
var pos = textArea.value.lastIndexOf('/')
|
|
1662
|
-
var strSearch = textArea.value.substr(pos)
|
|
1663
|
-
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strSearch)
|
|
1664
|
-
|
|
1665
|
-
var strTEMP = textArea.value.replace(strSearch, canned.text)
|
|
1666
|
-
strTEMP = this.replacePlaceholderInCanned(strTEMP)
|
|
1667
|
-
this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
|
|
1668
|
-
// strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1669
|
-
// textArea.value = '';
|
|
1670
|
-
// that.messageString = strTEMP;
|
|
1671
|
-
textArea.value = strTEMP
|
|
1672
|
-
setTimeout(() => {
|
|
1673
|
-
// textArea.focus();
|
|
1674
|
-
textArea.setFocus()
|
|
1675
|
-
this.resizeTextArea()
|
|
1676
|
-
}, 200)
|
|
1519
|
+
return await modal.present()
|
|
1677
1520
|
}
|
|
1678
1521
|
|
|
1679
1522
|
hasClickedOpenCannedResponses($event) {
|
|
@@ -1681,10 +1524,7 @@ export class ConversationDetailPage
|
|
|
1681
1524
|
const elTextArea = this.rowTextArea['el']
|
|
1682
1525
|
const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
|
|
1683
1526
|
|
|
1684
|
-
this.logger.log(
|
|
1685
|
-
'[CONVS-DETAIL] hasClickedOpenCannedResponses textArea ',
|
|
1686
|
-
textArea,
|
|
1687
|
-
)
|
|
1527
|
+
this.logger.log('[CONVS-DETAIL] hasClickedOpenCannedResponses textArea ', textArea)
|
|
1688
1528
|
// console.log("[CONVS-DETAIL] hasClickedOpenCannedResponses textArea value", textArea.value)
|
|
1689
1529
|
var lastChar = textArea.value[textArea.value.length - 1]
|
|
1690
1530
|
// console.log('[CONVS-DETAIL] hasClickedOpenCannedResponses lastChar', lastChar)
|
|
@@ -1840,7 +1680,7 @@ export class ConversationDetailPage
|
|
|
1840
1680
|
// this.isMenuShow = event;
|
|
1841
1681
|
}
|
|
1842
1682
|
|
|
1843
|
-
returnOnScrollContent(event: boolean) {}
|
|
1683
|
+
returnOnScrollContent(event: boolean) { }
|
|
1844
1684
|
|
|
1845
1685
|
returnOnAttachmentButtonClicked(event: any) {
|
|
1846
1686
|
this.logger.debug('[CONV-COMP] eventbutton', event)
|