@chat21/chat21-ionic 3.0.61-rc8 → 3.0.61

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 (89) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +6 -0
  3. package/angular.json +2 -0
  4. package/config.xml +0 -1
  5. package/deploy_pre.sh +1 -1
  6. package/deploy_prod.sh +1 -1
  7. package/env.sample +1 -1
  8. package/package.json +4 -4
  9. package/src/app/app-routing.module.ts +15 -0
  10. package/src/app/app.component.ts +12 -9
  11. package/src/app/app.module.ts +11 -3
  12. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +36 -25
  13. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +160 -50
  14. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +108 -18
  15. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +21 -36
  16. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +19 -7
  17. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +35 -40
  18. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -1
  19. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +13 -10
  20. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -2
  21. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
  22. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +142 -71
  23. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +57 -20
  24. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +32 -9
  25. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +98 -24
  26. package/src/app/components/ddp-header/ddp-header.component.html +9 -2
  27. package/src/app/components/ddp-header/ddp-header.component.ts +93 -18
  28. package/src/app/components/project-item/project-item.component.html +1 -1
  29. package/src/app/components/project-item/project-item.component.scss +1 -1
  30. package/src/app/components/project-item/project-item.component.ts +3 -3
  31. package/src/app/components/sidebar/sidebar.component.html +65 -52
  32. package/src/app/components/sidebar/sidebar.component.scss +23 -0
  33. package/src/app/components/sidebar/sidebar.component.ts +74 -26
  34. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +20 -9
  35. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +20 -3
  36. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +24 -8
  37. package/src/app/pages/conversation-detail/conversation-detail.module.ts +5 -1
  38. package/src/app/pages/conversation-detail/conversation-detail.page.html +19 -10
  39. package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
  40. package/src/app/pages/conversation-detail/conversation-detail.page.ts +229 -389
  41. package/src/app/pages/conversations-list/conversations-list.page.ts +646 -454
  42. package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
  43. package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
  44. package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
  45. package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
  46. package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
  47. package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
  48. package/src/app/pages/create-requester/create-requester-routing.module.ts +17 -0
  49. package/src/app/pages/create-requester/create-requester.module.ts +28 -0
  50. package/src/app/pages/create-requester/create-requester.page.html +67 -0
  51. package/src/app/pages/create-requester/create-requester.page.scss +30 -0
  52. package/src/app/pages/create-requester/create-requester.page.spec.ts +24 -0
  53. package/src/app/pages/create-requester/create-requester.page.ts +138 -0
  54. package/src/app/pages/create-ticket/create-ticket-routing.module.ts +17 -0
  55. package/src/app/pages/create-ticket/create-ticket.module.ts +28 -0
  56. package/src/app/pages/create-ticket/create-ticket.page.html +171 -0
  57. package/src/app/pages/create-ticket/create-ticket.page.scss +52 -0
  58. package/src/app/pages/create-ticket/create-ticket.page.spec.ts +24 -0
  59. package/src/app/pages/create-ticket/create-ticket.page.ts +432 -0
  60. package/src/app/pages/loader-preview/loader-preview.page.ts +2 -11
  61. package/src/app/pages/profile-info/profile-info.page.html +2 -2
  62. package/src/app/pages/profile-info/profile-info.page.scss +12 -1
  63. package/src/app/services/tiledesk/tiledesk.service.ts +190 -0
  64. package/src/app/shared/shared.module.ts +1 -1
  65. package/src/assets/i18n/de.json +37 -1
  66. package/src/assets/i18n/en.json +37 -1
  67. package/src/assets/i18n/es.json +38 -2
  68. package/src/assets/i18n/fr.json +38 -2
  69. package/src/assets/i18n/it.json +38 -2
  70. package/src/assets/i18n/pt.json +38 -2
  71. package/src/assets/i18n/ru.json +38 -2
  72. package/src/assets/i18n/sr.json +38 -2
  73. package/src/assets/i18n/tr.json +37 -1
  74. package/src/assets/images/default-avatar-x-select.png +0 -0
  75. package/src/assets/images/priority_icons/high.svg +3 -0
  76. package/src/assets/images/priority_icons/high_v2.svg +14 -0
  77. package/src/assets/images/priority_icons/low.svg +10 -0
  78. package/src/assets/images/priority_icons/low_v2.svg +14 -0
  79. package/src/assets/images/priority_icons/medium.svg +16 -0
  80. package/src/assets/images/priority_icons/medium_v2.svg +11 -0
  81. package/src/assets/images/priority_icons/urgent.svg +4 -0
  82. package/src/assets/images/priority_icons/urgent_v2.svg +16 -0
  83. package/src/chat-config-mqtt.json +25 -16
  84. package/src/chat-config-template.json +5 -4
  85. package/src/chat-config.json +1 -0
  86. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +8 -3
  87. package/src/chat21-core/utils/constants.ts +2 -0
  88. package/src/chat21-core/utils/utils-message.ts +19 -0
  89. package/src/global.scss +33 -9
@@ -1,43 +1,49 @@
1
- import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
2
- import { Component, OnInit, ViewChild } from '@angular/core';
3
- import { IonContent, ModalController } from '@ionic/angular';
4
- import { ActivatedRoute, Router, NavigationExtras } from '@angular/router';
1
+ import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service'
2
+ import { Component, OnInit, ViewChild } from '@angular/core'
3
+ import { IonContent, ModalController } from '@ionic/angular'
4
+ import { ActivatedRoute, Router, NavigationExtras } from '@angular/router'
5
5
  // config
6
- import { environment } from '../../../environments/environment';
6
+ import { environment } from '../../../environments/environment'
7
7
 
8
8
  // models
9
- import { ConversationModel } from 'src/chat21-core/models/conversation';
10
- import { UserModel } from 'src/chat21-core/models/user';
9
+ import { ConversationModel } from 'src/chat21-core/models/conversation'
10
+ import { UserModel } from 'src/chat21-core/models/user'
11
11
 
12
12
  // utils
13
- import { isInArray, checkPlatformIsMobile, presentModal, closeModal, convertMessage, isGroup, } from '../../../chat21-core/utils/utils';
14
-
15
- import { EventsService } from '../../services/events-service';
16
- import PerfectScrollbar from 'perfect-scrollbar'; // https://github.com/mdbootstrap/perfect-scrollbar
13
+ import {
14
+ isInArray,
15
+ checkPlatformIsMobile,
16
+ presentModal,
17
+ closeModal,
18
+ convertMessage,
19
+ isGroup,
20
+ } from '../../../chat21-core/utils/utils'
21
+
22
+ import { EventsService } from '../../services/events-service'
23
+ import PerfectScrollbar from 'perfect-scrollbar' // https://github.com/mdbootstrap/perfect-scrollbar
17
24
 
18
25
  // services
19
- import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service';
20
- import { ChatManager } from 'src/chat21-core/providers/chat-manager';
21
- import { NavProxyService } from '../../services/nav-proxy.service';
22
- import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
23
- import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page';
24
- import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page';
25
- import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page';
26
- import { ProfileInfoPage } from '../profile-info/profile-info.page';
27
- import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
28
- import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
29
- import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
30
- import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
31
- import { AppConfigProvider } from '../../services/app-config';
32
- import { Subscription } from 'rxjs';
33
- import { Platform } from '@ionic/angular';
26
+ import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service'
27
+ import { ChatManager } from 'src/chat21-core/providers/chat-manager'
28
+ import { NavProxyService } from '../../services/nav-proxy.service'
29
+ import { TiledeskService } from '../../services/tiledesk/tiledesk.service'
30
+ import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page'
31
+ import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page'
32
+ import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page'
33
+ import { ProfileInfoPage } from '../profile-info/profile-info.page'
34
+ import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service'
35
+ import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service'
36
+ import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
37
+ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service'
38
+ import { AppConfigProvider } from '../../services/app-config'
39
+ import { Subscription } from 'rxjs'
40
+ import { Platform } from '@ionic/angular'
34
41
  // Logger
35
- import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
36
- import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
37
- import { NetworkService } from 'src/app/services/network-service/network.service';
38
- import { Subject } from 'rxjs';
39
- import { takeUntil } from 'rxjs/operators';
40
-
42
+ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service'
43
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
44
+ import { NetworkService } from 'src/app/services/network-service/network.service'
45
+ import { Subject } from 'rxjs'
46
+ import { takeUntil } from 'rxjs/operators'
41
47
 
