@chat21/chat21-ionic 3.0.59 → 3.0.60-rc8

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 (49) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/deploy_pre.sh +45 -6
  3. package/deploy_prod.sh +34 -9
  4. package/env.sample +1 -1
  5. package/package.json +1 -1
  6. package/src/app/app.component.ts +51 -50
  7. package/src/app/app.module.ts +2 -2
  8. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +62 -36
  9. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
  10. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +42 -13
  11. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +64 -39
  12. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +50 -2
  13. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +80 -94
  14. package/src/app/components/image-viewer/image-viewer.component.scss +2 -2
  15. package/src/app/components/project-item/project-item.component.html +140 -118
  16. package/src/app/components/project-item/project-item.component.scss +145 -83
  17. package/src/app/components/project-item/project-item.component.ts +67 -26
  18. package/src/app/pages/conversation-detail/conversation-detail.module.ts +3 -1
  19. package/src/app/pages/conversation-detail/conversation-detail.page.html +9 -3
  20. package/src/app/pages/conversation-detail/conversation-detail.page.ts +201 -86
  21. package/src/app/pages/conversations-list/conversations-list.page.html +11 -5
  22. package/src/app/pages/conversations-list/conversations-list.page.scss +12 -1
  23. package/src/app/pages/conversations-list/conversations-list.page.ts +27 -7
  24. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +16 -11
  25. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +157 -63
  26. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +51 -16
  27. package/src/app/services/app-config.ts +14 -14
  28. package/src/app/services/websocket/websocket-js.ts +7 -4
  29. package/src/app/services/websocket/websocket.service.ts +1 -1
  30. package/src/app/shared/shared.module.ts +8 -7
  31. package/src/assets/i18n/de.json +208 -0
  32. package/src/assets/i18n/en.json +24 -7
  33. package/src/assets/i18n/es.json +208 -0
  34. package/src/assets/i18n/fr.json +208 -0
  35. package/src/assets/i18n/it.json +42 -33
  36. package/src/assets/i18n/pt.json +208 -0
  37. package/src/assets/i18n/ru.json +208 -0
  38. package/src/assets/i18n/tr.json +208 -0
  39. package/src/assets/js/chat21client.js +16 -3
  40. package/src/chat-config-mqtt.json +2 -1
  41. package/src/chat-config-pre-test.json +2 -0
  42. package/src/chat-config-template.json +1 -0
  43. package/src/chat-config.json +1 -0
  44. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +54 -43
  45. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +23 -0
  46. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -1
  47. package/src/chat21-core/utils/constants.ts +2 -0
  48. package/src/chat21-core/utils/utils.ts +12 -1
  49. package/src/global.scss +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.60-rc8
4
+ - Fixes the bug:: "info" messages sent by "SYSTEM" are not translated
5
+ - Adds the Portuguese language
6
+ - Adds the French language
7
+ - Adds the Russian language
8
+ - Adds the Turkish language
9
+
10
+ ### 3.0.60-rc7
11
+ - Adds German language
12
+ - Adds a method that translates chat texts based on the language of the browser settings if no preferred language is selected in the dashboard or based on the preferred language (ignoring the browser language)
13
+ - Manages the language used for translations from the "moment" library based on the language of the browser settings if no preferred language has been selected in the dashboard or on the preferred language selected (ignoring the browser language)
14
+ - Adds the ability to manage the visibility of canned responses in env.sample, chat-config-tempalte.json and chat-config.json
15
+ - Fixes the bug: in the 'item' that displays the pinned project and the number of the not assigned conversions the tooltip is not correctly displayed
16
+
17
+ ### 3.0.60-rc6
18
+ - Fixes the bug: push notifications are initialized even if the "pushEngine" configuration variable is set to "none"
19
+ - Adds spanish language
20
+
21
+ ### 3.0.60-rc5
22
+ - Change the icon and link of the "pin button" in the item at the top of the conversation list (now opens the list of projects and not the list of new conversations)
23
+ - Add a tooltip on the switch button to change the available/unavailable status
24
+ - Adds a link to the to the new conversations at the icon that display the number of new conversations
25
+
26
+ ### 3.0.60-rc4
27
+ - Translates the canned response displayed when there are not canned responses
28
+
29
+ ### 3.0.60-rc3
30
+ - Enhances the item at the top of the conversation list that displays the number of new conversations of a selected project
31
+ - Fixes the bug: the loading spinner is sometimes not displayed when loading the list of unassigned conversations
32
+ - Displays as canned response "Test" when no canned responses are available
33
+ - Adds the cursor to the "Send message" textarea after the "Canned responses" button has been clicked
34
+
35
+ ### 3.0.60-rc2
36
+ - Fixes the bug: in AppConfigProvider the "wsUrl" is incorrect (window.location.port is missing)
37
+
38
+ ### 3.0.60-rc1
39
+ - Adds the ability to view canned responses by clicking on the button with the "flash" icon located to the left of the "Enter a message" text area
40
+
41
+ ### 3.0.59.2
42
+ - Fixes the bug: when the agent refreshes the chat page and the chat is in mobile mode, the badge with the number of unassigned conversations does not work
43
+
44
+ ### 3.0.59.1
45
+ - Fixes the bug: "Unable to read uid of undefined" error occurs when agent logs out
46
+ - Fixes the bug: When the agent logs into the chat and the chat is in mobile mode, no conversations are displayed
47
+ - Fixes the bug: the websocket is initialized even if the supportMode property is set to false
48
+ - Fixes the bug: when the agent refreshes the chat page and the chat is in mobile mode, the badge with the number of unassigned conversations does not work
49
+
3
50
  ### 3.0.59
