@chat21/chat21-ionic 3.0.83 → 3.0.86-rc.1

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 (173) hide show
  1. package/CHANGELOG.md +124 -4
  2. package/README.md +2 -2
  3. package/deploy_amazon_beta.sh +29 -0
  4. package/deploy_amazon_prod.sh +30 -0
  5. package/package.json +4 -3
  6. package/src/app/app-routing.module.ts +7 -2
  7. package/src/app/app.component.html +7 -1
  8. package/src/app/app.component.scss +20 -2
  9. package/src/app/app.component.ts +231 -114
  10. package/src/app/app.module.ts +8 -3
  11. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +8 -1
  12. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +86 -23
  13. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +188 -88
  14. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +42 -3
  15. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +11 -24
  16. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +6 -10
  17. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.spec.ts +2 -2
  18. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +16 -26
  19. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +5 -1
  20. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +22 -15
  21. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +25 -5
  22. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +2 -1
  23. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +14 -15
  24. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +24 -5
  25. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +6 -1
  26. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +12 -13
  27. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +26 -5
  28. package/src/app/chatlib/conversation-detail/message/frame/frame.component.html +8 -2
  29. package/src/app/chatlib/conversation-detail/message/frame/frame.component.scss +36 -0
  30. package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +2 -2
  31. package/src/app/chatlib/conversation-detail/message/html/html.component.ts +0 -1
  32. package/src/app/chatlib/conversation-detail/message/image/image.component.html +3 -2
  33. package/src/app/chatlib/conversation-detail/message/image/image.component.scss +17 -5
  34. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +1 -1
  35. package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.scss +3 -2
  36. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +16 -6
  37. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -3
  38. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +2 -0
  39. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +78 -52
  40. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +63 -20
  41. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -10
  42. package/src/app/components/canned-response/canned-response.component.html +9 -9
  43. package/src/app/components/canned-response/canned-response.component.scss +14 -7
  44. package/src/app/components/canned-response/canned-response.component.ts +5 -4
  45. package/src/app/components/contacts-directory/contacts-directory.component.html +22 -26
  46. package/src/app/components/contacts-directory/contacts-directory.component.scss +8 -6
  47. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +64 -47
  48. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +98 -61
  49. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +24 -40
  50. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
  51. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +39 -42
  52. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +67 -4
  53. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +82 -152
  54. package/src/app/components/conversation-info/info-content/info-content.component.html +23 -2
  55. package/src/app/components/conversation-info/info-content/info-content.component.ts +3 -6
  56. package/src/app/components/conversation-info/info-direct/info-direct.component.html +7 -14
  57. package/src/app/components/conversation-info/info-direct/info-direct.component.scss +23 -0
  58. package/src/app/components/conversation-info/info-direct/info-direct.component.ts +1 -6
  59. package/src/app/components/conversation-info/info-group/info-group.component.html +44 -108
  60. package/src/app/components/conversation-info/info-group/info-group.component.scss +101 -61
  61. package/src/app/components/conversation-info/info-group/info-group.component.ts +1 -0
  62. package/src/app/components/conversation-info/info-support-group/info-support-group.component.html +2 -1
  63. package/src/app/components/conversation-info/info-support-group/info-support-group.component.ts +0 -1
  64. package/src/app/components/{ddp-header/ddp-header.component.html → conversations-list/header-conversations-list/header-conversations-list.component.html} +3 -3
  65. package/src/app/components/{ddp-header/ddp-header.component.scss → conversations-list/header-conversations-list/header-conversations-list.component.scss} +16 -4
  66. package/src/app/components/{conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts → conversations-list/header-conversations-list/header-conversations-list.component.spec.ts} +6 -6
  67. package/src/app/components/{ddp-header/ddp-header.component.ts → conversations-list/header-conversations-list/header-conversations-list.component.ts} +7 -16
  68. package/src/app/components/conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.html +12 -0
  69. package/src/app/components/conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.scss +14 -0
  70. package/src/app/components/{conversation-detail/option-header/option-header.component.spec.ts → conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.spec.ts} +5 -5
  71. package/src/app/components/{conversation-detail/option-header/option-header.component.ts → conversations-list/header-conversations-list-archived/header-conversations-list-archived.component.ts} +5 -4
  72. package/src/app/components/navbar/navbar.component.html +103 -0
  73. package/src/app/components/navbar/navbar.component.scss +249 -0
  74. package/src/app/components/{ddp-header/ddp-header.component.spec.ts → navbar/navbar.component.spec.ts} +6 -6
  75. package/src/app/components/navbar/navbar.component.ts +190 -0
  76. package/src/app/components/project-item/project-item.component.html +98 -149
  77. package/src/app/components/project-item/project-item.component.scss +43 -35
  78. package/src/app/components/project-item/project-item.component.ts +16 -4
  79. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +5 -5
  80. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +24 -13
  81. package/src/app/components/utils/user-presence/user-presence.component.html +7 -2
  82. package/src/app/components/utils/user-presence/user-presence.component.scss +35 -18
  83. package/src/app/components/utils/user-presence/user-presence.component.ts +6 -10
  84. package/src/app/{pages → modals}/create-canned-response/create-canned-response-routing.module.ts +0 -0
  85. package/src/app/{pages → modals}/create-canned-response/create-canned-response.module.ts +0 -0
  86. package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.html +0 -0
  87. package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.scss +0 -0
  88. package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.spec.ts +0 -0
  89. package/src/app/{pages → modals}/create-canned-response/create-canned-response.page.ts +13 -13
  90. package/src/app/{pages → modals}/loader-preview/loader-preview-routing.module.ts +0 -0
  91. package/src/app/{pages → modals}/loader-preview/loader-preview.module.ts +0 -0
  92. package/src/app/{pages → modals}/loader-preview/loader-preview.page.html +1 -1
  93. package/src/app/{pages → modals}/loader-preview/loader-preview.page.scss +4 -0
  94. package/src/app/{pages → modals}/loader-preview/loader-preview.page.spec.ts +0 -0
  95. package/src/app/{pages → modals}/loader-preview/loader-preview.page.ts +1 -2
  96. package/src/app/modals/send-email/send-email-routing.module.ts +17 -0
  97. package/src/app/modals/send-email/send-email.module.ts +31 -0
  98. package/src/app/modals/send-email/send-email.page.html +46 -0
  99. package/src/app/modals/send-email/send-email.page.scss +161 -0
  100. package/src/app/modals/send-email/send-email.page.spec.ts +24 -0
  101. package/src/app/modals/send-email/send-email.page.ts +89 -0
  102. package/src/app/pages/contacts-directory/contacts-directory.page.html +1 -1
  103. package/src/app/pages/contacts-directory/contacts-directory.page.scss +47 -0
  104. package/src/app/pages/contacts-directory/contacts-directory.page.ts +2 -0
  105. package/src/app/pages/conversation-detail/conversation-detail.module.ts +0 -8
  106. package/src/app/pages/conversation-detail/conversation-detail.page.html +48 -27
  107. package/src/app/pages/conversation-detail/conversation-detail.page.scss +45 -254
  108. package/src/app/pages/conversation-detail/conversation-detail.page.ts +361 -173
  109. package/src/app/pages/conversations-list/conversations-list.page.html +11 -8
  110. package/src/app/pages/conversations-list/conversations-list.page.scss +18 -2
  111. package/src/app/pages/conversations-list/conversations-list.page.ts +69 -65
  112. package/src/app/pages/profile-info/profile-info.page.html +2 -4
  113. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +1 -1
  114. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +42 -0
  115. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +1 -0
  116. package/src/app/services/canned-responses/canned-responses.service.ts +26 -0
  117. package/src/app/services/projects/projects.service.spec.ts +12 -0
  118. package/src/app/services/projects/projects.service.ts +43 -0
  119. package/src/app/services/tiledesk/tiledesk.service.ts +33 -17
  120. package/src/app/services/websocket/websocket.service.ts +1 -1
  121. package/src/app/shared/shared.module.ts +24 -33
  122. package/src/app/utils/toast.spec.ts +7 -0
  123. package/src/app/utils/toast.ts +48 -0
  124. package/src/assets/i18n/ar.json +288 -265
  125. package/src/assets/i18n/az.json +24 -1
  126. package/src/assets/i18n/de.json +25 -2
  127. package/src/assets/i18n/en.json +25 -2
  128. package/src/assets/i18n/es.json +26 -3
  129. package/src/assets/i18n/fr.json +24 -1
  130. package/src/assets/i18n/it.json +24 -1
  131. package/src/assets/i18n/kk.json +25 -2
  132. package/src/assets/i18n/pt.json +25 -2
  133. package/src/assets/i18n/ru.json +24 -1
  134. package/src/assets/i18n/sr.json +287 -264
  135. package/src/assets/i18n/sv.json +25 -2
  136. package/src/assets/i18n/tr.json +25 -2
  137. package/src/assets/i18n/uk.json +25 -2
  138. package/src/assets/i18n/uz.json +24 -1
  139. package/src/assets/js/chat21client.js +175 -148
  140. package/src/assets/sounds/interface-start.mp3 +0 -0
  141. package/src/assets/sounds/wheep-wheep.mp3 +0 -0
  142. package/src/chat-config-mqtt-localhost.json +2 -2
  143. package/src/chat-config-native-mqtt.json +3 -0
  144. package/src/chat21-core/models/conversation.ts +0 -1
  145. package/src/chat21-core/models/projects.ts +27 -0
  146. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +7 -9
  147. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +7 -8
  148. package/src/chat21-core/utils/constants.ts +7 -1
  149. package/src/chat21-core/utils/convertRequestToConversation.ts +41 -0
  150. package/src/chat21-core/utils/user-typing/user-typing.component.html +8 -5
  151. package/src/chat21-core/utils/user-typing/user-typing.component.scss +87 -17
  152. package/src/chat21-core/utils/user-typing/user-typing.component.ts +12 -94
  153. package/src/chat21-core/utils/utils.ts +41 -11
  154. package/src/global.scss +59 -255
  155. package/src/index.html +0 -9
  156. package/src/variables.scss +30 -10
  157. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +0 -3
  158. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +0 -21
  159. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +0 -24
  160. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +0 -14
  161. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +0 -54
  162. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +0 -98
  163. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +0 -84
  164. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +0 -30
  165. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +0 -83
  166. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +0 -24
  167. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +0 -68
  168. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +0 -3
  169. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +0 -10
  170. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +0 -24
  171. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +0 -14
  172. package/src/app/components/conversation-detail/option-header/option-header.component.html +0 -13
  173. package/src/app/components/conversation-detail/option-header/option-header.component.scss +0 -0