42
48
  @Component({
43
49
  selector: 'app-conversations-list',
@@ -45,54 +51,54 @@ import { takeUntil } from 'rxjs/operators';
45
51
  styleUrls: ['./conversations-list.page.scss'],
46
52
  })
47
53
  export class ConversationListPage implements OnInit {
48
-
49
- @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
50
-
51
- private unsubscribe$: Subject<any> = new Subject<any>();
52
- private subscriptions: Array<string>;
53
- public tenant: string;
54
- public loggedUserUid: string;
55
- public conversations: Array<ConversationModel> = [];
56
- public archivedConversations: Array<ConversationModel> = [];
57
- public uidConvSelected: string;
58
- public conversationSelected: ConversationModel;
59
- public uidReciverFromUrl: string;
60
- public showPlaceholder = true;
61
- public numberOpenConv = 0;
62
- public loadingIsActive = true;
63
- public supportMode: boolean;
64
- public writeto_btn: boolean;
65
- public archived_btn: boolean;
66
- public convertMessage = convertMessage;
67
- private isShowMenuPage = false;
68
- private logger: LoggerService = LoggerInstance.getInstance();
69
- translationMapConversation: Map<string, string>;
70
- stylesMap: Map<string, string>;
54
+ @ViewChild('ioncontentconvlist', { static: false })
55
+ ionContentConvList: IonContent
56
+
57
+ private unsubscribe$: Subject<any> = new Subject<any>()
58
+ private subscriptions: Array<string>
59
+ public tenant: string
60
+ public loggedUserUid: string
61
+ public conversations: Array<ConversationModel> = []
62
+ public archivedConversations: Array<ConversationModel> = []
63
+ public uidConvSelected: string
64
+ public conversationSelected: ConversationModel
65
+ public uidReciverFromUrl: string
66
+ public showPlaceholder = true
67
+ public numberOpenConv = 0
68
+ public loadingIsActive = true
69
+ public supportMode: boolean
70
+ public writeto_btn: boolean
71
+ public archived_btn: boolean
72
+ public convertMessage = convertMessage
73
+ private isShowMenuPage = false
74
+ private logger: LoggerService = LoggerInstance.getInstance()
75
+ translationMapConversation: Map<string, string>
76
+ stylesMap: Map<string, string>
71
77
 
72
78
  public conversationType = 'active'
73
- headerTitle: string;
74
- subscription: Subscription;
79
+ headerTitle: string
80
+ subscription: Subscription
75
81
 
76
- public UNASSIGNED_CONVS_URL: any;
77
- public PROJECTS_FOR_PANEL_URL: any;
78
- public IFRAME_URL: any;
79
- public hasClickedOpenUnservedConvIframe: boolean = false;
80
- public lastProjectId: string;
81
- public isOnline: boolean = true;
82
- public checkInternet: boolean;
82
+ public UNASSIGNED_CONVS_URL: any
83
+ public PROJECTS_FOR_PANEL_URL: any
84
+ public IFRAME_URL: any
85
+ public hasClickedOpenUnservedConvIframe: boolean = false
86
+ public lastProjectId: string
87
+ public isOnline: boolean = true
88
+ public checkInternet: boolean
83
89
 
84
- public displayNewConvsItem: boolean = true;
85
- public archiveActionNotAllowed: boolean = false;
90
+ public displayNewConvsItem: boolean = true
91
+ public archiveActionNotAllowed: boolean = false
86
92
 
87
93
  tooltipOptions = {
88
94
  'show-delay': 1500,
89
95
  'tooltip-class': 'chat-tooltip',
90
- 'theme': 'light',
91
- 'shadow': false,
96
+ theme: 'light',
97
+ shadow: false,
92
98
  'hide-delay-mobile': 0,
93
- 'hideDelayAfterClick': 3000,
94
- 'hide-delay': 200
95
- };
99
+ hideDelayAfterClick: 3000,
100
+ 'hide-delay': 200,
101
+ }
96
102
 
97
103
  constructor(
98
104
  private router: Router,
@@ -111,43 +117,51 @@ export class ConversationListPage implements OnInit {
111
117
  public tiledeskAuthService: TiledeskAuthService,
112
118
  public appConfigProvider: AppConfigProvider,
113
119
  public platform: Platform,
114
- private networkService: NetworkService
120
+ private networkService: NetworkService,
115
121
  ) {
116
- this.listenToAppCompConvsLengthOnInitConvs();
117
- this.listenToLogoutEvent();
118
- this.listenGoOnline();
119
- this.listenGoOffline();
120
- this.listenToSwPostMessage();
121
- this.listenSupportConvIdHasChanged();
122
+ this.listenToAppCompConvsLengthOnInitConvs()
123
+ this.listenToLogoutEvent()
124
+ this.listenGoOnline()
125
+ this.listenGoOffline()
126
+ this.listenToSwPostMessage()
127
+ this.listenSupportConvIdHasChanged()
122
128
  // this.listenDirectConvIdHasChanged();
123
- this.listenToCloseConvFromHeaderConversation();
124
-
129
+ this.listenToCloseConvFromHeaderConversation()
125
130
  }
126
131
 
127
-
128
-
129
132
  listenSupportConvIdHasChanged() {
130
133
  this.events.subscribe('supportconvid:haschanged', (IDConv) => {
131
134
  // console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', IDConv);
132
135
  if (IDConv) {
133
136
  // const conversationSelected = this.conversations.find(item => item.uid === convId);
134
137
  // this.onConversationSelected(conversationSelected)
135
- this.setUidConvSelected(IDConv, 'active');
138
+ this.setUidConvSelected(IDConv, 'active')
136
139
  }
137
140
  if (!IDConv) {
138
- this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select');
141
+ this.logger.log(
142
+ '[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select',
143
+ )
139
144
 
140
145
  const chatTabCount = +localStorage.getItem('tabCount')
141
- this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ', chatTabCount);
146
+ this.logger.log(
147
+ '[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ',
148
+ chatTabCount,
149
+ )
142
150
  if (chatTabCount && chatTabCount > 0) {
143
- this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ', chatTabCount);
151
+ this.logger.log(
152
+ '[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ',
153
+ chatTabCount,
154
+ )
144
155
  if (checkPlatformIsMobile()) {
145
- this.logger.log('[CONVS-LIST-PAGE] - the chat is in mobile mode ', checkPlatformIsMobile());
146
- this.events.publish('noparams:mobile', true);
156
+ this.logger.log(
157
+ '[CONVS-LIST-PAGE] - the chat is in mobile mode ',
158
+ checkPlatformIsMobile(),
159
+ )
160
+ this.events.publish('noparams:mobile', true)
147
161
  }
148
162
  }
149
163
  }
150
- });
164
+ })
151
165
  }
152
166
 
153
167
  // listenDirectConvIdHasChanged() {
