@chat21/chat21-ionic 3.0.59-rc2 → 3.0.59-rc7

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 (42) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/env.sample +1 -0
  3. package/package.json +1 -1
  4. package/src/app/app-routing.module.ts +21 -17
  5. package/src/app/app.component.ts +206 -42
  6. package/src/app/app.module.ts +4 -1
  7. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +18 -4
  8. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +0 -144
  9. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
  10. package/src/app/components/authentication/login/login.component.html +2 -2
  11. package/src/app/components/authentication/login/login.component.ts +2 -1
  12. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
  13. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +20 -15
  14. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  15. package/src/app/components/project-item/project-item.component.html +136 -0
  16. package/src/app/components/project-item/project-item.component.scss +669 -0
  17. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  18. package/src/app/components/project-item/project-item.component.ts +316 -0
  19. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +9 -3
  20. package/src/app/pages/authentication/login/login.page.ts +1 -1
  21. package/src/app/pages/conversation-detail/conversation-detail.page.ts +26 -22
  22. package/src/app/pages/conversations-list/conversations-list.page.html +40 -23
  23. package/src/app/pages/conversations-list/conversations-list.page.scss +146 -1
  24. package/src/app/pages/conversations-list/conversations-list.page.ts +71 -5
  25. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  26. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  27. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +14 -0
  28. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +0 -0
  29. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  30. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +105 -0
  31. package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
  32. package/src/app/services/websocket/websocket-js.ts +559 -0
  33. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  34. package/src/app/services/websocket/websocket.service.ts +274 -0
  35. package/src/app/shared/shared.module.ts +3 -0
  36. package/src/assets/i18n/en.json +8 -1
  37. package/src/assets/i18n/it.json +8 -1
  38. package/src/chat-config-pre-test.json +3 -1
  39. package/src/chat-config-template.json +2 -1
  40. package/src/chat-config.json +3 -1
  41. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +2 -2
  42. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,11 +1,30 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.59-rc7
4
+ - Fixes the bug "Cannot read properties of undefined (reading 'get')" in component template showing the number of new conversations
5
+ - Fixes the bug: the value of the "supportMode" property is passed hard-coded
6
+
7
+ ### 3.0.59-rc6
8
+ - Outsources the websocket URL to environments
9
+ - Improves the graphic of the element, positioned at the top of the conversation list, which displays the number of new conversations
10
+ - Adds "wsUrl" property to env.sample, chat-config-template.json and chat-config.json
11
+ - Updates environments with "wsUrl" property
12
+
13
+ ### 3.0.59-rc5
14
+ - Display a "toast message" of success after that the agent has joined to an unassigned conversation and other minor improvements
15
+
16
+ ### 3.0.59-rc4
17
+ - Adds an item to the top of the conversation list that shows the number of unassigned conversations for a selected project
18
+ - Adds the ability, by clicking on the element that displays the number of unassigned conversations, to view the unassigned conversations and to join to them or archive them
19
+
20
+ ### 3.0.59-rc3
21
+ - Improves the method that allows to chain multiple canned responses
22
+
3
23
  ### 3.0.59-rc2
4
24
  - Fixes the bug: on small windows, images and iframes are not the same size as the bubble message that contains them
5
25
  - Adds in the "bubble-message" component a check if the metadata is an object before calling the getMetadataSize() method
6
26
  - Hides the "canned responses" if there are whitespace after the forward slash "/" or if there are no whitespace before the forward slash "/"
7
27
  - Fixes the bug: if the "canned responses" are selected with the mouse, the "send message" text area does not have focus
8
- - Fixes the bug: on mobile devices, a blank page appears when the hardware back button is pressed in the conversation list
9
28
  - Adds the image viewer and the ability to download an image from it
10
29
  - Fixes the position of the "archive" button when the app runs on mobile devices
11
30
  - Updates Android splash screen .png image
package/env.sample CHANGED
@@ -1,5 +1,6 @@
1
1
  API_BASEIMAGE_URL=CHANGEIT
2
2
  DASHBOARD_URL=https://YOUR_DASHBOARD_URL
3
+ WS_URL=wss://YOUR_TILEDESK_SERVER_URL?token=
3
4
 
