@chat21/chat21-ionic 3.0.61-rc11 → 3.0.61-rc15

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/angular.json +1 -0
  3. package/package.json +2 -1
  4. package/src/app/app-routing.module.ts +5 -0
  5. package/src/app/app.module.ts +6 -3
  6. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +36 -25
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +160 -50
  8. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +101 -18
  9. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +21 -36
  10. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +19 -7
  11. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +35 -40
  12. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
  13. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +28 -25
  14. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +57 -20
  15. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +32 -9
  16. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +93 -24
  17. package/src/app/components/project-item/project-item.component.scss +1 -1
  18. package/src/app/components/sidebar/sidebar.component.html +36 -35
  19. package/src/app/components/sidebar/sidebar.component.ts +72 -26
  20. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +7 -0
  21. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +13 -1
  22. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +11 -7
  23. package/src/app/pages/conversation-detail/conversation-detail.module.ts +5 -1
  24. package/src/app/pages/conversation-detail/conversation-detail.page.html +19 -11
  25. package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
  26. package/src/app/pages/conversation-detail/conversation-detail.page.ts +221 -368
  27. package/src/app/pages/conversations-list/conversations-list.page.ts +6 -18
  28. package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
  29. package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
  30. package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
  31. package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
  32. package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
  33. package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
  34. package/src/app/pages/create-requester/create-requester.page.html +1 -1
  35. package/src/app/pages/create-requester/create-requester.page.ts +1 -0
  36. package/src/app/pages/create-ticket/create-ticket.page.html +1 -1
  37. package/src/app/pages/create-ticket/create-ticket.page.ts +13 -4
  38. package/src/app/pages/profile-info/profile-info.page.html +2 -2
  39. package/src/app/pages/profile-info/profile-info.page.scss +12 -1
  40. package/src/app/services/tiledesk/tiledesk.service.ts +28 -0
  41. package/src/app/shared/shared.module.ts +1 -1
  42. package/src/assets/i18n/de.json +17 -3
  43. package/src/assets/i18n/en.json +17 -3
  44. package/src/assets/i18n/es.json +17 -3
  45. package/src/assets/i18n/fr.json +17 -3
  46. package/src/assets/i18n/it.json +17 -3
  47. package/src/assets/i18n/pt.json +17 -3
  48. package/src/assets/i18n/ru.json +17 -3
  49. package/src/assets/i18n/sr.json +17 -3
  50. package/src/assets/i18n/tr.json +17 -3
  51. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +8 -3
  52. package/src/chat21-core/utils/utils-message.ts +19 -0
  53. package/src/global.scss +8 -0
@@ -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,29 +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
152
- conversation: 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;
153
158
  isMine = isMine
154
159
  isInfo = isInfo
155
160
  isFirstMessage = isFirstMessage
156
161
  messageType = messageType
157
162
  // info_content_child_enabled: boolean = false
158
- private logger: LoggerService = LoggerInstance.getInstance()
163
+ private logger: LoggerService = LoggerInstance.getInstance();
159
164
 
160
- public isOnline: boolean = true
161
- public checkInternet: boolean
162
- public msgCount: number
163
- public disableTextarea: boolean
165
+ public isOnline: boolean = true;
166
+ public checkInternet: boolean;
167
+ public msgCount: number;
168
+ public disableTextarea: boolean;
164
169
 
