@chat21/chat21-ionic 3.4.29-rc1 → 3.4.29
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 +6 -109
- package/angular.json +0 -1
- package/package.json +1 -1
- package/src/app/app.component.html +1 -3
- package/src/app/app.component.ts +10 -71
- package/src/app/components/canned-response/canned-response.component.html +23 -26
- package/src/app/components/canned-response/canned-response.component.scss +2 -0
- package/src/app/components/canned-response/canned-response.component.ts +1 -3
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +1 -24
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +0 -30
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +7 -29
- package/src/app/components/conversation-info/info-content/info-content.component.ts +2 -2
- package/src/app/components/conversation-info/info-group/info-group.component.ts +21 -23
- package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.html +1 -1
- package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.ts +1 -5
- package/src/app/components/navbar/navbar.component.html +3 -3
- package/src/app/components/navbar/navbar.component.ts +38 -29
- package/src/app/components/project-item/project-item.component.ts +11 -11
- package/src/app/components/sidebar/sidebar.component.html +45 -65
- package/src/app/components/sidebar/sidebar.component.ts +117 -110
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +2 -2
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +7 -10
- package/src/app/modals/create-ticket/create-ticket.page.ts +2 -4
- package/src/app/pages/conversation-detail/conversation-detail.page.html +3 -7
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +5 -89
- package/src/app/pages/conversations-list/conversations-list.page.html +0 -2
- package/src/app/pages/conversations-list/conversations-list.page.ts +2 -40
- package/src/app/services/global-settings/global-settings.service.ts +3 -11
- package/src/app/services/nav-proxy.service.ts +1 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +16 -0
- package/src/app/services/triggerEvents/triggerEvents.ts +0 -28
- package/src/app/services/websocket/websocket-js.ts +534 -59
- package/src/app/services/websocket/websocket.service.ts +10 -9
- package/src/app/shared/shared.module.ts +2 -11
- package/src/app/utils/globals.ts +0 -2
- package/src/app/utils/project-utils.ts +2 -2
- package/src/app/utils/utils.ts +1 -18
- package/src/assets/i18n/ar.json +1 -11
- package/src/assets/i18n/az.json +1 -11
- package/src/assets/i18n/de.json +1 -11
- package/src/assets/i18n/en.json +1 -11
- package/src/assets/i18n/es.json +1 -11
- package/src/assets/i18n/fr.json +1 -11
- package/src/assets/i18n/it.json +3 -13
- package/src/assets/i18n/kk.json +1 -11
- package/src/assets/i18n/pt.json +1 -11
- package/src/assets/i18n/ru.json +1 -11
- package/src/assets/i18n/sr.json +1 -11
- package/src/assets/i18n/sv.json +1 -11
- package/src/assets/i18n/tr.json +1 -11
- package/src/assets/i18n/uk.json +1 -11
- package/src/assets/i18n/uz.json +1 -12
- package/src/assets/js/chat21client.js +0 -36
- package/src/assets/test.html +2 -5
- package/src/chat-config-template.json +0 -1
- package/src/chat-config.json +0 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +1 -1
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -3
- package/src/chat21-core/utils/utils.ts +2 -16
- package/src/app/services/project_users/project-users.service.spec.ts +0 -16
- package/src/app/services/project_users/project-users.service.ts +0 -63
- package/src/app/services/websocket/websocket-js_old.ts +0 -578
- package/src/app/services/websocket/websocket.worker.ts +0 -242
- package/src/app/utils/permissions.constants.ts +0 -138
- package/src/assets/js/agentDesktop-sdk.js +0 -55
- package/src/assets/js/mqtt-keepalive-worker.js +0 -53
- package/src/chat21-core/models/projectUsers.ts +0 -19
|
@@ -15,10 +15,7 @@ import { tranlatedLanguage } from '../../../chat21-core/utils/constants';
|
|
|
15
15
|
// utils
|
|
16
16
|
import { avatarPlaceholder, getColorBck } from 'src/chat21-core/utils/utils-user';
|
|
17
17
|
import { BRAND_BASE_INFO, LOGOS_ITEMS } from 'src/app/utils/utils-resources';
|
|
18
|
-
import { getOSCode
|
|
19
|
-
import { PERMISSIONS } from 'src/app/utils/permissions.constants';
|
|
20
|
-
import { ProjectUser } from 'src/chat21-core/models/projectUsers';
|
|
21
|
-
import { ProjectUsersService } from 'src/app/services/project_users/project-users.service';
|
|
18
|
+
import { getOSCode } from 'src/app/utils/utils';
|
|
22
19
|
|
|
23
20
|
@Component({
|
|
24
21
|
selector: 'app-sidebar',
|
|
@@ -34,7 +31,7 @@ export class SidebarComponent implements OnInit {
|
|
|
34
31
|
IS_AVAILABLE: boolean = false;
|
|
35
32
|
IS_INACTIVE: boolean = true;
|
|
36
33
|
IS_BUSY: boolean;
|
|
37
|
-
|
|
34
|
+
isVisibleAPP: boolean;
|
|
38
35
|
isVisibleANA: boolean;
|
|
39
36
|
isVisibleACT: boolean;
|
|
40
37
|
isVisibleMON: boolean;
|
|
@@ -44,10 +41,9 @@ export class SidebarComponent implements OnInit {
|
|
|
44
41
|
project_id: string;
|
|
45
42
|
DASHBOARD_URL: string;
|
|
46
43
|
// HAS_CLICKED_OPEN_USER_DETAIL: boolean = false
|
|
47
|
-
public
|
|
44
|
+
public translationMap: Map<string, string>;
|
|
48
45
|
public_Key: any;
|
|
49
46
|
conversations_lbl: string;
|
|
50
|
-
whatsappbroadcast_lbl: string;
|
|
51
47
|
contacts_lbl: string;
|
|
52
48
|
apps_lbl: string;
|
|
53
49
|
analytics_lbl: string;
|
|
@@ -57,14 +53,19 @@ export class SidebarComponent implements OnInit {
|
|
|
57
53
|
countClickOnOpenUserDetailSidebar: number = 0
|
|
58
54
|
USER_PHOTO_PROFILE_EXIST: boolean;
|
|
59
55
|
currentUser: any;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
dashboard_home_url: string;
|
|
57
|
+
dashboard_knb_url: string;
|
|
58
|
+
dashboard_bots_url: string;
|
|
59
|
+
dashboard_convs_url: string;
|
|
60
|
+
dashboard_contacts_url: string;
|
|
61
|
+
dashboard_app_url: string;
|
|
62
|
+
dashboard_analytics_url: string;
|
|
63
|
+
dashboard_activities_url: string;
|
|
64
|
+
dashboard_history_url: string;
|
|
65
|
+
dashboard_settings_url: string;
|
|
66
|
+
tiledesk_url: string;
|
|
65
67
|
LOGOS_ITEMS = LOGOS_ITEMS;
|
|
66
68
|
BRAND_BASE_INFO = BRAND_BASE_INFO;
|
|
67
|
-
PERMISSIONS = PERMISSIONS;
|
|
68
69
|
constructor(
|
|
69
70
|
public imageRepoService: ImageRepoService,
|
|
70
71
|
public appStorageService: AppStorageService,
|
|
@@ -74,13 +75,12 @@ export class SidebarComponent implements OnInit {
|
|
|
74
75
|
public wsService: WebsocketService,
|
|
75
76
|
public appConfigProvider: AppConfigProvider,
|
|
76
77
|
private translate: TranslateService,
|
|
77
|
-
public projectUsersService: ProjectUsersService,
|
|
78
78
|
public events: EventsService,
|
|
79
79
|
|
|
80
80
|
) { }
|
|
81
81
|
|
|
82
82
|
ngOnInit() {
|
|
83
|
-
this.
|
|
83
|
+
this.tiledesk_url = BRAND_BASE_INFO['COMPANY_SITE_URL'] as string
|
|
84
84
|
|
|
85
85
|
this.DASHBOARD_URL = this.appConfig.getConfig().dashboardUrl + '#/project/';
|
|
86
86
|
this.getStoredProjectAndUserRole()
|
|
@@ -92,57 +92,36 @@ export class SidebarComponent implements OnInit {
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
getStoredProjectAndUserRole() {
|
|
95
|
-
this.events.subscribe('storage:last_project',
|
|
95
|
+
this.events.subscribe('storage:last_project',project =>{
|
|
96
96
|
this.logger.log('[SIDEBAR] stored_project ', project)
|
|
97
97
|
if (project && project !== 'undefined') {
|
|
98
98
|
this.project_id = project.id_project.id
|
|
99
99
|
this.USER_ROLE = project.role;
|
|
100
100
|
this.buildURLs(this.USER_ROLE)
|
|
101
|
-
this.projectUser = await this.projectUsersService.getProjectUserByProjectId(project.id_project.id)
|
|
102
|
-
this.roles = this.checkRoles()
|
|
103
|
-
this.logger.log('[SIDEBAR] roles ', this.roles)
|
|
104
101
|
}
|
|
105
102
|
})
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
buildURLs(USER_ROLE) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
this.setQueryParamsForAll({ tiledesk_logOut: BRAND_BASE_INFO['LOGOUT_ENABLED'] });
|
|
106
|
+
this.dashboard_home_url = this.DASHBOARD_URL + this.project_id + '/home'
|
|
107
|
+
this.dashboard_knb_url = this.DASHBOARD_URL + this.project_id + '/knowledge-bases'
|
|
108
|
+
this.dashboard_bots_url = this.DASHBOARD_URL + this.project_id + '/bots'
|
|
109
|
+
this.dashboard_convs_url = this.DASHBOARD_URL + this.project_id + '/wsrequests'
|
|
110
|
+
this.dashboard_contacts_url = this.DASHBOARD_URL + this.project_id + '/contacts'
|
|
111
|
+
this.dashboard_app_url = this.DASHBOARD_URL + this.project_id + '/app-store'
|
|
112
|
+
this.dashboard_analytics_url = this.DASHBOARD_URL + this.project_id + '/analytics'
|
|
113
|
+
this.dashboard_activities_url = this.DASHBOARD_URL + this.project_id + '/activities'
|
|
114
|
+
this.dashboard_history_url = this.DASHBOARD_URL + this.project_id + '/history'
|
|
115
|
+
this.dashboard_settings_url = ''
|
|
116
|
+
if (USER_ROLE !== 'agent') {
|
|
117
|
+
this.dashboard_settings_url = this.DASHBOARD_URL + this.project_id + '/widget-set-up'
|
|
118
|
+
} else if (USER_ROLE === 'agent') {
|
|
119
|
+
this.dashboard_settings_url = this.DASHBOARD_URL + this.project_id + '/cannedresponses'
|
|
120
|
+
}
|
|
121
|
+
this.tiledesk_url = 'https://www.tiledesk.com'
|
|
127
122
|
|
|
128
123
|
}
|
|
129
124
|
|
|
130
|
-
// Funzione helper per aggiungere query params a tutte le URL
|
|
131
|
-
setQueryParamsForAll(queryParams: any) {
|
|
132
|
-
if (!queryParams) return;
|
|
133
|
-
|
|
134
|
-
const queryString = new URLSearchParams(queryParams).toString();
|
|
135
|
-
|
|
136
|
-
// Cicla tutte le chiavi di URLS
|
|
137
|
-
Object.keys(this.URLS).forEach(key => {
|
|
138
|
-
if (this.URLS[key]) {
|
|
139
|
-
// Controlla se già ci sono query params
|
|
140
|
-
const separator = this.URLS[key].includes('?') ? '&' : '?';
|
|
141
|
-
this.URLS[key] = `${this.URLS[key]}${queryString ? separator + queryString : ''}`;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
125
|
subcribeToAuthStateChanged() {
|
|
147
126
|
this.messagingAuthService.BSAuthStateChanged.subscribe((state) => {
|
|
148
127
|
this.logger.log('[SIDEBAR] BSAuthStateChanged ', state)
|
|
@@ -261,7 +240,6 @@ setQueryParamsForAll(queryParams: any) {
|
|
|
261
240
|
this.logger.error('[SIDEBAR] - ngOnInit - currentUser not found in storage ')
|
|
262
241
|
}
|
|
263
242
|
this.translateLabels()
|
|
264
|
-
this.translations()
|
|
265
243
|
}
|
|
266
244
|
|
|
267
245
|
|
|
@@ -278,7 +256,6 @@ setQueryParamsForAll(queryParams: any) {
|
|
|
278
256
|
|
|
279
257
|
this.translate.get(keys).subscribe((text: string) => {
|
|
280
258
|
this.conversations_lbl = text['Conversations'];
|
|
281
|
-
this.whatsappbroadcast_lbl = text['WhatsAppBroadcasts']
|
|
282
259
|
this.contacts_lbl = text['LABEL_CONTACTS']
|
|
283
260
|
this.apps_lbl = text['Apps']
|
|
284
261
|
this.analytics_lbl = text['Analytics']
|
|
@@ -294,55 +271,13 @@ setQueryParamsForAll(queryParams: any) {
|
|
|
294
271
|
|
|
295
272
|
this.isVisibleANA = getOSCode("ANA", this.public_Key);
|
|
296
273
|
this.isVisibleACT = getOSCode("ACT", this.public_Key);
|
|
274
|
+
this.isVisibleAPP = getOSCode("APP", this.public_Key);
|
|
297
275
|
this.isVisibleMON = getOSCode("MON", this.public_Key);
|
|
298
276
|
this.isVisibleCNT = getOSCode("CNT", this.public_Key);
|
|
299
277
|
this.isVisibleKNB = getOSCode("KNB", this.public_Key);
|
|
300
|
-
|
|
278
|
+
|
|
301
279
|
}
|
|
302
280
|
|
|
303
|
-
|
|
304
|
-
checkRoles(): { [key: string]: boolean } {
|
|
305
|
-
const permissionKeys = [
|
|
306
|
-
'HOME_READ',
|
|
307
|
-
'KB_READ',
|
|
308
|
-
'FLOWS_READ',
|
|
309
|
-
'INBOX_READ',
|
|
310
|
-
'AUTOMATIONSLOG_READ',
|
|
311
|
-
'LEADS_READ',
|
|
312
|
-
'ANALYTICS_READ',
|
|
313
|
-
'ACTIVITIES_READ',
|
|
314
|
-
'HISTORY_READ',
|
|
315
|
-
'PROJECTSETTINGS_GENERAL_READ',
|
|
316
|
-
'PROJECTSETTINGS_DEVELOPER_READ',
|
|
317
|
-
'PROJECTSETTINGS_SMARTASSIGNMENT_READ',
|
|
318
|
-
'PROJECTSETTINGS_NOTIFICATION_READ',
|
|
319
|
-
'PROJECTSETTINGS_SECURITY_READ',
|
|
320
|
-
'PROJECTSETTINGS_BANNED_READ',
|
|
321
|
-
'PROJECTSETTINGS_ADVANCED_READ'
|
|
322
|
-
] as const;
|
|
323
|
-
|
|
324
|
-
const roles: { [key: string]: boolean } = {};
|
|
325
|
-
for (const key of permissionKeys) {
|
|
326
|
-
const permission = PERMISSIONS[key];
|
|
327
|
-
roles[permission] = hasRole(this.projectUser, permission);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
let settingRoleKEys = [
|
|
332
|
-
'PROJECTSETTINGS_GENERAL_READ',
|
|
333
|
-
'PROJECTSETTINGS_DEVELOPER_READ',
|
|
334
|
-
'PROJECTSETTINGS_SMARTASSIGNMENT_READ',
|
|
335
|
-
'PROJECTSETTINGS_NOTIFICATION_READ',
|
|
336
|
-
'PROJECTSETTINGS_SECURITY_READ',
|
|
337
|
-
'PROJECTSETTINGS_BANNED_READ',
|
|
338
|
-
'PROJECTSETTINGS_ADVANCED_READ'
|
|
339
|
-
] as const;
|
|
340
|
-
roles[PERMISSIONS.SETTINGS_READ] = settingRoleKEys.some(settingKey => roles[PERMISSIONS[settingKey]]);
|
|
341
|
-
|
|
342
|
-
return roles;
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
|
|
346
281
|
listenTocurrentProjectUserUserAvailability$() {
|
|
347
282
|
this.wsService.currentProjectUserAvailability$.subscribe((data) => {
|
|
348
283
|
this.logger.log('[SIDEBAR] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS RES ', data);
|
|
@@ -392,20 +327,92 @@ setQueryParamsForAll(queryParams: any) {
|
|
|
392
327
|
}
|
|
393
328
|
}
|
|
394
329
|
|
|
330
|
+
goToHome() {
|
|
331
|
+
let url = this.DASHBOARD_URL + this.project_id + '/home'
|
|
332
|
+
this.dashboard_home_url = url;
|
|
333
|
+
const myWindow = window.open(url, '_self');
|
|
334
|
+
myWindow.focus();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
goToBots() {
|
|
338
|
+
let url = this.DASHBOARD_URL + this.project_id + '/bots/my-chatbots/all'
|
|
339
|
+
const myWindow = window.open(url, '_self');
|
|
340
|
+
myWindow.focus();
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
goToConversations() {
|
|
344
|
+
let url = this.DASHBOARD_URL + this.project_id + '/wsrequests'
|
|
345
|
+
const myWindow = window.open(url, '_self');
|
|
346
|
+
myWindow.focus();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
goToContacts() {
|
|
350
|
+
let url = this.DASHBOARD_URL + this.project_id + '/contacts'
|
|
351
|
+
const myWindow = window.open(url, '_self');
|
|
352
|
+
myWindow.focus();
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
goToAppStore() {
|
|
356
|
+
let url = this.DASHBOARD_URL + this.project_id + '/app-store'
|
|
357
|
+
const myWindow = window.open(url, '_self');
|
|
358
|
+
myWindow.focus();
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
goToAnalytics() {
|
|
362
|
+
let url = this.DASHBOARD_URL + this.project_id + '/analytics'
|
|
363
|
+
const myWindow = window.open(url, '_self');
|
|
364
|
+
myWindow.focus();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
goToActivities() {
|
|
368
|
+
let url = this.DASHBOARD_URL + this.project_id + '/activities'
|
|
369
|
+
const myWindow = window.open(url, '_self');
|
|
370
|
+
myWindow.focus();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
goToHistory() {
|
|
374
|
+
let url = this.DASHBOARD_URL + this.project_id + '/history'
|
|
375
|
+
const myWindow = window.open(url, '_self');
|
|
376
|
+
myWindow.focus();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
goToWidgetSetUpOrToCannedResponses() {
|
|
380
|
+
if (this.USER_ROLE !== 'agent') {
|
|
381
|
+
this.goToWidgetSetUp()
|
|
382
|
+
} else if (this.USER_ROLE === 'agent') {
|
|
383
|
+
this.goToSettings_CannedResponses()
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
goToWidgetSetUp() {
|
|
388
|
+
let url = this.DASHBOARD_URL + this.project_id + '/widget-set-up'
|
|
389
|
+
const myWindow = window.open(url, '_self');
|
|
390
|
+
myWindow.focus();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
goToSettings_CannedResponses() {
|
|
394
|
+
let url = this.DASHBOARD_URL + this.project_id + '/cannedresponses'
|
|
395
|
+
const myWindow = window.open(url, '_self');
|
|
396
|
+
myWindow.focus();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
395
401
|
public translations() {
|
|
396
402
|
const keys = [
|
|
397
|
-
'
|
|
398
|
-
'
|
|
399
|
-
'
|
|
400
|
-
'
|
|
401
|
-
'
|
|
402
|
-
'
|
|
403
|
-
'
|
|
404
|
-
'
|
|
405
|
-
'
|
|
406
|
-
|
|
403
|
+
'LABEL_AVAILABLE',
|
|
404
|
+
'LABEL_NOT_AVAILABLE',
|
|
405
|
+
'LABEL_BUSY',
|
|
406
|
+
'VIEW_ALL_CONVERSATIONS',
|
|
407
|
+
'CONVERSATIONS_IN_QUEUE',
|
|
408
|
+
'CONVERSATION_IN_QUEUE',
|
|
409
|
+
'NO_CONVERSATION_IN_QUEUE',
|
|
410
|
+
'PINNED_PROJECT',
|
|
411
|
+
'CHANGE_PINNED_PROJECT',
|
|
412
|
+
"CHANGE_TO_YOUR_STATUS_TO_AVAILABLE",
|
|
413
|
+
"CHANGE_TO_YOUR_STATUS_TO_UNAVAILABLE"
|
|
407
414
|
];
|
|
408
|
-
this.
|
|
415
|
+
this.translationMap = this.translateService.translateLanguage(keys);
|
|
409
416
|
}
|
|
410
417
|
|
|
411
418
|
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
[searchable]="false">
|
|
82
82
|
<ng-template ng-label-tmp let-item="item">
|
|
83
83
|
<img style="width: 15px;height: 15px;position: relative; top: 1px;" height="15" width="15" [src]="item?.avatar" />
|
|
84
|
-
<span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label
|
|
84
|
+
<span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label}} </span>
|
|
85
85
|
</ng-template>
|
|
86
86
|
<ng-template ng-option-tmp let-item="item" let-index="index">
|
|
87
87
|
<img style="width: 15px;height: 15px;position: relative; top: 1px;" height="15" width="15" [src]="item?.avatar" />
|
|
88
|
-
<span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label
|
|
88
|
+
<span id="sidebaravatar_{{item.name}}" style="text-transform: capitalize; margin-left:8px"> {{item.label}} </span>
|
|
89
89
|
</ng-template>
|
|
90
90
|
</ng-select>
|
|
91
91
|
</section>
|
|
@@ -25,7 +25,6 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
|
25
25
|
// HAS_CLICKED_OPEN_USER_DETAIL: boolean = false;
|
|
26
26
|
// @Output() onCloseUserDetailsSidebar = new EventEmitter();
|
|
27
27
|
|
|
28
|
-
@Input() logOut: boolean;
|
|
29
28
|
|
|
30
29
|
public browserLang: string;
|
|
31
30
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
@@ -243,9 +242,9 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
|
243
242
|
.set('SubscriptionPaymentProblem', text['SubscriptionPaymentProblem'])
|
|
244
243
|
.set('ThePlanHasExpired', text['ThePlanHasExpired'])
|
|
245
244
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
this.teammateStatus.forEach(element => {
|
|
246
|
+
element.label = this.translationsMap.get(element.label)
|
|
247
|
+
});
|
|
249
248
|
|
|
250
249
|
});
|
|
251
250
|
}
|
|
@@ -262,7 +261,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
|
262
261
|
listenToCurrentStoredProject() {
|
|
263
262
|
this.events.subscribe('storage:last_project', projectObjct => {
|
|
264
263
|
if (projectObjct && projectObjct !== 'undefined') {
|
|
265
|
-
this.logger.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
|
|
264
|
+
// this.logger.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
|
|
266
265
|
|
|
267
266
|
//TODO: recuperare info da root e non da id_project
|
|
268
267
|
this.project = {
|
|
@@ -285,8 +284,6 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
|
285
284
|
} else if (this.project.profile.type === 'payment' && this.project.profile.name === 'enterprise') {
|
|
286
285
|
this.getEnterprisePlanTranslation();
|
|
287
286
|
}
|
|
288
|
-
|
|
289
|
-
this.wsService.subscriptionToWsCurrentProjectUserAvailability(this.project._id, projectObjct._id);
|
|
290
287
|
}
|
|
291
288
|
})
|
|
292
289
|
|
|
@@ -332,14 +329,14 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
|
332
329
|
// this.logger.log('teammateStatus ', this.teammateStatus)
|
|
333
330
|
this.selectedStatus = this.teammateStatus[2].id;
|
|
334
331
|
this.logger.debug('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[2].name);
|
|
335
|
-
|
|
332
|
+
this.teammateStatus = this.teammateStatus.slice(0)
|
|
336
333
|
} else if (projectUser['user_available'] === false && (projectUser['profileStatus'] === '' || !projectUser['profileStatus'])) {
|
|
337
334
|
this.selectedStatus = this.teammateStatus[1].id;
|
|
338
335
|
this.logger.debug('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[1].name);
|
|
339
|
-
|
|
336
|
+
this.teammateStatus = this.teammateStatus.slice(0)
|
|
340
337
|
} else if (projectUser['user_available'] === true && (projectUser['profileStatus'] === '' || !projectUser['profileStatus'])) {
|
|
341
338
|
this.selectedStatus = this.teammateStatus[0].id
|
|
342
|
-
|
|
339
|
+
this.teammateStatus = this.teammateStatus.slice(0)
|
|
343
340
|
this.logger.debug('[SIDEBAR-USER-DETAILS] - PROFILE_STATUS selected option', this.teammateStatus[0].name);
|
|
344
341
|
}
|
|
345
342
|
this.IS_BUSY = projectUser['isBusy']
|
|
@@ -9,7 +9,6 @@ import * as uuid from 'uuid';
|
|
|
9
9
|
import { EventsService } from 'src/app/services/events-service'
|
|
10
10
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
11
11
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
12
|
-
import { ProjectUsersService } from 'src/app/services/project_users/project-users.service'
|
|
13
12
|
|
|
14
13
|
@Component({
|
|
15
14
|
selector: 'app-create-ticket',
|
|
@@ -65,7 +64,6 @@ export class CreateTicketPage implements OnInit {
|
|
|
65
64
|
logger: LoggerService = LoggerInstance.getInstance();
|
|
66
65
|
constructor(
|
|
67
66
|
public modalController: ModalController,
|
|
68
|
-
public projectUsersService: ProjectUsersService,
|
|
69
67
|
public tiledeskService: TiledeskService,
|
|
70
68
|
public appConfigProvider: AppConfigProvider,
|
|
71
69
|
public events: EventsService
|
|
@@ -106,7 +104,7 @@ export class CreateTicketPage implements OnInit {
|
|
|
106
104
|
// Create the array of the project-users and contacts displayed in the combo box "Requester"
|
|
107
105
|
// -------------------------------------------------------------------------------------------
|
|
108
106
|
getProjectUsersAndContacts(projctid: string) {
|
|
109
|
-
const projectUsers = this.
|
|
107
|
+
const projectUsers = this.tiledeskService.getProjectUsersByProjectId(projctid)
|
|
110
108
|
const leads = this.tiledeskService.getAllLeadsActiveWithLimit(projctid,10000)
|
|
111
109
|
|
|
112
110
|
zip(projectUsers, leads).subscribe(
|
|
@@ -245,7 +243,7 @@ export class CreateTicketPage implements OnInit {
|
|
|
245
243
|
// -------------------------------------------------------------------------------------------------------------------
|
|
246
244
|
getProjectUserBotsAndDepts(projctid: string) {
|
|
247
245
|
// this.loadingAssignee = true;
|
|
248
|
-
const projectUsers = this.
|
|
246
|
+
const projectUsers = this.tiledeskService.getProjectUsersByProjectId( projctid)
|
|
249
247
|
const bots = this.tiledeskService.getAllBotByProjectId(projctid)
|
|
250
248
|
const depts = this.tiledeskService.getDeptsByProjectId(projctid)
|
|
251
249
|
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
<!-- ----------------------------------------------------------- -->
|
|
174
174
|
<app-canned-response *ngIf="SHOW_CANNED_RESPONSES"
|
|
175
175
|
id="canned"
|
|
176
|
-
[
|
|
176
|
+
[canShowCanned]="canShowCanned"
|
|
177
177
|
[conversationWith]="conversationWith"
|
|
178
178
|
[conversationWithFullname]="conversationWithFullname"
|
|
179
179
|
[currentString]="messageStr"
|
|
@@ -201,8 +201,7 @@
|
|
|
201
201
|
<!-- [tagsCannedFilter]="tagsCannedFilter" -->
|
|
202
202
|
<!-- openInfoConversation {{openInfoConversation}} - isMobile {{isMobile}} -->
|
|
203
203
|
<app-message-text-area *ngIf="(openInfoConversation === false && isMobile === true) || (openInfoConversation === true && isMobile === false) || (openInfoConversation === false && isMobile === false)"
|
|
204
|
-
[loggedUser]="loggedUser"
|
|
205
|
-
[projectUser]="projectUser"
|
|
204
|
+
[loggedUser]="loggedUser"
|
|
206
205
|
[conversationWith]="conversationWith"
|
|
207
206
|
[channelType]="channelType"
|
|
208
207
|
[channel]="conversation?.attributes?.request_channel"
|
|
@@ -214,10 +213,8 @@
|
|
|
214
213
|
[fileUploadAccept]="fileUploadAccept"
|
|
215
214
|
[emailSection]="isEmailEnabled"
|
|
216
215
|
[offlineMsgEmail]="offlineMsgEmail"
|
|
217
|
-
[cannedSection]="canShowCanned"
|
|
218
216
|
[whatsappTemplatesSection]="isWhatsappTemplatesEnabled"
|
|
219
217
|
[isOpenInfoConversation]="openInfoConversation"
|
|
220
|
-
[ticketSection]="isTicketEnabled"
|
|
221
218
|
[stylesMap]="styleMap"
|
|
222
219
|
[translationMap]="translationsMap"
|
|
223
220
|
[dropEvent]="dropEvent"
|
|
@@ -226,8 +223,7 @@
|
|
|
226
223
|
(onClickOpenCannedResponses)="onClickOpenCannedResponses($event)"
|
|
227
224
|
(eventSendMessage)="returnSendMessage($event)"
|
|
228
225
|
(onPresentModalScrollToBottom)="onPresentModalScrollToBottom($event)"
|
|
229
|
-
(onOpenFooterSection)="onOpenFooterSection($event)"
|
|
230
|
-
(onOpenTicket)="onOpenTicket($event)">
|
|
226
|
+
(onOpenFooterSection)="onOpenFooterSection($event)">
|
|
231
227
|
</app-message-text-area>
|
|
232
228
|
<!-- [events]="eventsReplaceTexareaText.asObservable()" -->
|
|
233
229
|
</ion-row>
|
|
@@ -83,11 +83,7 @@ import { WebsocketService } from 'src/app/services/websocket/websocket.service';
|
|
|
83
83
|
import { Project } from 'src/chat21-core/models/projects';
|
|
84
84
|
import { Globals } from 'src/app/utils/globals';
|
|
85
85
|
import { ProjectService } from 'src/app/services/projects/project.service';
|
|
86
|
-
import {
|
|
87
|
-
import { ProjectUser } from 'src/chat21-core/models/projectUsers';
|
|
88
|
-
import { getOSCode, hasRole } from 'src/app/utils/utils';
|
|
89
|
-
import { PERMISSIONS } from 'src/app/utils/permissions.constants';
|
|
90
|
-
import { TriggerEvents } from 'src/app/services/triggerEvents/triggerEvents';
|
|
86
|
+
import { getOSCode } from 'src/app/utils/utils';
|
|
91
87
|
|
|
92
88
|
@Component({
|
|
93
89
|
selector: 'app-conversation-detail',
|
|
@@ -112,7 +108,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
112
108
|
private subscriptions: Array<any>
|
|
113
109
|
public tenant: string;
|
|
114
110
|
public loggedUser: UserModel
|
|
115
|
-
public projectUser: ProjectUser;
|
|
116
111
|
public conversationWith: string
|
|
117
112
|
public conversationWithFullname: string
|
|
118
113
|
public messages: Array<MessageModel> = []
|
|
@@ -142,7 +137,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
142
137
|
public tagsCannedFilter: Array<any> = [];
|
|
143
138
|
public SHOW_CANNED_RESPONSES: boolean = false
|
|
144
139
|
public canShowCanned: boolean = true
|
|
145
|
-
public rolesCanned: { [key: string]: boolean }
|
|
146
140
|
|
|
147
141
|
public SHOW_COPILOT_SUGGESTIONS: boolean = false;
|
|
148
142
|
|
|
@@ -177,10 +171,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
177
171
|
copilotQuestion: string = '';
|
|
178
172
|
/**COPILOT : end */
|
|
179
173
|
|
|
180
|
-
/** TICKET: start */
|
|
181
|
-
isTicketEnabled: boolean = false;
|
|
182
|
-
/** TICKET: end */
|
|
183
|
-
|
|
184
174
|
isMine = isMine
|
|
185
175
|
isInfo = isInfo
|
|
186
176
|
isFirstMessage = isFirstMessage
|
|
@@ -250,20 +240,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
250
240
|
public toastController: ToastController,
|
|
251
241
|
public tiledeskService: TiledeskService,
|
|
252
242
|
public projectService: ProjectService,
|
|
253
|
-
public projectUsersService: ProjectUsersService,
|
|
254
243
|
private networkService: NetworkService,
|
|
255
244
|
private events: EventsService,
|
|
256
245
|
private webSocketService: WebsocketService,
|
|
257
246
|
public projectPlanUtils: ProjectPlanUtils,
|
|
258
|
-
public triggerEvents: TriggerEvents,
|
|
259
247
|
private g: Globals,
|
|
260
248
|
) {
|
|
261
249
|
// Change list on date change
|
|
262
250
|
this.route.paramMap.subscribe((params) => {
|
|
263
251
|
this.logger.log('[CONVS-DETAIL] - constructor -> params: ', params)
|
|
264
252
|
this.conversationWith = params.get('IDConv')
|
|
265
|
-
this.conversationWithFullname =
|
|
266
|
-
this.conv_type =
|
|
253
|
+
this.conversationWithFullname = params.get('FullNameConv')
|
|
254
|
+
this.conv_type = params.get('Convtype')
|
|
267
255
|
|
|
268
256
|
this.events.publish('supportconvid:haschanged', this.conversationWith)
|
|
269
257
|
})
|
|
@@ -430,8 +418,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
430
418
|
ionViewDidEnter() {
|
|
431
419
|
this.logger.log('[CONVS-DETAIL] > ionViewDidEnter')
|
|
432
420
|
// this.info_content_child_enabled = true;
|
|
433
|
-
// Scroll to bottom to show the last message without animation
|
|
434
|
-
this.scrollToLastMessage()
|
|
435
421
|
}
|
|
436
422
|
|
|
437
423
|
// Unsubscibe when new page transition end
|
|
@@ -491,7 +477,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
491
477
|
this.messages = [] // list messages of conversation
|
|
492
478
|
this.isFileSelected = false // indicates if a file has been selected (image to upload)
|
|
493
479
|
this.isEmailEnabled = (this.appConfigProvider.getConfig().emailSection === 'true' || this.appConfigProvider.getConfig().emailSection === true) ? true : false;
|
|
494
|
-
this.isTicketEnabled = (this.appConfigProvider.getConfig().ticketSection === 'true' || this.appConfigProvider.getConfig().ticketSection === true) ? true : false;
|
|
495
480
|
this.isWhatsappTemplatesEnabled = (this.appConfigProvider.getConfig().whatsappTemplatesSection === 'true' || this.appConfigProvider.getConfig().whatsappTemplatesSection === true) ? true : false;
|
|
496
481
|
|
|
497
482
|
this.cannedResponsesService.initialize(appconfig.apiUrl)
|
|
@@ -549,6 +534,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
549
534
|
this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',)
|
|
550
535
|
})
|
|
551
536
|
}else {
|
|
537
|
+
this.canShowCanned = false;
|
|
552
538
|
this.offlineMsgEmail = false;
|
|
553
539
|
}
|
|
554
540
|
|
|
@@ -559,13 +545,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
559
545
|
this.logger.log('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT RES', project)
|
|
560
546
|
if (project) {
|
|
561
547
|
const projectId = project.id_project
|
|
562
|
-
this.
|
|
548
|
+
this.canShowCanned = this.projectPlanUtils.checkPlanIsExpired(project)
|
|
563
549
|
this.offlineMsgEmail = this.checkOfflineMsgEmailIsEnabled(project)
|
|
564
550
|
this.isCopilotEnabled = this.projectPlanUtils.checkProjectProfileFeature(project, 'copilot');
|
|
565
551
|
this.fileUploadAccept = this.checkAcceptedUploadFile(project)
|
|
566
|
-
this.rolesCanned = this.checkCannedResponsesRoles()
|
|
567
|
-
this.canShowCanned = this.checkCannedResponses(project)
|
|
568
|
-
this.logger.log('[CONVS-DETAIL] this.rolesCanned ', this.canShowCanned)
|
|
569
552
|
}
|
|
570
553
|
}, (error) => {
|
|
571
554
|
this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
@@ -603,40 +586,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
603
586
|
return this.appConfigProvider.getConfig().fileUploadAccept
|
|
604
587
|
}
|
|
605
588
|
|
|
606
|
-
checkCannedResponses(project: Project): boolean {
|
|
607
|
-
let expires = this.projectPlanUtils.checkPlanIsExpired(project)
|
|
608
|
-
this.logger.log('[CONVS-DETAIL] checkCannedResponses expires ', expires)
|
|
609
|
-
if(expires){
|
|
610
|
-
return false
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
let hasRoleToShowCanned = this.rolesCanned[PERMISSIONS.CANNED_RESPONSES_READ]
|
|
614
|
-
this.logger.log('[CONVS-DETAIL] checkCannedResponses hasRoleToShowCanned ', hasRoleToShowCanned)
|
|
615
|
-
if(!hasRoleToShowCanned){
|
|
616
|
-
return false
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
return true
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
checkCannedResponsesRoles(): { [key: string]: boolean } {
|
|
623
|
-
const permissionKeys = [
|
|
624
|
-
'CANNED_RESPONSES_CREATE',
|
|
625
|
-
'CANNED_RESPONSES_READ',
|
|
626
|
-
'CANNED_RESPONSES_UPDATE',
|
|
627
|
-
'CANNED_RESPONSES_DELETE',
|
|
628
|
-
] as const;
|
|
629
|
-
|
|
630
|
-
const roles: { [key: string]: boolean } = {};
|
|
631
|
-
for (const key of permissionKeys) {
|
|
632
|
-
const permission = PERMISSIONS[key];
|
|
633
|
-
roles[permission] = hasRole(this.projectUser, permission);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
return roles;
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
640
589
|
// getProjectIdSelectedConversation(conversationWith: string): string{
|
|
641
590
|
// const conversationWith_segments = conversationWith.split('-')
|
|
642
591
|
// // Removes the last element of the array if is = to the separator
|
|
@@ -720,11 +669,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
720
669
|
"WHATSAPP.ERROR_WHATSAPP_NOT_INSTALLED",
|
|
721
670
|
"WHATSAPP.ERROR_WHATSAPP_GENERIC_ERROR",
|
|
722
671
|
|
|
723
|
-
"TICKET.OPEN_TICKET",
|
|
724
|
-
"TICKET.DESCRIPTION",
|
|
725
|
-
"TICKET.CONFIRM",
|
|
726
|
-
"TICKET.CLOSE",
|
|
727
|
-
|
|
728
672
|
"COPILOT.ASK_AI",
|
|
729
673
|
"COPILOT.NO_SUGGESTIONS_PRESENT",
|
|
730
674
|
|
|
@@ -1940,11 +1884,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1940
1884
|
}
|
|
1941
1885
|
|
|
1942
1886
|
|
|
1943
|
-
onOpenTicket(event) {
|
|
1944
|
-
this.logger.debug('[CONVS-DETAIL] openTicketOnExternalService - conversationWith ', this.conversationWith)
|
|
1945
|
-
const detailOBJ = { event: 'onOpenTicketExternally', request_id: this.conversationWith, conversation: this.conversation }
|
|
1946
|
-
this.triggerEvents.triggerOnOpenTicketExternally(detailOBJ)
|
|
1947
|
-
}
|
|
1948
1887
|
// -------------- START SCROLL/RESIZE -------------- //
|
|
1949
1888
|
/** */
|
|
1950
1889
|
resizeTextArea() {
|
|
@@ -1988,29 +1927,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1988
1927
|
}
|
|
1989
1928
|
}
|
|
1990
1929
|
|
|
1991
|
-
/**
|
|
1992
|
-
* Scroll to last message without animation using requestAnimationFrame
|
|
1993
|
-
* This is a best practice alternative to setTimeout
|
|
1994
|
-
*/
|
|
1995
|
-
private scrollToLastMessage() {
|
|
1996
|
-
this.showIonContent = true
|
|
1997
|
-
if (this.ionContentChatArea) {
|
|
1998
|
-
// Use requestAnimationFrame for better performance
|
|
1999
|
-
requestAnimationFrame(() => {
|
|
2000
|
-
requestAnimationFrame(() => {
|
|
2001
|
-
// Double RAF ensures DOM is fully rendered
|
|
2002
|
-
this.ionContentChatArea.scrollToBottom(0).then(() => {
|
|
2003
|
-
this.logger.log('[CONVS-DETAIL] scroll posizionato all\'ultimo messaggio')
|
|
2004
|
-
}).catch((error) => {
|
|
2005
|
-
this.logger.error('[CONVS-DETAIL] errore durante lo scroll:', error)
|
|
2006
|
-
})
|
|
2007
|
-
})
|
|
2008
|
-
})
|
|
2009
|
-
} else {
|
|
2010
|
-
this.logger.warn('[CONVS-DETAIL] ionContentChatArea non disponibile')
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
1930
|
/**
|
|
2015
1931
|
* detectBottom
|
|
2016
1932
|
*/
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
[sound_btn]="sound_btn"
|
|
8
8
|
[isMobile]="isMobile"
|
|
9
9
|
[isVisibleTKT]="isVisibleTKT"
|
|
10
|
-
[isVisibleCNT]="isVisibleCNT"
|
|
11
|
-
[roles]="rolesHeader"
|
|
12
10
|
(onSoundChange)="onSoundChange($event)"
|
|
13
11
|
(openContactsDirectory)=openContactsDirectory($event)
|
|
14
12
|
(openProfileInfo)=openProfileInfo($event)>
|