@@ -1,5 +1,5 @@
1
1
  import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
2
- import { TYPE_SUPPORT_GROUP, URL_SOUND_LIST_CONVERSATION } from './../../../chat21-core/utils/constants'
2
+ import { URL_SOUND_LIST_CONVERSATION } from './../../../chat21-core/utils/constants'
3
3
  import {
4
4
  Component,
5
5
  OnInit,
@@ -50,7 +50,7 @@ import { CannedResponsesService } from '../../services/canned-responses/canned-r
50
50
  import { compareValues, getDateDifference, htmlEntities } from '../../../chat21-core/utils/utils'
51
51
  import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
52
52
  import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service'
53
- import { CreateCannedResponsePage } from 'src/app/pages/create-canned-response/create-canned-response.page'
53
+ import { CreateCannedResponsePage } from 'src/app/modals/create-canned-response/create-canned-response.page'
54
54
  // utils
55
55
  import {
56
56
  TYPE_MSG_TEXT,
@@ -111,22 +111,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
111
111
  public groupDetail: GroupModel
112
112
  public messageSelected: any
113
113
  public channelType: string
114
- public online: boolean
114
+ public leadIsOnline: boolean
115
115
  public lastConnectionDate: string
116
116
  public showMessageWelcome: boolean
117
117
  public openInfoConversation = false
118
- public openInfoMessage: boolean // check is open info message
119
118
  public isMobile = false
120
119
  public isLessThan991px = false // nk added
121
- public isTyping = false
122
- public nameUserTypingNow: string
123
120
 
124
121
  public heightMessageTextArea = ''
125
- public translationMap: Map<string, string>
122
+ public translationsMap: Map<string, string> = new Map()
123
+ public translationsHeaderMap: Map<string, string> = new Map()
124
+ public translationsContentMap: Map<string, string> = new Map()
126
125
  public conversationAvatar: any
127
- public membersConversation: any
126
+ public leadInfo: {lead_id: string, hasEmail: boolean , email: string, projectId: string};
128
127
  public member: UserModel
129
- public urlConversationSupportGroup: any
130
128
  public isFileSelected: boolean
131
129
  public showIonContent = false
132
130
  public conv_type: string
@@ -150,7 +148,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
150
148
  //SOUND
151
149
  setTimeoutSound: any;
152
150
  audio: any;
153
- isOpenInfoConversation: boolean;
154
151
  USER_HAS_OPENED_CLOSE_INFO_CONV: boolean = false;
155
152
  isHovering: boolean = false;
156
153
  conversation_count: number;
@@ -172,6 +169,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
172
169
  public disableTextarea: boolean;
173
170
  appsidebarIsWide: boolean;
174
171
 
172
+ // ========== begin:: typying =======
173
+ public isTypings = false;
174
+ public isDirect = false;
175
+ public idUserTypingNow: string;
176
+ public nameUserTypingNow: string;
177
+ private setTimeoutWritingMessages;
178
+ membersConversation = ['SYSTEM'];
179
+ // ========== end:: typying =======
180
+
175
181
  /**
176
182
  * Constructor
177
183
  * @param route
@@ -240,21 +246,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
240
246
  // -----------------------------------------------------------
241
247
  ngOnInit() {
242
248
  this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
243
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
244
- // const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
245
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
246
- // const accept_files_array = accept_files.split(',')
247
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array ', accept_files_array);
248
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
249
-
250
- // accept_files_array.forEach(accept_file => {
251
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file ', accept_file);
252
- // const accept_file_segment = accept_file.split('/')
253
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file_segment ', accept_file_segment);
254
- // if (accept_file_segment[1] === '*') {
255
-
256
- // }
257
- // });
249
+
258
250
  this.getConversations();
259
251
  this.watchToConnectionStatus();
260
252
  this.getOSCODE();
@@ -275,21 +267,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
275
267
  // console.log('[CONVS-DETAIL] HAS CLICKED ENLARGE SIDEBAR WIDE chatAreaEle ', chatAreaEle)
276
268
 
277
269
  if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === true) {
278
- this.logger.log('[CONVS-DETAIL] HERE YES 1')
270
+ this.logger.log('[CONVS-DETAIL] openAppsSidebarWideMode EVENT-> open' )
279
271
  this.appsidebarIsWide = true
280
272
  // chat21InfoConversationEle.classList.add("info-convs-apps-sidebar-wide");
281
273
  // chatAreaEle.classList.add("chat-area-apps-sidebar-wide");
282
274
  }
283
275
 
284
276
  if (event && event.data && event.data.action && event.data.action === 'openAppsSidebarWideMode' && event.data.parameter === false) {
285
- this.logger.log('[CONVS-DETAIL] HERE YES 2')
277
+ this.logger.log('[CONVS-DETAIL] openAppsSidebarWideMode EVENT-> close')
286
278
  this.appsidebarIsWide = false
287
279
  // chat21InfoConversationEle.classList.remove("info-convs-apps-sidebar-wide");
288
280
  // chatAreaEle.classList.remove("chat-area-apps-sidebar-wide");
289
281
  }
290
282
 
291
283
  if (event && event.data && event.data.action && event.data.action === 'closeAppsSidebarWideMode' && event.data.parameter === true) {
292
- this.logger.log('[CONVS-DETAIL] HERE YES 3')
284
+ this.logger.log('[CONVS-DETAIL] closeAppsSidebarWideMode EVENT-> close')
293
285
  this.appsidebarIsWide = false
294
286
  // chat21InfoConversationEle.classList.remove("info-convs-apps-sidebar-wide");
295
287
  // chatAreaEle.classList.remove("chat-area-apps-sidebar-wide");
@@ -339,7 +331,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
339
331
  // this.updateConversationBadge()
340
332
  // }
341
333
  if(conv.uid && conv.uid === this.conversationWith){
342
- this.conversationAvatar = setConversationAvatar(conv.conversation_with,conv.conversation_with_fullname,conv.channel_type)
334
+ this.conversationAvatar = setConversationAvatar(
335
+ conv.conversation_with,
336
+ conv.conversation_with_fullname,
337
+ conv.channel_type,
338
+ null,
339
+ conv.attributes['projectId'],
340
+ conv.attributes['project_name'])
343
341
  }
344
342
 
345
343
  }
@@ -477,6 +475,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
477
475
  this.loggedUser = this.tiledeskAuthService.getCurrentUser()
478
476
  this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
479
477
  this.translations()
478
+ this.setStyleMap()
480
479
  // this.conversationSelected = localStorage.getItem('conversationSelected');
481
480
  this.showButtonToBottom = false
482
481
  this.showMessageWelcome = false
@@ -491,7 +490,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
491
490
 
492
491
  this.messages = [] // list messages of conversation
493
492
  this.isFileSelected = false // indicates if a file has been selected (image to upload)
494
- this.openInfoMessage = false // indicates whether the info message panel is open
495
493
 
496
494
  if (checkPlatformIsMobile()) {
497
495
  this.isMobile = true
@@ -507,19 +505,14 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
507
505
  if (checkWindowWidthIsLessThan991px()) {
508
506
  this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
509
507
  this.openInfoConversation = false // indica se è aperto il box info conversazione
510
- this.isOpenInfoConversation = false
511
- this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
508
+ this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation)
512
509
  } else {
513
510
  this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
514
511
  this.openInfoConversation = true
515
- this.isOpenInfoConversation = true
516
- this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
512
+ this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation)
517
513
  }
518
514
  }
519
515
 
520
- this.online = false
521
- this.lastConnectionDate = ''
522
-
523
516
  // init handler vengono prima delle sottoscrizioni!
524
517
  // this.initConversationsHandler(); // nk
525
518
  if (this.conversationWith) {
@@ -528,10 +521,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
528
521
  this.initConversationHandler()
529
522
  this.initGroupsHandler()
530
523
  this.initSubscriptions()
524
+ this.getLeadDetail()
531
525
  }
532
526
  this.addEventsKeyboard()
533
527
  this.startConversation()
534
528
  this.updateConversationBadge() // AGGIORNO STATO DELLA CONVERSAZIONE A 'LETTA' (is_new = false)
529
+
530
+ this.initializeTyping();
535
531
  }
536
532
 
537
533
  _getProjectIdByConversationWith(conversationWith: string) {
@@ -566,13 +562,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
566
562
  })
567
563
  }
568
564
 
569
- returnOpenCloseInfoConversation(openInfoConversation: boolean) {
570
- this.logger.log('[CONVS-DETAIL] returnOpenCloseInfoConversation - openInfoConversation ', openInfoConversation)
571
- this.resizeTextArea()
572
- this.openInfoMessage = false
573
- this.openInfoConversation = openInfoConversation
574
- this.isOpenInfoConversation = openInfoConversation
575
- this.USER_HAS_OPENED_CLOSE_INFO_CONV = true
565
+ getProjectIdSelectedConversation(conversationWith: string): string{
566
+ const conversationWith_segments = conversationWith.split('-')
567
+ // Removes the last element of the array if is = to the separator
568
+ if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
569
+ conversationWith_segments.pop()
570
+ }
571
+
572
+ this.logger.log('[CONVS-DETAIL] - getProjectIdSelectedConversation conversationWith_segments ', conversationWith_segments)
573
+ let projectId = ''
574
+ if (conversationWith_segments.length === 4) {
575
+ projectId = conversationWith_segments[2]
576
+ this.logger.log('[CONVS-DETAIL] - getProjectIdSelectedConversation projectId ', projectId)
577
+ }
578
+ return projectId
576
579
  }
577
580
 
578
581
  @HostListener('window:resize', ['$event'])
@@ -581,7 +584,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
581
584
  if (newInnerWidth < 991) {
582
585
  if (this.USER_HAS_OPENED_CLOSE_INFO_CONV === false) {
583
586
  this.openInfoConversation = false
584
- this.isOpenInfoConversation = false
585
587
  }
586
588
  }
587
589
  }
@@ -600,7 +602,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
600
602
  'LABEL_TO',
601
603
  'LABEL_LAST_ACCESS',
602
604
  'ARRAY_DAYS',
603
- 'LABEL_IS_WRITING',
605
+
604
606
  'LABEL_INFO_ADVANCED',
605
607
  'ID_CONVERSATION',
606
608
  'UPLOAD_FILE_ERROR',
@@ -619,11 +621,48 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
619
621
  'THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE',
620
622
  'TO_CREATE_THEM_GO_TO_THE_PROJECT',
621
623
  "AddNewCannedResponse",
622
- "LABEL_LOADING"
624
+ "LABEL_LOADING",
625
+ "DIRECT_CHAT",
626
+ "GROUP_CHAT",
627
+
628
+ "LABEL_CHAT",
629
+ "LABEL_EMAIL",
630
+ "EMAIL_PLACEHOLDER",
631
+ "EMAIL_NOT_FOUND_PLACEHOLDER",
632
+ "SUBJECT",
633
+ "MESSAGE",
634
+ "MESSAGE_PLACEHOLDER",
635
+ "LABEL_SEND",
636
+ "SEND_EMAIL_SUCCESS",
637
+ "SEND_EMAIL_ERROR",
638
+ "SUBJECT_OFFLINE_MESSAGE",
639
+ "SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE"
623
640
  ]
624
641
 
625
- this.translationMap = this.customTranslateService.translateLanguage(keys)
626
- this.logger.log('[CONVS-DETAIL] x this.translationMap ',this.translationMap)
642
+ const keysHeader = [
643
+ 'DIRECT_CHAT',
644
+ 'GROUP_CHAT',
645
+ 'LABEL_IS_WRITING',
646
+ 'LABEL_ONLINE',
647
+ 'LABEL_OFFLINE',
648
+ 'LABEL_TODAY',
649
+ 'LABEL_TOMORROW',
650
+ 'LABEL_TO',
651
+ 'LABEL_LAST_ACCESS',
652
+ 'ARRAY_DAYS',
653
+ 'Resolve',
654
+ ]
655
+
656
+ const keysContentDetail = [
657
+ 'LABEL_OPEN_INFO_CONVERSATION',
658
+ 'LABEL_CLOSE_GROUP',
659
+ 'LABEL_IS_WRITING',
660
+ ]
661
+
662
+ this.translationsMap = this.customTranslateService.translateLanguage(keys)
663
+ this.translationsHeaderMap = this.customTranslateService.translateLanguage(keysHeader)
664
+ this.translationsContentMap = this.customTranslateService.translateLanguage(keysContentDetail)
665
+ this.logger.log('[CONVS-DETAIL] x this.translationMap ',this.translationsMap)
627
666
  }
628
667
 
629
668
  // --------------------------------------------------------
@@ -650,6 +689,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
650
689
  return this.customTranslateService.translateLanguage(keys)
651
690
  }
652
691
 
692
+ private setStyleMap(){
693
+ this.styleMap.set('themeColor', 'var(--basic-blue)')
694
+ .set('bubbleReceivedBackground','var(--bck-msg-received)')
695
+ .set('bubbleReceivedTextColor', 'var(--col-msg-received)')
696
+ .set('bubbleSentBackground', 'var(--bck-msg-sent)')
697
+ .set('bubbleSentTextColor', 'var(--col-msg-sent)')
698
+ .set('buttonFontSize','var(--button-in-msg-font-size)')
699
+ .set('buttonBackgroundColor', 'var(--buttonBackgroundColor)')
700
+ .set('buttonTextColor', 'var(--buttonTextColor)')
701
+ .set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
702
+ .set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
703
+
704
+ }
653
705
  // -------------------------------------------------------------------------------------
654
706
  // * retrieving the handler from chatManager
655
707
  // * if it DOESN'T EXIST I create a handler and connect and store it in the chatmanager
@@ -712,12 +764,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
712
764
  }
713
765
 
714
766
  //TODO: servono ???
715
- if (this.loggedUser && this.loggedUser.email) {
716
- attributes.userEmail = this.loggedUser.email
717
- }
718
- if (this.loggedUser && this.loggedUser.fullname) {
719
- attributes.userFullname = this.loggedUser.fullname
720
- }
767
+ // if (this.loggedUser && this.loggedUser.email) {
768
+ // attributes.userEmail = this.loggedUser.email
769
+ // }
770
+ // if (this.loggedUser && this.loggedUser.fullname) {
771
+ // attributes.userFullname = this.loggedUser.fullname
772
+ // }
721
773
 
722
774
  return attributes
723
775
  }
@@ -735,6 +787,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
735
787
  }
736
788
  }
737
789
 
790
+ onConversationLoaded(conversation): ConversationModel{
791
+ if(conversation.attributes && conversation.attributes['projectId']){
792
+ let project = localStorage.getItem(conversation.attributes['projectId'])
793
+ if(project){
794
+ project = JSON.parse(project)
795
+ conversation.attributes.project_name = project['name']
796
+ }
797
+
798
+ }
799
+ return conversation
800
+ }
801
+
738
802
  setHeaderContent() {
739
803
  // this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
740
804
  // this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
@@ -749,7 +813,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
749
813
  conv.conversation_with,
750
814
  conv.conversation_with_fullname,
751
815
  conv.channel_type,
816
+ null,
817
+ conv.attributes['projectId'],
818
+ conv.attributes['project_name']
752
819
  )
820
+
753
821
  }
754
822
  if(!conv){
755
823
  this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conv not exist --> search in archived list', this.conversationWith, this.conv_type)
@@ -762,9 +830,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
762
830
  conv.conversation_with,
763
831
  conv.conversation_with_fullname,
764
832
  conv.channel_type,
833
+ null,
834
+ conv.attributes['projectId'],
835
+ conv.attributes['project_name']
765
836
  )
766
837
  let duration = getDateDifference(conv.timestamp, Date.now())
767
- duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false }
838
+ duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
839
+ }
768
840
  })
769
841
  }
770
842
  this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
@@ -779,9 +851,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
779
851
  conv.conversation_with,
780
852
  conv.conversation_with_fullname,
781
853
  conv.channel_type,
854
+ null,
855
+ conv.attributes['projectId'],
856
+ conv.attributes['project_name']
782
857
  )
783
858
  let duration = getDateDifference(conv.timestamp, Date.now())
784
- duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false }
859
+ duration.days > 10 && conv.channel_type !== TYPE_DIRECT? this.disableTextarea = true: this.disableTextarea = false
860
+ }
785
861
  if(!conv){
786
862
  this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
787
863
  if (conv) {
@@ -790,6 +866,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
790
866
  conv.conversation_with,
791
867
  conv.conversation_with_fullname,
792
868
  conv.channel_type,
869
+ null,
870
+ conv.attributes['projectId'],
871
+ conv.attributes['project_name']
793
872
  )
794
873
  }
795
874
  this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
@@ -807,18 +886,56 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
807
886
  }
808
887
 
809
888
 
889
+ getLeadDetail(){
890
+ const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
891
+ const projectId = this.getProjectIdSelectedConversation(this.conversationWith)
892
+ this.logger.debug('[CONVS-DETAIL] getLeadDetail - section ', projectId)
893
+ this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
894
+ this.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
895
+ if(request.lead && request.lead.email){
896
+ this.leadInfo = {lead_id: request.lead.lead_id, hasEmail: true, email: request.lead.email, projectId: projectId}
897
+ this.presenceService.userIsOnline(this.leadInfo.lead_id);
898
+ }
899
+ }, (error)=>{
900
+ this.logger.error('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL - ERROR ', error)
901
+ }, ()=>{
902
+ this.logger.debug('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL * COMPLETE *')
903
+ })
904
+
905
+ }
906
+
907
+ sendEmail(message: string){
908
+ const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
909
+ const emailFormGroup = {
910
+ to: this.leadInfo.email,
911
+ subject: this.translationsMap.get('SUBJECT_OFFLINE_MESSAGE'),
912
+ text: message,
913
+ request_id: this.conversationWith
914
+ }
915
+ this.tiledeskService.sendEmail(tiledeskToken, this.leadInfo.projectId, emailFormGroup).subscribe((res)=> {
916
+ console.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API response -->', res)
917
+ if(res && res.queued){
918
+ this.presentToast(this.translationsMap.get('SEND_EMAIL_SUCCESS_OFFLINE_MESSAGE'), 'success', '', 2000)
919
+ }
920
+ },(error)=> {
921
+ this.logger.error('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL - ERROR ', error)
922
+ this.presentToast(this.translationsMap.get('SEND_EMAIL_ERROR'), 'danger', '', 2000)
923
+ }, ()=> {
924
+ this.logger.log('[SEND-EMAIL-MODAL] subscribe to sendEmail API CALL /* COMPLETE */')
925
+ })
926
+ }
810
927
 