165
170
  /**
166
171
  * Constructor
@@ -209,6 +214,8 @@ export class ConversationDetailPage
209
214
  public tiledeskService: TiledeskService,
210
215
  private networkService: NetworkService,
211
216
  private events: EventsService,
217
+ private renderer: Renderer2,
218
+ private el: ElementRef
212
219
  ) {
213
220
  // Change list on date change
214
221
  this.route.paramMap.subscribe((params) => {
@@ -241,9 +248,26 @@ export class ConversationDetailPage
241
248
 
242
249
  // }
243
250
  // });
244
- this.getConversations()
245
- this.watchToConnectionStatus()
246
- 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) {
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
+ }
247
271
  }
248
272
 
249
273
  getConversations() {
@@ -252,10 +276,7 @@ export class ConversationDetailPage
252
276
  const conversations = this.conversationsHandlerService.conversations
253
277
  // console.log('[CONVS-DETAIL] conversations', conversations);
254
278
  this.conversation_count = conversations.length
255
- this.logger.log(
256
- '[CONVS-DETAIL] conversation_count',
257
- this.conversation_count,
258
- )
279
+ this.logger.log('[CONVS-DETAIL] conversation_count', this.conversation_count)
259
280
  })
260
281
 
261
282
  this.conversationsHandlerService.conversationChanged.subscribe((conv) => {
@@ -286,11 +307,10 @@ export class ConversationDetailPage
286
307
  }
287
308
 
288
309
  getOSCODE() {
310
+ this.support_mode = this.appConfigProvider.getConfig().supportMode
311
+ this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig support_mode', this.support_mode)
289
312
  this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK
290
- this.logger.log(
291
- '[CONVS-DETAIL] AppConfigService getAppConfig public_Key',
292
- this.public_Key,
293
- )
313
+ this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key)
294
314
 
295
315
  if (this.public_Key) {
296
316
  let keys = this.public_Key.split('-')
@@ -355,15 +375,9 @@ export class ConversationDetailPage
355
375
 
356
376
  ionViewWillEnter() {
357
377
  // this.info_content_child_enabled = true;
358
- this.logger.log(
359
- '[CONVS-DETAIL] TEST > ionViewWillEnter - convId ',
360
- this.conversationWith,
361
- )
378
+ this.logger.log('[CONVS-DETAIL] TEST > ionViewWillEnter - convId ', this.conversationWith)
362
379
  this.loggedUser = this.tiledeskAuthService.getCurrentUser()
363
- this.logger.log(
364
- '[CONVS-DETAIL] ionViewWillEnter loggedUser: ',
365
- this.loggedUser,
366
- )
380
+ this.logger.log('[CONVS-DETAIL] ionViewWillEnter loggedUser: ', this.loggedUser)
367
381
  this.listnerStart()
368
382
  }
369
383
 
@@ -426,10 +440,7 @@ export class ConversationDetailPage
426
440
  // }
427
441
 
428
442
  this.loggedUser = this.tiledeskAuthService.getCurrentUser()
429
- this.logger.log(
430
- '[CONVS-DETAIL] - initialize -> loggedUser: ',
431
- this.loggedUser,
432
- )
443
+ this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
433
444
  this.translations()
434
445
  // this.conversationSelected = localStorage.getItem('conversationSelected');
435
446
  this.showButtonToBottom = false
@@ -438,17 +449,9 @@ export class ConversationDetailPage
438
449
  const appconfig = this.appConfigProvider.getConfig()
439
450
  // this.tenant = appconfig.tenant;
440
451
  this.tenant = appconfig.firebaseConfig.tenant
441
- this.logger.log(
442
- '[CONVS-DETAIL] - initialize -> firebaseConfig tenant ',
443
- this.tenant,
444
- )
452
+ this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant)
445
453
 
446
- this.logger.log(
447
- '[CONVS-DETAIL] - initialize -> conversationWith: ',
448
- this.conversationWith,
449
- ' -> conversationWithFullname: ',
450
- this.conversationWithFullname,
451
- )
454
+ this.logger.log('[CONVS-DETAIL] - initialize -> conversationWith: ', this.conversationWith, ' -> conversationWithFullname: ', this.conversationWithFullname)
452
455
  this.subscriptions = []
453
456
  this.setHeightTextArea()
454
457
  this.tagsCanned = [] // list of canned
@@ -460,10 +463,7 @@ export class ConversationDetailPage
460
463
  if (checkPlatformIsMobile()) {
461
464
  this.isMobile = true
462
465
  // this.openInfoConversation = false; // indica se è aperto il box info conversazione
463
- this.logger.log(
464
- '[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ',
465
- this.isMobile,
466
- )
466
+ this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
467
467
  } else {
468
468
  this.isMobile = false
469
469
  this.logger.log(
@@ -527,24 +527,15 @@ export class ConversationDetailPage
527
527
  .getProjectIdByConvRecipient(tiledeskToken, conversationWith)
528
528
  .subscribe(
529
529
  (res) => {
530
- this.logger.log(
531
- '[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT RES',
532
- res,
533
- )
530
+ this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT RES', res)
534
531
  if (res) {
535
532
  const projectId = res.id_project
536
- this.logger.log(
537
- '[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT projectId ',
538
- projectId,
539
- )
533
+ this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
540
534
  this.getProjectById(tiledeskToken, projectId)
541
535
  }
542
536
  },
543
537
  (error) => {
544
- this.logger.error(
545
- '[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ',
546
- error,
547
- )
538
+ this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
548
539
  },
549
540
  () => {
550
541
  this.logger.log(
@@ -638,6 +629,7 @@ export class ConversationDetailPage
638
629
  'YES_CANNED_RESPONSES',
639
630
  'THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE',
640
631
  'TO_CREATE_THEM_GO_TO_THE_PROJECT',
632
+ "AddNewCannedResponse"
641
633
  ]
642
634
 
643
635
  this.translationMap = this.customTranslateService.translateLanguage(keys)
@@ -710,49 +702,24 @@ export class ConversationDetailPage
710
702
 
711
703
  // // wait 8 second and then display the message if there are no messages
712
704
  const that = this
713
- this.logger.log(
714
- '[CONVS-DETAIL] - initConversationHandler that.messages ',
715
- that.messages,
716
- )
717
- this.logger.log(
718
- '[CONVS-DETAIL] - initConversationHandler that.messages.length ',
719
- that.messages.length,
720
- )
705
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages)
706
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length)
721
707
  this.msgCount = that.messages.length
722
708
  setTimeout(() => {
723
709
  if (!that.messages || that.messages.length === 0) {
724
710
  this.showIonContent = true
725
711
  that.showMessageWelcome = true
726
- this.logger.log(
727
- '[CONVS-DETAIL] - initConversationHandler - showMessageWelcome: ',
728
- that.showMessageWelcome,
729
- )
712
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler - showMessageWelcome: ', that.showMessageWelcome)
730
713
  }
731
714
  }, 8000)
732
715
  } else {
733
- this.logger.log(
734
- '[CONVS-DETAIL] - initConversationHandler (else) - conversationHandlerService ',
735
- this.conversationHandlerService,
736
- ' handler',
737
- handler,
738
- )
716
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - conversationHandlerService ', this.conversationHandlerService, ' handler', handler)
739
717
  this.conversationHandlerService = handler
740
718
  this.messages = this.conversationHandlerService.messages
741
- this.logger.log(
742
- '[CONVS-DETAIL] - initConversationHandler (else) - this.messages: ',
743
- this.messages,
744
- )
745
- this.logger.log(
746
- '[CONVS-DETAIL] - initConversationHandler (else) - this.showMessageWelcome: ',
747
- this.showMessageWelcome,
748
- )
719
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - this.messages: ', this.messages)
720
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - this.showMessageWelcome: ', this.showMessageWelcome)
749
721
  }
750
- this.logger.log(
751
- '[CONVS-DETAIL] - initConversationHandler (else) - message ',
752
- this.messages,
753
- ' showIonContent',
754
- this.showIonContent,
755
- )
722
+ this.logger.log('[CONVS-DETAIL] - initConversationHandler (else) - message ', this.messages, ' showIonContent', this.showIonContent)
756
723
  }
757
724
 
758
725
  initGroupsHandler() {
@@ -761,12 +728,7 @@ export class ConversationDetailPage
761
728
  this.conversationWith.startsWith('group-')
762
729
  ) {
763
730
  this.groupService.initialize(this.tenant, this.loggedUser.uid)
764
- this.logger.log(
765
- '[CONVS-DETAIL] - initGroupsHandler - tenant',
766
- this.tenant,
767
- ' loggedUser UID',
768
- this.loggedUser.uid,
769
- )
731
+ this.logger.log('[CONVS-DETAIL] - initGroupsHandler - tenant', this.tenant, ' loggedUser UID', this.loggedUser.uid)
770
732
  }
771
733
  }
772
734
 
@@ -794,7 +756,7 @@ export class ConversationDetailPage
794
756
  // console.log( '[CONVS-DETAIL] - startConversation conversationWith: ', this.conversationWith )
795
757
  if (this.conversationWith) {
796
758
  this.channelType = setChannelType(this.conversationWith)
797
- this.logger.log( '[CONVS-DETAIL] - startConversation channelType : ', this.channelType)
759
+ this.logger.log('[CONVS-DETAIL] - startConversation channelType : ', this.channelType)
798
760
  // this.selectInfoContentTypeComponent();
799
761
  this.setHeaderContent()
800
762
  }
@@ -809,18 +771,18 @@ export class ConversationDetailPage
809
771
  this.conversationsHandlerService &&
810
772
  this.conv_type === 'active'
811
773
  ) {
812
- this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING' )
813
- this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
814
- if (conv) {
815
- // console.log( '[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv )
816
- this.conversationAvatar = setConversationAvatar(
817
- conv.conversation_with,
818
- conv.conversation_with_fullname,
819
- conv.channel_type,
820
- )
821
- }
822
- this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
823
- },
774
+ this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
775
+ this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
776
+ if (conv) {
777
+ // console.log( '[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv )
778
+ this.conversationAvatar = setConversationAvatar(
779
+ conv.conversation_with,
780
+ conv.conversation_with_fullname,
781
+ conv.channel_type,
782
+ )
783
+ }
784
+ this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
785
+ },
824
786
  )
825
787
  } else {
826
788
  //get conversation from 'conversations' firebase node
@@ -848,17 +810,9 @@ export class ConversationDetailPage
848
810
  }
849
811
 
850
812
  returnSendMessage(e: any) {
851
- this.logger.log(
852
- '[CONVS-DETAIL] - returnSendMessage event',
853
- e,
854
- ' - conversationWith',
855
- this.conversationWith,
856
- )
813
+ this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith)
857
814
 
858
- this.logger.log(
859
- '[CONVS-DETAIL] - returnSendMessage event message',
860
- e.message,
861
- )
815
+ this.logger.log('[CONVS-DETAIL] - returnSendMessage event message', e.message)
862
816
  try {
863
817
  let message = ''
864
818
  if (e.message) {
@@ -937,14 +891,7 @@ export class ConversationDetailPage
937
891
  // }
938
892
 
939
893
  metadata ? (metadata = metadata) : (metadata = '')
940
- this.logger.log(
941
- '[CONVS-DETAIL] - SEND MESSAGE msg: ',
942
- msg,
943
- ' - messages: ',
944
- this.messages,
945
- ' - loggedUser: ',
946
- this.loggedUser,
947
- )
894
+ this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser)
948
895
 
949
896
  if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
950
897
  this.conversationHandlerService.sendMessage(
@@ -977,30 +924,13 @@ export class ConversationDetailPage
977
924
  if (!subscription) {
978
925
  subscription = this.conversationsHandlerService.conversationChanged.subscribe(
979
926
  (data: ConversationModel) => {
980
- this.logger.log(
981
- '[CONVS-DETAIL] subscribe BSConversationsChanged data ',
982
- data,
983
- ' this.loggedUser.uid:',
984
- this.loggedUser.uid,
985
- )
927
+ this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid)
986
928
 
987
929
  if (data && data.sender !== this.loggedUser.uid) {
988
- this.logger.log(
989
- '[CONVS-DETAIL] subscribe to BSConversationsChange data sender ',
990
- data.sender,
991
- )
992
- this.logger.log(
993
- '[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ',
994
- this.loggedUser.uid,
995
- )
996
- this.logger.log(
997
- '[CONVS-DETAIL] subscribe to BSConversationsChange is_new ',
998
- data.is_new,
999
- )
1000
- this.logger.log(
1001
- '[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ',
1002
- this.showButtonToBottom,
1003
- )
930
+ this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
931
+ this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
932
+ this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
933
+ this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
1004
934
  // UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
1005
935
  // AND IF THE POSITION OF THE SCROLL IS AT THE END
1006
936
  if (!this.showButtonToBottom && data.is_new) {
@@ -1019,16 +949,10 @@ export class ConversationDetailPage
1019
949
  (item) => item.key === subscriptionKey,
1020
950
  )
1021
951
  if (!subscription) {
1022
- this.logger.log(
1023
- '[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService',
1024
- this.conversationHandlerService,
1025
- )
952
+ this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService)
1026
953
  subscription = this.conversationHandlerService.messageAdded.subscribe(
1027
954
  (msg: any) => {
1028
- this.logger.log(
1029
- '[CONVS-DETAIL] subscribe to messageAdded - msg ',
1030
- msg,
1031
- )
955
+ this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
1032
956
  if (msg) {
1033
957
  that.newMessageAdded(msg)
1034
958
  }
@@ -1065,10 +989,7 @@ export class ConversationDetailPage
1065
989
  this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved')
1066
990
  subscription = this.conversationHandlerService.messageRemoved.subscribe(
1067
991
  (messageId: any) => {
1068
- this.logger.log(
1069
- '[CONVS-DETAIL] subscribe to messageRemoved - messageId ',
1070
- messageId,
1071
- )
992
+ this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId)
1072
993
  },
1073
994
  )
1074
995
  const subscribe = { key: subscriptionKey, value: subscription }
@@ -1086,21 +1007,13 @@ export class ConversationDetailPage
1086
1007
  .subscribe(
1087
1008
  (groupDetail: any) => {
1088
1009
  this.groupDetail = groupDetail
1089
- this.logger.log(
1090
- '[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ',
1091
- this.groupDetail,
1092
- )
1010
+ this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ', this.groupDetail)
1093
1011
  },
1094
1012
  (error) => {
1095
- this.logger.error(
1096
- 'I[CONVS-DETAIL] subscribe to onGroupChange - ERROR ',
1097
- error,
1098
- )
1013
+ this.logger.error('[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error)
1099
1014
  },
1100
1015
  () => {
1101
- this.logger.log(
1102
- '[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */',
1103
- )
1016
+ this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */')
1104
1017
  this.groupDetail = null