@@ -159,13 +173,12 @@ export class ConversationListPage implements OnInit {
159
173
  // });
160
174
  // }
161
175
 
162
-
163
176
  // -----------------------------------------------
164
177
  // @ Lifehooks
165
178
  // -----------------------------------------------
166
179
  ngOnInit() {
167
- this.watchToConnectionStatus();
168
- this.getAppConfigToHideDiplayBtns();
180
+ this.watchToConnectionStatus()
181
+ this.getAppConfigToHideDiplayBtns()
169
182
 
170
183
  // const currentUrl = this.router.url;
171
184
  // this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
@@ -213,80 +226,105 @@ export class ConversationListPage implements OnInit {
213
226
  }
214
227
 
215
228
  getConversationListHeight() {
216
- var scrollbar2element = document.getElementById('scrollbar2');
229
+ var scrollbar2element = document.getElementById('scrollbar2')
217
230
  this.logger.log('[CONVS-LIST-PAGE] getConversationListHeight scrollbar2element', scrollbar2element)
218
231
  }
219
232
 
233
+ // this.support_mode = null
234
+ // if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
235
+ // this.support_mode = true
236
+ // } else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
237
+ // this.support_mode = false
238
+ // } else if ( !this.appConfigProvider.getConfig().supportMode ) {
239
+ // this.support_mode = false
240
+ // }
220
241
 
221
242
  getAppConfigToHideDiplayBtns() {
222
- const appConfig = this.appConfigProvider.getConfig();
223
- // console.log('[ION-LIST-CONVS-COMP] - appConfig ', appConfig)
224
- if (appConfig && appConfig.supportMode) {
225
- this.supportMode = appConfig.supportMode;
226
- } else {
227
- this.supportMode = false;
243
+ const appConfig = this.appConfigProvider.getConfig()
244
+ // console.log('[CONVS-LIST-PAGE] - appConfig ', appConfig)
245
+ this.supportMode = null
246
+ if (appConfig && appConfig.supportMode === true || appConfig.supportMode === 'true') {
247
+ this.supportMode = true;
248
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns supportMode ', this.supportMode)
249
+ } else if (appConfig && appConfig.supportMode === false || appConfig.supportMode === 'false') {
250
+ this.supportMode = false
251
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns supportMode ', this.supportMode)
228
252
  }
229
- if (appConfig && appConfig.archivedButton) {
230
- this.archived_btn = appConfig.archivedButton;
231
- } else {
253
+ this.archived_btn = null
254
+ if (appConfig && appConfig.archivedButton === true || appConfig.archivedButton === 'true') {
255
+ this.archived_btn = true;
256
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns archived_btn ', this.archived_btn)
257
+ } else if (appConfig && appConfig.archivedButton === false || appConfig.archivedButton === 'false') {
232
258
  this.archived_btn = false;
259
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns archived_btn ', this.archived_btn)
233
260
  }
234
- if (appConfig && appConfig.writeToButton) {
235
- this.writeto_btn = appConfig.writeToButton;
236
- } else {
261
+ this.writeto_btn = null
262
+ if (appConfig && appConfig.writeToButton === true || appConfig.writeToButton === 'true') {
263
+ this.writeto_btn = true;
264
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
265
+ } else if (appConfig && appConfig.writeToButton === false || appConfig.writeToButton === 'false') {
237
266
  this.writeto_btn = false;
267
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
238
268
  }
239
269
  // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
240
270
  }
241
271
 
242
272
  watchToConnectionStatus() {
243
- this.networkService.checkInternetFunc().subscribe(isOnline => {
273
+ this.networkService.checkInternetFunc().subscribe((isOnline) => {
244
274
  this.checkInternet = isOnline
245
275
  this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
246
276
 
247
277
  // checking internet connection
248
278
  if (this.checkInternet == true) {
249
-
250
- this.isOnline = true;
279
+ this.isOnline = true
251
280
  } else {
252
- this.isOnline = false;
281
+ this.isOnline = false
253
282
  }
254
- });
283
+ })
255
284
  }
256
285
 
257
-
258
286
  ionViewWillEnter() {
259
287
  this.logger.log('Called ionViewDidEnter')
260
- this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected', this.uidConvSelected);
261
- this.listnerStart();
288
+ this.logger.log(
289
+ '[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected',
290
+ this.uidConvSelected,
291
+ )
292
+ this.listnerStart()
262
293
 
263
294
  // exit from app with hardware back button
264
295
  this.subscription = this.platform.backButton.subscribe(() => {
265
- navigator['app'].exitApp();
266
- });
296
+ navigator['app'].exitApp()
297
+ })
267
298
  }
268
299
 
269
300
  // unsubscribe backButton.subscribe method to not use from other page
270
301
  ionViewWillLeave() {
271
302
  this.logger.log('Called ionViewWillLeave')
272
- this.subscription.unsubscribe();
303
+ this.subscription.unsubscribe()
273
304
  }
274
305
 
275
306
  ionViewDidEnter() { }
276
307
 
277
308
  getLastProjectId(projectid: string) {
278
- this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid);
279
- this.lastProjectId = projectid;
309
+ this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid)
310
+ this.lastProjectId = projectid
280
311
  }
281
312
 
282
313
  openUnsevedConversationIframe(event) {
283
314
  this.logger.log('[CONVS-LIST-PAGE] openUnsevedConversationIframe ', event)
284
315
  this.hasClickedOpenUnservedConvIframe = true
285
- this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME', this.hasClickedOpenUnservedConvIframe);
286
- const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
316
+ this.logger.log(
317
+ '[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME',
318
+ this.hasClickedOpenUnservedConvIframe,
319
+ )
320
+ const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl
287
321
  // http://localhost:4204/#/projects-for-panel
288
- this.PROJECTS_FOR_PANEL_URL = DASHBOARD_BASE_URL + '#/projects-for-panel';
289
- this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel';
322
+ this.PROJECTS_FOR_PANEL_URL = DASHBOARD_BASE_URL + '#/projects-for-panel'
323
+ this.UNASSIGNED_CONVS_URL =
324
+ DASHBOARD_BASE_URL +
325
+ '#/project/' +
326
+ this.lastProjectId +
327
+ '/unserved-request-for-panel'
290
328
 
291
329
  if (event === 'pinbtn') {
292
330
  this.IFRAME_URL = this.PROJECTS_FOR_PANEL_URL
@@ -294,7 +332,10 @@ export class ConversationListPage implements OnInit {
294
332
  this.IFRAME_URL = this.UNASSIGNED_CONVS_URL
295
333
  }
296
334
 
297
- this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL', this.UNASSIGNED_CONVS_URL);
335
+ this.logger.log(
336
+ '[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL',
337
+ this.UNASSIGNED_CONVS_URL,
338
+ )
298
339
  this.openUnassignedConversations(this.IFRAME_URL, event)
299
340
  }
300
341
 
@@ -305,180 +346,233 @@ export class ConversationListPage implements OnInit {
305
346
  if (checkPlatformIsMobile()) {
306
347
  presentModal(this.modalController, UnassignedConversationsPage, {
307
348
  iframe_URL: IFRAME_URL,
308
- callerBtn: event
309
- });
349
+ callerBtn: event,
350
+ })
310
351
  } else {
311
352
  this.navService.push(UnassignedConversationsPage, {
312
353
  iframe_URL: IFRAME_URL,
313
- callerBtn: event
314
-
315
- });
354
+ callerBtn: event,
355
+ })
316
356
  }
317
357
  }
318
358
 
319
359
  _closeContactsDirectory() {
320
360
  try {
321
- closeModal(this.modalController);
361
+ closeModal(this.modalController)
322
362
  } catch (err) {
323
- this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
363
+ this.logger.error(
364
+ '[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
365
+ err,
366
+ )
324
367
  }
325
368
  }
326
369
 
327
-
328
370
  listenToSwPostMessage() {
329
- this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
330
- const that = this;
371
+ this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ')
372
+ const that = this
331
373
  if (navigator && navigator.serviceWorker) {
332
-
333
374
  navigator.serviceWorker.addEventListener('message', function (event) {
334
-
335
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ', event.data);
336
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ', event.data['data']);
337
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ', typeof event.data['data']);
375
+ that.logger.log(
376
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ',
377
+ event.data,
378
+ )
379
+ that.logger.log(
380
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ',
381
+ event.data['data'],
382
+ )
383
+ that.logger.log(
384
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ',
385
+ typeof event.data['data'],
386
+ )
338
387
  let uidConvSelected = ''
339
388
  if (event.data && event.data['conversWith']) {
340
- uidConvSelected = event.data['conversWith'];
341
- }
342
- else {
343
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG');
344
- return;
389
+ uidConvSelected = event.data['conversWith']
390
+ } else {
391
+ that.logger.log(
392
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG',
393
+ )
394
+ return
345
395
  }
346
396
 
347
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ', uidConvSelected);
348
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ', that.conversations);
349
- const conversationSelected = that.conversations.find(item => item.uid === uidConvSelected);
397
+ that.logger.log(
398
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ',
399
+ uidConvSelected,
400
+ )
401
+ that.logger.log(
402
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ',
403
+ that.conversations,
404
+ )
405
+ const conversationSelected = that.conversations.find(
406
+ (item) => item.uid === uidConvSelected,
407
+ )
350
408
  if (conversationSelected) {
351
-
352
- that.conversationSelected = conversationSelected;
353
- that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ', that.conversationSelected);
409
+ that.conversationSelected = conversationSelected
410
+ that.logger.log(
411
+ '[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ',
412
+ that.conversationSelected,
413
+ )
354
414
 
355
415
  that.navigateByUrl('active', uidConvSelected)
356
416
  }
357
- });
417
+ })
358
418
  }
359
419
  }
360
420
 
361
-
362
421
  private listnerStart() {
363
- const that = this;
364
- this.chatManager.BSStart
365
- .pipe(
366
- takeUntil(that.unsubscribe$)
367
- )
368
- .subscribe((data: any) => {
369
- this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
422
+ const that = this
423
+ this.chatManager.BSStart.pipe(takeUntil(that.unsubscribe$)).subscribe(
424
+ (data: any) => {
425
+ this.logger.log(
426
+ '[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****',
427
+ data,
428
+ )
370
429
  if (data) {
371
- that.initialize();
430
+ that.initialize()
372
431
  }
373
- }, error => {
374
- this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
375
- }, () => {
432
+ },
433
+ (error) => {
434
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error)
435
+ },
436
+ () => {
376
437
  this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
377
- });
438
+ },
439
+ )
378
440
  }
