@chat21/chat21-ionic 3.0.63 → 3.0.65-rc1

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 (45) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/deploy_amazon_beta.sh +29 -0
  3. package/deploy_amazon_prod.sh +26 -0
  4. package/deploy_pre.sh +5 -44
  5. package/deploy_prod.sh +6 -54
  6. package/package.json +6 -1
  7. package/publiccode.yml +110 -0
  8. package/src/app/app.component.ts +50 -59
  9. package/src/app/app.module.ts +1 -0
  10. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
  11. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +0 -1
  12. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -39
  13. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +18 -6
  14. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +2 -2
  15. package/src/app/chatlib/conversation-detail/message/html/html.component.html +1 -0
  16. package/src/app/chatlib/conversation-detail/message/html/html.component.scss +79 -0
  17. package/src/app/chatlib/conversation-detail/message/html/html.component.spec.ts +25 -0
  18. package/src/app/chatlib/conversation-detail/message/html/html.component.ts +33 -0
  19. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
  20. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +0 -1
  21. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -1
  22. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +19 -0
  23. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
  24. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -2
  25. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
  26. package/src/app/directives/safe-html.pipe.ts +2 -2
  27. package/src/app/directives/truncate.pipe.spec.ts +8 -0
  28. package/src/app/directives/truncate.pipe.ts +16 -0
  29. package/src/app/pages/conversation-detail/conversation-detail.module.ts +3 -2
  30. package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
  31. package/src/app/pages/conversation-detail/conversation-detail.page.ts +12 -23
  32. package/src/app/pages/conversations-list/conversations-list.page.html +21 -12
  33. package/src/app/pages/conversations-list/conversations-list.page.ts +104 -366
  34. package/src/app/pages/loader-preview/loader-preview.module.ts +1 -2
  35. package/src/app/shared/shared.module.ts +4 -0
  36. package/src/assets/js/chat21client.js +1 -1
  37. package/src/{chat-config-mqtt-ver-uploaded.json → chat-config-mqtt-localhost.json} +10 -6
  38. package/src/chat-config-mqtt.json +18 -28
  39. package/src/chat-config-native-mqtt.json +30 -0
  40. package/src/chat-config-pre.json +9 -13
  41. package/src/chat21-core/models/conversation.ts +1 -1
  42. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +1 -1
  43. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +65 -9
  44. package/src/chat21-core/utils/utils-message.ts +5 -6
  45. package/src/chat-config-pre-test.json +0 -37
@@ -138,25 +138,14 @@ export class ConversationListPage implements OnInit {
138
138
  this.setUidConvSelected(IDConv, 'active')
139
139
  }