1105
1018
  },
1106
1019
  )
@@ -1221,31 +1134,13 @@ export class ConversationDetailPage
1221
1134
 
1222
1135
  this.heightMessageTextArea = height.toString() //e.target.scrollHeight + 20;
1223
1136
  const message = e.msg
1224
- this.logger.log(
1225
- '[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ',
1226
- this.heightMessageTextArea,
1227
- )
1137
+ this.logger.log('[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ', this.heightMessageTextArea)
1228
1138
 
1229
- this.logger.log(
1230
- '[CONVS-DETAIL] returnChangeTextArea e.detail.value',
1231
- e.msg,
1232
- )
1233
- this.logger.log(
1234
- '[CONVS-DETAIL] returnChangeTextArea loggedUser uid:',
1235
- this.loggedUser.uid,
1236
- )
1237
- this.logger.log(
1238
- '[CONVS-DETAIL] returnChangeTextArea loggedUser firstname:',
1239
- this.loggedUser.firstname,
1240
- )
1241
- this.logger.log(
1242
- '[CONVS-DETAIL] returnChangeTextArea conversationSelected uid:',
1243
- this.conversationWith,
1244
- )
1245
- this.logger.log(
1246
- '[CONVS-DETAIL] returnChangeTextArea channelType:',
1247
- this.channelType,
1248
- )
1139
+ this.logger.log('[CONVS-DETAIL] returnChangeTextArea e.detail.value', e.msg)
1140
+ this.logger.log('[CONVS-DETAIL] returnChangeTextArea loggedUser uid:', this.loggedUser.uid)
1141
+ this.logger.log('[CONVS-DETAIL] returnChangeTextArea loggedUser firstname:', this.loggedUser.firstname)
1142
+ this.logger.log('[CONVS-DETAIL] returnChangeTextArea conversationSelected uid:', this.conversationWith)
1143
+ this.logger.log('[CONVS-DETAIL] returnChangeTextArea channelType:', this.channelType)
1249
1144
  let idCurrentUser = ''