811
928
  returnSendMessage(e: any) {
812
929
  this.logger.log('[CONVS-DETAIL] - returnSendMessage event', e, ' - conversationWith', this.conversationWith)
813
930
  try {
814
931
  let message = ''
815
- if (e.message) {
816
- message = e.message
932
+ if (e.msg) {
933
+ message = e.msg
817
934
  }
818
935
  const type = e.type
819
936
  const metadata = e.metadata
820
-
821
- this.sendMessage(message, type, metadata)
937
+ const attributes = e.attributes
938
+ this.sendMessage(message, type, metadata, attributes)
822
939
  } catch (err) {
823
940
  this.logger.error('[CONVS-DETAIL] - returnSendMessage error: ', err)
824
941
  }
@@ -885,7 +1002,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
885
1002
  this.channelType,
886
1003
  attributes,
887
1004
  )
888
-
1005
+
1006
+ if(!this.leadIsOnline && this.leadInfo.email){
1007
+ this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
1008
+ this.sendEmail(msg)
1009
+ }
889
1010
  isDevMode()? null : this.segmentNewAgentMessage(this.conversation)
890
1011
  }
891
1012
  }
@@ -899,37 +1020,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
899
1020
  let subscription: any
900
1021
  let subscriptionKey: string
901
1022
 