4
5
  SERVER_BASE_URL=http://localhost:3000/
5
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.59-rc2",
3
+ "version": "3.0.59-rc7",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://ionicframework.com/",
6
6
  "scripts": {
@@ -29,6 +29,27 @@ const routes: Routes = [
29
29
  loadChildren: './pages/conversation-detail/conversation-detail.module#ConversationDetailPageModule'
30
30
 
31
31
  },
32
+ {
33
+ path: 'contacts-directory',
34
+ loadChildren: () => import('./pages/contacts-directory/contacts-directory.module').then( m => m.ContactsDirectoryPageModule)
35
+ },
36
+ {
37
+ path: 'login',
38
+ loadChildren: () => import('./pages/authentication/login/login.module').then( m => m.LoginPageModule)
39
+ },
40
+ {
41
+ path: 'profile-info',
42
+ loadChildren: () => import('./pages/profile-info/profile-info.module').then( m => m.ProfileInfoPageModule)
43
+ },
44
+ {
45
+ path: 'loader-preview',
46
+ loadChildren: () => import('./pages/loader-preview/loader-preview.module').then( m => m.LoaderPreviewPageModule)
47
+ },
48
+ {
49
+ path: 'unassigned-conversations',
50
+ loadChildren: () => import('./pages/unassigned-conversations/unassigned-conversations.module').then( m => m.UnassignedConversationsPageModule)
51
+ }
52
+
32
53
 
33
54
  // {
34
55
  // path: 'conversation-detail/:IDConv',
@@ -50,23 +71,6 @@ const routes: Routes = [
50
71
  // // loadChildren: () => import('./pages/details/details.module').then( m => m.DetailsPageModule),
51
72
  // // loadChildren: './pages/details/details.module',
52
73
  // },
53
- {
54
- path: 'contacts-directory',
55
- loadChildren: () => import('./pages/contacts-directory/contacts-directory.module').then( m => m.ContactsDirectoryPageModule)
56
- },
57
- {
58
- path: 'login',
59
- loadChildren: () => import('./pages/authentication/login/login.module').then( m => m.LoginPageModule)
60
- },
61
- {
62
- path: 'profile-info',
63
- loadChildren: () => import('./pages/profile-info/profile-info.module').then( m => m.ProfileInfoPageModule)
64
- },
65
- {
66
- path: 'loader-preview',
67
- loadChildren: () => import('./pages/loader-preview/loader-preview.module').then( m => m.LoaderPreviewPageModule)
68
- }
69
-
70
74
 
71
75
 
72
76
  // {
@@ -55,9 +55,8 @@ import { getImageUrlThumbFromFirebasestorage } from 'src/chat21-core/utils/utils
55
55
  import { TiledeskService } from './services/tiledesk/tiledesk.service';
56
56
  import { NetworkService } from './services/network-service/network.service';
57
57
  import * as PACKAGE from 'package.json';
58
-
59
- import { Subject } from 'rxjs';
60
- import { filter, takeUntil } from 'rxjs/operators'
58
+ import { filter } from 'rxjs/operators'
59
+ import { WebSocketJs } from './services/websocket/websocket-js';
61
60
 
62
61
  // import { filter } from 'rxjs/operators';
63
62
 
@@ -99,9 +98,11 @@ export class AppComponent implements OnInit {
99
98
  public missingConnectionToast: any
100
99
  public executedInitializeAppByWatchConnection: boolean = false;
101
100
  private version: string;
102
- private unsubscribe$: Subject<any> = new Subject<any>();
101
+
103
102
  // private isOnline: boolean = false;
104
103
 
104
+ wsService: WebSocketJs;
105
+
105
106
  constructor(
106
107
  private platform: Platform,
107
108
  private splashScreen: SplashScreen,
@@ -136,34 +137,105 @@ export class AppComponent implements OnInit {
136
137
  public toastController: ToastController,
137
138
  // private network: Network,
138
139
  // private tiledeskService: TiledeskService,
139
- private networkService: NetworkService
140
+ private networkService: NetworkService,
141
+ public webSocketJs: WebSocketJs,
140
142
  ) {
141
- this.logger.log('[APP-COMP] HELLO Constuctor !!!!!!!')
142
- // HACK: fix toast not presented when offline, due to lazy loading the toast controller.
143
- // this.toastController.create({ animated: false }).then(t => {
144
- // console.log('[APP-COMP] toastController create')
145
- // t.present();
146
- // t.dismiss();
147
- // });
143
+
144
+ // this.saveInStorageChatOpenedTab();
145
+ // FOR TEST
146
+ // const last_project = { "user_available": true, "number_assigned_requests": 59, "last_login_at": "2021-08-09T17:30:55.234Z", "status": "active", "_id": "6112bc8f58c958003495a2cb", "id_project": { "status": 100, "_id": "60ffe291f725db00347661ef", "name": "27-LUGLIO-21-STRIPE-TEST", "activeOperatingHours": false, "createdBy": "608ad02d3a4dc000344ade17", "profile": { "name": "pro", "trialDays": 30, "agents": 5, "type": "payment", "subStart": "2021-11-18T10:42:41.000Z", "subEnd": "2021-11-19T10:42:41.000Z", "subscriptionId": "sub_Jvf4kABe9t8JvX", "last_stripe_event": "invoice.payment_succeeded" }, "versions": 20115, "channels": [{ "name": "chat21" }], "createdAt": "2021-07-27T10:40:17.752Z", "updatedAt": "2021-11-18T11:55:01.346Z", "__v": 0, "widget": { "preChatForm": true, "preChatFormJson": [{ "name": "userFullname", "type": "text", "mandatory": true, "label": { "en": "Your name", "it": "Il tuo nome" } }, { "name": "userEmail", "type": "text", "mandatory": true, "regex": "/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/", "label": { "en": "Your email", "it": "La tua email" }, "errorLabel": { "en": "Invalid email address", "it": "Indirizzo email non valido" } }, { "name": "tel", "mandatory": true, "label": { "en": "Your phone number", "it": "Il tuo numero di telefono" } }], "preChatFormCustomFieldsEnabled": true }, "trialExpired": true, "trialDaysLeft": 84, "isActiveSubscription": true, "id": "60ffe291f725db00347661ef" }, "id_user": "60aa0fef1482fe00346854a7", "role": "admin", "createdBy": "608ad02d3a4dc000344ade17", "createdAt": "2021-08-10T17:51:11.318Z", "updatedAt": "2021-11-19T08:08:21.437Z", "__v": 0, "presence": { "status": "online", "changedAt": "2021-11-19T08:08:21.432Z" }, "isAuthenticated": true, "id": "6112bc8f58c958003495a2cb" }
147
+ // localStorage.setItem('last_project', JSON.stringify(last_project))
148
148
  }
149
+ saveInStorageChatOpenedTab() {
150
+ // if (+localStorage.tabCount > 0) {
151
+ // alert('Already open!');
152
+ // } else {
153
+ // localStorage.tabCount = 0;
154
+ // }
155
+
156
+ // window.addEventListener('load', (event) => {
157
+ // console.log('[CONVS-LIST-PAGE] page is fully loaded', event);
158
+ // // let tab = + localStorage.getItem('tab')
159
+ // // console.log('[CONVS-LIST-PAGE] page is fully loaded getItem tab', + tab);
160
+ // // localStorage.setItem('tab', "1" )
161
+ // localStorage.tabCount = +localStorage.tabCount + 1;
162
+ // });
163
+
164
+ // // https://developers.google.com/web/updates/2018/07/page-lifecycle-api#the-beforeunload-event
165
+ // const terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';
166
+ // window.addEventListener(terminationEvent, (event) => {
167
+ // console.log('[CONVS-LIST-PAGE] page is terminationEvent', event);
168
+ // localStorage.tabCount = +localStorage.tabCount - 1;
169
+ // }, { capture: true });
170
+ const getState = () => {
171
+ if (document.visibilityState === 'hidden') {
172
+ return 'hidden';
173
+ }
174
+ if (document.hasFocus()) {
175
+ return 'active';
176
+ }
177
+ return 'passive';
178
+ };
179
+
180
+ let state = getState();
181
+ console.log('[CONVS-LIST-PAGE] page state ', state)
182
+ if (state === 'hidden') {
183
+ localStorage.setItem('hidden', 'true')
184
+ }
185
+
186
+ const logStateChange = (nextState) => {
187
+ const prevState = state;
188
+ if (nextState !== prevState) {
189
+ console.log(`State change: ${prevState} >>> ${nextState}`);
190
+ state = nextState;
191
+ }
192
+ };
193
+
194
+ ['pageshow', 'focus', 'blur', 'visibilitychange', 'resume'].forEach((type) => {
195
+ window.addEventListener(type, () => logStateChange(getState()), { capture: true });
196
+ });
197
+
198
+ // The next two listeners, on the other hand, can determine the next
199
+ // state from the event itself.
200
+ window.addEventListener('freeze', () => {
201
+ // In the freeze event, the next state is always frozen.
202
+ logStateChange('frozen');
203
+ }, { capture: true });
204
+
205
+ window.addEventListener('pagehide', (event) => {
206
+ if (event.persisted) {
207
+ // If the event's persisted property is `true` the page is about
208
+ // to enter the Back-Forward Cache, which is also in the frozen state.
209
+ logStateChange('frozen');
210
+ localStorage.setItem('terminated', 'true')
211
+ } else {
212
+ // If the event's persisted property is not `true` the page is
213
+ // about to be unloaded.
214
+ logStateChange('terminated');
215
+ localStorage.setItem('terminated', 'true')
216
+ }
217
+ }, { capture: true });
149
218
 
150
- param() {
151
- // PARAM
152
- const url: URL = new URL(window.top.location.href);
153
- const params: URLSearchParams = url.searchParams;
154
- return params;
155
219
  }
220
+
221
+
222
+ // param() {
223
+ // // PARAM
224
+ // const url: URL = new URL(window.top.location.href);
225
+ // const params: URLSearchParams = url.searchParams;
226
+ // return params;
227
+ // }
156
228
  /**
157
229
  */
158
230
  ngOnInit() {
159
231
  const appconfig = this.appConfigProvider.getConfig();
160
232
  this.persistence = appconfig.authPersistence;
161
233
  this.appStorageService.initialize(environment.storage_prefix, this.persistence, '')
162
- this.logger.log('[APP-COMP] HELLO ngOnInit !!!!!!!')
163
- this.logger.log('[APP-COMP] ngOnInit this.route.snapshot.params -->', this.route.snapshot.params);
234
+ // this.logger.log('[APP-COMP] HELLO ngOnInit !!!!!!!')
235
+ // this.logger.log('[APP-COMP] ngOnInit this.route.snapshot.params -->', this.route.snapshot.params);
164
236
  // this.initializeApp('oninit');
165
237
  const token = getParameterByName('jwt')
166
- this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName -->', token);
238
+ // this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName -->', token);
167
239
 
168
240
  if (token) {
169
241
  // this.isOnline = false;
@@ -182,8 +254,80 @@ export class AppComponent implements OnInit {
182
254
  }
183
255
  this.initializeApp('oninit');
184
256
 
257
+ this.listenToPostMsgs();
258
+ }
259
+
260
+
261
+
262
+ listenToPostMsgs() {
263
+ window.addEventListener("message", (event) => {
264
+ // console.log("[APP-COMP] message event ", event);
265
+
266
+ if (event && event.data && event.data.action && event.data.parameter) {
267
+ if (event.data.action === 'openJoinConversationModal') {
268
+ // console.log("[APP-COMP] message event action ", event.data.action);
269
+ // console.log("[APP-COMP] message event parameter ", event.data.parameter);
270
+ this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
271
+ }
272
+ }
273
+ if (event && event.data && event.data.action && event.data.text) {
274
+ if (event.data.action === "display_toast_join_complete") {
275
+ this.presentToastJoinComplete(event.data.text)
276
+ }
277
+ }
278
+ })
279
+ }
280
+
281
+ async presentToastJoinComplete(text) {
282
+ const toast = await this.toastController.create({
283
+ message: text,
284
+ duration: 2000,
285
+ color: "success"
286
+ });
287
+ toast.present();
185
288
  }
186
289
 
290
+ async presentAlertConfirmJoinRequest(requestid, calledby) {
291
+ var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
292
+ // console.log("[APP-COMP] message event iframeWin ", iframeWin);
293
+
294
+ const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
295
+ input !== null && input.tagName === 'IFRAME';
296
+
297
+ const keys = ['YouAreAboutToJoinThisChat', 'Cancel', 'AreYouSure'];
298
+ const translationMap = this.translateService.translateLanguage(keys);
299
+
300
+ const alert = await this.alertController.create({
301
+ cssClass: 'my-custom-class',
302
+ header: translationMap.get('AreYouSure'),
303
+ message: translationMap.get('YouAreAboutToJoinThisChat'),
304
+ buttons: [
305
+ {
306
+ text: translationMap.get('Cancel'),
307
+ role: 'cancel',
308
+ cssClass: 'secondary',
309
+ handler: (blah) => {
310
+ // console.log('Confirm Cancel: blah', blah);
311
+ }
312
+ }, {
313
+ text: 'Ok',
314
+ handler: () => {
315
+ // console.log('Confirm Okay');
316
+
317
+ if (isIFrame(iframeWin) && iframeWin.contentWindow) {
318
+ const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
319
+ iframeWin.contentWindow.postMessage(msg, '*');
320
+ }
321
+ }
322
+ }
323
+ ]
324
+ });
325
+
326
+ await alert.present();
327
+ }
328
+
329
+
330
+
187
331
 
188
332
  signInWithCustomToken(token) {
189
333
  // this.isOnline = false;
@@ -200,8 +344,8 @@ export class AppComponent implements OnInit {
200
344
 
201
345
  /** */
202
346
  initializeApp(calledby: string) {
203
- this.logger.log('[APP-COMP] - X - initializeApp !!! CALLED-BY: ', calledby);
204
- this.logger.log('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
347
+ // this.logger.log('[APP-COMP] - X - initializeApp !!! CALLED-BY: ', calledby);
348
+ // this.logger.log('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
205
349
 
206
350
  if (!this.platform.is('cordova')) {
207
351
  this.splashScreen.show();
@@ -320,7 +464,7 @@ export class AppComponent implements OnInit {
320
464
  getRouteParamsAndSetLoggerConfig() {
321
465
  const appconfig = this.appConfigProvider.getConfig();
322
466
  this.route.queryParams.subscribe(params => {
323
- this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
467
+ // this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
324
468
  if (params.logLevel) {
325
469
  this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from queryParams: ', params.logLevel)
326
470
  this.logger.setLoggerConfig(true, params.logLevel)
@@ -352,6 +496,7 @@ export class AppComponent implements OnInit {
352
496
  /**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
353
497
  private initAuthentication() {
354
498
  const tiledeskToken = this.appStorageService.getItem('tiledeskToken')
499
+
355
500
  this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
356
501
  this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
357
502
  // const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
@@ -360,19 +505,19 @@ export class AppComponent implements OnInit {
360
505
  this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
361
506
  this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
362
507
  this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
363
- this.messagingAuthService.createCustomToken(tiledeskToken)
508
+ this.messagingAuthService.createCustomToken(tiledeskToken)
364
509
  }).catch(error => {
365
510
  this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
366
511
  })
367
512
  } else {
368
513
  this.logger.warn('[APP-COMP] >>> I AM NOT LOGGED IN <<<')
369
-
514
+
370
515
  // clearTimeout(this.timeModalLogin);
371
516
  // this.timeModalLogin = setTimeout(() => {
372
- if (!this.hadBeenCalledOpenModal) {
373
- this.authModal = this.presentModal('initAuthentication');
374
- this.hadBeenCalledOpenModal = true;
375
- }
517
+ if (!this.hadBeenCalledOpenModal) {
518
+ this.authModal = this.presentModal('initAuthentication');
519
+ this.hadBeenCalledOpenModal = true;
520
+ }
376
521
  // }, 1000);
377
522
  }
378
523
  }
@@ -385,6 +530,18 @@ export class AppComponent implements OnInit {
385
530
  // }
386
531
  // }
387
532
 
533
+ connetWebsocket(tiledeskToken) {
534
+ const appconfig = this.appConfigProvider.getConfig();
535
+ this.logger.log('connetWebsocket appconfig wsUrl ', appconfig.wsUrl)
536
+ const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
537
+ this.webSocketJs.init(
538
+ WS_URL,
539
+ undefined,
540
+ undefined,
541
+ undefined
542
+ );
543
+ }
544
+
388
545
  /**
389
546
  * goOnLine:
390
547
  * 1 - nascondo splashscreen
@@ -396,8 +553,10 @@ export class AppComponent implements OnInit {
396
553
  // this.isOnline = true;
397
554
  // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
398
555
 
399
- clearTimeout(this.timeModalLogin);
556
+ // clearTimeout(this.timeModalLogin);
400
557
  const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
558
+ this.connetWebsocket(tiledeskToken)
559
+
401
560
  const currentUser = this.tiledeskAuthService.getCurrentUser();
402
561
  // this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
403
562
  this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
@@ -429,8 +588,16 @@ export class AppComponent implements OnInit {
429
588
  this.chatManager.startApp();
430
589
  }
431
590
 
591
+
592
+ webSocketClose() {
593
+ this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
594
+ this.webSocketJs.close()
595
+ }
596
+
432
597
  goOffLine = () => {
433
598
  this.logger.log('[APP-COMP] - GO-OFFLINE');
599
+
600
+ this.webSocketClose()
434
601
  // this.isOnline = false;
435
602
  // this.conversationsHandlerService.conversations = [];
436
603
 
@@ -439,13 +606,13 @@ export class AppComponent implements OnInit {
439
606
  this.chatManager.goOffLine();
440
607
 
441
608
  this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
442
-
609
+
443
610
  // clearTimeout(this.timeModalLogin);
444
611
  // this.timeModalLogin = setTimeout(() => {
445
- if (!this.hadBeenCalledOpenModal) {
446
- this.authModal = this.presentModal('goOffLine');
447
- this.hadBeenCalledOpenModal = true
448
- }
612
+ if (!this.hadBeenCalledOpenModal) {
613
+ this.authModal = this.presentModal('goOffLine');
614
+ this.hadBeenCalledOpenModal = true
615
+ }
449
616
  // }, 1000);
450
617
 
451
618
  // this.unsubscribe$.next();
@@ -601,8 +768,8 @@ export class AppComponent implements OnInit {
601
768
  return;
602
769
  }
603
770
 
604
- this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
605
-
771
+ this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
772
+
606
773
  // .pipe(takeUntil(this.unsubscribe$))
607
774
  .pipe(filter((state) => state !== null))
608
775
  .subscribe((state: any) => {
@@ -848,7 +1015,7 @@ export class AppComponent implements OnInit {
848
1015
  // https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
849
1016
  @HostListener('window:storage', ['$event'])
850
1017
  onStorageChanged(event: any) {
851
- // console.log('[APP-COMP] - onStorageChanged event ', event)
1018
+
852
1019
  if (event.key !== 'chat_sv5__tiledeskToken') {
853
1020
  return;
854
1021
  }
@@ -877,7 +1044,7 @@ export class AppComponent implements OnInit {
877
1044
  // this.unsubscribe$.complete();
878
1045
  this.initializeApp('onstoragechanged');
879
1046
 
880
-
1047
+
881
1048
 
882
1049
  // console.log('[APP-COMP] onAuthStateChanged HERE !!! ')
883
1050
  // firebase.auth().onAuthStateChanged(user => {
@@ -887,7 +1054,4 @@ export class AppComponent implements OnInit {
887
1054
  }
888
1055
  }
889
1056
  }
890
-
891
-
892
-
893
1057
  }
@@ -94,7 +94,8 @@ import { TooltipModule } from 'ng2-tooltip-directive';
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';
97
-
97
+ import { WebSocketJs } from './services/websocket/websocket-js';
98
+ import { UnassignedConversationsPageModule } from './pages/unassigned-conversations/unassigned-conversations.module';
98
99
 
99
100
  // FACTORIES
100
101
  export function createTranslateLoader(http: HttpClient) {
@@ -253,6 +254,7 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
253
254
  LoginPageModule,
254
255
  ConversationListPageModule,
255
256
  ConversationDetailPageModule,
257
+ UnassignedConversationsPageModule,
256
258
  TranslateModule.forRoot({
257
259
  loader: {
258
260
  provide: TranslateLoader,
@@ -352,6 +354,7 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
352
354
  EventsService,
353
355
  Chooser,
354
356
  Chat21Service,
357
+ WebSocketJs
355
358
  ]
356
359
  })
357
360
  export class AppModule { }
@@ -25,7 +25,8 @@
25
25
  <!-- -------------------------------------------------------------------------- -->
26
26
  <!-- New <ion-spinner class="spinner-middle" style="margin-left: 19px;"></ion-spinner> -->
27
27
  <!-- -------------------------------------------------------------------------- -->
28
- <ion-item *ngIf="isOnline === false" button="true" lines="none" class="ion-no-padding waiting-for-connection">
28
+ <!-- <ion-item *ngIf="isOnline === false" button="true" lines="none" class="ion-no-padding waiting-for-connection">
29
+ <div tabindex="0"></div>
29
30
  <ion-avatar item-start>
30
31
  <div class="sk-fading-circle">
31
32
  <div class="sk-circle1 sk-circle"></div>
@@ -43,7 +44,17 @@
43
44
  </div>
44
45
  </ion-avatar>
45
46
  <ion-label part="message-text" class="waiting-for-network-msg"> Waiting for network</ion-label>
46
- </ion-item>
47
+ </ion-item> -->
48
+
49
+ <!-- <ion-item>
50
+ <div tabindex="0"></div>
51
+ <iframe loading="lazy" width="100%" height="70px" style="border: unset;" [src]="PROJECT_FOR_PANEL"></iframe>
52
+ </ion-item> -->
53
+ <!-- <ion-item button="true" (click)="openUnsevedConversationIframe()">
54
+ <app-project-item
55
+ (projectIdEvent)="getLastProjectId($event)"></app-project-item>
56
+ </ion-item> -->
57
+
47
58
 
48
59
  <!-- <ion-item-sliding disabled>
49
60
  <ion-item>
@@ -63,6 +74,7 @@
63
74
  </ion-item-options>
64
75
  </ion-item-sliding> -->
65
76
 
77
+
66
78
  <ion-item button="true" lines="none" class="ion-no-padding" [class.ion-selected]="conversation.uid === uidConvSelected"
67
79
  *ngFor="let conversation of listConversations" (click)="openConversationByID(conversation)" detail=false>
68
80
  <div tabindex="0"></div>
@@ -106,7 +118,8 @@
106
118
  <ion-note *ngIf="!conversation.archived" class="conversation_time">{{conversation.timestamp | amTimeAgo}}</ion-note>
107
119
 
108
120
  <ion-buttons slot="end">
109
- <ion-button *ngIf="!conversation.archived" [ngClass]="{'hide': !isApp, 'button-on-desktop': !isApp, 'button-on-mobile': isApp }"
121
+ <ion-button *ngIf="!conversation.archived"
122
+ [ngClass]="{'hide': !isApp, 'button-on-desktop': !isApp, 'button-on-mobile': isApp }"
110
123
  id="{{ 'close_conversation_button' + conversation.uid }}" class="close-conversation-button" ion-button clear
111
124
  item-end (click)="closeConversation(conversation);$event.stopPropagation();" padding>
112
125
  <ion-icon slot="icon-only" style="display:block;" id="{{ 'close_button_icon' + conversation.uid }}"
@@ -135,7 +148,8 @@
135
148
  </div>
136
149
 
137
150
  <!-- && !conversation?.archived -->
138
- <div item-end class="notification_point" [ngClass]="{'notification_point-on-desktop': !isApp, 'notification_point-on-mobile': isApp }"
151
+ <div item-end class="notification_point"
152
+ [ngClass]="{'notification_point-on-desktop': !isApp, 'notification_point-on-mobile': isApp }"
139
153
  *ngIf="conversation.is_new">
140
154
  </div>
141
155