@chat21/chat21-ionic 3.0.64 → 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 (38) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/deploy_amazon_prod.sh +2 -1
  3. package/deploy_pre.sh +39 -6
  4. package/deploy_prod.sh +3 -0
  5. package/package.json +6 -1
  6. package/publiccode.yml +110 -0
  7. package/src/app/app.component.ts +50 -57
  8. package/src/app/app.module.ts +1 -0
  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 +0 -1
  11. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -39
  12. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +18 -6
  13. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +2 -2
  14. package/src/app/chatlib/conversation-detail/message/html/html.component.html +1 -0
  15. package/src/app/chatlib/conversation-detail/message/html/html.component.scss +79 -0
  16. package/src/app/chatlib/conversation-detail/message/html/html.component.spec.ts +25 -0
  17. package/src/app/chatlib/conversation-detail/message/html/html.component.ts +33 -0
  18. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +0 -1
  19. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -1
  20. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +19 -0
  21. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
  22. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -2
  23. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
  24. package/src/app/directives/safe-html.pipe.ts +2 -2
  25. package/src/app/directives/truncate.pipe.spec.ts +8 -0
  26. package/src/app/directives/truncate.pipe.ts +16 -0
  27. package/src/app/pages/conversation-detail/conversation-detail.module.ts +3 -2
  28. package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
  29. package/src/app/pages/conversation-detail/conversation-detail.page.ts +12 -23
  30. package/src/app/pages/conversations-list/conversations-list.page.html +21 -12
  31. package/src/app/pages/conversations-list/conversations-list.page.ts +104 -366
  32. package/src/app/pages/loader-preview/loader-preview.module.ts +1 -2
  33. package/src/app/shared/shared.module.ts +4 -0
  34. package/src/assets/js/chat21client.js +1 -1
  35. package/src/chat21-core/models/conversation.ts +1 -1
  36. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +1 -1
  37. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +47 -8
  38. package/src/chat21-core/utils/utils-message.ts +2 -3
package/CHANGELOG.md CHANGED
@@ -1,8 +1,22 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
- ### 3.0.64
3
+ ### 3.0.65-rc.1 - LATEST
4
+ - added: improves chat performance by caching conversations
5
+ - added: Displays balloon messages with a light orange background for "internal notes" type message
6
+ - added: the html component
7
+ - bug-fixed: if archive conversation and do a refresh, url not change from active to archived
8
+ - bug-fixed: truncate sender_fullname in conversation-list and conversation-detail header components
9
+ - bug-fixed: on conversation removed, update local conversations on storage
10
+
11
+ ### 3.0.64 IN PROD
4
12
  - 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
13
 
14
+ ### 3.0.64-rc1
15
+ - 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
16
+ - Displays balloon messages with a light orange background for "internal notes" type message
17
+ - Adds the html component
18
+ - Improves chat performance by caching conversations
19
+
6
20
  ### 3.0.63
7
21
  - Deploys in production
8
22
 
@@ -19,7 +33,7 @@
19
33
  - Fixes the bug: images that are not in the database cannot be downloaded
20
34
  - Adds default chat color to emojis picker tabs
21
35
  - Fixes the bug: the selected conversation is undefined
22
- - Fixes the bug: in the conversation list, the name of the requester changes according to the order of arrival of the conversations
36
+ - 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
23
37
 
24
38
  ### 3.0.62.3
25
39
  - Fixes the bug: the method setTyping fired twice after that a message is sent
@@ -15,8 +15,9 @@ cp -p src/manifest.json platforms/browser/www/
15
15
  cp -p src/chat-config.json platforms/browser/www/
16
16
 
17
17
  cd platforms/browser/www
18
- aws s3 sync . s3://tiledesk-console/v2/chat/
18
+ # aws s3 sync . s3://tiledesk-console/v2/chat/
19
19
  # aws s3 sync . s3://tiledesk-console/v2/chat/$version/
20
+ aws s3 sync . s3://tiledesk-console/v2/chat/latest/
20
21
  cd ../../../
21
22
  # aws cloudfront create-invalidation --distribution-id E36UIP90GOSFPM --paths "/*"
22
23
 
package/deploy_pre.sh CHANGED
@@ -1,11 +1,44 @@
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
+
1
9
  #npm version prerelease --preid=beta
