@chat21/chat21-ionic 3.0.5-9.2 → 3.0.6-2.3
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 +202 -0
- package/LICENSE +661 -21
- package/README.md +13 -1
- package/angular.json +4 -0
- package/config.xml +4 -5
- package/deploy_pre.sh +44 -5
- package/deploy_prod.sh +36 -7
- package/env.sample +4 -2
- package/package.json +12 -8
- package/resources/{Android → android}/icon/drawable-hdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-ldpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-mdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/{Android → android}/icon.png +0 -0
- package/resources/{Android → android}/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/{Android → android}/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/{Android → android}/splash.png +0 -0
- package/src/app/app-routing.module.ts +15 -0
- package/src/app/app.component.html +14 -4
- package/src/app/app.component.scss +18 -1
- package/src/app/app.component.ts +98 -37
- package/src/app/app.module.ts +14 -5
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +36 -25
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +160 -50
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +108 -18
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +21 -36
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +19 -7
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +63 -42
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +7 -2
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +141 -21
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +13 -10
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +39 -36
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +7 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +148 -63
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +101 -39
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +73 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +168 -98
- package/src/app/components/ddp-header/ddp-header.component.html +20 -6
- package/src/app/components/ddp-header/ddp-header.component.scss +4 -0
- package/src/app/components/ddp-header/ddp-header.component.ts +104 -10
- package/src/app/components/image-viewer/image-viewer.component.scss +2 -2
- package/src/app/components/project-item/project-item.component.html +141 -118
- package/src/app/components/project-item/project-item.component.scss +173 -91
- package/src/app/components/project-item/project-item.component.ts +59 -25
- package/src/app/components/sidebar/sidebar.component.html +275 -0
- package/src/app/components/sidebar/sidebar.component.scss +79 -0
- package/src/app/components/sidebar/sidebar.component.spec.ts +24 -0
- package/src/app/components/sidebar/sidebar.component.ts +541 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +137 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +389 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.spec.ts +24 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +530 -0
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +9 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.html +53 -49
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +1254 -753
- package/src/app/pages/conversations-list/conversations-list.module.ts +2 -1
- package/src/app/pages/conversations-list/conversations-list.page.html +24 -11
- package/src/app/pages/conversations-list/conversations-list.page.scss +20 -1
- package/src/app/pages/conversations-list/conversations-list.page.ts +687 -420
- package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
- package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
- package/src/app/pages/create-requester/create-requester-routing.module.ts +17 -0
- package/src/app/pages/create-requester/create-requester.module.ts +28 -0
- package/src/app/pages/create-requester/create-requester.page.html +67 -0
- package/src/app/pages/create-requester/create-requester.page.scss +30 -0
- package/src/app/pages/create-requester/create-requester.page.spec.ts +24 -0
- package/src/app/pages/create-requester/create-requester.page.ts +138 -0
- package/src/app/pages/create-ticket/create-ticket-routing.module.ts +17 -0
- package/src/app/pages/create-ticket/create-ticket.module.ts +28 -0
- package/src/app/pages/create-ticket/create-ticket.page.html +171 -0
- package/src/app/pages/create-ticket/create-ticket.page.scss +52 -0
- package/src/app/pages/create-ticket/create-ticket.page.spec.ts +24 -0
- package/src/app/pages/create-ticket/create-ticket.page.ts +432 -0
- package/src/app/pages/loader-preview/loader-preview.page.ts +226 -166
- package/src/app/pages/profile-info/profile-info.page.html +4 -4
- package/src/app/pages/profile-info/profile-info.page.scss +13 -2
- package/src/app/pages/profile-info/profile-info.page.ts +23 -21
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +16 -11
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +157 -63
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +51 -16
- package/src/app/services/app-config.ts +14 -14
- package/src/app/services/tiledesk/tiledesk.service.ts +209 -0
- package/src/app/shared/shared.module.ts +21 -7
- package/src/app/utils/scrollbar-theme.directive.ts +58 -24
- package/src/assets/i18n/de.json +266 -0
- package/src/assets/i18n/en.json +85 -10
- package/src/assets/i18n/es.json +266 -0
- package/src/assets/i18n/fr.json +266 -0
- package/src/assets/i18n/it.json +104 -37
- package/src/assets/i18n/pt.json +266 -0
- package/src/assets/i18n/ru.json +266 -0
- package/src/assets/i18n/sr.json +266 -0
- package/src/assets/i18n/tr.json +266 -0
- package/src/assets/images/default-avatar-x-select.png +0 -0
- package/src/assets/images/language_flag/ar.png +0 -0
- package/src/assets/images/language_flag/bg.png +0 -0
- package/src/assets/images/language_flag/ca.png +0 -0
- package/src/assets/images/language_flag/cs.png +0 -0
- package/src/assets/images/language_flag/da.png +0 -0
- package/src/assets/images/language_flag/de.png +0 -0
- package/src/assets/images/language_flag/el.png +0 -0
- package/src/assets/images/language_flag/en.png +0 -0
- package/src/assets/images/language_flag/es.png +0 -0
- package/src/assets/images/language_flag/fa.png +0 -0
- package/src/assets/images/language_flag/fi.png +0 -0
- package/src/assets/images/language_flag/fr.png +0 -0
- package/src/assets/images/language_flag/he.png +0 -0
- package/src/assets/images/language_flag/hi.png +0 -0
- package/src/assets/images/language_flag/hr.png +0 -0
- package/src/assets/images/language_flag/hu.png +0 -0
- package/src/assets/images/language_flag/id.png +0 -0
- package/src/assets/images/language_flag/it.png +0 -0
- package/src/assets/images/language_flag/ja.png +0 -0
- package/src/assets/images/language_flag/ko.png +0 -0
- package/src/assets/images/language_flag/ml-IN.png +0 -0
- package/src/assets/images/language_flag/ne-NP.png +0 -0
- package/src/assets/images/language_flag/nl.png +0 -0
- package/src/assets/images/language_flag/no.png +0 -0
- package/src/assets/images/language_flag/pl.png +0 -0
- package/src/assets/images/language_flag/pt-BR.png +0 -0
- package/src/assets/images/language_flag/pt.png +0 -0
- package/src/assets/images/language_flag/ro.png +0 -0
- package/src/assets/images/language_flag/ru.png +0 -0
- package/src/assets/images/language_flag/sk.png +0 -0
- package/src/assets/images/language_flag/sl.png +0 -0
- package/src/assets/images/language_flag/sr.png +0 -0
- package/src/assets/images/language_flag/sv-SE.png +0 -0
- package/src/assets/images/language_flag/ta.png +0 -0
- package/src/assets/images/language_flag/th.png +0 -0
- package/src/assets/images/language_flag/tr.png +0 -0
- package/src/assets/images/language_flag/uk.png +0 -0
- package/src/assets/images/language_flag/vi.png +0 -0
- package/src/assets/images/language_flag/zh-CN.png +0 -0
- package/src/assets/images/language_flag/zh-TW.png +0 -0
- package/src/assets/images/no_image_user.png +0 -0
- package/src/assets/images/priority_icons/high.svg +3 -0
- package/src/assets/images/priority_icons/high_v2.svg +14 -0
- package/src/assets/images/priority_icons/low.svg +10 -0
- package/src/assets/images/priority_icons/low_v2.svg +14 -0
- package/src/assets/images/priority_icons/medium.svg +16 -0
- package/src/assets/images/priority_icons/medium_v2.svg +11 -0
- package/src/assets/images/priority_icons/urgent.svg +4 -0
- package/src/assets/images/priority_icons/urgent_v2.svg +16 -0
- package/src/assets/js/chat21client.js +16 -3
- package/src/assets/tiledesk-solo-logo.png +0 -0
- package/src/chat-config-mqtt.json +27 -17
- package/src/chat-config-pre-test.json +5 -1
- package/src/chat-config-pre.json +15 -3
- package/src/chat-config-template.json +6 -2
- package/src/chat-config.json +5 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +61 -45
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +23 -0
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -1
- package/src/chat21-core/utils/constants.ts +8 -1
- package/src/chat21-core/utils/utils-message.ts +19 -0
- package/src/chat21-core/utils/utils.ts +12 -1
- package/src/global.scss +408 -2
- package/src/index.html +7 -0
- package/publish_pre.sh +0 -33
- package/publish_prod.sh +0 -33
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { Component, ElementRef, EventEmitter, HostListener, Input, OnChanges, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
3
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
4
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
5
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
6
|
+
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
|
|
7
|
+
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
8
|
+
import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
|
|
9
|
+
import { WebsocketService } from 'src/app/services/websocket/websocket.service';
|
|
10
|
+
import { skip } from 'rxjs/operators';
|
|
11
|
+
import { AppConfigProvider } from 'src/app/services/app-config';
|
|
12
|
+
import { EventsService } from 'src/app/services/events-service';
|
|
13
|
+
import { tranlatedLanguage } from '../../../chat21-core/utils/constants';
|
|
14
|
+
import { avatarPlaceholder, getColorBck } from 'src/chat21-core/utils/utils-user';
|
|
15
|
+
import * as PACKAGE from 'package.json';
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'app-sidebar-user-details',
|
|
18
|
+
templateUrl: './sidebar-user-details.component.html',
|
|
19
|
+
styleUrls: ['./sidebar-user-details.component.scss'],
|
|
20
|
+
})
|
|
21
|
+
export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
22
|
+
// HAS_CLICKED_OPEN_USER_DETAIL: boolean = false;
|
|
23
|
+
// @Output() onCloseUserDetailsSidebar = new EventEmitter();
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
public browserLang: string;
|
|
27
|
+
private logger: LoggerService = LoggerInstance.getInstance()
|
|
28
|
+
chat_lang: string
|
|
29
|
+
flag_url: string;
|
|
30
|
+
photo_profile_URL: string;
|
|
31
|
+
IS_BUSY: boolean;
|
|
32
|
+
IS_AVAILABLE: boolean;
|
|
33
|
+
USER_ROLE: boolean;
|
|
34
|
+
USER_ROLE_LABEL: string;
|
|
35
|
+
EditProfileLabel: string;
|
|
36
|
+
IS_BUSY_msg: string;
|
|
37
|
+
IS_AVAILABLE_msg: string;
|
|
38
|
+
IS_UNAVAILABLE_msg: string;
|
|
39
|
+
SUBSCRIPTION_PAYMENT_PROBLEM_msg: string;
|
|
40
|
+
THE_PLAN_HAS_EXPIRED_msg: string;
|
|
41
|
+
PAYD_PLAN_NAME_PRO_msg: string;
|
|
42
|
+
PAYD_PLAN_NAME_ENTERPRISE_msg: string;
|
|
43
|
+
PRO_PLAN_TRIAL_msg: string;
|
|
44
|
+
FREE_PLAN_msg: string;
|
|
45
|
+
LOGOUT_msg: string;
|
|
46
|
+
profile_name_translated: string;
|
|
47
|
+
SubscriptionPaymentProblem: string;
|
|
48
|
+
user: any
|
|
49
|
+
projectID: any
|
|
50
|
+
tiledeskToken: string;
|
|
51
|
+
prjct_name: string;
|
|
52
|
+
plan_type: string;
|
|
53
|
+
_prjct_profile_name: string;
|
|
54
|
+
|
|
55
|
+
isVisiblePAY: boolean;
|
|
56
|
+
public_Key: any
|
|
57
|
+
plan_name: string;
|
|
58
|
+
plan_subscription_is_active: boolean;
|
|
59
|
+
USER_PHOTO_PROFILE_EXIST: boolean;
|
|
60
|
+
version: string
|
|
61
|
+
test: Date = new Date();
|
|
62
|
+
company_name: string = 'Tiledesk'
|
|
63
|
+
DASHBOARD_URL: string;
|
|
64
|
+
constructor(
|
|
65
|
+
private translate: TranslateService,
|
|
66
|
+
public tiledeskAuthService: TiledeskAuthService,
|
|
67
|
+
public imageRepoService: ImageRepoService,
|
|
68
|
+
public appStorageService: AppStorageService,
|
|
69
|
+
private messagingAuthService: MessagingAuthService,
|
|
70
|
+
public wsService: WebsocketService,
|
|
71
|
+
public appConfigProvider: AppConfigProvider,
|
|
72
|
+
public events: EventsService,
|
|
73
|
+
private eRef: ElementRef,
|
|
74
|
+
|
|
75
|
+
) { }
|
|
76
|
+
|
|
77
|
+
ngOnInit() {
|
|
78
|
+
this.DASHBOARD_URL = this.appConfigProvider.getConfig().dashboardUrl + '#/project/';
|
|
79
|
+
this.version = PACKAGE.version;
|
|
80
|
+
this.getCurrentChatLangAndTranslateLabels();
|
|
81
|
+
this.subcribeToAuthStateChanged();
|
|
82
|
+
this.listenTocurrentProjectUserUserAvailability$();
|
|
83
|
+
this.getCurrentStoredProject();
|
|
84
|
+
this.getOSCODE();
|
|
85
|
+
// this.listenOpenUserSidebarEvent();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
subcribeToAuthStateChanged() {
|
|
89
|
+
this.messagingAuthService.BSAuthStateChanged.subscribe((state) => {
|
|
90
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] BSAuthStateChanged ', state)
|
|
91
|
+
|
|
92
|
+
if (state === 'online') {
|
|
93
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
94
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] currentUser ', currentUser)
|
|
95
|
+
if (currentUser) {
|
|
96
|
+
this.user = currentUser;
|
|
97
|
+
this.createUserAvatar(this.user)
|
|
98
|
+
this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(currentUser.uid)
|
|
99
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] photo_profile_URL ', this.photo_profile_URL);
|
|
100
|
+
this.checkIfExistPhotoProfile(this.photo_profile_URL)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
checkIfExistPhotoProfile(imageUrl) {
|
|
107
|
+
this.verifyImageURL(imageUrl, (imageExists) => {
|
|
108
|
+
|
|
109
|
+
if (imageExists === true) {
|
|
110
|
+
this.USER_PHOTO_PROFILE_EXIST = true;
|
|
111
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] photo_profile_URL IMAGE EXIST ', imageExists)
|
|
112
|
+
|
|
113
|
+
} else {
|
|
114
|
+
this.USER_PHOTO_PROFILE_EXIST = false;
|
|
115
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] photo_profile_URL IMAGE EXIST ', imageExists)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
createUserAvatar(currentUser) {
|
|
122
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - createProjectUserAvatar ', currentUser)
|
|
123
|
+
let fullname = ''
|
|
124
|
+
if (currentUser && currentUser.firstname && currentUser.lastname) {
|
|
125
|
+
fullname = currentUser.firstname + ' ' + currentUser.lastname
|
|
126
|
+
currentUser['fullname_initial'] = avatarPlaceholder(fullname)
|
|
127
|
+
currentUser['fillColour'] = getColorBck(fullname)
|
|
128
|
+
} else if (currentUser && currentUser.firstname) {
|
|
129
|
+
fullname = currentUser.firstname
|
|
130
|
+
currentUser['fullname_initial'] = avatarPlaceholder(fullname)
|
|
131
|
+
currentUser['fillColour'] = getColorBck(fullname)
|
|
132
|
+
} else {
|
|
133
|
+
currentUser['fullname_initial'] = 'N/A'
|
|
134
|
+
currentUser['fillColour'] = 'rgb(98, 100, 167)'
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
verifyImageURL(image_url, callBack) {
|
|
139
|
+
const img = new Image();
|
|
140
|
+
img.src = image_url;
|
|
141
|
+
img.onload = function () {
|
|
142
|
+
callBack(true);
|
|
143
|
+
};
|
|
144
|
+
img.onerror = function () {
|
|
145
|
+
callBack(false);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// listenOpenUserSidebarEvent() {
|
|
150
|
+
// this.events.subscribe('userdetailsidebar:opened', (openUserDetailsSidebar) => {
|
|
151
|
+
// this.logger.log('[SIDEBAR-USER-DETAILS] - listenOpenUserSidebarEvent - openUserDetailsSidebar', openUserDetailsSidebar);
|
|
152
|
+
// this.HAS_CLICKED_OPEN_USER_DETAIL = true;
|
|
153
|
+
// });
|
|
154
|
+
// }
|
|
155
|
+
|
|
156
|
+
@HostListener('document:click', ['$event'])
|
|
157
|
+
clickout(event) {
|
|
158
|
+
this.logger.log('[SIDEBAR-USER-DETAILSS-CHAT] clickout event.target)', event.target)
|
|
159
|
+
this.logger.log('[SIDEBAR-USER-DETAILSS-CHAT] clickout event.target)', event.target.id)
|
|
160
|
+
const clicked_element_id = event.target.id
|
|
161
|
+
if (this.eRef.nativeElement.contains(event.target)) {
|
|
162
|
+
// this.logger.log('[SIDEBAR-USER-DETAILS] clicked inside')
|
|
163
|
+
} else {
|
|
164
|
+
if (!clicked_element_id.startsWith("sidebaravatar")) {
|
|
165
|
+
this.closeUserDetailSidePanel();
|
|
166
|
+
}
|
|
167
|
+
// this.logger.log('[SIDEBAR-USER-DETAILS] clicked outside')
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
closeUserDetailSidePanel() {
|
|
173
|
+
var element = document.getElementById('user-details');
|
|
174
|
+
element.classList.remove("active");
|
|
175
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] element', element);
|
|
176
|
+
// this.HAS_CLICKED_OPEN_USER_DETAIL === true
|
|
177
|
+
// this.onCloseUserDetailsSidebar.emit(false);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
getCurrentChatLangAndTranslateLabels() {
|
|
182
|
+
this.browserLang = this.translate.getBrowserLang();
|
|
183
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
184
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser ', currentUser)
|
|
185
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - browserLang ', this.browserLang)
|
|
186
|
+
let currentUserId = ''
|
|
187
|
+
if (currentUser) {
|
|
188
|
+
currentUserId = currentUser.uid
|
|
189
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUserId ', currentUserId)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
|
|
193
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] stored_preferred_lang: ', stored_preferred_lang);
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
this.chat_lang = ''
|
|
197
|
+
if (this.browserLang && !stored_preferred_lang) {
|
|
198
|
+
this.chat_lang = this.browserLang
|
|
199
|
+
// this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
|
|
200
|
+
|
|
201
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
|
|
202
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
|
|
203
|
+
} else if (this.browserLang && stored_preferred_lang) {
|
|
204
|
+
this.chat_lang = stored_preferred_lang
|
|
205
|
+
// this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
|
|
206
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
|
|
207
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
if (tranlatedLanguage.includes(this.chat_lang)) {
|
|
212
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
|
|
213
|
+
this.translate.use(this.chat_lang);
|
|
214
|
+
this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
|
|
215
|
+
} else {
|
|
216
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
|
|
217
|
+
this.translate.use('en');
|
|
218
|
+
this.flag_url = "assets/images/language_flag/en.png"
|
|
219
|
+
this.chat_lang = 'en'
|
|
220
|
+
}
|
|
221
|
+
this.translateLabels()
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
translateLabels() {
|
|
225
|
+
this.getEditProfileTranslation();
|
|
226
|
+
this.getAvailableTranslation();
|
|
227
|
+
this.getUnavailableTranslation();
|
|
228
|
+
this.getIsBusyTranslation();
|
|
229
|
+
this.getSubscriptionPaymentProblemTranslation();
|
|
230
|
+
this.getThePlanHasExpiredTranslation();
|
|
231
|
+
this.getLogoutTranslation();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
getOSCODE() {
|
|
236
|
+
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK;
|
|
237
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] AppConfigService getAppConfig public_Key', this.public_Key);
|
|
238
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] AppConfigService getAppConfig', this.appConfigProvider.getConfig());
|
|
239
|
+
if (this.public_Key) {
|
|
240
|
+
let keys = this.public_Key.split("-");
|
|
241
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] PUBLIC-KEY - public_Key keys', keys)
|
|
242
|
+
|
|
243
|
+
keys.forEach(key => {
|
|
244
|
+
if (key.includes("PAY")) {
|
|
245
|
+
|
|
246
|
+
let pay = key.split(":");
|
|
247
|
+
|
|
248
|
+
if (pay[1] === "F") {
|
|
249
|
+
this.isVisiblePAY = false;
|
|
250
|
+
} else {
|
|
251
|
+
this.isVisiblePAY = true;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
if (!this.public_Key.includes("PAY")) {
|
|
257
|
+
this.isVisiblePAY = false;
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
this.isVisiblePAY = false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
getEditProfileTranslation() {
|
|
265
|
+
this.translate.get('EditProfile')
|
|
266
|
+
.subscribe((text: string) => {
|
|
267
|
+
|
|
268
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
269
|
+
this.EditProfileLabel = text
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
getAvailableTranslation() {
|
|
276
|
+
this.translate.get('Available')
|
|
277
|
+
.subscribe((text: string) => {
|
|
278
|
+
|
|
279
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
280
|
+
this.IS_AVAILABLE_msg = text
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
getUnavailableTranslation() {
|
|
284
|
+
this.translate.get('Unavailable')
|
|
285
|
+
.subscribe((text: string) => {
|
|
286
|
+
|
|
287
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
288
|
+
this.IS_UNAVAILABLE_msg = text
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
getIsBusyTranslation() {
|
|
293
|
+
this.translate.get('Busy')
|
|
294
|
+
.subscribe((text: string) => {
|
|
295
|
+
|
|
296
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
297
|
+
this.IS_BUSY_msg = text
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
getLogoutTranslation() {
|
|
302
|
+
this.translate.get('LABEL_LOGOUT')
|
|
303
|
+
.subscribe((text: string) => {
|
|
304
|
+
// this.deleteContact_msg = text;
|
|
305
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET Logout label ', text)
|
|
306
|
+
this.LOGOUT_msg = text
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
getSubscriptionPaymentProblemTranslation() {
|
|
311
|
+
this.translate.get('SubscriptionPaymentProblem')
|
|
312
|
+
.subscribe((text: string) => {
|
|
313
|
+
|
|
314
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
315
|
+
this.SUBSCRIPTION_PAYMENT_PROBLEM_msg = text
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
getThePlanHasExpiredTranslation() {
|
|
320
|
+
this.translate.get('ThePlanHasExpired')
|
|
321
|
+
.subscribe((text: string) => {
|
|
322
|
+
|
|
323
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
324
|
+
this.THE_PLAN_HAS_EXPIRED_msg = text
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
getCurrentStoredProject() {
|
|
330
|
+
try {
|
|
331
|
+
const project = localStorage.getItem('last_project')
|
|
332
|
+
if (project && project !== 'undefined') {
|
|
333
|
+
const projectObjct = JSON.parse(localStorage.getItem('last_project'))
|
|
334
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
|
|
335
|
+
|
|
336
|
+
this.projectID = projectObjct['id_project']['_id']
|
|
337
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PROJECT ID ', this.projectID);
|
|
338
|
+
|
|
339
|
+
this.prjct_name = projectObjct['id_project']['name']
|
|
340
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PROJECT NAME ', this.prjct_name);
|
|
341
|
+
|
|
342
|
+
this.plan_type = projectObjct['id_project']['profile']['type'];
|
|
343
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PLAN TYPE ', this.plan_type);
|
|
344
|
+
|
|
345
|
+
const trial_expired = projectObjct['id_project']['trialExpired']
|
|
346
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > TRIAL EXPIRED ', trial_expired);
|
|
347
|
+
|
|
348
|
+
const profile_name = projectObjct['id_project']['profile']['name'];
|
|
349
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PROFILE NAME ', profile_name);
|
|
350
|
+
|
|
351
|
+
this.plan_name = projectObjct['id_project']['profile']['name'];
|
|
352
|
+
this.plan_subscription_is_active = projectObjct['id_project']['isActiveSubscription'];
|
|
353
|
+
|
|
354
|
+
if (this.plan_type === 'free') {
|
|
355
|
+
|
|
356
|
+
if (trial_expired === false) {
|
|
357
|
+
this.getProPlanTrialTranslation();
|
|
358
|
+
} else if (trial_expired === true) {
|
|
359
|
+
this.getFreePlanTranslation();
|
|
360
|
+
}
|
|
361
|
+
} else if (this.plan_type === 'payment' && profile_name === 'pro') {
|
|
362
|
+
this.getProPlanTranslation();
|
|
363
|
+
} else if (this.plan_type === 'payment' && profile_name === 'enterprise') {
|
|
364
|
+
this.getEnterprisePlanTranslation();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
} catch (err) {
|
|
370
|
+
this.logger.error('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ERR ', err)
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
try {
|
|
374
|
+
this.tiledeskToken = this.appStorageService.getItem('tiledeskToken');
|
|
375
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET STORED TOKEN ', this.tiledeskToken)
|
|
376
|
+
} catch (err) {
|
|
377
|
+
this.logger.error('[SIDEBAR-USER-DETAILS] - GET STORED TOKEN ', err)
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
getProPlanTrialTranslation() {
|
|
383
|
+
// this.profile_name_translated = this.PRO_PLAN_TRIAL_msg;
|
|
384
|
+
this.translate.get('ProPlanTrial')
|
|
385
|
+
.subscribe((text: string) => {
|
|
386
|
+
|
|
387
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
388
|
+
this.profile_name_translated = text
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
getFreePlanTranslation() {
|
|
393
|
+
// this.profile_name_translated = this.FREE_PLAN_msg;
|
|
394
|
+
this.translate.get('FreePlan')
|
|
395
|
+
.subscribe((text: string) => {
|
|
396
|
+
|
|
397
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
398
|
+
this.profile_name_translated = text
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
getProPlanTranslation() {
|
|
403
|
+
// this.profile_name_translated = this.PAYD_PLAN_NAME_PRO_msg;
|
|
404
|
+
this.translate.get('PaydPlanNamePro')
|
|
405
|
+
.subscribe((text: string) => {
|
|
406
|
+
// this.deleteContact_msg = text;
|
|
407
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
408
|
+
this.profile_name_translated = text
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
getEnterprisePlanTranslation() {
|
|
413
|
+
// this.profile_name_translated = this.PAYD_PLAN_NAME_ENTERPRISE_msg;
|
|
414
|
+
this.translate.get('PaydPlanNameEnterprise')
|
|
415
|
+
.subscribe((text: string) => {
|
|
416
|
+
// this.deleteContact_msg = text;
|
|
417
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
418
|
+
this.profile_name_translated = text
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
listenTocurrentProjectUserUserAvailability$() {
|
|
426
|
+
this.wsService.currentProjectUserAvailability$
|
|
427
|
+
.pipe(skip(1))
|
|
428
|
+
.subscribe((projectUser) => {
|
|
429
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS RES ', projectUser);
|
|
430
|
+
|
|
431
|
+
if (projectUser) {
|
|
432
|
+
this.IS_AVAILABLE = projectUser['user_available']
|
|
433
|
+
this.IS_BUSY = projectUser['isBusy']
|
|
434
|
+
this.USER_ROLE = projectUser['role']
|
|
435
|
+
// console.log('[SIDEBAR-USER-DETAILS] -translateUserRole 1', this.USER_ROLE)
|
|
436
|
+
this.translateUserRole(this.USER_ROLE)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
}, (error) => {
|
|
442
|
+
this.logger.error('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS error ', error);
|
|
443
|
+
}, () => {
|
|
444
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS * COMPLETE *');
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
translateUserRole(role) {
|
|
449
|
+
// console.log('[SIDEBAR-USER-DETAILS] -translateUserRole ', role)
|
|
450
|
+
this.translate.get(role)
|
|
451
|
+
.subscribe((text: string) => {
|
|
452
|
+
|
|
453
|
+
// console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
454
|
+
this.USER_ROLE_LABEL = text
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
ngOnChanges() {
|
|
462
|
+
// console.log('[SIDEBAR-USER-DETAILS] HAS_CLICKED_OPEN_USER_DETAIL', this.HAS_CLICKED_OPEN_USER_DETAIL)
|
|
463
|
+
// var element = document.getElementById('user-details');
|
|
464
|
+
// // console.log('[SIDEBAR-USER-DETAILS] element', element)
|
|
465
|
+
// if (this.HAS_CLICKED_OPEN_USER_DETAIL === true) {
|
|
466
|
+
// element.classList.add("active");
|
|
467
|
+
// }
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
// closeUserDetailSidePanel() {
|
|
473
|
+
// var element = document.getElementById('user-details');
|
|
474
|
+
// element.classList.remove("active");
|
|
475
|
+
// this.logger.log('[SIDEBAR-USER-DETAILS] element', element);
|
|
476
|
+
// this.HAS_CLICKED_OPEN_USER_DETAIL === true
|
|
477
|
+
// // this.onCloseUserDetailsSidebar.emit(false);
|
|
478
|
+
// }
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
changeAvailabilityStateInUserDetailsSidebar(available) {
|
|
483
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.projectID, ' available 1: ', available);
|
|
484
|
+
|
|
485
|
+
// available = !available
|
|
486
|
+
// console.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.projectID, ' available 2 : ', available);
|
|
487
|
+
|
|
488
|
+
this.wsService.updateCurrentUserAvailability(this.tiledeskToken, this.projectID, available)
|
|
489
|
+
.subscribe((projectUser: any) => {
|
|
490
|
+
|
|
491
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED ', projectUser)
|
|
492
|
+
|
|
493
|
+
// NOTIFY TO THE USER SERVICE WHEN THE AVAILABLE / UNAVAILABLE BUTTON IS CLICKED
|
|
494
|
+
// this.usersService.availability_btn_clicked(true)
|
|
495
|
+
|
|
496
|
+
// if (this.project['id_project']._id === projectUser.id_project) {
|
|
497
|
+
// this.project['ws_projct_user_available'] = projectUser.user_available;
|
|
498
|
+
// // this.project['ws_projct_user_isBusy'] = projectUser['isBusy']
|
|
499
|
+
// }
|
|
500
|
+
|
|
501
|
+
}, (error) => {
|
|
502
|
+
this.logger.error('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED - ERROR ', error);
|
|
503
|
+
|
|
504
|
+
}, () => {
|
|
505
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED * COMPLETE *');
|
|
506
|
+
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
goToUserProfile() {
|
|
511
|
+
let url = this.DASHBOARD_URL + this.projectID + '/user-profile'
|
|
512
|
+
|
|
513
|
+
const myWindow = window.open(url, '_self');
|
|
514
|
+
myWindow.focus();
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
goToHelpCenter() {
|
|
518
|
+
const url = "https://gethelp.tiledesk.com/"
|
|
519
|
+
window.open(url, '_blank');
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
public onLogout() {
|
|
523
|
+
// this.authService.logout();
|
|
524
|
+
this.closeUserDetailSidePanel()
|
|
525
|
+
// pubblico evento
|
|
526
|
+
this.events.publish('profileInfoButtonClick:logout', true);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
}
|
|
@@ -34,13 +34,19 @@ import { InfoGroupComponent } from 'src/app/components/conversation-info/info-gr
|
|
|
34
34
|
import { SharedModule } from 'src/app/shared/shared.module';
|
|
35
35
|
// import { SharedConversationInfoModule } from 'src/app/shared/shared-conversation-info.module';
|
|
36
36
|
import { NgxLinkifyjsModule } from 'ngx-linkifyjs';
|
|
37
|
+
import { ScrollbarThemeModule } from '../../utils/scrollbar-theme.directive';
|
|
38
|
+
import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
39
|
+
|
|
37
40
|
|
|
38
41
|
@NgModule({
|
|
39
42
|
imports: [
|
|
40
43
|
CommonModule,
|
|
41
44
|
FormsModule,
|
|
42
45
|
IonicModule,
|
|
46
|
+
TooltipModule,
|
|
43
47
|
ConversationDetailPageRoutingModule,
|
|
48
|
+
ScrollbarThemeModule,
|
|
49
|
+
PickerModule,
|
|
44
50
|
TranslateModule.forChild({
|
|
45
51
|
loader: {
|
|
46
52
|
provide: TranslateLoader,
|
|
@@ -51,11 +57,12 @@ import { NgxLinkifyjsModule } from 'ngx-linkifyjs';
|
|
|
51
57
|
SharedModule,
|
|
52
58
|
NgxLinkifyjsModule,
|
|
53
59
|
],
|
|
54
|
-
entryComponents: [MessageTextAreaComponent],
|
|
60
|
+
// entryComponents: [MessageTextAreaComponent],
|
|
61
|
+
entryComponents: [],
|
|
55
62
|
declarations: [
|
|
56
63
|
ConversationDetailPage,
|
|
57
64
|
HeaderConversationDetailComponent,
|
|
58
|
-
MessageTextAreaComponent
|
|
65
|
+
MessageTextAreaComponent
|
|
59
66
|
// BubbleDayMessageComponent,
|
|
60
67
|
// BubbleSystemMessageComponent,
|
|
61
68
|
// BubbleMyMessageComponent,
|