379
441
 
380
-
381
442
  // ------------------------------------------------------------------ //
382
443
  // Init convrsation handler
383
444
  // ------------------------------------------------------------------ //
384
445
  initConversationsHandler() {
385
- this.conversations = this.conversationsHandlerService.conversations;
446
+ this.conversations = this.conversationsHandlerService.conversations
386
447
  this.logger.log('[CONVS-LIST-PAGE] - CONVERSATIONS ', this.conversations)
387
448
  // save conversationHandler in chatManager
388
- this.chatManager.setConversationsHandler(this.conversationsHandlerService);
389
- this.showPlaceholder = false;
449
+ this.chatManager.setConversationsHandler(this.conversationsHandlerService)
450
+ this.showPlaceholder = false
390
451
  }
391
452
 
392
-
393
-
394
453
  initArchivedConversationsHandler() {
395
- const keysConversation = ['CLOSED', 'Resolve'];
396
- this.translationMapConversation = this.translateService.translateLanguage(keysConversation);
454
+ const keysConversation = ['CLOSED', 'Resolve']
455
+ this.translationMapConversation = this.translateService.translateLanguage(
456
+ keysConversation,
457
+ )
397
458
 
398
459
  this.archivedConversationsHandlerService.subscribeToConversations(() => {
399
- this.logger.log('[CONVS-LIST-PAGE]-CONVS - conversations archived length ', this.archivedConversations.length)
400
-
401
- });
460
+ this.logger.log(
461
+ '[CONVS-LIST-PAGE]-CONVS - conversations archived length ',
462
+ this.archivedConversations.length,
463
+ )
464
+ })
402
465
 
403
- this.archivedConversations = this.archivedConversationsHandlerService.archivedConversations;
404
- this.logger.log('[CONVS-LIST-PAGE] archived conversation', this.archivedConversations)
466
+ this.archivedConversations = this.archivedConversationsHandlerService.archivedConversations
467
+ this.logger.log(
468
+ '[CONVS-LIST-PAGE] archived conversation',
469
+ this.archivedConversations,
470
+ )
405
471
 
406
472
  // save archivedConversationsHandlerService in chatManager
407
- this.chatManager.setArchivedConversationsHandler(this.archivedConversationsHandlerService);
408
-
409
- this.logger.log('[CONVS-LIST-PAGE]-CONVS SubscribeToConversations - conversations archived length ', this.archivedConversations.length)
410
- if (!this.archivedConversations || this.archivedConversations.length === 0) {
411
- this.loadingIsActive = false;
473
+ this.chatManager.setArchivedConversationsHandler(
474
+ this.archivedConversationsHandlerService,
475
+ )
476
+
477
+ this.logger.log(
478
+ '[CONVS-LIST-PAGE]-CONVS SubscribeToConversations - conversations archived length ',
479
+ this.archivedConversations.length,
480
+ )
481
+ if (
482
+ !this.archivedConversations ||
483
+ this.archivedConversations.length === 0
484
+ ) {
485
+ this.loadingIsActive = false
412
486
  }
413
487
  }
414
488
 
415
-
416
489
  // ----------------------------------------------------------------------------------------------------
417
- // To display "No conversation yet" MESSAGE in conversazion list
490
+ // To display "No conversation yet" MESSAGE in conversazion list
418
491
  // this.loadingIsActive is set to false only if on init there are not conversation
419
492
  // otherwise loadingIsActive remains set to true and the message "No conversation yet" is not displayed
420
493
  // to fix this
421
- // - for the direct conversation
422
- // ----------------------------------------------------------------------------------------------------
494
+ // - for the direct conversation
495
+ // ----------------------------------------------------------------------------------------------------
423
496
  listenToAppCompConvsLengthOnInitConvs() {
424
- this.events.subscribe('appcompSubscribeToConvs:loadingIsActive', (loadingIsActive) => {
425
- this.logger.log('[CONVS-LIST-PAGE]-CONVS loadingIsActive', loadingIsActive);
426
- if (loadingIsActive === false) {
427
- this.loadingIsActive = false
428
- }
429
- });
497
+ this.events.subscribe(
498
+ 'appcompSubscribeToConvs:loadingIsActive',
499
+ (loadingIsActive) => {
500
+ this.logger.log(
501
+ '[CONVS-LIST-PAGE]-CONVS loadingIsActive',
502
+ loadingIsActive,
503
+ )
504
+ if (loadingIsActive === false) {
505
+ this.loadingIsActive = false
506
+ }
507
+ },
508
+ )
430
509
  }
431
510
 
432
511
  listenGoOnline() {
433
512
  this.events.subscribe('go:online', (goonline) => {
434
- this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
513
+ this.logger.info(
514
+ '[CONVS-LIST-PAGE] - listen To go:online - goonline',
515
+ goonline,
516
+ )
435
517
  // this.events.unsubscribe('profileInfoButtonClick:logout')
436
518
  if (goonline === true) {
437
519
  this.displayNewConvsItem = true
438
520
  }
439
- });
521
+ })
440
522
  }
441
523
 
442
524
  listenGoOffline() {
443
525
  this.events.subscribe('go:offline', (offline) => {
444
- this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
526
+ this.logger.info(
527
+ '[CONVS-LIST-PAGE] - listen To go:offline - offline',
528
+ offline,
529
+ )
445
530
  // this.events.unsubscribe('profileInfoButtonClick:logout')
446
531
  if (offline === true) {
447
532
  this.displayNewConvsItem = false
448
533
  }
449
- });
534
+ })
450
535
  }
451
536
 
452
537
  listenToLogoutEvent() {
453
- this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
454
- this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
455
-
456
-
457
- this.conversations = []
458
- this.conversationsHandlerService.conversations = [];
459
- this.uidConvSelected = null;
460
-
461
- this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - CONVERSATIONS ', this.conversations)
462
- this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - uidConvSelected ', this.uidConvSelected)
463
- if (hasclickedlogout === true) {
464
- this.loadingIsActive = false
465
- }
466
- });
538
+ this.events.subscribe(
539
+ 'profileInfoButtonClick:logout',
540
+ (hasclickedlogout) => {
541
+ this.logger.info(
542
+ '[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout',
543
+ hasclickedlogout,
544
+ )
545
+
546
+ this.conversations = []
547
+ this.conversationsHandlerService.conversations = []
548
+ this.uidConvSelected = null
549
+
550
+ this.logger.log(
551
+ '[CONVS-LIST-PAGE] - listenToLogoutEvent - CONVERSATIONS ',
552
+ this.conversations,
553
+ )
554
+ this.logger.log(
555
+ '[CONVS-LIST-PAGE] - listenToLogoutEvent - uidConvSelected ',
556
+ this.uidConvSelected,
557
+ )
558
+ if (hasclickedlogout === true) {
559
+ this.loadingIsActive = false
560
+ }
561
+ },
562
+ )
467
563
  }
468
564
 
469
-
470
- // ------------------------------------------------------------------
565
+ // ------------------------------------------------------------------
471
566
  // SUBSCRIPTIONS
472
567
  // ------------------------------------------------------------------