902
- // subscriptionKey = 'BSConversationsChanged'
903
- // subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
904
- // if (!subscription) {
905
- // subscription = this.conversationsHandlerService.conversationChanged.subscribe((data: ConversationModel) => {
906
- // this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid)
907
-
908
- // if (data && data.sender !== this.loggedUser.uid) {
909
- // this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
910
- // this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
911
- // this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
912
- // this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
913
- // // UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
914
- // // AND IF THE POSITION OF THE SCROLL IS AT THE END
915
- // if (!this.showButtonToBottom && data.is_new) {
916
- // // ARE AT THE END
917
- // this.updateConversationBadge()
918
- // }
919
- // if(data.uid === this.conversationWith){
920
- // this.conversationAvatar = setConversationAvatar(
921
- // data.conversation_with,
922
- // data.conversation_with_fullname,
923
- // data.channel_type,
924
- // )
925
- // }
926
-
927
- // }
928
- // })
929
- // const subscribe = { key: subscriptionKey, value: subscription }
930
- // this.subscriptions.push(subscribe)
931
- // }
932
-
933
1023
  subscriptionKey = 'messageAdded'
934
1024
  subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
935
1025
  if (!subscription) {
@@ -979,6 +1069,39 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
979
1069
  this.subscriptions.push(subscribe)
980
1070
  }