4
51
  - Deploys in production
5
52
 
@@ -7,7 +54,6 @@
7
54
  - Fixes the bug: the badge indicating the number of unassigned conversations does not update correctly when the project is changed
8
55
  - Changes the code that prevent the chat from opening in a new browser tab if the chat tab is already open
9
56
  - Publish conversations returned by subscription to websocket conversations > "on data" callback
10
- - Conditions the opening of websockets to "supportMode" set to true
11
57
 
12
58
  ### 3.0.59-rc22
13
59
  - Minor improvements
@@ -101,6 +147,9 @@
101
147
  - Fixes the bug: in the avatar-profile component the properties 'avatarUrl', 'color' and 'avatar' are private and accessible only within the class
102
148
  - Fixes the bug: on ios platforms the back button in the conversation details header overlaps the avatar
103
149
 
150
+ ### 3.0.58.1
151
+ - Fix the bug: if the "chatEngine" property value is set to "mqtt "the login modal window does not disappear even if the agent is logged in
152
+
104
153
  ### 3.0.58
105
154
  - Changes the logic with which the 'online' / 'offline' event is published (done before by the onAuthStateChanged() method)
106
155
  - Removes the setTimeout set for displaying the login window
package/deploy_pre.sh CHANGED
@@ -24,21 +24,60 @@ sed -i -e "s/$URL_VER/g" src/utils/constants.ts
24
24
 
25
25
  # ng build --prod --base-href /$NEW_BUILD/
26
26
  #ionic cordova build browser --prod
27
-
28
- ionic cordova platform add browser --save
29
27
  #ionic cordova build browser --prod --release
30
- ionic cordova build --env=pre browser #--prod --verbose
28
+ # ionic cordova build --env=pre browser --prod #--verbose
31
29
 
30
+ ionic cordova platform add browser --save
31
+ ionic cordova build -c=pre browser --prod
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
-
35
+ cp config.xml platforms/browser/www/
36
+
37
+ ######### chat-ionic5 - the good one - publish in pre
36
38
  cd platforms/browser/www
37
39
  aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/$version/
38
40
  aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/
39
41
  cd ../../../
40
42
 
41
- #aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
43
+ aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
42
44
 
43
45
  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
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-test - publish in pre with the projects right panel
51
+ # cd platforms/browser/www
52
+ # aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5-test/$version/
53
+ # aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5-test/
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-test/$version/
59
+ # echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5-test/$version/index.html
60
+ # echo available on https://support-pre.tiledesk.com/chat-ionic5-test/$version/index.html
61
+ # echo available on https://support-pre.tiledesk.com/chat-ionic5-test/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
package/deploy_prod.sh CHANGED
@@ -1,4 +1,4 @@
1
- npm version patch
1
+ # npm version patch
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
@@ -12,22 +12,47 @@ echo 'URL_VER: ---->'$URL_VER
12
12
  # npm publish
13
13
  # fi
14
14
 
