@chat21/chat21-ionic 3.0.5-9.1 → 3.0.5-9.2

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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.59.2
4
+ - 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
5
+
3
6
  ### 3.0.59.1
4
7
  - Fixes the bug: "Unable to read uid of undefined" error occurs when agent logs out
5
8
  - Fixes the bug: When the agent logs into the chat and the chat is in mobile mode, no conversations are displayed
6
- - Conditions the opening of the websocket to retrieve the number of conversations not assigned to the "supportMode" property set to true
9
+ - Fixes the bug: the websocket is initialized even if the supportMode property is set to false
10
+ - 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
7
11
 
8
12
  ### 3.0.59
9
13
  - Deploys in production
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.59.1",
3
+ "version": "3.0.59.2",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://ionicframework.com/",
6
6
  "scripts": {
@@ -98,7 +98,7 @@ export class AppComponent implements OnInit {
98
98
  public missingConnectionToast: any
99
99
  public executedInitializeAppByWatchConnection: boolean = false;
100
100
  private version: string;
101
- public browserRefresh: boolean = false;
101
+
102
102
  // private isOnline: boolean = false;
103
103
 
104
104
  wsService: WebSocketJs;
@@ -148,29 +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
- router.events.subscribe((event) => {
168
- if (event instanceof NavigationStart) {
169
- this.browserRefresh = !router.navigated;
170
- // console.log('browserRefresh ', this.browserRefresh)
171
- }
172
- });
173
- }
174
154
 
175
155
  listenChatAlreadyOpenWithoutParamsInMobileMode() {
176
156
  this.events.subscribe('noparams:mobile', (isAlreadyOpenInMobileMode) => {
@@ -881,13 +861,11 @@ export class AppComponent implements OnInit {
881
861
  // clearTimeout(this.timeModalLogin);
882
862
  const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
883
863
 
884
- const supportmode = this.appConfigProvider.getConfig().supportMode;
885
- this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
886
- if (supportmode === true) {
887
-
888
- this.connetWebsocket(tiledeskToken)
889
-
890
- }
864
+ // const supportmode = this.appConfigProvider.getConfig().supportMode;
865
+ // this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
866
+ // if (supportmode === true) {
867
+ // this.connetWebsocket() // moved in the comp project-item
868
+ // }
891
869
  this.events.publish('go:online', true);
892
870
  const currentUser = this.tiledeskAuthService.getCurrentUser();
893
871
  // this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
@@ -921,17 +899,7 @@ export class AppComponent implements OnInit {
921
899
  }
922
900
  }
923
901
 
924
- connetWebsocket(tiledeskToken) {
925
- const appconfig = this.appConfigProvider.getConfig();
926
- this.logger.log('connetWebsocket appconfig wsUrl ', appconfig.wsUrl)
927
- const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
928
- this.webSocketJs.init(
929
- WS_URL,
930
- undefined,
931
- undefined,
932
- undefined
933
- );
934
- }
902
+
935
903
 
936
904
 
937
905
  goOffLine = () => {
@@ -9,6 +9,7 @@ import { CustomTranslateService } from 'src/chat21-core/providers/custom-transla
9
9
  import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
10
10
  import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service';
11
11
  import { WebSocketJs } from 'src/app/services/websocket/websocket-js';
12
+ import { AppConfigProvider } from 'src/app/services/app-config';
12
13
 
13
14
  @Component({
14
15
  selector: 'app-project-item',
@@ -38,11 +39,11 @@ export class ProjectItemComponent implements OnInit {
38
39
  public tiledeskAuthService: TiledeskAuthService,
39
40
  public tiledeskService: TiledeskService,
40
41
  public webSocketJs: WebSocketJs,
42
+ private appConfigProvider: AppConfigProvider,
41
43
  ) { }
42
44
 
43
45
  ngOnInit() {
44
- this.getLastProjectStoredAndSubscToWSAvailabilityAndConversations();
45
- this.getStoredToken();
46
+ this.getStoredTokenAndConnectWS();
46
47
  this.getStoredCurrenUser();
47
48
  this.translations();
48
49
  this.listenToPostMsgs();
@@ -50,6 +51,29 @@ export class ProjectItemComponent implements OnInit {
50
51
  // console.log('[PROJECT-ITEM] - on INIT')
51
52
  }
52
53
 
54
+ getStoredTokenAndConnectWS() {
55
+ this.tiledeskToken = this.appStorageService.getItem('tiledeskToken');
56
+ this.logger.log('[PROJECT-ITEM] - STORED TILEDEK TOKEN ', this.tiledeskToken)
57
+ this.connetWebsocket( this.tiledeskToken)
58
+ }
59
+
60
+ connetWebsocket(tiledeskToken) {
61
+
62
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ',tiledeskToken)
63
+ const appconfig = this.appConfigProvider.getConfig();
64
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
65
+ const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
66
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
67
+ this.webSocketJs.init(
68
+ WS_URL,
69
+ undefined,
70
+ undefined,
71
+ undefined
72
+ );
73
+
74
+ this.getLastProjectStoredAndSubscToWSAvailabilityAndConversations();
75
+ }
76
+
53
77
  listenToPostMsgs() {
54
78
  window.addEventListener("message", (event) => {
55
79
  // console.log("[PROJECT-ITEM] post message event ", event);
@@ -104,11 +128,7 @@ export class ProjectItemComponent implements OnInit {
104
128
 
105
129
 
106
130
 
107
- getStoredToken() {
108
- this.tiledeskToken = this.appStorageService.getItem('tiledeskToken');
109
- this.logger.log('[PROJECT-ITEM] - STORED TILEDEK TOKEN ', this.tiledeskToken)
110
-
111
- }
131
+
112
132
 
113
133
  getStoredCurrenUser() {
114
134
  const storedCurrentUser = this.appStorageService.getItem('currentUser');
@@ -93,7 +93,7 @@ export class WebSocketJs {
93
93
  var that = this;
94
94
  if (this.ws) {
95
95
  this.ws.addEventListener("open", function (event) {
96
- this.logger.log('[WEBSOCKET-JS] - REF - OPEN EVENT *** ', event);
96
+ that.logger.log('[WEBSOCKET-JS] - REF - OPEN EVENT *** ', event);
97
97
  that.subscribe(topic);
98
98
  });
99
99
  } else {
@@ -329,7 +329,7 @@ export class WebSocketJs {
329
329
  // this.sendingMessages = [];//new Map();
330
330
  // this.data = [];
331
331
  // this.init(this.sendMesagesInSendingArray);
332
-
332
+ this.logger.log("[WEBSOCKET-JS] - CALLING INIT - url ", this.url);
333
333
  this.logger.log("[WEBSOCKET-JS] - CALLING INIT - topics ", this.topics);
334
334
  this.logger.log("[WEBSOCKET-JS] - CALLING INIT - url ", this.url);
335
335
  this.logger.log("[WEBSOCKET-JS] - CALLING INIT - callbacks ", this.callbacks);