473
568
  initSubscriptions() {
474
569
  this.logger.log('[CONVS-LIST-PAGE] - CALLING - initSubscriptions ')
475
- let key = '';
476
-
570
+ let key = ''
477
571
 
478
- key = 'loggedUser:logout';
572
+ key = 'loggedUser:logout'
479
573
  if (!isInArray(key, this.subscriptions)) {
480
- this.subscriptions.push(key);
481
- this.events.subscribe(key, this.subscribeLoggedUserLogout);
574
+ this.subscriptions.push(key)
575
+ this.events.subscribe(key, this.subscribeLoggedUserLogout)
482
576
  }
483
577
 
484
578
  // key = 'readAllMessages';
@@ -487,10 +581,10 @@ export class ConversationListPage implements OnInit {
487
581
  // this.events.subscribe(key, this.readAllMessages);
488
582
  // }
489
583
 
490
- key = 'profileInfoButtonClick:changed';
584
+ key = 'profileInfoButtonClick:changed'
491
585
  if (!isInArray(key, this.subscriptions)) {
492
- this.subscriptions.push(key);
493
- this.events.subscribe(key, this.subscribeProfileInfoButtonClicked);
586
+ this.subscriptions.push(key)
587
+ this.events.subscribe(key, this.subscribeProfileInfoButtonClicked)
494
588
  }
495
589
 
496
590
  // this.conversationsHandlerService.readAllMessages.subscribe((conversationId: string) => {
@@ -498,67 +592,89 @@ export class ConversationListPage implements OnInit {
498
592
  // this.readAllMessages(conversationId);
499
593
  // });
500
594
 
501
- this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
502
- // this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
503
- // that.conversationsChanged(conversations);
504
- if (conversation) {
505
- this.onImageLoaded(conversation)
506
- this.onConversationLoaded(conversation)
507
- }
508
- });
509
-
510
- this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
511
- // this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
512
- // that.conversationsChanged(conversations)
513
- if (conversation) {
514
- this.onImageLoaded(conversation)
515
- this.onConversationLoaded(conversation)
516
- }
517
- });
518
-
519
- this.conversationsHandlerService.conversationRemoved.subscribe((conversation: ConversationModel) => {
520
- this.logger.log('[CONVS-LIST-PAGE] ***** conversationsRemoved *****', conversation);
521
- });
522
-
523
- this.archivedConversationsHandlerService.archivedConversationAdded.subscribe((conversation: ConversationModel) => {
524
- this.logger.log('[CONVS-LIST-PAGE] ***** archivedConversationAdded *****', conversation);
525
- // that.conversationsChanged(conversations);
526
- if (conversation) {
527
- this.onImageLoaded(conversation)
528
- this.onConversationLoaded(conversation)
529
- }
530
- });
595
+ this.conversationsHandlerService.conversationAdded.subscribe(
596
+ (conversation: ConversationModel) => {
597
+ // this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
598
+ // that.conversationsChanged(conversations);
599
+ if (conversation) {
600
+ this.onImageLoaded(conversation)
601
+ this.onConversationLoaded(conversation)
602
+ }
603
+ },
604
+ )
605
+
606
+ this.conversationsHandlerService.conversationChanged.subscribe(
607
+ (conversation: ConversationModel) => {
608
+ // this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
609
+ // that.conversationsChanged(conversations)
610
+ if (conversation) {
611
+ this.onImageLoaded(conversation)
612
+ this.onConversationLoaded(conversation)
613
+ }
614
+ },
615
+ )
616
+
617
+ this.conversationsHandlerService.conversationRemoved.subscribe(
618
+ (conversation: ConversationModel) => {
619
+ this.logger.log(
620
+ '[CONVS-LIST-PAGE] ***** conversationsRemoved *****',
621
+ conversation,
622
+ )
623
+ },
624
+ )
625
+
626
+ this.archivedConversationsHandlerService.archivedConversationAdded.subscribe(
627
+ (conversation: ConversationModel) => {
628
+ this.logger.log(
629
+ '[CONVS-LIST-PAGE] ***** archivedConversationAdded *****',
630
+ conversation,
631
+ )
632
+ // that.conversationsChanged(conversations);
633
+ if (conversation) {
634
+ this.onImageLoaded(conversation)
635
+ this.onConversationLoaded(conversation)
636
+ }
637
+ },
638
+ )
531
639
  }
532
640
 
533
641
  // ------------------------------------------------------------------------------------
534
642
  // @ SUBSCRIBE TO LOGGED USER LOGOUT ??????????? SEEMS NOT USED ?????????????????
535
643
  // ------------------------------------------------------------------------------------
536
644
  subscribeLoggedUserLogout = () => {
537
- this.conversations = [];
538
- this.uidConvSelected = null;
539
- this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout conversations ', this.conversations);
540
- this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ', this.uidConvSelected);
645
+ this.conversations = []
646
+ this.uidConvSelected = null
647
+ this.logger.log(
648
+ '[CONVS-LIST-PAGE] - subscribeLoggedUserLogout conversations ',
649
+ this.conversations,
650
+ )
651
+ this.logger.log(
652
+ '[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ',
653
+ this.uidConvSelected,
654
+ )
541
655
  }
542
656
 
543
-
544
-
545
657
  // ------------------------------------------------------------------------------------
546
658
  // @ SUBSCRIBE TO CONVERSATION CHANGED ??????????? SEEMS NOT USED ?????????????????
547
659
  // ------------------------------------------------------------------------------------
548
660
  conversationsChanged = (conversations: ConversationModel[]) => {
549
- this.numberOpenConv = this.conversationsHandlerService.countIsNew();
550
- this.logger.log('[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ', this.numberOpenConv);
661
+ this.numberOpenConv = this.conversationsHandlerService.countIsNew()
662
+ this.logger.log(
663
+ '[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ',
664
+ this.numberOpenConv,
665
+ )
551
666
  // console.log('conversationsChanged »»»»»»»»» uidConvSelected', that.conversations[0], that.uidConvSelected);
552
667
  if (this.uidConvSelected && !this.conversationSelected) {
553
- const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
668
+ const conversationSelected = this.conversations.find(
669
+ (item) => item.uid === this.uidConvSelected,
670
+ )
554
671
  if (conversationSelected) {
555
- this.conversationSelected = conversationSelected;
556
- this.setUidConvSelected(this.uidConvSelected);
672
+ this.conversationSelected = conversationSelected
673
+ this.setUidConvSelected(this.uidConvSelected)
557
674
  }
558
675
  }
559
676
  }
560
677
 
561
-
562
678
  /**
563
679
  * ::: subscribeChangedConversationSelected :::
564
680
  * evento richiamato quando si seleziona un utente nell'elenco degli user
@@ -568,14 +684,27 @@ export class ConversationListPage implements OnInit {
568
684
  // !!!!!! IS USED? ?????
569
685
  // ------------------------------
570
686
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
571
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
572
- this.uidConvSelected = user.uid;
573
- this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected);
687
+ this.logger.log(
688
+ '[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl',
689
+ user,
690
+ type,
691
+ )
692
+ this.uidConvSelected = user.uid
693
+ this.logger.log(
694
+ '[CONVS-LIST-PAGE] ************** uidConvSelected ',
695
+ this.uidConvSelected,
696
+ )
574
697
  // this.conversationsHandlerService.uidConvSelected = user.uid;
575
- const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
698
+ const conversationSelected = this.conversations.find(
699
+ (item) => item.uid === this.uidConvSelected,
700
+ )
576
701
  if (conversationSelected) {
577
- this.logger.log('[CONVS-LIST-PAGE] --> uidConvSelected: ', this.conversationSelected, this.uidConvSelected);
578
- this.conversationSelected = conversationSelected;
702
+ this.logger.log(
703
+ '[CONVS-LIST-PAGE] --> uidConvSelected: ',
704
+ this.conversationSelected,
705
+ this.uidConvSelected,
706
+ )
707
+ this.conversationSelected = conversationSelected
579
708
  }
580
709
  // this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
581
710
  }
@@ -585,22 +714,28 @@ export class ConversationListPage implements OnInit {
585
714
  * evento richiamato quando si seleziona bottone profile-info-modal
586
715
  */
587
716
  subscribeProfileInfoButtonClicked = (event: string) => {
588
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ', event);
717
+ this.logger.log(
718
+ '[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ',
719
+ event,
720
+ )
589
721
  if (event === 'displayArchived') {
590
- this.initArchivedConversationsHandler();
722
+ this.initArchivedConversationsHandler()
591
723
  // this.openArchivedConversationsModal()
592
724
  this.conversationType = 'archived'
593
725
 
594
726
  // let storedArchivedConv = localStorage.getItem('activeConversationSelected');
595
- const keys = ['LABEL_ARCHIVED'];
727
+ const keys = ['LABEL_ARCHIVED']
596
728
  // const keys = ['History'];
597
729
 
598
- this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0]);
599
-
730
+ this.headerTitle = this.translateService
731
+ .translateLanguage(keys)
732
+ .get(keys[0])
600
733
  } else if (event === 'displayContact') {
601
734
  this.conversationType = 'archived'
602
- const keys = ['LABEL_CONTACTS'];
603
- this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0]);
735
+ const keys = ['LABEL_CONTACTS']
736
+ this.headerTitle = this.translateService
737
+ .translateLanguage(keys)
738
+ .get(keys[0])
604
739
  }
605
740
  }
606
741
 