981
1071
 
1072
+ subscriptionKey = 'conversationTyping';
1073
+ subscription = this.subscriptions.find(item => item.key === subscriptionKey);
1074
+ if (!subscription) {
1075
+ subscription = this.typingService.BSIsTyping.pipe(takeUntil(this.unsubscribe$)).subscribe((data: any) => {
1076
+ this.logger.debug('[CONVS-DETAIL] ***** BSIsTyping *****', data);
1077
+ if (data) {
1078
+ const isTypingUid = data.uid; //support-group-...
1079
+ if (this.conversationWith === isTypingUid) {
1080
+ that.subscribeTypings(data);
1081
+ }
1082
+ }
1083
+ });
1084
+ const subscribe = {key: subscriptionKey, value: subscription };
1085
+ this.subscriptions.push(subscribe);
1086
+ }
1087
+
1088
+ subscriptionKey = 'BSIsOnline';
1089
+ subscription = this.subscriptions.find(item => item.key === subscriptionKey);
1090
+ if (!subscription) {
1091
+ subscription = this.presenceService.BSIsOnline.subscribe((data: any) => {
1092
+ this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
1093
+ if (data) {
1094
+ const userId = data.uid;
1095
+ const isOnline = data.isOnline;
1096
+ if (this.leadInfo && this.leadInfo.lead_id === userId) {
1097
+ this.leadIsOnline = isOnline;
1098
+ }
1099
+ }
1100
+ });
1101
+ const subscribe = { key: subscriptionKey, value: subscription };
1102
+ this.subscriptions.push(subscribe);
1103
+ }
1104
+
982
1105
  // subscriptionKey = 'onGroupChange';
