@chat21/chat21-ionic 3.0.64-rc1 → 3.0.64

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 (37) hide show
  1. package/CHANGELOG.md +2 -5
  2. package/deploy_amazon_beta.sh +29 -0
  3. package/deploy_amazon_prod.sh +25 -0
  4. package/deploy_pre.sh +6 -78
  5. package/deploy_prod.sh +6 -57
  6. package/package.json +1 -6
  7. package/src/app/app.component.ts +57 -45
  8. package/src/app/app.module.ts +0 -1
  9. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
  10. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +1 -0
  11. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +39 -2
  12. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +6 -18
  13. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +2 -2
  14. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
  15. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -2
  16. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
  17. package/src/app/directives/safe-html.pipe.ts +2 -2
  18. package/src/app/pages/conversation-detail/conversation-detail.page.html +2 -4
  19. package/src/app/pages/conversation-detail/conversation-detail.page.ts +23 -12
  20. package/src/app/pages/conversations-list/conversations-list.page.html +12 -21
  21. package/src/app/pages/conversations-list/conversations-list.page.ts +191 -58
  22. package/src/app/pages/loader-preview/loader-preview.module.ts +2 -1
  23. package/src/app/shared/shared.module.ts +0 -4
  24. package/src/assets/js/chat21client.js +1 -1
  25. package/src/{chat-config-mqtt-ver-uploaded.json → chat-config-mqtt-localhost.json} +10 -6
  26. package/src/chat-config-mqtt.json +18 -28
  27. package/src/chat-config-native-mqtt.json +30 -0
  28. package/src/chat-config-pre.json +9 -13
  29. package/src/chat21-core/models/conversation.ts +1 -1
  30. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +1 -1
  31. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +8 -47
  32. package/src/chat21-core/utils/utils-message.ts +3 -2
  33. package/src/app/chatlib/conversation-detail/message/html/html.component.html +0 -1
  34. package/src/app/chatlib/conversation-detail/message/html/html.component.scss +0 -79
  35. package/src/app/chatlib/conversation-detail/message/html/html.component.spec.ts +0 -25
  36. package/src/app/chatlib/conversation-detail/message/html/html.component.ts +0 -33
  37. package/src/chat-config-pre-test.json +0 -37
package/CHANGELOG.md CHANGED
@@ -1,10 +1,7 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
- ### 3.0.64-rc1
3
+ ### 3.0.64
4
4
  - Fixes the bug: in the conversation list, for the direct convesations, the name of the requester changes according to the order of arrival of the conversations
5
- - Displays balloon messages with a light orange background for "internal notes" type message
6
- - Adds the html component
7
- - Improves chat performance by caching conversations
8
5
 
9
6
  ### 3.0.63
10
7
  - Deploys in production
@@ -22,7 +19,7 @@
22
19
  - Fixes the bug: images that are not in the database cannot be downloaded
23
20
  - Adds default chat color to emojis picker tabs
24
21
  - Fixes the bug: the selected conversation is undefined
25
- - Fixes the bug: in the conversation list, for the support convesations, the name of the requester changes according to the order of arrival of the conversations
22
+ - Fixes the bug: in the conversation list, the name of the requester changes according to the order of arrival of the conversations
26
23
 
27
24
  ### 3.0.62.3
28
25
  - Fixes the bug: the method setTyping fired twice after that a message is sent