15
- # sed -i -e "s/$start$ver.$build/$start$NEW_VER.$NEW_BUILD/g" src/utils/constants.ts
16
15
  sed -i -e "s/$URL_VER/g" src/utils/constants.ts
16
+
17
17
  ionic cordova platform add browser --save
18
18
  #ionic cordova build --env=prod browser -- --base-href /www/ --prod
19
19
  ionic cordova build --env=prod browser --prod
20
20
  cp -p src/firebase-messaging-sw.js platforms/browser/www/
21
21
  cp -p src/manifest.json platforms/browser/www/
22
22
  cp -p src/chat-config.json platforms/browser/www/
23
+ cp -p config.xml platforms/browser/www/
24
+
23
25
 
26
+ ###### CHAT in prod
24
27
  cd platforms/browser/www
25
- #aws s3 sync . s3://tiledesk-dashboard/chat/
26
- aws s3 sync . s3://tiledesk-console/v2/chat-ionic5/
27
- aws s3 sync . s3://tiledesk-console/v2/chat-ionic5/$version/
28
+ aws s3 sync . s3://tiledesk-console/v2/chat/
29
+ aws s3 sync . s3://tiledesk-console/v2/chat/$version/
28
30
  cd ../../../
29
- # aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
31
+ echo new version deployed on s3://tiledesk-console/v2/chat/
32
+ echo available on https://console.tiledesk.com/v2/chat/$version/index.html
33
+ echo available on https://console.tiledesk.com/v2/chat/index.html
34
+
35
+
36
+ ###### CHAT-IONIC5
37
+ # cd platforms/browser/www
38
+ # #aws s3 sync . s3://tiledesk-dashboard/chat/
39
+ # aws s3 sync . s3://tiledesk-console/v2/chat-ionic5/
40
+ # aws s3 sync . s3://tiledesk-console/v2/chat-ionic5/$version/
41
+ # cd ../../../
42
+ # # aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
43
+
44
+ # # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
45
+ # echo new version deployed on s3://tiledesk-console/v2/chat-ionic5/$version/
46
+ # echo available on https://console.tiledesk.com/v2/chat-ionic5/$version/index.html
47
+
48
+
30
49
 
31
- # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
32
- echo new version deployed on s3://tiledesk-console/v2/chat-ionic5/$version/
33
- echo available on https://console.tiledesk.com/v2/chat-ionic5/$version/index.html
50
+ ####### chat ionic FIREBASE in PROD IN SUBFOLDER
51
+ # cd platforms/browser/www
52
+ # aws s3 sync . s3://tiledesk-console/v2/chat5-dev/
53
+ # aws s3 sync . s3://tiledesk-console/v2/chat5-dev/$version
54
+ # cd ../../../
55
+ # echo new version deployed on s3://console.tiledesk.com/v2/chat5-dev/$version
56
+ # echo new version deployed on s3://console.tiledesk.com/v2/chat5-dev/
57
+ # echo available on http://console.tiledesk.com/v2/chat5-dev/index.html
58
+ # echo available on http://console.tiledesk.com/v2/chat5-dev/$version/index.html
package/env.sample CHANGED
@@ -3,7 +3,7 @@ DASHBOARD_URL=https://YOUR_DASHBOARD_URL
3
3
  WS_URL=wss://YOUR_TILEDESK_SERVER_URL?token=
4
4
  WS_URL_RELATIVE=********
5
5
  SERVER_BASE_URL=http://localhost:3000/
6
-
6
+ FEATURES_TOKEN=CAR:F
7
7
  CHAT21_ENGINE=mqtt
8
8
  UPLOAD_ENGINE=native
9
9
  PUSH_ENGINE=none
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.59",
3
+ "version": "3.0.60-rc8",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://ionicframework.com/",
6
6
  "scripts": {
@@ -148,22 +148,9 @@ export class AppComponent implements OnInit {
148
148
 
149
149
  // this.listenToUrlChanges();
150
150
  // this.getPageState();
151
+ }
151
152
 
152
- // location.subscribe((val) => {
153
-
154
- // console.log('location subscribe val', val)
155
- // if (val.type == "hashchange") {
156
- // const convId = getParameterByName('convId')
157
- // console.log('[APP-COMP] ngOnInit convId get with getParameterByName ', convId)
158
- // const requesterFullaname = getParameterByName('requester_fullaname')
159
- // console.log('[APP-COMP] ngOnInit convId get with getParameterByName ', requesterFullaname);
160
153
 
161
- // this.navigateToDetail(convId, requesterFullaname)
162
-
163
- // this.events.publish('convid:haschanged', convId);
164
- // }
165
- // });
166
- }
167
154
 