983
1106
  // subscription = this.subscriptions.find(item => item.key === subscriptionKey);
984
1107
  // if (!subscription) {
@@ -999,18 +1122,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
999
1122
  // }
1000
1123
  }
1001
1124
 
1002
- onConversationLoaded(conversation): ConversationModel{
1003
- if(conversation.attributes && conversation.attributes['projectId']){
1004
- let project = localStorage.getItem(conversation.attributes['projectId'])
1005
- if(project){
1006
- project = JSON.parse(project)
1007
- conversation.attributes.project_name = project['name']
1008
- }
1009
- }
1010
- return conversation
1011
- }
1012
-
1013
-
1014
1125
  // -------------------------------------------------
1015
1126
  // addEventsKeyboard
1016
1127
  // -------------------------------------------------
@@ -1038,13 +1149,25 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1038
1149
  this.conversationAvatar = setConversationAvatar(
1039
1150
  this.conversationWith,
1040
1151
  this.conversationWithFullname,
1041
- this.channelType
1152
+ this.channelType,
1153
+ null,
1154
+ this.conversation.attributes['projectId'],
1155
+ this.conversation.attributes['project_name']
1042
1156
  )
1043
-
1044
1157
  }
1045
1158
  if (msg.attributes && msg.attributes['updateUserEmail']) {
1046
1159
  const userEmail = msg.attributes['updateUserEmail'];
1047
1160
  this.logger.debug('[CONVS-DETAIL] newMessageAdded --> userEmail', userEmail)
1161
+ this.conversationAvatar = setConversationAvatar(
1162
+ this.conversationWith,
1163
+ this.conversationWithFullname,
1164
+ this.channelType,
1165
+ userEmail,
1166
+ this.conversation.attributes['projectId'],
1167
+ this.conversation.attributes['project_name']
1168
+ )
1169
+ this.getLeadDetail()
1170
+
1048
1171
  }
1049
1172
  }
1050
1173
 
@@ -1128,6 +1251,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1128
1251
  }
1129
1252
 
1130
1253
  this.heightMessageTextArea = height.toString() //e.target.scrollHeight + 20;
1254
+ this.scrollBottom(0)
1131
1255
  const message = e.msg
1132
1256
  this.logger.log('[CONVS-DETAIL] returnChangeTextArea heightMessageTextArea ', this.heightMessageTextArea)
1133
1257
 
@@ -1215,7 +1339,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1215
1339
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash', beforeSlash)
1216
1340
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> afterSlash', afterSlash)
1217
1341
 