@@ -614,12 +749,10 @@ export class ConversationListPage implements OnInit {
614
749
  // console.log('ConversationListPage - storedActiveConv Objct: ', storedActiveConvObjct);
615
750
  // this.navigateByUrl('active', storedActiveConvObjct.uid)
616
751
  // } else {
617
- // // da implementare se nn c'è stata nessuna conv attive selezionata
752
+ // // da implementare se nn c'è stata nessuna conv attive selezionata
618
753
  // }
619
-
620
754
  }
621
755
 
622
-
623
756
  // ------------------------------------------------------------------//
624
757
  // END SUBSCRIPTIONS
625
758
  // ------------------------------------------------------------------//
@@ -641,8 +774,6 @@ export class ConversationListPage implements OnInit {
641
774
  // })
642
775
  // }
643
776
 
644
-
645
-
646
777
  // ------------------------------------------------------------------//
647
778
  // BEGIN FUNCTIONS
648
779
  // ------------------------------------------------------------------//
@@ -650,22 +781,24 @@ export class ConversationListPage implements OnInit {
650
781
  * ::: initialize :::
651
782
  */
652
783
  initialize() {
653
- const appconfig = this.appConfigProvider.getConfig();
654
- this.tenant = appconfig.firebaseConfig.tenant;
655
- this.logger.log('[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ', this.tenant);
784
+ const appconfig = this.appConfigProvider.getConfig()
785
+ this.tenant = appconfig.firebaseConfig.tenant
786
+ this.logger.log(
787
+ '[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ',
788
+ this.tenant,
789
+ )
656
790
 
657
791
  if (this.tiledeskAuthService.getCurrentUser()) {
658
- this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid;
792
+ this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid
659
793
  }
660
- this.subscriptions = [];
661
- this.initConversationsHandler();
662
- this.initVariables();
663
- this.initSubscriptions();
794
+ this.subscriptions = []
795
+ this.initConversationsHandler()
796
+ this.initVariables()
797
+ this.initSubscriptions()
664
798
 
665
799
  // this.initHandlerEventEmitter();
666
800
  }
667
801
 
668
-
669
802
  /**
670
803
  * ::: initVariables :::
671
804
  * al caricamento della pagina:
@@ -680,46 +813,45 @@ export class ConversationListPage implements OnInit {
680
813
  // It only works on BSStart.subscribe! it is useful or can be eliminated
681
814
  // --------------------------------------------------------
682
815
  initVariables() {
683
- this.logger.log('[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl);
684
- this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid);
685
- this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant);
686
- if (this.route.component['name'] !== "ConversationListPage") {
687
-
816
+ this.logger.log(
817
+ '[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl,
818
+ )
819
+ this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid)
820
+ this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant)
821
+ if (this.route.component['name'] !== 'ConversationListPage') {
688
822
  if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
689
- const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
690
- this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv);
823
+ const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv')
824
+ this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv)
691
825
  if (IDConv) {
692
- this.setUidConvSelected(IDConv);
826
+ this.setUidConvSelected(IDConv)
693
827
  } else {
694
-
695
- this.logger.log('[CONVS-LIST-PAGE] conversationWith 2 (else): ', IDConv);
828
+ this.logger.log(
829
+ '[CONVS-LIST-PAGE] conversationWith 2 (else): ',
830
+ IDConv,
831
+ )
696
832
  }
697
833
  }
698
834
  }
699
835
  }
700
836
 
701
-
702
-
703
837
  /**
704
838
  * ::: setUidConvSelected :::
705
839
  */
706
- setUidConvSelected(uidConvSelected: string, conversationType?: string,) {
840
+ setUidConvSelected(uidConvSelected: string, conversationType?: string) {
707
841
  this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
708
- this.uidConvSelected = uidConvSelected;
842
+ this.uidConvSelected = uidConvSelected
709
843
  this.logger.log('uidConvSelected', uidConvSelected)
710
844
  // this.conversationsHandlerService.uidConvSelected = uidConvSelected;
711
845
  if (uidConvSelected) {
712
- let conversationSelected;
846
+ let conversationSelected
713
847
  if (conversationType === 'active') {
714
- conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
715
- } else if (conversationType === 'archived') {
716
- conversationSelected = this.archivedConversations.find(item => item.uid === this.uidConvSelected);
717
- }
848
+ conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
849
+ } else if (conversationType === 'archived') { conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected) }
718
850
  if (conversationSelected) {
719
- this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
720
- this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
721
- this.conversationSelected = conversationSelected;
722
- this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
851
+ this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected,)
852
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded')
853
+ this.conversationSelected = conversationSelected
854
+ this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected)
723
855
  }
724
856
  }
725
857
  }
@@ -728,29 +860,31 @@ export class ConversationListPage implements OnInit {
728
860
  this.logger.log('onConversationSelected conversation', conversation)
729
861
  if (conversation.archived) {
730
862
  this.navigateByUrl('archived', conversation.uid)
731
- this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
863
+ this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid,
864
+ )
732
865
  } else {
733
866
  this.navigateByUrl('active', conversation.uid)
734
867
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected active conversation.uid ', conversation.uid)
735
868
  }
736
-
737
869
  }
738
870
 