@@ -0,0 +1,29 @@
1
+ #npm version prerelease --preid=beta
2
+ version=`node -e 'console.log(require("./package.json").version)'`
3
+ echo "version $version"
4
+
5
+ URL_VER=${version//[.]//}
6
+ echo 'URL_VER: ---->'$URL_VER
7
+
8
+ sed -i -e "s/$URL_VER/g" src/utils/constants.ts
9
+
10
+ # ng build --prod --base-href /$NEW_BUILD/
11
+ #ionic cordova build browser --prod
12
+
13
+ ionic cordova platform add browser --save
14
+ #ionic cordova build browser --prod --release
15
+ ionic cordova build --env=pre browser #--prod --verbose
16
+
17
+ cp -p src/firebase-messaging-sw.js platforms/browser/www/
18
+ cp -p src/manifest.json platforms/browser/www/
19
+ cp -p src/chat-config.json platforms/browser/www/
20
+
21
+ cd platforms/browser/www
22
+ aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/$version/
23
+ aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/
24
+ cd ../../../
25
+
26
+ #aws cloudfront create-invalidation --distribution-id E13L8CUUKUWAJF --paths "/*"
27
+
28
+ echo new version deployed on s3://tiledesk-dashboard-pre/chat-ionic5/$version/
29
+ echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5/$version/index.html
@@ -0,0 +1,25 @@
1
+ # npm version patch
2
+ version=`node -e 'console.log(require("./package.json").version)'`
3
+ echo "version $version"
4
+
5
+ URL_VER=${version//[.]//}
6
+ echo 'URL_VER: ---->'$URL_VER
7
+
8
+ # sed -i -e "s/$start$ver.$build/$start$NEW_VER.$NEW_BUILD/g" src/utils/constants.ts
9
+ sed -i -e "s/$URL_VER/g" src/utils/constants.ts
10
+ ionic cordova platform add browser --save
11
+ #ionic cordova build --env=prod browser -- --base-href /www/ --prod
12
+ ionic cordova build --env=prod browser --prod
13
+ cp -p src/firebase-messaging-sw.js platforms/browser/www/
14
+ cp -p src/manifest.json platforms/browser/www/
15
+ cp -p src/chat-config.json platforms/browser/www/
16
+
17
+ cd platforms/browser/www
18
+ aws s3 sync . s3://tiledesk-console/v2/chat/
19
+ # aws s3 sync . s3://tiledesk-console/v2/chat/$version/
20
+ cd ../../../
21
+ # aws cloudfront create-invalidation --distribution-id E36UIP90GOSFPM --paths "/*"
22
+
23
+ # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
24
+ echo new version deployed on s3://tiledesk-console/v2/chat-ionic5/$version/
25
+ echo available on https://console.tiledesk.com/v2/chat-ionic5/$version/index.html
package/deploy_pre.sh CHANGED
@@ -1,83 +1,11 @@
1
- # environment=$(< src/utils/constants.ts)
2
- # start="CURR_VER_PROD = '0."
3
- # end="'"
4
- # one=${environment#*$start}
5
- # build=${one%%$end*} #two=${one%,*} -> %% prendo la prima istanza; % prendo la seconda
6
- # NEW_BUILD=$(($build + 1))
7
- # sed -i -e "s/$start$build/$start$NEW_BUILD/g" src/utils/constants.ts
8
-
9
1
  #npm version prerelease --preid=beta
10
2
  version=`node -e 'console.log(require("./package.json").version)'`
11
3
  echo "version $version"
12
4
 
13
- URL_VER=${version//[.]//}
14
- echo 'URL_VER: ---->'$URL_VER
15
-
16
- # if [ "$version" != "" ]; then
17
- # git tag -a "v$version" -m "`git log -1 --format=%s`"
18
- # echo "Created a new tag, v$version"
19
- # git push --tags
20
- # npm publish
21
- # fi
22
-
23
- sed -i -e "s/$URL_VER/g" src/utils/constants.ts
24
-
25
- # ng build --prod --base-href /$NEW_BUILD/
26
- #ionic cordova build browser --prod
27
-
28
- ionic cordova platform add browser --save
29
- #ionic cordova build browser --prod --release
30
- # ionic cordova build --env=pre browser --prod #--verbose
31
- ionic cordova build -c=pre browser --prod
32
- cp -p src/firebase-messaging-sw.js platforms/browser/www/
33
- cp -p src/manifest.json platforms/browser/www/
34
- cp -p src/chat-config.json platforms/browser/www/
35
- # cp -p config.xml platforms/browser/www/
36
-
37
- ######### chat-ionic5 - the good one - publish in pre
38
- cd platforms/browser/www
39
- aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/$version/
40
- aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/
41
- cd ../../../
42
-
43
- aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
44
-
45
- echo new version deployed on s3://tiledesk-dashboard-pre/chat-ionic5/$version/
46
- echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5/$version/index.html
47
- echo available on https://support-pre.tiledesk.com/chat-ionic5/$version/index.html
48
- echo available on https://support-pre.tiledesk.com/chat-ionic5/index.html
49
-
50
- ######### chat-ionic5-panel - publish in pre with the projects right panel
51
- # cd platforms/browser/www
52
- # aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5-panel/$version/
53
- # aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5-panel/
54
- # cd ../../../
55
-
56
- # aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
57
-
58
- # echo new version deployed on s3://tiledesk-dashboard-pre/chat-ionic5-panel/$version/
59
- # echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5-panel/$version/index.html
60
- # echo available on https://support-pre.tiledesk.com/chat-ionic5-panel/$version/index.html
61
- # echo available on https://support-pre.tiledesk.com/chat-ionic5-panel/index.html
62
-
63
-
64
- ####### chat ionic MQTT in pre da aggiungere in deploy_pre.sh
65
- # cd platforms/browser/www
66
- # aws s3 sync . s3://tiledesk-dashboard-pre/native-mqtt/chat-ionic5/
67
- # aws s3 sync . s3://tiledesk-dashboard-pre/native-mqtt/chat-ionic5/$version
68
- # cd ../../../
69
- # echo new version deployed on s3://tiledesk-dashboard-pre/native-mqtt/chat-ionic5/
70
- # echo new version deployed on s3://tiledesk-dashboard-pre/native-mqtt/chat-ionic5/$version
71
- # echo http://tiledesk-dashboard-pre.s3-eu-west-1.amazonaws.com/native-mqtt/chat-ionic5/index.html
72
- # echo http://tiledesk-dashboard-pre.s3-eu-west-1.amazonaws.com/native-mqtt/chat-ionic5/$version/index.html
73
-
5
+ if [ "$version" != "" ]; then
6
+ git tag -a "v$version" -m "`git log -1 --format=%s`"
7
+ echo "Created a new tag, v$version"
8
+ git push --tags
9
+ npm publish
10
+ fi
74
11
 
75
- ####### chat ionic FIREBASE in pre da aggiungere in deploy_pre.sh
76
- # cd platforms/browser/www
77
- # aws s3 sync . s3://tiledesk-dashboard-pre/chat5/
78
- # aws s3 sync . s3://tiledesk-dashboard-pre/chat5/$version
79
- # cd ../../../
80
- # echo new version deployed on s3://tiledesk-dashboard-pre/chat5/$version
81
- # echo new version deployed on s3://tiledesk-dashboard-pre/chat5/
82
- # echo available on http://support-pre.tiledesk.com/chat5/index.html
83
- # echo available on http://support-pre.tiledesk.com/chat5/$version/index.html
package/deploy_prod.sh CHANGED
@@ -2,61 +2,10 @@
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
- URL_VER=${version//[.]//}
6
- echo 'URL_VER: ---->'$URL_VER
5
+ if [ "$version" != "" ]; then
6
+ git tag -a "$version" -m "`git log -1 --format=%s`"
7
+ echo "Created a new tag, $version"
8
+ git push --tags
9
+ npm publish
10
+ fi
7
11
 
8
- # if [ "$version" != "" ]; then
9
- # git tag -a "$version" -m "`git log -1 --format=%s`"
10
- # echo "Created a new tag, $version"
11
- # git push --tags
12
- # npm publish
13
- # fi
14
-
15
- sed -i -e "s/$URL_VER/g" src/utils/constants.ts
16
-
17
- ionic cordova platform add browser --save
18
- #ionic cordova build --env=prod browser -- --base-href /www/ --prod
19
- ionic cordova build --env=prod browser --prod
20
- cp -p src/firebase-messaging-sw.js platforms/browser/www/
21
- cp -p src/manifest.json platforms/browser/www/
22
- cp -p src/chat-config.json platforms/browser/www/
23
- cp -p config.xml platforms/browser/www/
24
-
25
-
26
- ###### CHAT in prod
27
- cd platforms/browser/www
28
- aws s3 sync . s3://tiledesk-console/v2/chat/
29
- aws s3 sync . s3://tiledesk-console/v2/chat/$version/
30
- echo new version deployed on s3://tiledesk-console/v2/chat/$version/
31
- echo available on https://console.tiledesk.com/v2/chat/$version/index.html
32
- echo available on https://console.tiledesk.com/v2/chat/index.html
33
-
34
-
35
- ###### CHAT in prod under latest
36
- # cd platforms/browser/www
37
- # aws s3 sync . s3://tiledesk-console/v2/chat/latest
38
- # echo available on https://console.tiledesk.com/v2/chat/latest/index.html
39
-
40
- ###### CHAT-IONIC5
41
- # cd platforms/browser/www
42
- # #aws s3 sync . s3://tiledesk-dashboard/chat/
43
- # aws s3 sync . s3://tiledesk-console/v2/chat-ionic5/
44
- # aws s3 sync . s3://tiledesk-console/v2/chat-ionic5/$version/
45
- # cd ../../../
46
- # # aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
47
-
48
- # # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
49
- # echo new version deployed on s3://tiledesk-console/v2/chat-ionic5/$version/
50
- # echo available on https://console.tiledesk.com/v2/chat-ionic5/$version/index.html
51
-
52
-
53
-
54
- ####### chat ionic FIREBASE in PROD IN SUBFOLDER
55
- # cd platforms/browser/www
56
- # aws s3 sync . s3://tiledesk-console/v2/chat5-dev/
57
- # aws s3 sync . s3://tiledesk-console/v2/chat5-dev/$version
58
- # cd ../../../
59
- # echo new version deployed on s3://console.tiledesk.com/v2/chat5-dev/$version
60
- # echo new version deployed on s3://console.tiledesk.com/v2/chat5-dev/
61
- # echo available on http://console.tiledesk.com/v2/chat5-dev/index.html
62
- # echo available on http://console.tiledesk.com/v2/chat5-dev/$version/index.html
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
+ "version": "3.0.64",
3
4
  "author": "Tiledesk SRL",
4
- "version": "3.0.64-rc1",
5
- "license": "AGPL-3.0",
6
5
  "homepage": "https://tiledesk.com/",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/Tiledesk/chat21-ionic"
10
- },
11
6
  "scripts": {
12
7
  "ng": "ng",
13
8
  "start": "ng serve",
@@ -90,7 +90,6 @@ export class AppComponent implements OnInit {
90
90
  private setTimeoutSound: any;
91
91
  private isTabVisible: boolean = true;
92
92
  private tabTitle: string;
93
- private setTimeoutConversationsEvent: any;
94
93
  private logger: LoggerService = LoggerInstance.getInstance();
95
94
  public toastMsgErrorWhileUnsubscribingFromNotifications: string;
96
95
  public toastMsgCloseToast: string;
@@ -342,6 +341,8 @@ export class AppComponent implements OnInit {
342
341
 
343
342
  if (event && event.data && event.data.action && event.data.parameter) {
344
343
  if (event.data.action === 'openJoinConversationModal') {
344
+ // console.log("[APP-COMP] message event action ", event.data.action);
345
+ // console.log("[APP-COMP] message event parameter ", event.data.parameter);
345
346
  this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
346
347
  }
347
348
  }
@@ -376,6 +377,7 @@ export class AppComponent implements OnInit {
376
377
 
377
378
  async presentAlertConfirmJoinRequest(requestid, calledby) {
378
379
  var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
380
+ // console.log("[APP-COMP] message event iframeWin ", iframeWin);
379
381
 
380
382
  const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
381
383
  input !== null && input.tagName === 'IFRAME';
@@ -393,10 +395,12 @@ export class AppComponent implements OnInit {
393
395
  role: 'cancel',
394
396
  cssClass: 'secondary',
395
397
  handler: (blah) => {
398
+ // console.log('Confirm Cancel: blah', blah);
396
399
  }
397
400
  }, {
398
401
  text: 'Ok',
399
402
  handler: () => {
403
+ // console.log('Confirm Okay');
400
404
 
401
405
  if (isIFrame(iframeWin) && iframeWin.contentWindow) {
402
406
  const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
@@ -416,12 +420,14 @@ export class AppComponent implements OnInit {
416
420
  signInWithCustomToken(token) {
417
421
  // this.isOnline = false;
418
422
  this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN token', token)
419
- this.tiledeskAuthService.signInWithCustomToken(token).then((user: any) => {
423
+ this.tiledeskAuthService.signInWithCustomToken(token)
424
+ .then((user: any) => {
420
425
  this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN AUTLOGIN user', user)
421
426
  this.messagingAuthService.createCustomToken(token)
422
- }).catch(error => {
427
+ })
428
+ .catch(error => {
423
429
  this.logger.error('[APP-COMP] SIGNINWITHCUSTOMTOKEN error::', error)
424
- })
430
+ })
425
431
  }
426
432
 
427
433
  /** */
@@ -571,6 +577,16 @@ export class AppComponent implements OnInit {
571
577
  this.translate.use('en');
572
578
  }
573
579
 
580
+ // this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
581
+ // let language;
582
+ // if (navigator.language.indexOf('-') !== -1) {
583
+ // language = navigator.language.substring(0, navigator.language.indexOf('-'));
584
+ // } else if (navigator.language.indexOf('_') !== -1) {
585
+ // language = navigator.language.substring(0, navigator.language.indexOf('_'));
586
+ // } else {
587
+ // language = navigator.language;
588
+ // }
589
+ // this.translate.use(language);
574
590
  }
575
591
 
576
592
 
@@ -645,6 +661,7 @@ export class AppComponent implements OnInit {
645
661
  updateStoredCurrentUser() {
646
662
  const storedCurrentUser = this.appStorageService.getItem('currentUser')
647
663
  const storedDshbrdUser = localStorage.getItem('user')
664
+
648
665
  this.logger.log('[APP-COMP] updateStoredCurrentUser - stored currentUser', storedCurrentUser)
649
666
  this.logger.log('[APP-COMP] updateStoredCurrentUser - stored dshbrdUser', storedDshbrdUser)
650
667
  if ((storedCurrentUser && storedCurrentUser !== 'undefined') && (storedDshbrdUser && storedDshbrdUser !== 'undefined')) {
@@ -661,6 +678,7 @@ export class AppComponent implements OnInit {
661
678
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
662
679
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
663
680
  }
681
+
664
682
  if (currentUser.firstname !== dshbrdUser.firstname) {
665
683
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
666
684
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
@@ -671,6 +689,7 @@ export class AppComponent implements OnInit {
671
689
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
672
690
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
673
691
  }
692
+
674
693
  if (currentUser.lastname !== dshbrdUser.lastname) {
675
694
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
676
695
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
@@ -681,6 +700,7 @@ export class AppComponent implements OnInit {
681
700
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
682
701
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
683
702
  }
703
+
684
704
  if (currentUser.avatar !== dshbrdUser.fullname_initial) {
685
705
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
686
706
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
@@ -691,6 +711,7 @@ export class AppComponent implements OnInit {
691
711
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
692
712
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
693
713
  }
714
+
694
715
  let fullname = ""
695
716
  if (dshbrdUser.firstname && !dshbrdUser.lastname) {
696
717
  fullname = dshbrdUser.firstname
@@ -698,6 +719,7 @@ export class AppComponent implements OnInit {
698
719
  fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
699
720
  this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
700
721
  }
722
+
701
723
  if (fullname !== currentUser.fullname) {
702
724
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
703
725
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
@@ -708,6 +730,7 @@ export class AppComponent implements OnInit {
708
730
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
709
731
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
710
732
  }
733
+
711
734
  this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
712
735
  this.tiledeskAuthService.setCurrentUser(currentUser);
713
736
  }
@@ -823,10 +846,13 @@ export class AppComponent implements OnInit {
823
846
  }
824
847
 
825
848
  private initAudio() {
849
+ // console.log('HERE IS initAudio ')
826
850
  // SET AUDIO
827
851
  const href = window.location.href;
828
852
  const hrefArray = href.split('/#/');
829
853
  const chatBaseUrl = hrefArray[0]
854
+ // console.log('initAudio href', href)
855
+ // console.log('initAudio chatBaseUrl', chatBaseUrl)
830
856
 
831
857
  this.audio = new Audio();
832
858
  this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
@@ -836,6 +862,7 @@ export class AppComponent implements OnInit {
836
862
  private manageTabNotification() {
837
863
  if (!this.isTabVisible) {
838
864
  // TAB IS HIDDEN --> manage title and SOUND
865
+ // console.log('HERE IS manageTabNotification ')
839
866
  let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
840
867
  badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
841
868
  document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
@@ -854,6 +881,7 @@ export class AppComponent implements OnInit {
854
881
  }
855
882
 
856
883
  soundMessage() {
884
+ // console.log('HERE IS soundMessage ')
857
885
  const that = this;
858
886
  // this.audio = new Audio();
859
887
  // // this.audio.src = '/assets/sounds/pling.mp3';
@@ -889,7 +917,9 @@ export class AppComponent implements OnInit {
889
917
  return;
890
918
  }
891
919
 
892
- this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged.pipe(filter((state) => state !== null)).subscribe((state: any) => {
920
+ this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
921
+ // .pipe(takeUntil(this.unsubscribe$))
922
+ .pipe(filter((state) => state !== null)).subscribe((state: any) => {
893
923
  this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
894
924
 
895
925
  if (state && state === AUTH_STATE_ONLINE) {
@@ -918,24 +948,30 @@ export class AppComponent implements OnInit {
918
948
 
919
949
 
920
950
  this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
921
- this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
951
+ // this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
922
952
  // that.conversationsChanged(conversations);
923
953
  if (conversation && conversation.is_new === true) {
924
954
  this.manageTabNotification()
925
- this.updateConversationsOnStorage()
926
955
  }
927
956
  });
928
957
 
929
958
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
959
+
930
960
  // console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
931
- if(conversation) this.updateConversationsOnStorage();
932
- const currentUser = this.tiledeskAuthService.getCurrentUser()
933
- if (currentUser && currentUser !== null) {
961
+ let currentUser = null
962
+ const storedCurrentUser = this.appStorageService.getItem('currentUser')
963
+ if (storedCurrentUser && storedCurrentUser !== 'undefined') {
964
+ currentUser = JSON.parse(storedCurrentUser);
934
965
  this.logger.log('[APP-COMP] ***** subscribeConversationChanged currentUser: ', currentUser);
935
- if (conversation && conversation.sender !== currentUser.uid) {
936
- this.manageTabNotification();
937
- }
938
966
 
967
+ if (currentUser) {
968
+ this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
969
+ if (conversation && conversation.sender !== currentUser.uid) {
970
+ this.manageTabNotification();
971
+ }
972
+ }
973
+ } else {
974
+ this.logger.error('[APP-COMP] ***** subscribeConversationChanged currentUser nor found in storage ');
939
975
  }
940
976
  });
941
977
  }
@@ -998,8 +1034,9 @@ export class AppComponent implements OnInit {
998
1034
 
999
1035
  goOffLine = () => {
1000
1036
  this.logger.log('[APP-COMP] - GO-OFFLINE');
1001
- this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', this.SUPPORT_MODE);
1002
- if (this.SUPPORT_MODE === true) {
1037
+ const supportmode = this.appConfigProvider.getConfig().supportMode;
1038
+ this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
1039
+ if (supportmode === true) {
1003
1040
  this.webSocketClose()
1004
1041
  }
1005
1042
  // this.isOnline = false;
@@ -1082,7 +1119,6 @@ export class AppComponent implements OnInit {
1082
1119
 
1083
1120
 
1084
1121
  if (hasClickedLogout === true) {
1085
- this.appStorageService.removeItem('conversations')
1086
1122
  // ----------------------------------------------
1087
1123
  // PUSH NOTIFICATIONS
1088
1124
  // ----------------------------------------------
@@ -1189,13 +1225,14 @@ export class AppComponent implements OnInit {
1189
1225
  this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
1190
1226
  // 1 - init chatConversationsHandler and archviedConversationsHandler
1191
1227
  this.conversationsHandlerService.initialize(this.tenant, userId, translationMap);
1228
+
1192
1229
  // this.subscribeToConvs()
1193
- const lastTimestamp = this.manageStoredConversations()
1194
- this.logger.log('[APP-COMP] initConversationsHandler: get lastTimestamp', lastTimestamp)
1195
- this.conversationsHandlerService.subscribeToConversations(lastTimestamp, () => {
1196
- // this.logger.log('[APP-COMP] - CONVS - INIT CONV')
1230
+ this.conversationsHandlerService.subscribeToConversations(() => {
1231
+ this.logger.log('[APP-COMP] - CONVS - INIT CONV')
1232
+
1197
1233
  const conversations = this.conversationsHandlerService.conversations;
1198
1234
  this.logger.info('initialize FROM [APP-COMP] - [APP-COMP]-CONVS - INIT CONV CONVS', conversations)
1235
+
1199
1236
  // this.logger.printDebug('SubscribeToConversations (convs-list-page) - conversations')
1200
1237
  if (!conversations || conversations.length === 0) {
1201
1238
  // that.showPlaceholder = true;
@@ -1206,31 +1243,6 @@ export class AppComponent implements OnInit {
1206
1243
 
1207
1244
  }
1208
1245
 
1209
- // START: manage conversations on firebase upon last timestamp from stored conversations
1210
- private manageStoredConversations(): number {
1211
- let timestamp = 0
1212
- if(this.appStorageService.getItem('conversations')){
1213
- const conversationsStored = JSON.parse(this.appStorageService.getItem('conversations'))
1214
- if(conversationsStored && conversationsStored.length > 0) {
1215
- this.conversationsHandlerService.conversations = conversationsStored
1216
- timestamp = conversationsStored[0].timestamp
1217
- this.events.publish('appcompSubscribeToConvs:loadingIsActive', false);
1218
- }
1219
- }
1220
- return timestamp
1221
- }
1222
-
1223
- private updateConversationsOnStorage(){
1224
- const that = this
1225
- //reset timer and save conversation on storage after 2s
1226
- clearTimeout(this.setTimeoutConversationsEvent);
1227
- this.setTimeoutConversationsEvent = setTimeout(() => {
1228
- this.logger.debug('[APP-COMP] updateConversationsOnStorage: reset timer and save conversations -> ', this.conversationsHandlerService.conversations.length)
1229
- that.appStorageService.setItem('conversations', JSON.stringify(this.conversationsHandlerService.conversations))
1230
- }, 2000);
1231
- }
1232
- // END: manage conversations on firebase upon last timestamp from stored conversations
1233
-
1234
1246
  private initArchivedConversationsHandler(userId: string) {
1235
1247
  const keys = ['YOU'];
1236
1248
 
@@ -278,7 +278,6 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
278
278
  serverLogLevel: NgxLoggerLevel.ERROR,
279
279
  timestampFormat: 'HH:mm:ss.SSS',
280
280
  enableSourceMaps: false,
281
- disableFileDetails: true,
282
281
  colorScheme: ['purple', 'yellow', 'gray', 'gray', 'red', 'red', 'red'],
283
282
  serverLoggingUrl: 'https://tiledesk-server-pre.herokuapp.com/logs'
284
283
  }),
@@ -86,7 +86,7 @@
86
86
  [textColor]="'col-msg-sent'"
87
87
  [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
88
88
  [areVisibleCAR]="areVisibleCAR"
89
- [supportMode]="supportMode"
89
+ [support_mode]="support_mode"
90
90
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
91
91
  (onAfterMessageRender)="returnOnAfterMessageRender($event)"
92
92
  (onImageRendered)="onImageRenderedFN($event)">
@@ -125,7 +125,7 @@
125
125
  [textColor]="'black'"
126
126
  [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
127
127
  [areVisibleCAR]="areVisibleCAR"
128
- [supportMode]="supportMode"
128
+ [support_mode]="support_mode"
129
129
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
130
130
  (onAfterMessageRender)="returnOnAfterMessageRender($event)"
131
131
  (onImageRendered)="onImageRenderedFN($event)"
@@ -97,6 +97,7 @@ ion-item {
97
97
  background-color: var(--bubble-privateMsg);
98
98
  color: var(--bubble-privateMsgColor)
99
99
  }
100
+
100
101
  }
101
102
  .emoticon {
102
103
  background: unset !important;
@@ -22,12 +22,12 @@ export class IonConversationDetailComponent extends ConversationContentComponent
22
22
 
23
23
  @Input() senderId: string;
24
24
  @Input() channelType: string;
25
- @Input() areVisibleCAR: boolean;
26
- @Input() supportMode: boolean;
27
25
  @Output() onImageRendered = new EventEmitter<boolean>()
28
26
  @Output() onAddUploadingBubble = new EventEmitter<boolean>();
29
27
 
30
28
  public public_Key: any
29
+ public areVisibleCAR: boolean
30
+ public support_mode: boolean
31
31
  public uploadProgress: number = 100
32
32
  public fileType: any
33
33
  public browserLang: string;
@@ -64,11 +64,48 @@ export class IonConversationDetailComponent extends ConversationContentComponent
64
64
  }
65
65
 
66
66
  ngOnInit() {
67
+ this.getOSCODE()
67
68
  this.listenToUploadFileProgress();
68
69
  this.setMomentLocaleAndGetTranslation();
69
70
  }
70
71
 
72
+ getOSCODE() {
73
+ this.support_mode = null
74
+ if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
75
+ this.support_mode = true
76
+ } else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
77
+ this.support_mode = false
78
+ } else if ( !this.appConfigProvider.getConfig().supportMode ) {
79
+ this.support_mode = false
80
+ }
81
+ this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK
82
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key)
83
+
84
+ if (this.public_Key) {
85
+ let keys = this.public_Key.split('-')
86
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - public_Key keys', keys)
87
+
88
+ keys.forEach((key) => {
89
+ if (key.includes('CAR')) {
90
+ let car = key.split(':')
91
+ if (car[1] === 'F') {
92
+ this.areVisibleCAR = false
93
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
94
+ } else {
95
+ this.areVisibleCAR = true
96
+ this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
97
+ }
98
+ }
99
+ })
71
100
 
101
+ if (!this.public_Key.includes('CAR')) {
102
+ this.areVisibleCAR = false
103
+ // console.log('[CONVS-DETAIL][ION-CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
104
+ }
105
+ } else {
106
+ this.areVisibleCAR = false
107
+ }
108
+ }
72
109
 
73
110
  setMomentLocaleAndGetTranslation() {
74
111
  this.browserLang = this.translate.getBrowserLang();