1218
-
1219
1342
  if(beforeSlash[beforeSlash.length-1].indexOf(' ') >= 0 && afterSlash === ''){
1220
1343
  this.HIDE_CANNED_RESPONSES = false
1221
1344
  } else if(beforeSlash[beforeSlash.length-1].indexOf(' ') < 0 && afterSlash === '' ){
@@ -1263,7 +1386,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1263
1386
 
1264
1387
  replaceTagInMessage(canned, event?) {
1265
1388
  const elTextArea = this.rowTextArea['el']
1266
- const textArea = elTextArea.getElementsByTagName('ion-textarea')[0]
1389
+ const textArea = elTextArea.getElementsByTagName('ion-textarea')[0] as HTMLInputElement;
1267
1390
  // console.log('[CONVS-DETAIL] replaceTagInMessage textArea ', textArea)
1268
1391
  // console.log('[CONVS-DETAIL] replaceTagInMessage textArea value', textArea.value,)
1269
1392
 
@@ -1278,20 +1401,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1278
1401
  // replace text
1279
1402
  var strTEMP = textArea.value.replace(/\/.*/ig, canned.text)
1280
1403
  strTEMP = this.replacePlaceholderInCanned(strTEMP)
1281
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch before', strTEMP, textArea)
1404
+ this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch ', strTEMP)
1282
1405
  // strTEMP = this.replacePlaceholderInCanned(strTEMP);
1283
1406
  // textArea.value = '';
1284
1407
  // that.messageString = strTEMP;
1285
1408
  textArea.value = strTEMP
1286
- this.logger.log('[CONVS-DETAIL] replaceTagInMessage strSearch after', strTEMP, textArea)
1287
1409
  this.insertAtCursor(textArea, '')
1288
1410
  this.setCaretPosition(textArea)
1289
1411
  // setTimeout(() => {
1290
1412
  // // textArea.focus();
1291
- // textArea.selectionEnd = textArea.value.length;
1292
1413
  // textArea.setFocus()
1293
1414
  // // this.resizeTextArea()
1294
- // // this.setCaretPosition(textArea)
1295
1415
  // }, 200)
1296
1416
 
1297
1417
  }
@@ -1335,7 +1455,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1335
1455
  if(elTextArea){
1336
1456
  // console.log("[CONVS-DETAIL] onClickOpenCannedResponses textArea value", textArea.value)
1337
1457
  var lastChar = textArea.value[textArea.value.length - 1]
1338
- this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar --- textArea ', lastChar, textArea)
1458
+ this.logger.log('[CONVS-DETAIL] onClickOpenCannedResponses lastChar --- textArea ', lastChar, textArea)
1339
1459
  if (lastChar !== '/') {
1340
1460
  this.insertAtCursor(textArea, '/')
1341
1461
  }
@@ -1515,6 +1635,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1515
1635
  }
1516
1636
  }
1517
1637
 
1638
+ onOpenCloseInfoConversation(event){
1639
+ this.logger.debug('[CONVS-DETAIL] onOpenCloseInfoConversation - openInfoConversation ', event)
1640
+ this.resizeTextArea()
1641
+ this.openInfoConversation = event
1642
+ this.USER_HAS_OPENED_CLOSE_INFO_CONV = true
1643
+ }
1644
+
1645
+ onOpenFooterSection(event: string){
1646
+ this.logger.debug('[CONVS-DETAIL] onOpenFooterSection - section ', event)
1647
+ if(event === 'email'){
1648
+ this.getLeadDetail()
1649
+ }
1650
+ }
1651
+
1518
1652
  // -------------- START SCROLL/RESIZE -------------- //
1519
1653
  /** */
1520
1654
  resizeTextArea() {
@@ -1616,6 +1750,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1616
1750
  this.heightMessageTextArea = '57' // NK edited
1617
1751
  }
1618
1752
  }
1753
+
1619
1754
  checkAcceptedFile(draggedFileMimeType) {
1620
1755
  let isAcceptFile = false
1621
1756
  this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ',this.appConfigProvider.getConfig().fileUploadAccept)
@@ -1637,26 +1772,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1637
1772
  if (accept_file_segment[1] === '*') {
1638
1773
  if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
1639
1774
  isAcceptFile = true
1640
- this.logger.log(
1641
- '[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
1642
- isAcceptFile,
1643
- )
1775
+ this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
1644
1776
  return isAcceptFile
1645
1777
  } else {
1646
1778
  isAcceptFile = false
1647
- this.logger.log(
1648
- '[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
1649
- isAcceptFile,
1650
- )
1779
+ this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
1651
1780
  return isAcceptFile
1652
1781
  }
1653
1782
  } else if (accept_file_segment[1] !== '*') {
1654
1783
  if (draggedFileMimeType === accept_file) {
1655
1784
  isAcceptFile = true
1656
- this.logger.log(
1657
- '[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',
1658
- isAcceptFile,
1659
- )
1785
+ this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile',isAcceptFile)
1660
1786
  return isAcceptFile
1661
1787
  }
1662
1788
  }
@@ -1666,53 +1792,113 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1666
1792
  }
1667
1793
  }
1668
1794
 