2
10
  version=`node -e 'console.log(require("./package.json").version)'`
3
11
  echo "version $version"
4
12
 
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
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
+
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
+
36
+ cd platforms/browser/www
37
+ aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/$version/
38
+ aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/
39
+ cd ../../../
40
+
41
+ #aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
11
42
 
43
+ echo new version deployed on s3://tiledesk-dashboard-pre/chat-ionic5/$version/
44
+ echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5/$version/index.html
package/deploy_prod.sh CHANGED
@@ -2,6 +2,9 @@
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
7
+
5
8
  if [ "$version" != "" ]; then
6
9
  git tag -a "$version" -m "`git log -1 --format=%s`"
7
10
  echo "Created a new tag, $version"
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.64",
4
3
  "author": "Tiledesk SRL",
4
+ "version": "3.0.65-rc1",
5
+ "license": "AGPL-3.0",
5
6
  "homepage": "https://tiledesk.com/",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Tiledesk/chat21-ionic"
10
+ },
6
11
  "scripts": {
7
12
  "ng": "ng",
8
13
  "start": "ng serve",
package/publiccode.yml ADDED
@@ -0,0 +1,110 @@
1
+ # This repository adheres to the publiccode.yml standard by including this
2
+ # metadata file that makes public software easily discoverable.
3
+ # More info at https://github.com/italia/publiccode.yml
4
+
5
+ publiccodeYmlVersion: '0.2'
6
+ categories:
7
+ - customer-service-and-support
8
+ - communications
9
+ - marketing
10
+ - mobile-marketing
11
+ description:
12
+ it:
13
+ apiDocumentation: 'https://developer.tiledesk.com/apis/rest-api'
14
+ documentation: 'https://gethelp.tiledesk.com'
15
+ features:
16
+ - live chat widget
17
+ - chatbot
18
+ - 'integration with DialogFlow, Rasa and all major AI solutions'
19
+ - ticketing
20
+ - multi-project management
21
+ - SLAs setting
22
+ - 'smart assignment of the queues '
23
+ - seamless conversation
24
+ - dashboard
25
+ - knowledge base
26
+ - mobile apps
27
+ genericName: Live chat with integrated chatbots
28
+ longDescription: |
29
+ To have fully satisfied customers is complex. Conversation’s actors
30
+ (chatbots and humans) should handoff to each other many times during a
31
+ chat to address customers needs.
32
+
33
+
34
+ Tiledesk provides a solution **orchestrating instant, asynchronous and
35
+ multichannel communication among all stakeholders of a typical
36
+ conversational architecture**: chatbots, support operators, end users,
37
+ colleagues, applications, etc.
38
+
39
+
40
+ **Main Features**:
41
+
42
+
43
+ - Live Chat Widget with full multichannel experience on Web and Mobile;
44
+
45
+ - Resolution Bot to automate customer support;
46
+
47
+ - Easy Integration with all major AI-platforms, cloud and Open source,
48
+ from DialogFlow to RASA;
49
+
50
+ - Ticketing Management system fully integrated into the platform and
51
+ instant conversation flow;
52
+
53
+ - Team Organization with multi-project management, SLAs setting, smart
54
+ assignment of the
55
+ queues, departments organization and much more;
56
+ - Seamless conversation to “jump” between different channels in a
57
+ transparent way for end
58
+ customers and agents;
59
+ - Chat Tools like typing indicator, off-line access, delivery receipts,
60
+ contact list and much more;
61
+
62
+ - Dashboard with real time analytics;
63
+
64
+ - Knowledge base.
65
+
66
+
67
+
68
+ Tiledesk is an **open source **project, made with passion in Salento
69
+ (Southern Italy).
70
+ shortDescription: |-
71
+ Tiledesk delivers scalable customer service to your mobile apps and your
72
+ website. It is a conversational platform that connects chatbots and
73
+ humans
74
+ developmentStatus: stable
75
+ it:
76
+ conforme:
77
+ gdpr: false
78
+ lineeGuidaDesign: false
79
+ misureMinimeSicurezza: false
80
+ modelloInteroperabilita: false
81
+ countryExtensionVersion: '0.2'
82
+ piattaforme:
83
+ anpr: false
84
+ cie: false
85
+ pagopa: false
86
+ spid: false
87
+ landingURL: 'https://tiledesk.com/install'
88
+ legal:
89
+ license: AGPL-3.0-only
90
+ localisation:
91
+ availableLanguages:
92
+ - it
93
+ - en
94
+ - es
95
+ - fr
96
+ - pt
97
+ - de
98
+ - ru
99
+ - tr
100
+ localisationReady: true
101
+ maintenance:
102
+ contacts:
103
+ - name: Andrea Sponziello
104
+ type: internal
105
+ name: Tiledesk
106
+ platforms:
107
+ - web
108
+ releaseDate: '2022-06-15'
109
+ softwareType: standalone/web
110
+ url: 'https://github.com/Tiledesk/tiledesk-deployment'
@@ -90,6 +90,7 @@ 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;
93
94
  private logger: LoggerService = LoggerInstance.getInstance();
94
95
  public toastMsgErrorWhileUnsubscribingFromNotifications: string;
95
96
  public toastMsgCloseToast: string;
@@ -341,8 +342,6 @@ export class AppComponent implements OnInit {
341
342
 
342
343
  if (event && event.data && event.data.action && event.data.parameter) {
343
344
  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);
346
345
  this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
347
346
  }
348
347
  }