168
155
  listenChatAlreadyOpenWithoutParamsInMobileMode() {
169
156
  this.events.subscribe('noparams:mobile', (isAlreadyOpenInMobileMode) => {
@@ -349,7 +336,7 @@ export class AppComponent implements OnInit {
349
336
  // const msg = { action: "hasArchived", parameter: event.data.parameter, calledBy: event.data.calledBy }
350
337
  // iframeWin.contentWindow.postMessage(msg, '*');
351
338
  // }
352
-
339
+
353
340
  // }
354
341
  // }
355
342
  if (event && event.data && event.data.action && event.data.text) {
@@ -456,7 +443,7 @@ export class AppComponent implements OnInit {
456
443
  // console.log("Check platform");
457
444
  this.getPlatformName();
458
445
 
459
- this.setLanguage();
446
+ // this.setLanguage();
460
447
 
461
448
  // if (this.splashScreen) {
462
449
  this.splashScreen.hide();
@@ -534,19 +521,42 @@ export class AppComponent implements OnInit {
534
521
  }
535
522
 
536
523
  /** */
537
- setLanguage() {
524
+ setLanguage(currentUser) {
525
+ // const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
526
+ this.logger.log('[APP-COMP] - setLanguage current_user uid: ', currentUser);
527
+
528
+ let currentUserId = ''
529
+ if (currentUser) {
530
+ currentUserId = currentUser.uid;
531
+ this.logger.log('[APP-COMP] - setLanguage current_user uid: ', currentUserId);
532
+ }
538
533
  this.translate.setDefaultLang('en');
539
534
  this.translate.use('en');
540
- this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
541
- let language;
542
- if (navigator.language.indexOf('-') !== -1) {
543
- language = navigator.language.substring(0, navigator.language.indexOf('-'));
544
- } else if (navigator.language.indexOf('_') !== -1) {
545
- language = navigator.language.substring(0, navigator.language.indexOf('_'));
546
- } else {
547
- language = navigator.language;
535
+
536
+ const browserLang = this.translate.getBrowserLang();
537
+ this.logger.log('[APP-COMP] browserLang: ', browserLang);
538
+ const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
539
+ this.logger.log('[APP-COMP] stored_preferred_lang: ', stored_preferred_lang);
540
+
541
+ let chat_lang = ''
542
+ if (browserLang && !stored_preferred_lang) {
543
+ chat_lang = browserLang
544
+ } else if (browserLang && stored_preferred_lang) {
545
+ chat_lang = stored_preferred_lang
548
546
  }
549
- this.translate.use(language);
547
+
548
+ this.translate.use(chat_lang);
549
+
550
+ // this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
551
+ // let language;
552
+ // if (navigator.language.indexOf('-') !== -1) {
553
+ // language = navigator.language.substring(0, navigator.language.indexOf('-'));
554
+ // } else if (navigator.language.indexOf('_') !== -1) {
555
+ // language = navigator.language.substring(0, navigator.language.indexOf('_'));
556
+ // } else {
557
+ // language = navigator.language;
558
+ // }
559
+ // this.translate.use(language);
550
560
  }
551
561
 
552
562
 
@@ -679,8 +689,8 @@ export class AppComponent implements OnInit {
679
689
  // }
680
690
 
681
691
  if (checkPlatformIsMobile()) {
682
- // this.chatManager.startApp()
683
-
692
+ this.chatManager.startApp();
693
+
684
694
  this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
685
695
  this.platformIs = PLATFORM_MOBILE;
686
696
  const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
@@ -693,7 +703,7 @@ export class AppComponent implements OnInit {
693
703
  // this.router.navigateByUrl(pageUrl);
694
704
  // this.navService.setRoot(ConversationListPage, {});
695
705
  } else {
696
- // this.chatManager.startApp()
706
+ this.chatManager.startApp();
697
707
  this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
698
708
  this.platformIs = PLATFORM_DESKTOP;
699
709
  // console.log('[APP-COMP] platformIs', this.platformIs);
@@ -815,7 +825,7 @@ export class AppComponent implements OnInit {
815
825
  .pipe(filter((state) => state !== null))
816
826
  .subscribe((state: any) => {
817
827
  this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
818
- // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged isOnline', this.isOnline);
828
+
819
829
  if (state && state === AUTH_STATE_ONLINE) {
820
830
  // const user = this.tiledeskAuthService.getCurrentUser();
821
831
  // if (this.isOnline === false) {
@@ -868,24 +878,25 @@ export class AppComponent implements OnInit {
868
878
  * @param user
869
879
  */
870
880
  goOnLine = () => {
871
- // console.log('[APP-COMP] - GO-ONLINE ');
881
+ this.logger.log('[APP-COMP]- GO-ONLINE ');
872
882
  // this.isOnline = true;
873
883
  // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
874
884
  // clearTimeout(this.timeModalLogin);
875
885
  const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
876
886
 
877
- const supportmode = this.appConfigProvider.getConfig().supportMode;
878
- this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
887
+ // const supportmode = this.appConfigProvider.getConfig().supportMode;
888
+ // this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
879
889
  // if (supportmode === true) {
880
- this.connetWebsocket(tiledeskToken)
890
+ // this.connetWebsocket() // moved in the comp project-item
881
891
  // }
882
892
  this.events.publish('go:online', true);
883
893
  const currentUser = this.tiledeskAuthService.getCurrentUser();
894
+ this.setLanguage(currentUser);
884
895
  // this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
885
896
  this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
886
897
  this.chatManager.setTiledeskToken(tiledeskToken);
887
898
  this.chatManager.setCurrentUser(currentUser);
888
- this.chatManager.startApp();
899
+ // this.chatManager.startApp();
889
900
 
890
901
  // ----------------------------------------------
891
902
  // PUSH NOTIFICATIONS
@@ -912,26 +923,16 @@ export class AppComponent implements OnInit {
912
923
  }
913
924
  }
914
925
 
915
- connetWebsocket(tiledeskToken) {
916
- const appconfig = this.appConfigProvider.getConfig();
917
- this.logger.log('connetWebsocket appconfig wsUrl ', appconfig.wsUrl)
918
- const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
919
- this.webSocketJs.init(
920
- WS_URL,
921
- undefined,
922
- undefined,
923
- undefined
924
- );
925
- }
926
+
926
927
 
927
928
 
928
929
  goOffLine = () => {
929
- console.log('[APP-COMP] - GO-OFFLINE');
930
+ this.logger.log('[APP-COMP] - GO-OFFLINE');
930
931
  const supportmode = this.appConfigProvider.getConfig().supportMode;
931
932
  this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
932
- // if (supportmode === true) {
933
+ if (supportmode === true) {
933
934
  this.webSocketClose()
934
- // }
935
+ }
935
936
  // this.isOnline = false;
936
937
  // this.conversationsHandlerService.conversations = [];
937
938
  this.chatManager.setTiledeskToken(null);
@@ -1111,7 +1112,7 @@ export class AppComponent implements OnInit {
1111
1112
  }
1112
1113
 
1113
1114
  private initConversationsHandler(userId: string) {
1114
- const keys = ['YOU'];
1115
+ const keys = ['YOU', 'INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU'];
1115
1116
  const translationMap = this.translateService.translateLanguage(keys);
1116
1117
 
1117
1118
  this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
@@ -90,7 +90,7 @@ import { ConversationInfoModule } from 'src/app/components/conversation-info/con
90
90
 
91
91
 
92
92
  // Directives
93
- import { TooltipModule } from 'ng2-tooltip-directive';
93
+
94
94
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
95
95
  import { Network } from '@ionic-native/network/ngx';
96
96
  import { ConnectionService } from 'ng-connection-service';
@@ -114,7 +114,7 @@ export function authenticationFactory(http: HttpClient, appConfig: AppConfigProv
114
114
 
115
115
  auth.setBaseUrl(appConfig.getConfig().apiUrl);
116
116
 
117
- if (config.pushEngine = PUSH_ENGINE_MQTT) {
117
+ if (config.pushEngine === PUSH_ENGINE_MQTT) {
118
118
  // FOR PUSH NOTIFICATIONS INIT FIREBASE APP
119
119
  FirebaseInitService.initFirebase(config.firebaseConfig);
120
120
  }
@@ -6,6 +6,7 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
6
6
  import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
7
7
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
8
8
  import { TranslateService } from '@ngx-translate/core';
9
+ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
9
10
  import * as moment from 'moment';
10
11
  @Component({
11
12
  selector: 'chat-bubble-message',
@@ -36,53 +37,78 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
36
37
  };
37
38
 
38
39
  private logger: LoggerService = LoggerInstance.getInstance()
40
+
39
41
  constructor(
40
42
  public sanitizer: DomSanitizer,
41
- private translate: TranslateService) {
43
+ private translate: TranslateService,
44
+ public tiledeskAuthService: TiledeskAuthService
45
+
46
+ ) {
42
47
  // console.log('BUBBLE-MSG Hello !!!!')
43
48
  }
44
49
 
45
50
  ngOnInit() {
51
+
52
+ this.setMomentLocale()
53
+ // this.browserLang = this.translate.getBrowserLang();
54
+
55
+ // if (this.browserLang) {
56
+ // if (this.browserLang === 'it') {
57
+
58
+
59
+ // moment.locale('it', {
60
+ // calendar: {
61
+ // lastDay: '[Ieri alle] LT',
62
+ // sameDay: '[Oggi alle] LT',
63
+ // nextDay: '[Domani alle] LT',
64
+ // lastWeek: '[Ultimo] dddd [alle] LT',
65
+ // nextWeek: 'dddd [alle] LT',
66
+ // sameElse: 'lll'
67
+ // }
68
+ // });
69
+
70
+ // } else {
71
+ // moment.locale('en', {
72
+ // calendar: {
73
+ // lastDay: '[Yesterday at] LT',
74
+ // sameDay: '[Today at] LT',
75
+ // nextDay: '[Tomorrow at] LT',
76
+ // lastWeek: '[last] dddd [at] LT',
77
+ // nextWeek: 'dddd [at] LT',
78
+ // sameElse: 'lll'
79
+ // }
80
+ // });
81
+ // }
82
+ // }
83
+
84
+ }
85
+
86
+
87
+ setMomentLocale() {
46
88
  this.browserLang = this.translate.getBrowserLang();
47
- // console.log('BUBBLE-MSG ngOnInit browserLang ', this.browserLang)
48
- if (this.browserLang) {
49
- if (this.browserLang === 'it') {
50
- // console.log('BUBBLE-MSG browserLang ', this.browserLang)
51
- // moment.locale('it')
52
-
53
- moment.locale('it', {
54
- calendar: {
55
- lastDay: '[Ieri alle] LT',
56
- sameDay: '[Oggi alle] LT',
57
- nextDay: '[Domani alle] LT',
58
- lastWeek: '[Ultimo] dddd [alle] LT',
59
- nextWeek: 'dddd [alle] LT',
60
- sameElse: 'lll'
61
- }
62
- });
63
-
64
- } else {
65
- // console.log('BUBBLE-MSG browserLang ', this.browserLang)
66
- // moment.locale('en')
67
-
68
- moment.locale('en', {
69
- calendar: {
70
- lastDay: '[Yesterday at] LT',
71
- sameDay: '[Today at] LT',
72
- nextDay: '[Tomorrow at] LT',
73
- lastWeek: '[last] dddd [at] LT',
74
- nextWeek: 'dddd [at] LT',
75
- sameElse: 'lll'
76
- }
77
- });
78
- }
89
+ const currentUser = this.tiledeskAuthService.getCurrentUser();
90
+ this.logger.log('[BUBBLE-MESSAGE] - ngOnInit - currentUser ', currentUser)
91
+ let currentUserId = ''
92
+ if (currentUser) {
93
+ currentUserId = currentUser.uid
94
+ this.logger.log('[BUBBLE-MESSAGE] - ngOnInit - currentUserId ', currentUserId)
79
95
  }
80
96
 
97
+ const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
98
+ this.logger.log('[BUBBLE-MESSAGE] stored_preferred_lang: ', stored_preferred_lang);
81
99
 
82
100
 
83
- // const yesterday = moment().subtract(1, 'day')
84
- // console.log('BUBBLE-MSG yesterday ', yesterday)
85
-
101
+ let chat_lang = ''
102
+ if (this.browserLang && !stored_preferred_lang) {
103
+ chat_lang = this.browserLang
104
+ } else if (this.browserLang && stored_preferred_lang) {
105
+ chat_lang = stored_preferred_lang
106
+ }
107
+ moment.locale(chat_lang , {
108
+ calendar: {
109
+ sameElse: 'LLLL'
110
+ }
111
+ });
86
112
  }
87
113
 
88
114
  ngOnChanges() {
@@ -75,7 +75,7 @@
75
75
  </ion-item-sliding> -->
76
76
 
77
77
 
78
- <ion-item button="true" lines="none" class="ion-no-padding" [class.ion-selected]="conversation.uid === uidConvSelected"
78
+ <ion-item button="true" lines="none" class="ion-no-padding" [class.ion-selected]="conversation?.uid === uidConvSelected"
79
79
  *ngFor="let conversation of listConversations" (click)="openConversationByID(conversation)" detail=false>
80
80
  <div tabindex="0"></div>
81
81
 
@@ -14,6 +14,7 @@ import * as moment from 'moment';
14
14
  import { NetworkService } from '../../../services/network-service/network.service';
15
15
  import { AppConfigProvider } from 'src/app/services/app-config';
16
16
  import { DomSanitizer } from '@angular/platform-browser'
17
+ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
17
18
  // import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
18
19
  // import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
19
20
 
@@ -32,7 +33,7 @@ export class IonListConversationsComponent extends ListConversationsComponent im
32
33
  public logger: LoggerService = LoggerInstance.getInstance();
33
34
  public currentYear: any;
34
35
  public browserLang: string;
35
-
36
+
36
37
  public PROJECT_FOR_PANEL: any;
37
38
 
38
39
  /**
@@ -51,19 +52,24 @@ export class IonListConversationsComponent extends ListConversationsComponent im
51
52
  private networkService: NetworkService,
52
53
  private appConfigProvider: AppConfigProvider,
53
54
  private sanitizer: DomSanitizer,
55
+ public tiledeskAuthService: TiledeskAuthService
54
56
  ) {
55
57
  super(iterableDiffers, kvDiffers)
56
- this.browserLang = this.translate.getBrowserLang();
57
- if (this.browserLang) {
58
- if (this.browserLang === 'it') {
59
- // this.translate.use('it');
60
- moment.locale('it')
61
-
62
- } else {
63
- // this.translate.use('en');
64
- moment.locale('en')
65
- }
66
- }
58
+ this.setMomentLocale();
59
+
60
+
61
+ // if (this.browserLang) {
62
+
63
+ // moment.locale(this.browserLang)
64
+ // // if (this.browserLang === 'it') {
65
+ // // // this.translate.use('it');
66
+ // // moment.locale('it')
67
+
68
+ // // } else {
69
+ // // // this.translate.use('en');
70
+ // // moment.locale('en')
71
+ // // }
72
+ // }
67
73
 
68
74
  this.currentYear = moment().format('YYYY');
69
75
  this.logger.log('[ION-LIST-CONVS-COMP] - currentYear ', this.currentYear)
@@ -74,13 +80,36 @@ export class IonListConversationsComponent extends ListConversationsComponent im
74
80
  this.PROJECT_FOR_PANEL = this.sanitizer.bypassSecurityTrustResourceUrl(DASHBOARD_BASE_URL + '#/project-for-panel');
75
81
  }
76
82
 
83
+ setMomentLocale() {
84
+ this.browserLang = this.translate.getBrowserLang();
85
+ const currentUser = this.tiledeskAuthService.getCurrentUser();
86
+ this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - currentUser ', currentUser)
87
+ let currentUserId = ''
88
+ if (currentUser) {
89
+ currentUserId = currentUser.uid
90
+ this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - currentUserId ', currentUserId)
91
+ }
92
+
93
+ const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
94
+ this.logger.log('[ION-LIST-CONVS-COMP] stored_preferred_lang: ', stored_preferred_lang);
95
+
96
+
97
+ let chat_lang = ''
98
+ if (this.browserLang && !stored_preferred_lang) {
99
+ chat_lang = this.browserLang
100
+ } else if (this.browserLang && stored_preferred_lang) {
101
+ chat_lang = stored_preferred_lang
102
+ }
103
+ moment.locale(chat_lang)
104
+ }
105
+
77
106
  ngOnInit() {
78
107
  this.isApp = this.platform.is('ios') || this.platform.is('android')
79
108
  this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - IS-APP ', this.isApp)
80
109
  this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - Platform', this.platform.platforms());
81
110
  }
82
111
 
83
-
112
+
84
113
 
85
114
 
86
115