140
140
  if (!IDConv) {
141
- this.logger.log(
142
- '[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select',
143
- )
141
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select',)
144
142
 
145
143
  const chatTabCount = +localStorage.getItem('tabCount')
146
- this.logger.log(
147
- '[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ',
148
- chatTabCount,
149
- )
144
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ',chatTabCount,)
150
145
  if (chatTabCount && chatTabCount > 0) {
151
- this.logger.log(
152
- '[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ',
153
- chatTabCount,
154
- )
146
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ',chatTabCount)
155
147
  if (checkPlatformIsMobile()) {
156
- this.logger.log(
157
- '[CONVS-LIST-PAGE] - the chat is in mobile mode ',
158
- checkPlatformIsMobile(),
159
- )
148
+ this.logger.log('[CONVS-LIST-PAGE] - the chat is in mobile mode ',checkPlatformIsMobile())
160
149
  this.events.publish('noparams:mobile', true)
161
150
  }
162
151
  }
@@ -179,46 +168,6 @@ export class ConversationListPage implements OnInit {
179
168
  ngOnInit() {
180
169
  this.watchToConnectionStatus()
181
170
  this.getAppConfigToHideDiplayBtns()
182
-
183
- // const currentUrl = this.router.url;
184
- // this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
185
- // this.route.queryParams.subscribe(params => {
186
- // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
187
- // if (params && params.convId) {
188
- // console.log('[CONVS-LIST-PAGE] ngOnInit params convId:', params.convId);
189
-
190
- // const conversationSelected = this.conversations.find(item => item.uid === params.convId);
191
- // if (conversationSelected) {
192
- // this.conversationSelected = conversationSelected;
193
- // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
194
- // setTimeout(() => {
195
- // // this.navigateByUrl('active', params.convId)
196
- // }, 0);
197
- // }
198
-
199
- // } else {
200
- // console.log('[CONVS-LIST-PAGE] ngOnInit params No convId Params ');
201
- // }
202
- // if (params && params.contact_id && params.contact_fullname) {
203
- // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
204
- // setTimeout(() => {
205
- // this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
206
- // }, 0);
207
- // this.uidConvSelected = params.contact_id
208
- // } else {
209
- // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No contact_id and contact_fullname Params ');
210
- // }
211
-
212
- // if (params && params.conversation_detail) {
213
- // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
214
- // setTimeout(() => {
215
- // this.router.navigateByUrl('conversation-detail/');
216
- // }, 0);
217
- // } else {
218
- // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No conversation_detail Params ');
219
- // }
220
-
221
- // });
222
171
  }
223
172
 
224
173
  ngOnChanges() {
@@ -230,15 +179,6 @@ export class ConversationListPage implements OnInit {
230
179
  this.logger.log('[CONVS-LIST-PAGE] getConversationListHeight scrollbar2element', scrollbar2element)
231
180
  }
232
181
 
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
- // }
241
-
242
182
  getAppConfigToHideDiplayBtns() {
243
183
  const appConfig = this.appConfigProvider.getConfig()
244
184
  // console.log('[CONVS-LIST-PAGE] - appConfig ', appConfig)
@@ -266,7 +206,6 @@ export class ConversationListPage implements OnInit {
266
206
  this.writeto_btn = false;
267
207
  this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
268
208
  }
269
- // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
270
209
  }
271
210
 
272
211
  watchToConnectionStatus() {
@@ -285,10 +224,7 @@ export class ConversationListPage implements OnInit {
285
224
 
286
225
  ionViewWillEnter() {
287
226
  this.logger.log('Called ionViewDidEnter')
288
- this.logger.log(
289
- '[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected',
290
- this.uidConvSelected,
291
- )
227
+ this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected',this.uidConvSelected )
292
228
  this.listnerStart()
293
229
 
294
230
  // exit from app with hardware back button
@@ -313,29 +249,18 @@ export class ConversationListPage implements OnInit {
313
249
  openUnsevedConversationIframe(event) {
314
250
  this.logger.log('[CONVS-LIST-PAGE] openUnsevedConversationIframe ', event)
315
251
  this.hasClickedOpenUnservedConvIframe = true
316
- this.logger.log(
317
- '[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME',
318
- this.hasClickedOpenUnservedConvIframe,
319
- )
252
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME',this.hasClickedOpenUnservedConvIframe )
320
253
  const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl
321
254
  // http://localhost:4204/#/projects-for-panel
322
255
  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'
256
+ this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel'
328
257
 
329
258
  if (event === 'pinbtn') {
330
259
  this.IFRAME_URL = this.PROJECTS_FOR_PANEL_URL
331
260
  } else {
332
261
  this.IFRAME_URL = this.UNASSIGNED_CONVS_URL
333
262
  }
334
-
335
- this.logger.log(
336
- '[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL',
337
- this.UNASSIGNED_CONVS_URL,
338
- )
263
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL',this.UNASSIGNED_CONVS_URL )
339
264
  this.openUnassignedConversations(this.IFRAME_URL, event)
340
265
  }
341
266
 
@@ -360,10 +285,7 @@ export class ConversationListPage implements OnInit {
360
285
  try {
361
286
  closeModal(this.modalController)
362
287
  } catch (err) {
363
- this.logger.error(
364
- '[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
365
- err,
366
- )
288
+ this.logger.error( '[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err)
367
289
  }
368
290
  }
369
291
 
@@ -372,46 +294,23 @@ export class ConversationListPage implements OnInit {
372
294
  const that = this
373
295
  if (navigator && navigator.serviceWorker) {
374
296
  navigator.serviceWorker.addEventListener('message', function (event) {
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
- )
297
+ that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ', event.data)
298
+ that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ', event.data['data'] )
299
+ that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ', typeof event.data['data'] )
387
300
  let uidConvSelected = ''
388
301
  if (event.data && event.data['conversWith']) {
389
302
  uidConvSelected = event.data['conversWith']
390
303
  } else {
391
- that.logger.log(
392
- '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG',
393
- )
304
+ that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG',)
394
305
  return
395
306
  }
396
307
 
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
- )
308
+ that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ', uidConvSelected )
309
+ that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ', that.conversations)
310
+ const conversationSelected = that.conversations.find((item) => item.uid === uidConvSelected)
408
311
  if (conversationSelected) {
409
312
  that.conversationSelected = conversationSelected
410
- that.logger.log(
411
- '[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ',
412
- that.conversationSelected,
413
- )
414
-
313
+ that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ', that.conversationSelected )
415
314
  that.navigateByUrl('active', uidConvSelected)
416
315
  }
417
316
  })
@@ -420,23 +319,16 @@ export class ConversationListPage implements OnInit {
420
319
 
421
320
  private listnerStart() {
422
321
  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
- )
322
+ this.chatManager.BSStart.pipe(takeUntil(that.unsubscribe$)).subscribe((data: any) => {
323
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data)
429
324
  if (data) {
430
325
  that.initialize()
431
326
  }
432
- },
433
- (error) => {
327
+ },(error) => {
434
328
  this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error)
435
- },
436
- () => {
329
+ },() => {
437
330
  this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
438
- },
439
- )
331
+ })
440
332
  }
441
333
 
442
334
  // ------------------------------------------------------------------ //
@@ -444,7 +336,7 @@ export class ConversationListPage implements OnInit {
444
336
  // ------------------------------------------------------------------ //
445
337
  initConversationsHandler() {
446
338
  this.conversations = this.conversationsHandlerService.conversations
447
- this.logger.log('[CONVS-LIST-PAGE] - CONVERSATIONS ', this.conversations)
339
+ this.logger.log('[CONVS-LIST-PAGE] - CONVERSATIONS ', this.conversations.length, this.conversations)
448
340
  // save conversationHandler in chatManager
449
341
  this.chatManager.setConversationsHandler(this.conversationsHandlerService)
450
342
  this.showPlaceholder = false
@@ -452,36 +344,22 @@ export class ConversationListPage implements OnInit {
452
344
 
453
345
  initArchivedConversationsHandler() {
454
346
  const keysConversation = ['CLOSED', 'Resolve']
455
- this.translationMapConversation = this.translateService.translateLanguage(
456
- keysConversation,
457
- )
347
+ this.translationMapConversation = this.translateService.translateLanguage( keysConversation )
458
348
 
459
349
  this.archivedConversationsHandlerService.subscribeToConversations(() => {
460
- this.logger.log(
461
- '[CONVS-LIST-PAGE]-CONVS - conversations archived length ',
462
- this.archivedConversations.length,
463
- )
350
+ this.logger.log('[CONVS-LIST-PAGE]-CONVS - conversations archived length ',this.archivedConversations.length)
464
351
  })
465
352
 
466
353
  this.archivedConversations = this.archivedConversationsHandlerService.archivedConversations
467
- this.logger.log(
468
- '[CONVS-LIST-PAGE] archived conversation',
469
- this.archivedConversations,
470
- )
354
+ this.logger.log('[CONVS-LIST-PAGE] archived conversation',this.archivedConversations )
471
355
 
472
356
  // save archivedConversationsHandlerService in chatManager
473
357
  this.chatManager.setArchivedConversationsHandler(
474
358
  this.archivedConversationsHandlerService,
475
359
  )
476
360
 
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
- ) {
361
+ this.logger.log('[CONVS-LIST-PAGE]-CONVS SubscribeToConversations - conversations archived length ', this.archivedConversations.length )
362
+ if (!this.archivedConversations || this.archivedConversations.length === 0 ) {
485
363
  this.loadingIsActive = false
486
364
  }
487
365
  }
@@ -494,26 +372,17 @@ export class ConversationListPage implements OnInit {
494
372
  // - for the direct conversation
495
373
  // ----------------------------------------------------------------------------------------------------
496
374
  listenToAppCompConvsLengthOnInitConvs() {
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
- )
375
+ this.events.subscribe( 'appcompSubscribeToConvs:loadingIsActive', (loadingIsActive) => {
376
+ this.logger.log( '[CONVS-LIST-PAGE]-CONVS loadingIsActive', loadingIsActive)
377
+ if (loadingIsActive === false) {
378
+ this.loadingIsActive = false
379
+ }
380
+ })
509
381
  }
510
382
 
511
383
  listenGoOnline() {
512
384
  this.events.subscribe('go:online', (goonline) => {
513
- this.logger.info(
514
- '[CONVS-LIST-PAGE] - listen To go:online - goonline',
515
- goonline,
516
- )
385
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline',goonline)
517
386
  // this.events.unsubscribe('profileInfoButtonClick:logout')
518
387
  if (goonline === true) {
519
388
  this.displayNewConvsItem = true
@@ -523,10 +392,7 @@ export class ConversationListPage implements OnInit {
523
392
 
524
393
  listenGoOffline() {
525
394
  this.events.subscribe('go:offline', (offline) => {
526
- this.logger.info(
527
- '[CONVS-LIST-PAGE] - listen To go:offline - offline',
528
- offline,
529
- )
395
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline',offline)
530
396
  // this.events.unsubscribe('profileInfoButtonClick:logout')
531
397
  if (offline === true) {
532
398
  this.displayNewConvsItem = false
@@ -535,31 +401,19 @@ export class ConversationListPage implements OnInit {
535
401
  }
536
402
 
537
403
  listenToLogoutEvent() {
538
- this.events.subscribe(
539
- 'profileInfoButtonClick:logout',
540
- (hasclickedlogout) => {
541
- this.logger.info(
542
- '[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout',
543
- hasclickedlogout,
544
- )
404
+ this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
405
+ this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout',hasclickedlogout)
545
406
 
546
407
  this.conversations = []
547
408
  this.conversationsHandlerService.conversations = []
548
409
  this.uidConvSelected = null
549
410
 
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
- )
411
+ this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - CONVERSATIONS ', this.conversations )
412
+ this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - uidConvSelected ', this.uidConvSelected )
558
413
  if (hasclickedlogout === true) {
559
414
  this.loadingIsActive = false
560
415
  }
561
- },
562
- )
416
+ })
563
417
  }
564
418
 
565
419
  // ------------------------------------------------------------------
@@ -592,50 +446,36 @@ export class ConversationListPage implements OnInit {
592
446
  // this.readAllMessages(conversationId);
593
447
  // });
594
448
 
595
- this.conversationsHandlerService.conversationAdded.subscribe(
596
- (conversation: ConversationModel) => {
449
+ this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
597
450
  // this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
598
451
  // that.conversationsChanged(conversations);
599
452
  if (conversation) {
600
453
  this.onImageLoaded(conversation)
601
454
  this.onConversationLoaded(conversation)
602
455
  }
603
- },
604
- )
456
+ })
605
457
 
606
- this.conversationsHandlerService.conversationChanged.subscribe(
607
- (conversation: ConversationModel) => {
458
+ this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
608
459
  // this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
609
460
  // that.conversationsChanged(conversations)
610
461
  if (conversation) {
611
462
  this.onImageLoaded(conversation)
612
463
  this.onConversationLoaded(conversation)
613
464
  }
614
- },
615
- )
465
+ })
616
466
 
617
- this.conversationsHandlerService.conversationRemoved.subscribe(
618
- (conversation: ConversationModel) => {
619
- this.logger.log(
620
- '[CONVS-LIST-PAGE] ***** conversationsRemoved *****',
621
- conversation,
622
- )
623
- },
624
- )
467
+ this.conversationsHandlerService.conversationRemoved.subscribe((conversation: ConversationModel) => {
468
+ this.logger.log('[CONVS-LIST-PAGE] ***** conversationsRemoved *****',conversation)
469
+ })
625
470
 
626
- this.archivedConversationsHandlerService.archivedConversationAdded.subscribe(
627
- (conversation: ConversationModel) => {
628
- this.logger.log(
629
- '[CONVS-LIST-PAGE] ***** archivedConversationAdded *****',
630
- conversation,
631
- )
471
+ this.archivedConversationsHandlerService.archivedConversationAdded.subscribe((conversation: ConversationModel) => {
472
+ this.logger.log('[CONVS-LIST-PAGE] ***** archivedConversationAdded *****',conversation)
632
473
  // that.conversationsChanged(conversations);
633
474
  if (conversation) {
634
475
  this.onImageLoaded(conversation)
635
476
  this.onConversationLoaded(conversation)
636
477
  }
637
- },
638
- )
478
+ })
639
479
  }
640
480
 
641
481
  // ------------------------------------------------------------------------------------
@@ -644,14 +484,8 @@ export class ConversationListPage implements OnInit {
644
484
  subscribeLoggedUserLogout = () => {
645
485
  this.conversations = []
646
486
  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
- )
487
+ this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout conversations ',this.conversations)
488
+ this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ',this.uidConvSelected)
655
489
  }
656
490
 
657
491
  // ------------------------------------------------------------------------------------
@@ -659,15 +493,10 @@ export class ConversationListPage implements OnInit {
659
493
  // ------------------------------------------------------------------------------------
660
494
  conversationsChanged = (conversations: ConversationModel[]) => {
661
495
  this.numberOpenConv = this.conversationsHandlerService.countIsNew()
662
- this.logger.log(
663
- '[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ',
664
- this.numberOpenConv,
665
- )
496
+ this.logger.log('[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ',this.numberOpenConv)
666
497
  // console.log('conversationsChanged »»»»»»»»» uidConvSelected', that.conversations[0], that.uidConvSelected);
667
498
  if (this.uidConvSelected && !this.conversationSelected) {
668
- const conversationSelected = this.conversations.find(
669
- (item) => item.uid === this.uidConvSelected,
670
- )
499
+ const conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
671
500
  if (conversationSelected) {
672
501
  this.conversationSelected = conversationSelected
673
502
  this.setUidConvSelected(this.uidConvSelected)
@@ -684,26 +513,13 @@ export class ConversationListPage implements OnInit {
684
513
  // !!!!!! IS USED? ?????
685
514
  // ------------------------------
686
515
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
687
- this.logger.log(
688
- '[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl',
689
- user,
690
- type,
691
- )
516
+ this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl',user, type)
692
517
  this.uidConvSelected = user.uid
693
- this.logger.log(
694
- '[CONVS-LIST-PAGE] ************** uidConvSelected ',
695
- this.uidConvSelected,
696
- )
518
+ this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected)
697
519
  // this.conversationsHandlerService.uidConvSelected = user.uid;
698
- const conversationSelected = this.conversations.find(
699
- (item) => item.uid === this.uidConvSelected,
700
- )
520
+ const conversationSelected = this.conversations.find( (item) => item.uid === this.uidConvSelected)
701
521
  if (conversationSelected) {
702
- this.logger.log(
703
- '[CONVS-LIST-PAGE] --> uidConvSelected: ',
704
- this.conversationSelected,
705
- this.uidConvSelected,
706
- )
522
+ this.logger.log('[CONVS-LIST-PAGE] --> uidConvSelected: ',this.conversationSelected, this.uidConvSelected)
707
523
  this.conversationSelected = conversationSelected
708
524
  }
709
525
  // this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
@@ -714,10 +530,7 @@ export class ConversationListPage implements OnInit {
714
530
  * evento richiamato quando si seleziona bottone profile-info-modal
715
531
  */
716
532
  subscribeProfileInfoButtonClicked = (event: string) => {
717
- this.logger.log(
718
- '[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ',
719
- event,
720
- )
533
+ this.logger.log('[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ', event)
721
534
  if (event === 'displayArchived') {
722
535
  this.initArchivedConversationsHandler()
723
536
  // this.openArchivedConversationsModal()
@@ -727,15 +540,11 @@ export class ConversationListPage implements OnInit {
727
540
  const keys = ['LABEL_ARCHIVED']
728
541
  // const keys = ['History'];
729
542
 
730
- this.headerTitle = this.translateService
731
- .translateLanguage(keys)
732
- .get(keys[0])
543
+ this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0])
733
544
  } else if (event === 'displayContact') {
734
545
  this.conversationType = 'archived'
735
546
  const keys = ['LABEL_CONTACTS']
736
- this.headerTitle = this.translateService
737
- .translateLanguage(keys)
738
- .get(keys[0])
547
+ this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0])
739
548
  }
740
549
  }
741
550
 
@@ -783,10 +592,7 @@ export class ConversationListPage implements OnInit {
783
592
  initialize() {
784
593
  const appconfig = this.appConfigProvider.getConfig()
785
594
  this.tenant = appconfig.firebaseConfig.tenant
786
- this.logger.log(
787
- '[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ',
788
- this.tenant,
789
- )
595
+ this.logger.log('[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ',this.tenant)
790
596
 
791
597
  if (this.tiledeskAuthService.getCurrentUser()) {
792
598
  this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid
@@ -813,22 +619,18 @@ export class ConversationListPage implements OnInit {
813
619
  // It only works on BSStart.subscribe! it is useful or can be eliminated
814
620
  // --------------------------------------------------------
815
621
  initVariables() {
816
- this.logger.log(
817
- '[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl,
818
- )
622
+ this.logger.log('[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl)
819
623
  this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid)
820
624
  this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant)
821
625
  if (this.route.component['name'] !== 'ConversationListPage') {
822
626
  if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
823
627
  const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv')
628
+ const convType = this.route.snapshot.firstChild.paramMap.get('Convtype')
824
629
  this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv)
825
630
  if (IDConv) {
826
- this.setUidConvSelected(IDConv)
631
+ this.setUidConvSelected(IDConv, convType)
827
632
  } else {
828
- this.logger.log(
829
- '[CONVS-LIST-PAGE] conversationWith 2 (else): ',
830
- IDConv,
831
- )
633
+ this.logger.log('[CONVS-LIST-PAGE] conversationWith 2 (else): ',IDConv)
832
634
  }
833
635
  }
834
636
  }
@@ -846,9 +648,11 @@ export class ConversationListPage implements OnInit {
846
648
  let conversationSelected
847
649
  if (conversationType === 'active') {
848
650
  conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
849
- } else if (conversationType === 'archived') { conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected) }
651
+ } else if (conversationType === 'archived') {
652
+ conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected)
653
+ }
850
654
  if (conversationSelected) {
851
- this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected,)
655
+ this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected)
852
656
  this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded')
853
657
  this.conversationSelected = conversationSelected
854
658
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected)
@@ -882,9 +686,7 @@ export class ConversationListPage implements OnInit {
882
686
  conversation_with_fullname = conversation.recipient_fullname
883
687
  }
884
688
  if (!conversation_with.startsWith('support-group')) {
885
- conversation.image = this.imageRepoService.getImagePhotoUrl(
886
- conversation_with,
887
- )
689
+ conversation.image = this.imageRepoService.getImagePhotoUrl(conversation_with)
888
690
  }
889
691
  }
890
692
 
@@ -1048,29 +850,18 @@ export class ConversationListPage implements OnInit {
1048
850
  this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
1049
851
 
1050
852
  const conversationWith_segments = conversationId.split('-')
1051
- this.logger.log(
1052
- '[CONVS-LIST-PAGE] - conversationId_segments: ',
1053
- conversationWith_segments,
1054
- )
853
+ this.logger.log('[CONVS-LIST-PAGE] - conversationId_segments: ',conversationWith_segments)
1055
854
 
1056
855
  // Removes the last element of the array if is = to the separator
1057
- if (
1058
- conversationWith_segments[conversationWith_segments.length - 1] === ''
1059
- ) {
856
+ if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
1060
857
  conversationWith_segments.pop()
1061
858
  }
1062
859
 
1063
860
  if (conversationWith_segments.length === 4) {
1064
861
  const lastArrayElement =
1065
862
  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
- )
863
+ this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement ',lastArrayElement)
864
+ this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement length',lastArrayElement.length)
1074
865
  if (lastArrayElement.length !== 32) {
1075
866
  conversationWith_segments.pop()
1076
867
  }
@@ -1082,11 +873,7 @@ export class ConversationListPage implements OnInit {
1082
873
  project_id = conversationWith_segments[2]
1083
874
 
1084
875
  const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1085
- this.archiveSupportGroupConv(
1086
- tiledeskToken,
1087
- project_id,
1088
- conversationId,
1089
- )
876
+ this.archiveSupportGroupConv(tiledeskToken,project_id,conversationId,)
1090
877
  } else {
1091
878
  this.getProjectIdByConversationWith(conversationId)
1092
879
  }
@@ -1099,89 +886,40 @@ export class ConversationListPage implements OnInit {
1099
886
  getProjectIdByConversationWith(conversationId: string) {
1100
887
  const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1101
888
 
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
- )
889
+ this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationId).subscribe((res) => {
890
+ this.logger.log('[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT RES',res)
1110
891
 
1111
892
  if (res) {
1112
893
  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
- )
894
+ this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id',project_id)
895
+ this.archiveSupportGroupConv(tiledeskToken,project_id,conversationId)
1122
896
  }
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
- )
897
+ },(error) => {
898
+ this.logger.error('[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT - ERROR ',error)
899
+ },() => {
900
+ this.logger.log('[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
901
+ })
1136
902
  }
1137
903
 
1138
904
  archiveSupportGroupConv(tiledeskToken, project_id, conversationId) {
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
- )
905
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation projectId: ',project_id)
906
+ this.tiledeskService.closeSupportGroup(tiledeskToken, project_id, conversationId).subscribe((res) => {
907
+ this.archiveActionNotAllowed = false
908
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES',res)
909
+ },(error) => {
910
+ this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ',error)
911
+ this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.error.msg ',error.error.msg)
912
+ this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.status ',error.status)
913
+ if (error.error.msg === 'you dont belong to the project.') {
914
+ this.archiveActionNotAllowed = true
915
+ }
916
+ },() => {
917
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *')
918
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ',this.conversations)
919
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ',this.conversations.length)
920
+ this.events.publish('conversationhasbeenclosed', conversationId)
921
+ this.navigateByUrl('archived', conversationId)
922
+ })
1185
923
  }
1186
924
 
1187
925
  onCloseAlert($event) {