@chat21/chat21-ionic 3.4.27-rc2 → 3.4.27-rc3

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
@@ -8,6 +8,9 @@
8
8
  ### **Copyrigth**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.27-rc3
12
+ - **bug-fixed**: cannot set user availability if supportMode is enabled and tiledesk_projectID url params is set
13
+
11
14
  # 3.4.27-rc2
12
15
  - **bug-fixed**: cannede responses role
13
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.4.27-rc2",
4
+ "version": "3.4.27-rc3",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -44,6 +44,7 @@ import { conversationToMessage } from 'src/chat21-core/utils/utils-message';
44
44
  import { ProjectService } from './services/projects/project.service';
45
45
  import { ContactsService } from './services/contacts/contacts.service';
46
46
  import { TiledeskService } from './services/tiledesk/tiledesk.service';
47
+ import { Project } from 'src/chat21-core/models/projects';
47
48
  import { ProjectUsersService } from './services/project_users/project-users.service';
48
49
 
49
50
  @Component({
@@ -1182,11 +1183,14 @@ export class AppComponent implements OnInit {
1182
1183
  this.contactsService.initialize(serverBaseURL)
1183
1184
  // this.chatManager.startApp();
1184
1185
 
1186
+
1187
+ //INIT WEBSOCKET
1188
+ this.connetWebsocket(tiledeskToken)
1189
+
1185
1190
  // ----------------------------------------------
1186
1191
  // PUSH NOTIFICATIONS
1187
1192
  // ----------------------------------------------
1188
1193
  const pushEngine = this.appConfigProvider.getConfig().pushEngine
1189
-
1190
1194
  if (currentUser) {
1191
1195
  if (pushEngine && pushEngine !== 'none') {
1192
1196
  this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
@@ -1208,6 +1212,24 @@ export class AppComponent implements OnInit {
1208
1212
  } catch (err) {
1209
1213
  this.logger.error('[APP-COMP] -> error:', err);
1210
1214
  }
1215
+
1216
+ // ----------------------------------------------
1217
+ // LAST PROJECT FROM URL
1218
+ // ----------------------------------------------
1219
+ if(this.g.projectID){
1220
+ this.projectService.getProjects().subscribe({ next: (projects: Project[]) => {
1221
+ const project = projects.find(prjct => prjct.id_project._id === this.g.projectID)
1222
+ if(project){
1223
+ this.logger.log('[APP-COMP] - GET PROJECT - project found with this.projectID', project);
1224
+ localStorage.setItem('last_project', JSON.stringify(project))
1225
+ this.events.publish('storage:last_project', project)
1226
+ }
1227
+ }, error: (error) => {
1228
+ this.logger.log('[APP-COMP] - GET PROJECT - project NOT found with this.projectID', this.g.projectID, error);
1229
+ }, complete: () => {
1230
+
1231
+ }});
1232
+ }
1211
1233
  }
1212
1234
 
1213
1235
 
@@ -1253,6 +1275,21 @@ export class AppComponent implements OnInit {
1253
1275
  myWindow.focus();
1254
1276
  }
1255
1277
 
1278
+ connetWebsocket(tiledeskToken) {
1279
+
1280
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ', tiledeskToken)
1281
+ const appconfig = this.appConfigProvider.getConfig();
1282
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
1283
+ const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
1284
+ this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
1285
+ this.webSocketJs.init(
1286
+ WS_URL,
1287
+ undefined,
1288
+ undefined,
1289
+ undefined
1290
+ );
1291
+ }
1292
+
1256
1293
 
1257
1294
  webSocketClose() {
1258
1295
  this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
@@ -85,17 +85,17 @@ export class ProjectItemComponent implements OnInit {
85
85
 
86
86
  connetWebsocket(tiledeskToken) {
87
87
 
88
- this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ', tiledeskToken)
89
- const appconfig = this.appConfigProvider.getConfig();
90
- this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
91
- const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
92
- this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
93
- this.webSocketJs.init(
94
- WS_URL,
95
- undefined,
96
- undefined,
97
- undefined
98
- );
88
+ // this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] tiledeskToken ', tiledeskToken)
89
+ // const appconfig = this.appConfigProvider.getConfig();
90
+ // this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', appconfig.wsUrl)
91
+ // const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
92
+ // this.logger.log('[WEBSOCKET-JS] connetWebsocket called in [PROJECT-ITEM] wsUrl ', WS_URL)
93
+ // this.webSocketJs.init(
94
+ // WS_URL,
95
+ // undefined,
96
+ // undefined,
97
+ // undefined
98
+ // );
99
99
 
100
100
  this.getLastProjectStoredAndSubscToWSAvailabilityAndConversations();
101
101
  }
@@ -284,6 +284,8 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
284
284
  } else if (this.project.profile.type === 'payment' && this.project.profile.name === 'enterprise') {
285
285
  this.getEnterprisePlanTranslation();
286
286
  }
287
+
288
+ this.wsService.subscriptionToWsCurrentProjectUserAvailability(this.project._id, projectObjct._id);
287
289
  }
288
290
  })
289
291