1669
- segmentNewAgentMessage(conversation: ConversationModel){
1670
- let user = this.loggedUser
1671
- try {
1672
- window['analytics'].page("Chat Conversation Detail Page, Message Sent", {});
1673
- } catch (err) {
1674
- this.logger.error('Event:Message Sent [page] error', err);
1675
- }
1676
1795
 
1677
- try {
1678
- window['analytics'].identify(user.uid, {
1679
- name: user.firstname + ' ' + user.lastname,
1680
- email: user.email,
1681
- logins: 5,
1682
- });
1683
- } catch (err) {
1684
- this.logger.error('Event:Message Sent [identify] error', err);
1796
+ initializeTyping() {
1797
+ this.logger.debug('[CONVS-DETAIL] membersconversation', this.membersConversation)
1798
+ if(this.loggedUser){
1799
+ this.membersConversation.push(this.loggedUser.uid)
1800
+ //this.setSubscriptions();
1801
+ this.typingService.isTyping(this.conversationWith, this.loggedUser.uid, this.isDirect);
1685
1802
  }
1803
+ }
1686
1804
 
1805
+ /** */
1806
+ subscribeTypings(data: any) {
1807
+ const that = this;
1687
1808
  try {
1688
- window['analytics'].track('Message Sent', {
1689
- "username": user.firstname + ' ' + user.lastname,
1690
- "userId": user.uid,
1691
- "conversation_id": conversation.uid,
1692
- "channel_type": conversation.channel_type,
1693
- "conversation_with": conversation.conversation_with,
1694
- "department_name":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentName: null,
1695
- "department_id":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentId: null,
1696
- },
1697
- {
1698
- "context": {
1699
- "groupId": (conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.projectId: null
1700
- }
1701
- });
1702
- } catch (err) {
1703
- this.logger.error('Event:Message Sent [track] error', err);
1704
- }
1809
+ const key = data.uidUserTypingNow;
1810
+ const waitTime = data.waitTime
1811
+ this.nameUserTypingNow = null;
1812
+ this.idUserTypingNow = null;
1705
1813
 
1706
- try {
1707
- window['analytics'].group(conversation.attributes.projectId, {
1708
- name: (conversation.attributes.project_name)? conversation.attributes.project_name : null,
1709
- // plan: projectProfileName,
1710
- });
1711
- } catch (err) {
1712
- this.logger.error('Event:Message Sent [group] error', err);
1814
+ if (data.nameUserTypingNow) {
1815
+ this.nameUserTypingNow = data.nameUserTypingNow;
1816
+ }
1817
+ if (data.uidUserTypingNow){
1818
+ this.idUserTypingNow = data.uidUserTypingNow
1819
+ }
1820
+ this.logger.debug('[CONV-COMP] subscribeTypings data:', data);
1821
+ const userTyping = this.membersConversation.includes(key);
1822
+ if ( !userTyping && key) {
1823
+ this.isTypings = true;
1824
+ setTimeout(function () {
1825
+ that.scrollBottom(0)
1826
+ }, 0);
1827
+ // clearTimeout(this.setTimeoutWritingMessages);
1828
+ this.setTimeoutWritingMessages = setTimeout(() => {
1829
+ that.isTypings = false;
1830
+ }, waitTime);
1831
+ // this.initiTimeout(waitTime)
1832
+ }
1833
+ } catch (error) {
1834
+ this.logger.error('[CONV-COMP] error: ', error);
1713
1835
  }
1836
+
1837
+ }
1838
+
1839
+ initiTimeout(waitTime){
1840
+ const that = this;
1841
+ this.setTimeoutWritingMessages = setTimeout(() => {
1842
+ that.isTypings = false;
1843
+ }, waitTime);
1844
+ }
1845
+
1846
+ resetTimeout(){
1847
+ this.isTypings = false
1848
+ this.setTimeoutWritingMessages = null;
1849
+ clearTimeout(this.setTimeoutWritingMessages)
1714
1850
  }
1851
+
1852
+
1853
+ segmentNewAgentMessage(conversation: ConversationModel){
1854
+ let user = this.loggedUser
1855
+ if(window['analytics']){
1856
+ try {
1857
+ window['analytics'].page("Chat Conversation Detail Page, Message Sent", {});
1858
+ } catch (err) {
1859
+ this.logger.error('Event:Message Sent [page] error', err);
1860
+ }
1861
+
1862
+ try {
1863
+ window['analytics'].identify(user.uid, {
1864
+ name: user.firstname + ' ' + user.lastname,
1865
+ email: user.email,
1866
+ logins: 5,
1867
+ });
1868
+ } catch (err) {
1869
+ this.logger.error('Event:Message Sent [identify] error', err);
1870
+ }
1715
1871
 
1872
+ try {
1873
+ window['analytics'].track('Message Sent', {
1874
+ "username": user.firstname + ' ' + user.lastname,
1875
+ "userId": user.uid,
1876
+ "conversation_id": conversation.uid,
1877
+ "channel_type": conversation.channel_type,
1878
+ "conversation_with": conversation.conversation_with,
1879
+ "department_name":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentName: null,
1880
+ "department_id":(conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.departmentId: null,
1881
+ },
1882
+ {
1883
+ "context": {
1884
+ "groupId": (conversation.channel_type !== TYPE_DIRECT)? conversation.attributes.projectId: null
1885
+ }
1886
+ });
1887
+ } catch (err) {
1888
+ this.logger.error('Event:Message Sent [track] error', err);
1889
+ }
1890
+
1891
+ try {
1892
+ window['analytics'].group(conversation.attributes.projectId, {
1893
+ name: (conversation.attributes.project_name)? conversation.attributes.project_name : null,
1894
+ // plan: projectProfileName,
1895
+ });
1896
+ } catch (err) {
1897
+ this.logger.error('Event:Message Sent [group] error', err);
1898
+ }
1899
+ }
1900
+ }
1901
+
1716
1902
  // -------------------------------------------------------------
1717
1903
  // DRAG FILE
1718
1904
  // -------------------------------------------------------------
@@ -1742,7 +1928,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1742
1928
  this.handleDropEvent(ev)
1743
1929
  } else {
1744
1930
  this.logger.log( '[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
1745
- this.presentToastOnlyImageFilesAreAllowedToDrag()
1931
+ this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
1932
+ // this.presentToastOnlyImageFilesAreAllowedToDrag()
1746
1933
  }
1747
1934
  }
1748
1935
  }
@@ -1770,14 +1957,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1770
1957
  this.logger.log('[CONVS-DETAIL] ----> FILE - FILE - (dragleave) drag his.isHovering ',this.isHovering)
1771
1958
  }
1772
1959
 
1773
- async presentToastOnlyImageFilesAreAllowedToDrag() {
1960
+ async presentToast(message: string, color: string, cssClass: string, duration: number = 2000, position: 'top' | 'bottom' | 'middle'= 'bottom'){
1774
1961
  const toast = await this.toastController.create({
1775
- message: this.translationMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'),
1776
- duration: 5000,
1777
- color: 'danger',
1778
- cssClass: 'toast-custom-class',
1779
- })
1780
- toast.present()
1962
+ message: message,
1963
+ duration: duration,
1964
+ color: color,
1965
+ position: position,
1966
+ cssClass: cssClass,
1967
+ });
1968
+ toast.present();
1781
1969
  }
1782
1970
  }
1783
1971
  // END ALL //