@chat21/chat21-ionic 3.0.59-rc3 → 3.0.59-rc4
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 +4 -1
- package/package.json +1 -1
- package/src/app/app-routing.module.ts +21 -17
- package/src/app/app.component.ts +186 -32
- package/src/app/app.module.ts +4 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +13 -2
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +0 -144
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -18
- package/src/app/components/authentication/login/login.component.html +2 -2
- package/src/app/components/authentication/login/login.component.ts +2 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +0 -7
- package/src/app/components/project-item/project-item.component.html +102 -0
- package/src/app/components/project-item/project-item.component.scss +542 -0
- package/src/app/components/project-item/project-item.component.spec.ts +24 -0
- package/src/app/components/project-item/project-item.component.ts +308 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.html +9 -3
- package/src/app/pages/authentication/login/login.page.ts +1 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +26 -22
- package/src/app/pages/conversations-list/conversations-list.page.html +40 -23
- package/src/app/pages/conversations-list/conversations-list.page.scss +146 -1
- package/src/app/pages/conversations-list/conversations-list.page.ts +63 -4
- package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +14 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +0 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +105 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
- package/src/app/services/websocket/websocket-js.ts +559 -0
- package/src/app/services/websocket/websocket.service.spec.ts +12 -0
- package/src/app/services/websocket/websocket.service.ts +274 -0
- package/src/app/shared/shared.module.ts +3 -0
- package/src/assets/i18n/en.json +8 -1
- package/src/assets/i18n/it.json +8 -1
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.59-rc4
|
|
4
|
+
- Adds an item to the top of the conversation list that shows the number of unassigned conversations for a selected project
|
|
5
|
+
- 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
|
|
6
|
+
|
|
3
7
|
### 3.0.59-rc3
|
|
4
8
|
- Improves the method that allows to chain multiple canned responses
|
|
5
9
|
|
|
@@ -8,7 +12,6 @@
|
|
|
8
12
|
- Adds in the "bubble-message" component a check if the metadata is an object before calling the getMetadataSize() method
|
|
9
13
|
- Hides the "canned responses" if there are whitespace after the forward slash "/" or if there are no whitespace before the forward slash "/"
|
|
10
14
|
- Fixes the bug: if the "canned responses" are selected with the mouse, the "send message" text area does not have focus
|
|
11
|
-
- Fixes the bug: on mobile devices, a blank page appears when the hardware back button is pressed in the conversation list
|
|
12
15
|
- Adds the image viewer and the ability to download an image from it
|
|
13
16
|
- Fixes the position of the "archive" button when the app runs on mobile devices
|
|
14
17
|
- Updates Android splash screen .png image
|
package/package.json
CHANGED
|
@@ -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
|
// {
|
package/src/app/app.component.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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,23 +137,94 @@ 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
|
-
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
//
|
|
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() {
|
|
@@ -182,8 +254,69 @@ 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)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
|
|
185
277
|
}
|
|
186
278
|
|
|
279
|
+
async presentAlertConfirmJoinRequest(requestid) {
|
|
280
|
+
var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
|
|
281
|
+
// console.log("[APP-COMP] message event iframeWin ", iframeWin);
|
|
282
|
+
|
|
283
|
+
const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
|
|
284
|
+
input !== null && input.tagName === 'IFRAME';
|
|
285
|
+
|
|
286
|
+
const keys = ['YouAreAboutToJoinThisChat', 'Cancel', 'AreYouSure'];
|
|
287
|
+
const translationMap = this.translateService.translateLanguage(keys);
|
|
288
|
+
|
|
289
|
+
const alert = await this.alertController.create({
|
|
290
|
+
cssClass: 'my-custom-class',
|
|
291
|
+
header: translationMap.get('AreYouSure'),
|
|
292
|
+
message: translationMap.get('YouAreAboutToJoinThisChat'),
|
|
293
|
+
buttons: [
|
|
294
|
+
{
|
|
295
|
+
text: translationMap.get('Cancel'),
|
|
296
|
+
role: 'cancel',
|
|
297
|
+
cssClass: 'secondary',
|
|
298
|
+
handler: (blah) => {
|
|
299
|
+
// console.log('Confirm Cancel: blah', blah);
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
text: 'Ok',
|
|
303
|
+
handler: () => {
|
|
304
|
+
// console.log('Confirm Okay');
|
|
305
|
+
|
|
306
|
+
if (isIFrame(iframeWin) && iframeWin.contentWindow) {
|
|
307
|
+
const msg = { action: "joinConversation", parameter: requestid }
|
|
308
|
+
iframeWin.contentWindow.postMessage(msg, '*');
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
await alert.present();
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
187
320
|
|
|
188
321
|
signInWithCustomToken(token) {
|
|
189
322
|
// this.isOnline = false;
|
|
@@ -352,6 +485,7 @@ export class AppComponent implements OnInit {
|
|
|
352
485
|
/**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
|
|
353
486
|
private initAuthentication() {
|
|
354
487
|
const tiledeskToken = this.appStorageService.getItem('tiledeskToken')
|
|
488
|
+
|
|
355
489
|
this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
|
|
356
490
|
this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
|
|
357
491
|
// const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
@@ -360,19 +494,19 @@ export class AppComponent implements OnInit {
|
|
|
360
494
|
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
495
|
this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
|
|
362
496
|
this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
|
|
363
|
-
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
497
|
+
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
364
498
|
}).catch(error => {
|
|
365
499
|
this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
|
|
366
500
|
})
|
|
367
501
|
} else {
|
|
368
502
|
this.logger.warn('[APP-COMP] >>> I AM NOT LOGGED IN <<<')
|
|
369
|
-
|
|
503
|
+
|
|
370
504
|
// clearTimeout(this.timeModalLogin);
|
|
371
505
|
// this.timeModalLogin = setTimeout(() => {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
506
|
+
if (!this.hadBeenCalledOpenModal) {
|
|
507
|
+
this.authModal = this.presentModal('initAuthentication');
|
|
508
|
+
this.hadBeenCalledOpenModal = true;
|
|
509
|
+
}
|
|
376
510
|
// }, 1000);
|
|
377
511
|
}
|
|
378
512
|
}
|
|
@@ -385,6 +519,16 @@ export class AppComponent implements OnInit {
|
|
|
385
519
|
// }
|
|
386
520
|
// }
|
|
387
521
|
|
|
522
|
+
connetWebsocket(tiledeskToken) {
|
|
523
|
+
const WS_URL = 'wss://tiledesk-server-pre.herokuapp.com/' + '?token=' + tiledeskToken
|
|
524
|
+
this.webSocketJs.init(
|
|
525
|
+
WS_URL,
|
|
526
|
+
undefined,
|
|
527
|
+
undefined,
|
|
528
|
+
undefined
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
|
|
388
532
|
/**
|
|
389
533
|
* goOnLine:
|
|
390
534
|
* 1 - nascondo splashscreen
|
|
@@ -396,8 +540,10 @@ export class AppComponent implements OnInit {
|
|
|
396
540
|
// this.isOnline = true;
|
|
397
541
|
// this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
|
|
398
542
|
|
|
399
|
-
clearTimeout(this.timeModalLogin);
|
|
543
|
+
// clearTimeout(this.timeModalLogin);
|
|
400
544
|
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
545
|
+
this.connetWebsocket(tiledeskToken)
|
|
546
|
+
|
|
401
547
|
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
402
548
|
// this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
|
|
403
549
|
this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
|
|
@@ -429,8 +575,16 @@ export class AppComponent implements OnInit {
|
|
|
429
575
|
this.chatManager.startApp();
|
|
430
576
|
}
|
|
431
577
|
|
|
578
|
+
|
|
579
|
+
webSocketClose() {
|
|
580
|
+
this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
|
|
581
|
+
this.webSocketJs.close()
|
|
582
|
+
}
|
|
583
|
+
|
|
432
584
|
goOffLine = () => {
|
|
433
585
|
this.logger.log('[APP-COMP] - GO-OFFLINE');
|
|
586
|
+
|
|
587
|
+
this.webSocketClose()
|
|
434
588
|
// this.isOnline = false;
|
|
435
589
|
// this.conversationsHandlerService.conversations = [];
|
|
436
590
|
|
|
@@ -439,13 +593,13 @@ export class AppComponent implements OnInit {
|
|
|
439
593
|
this.chatManager.goOffLine();
|
|
440
594
|
|
|
441
595
|
this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
|
|
442
|
-
|
|
596
|
+
|
|
443
597
|
// clearTimeout(this.timeModalLogin);
|
|
444
598
|
// this.timeModalLogin = setTimeout(() => {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
599
|
+
if (!this.hadBeenCalledOpenModal) {
|
|
600
|
+
this.authModal = this.presentModal('goOffLine');
|
|
601
|
+
this.hadBeenCalledOpenModal = true
|
|
602
|
+
}
|
|
449
603
|
// }, 1000);
|
|
450
604
|
|
|
451
605
|
// this.unsubscribe$.next();
|
|
@@ -601,8 +755,8 @@ export class AppComponent implements OnInit {
|
|
|
601
755
|
return;
|
|
602
756
|
}
|
|
603
757
|
|
|
604
|
-
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
|
|
605
|
-
|
|
758
|
+
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
|
|
759
|
+
|
|
606
760
|
// .pipe(takeUntil(this.unsubscribe$))
|
|
607
761
|
.pipe(filter((state) => state !== null))
|
|
608
762
|
.subscribe((state: any) => {
|
|
@@ -877,7 +1031,7 @@ export class AppComponent implements OnInit {
|
|
|
877
1031
|
// this.unsubscribe$.complete();
|
|
878
1032
|
this.initializeApp('onstoragechanged');
|
|
879
1033
|
|
|
880
|
-
|
|
1034
|
+
|
|
881
1035
|
|
|
882
1036
|
// console.log('[APP-COMP] onAuthStateChanged HERE !!! ')
|
|
883
1037
|
// firebase.auth().onAuthStateChanged(user => {
|
package/src/app/app.module.ts
CHANGED
|
@@ -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>
|
|
@@ -220,147 +220,3 @@ ion-item:hover {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
|
|
223
|
-
.waiting-for-connection {
|
|
224
|
-
--background: #fdd764;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// -------------------------------
|
|
228
|
-
// Spinner
|
|
229
|
-
// -------------------------------
|
|
230
|
-
.sk-fading-circle {
|
|
231
|
-
// margin: 100px auto;
|
|
232
|
-
width: 40px;
|
|
233
|
-
height: 40px;
|
|
234
|
-
position: relative;
|
|
235
|
-
margin-left: 5px;
|
|
236
|
-
margin-top: 5px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.sk-fading-circle .sk-circle {
|
|
240
|
-
width: 100%;
|
|
241
|
-
height: 100%;
|
|
242
|
-
position: absolute;
|
|
243
|
-
left: 0;
|
|
244
|
-
top: 0;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.sk-fading-circle .sk-circle:before {
|
|
248
|
-
content: '';
|
|
249
|
-
display: block;
|
|
250
|
-
margin: 0 auto;
|
|
251
|
-
width: 15%;
|
|
252
|
-
height: 15%;
|
|
253
|
-
background-color: #333;
|
|
254
|
-
border-radius: 100%;
|
|
255
|
-
-webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
|
256
|
-
animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
|
257
|
-
}
|
|
258
|
-
.sk-fading-circle .sk-circle2 {
|
|
259
|
-
-webkit-transform: rotate(30deg);
|
|
260
|
-
-ms-transform: rotate(30deg);
|
|
261
|
-
transform: rotate(30deg);
|
|
262
|
-
}
|
|
263
|
-
.sk-fading-circle .sk-circle3 {
|
|
264
|
-
-webkit-transform: rotate(60deg);
|
|
265
|
-
-ms-transform: rotate(60deg);
|
|
266
|
-
transform: rotate(60deg);
|
|
267
|
-
}
|
|
268
|
-
.sk-fading-circle .sk-circle4 {
|
|
269
|
-
-webkit-transform: rotate(90deg);
|
|
270
|
-
-ms-transform: rotate(90deg);
|
|
271
|
-
transform: rotate(90deg);
|
|
272
|
-
}
|
|
273
|
-
.sk-fading-circle .sk-circle5 {
|
|
274
|
-
-webkit-transform: rotate(120deg);
|
|
275
|
-
-ms-transform: rotate(120deg);
|
|
276
|
-
transform: rotate(120deg);
|
|
277
|
-
}
|
|
278
|
-
.sk-fading-circle .sk-circle6 {
|
|
279
|
-
-webkit-transform: rotate(150deg);
|
|
280
|
-
-ms-transform: rotate(150deg);
|
|
281
|
-
transform: rotate(150deg);
|
|
282
|
-
}
|
|
283
|
-
.sk-fading-circle .sk-circle7 {
|
|
284
|
-
-webkit-transform: rotate(180deg);
|
|
285
|
-
-ms-transform: rotate(180deg);
|
|
286
|
-
transform: rotate(180deg);
|
|
287
|
-
}
|
|
288
|
-
.sk-fading-circle .sk-circle8 {
|
|
289
|
-
-webkit-transform: rotate(210deg);
|
|
290
|
-
-ms-transform: rotate(210deg);
|
|
291
|
-
transform: rotate(210deg);
|
|
292
|
-
}
|
|
293
|
-
.sk-fading-circle .sk-circle9 {
|
|
294
|
-
-webkit-transform: rotate(240deg);
|
|
295
|
-
-ms-transform: rotate(240deg);
|
|
296
|
-
transform: rotate(240deg);
|
|
297
|
-
}
|
|
298
|
-
.sk-fading-circle .sk-circle10 {
|
|
299
|
-
-webkit-transform: rotate(270deg);
|
|
300
|
-
-ms-transform: rotate(270deg);
|
|
301
|
-
transform: rotate(270deg);
|
|
302
|
-
}
|
|
303
|
-
.sk-fading-circle .sk-circle11 {
|
|
304
|
-
-webkit-transform: rotate(300deg);
|
|
305
|
-
-ms-transform: rotate(300deg);
|
|
306
|
-
transform: rotate(300deg);
|
|
307
|
-
}
|
|
308
|
-
.sk-fading-circle .sk-circle12 {
|
|
309
|
-
-webkit-transform: rotate(330deg);
|
|
310
|
-
-ms-transform: rotate(330deg);
|
|
311
|
-
transform: rotate(330deg);
|
|
312
|
-
}
|
|
313
|
-
.sk-fading-circle .sk-circle2:before {
|
|
314
|
-
-webkit-animation-delay: -1.1s;
|
|
315
|
-
animation-delay: -1.1s;
|
|
316
|
-
}
|
|
317
|
-
.sk-fading-circle .sk-circle3:before {
|
|
318
|
-
-webkit-animation-delay: -1s;
|
|
319
|
-
animation-delay: -1s;
|
|
320
|
-
}
|
|
321
|
-
.sk-fading-circle .sk-circle4:before {
|
|
322
|
-
-webkit-animation-delay: -0.9s;
|
|
323
|
-
animation-delay: -0.9s;
|
|
324
|
-
}
|
|
325
|
-
.sk-fading-circle .sk-circle5:before {
|
|
326
|
-
-webkit-animation-delay: -0.8s;
|
|
327
|
-
animation-delay: -0.8s;
|
|
328
|
-
}
|
|
329
|
-
.sk-fading-circle .sk-circle6:before {
|
|
330
|
-
-webkit-animation-delay: -0.7s;
|
|
331
|
-
animation-delay: -0.7s;
|
|
332
|
-
}
|
|
333
|
-
.sk-fading-circle .sk-circle7:before {
|
|
334
|
-
-webkit-animation-delay: -0.6s;
|
|
335
|
-
animation-delay: -0.6s;
|
|
336
|
-
}
|
|
337
|
-
.sk-fading-circle .sk-circle8:before {
|
|
338
|
-
-webkit-animation-delay: -0.5s;
|
|
339
|
-
animation-delay: -0.5s;
|
|
340
|
-
}
|
|
341
|
-
.sk-fading-circle .sk-circle9:before {
|
|
342
|
-
-webkit-animation-delay: -0.4s;
|
|
343
|
-
animation-delay: -0.4s;
|
|
344
|
-
}
|
|
345
|
-
.sk-fading-circle .sk-circle10:before {
|
|
346
|
-
-webkit-animation-delay: -0.3s;
|
|
347
|
-
animation-delay: -0.3s;
|
|
348
|
-
}
|
|
349
|
-
.sk-fading-circle .sk-circle11:before {
|
|
350
|
-
-webkit-animation-delay: -0.2s;
|
|
351
|
-
animation-delay: -0.2s;
|
|
352
|
-
}
|
|
353
|
-
.sk-fading-circle .sk-circle12:before {
|
|
354
|
-
-webkit-animation-delay: -0.1s;
|
|
355
|
-
animation-delay: -0.1s;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
@-webkit-keyframes sk-circleFadeDelay {
|
|
359
|
-
0%, 39%, 100% { opacity: 0; }
|
|
360
|
-
40% { opacity: 1; }
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
@keyframes sk-circleFadeDelay {
|
|
364
|
-
0%, 39%, 100% { opacity: 0; }
|
|
365
|
-
40% { opacity: 1; }
|
|
366
|
-
}
|
|
@@ -7,10 +7,13 @@ import { Platform } from '@ionic/angular';
|
|
|
7
7
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
8
8
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
9
9
|
import { TranslateService } from '@ngx-translate/core';
|
|
10
|
+
|
|
10
11
|
import * as moment from 'moment';
|
|
11
12
|
// import { EventsService } from 'src/app/services/events-service';
|
|
12
13
|
// import { TiledeskService } from '../../../services/tiledesk/tiledesk.service';
|
|
13
14
|
import { NetworkService } from '../../../services/network-service/network.service';
|
|
15
|
+
import { AppConfigProvider } from 'src/app/services/app-config';
|
|
16
|
+
import { DomSanitizer } from '@angular/platform-browser'
|
|
14
17
|
// import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
15
18
|
// import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
16
19
|
|
|
@@ -29,8 +32,8 @@ export class IonListConversationsComponent extends ListConversationsComponent im
|
|
|
29
32
|
public logger: LoggerService = LoggerInstance.getInstance();
|
|
30
33
|
public currentYear: any;
|
|
31
34
|
public browserLang: string;
|
|
32
|
-
|
|
33
|
-
public
|
|
35
|
+
|
|
36
|
+
public PROJECT_FOR_PANEL: any;
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
*
|
|
@@ -45,7 +48,9 @@ export class IonListConversationsComponent extends ListConversationsComponent im
|
|
|
45
48
|
private translate: TranslateService,
|
|
46
49
|
// private events: EventsService,
|
|
47
50
|
// private tiledeskService: TiledeskService,
|
|
48
|
-
private networkService: NetworkService
|
|
51
|
+
private networkService: NetworkService,
|
|
52
|
+
private appConfigProvider: AppConfigProvider,
|
|
53
|
+
private sanitizer: DomSanitizer,
|
|
49
54
|
) {
|
|
50
55
|
super(iterableDiffers, kvDiffers)
|
|
51
56
|
this.browserLang = this.translate.getBrowserLang();
|
|
@@ -62,31 +67,22 @@ export class IonListConversationsComponent extends ListConversationsComponent im
|
|
|
62
67
|
|
|
63
68
|
this.currentYear = moment().format('YYYY');
|
|
64
69
|
this.logger.log('[ION-LIST-CONVS-COMP] - currentYear ', this.currentYear)
|
|
70
|
+
|
|
71
|
+
const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
|
|
72
|
+
|
|
73
|
+
// console.log('[ION-LIST-CONVS-COMP] - DASHBOARD_BASE_URL ', DASHBOARD_BASE_URL)
|
|
74
|
+
this.PROJECT_FOR_PANEL = this.sanitizer.bypassSecurityTrustResourceUrl(DASHBOARD_BASE_URL + '#/project-for-panel');
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
ngOnInit() {
|
|
68
78
|
this.isApp = this.platform.is('ios') || this.platform.is('android')
|
|
69
79
|
this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - IS-APP ', this.isApp)
|
|
70
80
|
this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - Platform', this.platform.platforms());
|
|
71
|
-
|
|
81
|
+
|
|
72
82
|
}
|
|
73
83
|
|
|
74
84
|
|
|
75
|
-
watchToConnectionStatus() {
|
|
76
|
-
|
|
77
|
-
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
78
|
-
this.checkInternet = isOnline
|
|
79
|
-
this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
80
85
|
|
|
81
|
-
// checking internet connection
|
|
82
|
-
if (this.checkInternet == true) {
|
|
83
|
-
|
|
84
|
-
this.isOnline = true;
|
|
85
|
-
} else {
|
|
86
|
-
this.isOnline = false;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
86
|
// --------------------------------------------------
|
|
91
87
|
// subdsribe to event
|
|
92
88
|
// --------------------------------------------------
|