1250
1145
  let userFullname = ''
1251
1146
 
@@ -1271,14 +1166,11 @@ export class ConversationDetailPage
1271
1166
  // ----------------------------------------------------------
1272
1167
  // DISPLAY CANNED RESPONSES if message.lastIndexOf("/")
1273
1168
  // ----------------------------------------------------------
1274
- if (this.areVisibleCAR) {
1169
+ if (this.areVisibleCAR && this.support_mode === true) {
1275
1170
  setTimeout(() => {
1276
1171
  if (this.conversationWith.startsWith('support-group')) {
1277
1172
  const pos = message.lastIndexOf('/')
1278
- this.logger.log(
1279
- '[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / (using lastIndexOf) ',
1280
- pos,
1281
- )
1173
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / (using lastIndexOf) ', pos)
1282
1174
 
1283
1175
  if (pos === -1) {
1284
1176
  this.tagsCannedFilter = []
@@ -1298,10 +1190,7 @@ export class ConversationDetailPage
1298
1190
 
1299
1191
  if (pos >= 0) {
1300
1192
  var strSearch = message.substr(pos + 1)
1301
- this.logger.log(
1302
- '[CONVS-DETAIL] - returnChangeTextArea - canned responses strSearch ',
1303
- strSearch,
1304
- )
1193
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea - canned responses strSearch ', strSearch)
1305
1194
 
1306
1195
  // --------------------------------------------
1307
1196
  // Load canned responses
@@ -1321,15 +1210,11 @@ export class ConversationDetailPage
1321
1210
  after_slash.length === 1 &&
1322
1211
  after_slash.trim() === ''
1323
1212
  ) {
1324
- this.logger.log(
1325
- '[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ',
1326
- )
1213
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is a white space after ')
1327
1214
  this.HIDE_CANNED_RESPONSES = true
1328
1215
  this.tagsCannedFilter = []
1329
1216
  } else if (pos === 0 && after_slash.length === 0) {
1330
- this.logger.log(
1331
- '[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after',
1332
- )
1217
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea after_slash --> there is NOT a white space after')
1333
1218
  this.HIDE_CANNED_RESPONSES = false
1334
1219
  }
1335
1220
 
@@ -1341,29 +1226,14 @@ export class ConversationDetailPage
1341
1226
 
1342
1227
  let beforeSlash = message.substr(pos - 1)
1343
1228
  let afterSlash = message.substr(pos + 1)
1344
- this.logger.log(
1345
- '[CONVS-DETAIL] - returnChangeTextArea * POS ',
1346
- pos,
1347
- )
1348
-
1349
- this.logger.log(
1350
- '[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash',
1351
- beforeSlash,
1352
- )
1353
- this.logger.log(
1354
- '[CONVS-DETAIL] - returnChangeTextArea --> afterSlash',
1355
- afterSlash,
1356
- )
1229
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea * POS ', pos)
1230
+
1231
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
1232
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
1357
1233
  var afterSlashParts = afterSlash.split('/')
1358
1234
  var beforeSlashParts = beforeSlash.split('/')
1359
- this.logger.log(
1360
- '[CONVS-DETAIL] - returnChangeTextArea --> afterSlash parts',
1361
- afterSlashParts,
1362
- )
1363
- this.logger.log(
1364
- '[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts',
1365
- beforeSlashParts,
1366
- )
1235
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash parts', afterSlashParts)
1236
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts', beforeSlashParts)
1367
1237
 
1368
1238
  if (beforeSlashParts.length === 2) {
1369
1239
  if (
@@ -1381,16 +1251,12 @@ export class ConversationDetailPage
1381
1251
  ) {
1382
1252
  this.HIDE_CANNED_RESPONSES = true
1383
1253
  this.tagsCannedFilter = []
1384
- this.logger.log(
1385
- '[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not',
1386
- )
1254
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not')
1387
1255
  } else if (
1388
1256
  beforeSlashParts[0].indexOf(' ') >= 0 &&
1389
1257
  afterSlashParts[0] === ' '
1390
1258
  ) {
1391
- this.logger.log(
1392
- '[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES',
1393
- )
1259
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES')
1394
1260
  this.HIDE_CANNED_RESPONSES = true
1395
1261
  this.tagsCannedFilter = []
1396
1262
  }
@@ -1413,14 +1279,8 @@ export class ConversationDetailPage
1413
1279
  // ----------------------------------------------------------
1414
1280
  loadTagsCanned(strSearch, conversationWith) {
1415
1281
  this.logger.log('[CONVS-DETAIL] - loadTagsCanned strSearch ', strSearch)
1416
- this.logger.log(
1417
- '[CONVS-DETAIL] - loadTagsCanned groupDetail ',
1418
- this.groupDetail,
1419
- )
1420
- this.logger.log(
1421
- '[CONVS-DETAIL] - loadTagsCanned conversationWith ',
1422
- conversationWith,
1423
- )
1282
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned groupDetail ', this.groupDetail)
1283
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned conversationWith ', conversationWith)
1424
1284
 
1425
1285
  const conversationWith_segments = conversationWith.split('-')
1426
1286
  // Removes the last element of the array if is = to the separator
@@ -1434,19 +1294,13 @@ export class ConversationDetailPage
1434
1294
  const lastArrayElement =
1435
1295
  conversationWith_segments[conversationWith_segments.length - 1]
1436
1296
  this.logger.log('[CONVS-DETAIL] - lastArrayElement ', lastArrayElement)
1437
- this.logger.log(
1438
- '[CONVS-DETAIL] - lastArrayElement length',
1439
- lastArrayElement.length,
1440
- )
1297
+ this.logger.log('[CONVS-DETAIL] - lastArrayElement length', lastArrayElement.length)
1441
1298
  if (lastArrayElement.length !== 32) {
1442
1299
  conversationWith_segments.pop()
1443
1300
  }
1444
1301
  }
1445
1302
 
1446
- this.logger.log(
1447
- '[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ',
1448
- conversationWith_segments,
1449
- )
1303
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ', conversationWith_segments)
1450
1304
  let projectId = ''
1451
1305
 
1452
1306
  if (conversationWith_segments.length === 4) {
@@ -1466,31 +1320,20 @@ export class ConversationDetailPage
1466
1320
  .getProjectIdByConvRecipient(tiledeskToken, conversationWith)
1467
1321
  .subscribe(
1468
1322
  (res) => {
1469
- this.logger.log(
1470
- '[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES',
1471
- res,
1472
- )
1323
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
1473
1324
  if (res) {
1474
1325
  const projectId = res.id_project
1475
- this.logger.log(
1476
- '[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ',
1477
- projectId,
1478
- )
1326
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
1479
1327
  if (projectId) {
1480
1328
  this.getAndShowCannedResponses(strSearch, projectId)
1481
1329
  }
1482
1330
  }
1483
1331
  },
1484
1332
  (error) => {
1485
- this.logger.error(
1486
- '[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ',
1487
- error,
1488
- )
1333
+ this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
1489
1334
  },
1490
1335
  () => {
1491
- this.logger.log(
1492
- '[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',
1493
- )
1336
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
1494
1337
  },
1495
1338
  )
1496
1339
  }
@@ -1507,31 +1350,20 @@ export class ConversationDetailPage
1507
1350
  .getCannedResponses(tiledeskToken, projectId)
1508
1351
  .subscribe(
1509
1352
  (res) => {
1510
- this.logger.log(
1511
- '[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES',
1512
- res,
1513
- )
1353
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res)
1514
1354
 
1515
1355
  this.tagsCanned = res
1516
1356
  this.tagsCannedCount = res.length
1517
- this.logger.log(
1518
- '[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount',
1519
- this.tagsCannedCount,
1520
- )
1357
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
1521
1358
  if (this.HIDE_CANNED_RESPONSES === false) {
1522
1359
  this.showTagsCanned(strSearch)
1523
1360
  }
1524
1361
  },
1525
1362
  (error) => {
1526
- this.logger.error(
1527
- '[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ',
1528
- error,
1529
- )
1363
+ this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
1530
1364
  },
1531
1365
  () => {
1532
- this.logger.log(
1533
- '[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *',
1534
- )
1366
+ this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
1535
1367
  },
1536
1368
  )
1537
1369
  }
@@ -1540,16 +1372,10 @@ export class ConversationDetailPage
1540
1372
  this.logger.log('[CONVS-DETAIL] - showTagsCanned strSearch ', strSearch)
1541
1373
  this.tagsCannedFilter = []
1542
1374
  var tagsCannedClone = JSON.parse(JSON.stringify(this.tagsCanned))
1543
- this.logger.log(
1544
- '[CONVS-DETAIL] - showTagsCanned tagsCannedClone ',
1545
- tagsCannedClone,
1546
- )
1375
+ this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedClone ', tagsCannedClone)
1547
1376
  //this.logger.log("that.contacts lenght:: ", strSearch);
1548
1377
  this.tagsCannedFilter = this.filterItems(tagsCannedClone, strSearch)
1549
- this.logger.log(
1550
- '[CONVS-DETAIL] - showTagsCanned tagsCannedFilter ',
1551
- this.tagsCannedFilter,
1552
- )
1378
+ this.logger.log('[CONVS-DETAIL] - showTagsCanned tagsCannedFilter ', this.tagsCannedFilter)
1553
1379
 
1554
1380
  this.tagsCannedFilter.sort(compareValues('title', 'asc'))
1555
1381
  var strReplace = strSearch
@@ -1557,40 +1383,47 @@ export class ConversationDetailPage
1557
1383
  strReplace = "<b class='highlight-search-string'>" + strSearch + '</b>'
1558
1384
  }
1559
1385
  for (var i = 0; i < this.tagsCannedFilter.length; i++) {
1560
- const textCanned =
1561
- "<div class='cannedText'>" +
1562
- this.replacePlaceholderInCanned(this.tagsCannedFilter[i].text) +
1563
- '</div>'
1564
- this.tagsCannedFilter[i].title =
1565
- "<div class='cannedContent'><div class='cannedTitle'>" +
1566
- this.tagsCannedFilter[i].title
1567
- .toString()
1568
- .replace(strSearch, strReplace.trim()) +
1569
- '</div>' +
1570
- textCanned +
1571
- '</div>'
1386
+ let text = htmlEntities(this.tagsCannedFilter[i].text);
1387
+ // const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(this.tagsCannedFilter[i].text) + '</div>'
1388
+ const textCanned = "<div class='cannedText'>" + this.replacePlaceholderInCanned(text) + '</div>'
1389
+ let title = htmlEntities(this.tagsCannedFilter[i].title)
1390
+ // this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + this.tagsCannedFilter[i].title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
1391
+ this.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>" + title.toString().replace(strSearch, strReplace.trim()) + '</div>' + textCanned + '</div>'
1392
+
1572
1393
  }
1573
1394
  if (this.tagsCannedCount === 0) {
1574
- const nocanned = {
1395
+ // const button = this.renderer.createElement('button');
1396
+ // const buttonText = this.renderer.createText('Click me');
1397
+ // this.renderer.appendChild(button, buttonText);
1398
+ // console.log('[CONVS-DETAIL] - this.el.nativeElement ', this.el.nativeElement)
1399
+ // this.renderer.listen(button, 'click', () => { alert('hi'); });
1400
+ // let nocanned = {}
1401
+ // if (this.USER_ROLE !== 'agent') {
1402
+ const nocanned = {
1403
+ // "<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>'
1404
+ // <div class='cannedText no-canned-available-text'>" + this.translationMap.get('AddNewCannedResponse') + '</div>
1575
1405
  title:
1576
- "<div class='cannedContent'><div class='cannedTitle nocannedTitle'>" +
1577
- this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') +
1578
- ".</div><div class='cannedText'>" +
1579
- this.translationMap.get('TO_CREATE_THEM_GO_TO_THE_PROJECT') +
1580
- '</div></div>',
1406
+ "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
1581
1407
  text: 'There are no canned responses available',
1582
1408
  }
1409
+ // } else if (this.USER_ROLE === 'agent') {
1410
+ // nocanned = {
1411
+ // // "<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>'
1412
+ // title:
1413
+ // "<div class='cannedContent'><div class='cannedTitle nocannedTitle #noCannedTitle'>" + this.translationMap.get('THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE') + ".</div></div>",
1414
+ // text: 'There are no canned responses available',
1415
+ // }
1416
+ // }
1583
1417
  this.tagsCannedFilter.push(nocanned)
1584
1418
  }
1585
1419
  }
1586
1420
 
1421
+ toggleSidebar() {
1422
+ // console.log('[CONVS-DETAIL] has clicked test')
1423
+ }
1424
+
1587
1425
  filterItems(items, searchTerm) {
1588
- this.logger.log(
1589
- '[CONVS-DETAIL] filterItems tagsCannedClone ',
1590
- items,
1591
- ' searchTerm: ',
1592
- searchTerm,
1593
- )
1426
+ this.logger.log('[CONVS-DETAIL] filterItems tagsCannedClone ', items, ' searchTerm: ', searchTerm)
1594
1427
  //this.logger.log("filterItems::: ",searchTerm);
1595
1428
  return items.filter((item) => {
1596
1429
  //this.logger.log("filterItems::: ", item.title.toString().toLowerCase());
@@ -1614,46 +1447,69 @@ export class ConversationDetailPage
1614
1447
  }
1615
1448
 
1616
1449
  replaceTagInMessage(canned, event) {
1617
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage event ', event)
1618
- const elTextArea = this.rowTextArea['el']
1619
- const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1450
+ if (this.tagsCannedCount > 0) {
1451
+ // console.log('[CONVS-DETAIL] replaceTagInMessage event ', event)
1452
+ // console.log('[CONVS-DETAIL] replaceTagInMessage canned ', canned)
1453
+ // console.log('[CONVS-DETAIL] replaceTagInMessage canned title', canned.title)
1454
+ // console.log('[CONVS-DETAIL] replaceTagInMessage canned contains nocannedTitle', canned.title.includes('nocannedTitle'))
1455
+
1456
+ const elTextArea = this.rowTextArea['el']
1457
+ const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1620
1458
 
1621
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
1622
- this.logger.log(
1623
- '[CONVS-DETAIL] replaceTagInMessage textArea value',
1624
- textArea.value,
1625
- )
1459
+ // console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
1460
+ // console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
1626
1461
 
1627
- // var lastChar = textArea.value.substr(-1); // Selects the last character
1628
- // if (lastChar === '/') {
1629
- // textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
1630
- // }
1631
- // this.insertAtCursor(this.textArea, textArea.value)
1462
+ // var lastChar = textArea.value.substr(-1); // Selects the last character
1463
+ // if (lastChar === '/') {
1464
+ // textArea.value = textArea.value.substring(0, textArea.value.length() - 1);
1465
+ // }
1466
+ // this.insertAtCursor(this.textArea, textArea.value)
1467
+
1468
+ this.arrowkeyLocation = -1
1469
+ this.tagsCannedFilter = []
1470
+ this.logger.log('[CONVS-DETAIL] replaceTagInMessage canned text ', canned.text)
1471
+
1472
+ // replace text
1473
+ var pos = textArea.value.lastIndexOf('/')
1474
+ var strSearch = textArea.value.substr(pos)
1475
+ this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strSearch)
1476
+
1477
+ var strTEMP = textArea.value.replace(strSearch, canned.text)
1478
+ strTEMP = this.replacePlaceholderInCanned(strTEMP)
1479
+ this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
1480
+ // strTEMP = this.replacePlaceholderInCanned(strTEMP);
1481
+ // textArea.value = '';
1482
+ // that.messageString = strTEMP;
1483
+ textArea.value = strTEMP
1484
+ setTimeout(() => {
1485
+ // textArea.focus();
1486
+ textArea.setFocus()
1487
+ this.resizeTextArea()
1488
+ }, 200)
1489
+ }
1490
+ else {
1491
+ this.logger.log('[CONVS-DETAIL] THERE IS NOT CANNED ', canned.text)
1492
+ }
1493
+ }
1632
1494
 
1633
- this.arrowkeyLocation = -1
1634
- this.tagsCannedFilter = []
1635
- this.logger.log(
1636
- '[CONVS-DETAIL] replaceTagInMessage canned text ',
1637
- canned.text,
1638
- )
1495
+ async presentCreateCannedResponseModal(): Promise<any> {
1496
+ const elTextArea = this.rowTextArea['el']
1497
+ const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1498
+ textArea.value = ''
1499
+
1500
+ // console.log('[CONVS-DETAIL] PRESENT CREATE CANNED RESPONSE MODAL ')
1501
+ const attributes = { conversationWith: this.conversationWith }
1502
+ const modal: HTMLIonModalElement = await this.modalController.create({
1503
+ component: CreateCannedResponsePage,
1504
+ componentProps: attributes,
1505
+ swipeToClose: false,
1506
+ backdropDismiss: false,
1507
+ })
1508
+ modal.onDidDismiss().then((dataReturned: any) => {
1509
+ this.logger.log('[CONVS-DETAIL] ', dataReturned.data)
1510
+ })
1639
1511
 
1640
- // replace text
1641
- var pos = textArea.value.lastIndexOf('/')
1642
- var strSearch = textArea.value.substr(pos)
1643
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strSearch)
1644
-
1645
- var strTEMP = textArea.value.replace(strSearch, canned.text)
1646
- strTEMP = this.replacePlaceholderInCanned(strTEMP)
1647
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
1648
- // strTEMP = this.replacePlaceholderInCanned(strTEMP);
1649
- // textArea.value = '';
1650
- // that.messageString = strTEMP;
1651
- textArea.value = strTEMP
1652
- setTimeout(() => {
1653
- // textArea.focus();
1654
- textArea.setFocus()
1655
- this.resizeTextArea()
1656
- }, 200)
1512
+ return await modal.present()
1657
1513
  }
1658
1514
 
1659
1515
  hasClickedOpenCannedResponses($event) {
@@ -1661,10 +1517,7 @@ export class ConversationDetailPage
1661
1517
  const elTextArea = this.rowTextArea['el']
1662
1518
  const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1663
1519
 
1664
- this.logger.log(
1665
- '[CONVS-DETAIL] hasClickedOpenCannedResponses textArea ',
1666
- textArea,
1667
- )
1520
+ this.logger.log('[CONVS-DETAIL] hasClickedOpenCannedResponses textArea ', textArea)
1668
1521
  // console.log("[CONVS-DETAIL] hasClickedOpenCannedResponses textArea value", textArea.value)
1669
1522
  var lastChar = textArea.value[textArea.value.length - 1]
1670
1523
  // console.log('[CONVS-DETAIL] hasClickedOpenCannedResponses lastChar', lastChar)
@@ -1820,7 +1673,7 @@ export class ConversationDetailPage
1820
1673
  // this.isMenuShow = event;
1821
1674
  }
1822
1675
 
1823
- returnOnScrollContent(event: boolean) {}
1676
+ returnOnScrollContent(event: boolean) { }
1824
1677
 
1825
1678
  returnOnAttachmentButtonClicked(event: any) {
1826
1679
  this.logger.debug('[CONV-COMP] eventbutton', event)