@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
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
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
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
+
3
20
  ### 3.0.63
4
21
  - Deploys in production
5
22
 
@@ -16,7 +33,7 @@
16
33
  - Fixes the bug: images that are not in the database cannot be downloaded
17
34
  - Adds default chat color to emojis picker tabs
18
35
  - Fixes the bug: the selected conversation is undefined
19
- - 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
20
37
 
21
38
  ### 3.0.62.3
22
39
  - 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,26 @@
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
+ aws s3 sync . s3://tiledesk-console/v2/chat/latest/
21
+ cd ../../../
22
+ # aws cloudfront create-invalidation --distribution-id E36UIP90GOSFPM --paths "/*"
23
+
24
+ # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
25
+ echo new version deployed on s3://tiledesk-console/v2/chat-ionic5/$version/
26
+ echo available on https://console.tiledesk.com/v2/chat-ionic5/$version/index.html
package/deploy_pre.sh CHANGED
@@ -27,57 +27,18 @@ sed -i -e "s/$URL_VER/g" src/utils/constants.ts
27
27
 
28
28
  ionic cordova platform add browser --save
29
29
  #ionic cordova build browser --prod --release
30
- # ionic cordova build --env=pre browser --prod #--verbose
31
- ionic cordova build -c=pre browser --prod
30
+ ionic cordova build --env=pre browser #--prod --verbose
31
+
32
32
  cp -p src/firebase-messaging-sw.js platforms/browser/www/
33
33
  cp -p src/manifest.json platforms/browser/www/
34
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
35
+
38
36
  cd platforms/browser/www
39
37
  aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/$version/
40
38
  aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/
41
39
  cd ../../../
42
40
 
43
- aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
41
+ #aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
44
42
 
45
43
  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
-
74
-
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
44
+ echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5/$version/index.html
package/deploy_prod.sh CHANGED
@@ -5,58 +5,10 @@ echo "version $version"
5
5
  URL_VER=${version//[.]//}
6
6
  echo 'URL_VER: ---->'$URL_VER
7
7
 
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
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
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
- cd ../../../
31
- # aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
32
-
33
- # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
34
- echo new version deployed on s3://tiledesk-console/v2/chat/$version/
35
- # echo new version deployed on s3://tiledesk-console/v2/chat/
36
- echo available on https://console.tiledesk.com/v2/chat/$version/index.html
37
- echo available on https://console.tiledesk.com/v2/chat/index.html
38
-
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,8 +1,13 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.63",
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,11 +889,7 @@ export class AppComponent implements OnInit {
917
889
  return;
918
890
  }
919
891
 
920
- this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
921
-
922
- // .pipe(takeUntil(this.unsubscribe$))
923
- .pipe(filter((state) => state !== null))
924
- .subscribe((state: any) => {
892
+ this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged.pipe(filter((state) => state !== null)).subscribe((state: any) => {
925
893
  this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
926
894
 
927
895
  if (state && state === AUTH_STATE_ONLINE) {
@@ -950,32 +918,31 @@ export class AppComponent implements OnInit {
950
918
 
951
919
 
952
920
  this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
953
- // this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
921
+ this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
954
922
  // that.conversationsChanged(conversations);
955
923
  if (conversation && conversation.is_new === true) {
956
924
  this.manageTabNotification()
925
+ this.updateConversationsOnStorage()
957
926
  }
958
927
  });
959
928
 
960
929
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
961
-
962
930
  // console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
963
- let currentUser = null
964
- const storedCurrentUser = this.appStorageService.getItem('currentUser')
965
- if (storedCurrentUser && storedCurrentUser !== 'undefined') {
966
- currentUser = JSON.parse(storedCurrentUser);
931
+ if(conversation) this.updateConversationsOnStorage();
932
+ const currentUser = this.tiledeskAuthService.getCurrentUser()
933
+ if (currentUser && currentUser !== null) {
967
934
  this.logger.log('[APP-COMP] ***** subscribeConversationChanged currentUser: ', currentUser);
968
-
969
- if (currentUser) {
970
- this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
971
- if (conversation && conversation.sender !== currentUser.uid) {
972
- this.manageTabNotification();
973
- }
935
+ if (conversation && conversation.sender !== currentUser.uid) {
936
+ this.manageTabNotification();
974
937
  }
975
- } else {
976
- this.logger.error('[APP-COMP] ***** subscribeConversationChanged currentUser nor found in storage ');
977
938
  }
978
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
+ });
979
946
  }
980
947
 
981
948
  /**
@@ -1036,9 +1003,8 @@ export class AppComponent implements OnInit {
1036
1003
 
1037
1004
  goOffLine = () => {
1038
1005
  this.logger.log('[APP-COMP] - GO-OFFLINE');
1039
- const supportmode = this.appConfigProvider.getConfig().supportMode;
1040
- this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
1041
- if (supportmode === true) {
1006
+ this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', this.SUPPORT_MODE);
1007
+ if (this.SUPPORT_MODE === true) {
1042
1008
  this.webSocketClose()
1043
1009
  }
1044
1010
  // this.isOnline = false;
@@ -1121,6 +1087,7 @@ export class AppComponent implements OnInit {
1121
1087
 
1122
1088
 
1123
1089
  if (hasClickedLogout === true) {
1090
+ this.appStorageService.removeItem('conversations')
1124
1091
  // ----------------------------------------------
1125
1092
  // PUSH NOTIFICATIONS
1126
1093
  // ----------------------------------------------
@@ -1227,14 +1194,13 @@ export class AppComponent implements OnInit {
1227
1194
  this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
1228
1195
  // 1 - init chatConversationsHandler and archviedConversationsHandler
1229
1196
  this.conversationsHandlerService.initialize(this.tenant, userId, translationMap);
1230
-
1231
1197
  // this.subscribeToConvs()
1232
- this.conversationsHandlerService.subscribeToConversations(() => {
1233
- this.logger.log('[APP-COMP] - CONVS - INIT CONV')
1234
-
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')
1235
1202
  const conversations = this.conversationsHandlerService.conversations;
1236
1203
  this.logger.info('initialize FROM [APP-COMP] - [APP-COMP]-CONVS - INIT CONV CONVS', conversations)
1237
-
1238
1204
  // this.logger.printDebug('SubscribeToConversations (convs-list-page) - conversations')
1239
1205
  if (!conversations || conversations.length === 0) {
1240
1206
  // that.showPlaceholder = true;
@@ -1245,6 +1211,31 @@ export class AppComponent implements OnInit {
1245
1211
 
1246
1212
  }
1247
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
+
1248
1239
  private initArchivedConversationsHandler(userId: string) {
1249
1240
  const keys = ['YOU'];
1250
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;