@@ -377,7 +376,6 @@ export class AppComponent implements OnInit {
377
376
 
378
377
  async presentAlertConfirmJoinRequest(requestid, calledby) {
379
378
  var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
380
- // console.log("[APP-COMP] message event iframeWin ", iframeWin);
381
379
 
382
380
  const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
383
381
  input !== null && input.tagName === 'IFRAME';
@@ -395,12 +393,10 @@ export class AppComponent implements OnInit {
395
393
  role: 'cancel',
396
394
  cssClass: 'secondary',
397
395
  handler: (blah) => {
398
- // console.log('Confirm Cancel: blah', blah);
399
396
  }
400
397
  }, {
401
398
  text: 'Ok',
402
399
  handler: () => {
403
- // console.log('Confirm Okay');
404
400
 
405
401
  if (isIFrame(iframeWin) && iframeWin.contentWindow) {
406
402
  const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
@@ -420,14 +416,12 @@ export class AppComponent implements OnInit {
420
416
  signInWithCustomToken(token) {
421
417
  // this.isOnline = false;
422
418
  this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN token', token)
423
- this.tiledeskAuthService.signInWithCustomToken(token)
424
- .then((user: any) => {
419
+ this.tiledeskAuthService.signInWithCustomToken(token).then((user: any) => {
425
420
  this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN AUTLOGIN user', user)
426
421
  this.messagingAuthService.createCustomToken(token)
427
- })
428
- .catch(error => {
422
+ }).catch(error => {
429
423
  this.logger.error('[APP-COMP] SIGNINWITHCUSTOMTOKEN error::', error)
430
- })
424
+ })
431
425
  }
432
426
 
433
427
  /** */
@@ -577,16 +571,6 @@ export class AppComponent implements OnInit {
577
571
  this.translate.use('en');
578
572
  }
579
573
 
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);
590
574
  }
591
575
 
592
576
 
@@ -661,7 +645,6 @@ export class AppComponent implements OnInit {
661
645
  updateStoredCurrentUser() {
662
646
  const storedCurrentUser = this.appStorageService.getItem('currentUser')
663
647
  const storedDshbrdUser = localStorage.getItem('user')
664
-
665
648
  this.logger.log('[APP-COMP] updateStoredCurrentUser - stored currentUser', storedCurrentUser)
666
649
  this.logger.log('[APP-COMP] updateStoredCurrentUser - stored dshbrdUser', storedDshbrdUser)
667
650
  if ((storedCurrentUser && storedCurrentUser !== 'undefined') && (storedDshbrdUser && storedDshbrdUser !== 'undefined')) {
@@ -678,7 +661,6 @@ export class AppComponent implements OnInit {
678
661
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
679
662
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
680
663
  }
681
-
682
664
  if (currentUser.firstname !== dshbrdUser.firstname) {
683
665
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
684
666
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
@@ -689,7 +671,6 @@ export class AppComponent implements OnInit {
689
671
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
690
672
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
691
673
  }
692
-
693
674
  if (currentUser.lastname !== dshbrdUser.lastname) {
694
675
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
695
676
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
@@ -700,7 +681,6 @@ export class AppComponent implements OnInit {
700
681
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
701
682
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
702
683
  }
703
-
704
684
  if (currentUser.avatar !== dshbrdUser.fullname_initial) {
705
685
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
706
686
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
@@ -711,7 +691,6 @@ export class AppComponent implements OnInit {
711
691
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
712
692
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
713
693
  }
714
-
715
694
  let fullname = ""
716
695
  if (dshbrdUser.firstname && !dshbrdUser.lastname) {
717
696
  fullname = dshbrdUser.firstname
@@ -719,7 +698,6 @@ export class AppComponent implements OnInit {
719
698
  fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
720
699
  this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
721
700
  }
722
-
723
701
  if (fullname !== currentUser.fullname) {
724
702
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
725
703
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
@@ -730,7 +708,6 @@ export class AppComponent implements OnInit {
730
708
  this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
731
709
  this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
732
710
  }
733
-
734
711
  this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
735
712
  this.tiledeskAuthService.setCurrentUser(currentUser);
736
713
  }
@@ -846,13 +823,10 @@ export class AppComponent implements OnInit {
846
823
  }
847
824
 
848
825
  private initAudio() {
849
- // console.log('HERE IS initAudio ')
850
826
  // SET AUDIO
851
827
  const href = window.location.href;
852
828
  const hrefArray = href.split('/#/');
853
829
  const chatBaseUrl = hrefArray[0]
854
- // console.log('initAudio href', href)
855
- // console.log('initAudio chatBaseUrl', chatBaseUrl)
856
830
 
857
831
  this.audio = new Audio();
858
832
  this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
@@ -862,7 +836,6 @@ export class AppComponent implements OnInit {
862
836
  private manageTabNotification() {
863
837
  if (!this.isTabVisible) {
864
838
  // TAB IS HIDDEN --> manage title and SOUND
865
- // console.log('HERE IS manageTabNotification ')
866
839
  let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
867
840
  badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
868
841
  document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
@@ -881,7 +854,6 @@ export class AppComponent implements OnInit {
881
854
  }
882
855
 
883
856
  soundMessage() {
884
- // console.log('HERE IS soundMessage ')
885
857
  const that = this;
886
858
  // this.audio = new Audio();
887
859
  // // this.audio.src = '/assets/sounds/pling.mp3';
@@ -917,9 +889,7 @@ export class AppComponent implements OnInit {
917
889
  return;
918
890
  }
919
891
 
920
- this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
921
- // .pipe(takeUntil(this.unsubscribe$))
922
- .pipe(filter((state) => state !== null)).subscribe((state: any) => {
892
+ this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged.pipe(filter((state) => state !== null)).subscribe((state: any) => {
923
893
  this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
924
894
 
925
895
  if (state && state === AUTH_STATE_ONLINE) {
@@ -948,32 +918,31 @@ export class AppComponent implements OnInit {
948
918
 
949
919
 
950
920
  this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
951
- // this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
921
+ this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
952
922
  // that.conversationsChanged(conversations);
953
923
  if (conversation && conversation.is_new === true) {
954
924
  this.manageTabNotification()
925
+ this.updateConversationsOnStorage()
955
926
  }
956
927
  });
957
928
 
958
929
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
959
-
960
930
  // console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
961
- let currentUser = null
962
- const storedCurrentUser = this.appStorageService.getItem('currentUser')
963
- if (storedCurrentUser && storedCurrentUser !== 'undefined') {
964
- currentUser = JSON.parse(storedCurrentUser);
931
+ if(conversation) this.updateConversationsOnStorage();
932
+ const currentUser = this.tiledeskAuthService.getCurrentUser()
933
+ if (currentUser && currentUser !== null) {
965
934
  this.logger.log('[APP-COMP] ***** subscribeConversationChanged currentUser: ', currentUser);
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
- }
935
+ if (conversation && conversation.sender !== currentUser.uid) {
936
+ this.manageTabNotification();
972
937
  }
973
- } else {
974
- this.logger.error('[APP-COMP] ***** subscribeConversationChanged currentUser nor found in storage ');
975
938
  }
976
939
  });
940
+
941
+ this.conversationsHandlerService.conversationRemoved.subscribe((conversation: ConversationModel) => {
942
+ this.logger.log('[APP-COMP] ***** conversationRemoved *****', conversation);
943
+ // that.conversationsChanged(conversations);
944
+ if(conversation) this.updateConversationsOnStorage();
945
+ });
977
946
  }
978
947
 
979
948
  /**
@@ -1034,9 +1003,8 @@ export class AppComponent implements OnInit {
1034
1003
 
1035
1004
  goOffLine = () => {
1036
1005
  this.logger.log('[APP-COMP] - GO-OFFLINE');
1037
- const supportmode = this.appConfigProvider.getConfig().supportMode;
1038
- this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
1039
- if (supportmode === true) {
1006
+ this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', this.SUPPORT_MODE);
1007
+ if (this.SUPPORT_MODE === true) {
1040
1008
  this.webSocketClose()
1041
1009
  }
1042
1010
  // this.isOnline = false;
@@ -1119,6 +1087,7 @@ export class AppComponent implements OnInit {
1119
1087
 
1120
1088
 
1121
1089
  if (hasClickedLogout === true) {
1090
+ this.appStorageService.removeItem('conversations')
1122
1091
  // ----------------------------------------------
1123
1092
  // PUSH NOTIFICATIONS
1124
1093
  // ----------------------------------------------
@@ -1225,14 +1194,13 @@ export class AppComponent implements OnInit {
1225
1194
  this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
1226
1195
  // 1 - init chatConversationsHandler and archviedConversationsHandler
1227
1196
  this.conversationsHandlerService.initialize(this.tenant, userId, translationMap);
1228
-
1229
1197
  // this.subscribeToConvs()
1230
- this.conversationsHandlerService.subscribeToConversations(() => {
1231
- this.logger.log('[APP-COMP] - CONVS - INIT CONV')
1232
-
1198
+ const lastTimestamp = this.manageStoredConversations()
1199
+ this.logger.log('[APP-COMP] initConversationsHandler: get lastTimestamp', lastTimestamp)
1200
+ this.conversationsHandlerService.subscribeToConversations(lastTimestamp, () => {
1201
+ // this.logger.log('[APP-COMP] - CONVS - INIT CONV')
1233
1202
  const conversations = this.conversationsHandlerService.conversations;
1234
1203
  this.logger.info('initialize FROM [APP-COMP] - [APP-COMP]-CONVS - INIT CONV CONVS', conversations)
1235
-
1236
1204
  // this.logger.printDebug('SubscribeToConversations (convs-list-page) - conversations')
1237
1205
  if (!conversations || conversations.length === 0) {
1238
1206
  // that.showPlaceholder = true;
@@ -1243,6 +1211,31 @@ export class AppComponent implements OnInit {
1243
1211
 
1244
1212
  }
1245
1213
 
1214
+ // START: manage conversations on firebase upon last timestamp from stored conversations
1215
+ private manageStoredConversations(): number {
1216
+ let timestamp = 0
1217
+ if(this.appStorageService.getItem('conversations')){
1218
+ const conversationsStored = JSON.parse(this.appStorageService.getItem('conversations'))
1219
+ if(conversationsStored && conversationsStored.length > 0) {
1220
+ this.conversationsHandlerService.conversations = conversationsStored
1221
+ timestamp = conversationsStored[0].timestamp
1222
+ this.events.publish('appcompSubscribeToConvs:loadingIsActive', false);
1223
+ }
1224
+ }
1225
+ return timestamp
1226
+ }
1227
+
1228
+ private updateConversationsOnStorage(){
1229
+ const that = this
1230
+ //reset timer and save conversation on storage after 2s
1231
+ clearTimeout(this.setTimeoutConversationsEvent);
1232
+ this.setTimeoutConversationsEvent = setTimeout(() => {
1233
+ this.logger.debug('[APP-COMP] updateConversationsOnStorage: reset timer and save conversations -> ', this.conversationsHandlerService.conversations.length)
1234
+ that.appStorageService.setItem('conversations', JSON.stringify(this.conversationsHandlerService.conversations))
1235
+ }, 2000);
1236
+ }
1237
+ // END: manage conversations on firebase upon last timestamp from stored conversations
1238
+
1246
1239
  private initArchivedConversationsHandler(userId: string) {
1247
1240
  const keys = ['YOU'];
1248
1241
 
@@ -278,6 +278,7 @@ 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,
281
282
  colorScheme: ['purple', 'yellow', 'gray', 'gray', 'red', 'red', 'red'],
282
283
  serverLoggingUrl: 'https://tiledesk-server-pre.herokuapp.com/logs'
283
284
  }),
@@ -86,7 +86,7 @@
86
86
  [textColor]="'col-msg-sent'"
87
87
  [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
88
88
  [areVisibleCAR]="areVisibleCAR"
89
- [support_mode]="support_mode"
89
+ [supportMode]="supportMode"
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
- [support_mode]="support_mode"
128
+ [supportMode]="supportMode"
129
129
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
130
130
  (onAfterMessageRender)="returnOnAfterMessageRender($event)"
131
131
  (onImageRendered)="onImageRenderedFN($event)"
@@ -97,7 +97,6 @@ ion-item {
97
97
  background-color: var(--bubble-privateMsg);
98
98
  color: var(--bubble-privateMsgColor)
99
99
  }
100
-
101
100
  }
102
101
  .emoticon {
103
102
  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;
25
27
  @Output() onImageRendered = new EventEmitter<boolean>()
26
28
  @Output() onAddUploadingBubble = new EventEmitter<boolean>();
27
29
 
28
30
  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,48 +64,11 @@ export class IonConversationDetailComponent extends ConversationContentComponent
64
64
  }
65
65
 
66
66
  ngOnInit() {
67
- this.getOSCODE()
68
67
  this.listenToUploadFileProgress();
69
68
  this.setMomentLocaleAndGetTranslation();
70
69
  }
71
70
 
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
- })
100
71
 
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
- }
109
72
 
110
73
  setMomentLocaleAndGetTranslation() {
111
74
  this.browserLang = this.translate.getBrowserLang();
@@ -18,13 +18,18 @@
18
18
 
19
19
  <!-- [width]="getMetadataSize(message.metadata).width"
20
20
  [height]="getMetadataSize(message.metadata).height" -->
21
- <chat-image *ngIf="isImage(message)" [metadata]="message.metadata" [width]="message.metadata.width"
22
- [height]="message.metadata.height" (onImageRendered)="onImageRenderedFN($event)">
21
+ <chat-image *ngIf="isImage(message)"
22
+ [metadata]="message.metadata"
23
+ [width]="message.metadata.width"
24
+ [height]="message.metadata.height"
25
+ (onImageRendered)="onImageRenderedFN($event)">
23
26
  </chat-image>
24
27
 
25
28
  <!-- [width]="getMetadataSize(message.metadata).width" -->
26
29
  <!-- [height]="getMetadataSize(message.metadata).height"> -->
27
- <chat-frame *ngIf="isFrame(message)" [metadata]="message.metadata" [width]="message.metadata.width"
30
+ <chat-frame *ngIf="isFrame(message)"
31
+ [metadata]="message.metadata"
32
+ [width]="message.metadata.width"
28
33
  [height]="message.metadata.height">
29
34
  </chat-frame>
30
35
 
@@ -42,13 +47,20 @@
42
47
  <span> {{message.timestamp | amCalendar }} </span>
43
48
  </ng-template> -->
44
49
 
45
- <chat-text [text]="message?.text" [color]="textColor" [message]="message"
46
- [class.chat-text-emoticon]="message?.emoticon"
50
+ <chat-text *ngIf="message?.type !=='html'"
51
+ [text]="message?.text"
52
+ [color]="textColor"
53
+ [message]="message"
54
+ [class.chat-text-emoticon]="message?.emoticon"
47
55
  (onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
48
56
  (onAfterMessageRender)="returnOnAfterMessageRender($event)">
49
57
  </chat-text>
50
58
 
51
- <ng-container *ngIf="areVisibleCAR && support_mode === true">
59
+ <chat-html *ngIf="message?.type==='html'"
60
+ [htmlText]="message?.text">
61
+ </chat-html>
62
+
63
+ <ng-container *ngIf="areVisibleCAR && supportMode">
52
64
  <ion-button shape="round" size="small" class="btn-add-msg-as-canned-response" ion-button fill="clear"
53
65
  (click)="presentCreateCannedResponseModal()" tooltip="{{addAsCannedResponseTooltipText}}"
54
66
  [options]="tooltipOptions" placement="bottom">