739
871
  onImageLoaded(conversation: any) {
740
872
  // this.logger.log('[CONVS-LIST-PAGE] onImageLoaded', conversation)
741
- let conversation_with_fullname = conversation.sender_fullname;
742
- let conversation_with = conversation.sender;
873
+ let conversation_with_fullname = conversation.sender_fullname
874
+ let conversation_with = conversation.sender
743
875
  if (conversation.sender === this.loggedUserUid) {
744
- conversation_with = conversation.recipient;
745
- conversation_with_fullname = conversation.recipient_fullname;
876
+ conversation_with = conversation.recipient
877
+ conversation_with_fullname = conversation.recipient_fullname
746
878
  } else if (isGroup(conversation)) {
747
879
  // conversation_with_fullname = conv.sender_fullname;
748
880
  // conv.last_message_text = conv.last_message_text;
749
- conversation_with = conversation.recipient;
750
- conversation_with_fullname = conversation.recipient_fullname;
881
+ conversation_with = conversation.recipient
882
+ conversation_with_fullname = conversation.recipient_fullname
751
883
  }
752
- if (!conversation_with.startsWith("support-group")) {
753
- conversation.image = this.imageRepoService.getImagePhotoUrl(conversation_with)
884
+ if (!conversation_with.startsWith('support-group')) {
885
+ conversation.image = this.imageRepoService.getImagePhotoUrl(
886
+ conversation_with,
887
+ )
754
888
  }
755
889
  }
756
890
 
@@ -761,49 +895,42 @@ export class ConversationListPage implements OnInit {
761
895
  // this.ionContentConvList.scrollToTop(0);
762
896
  // }
763
897
 
764
- const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT'];
765
- const translationMap = this.translateService.translateLanguage(keys);
898
+ const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT']
899
+ const translationMap = this.translateService.translateLanguage(keys)
766
900
  // Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
767
901
 
768
- var regex = /<br\s*[\/]?>/gi;
902
+ var regex = /<br\s*[\/]?>/gi
769
903
  if (conversation && conversation.last_message_text) {
770
- conversation.last_message_text = conversation.last_message_text.replace(regex, "")
904
+ conversation.last_message_text = conversation.last_message_text.replace(regex, '',)
771
905
 
772
906
  //FIX-BUG: 'YOU: YOU: YOU: text' on last-message-text in conversation-list
773
907
  if (conversation.sender === this.loggedUserUid && !conversation.last_message_text.includes(': ')) {
774
908
  // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded', conversation)
775
909
 
776
- if (conversation.type !== "image" && conversation.type !== "file") {
777
- conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text;
778
-
779
- } else if (conversation.type === "image") {
780
-
910
+ if (conversation.type !== 'image' && conversation.type !== 'file') {
911
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text
912
+ } else if (conversation.type === 'image') {
781
913
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
782
914
  // this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
783
- const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
784
-
785
- conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE;
915
+ const SENT_AN_IMAGE = (conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE'))
786
916
 
787
- } else if (conversation.type === "file") {
917
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE
918
+ } else if (conversation.type === 'file') {
788
919
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
789
- const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
790
- conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT;
920
+ const SENT_AN_ATTACHMENT = (conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT'))
921
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT
791
922
  }
792
923
  } else {
793
- if (conversation.type === "image") {
794
-
924
+ if (conversation.type === 'image') {
795
925
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
796
926
  // this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
797
- const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
798
-
799
- conversation.last_message_text = SENT_AN_IMAGE;
927
+ const SENT_AN_IMAGE = (conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE'))
800
928
 
801
- }
802
- else if (conversation.type === "file") {
929
+ conversation.last_message_text = SENT_AN_IMAGE
930
+ } else if (conversation.type === 'file') {
803
931
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
804
- const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
805
- conversation.last_message_text = SENT_AN_ATTACHMENT;
806
-
932
+ const SENT_AN_ATTACHMENT = (conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT'))
933
+ conversation.last_message_text = SENT_AN_ATTACHMENT
807
934
  }
808
935
  }
809
936
  }
@@ -813,59 +940,65 @@ export class ConversationListPage implements OnInit {
813
940
  // this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 1')
814
941
  // var regex = /^(^|[\n\r])\s*1\.\s.*\s+1\.\s$/
815
942
  // let matchRegex = false
816
- // if (regex.test(last_message_text)) {
943
+ // if (regex.test(last_message_text)) {
817
944
  // this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 2')
818
945
  // matchRegex = true
819
946
  // return matchRegex
820
947
  // }
821
948
  // }
822
949
 
823
-
824
950
  navigateByUrl(converationType: string, uidConvSelected: string) {
825
- this.logger.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
826
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
827
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
828
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
829
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected ', this.conversationSelected)
830
951
 
831
- this.setUidConvSelected(uidConvSelected, converationType);
952
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected)
953
+
954
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected)
955
+
956
+ this.setUidConvSelected(uidConvSelected, converationType)
832
957
  if (checkPlatformIsMobile()) {
833
- this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
834
- this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
835
- let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
958
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile())
959
+ this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window < 768)', this.navService)
960
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected conversation_with_fullname ', this.conversationSelected.conversation_with_fullname)
961
+ let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
836
962
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
837
- this.router.navigateByUrl(pageUrl);
963
+ // replace(/\(/g, '%28').replace(/\)/g, '%29') -> used for the encoder of any round brackets
964
+ this.router.navigateByUrl(pageUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'))
838
965
  } else {
839
- this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
840
- this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
841
- let pageUrl = 'conversation-detail/' + this.uidConvSelected;
966
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected conversation_with_fullname ', this.conversationSelected.conversation_with_fullname)
967
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile())
968
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window >= 768) ', this.navService)
969
+ let pageUrl = 'conversation-detail/' + this.uidConvSelected
842
970
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
843
- pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
971
+ pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
844
972
  }
845
- this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected navigateByUrl--->: ', pageUrl);
846
- this.router.navigateByUrl(pageUrl);
973
+ this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected navigateByUrl--->: ', pageUrl)
974
+ // replace(/\(/g, '%28').replace(/\)/g, '%29') -> used for the encoder of any round brackets
975
+ this.router.navigateByUrl(pageUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'))
847
976
  }
848
977
  }
849
978
 
850
-
851
979
  // ---------------------------------------------------------
852
980
  // Opens the list of contacts for direct convs
853
981
  // ---------------------------------------------------------
854
982
  openContactsDirectory(event: any) {
855
- const TOKEN = this.tiledeskAuthService.getTiledeskToken();
856
- this.logger.log('[CONVS-LIST-PAGE] openContactsDirectory', TOKEN);
983
+ const TOKEN = this.tiledeskAuthService.getTiledeskToken()
984
+ this.logger.log('[CONVS-LIST-PAGE] openContactsDirectory', TOKEN)
857
985
  if (checkPlatformIsMobile()) {
858
- presentModal(this.modalController, ContactsDirectoryPage, { token: TOKEN });
986
+ presentModal(this.modalController, ContactsDirectoryPage, {
987
+ token: TOKEN,
988
+ })
859
989
  } else {
860
- this.navService.push(ContactsDirectoryPage, { token: TOKEN });
990
+ this.navService.push(ContactsDirectoryPage, { token: TOKEN })
861
991
  }
862
992
  }
863
993
 
864
994
  closeContactsDirectory() {
865
995
  try {
866
- closeModal(this.modalController);
996
+ closeModal(this.modalController)
867
997
  } catch (err) {
868
- this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
998
+ this.logger.error(
999
+ '[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
1000
+ err,
1001
+ )
869
1002
  }
870
1003
  }
871
1004
 
@@ -873,8 +1006,8 @@ export class ConversationListPage implements OnInit {
873
1006
  // Opens logged user profile modal
874
1007
  // ---------------------------------------------------------
875
1008
  openProfileInfo(event: any) {
876
- const TOKEN = this.messagingAuthService.getToken();
877
- this.logger.log('[CONVS-LIST-PAGE] open ProfileInfoPage TOKEN ', TOKEN);
1009
+ const TOKEN = this.messagingAuthService.getToken()
1010
+ this.logger.log('[CONVS-LIST-PAGE] open ProfileInfoPage TOKEN ', TOKEN)
878
1011
  if (checkPlatformIsMobile()) {
879
1012
  presentModal(this.modalController, ProfileInfoPage, { token: TOKEN })
880
1013
  } else {
@@ -883,13 +1016,15 @@ export class ConversationListPage implements OnInit {
883
1016
  }
884
1017
 
885
1018
  listenToCloseConvFromHeaderConversation() {
886
- this.events.subscribe('hasclosedconversation', (convId) => {
1019
+ this.events.subscribe('conversation:closed', (convId) => {
887
1020
  this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation convId', convId)
888
1021
 
889
- const conversation = this.conversations.find(conv => conv.uid === convId)
1022
+ const conversation = this.conversations.find(
1023
+ (conv) => conv.uid === convId,
1024
+ )
890
1025
  this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation conversation', conversation)
891
1026
  this.onCloseConversation(conversation)
892
- });
1027
+ })
893
1028
  }
894
1029
 
895
1030
  // ----------------------------------------------------------------------------------------------
@@ -898,104 +1033,168 @@ export class ConversationListPage implements OnInit {
898
1033
  // ----------------------------------------------------------------------------------------------
899
1034
  onCloseConversation(conversation: ConversationModel) {
900
1035
  this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversation', conversation)
901
-
1036
+
902
1037
  // -------------------------------------------------------------------------------------
903
- // Fix the display of the message "No conversation yet" when a conversation is archived
904
- // but there are others in the list (happens when loadingIsActive is set to false because
1038
+ // Fix the display of the message "No conversation yet" when a conversation is archived
1039
+ // but there are others in the list (happens when loadingIsActive is set to false because
905
1040
  // when is called the initConversationsHandler method there is not conversations)
906
1041
  // -------------------------------------------------------------------------------------
907
- this.loadingIsActive = false;
1042
+ this.loadingIsActive = false
908
1043
  // console.log('CONVS - CONV-LIST-PAGE onCloseConversation CONVS: ', conversation)
909
1044
  this.logger.log('[CONVS-LIST-PAGE] onCloseConversation loadingIsActive: ', this.loadingIsActive)
1045
+ if (conversation) {
1046
+ const conversationId = conversation.uid
910
1047
 
911
- const conversationId = conversation.uid;
912
-
913
- this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
1048
+ this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
914
1049
 
915
- const conversationWith_segments = conversationId.split('-');
916
- this.logger.log('[CONVS-LIST-PAGE] - conversationId_segments: ', conversationWith_segments);
917
-
918
- // Removes the last element of the array if is = to the separator
919
- if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
920
- conversationWith_segments.pop();
921
- }
1050
+ const conversationWith_segments = conversationId.split('-')
1051
+ this.logger.log(
1052
+ '[CONVS-LIST-PAGE] - conversationId_segments: ',
1053
+ conversationWith_segments,
1054
+ )
922
1055
 
923
- if (conversationWith_segments.length === 4) {
924
- const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
925
- this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement ', lastArrayElement);
926
- this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement length', lastArrayElement.length);
927
- if (lastArrayElement.length !== 32) {
928
- conversationWith_segments.pop();
1056
+ // Removes the last element of the array if is = to the separator
1057
+ if (
1058
+ conversationWith_segments[conversationWith_segments.length - 1] === ''
1059
+ ) {
1060
+ conversationWith_segments.pop()
929
1061
  }
930
- }
931
1062
 
932
- if (conversationId.startsWith("support-group")) {
933
- let project_id = ''
934
1063
  if (conversationWith_segments.length === 4) {
935
- project_id = conversationWith_segments[2];
936
-
937
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
938
- this.archiveSupportGroupConv(tiledeskToken, project_id, conversationId);
1064
+ const lastArrayElement =
1065
+ conversationWith_segments[conversationWith_segments.length - 1]
1066
+ this.logger.log(
1067
+ '[CONVS-LIST-PAGE] - lastArrayElement ',
1068
+ lastArrayElement,
1069
+ )
1070
+ this.logger.log(
1071
+ '[CONVS-LIST-PAGE] - lastArrayElement length',
1072
+ lastArrayElement.length,
1073
+ )
1074
+ if (lastArrayElement.length !== 32) {
1075
+ conversationWith_segments.pop()
1076
+ }
1077
+ }
939
1078
 
1079
+ if (conversationId.startsWith('support-group')) {
1080
+ let project_id = ''
1081
+ if (conversationWith_segments.length === 4) {
1082
+ project_id = conversationWith_segments[2]
1083
+
1084
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1085
+ this.archiveSupportGroupConv(
1086
+ tiledeskToken,
1087
+ project_id,
1088
+ conversationId,
1089
+ )
1090
+ } else {
1091
+ this.getProjectIdByConversationWith(conversationId)
1092
+ }
940
1093
  } else {
941
- this.getProjectIdByConversationWith(conversationId)
1094
+ this.conversationsHandlerService.archiveConversation(conversationId)
942
1095
  }
943
- } else {
944
- this.conversationsHandlerService.archiveConversation(conversationId)
945
1096
  }
946
1097
  }
947
1098
 
948
1099
  getProjectIdByConversationWith(conversationId: string) {
949
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
950
-
951
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationId).subscribe(res => {
952
- this.logger.log('[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT RES', res);
953
-
954
- if (res) {
955
- const project_id = res.id_project
956
- this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id', project_id);
957
- this.archiveSupportGroupConv(tiledeskToken, project_id, conversationId);
958
- }
959
-
960
- }, (error) => {
961
- this.logger.error('[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error);
962
-
963
- }, () => {
964
- this.logger.log('[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *');
965
-
966
- });
1100
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1101
+
1102
+ this.tiledeskService
1103
+ .getProjectIdByConvRecipient(tiledeskToken, conversationId)
1104
+ .subscribe(
1105
+ (res) => {
1106
+ this.logger.log(
1107
+ '[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT RES',
1108
+ res,
1109
+ )
1110
+
1111
+ if (res) {
1112
+ const project_id = res.id_project
1113
+ this.logger.log(
1114
+ '[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id',
1115
+ project_id,
1116
+ )
1117
+ this.archiveSupportGroupConv(
1118
+ tiledeskToken,
1119
+ project_id,
1120
+ conversationId,
1121
+ )
1122
+ }
1123
+ },
1124
+ (error) => {
1125
+ this.logger.error(
1126
+ '[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT - ERROR ',
1127
+ error,
1128
+ )
1129
+ },
1130
+ () => {
1131
+ this.logger.log(
1132
+ '[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',
1133
+ )
1134
+ },
1135
+ )
967
1136
  }
968
1137
 
969
1138
  archiveSupportGroupConv(tiledeskToken, project_id, conversationId) {
970
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation projectId: ', project_id)
971
- this.tiledeskService.closeSupportGroup(tiledeskToken, project_id, conversationId).subscribe(res => {
972
- this.archiveActionNotAllowed = false;
973
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES', res);
974
- }, (error) => {
975
- this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ', error);
976
- this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.error.msg ', error.error.msg);
977
- this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.status ', error.status);
978
- if (error.error.msg === 'you dont belong to the project.') {
979
- this.archiveActionNotAllowed = true;
980
- }
981
- }, () => {
982
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *');
983
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ', this.conversations)
984
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ', this.conversations.length)
985
- });
1139
+ this.logger.log(
1140
+ '[CONVS-LIST-PAGE] - onCloseConversation projectId: ',
1141
+ project_id,
1142
+ )
1143
+ this.tiledeskService
1144
+ .closeSupportGroup(tiledeskToken, project_id, conversationId)
1145
+ .subscribe(
1146
+ (res) => {
1147
+ this.archiveActionNotAllowed = false
1148
+ this.logger.log(
1149
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES',
1150
+ res,
1151
+ )
1152
+ },
1153
+ (error) => {
1154
+ this.logger.error(
1155
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ',
1156
+ error,
1157
+ )
1158
+ this.logger.error(
1159
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.error.msg ',
1160
+ error.error.msg,
1161
+ )
1162
+ this.logger.error(
1163
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.status ',
1164
+ error.status,
1165
+ )
1166
+ if (error.error.msg === 'you dont belong to the project.') {
1167
+ this.archiveActionNotAllowed = true
1168
+ }
1169
+ },
1170
+ () => {
1171
+ this.logger.log(
1172
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *',
1173
+ )
1174
+ this.logger.log(
1175
+ '[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ',
1176
+ this.conversations,
1177
+ )
1178
+ this.logger.log(
1179
+ '[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ',
1180
+ this.conversations.length,
1181
+ )
1182
+ this.events.publish('conversationhasbeenclosed', conversationId)
1183
+ },
1184
+ )
986
1185
  }
987
1186
 
988
1187
  onCloseAlert($event) {
989
- this.logger.log('[CONVS-LIST-PAGE] - onCloseAlert ', $event);
990
- this.archiveActionNotAllowed = false;
1188
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseAlert ', $event)
1189
+ this.archiveActionNotAllowed = false
991
1190
  }
992
1191
 
993
1192
  public generateFake(count: number): Array<number> {
994
- const indexes = [];
1193
+ const indexes = []
995
1194
  for (let i = 0; i < count; i++) {
996
- indexes.push(i);
1195
+ indexes.push(i)
997
1196
  }
998
- return indexes;
1197
+ return indexes
999
1198
  }
1000
1199
 
1001
1200
  // ------------------------------------------------------------------
@@ -1011,7 +1210,6 @@ export class ConversationListPage implements OnInit {
1011
1210
  // this.logger.log('[CONVS-LIST-PAGE] openArchivedConversationsPage');
1012
1211
  // }
1013
1212
 
1014
-
1015
1213
  // // info page
1016
1214
  // returnCloseInfoPage() {
1017
1215
  // this.logger.log('[CONVS-LIST-PAGE] returnCloseInfoPage');
@@ -1020,7 +1218,6 @@ export class ConversationListPage implements OnInit {
1020
1218
 
1021
1219
  // }
1022
1220
 
1023
-
1024
1221
  // private navigatePage() {
1025
1222
  // this.logger.log('[CONVS-LIST-PAGE] navigatePage:: >>>> conversationSelected ', this.conversationSelected);
1026
1223
  // let urlPage = 'detail/';
@@ -1041,7 +1238,6 @@ export class ConversationListPage implements OnInit {
1041
1238
  // this.navService.openPage(urlPage, ConversationDetailPage, navigationExtras);
1042
1239
  // }
1043
1240
 
1044
-
1045
1241
  // openDetailsWithState(conversationSelected) {
1046
1242
  // console.log('openDetailsWithState:: >>>> conversationSelected ', conversationSelected);
1047
1243
  // let navigationExtras: NavigationExtras = {
@@ -1070,8 +1266,6 @@ export class ConversationListPage implements OnInit {
1070
1266
  // this.initialize();
1071
1267
  // }
1072
1268
 
1073
-
1074
-
1075
1269
  /**
1076
1270
  * ::: conversationsChanged :::
1077
1271
  * evento richiamato su add, change, remove dell'elenco delle conversazioni
@@ -1079,15 +1273,13 @@ export class ConversationListPage implements OnInit {
1079
1273
  * 2 - aggiorno il conto delle nuove conversazioni
1080
1274
  * 4 - se esiste un uidReciverFromUrl (passato nell'url)
1081
1275
  * e se esiste una conversazione con lo stesso id di uidReciverFromUrl
1082
- * imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
1276
+ * imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
1083
1277
  * e la carico nella pagina di dettaglio e azzero la variabile uidReciverFromUrl!!!
1084
1278
  * 5 - altrimenti se esiste una conversazione con lo stesso id della conversazione attiva
1085
- * e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
1279
+ * e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
1086
1280
  * (operazione da fare una sola volta al caricamento delle conversazioni)
1087
1281
  */
1088
1282
 
1089
-
1090
-
1091
1283
  // ------------------------------------------------------------------------------------
1092
1284
  // ::: readAllMessages ::: ??????????? SEEMS NOT USED ?????????????????
1093
1285
  // when all chat messages are displayed,