@chat21/chat21-ionic 3.0.60 → 3.0.61-rc2
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 +23 -0
- package/README.md +2 -0
- package/angular.json +2 -0
- package/env.sample +3 -1
- package/package.json +5 -1
- package/src/app/app.component.html +11 -2
- package/src/app/app.component.scss +13 -1
- package/src/app/app.component.ts +26 -3
- package/src/app/app.module.ts +2 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +2 -2
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +24 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -3
- package/src/app/components/conversation-info/info-content/info-content.component.html +2 -2
- package/src/app/components/ddp-header/ddp-header.component.html +14 -7
- package/src/app/components/ddp-header/ddp-header.component.scss +4 -0
- package/src/app/components/ddp-header/ddp-header.component.ts +21 -2
- package/src/app/components/project-item/project-item.component.html +7 -6
- package/src/app/components/project-item/project-item.component.scss +6 -1
- package/src/app/components/project-item/project-item.component.ts +15 -2
- package/src/app/components/sidebar/sidebar.component.html +210 -0
- package/src/app/components/sidebar/sidebar.component.scss +11 -0
- package/src/app/components/sidebar/sidebar.component.spec.ts +24 -0
- package/src/app/components/sidebar/sidebar.component.ts +400 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +102 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +310 -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 +423 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +21 -20
- package/src/app/pages/conversations-list/conversations-list.page.html +11 -5
- package/src/app/pages/conversations-list/conversations-list.page.ts +33 -8
- package/src/app/pages/profile-info/profile-info.page.html +2 -2
- package/src/app/pages/profile-info/profile-info.page.ts +23 -21
- package/src/app/shared/shared.module.ts +13 -0
- package/src/assets/i18n/de.json +29 -12
- package/src/assets/i18n/en.json +21 -4
- package/src/assets/i18n/es.json +21 -4
- package/src/assets/i18n/fr.json +21 -4
- package/src/assets/i18n/it.json +21 -4
- package/src/assets/i18n/pt.json +21 -4
- package/src/assets/i18n/ru.json +21 -4
- package/src/assets/i18n/tr.json +23 -5
- 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/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/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/tiledesk-solo-logo.png +0 -0
- package/src/chat-config-pre-test.json +3 -1
- package/src/chat-config-template.json +3 -1
- package/src/chat-config.json +4 -2
- package/src/global.scss +451 -3
- package/src/index.html +7 -0
|
@@ -0,0 +1,423 @@
|
|
|
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
|
+
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'app-sidebar-user-details',
|
|
17
|
+
templateUrl: './sidebar-user-details.component.html',
|
|
18
|
+
styleUrls: ['./sidebar-user-details.component.scss'],
|
|
19
|
+
})
|
|
20
|
+
export class SidebarUserDetailsComponent implements OnInit, OnChanges {
|
|
21
|
+
HAS_CLICKED_OPEN_USER_DETAIL: boolean = false;
|
|
22
|
+
// @Output() onCloseUserDetailsSidebar = new EventEmitter();
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
public browserLang: string;
|
|
26
|
+
private logger: LoggerService = LoggerInstance.getInstance()
|
|
27
|
+
chat_lang: string
|
|
28
|
+
flag_url: string;
|
|
29
|
+
photo_profile_URL: string;
|
|
30
|
+
IS_BUSY: boolean;
|
|
31
|
+
IS_AVAILABLE: boolean;
|
|
32
|
+
USER_ROLE: boolean;
|
|
33
|
+
USER_ROLE_LABEL: string;
|
|
34
|
+
IS_BUSY_msg: string;
|
|
35
|
+
IS_AVAILABLE_msg: string;
|
|
36
|
+
IS_UNAVAILABLE_msg: string;
|
|
37
|
+
SUBSCRIPTION_PAYMENT_PROBLEM_msg: string;
|
|
38
|
+
THE_PLAN_HAS_EXPIRED_msg: string;
|
|
39
|
+
PAYD_PLAN_NAME_PRO_msg: string;
|
|
40
|
+
PAYD_PLAN_NAME_ENTERPRISE_msg: string;
|
|
41
|
+
PRO_PLAN_TRIAL_msg: string;
|
|
42
|
+
FREE_PLAN_msg: string;
|
|
43
|
+
profile_name_translated: string;
|
|
44
|
+
SubscriptionPaymentProblem: string;
|
|
45
|
+
user: any
|
|
46
|
+
projectID: any
|
|
47
|
+
tiledeskToken: string;
|
|
48
|
+
prjct_name: string;
|
|
49
|
+
plan_type: string;
|
|
50
|
+
_prjct_profile_name: string;
|
|
51
|
+
|
|
52
|
+
isVisiblePAY: boolean;
|
|
53
|
+
public_Key: any
|
|
54
|
+
plan_name: string;
|
|
55
|
+
plan_subscription_is_active: boolean;
|
|
56
|
+
constructor(
|
|
57
|
+
private translate: TranslateService,
|
|
58
|
+
public tiledeskAuthService: TiledeskAuthService,
|
|
59
|
+
public imageRepoService: ImageRepoService,
|
|
60
|
+
public appStorageService: AppStorageService,
|
|
61
|
+
private messagingAuthService: MessagingAuthService,
|
|
62
|
+
public wsService: WebsocketService,
|
|
63
|
+
public appConfigProvider: AppConfigProvider,
|
|
64
|
+
public events: EventsService,
|
|
65
|
+
private eRef: ElementRef,
|
|
66
|
+
) { }
|
|
67
|
+
|
|
68
|
+
ngOnInit() {
|
|
69
|
+
this.getCurrentChatLangAndTranslateLabels();
|
|
70
|
+
this.subcribeToAuthStateChanged();
|
|
71
|
+
this.listenTocurrentProjectUserUserAvailability$();
|
|
72
|
+
this.getCurrentStoredProject();
|
|
73
|
+
this.getOSCODE();
|
|
74
|
+
this.listenOpenUserSidebarEvent();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
listenOpenUserSidebarEvent() {
|
|
78
|
+
this.events.subscribe('userdetailsidebar:opened', (openUserDetailsSidebar) => {
|
|
79
|
+
console.log('[SIDEBAR-USER-DETAILS] - listenOpenUserSidebarEvent - openUserDetailsSidebar', openUserDetailsSidebar);
|
|
80
|
+
this.HAS_CLICKED_OPEN_USER_DETAIL = true;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@HostListener('document:click', ['$event'])
|
|
85
|
+
clickout(event) {
|
|
86
|
+
console.log('[SIDEBAR-USER-DETAILS] clickout event.target)', event.target)
|
|
87
|
+
console.log('[SIDEBAR-USER-DETAILS] clickout event.target)', event.target.id)
|
|
88
|
+
const clicked_element_id = event.target.id
|
|
89
|
+
if (this.eRef.nativeElement.contains(event.target)) {
|
|
90
|
+
console.log('[SIDEBAR-USER-DETAILS] clicked inside')
|
|
91
|
+
} else {
|
|
92
|
+
console.log('[SIDEBAR-USER-DETAILS] HAS_CLICKED_OPEN_USER_DETAIL ', this.HAS_CLICKED_OPEN_USER_DETAIL)
|
|
93
|
+
if (this.HAS_CLICKED_OPEN_USER_DETAIL === true) {
|
|
94
|
+
if (!clicked_element_id.startsWith("sidebaravatar")) {
|
|
95
|
+
this.closeUserDetailSidePanel();
|
|
96
|
+
}
|
|
97
|
+
console.log('[SIDEBAR-USER-DETAILS] clicked outside')
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getCurrentChatLangAndTranslateLabels() {
|
|
103
|
+
this.browserLang = this.translate.getBrowserLang();
|
|
104
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
105
|
+
console.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser ', currentUser)
|
|
106
|
+
console.log('[SIDEBAR-USER-DETAILS] - ngOnInit - browserLang ', this.browserLang)
|
|
107
|
+
let currentUserId = ''
|
|
108
|
+
if (currentUser) {
|
|
109
|
+
currentUserId = currentUser.uid
|
|
110
|
+
console.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUserId ', currentUserId)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
|
|
114
|
+
console.log('[SIDEBAR-USER-DETAILS] stored_preferred_lang: ', stored_preferred_lang);
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
this.chat_lang = ''
|
|
118
|
+
if (this.browserLang && !stored_preferred_lang) {
|
|
119
|
+
this.chat_lang = this.browserLang
|
|
120
|
+
this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
|
|
121
|
+
|
|
122
|
+
console.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
|
|
123
|
+
console.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
|
|
124
|
+
} else if (this.browserLang && stored_preferred_lang) {
|
|
125
|
+
this.chat_lang = stored_preferred_lang
|
|
126
|
+
this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
|
|
127
|
+
console.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
|
|
128
|
+
console.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
this.translate.use(this.chat_lang);
|
|
132
|
+
this.translateLabels()
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
translateLabels() {
|
|
136
|
+
this.getAvailableTranslation();
|
|
137
|
+
this.getUnavailableTranslation();
|
|
138
|
+
this.getIsBusyTranslation();
|
|
139
|
+
this.getSubscriptionPaymentProblemTranslation();
|
|
140
|
+
this.getThePlanHasExpiredTranslation();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
getOSCODE() {
|
|
145
|
+
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK;
|
|
146
|
+
console.log('[SIDEBAR-USER-DETAILS] AppConfigService getAppConfig public_Key', this.public_Key);
|
|
147
|
+
console.log('[SIDEBAR-USER-DETAILS] AppConfigService getAppConfig', this.appConfigProvider.getConfig());
|
|
148
|
+
if (this.public_Key) {
|
|
149
|
+
let keys = this.public_Key.split("-");
|
|
150
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] PUBLIC-KEY - public_Key keys', keys)
|
|
151
|
+
|
|
152
|
+
keys.forEach(key => {
|
|
153
|
+
if (key.includes("PAY")) {
|
|
154
|
+
|
|
155
|
+
let pay = key.split(":");
|
|
156
|
+
|
|
157
|
+
if (pay[1] === "F") {
|
|
158
|
+
this.isVisiblePAY = false;
|
|
159
|
+
} else {
|
|
160
|
+
this.isVisiblePAY = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
if (!this.public_Key.includes("PAY")) {
|
|
166
|
+
this.isVisiblePAY = false;
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
this.isVisiblePAY = false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
getAvailableTranslation() {
|
|
174
|
+
this.translate.get('Available')
|
|
175
|
+
.subscribe((text: string) => {
|
|
176
|
+
// this.deleteContact_msg = text;
|
|
177
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
178
|
+
this.IS_AVAILABLE_msg = text
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
getUnavailableTranslation() {
|
|
182
|
+
this.translate.get('Unavailable')
|
|
183
|
+
.subscribe((text: string) => {
|
|
184
|
+
// this.deleteContact_msg = text;
|
|
185
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
186
|
+
this.IS_UNAVAILABLE_msg = text
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
getIsBusyTranslation() {
|
|
191
|
+
this.translate.get('Busy')
|
|
192
|
+
.subscribe((text: string) => {
|
|
193
|
+
// this.deleteContact_msg = text;
|
|
194
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
195
|
+
this.IS_BUSY_msg = text
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
getSubscriptionPaymentProblemTranslation() {
|
|
200
|
+
this.translate.get('SubscriptionPaymentProblem')
|
|
201
|
+
.subscribe((text: string) => {
|
|
202
|
+
// this.deleteContact_msg = text;
|
|
203
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
204
|
+
this.SUBSCRIPTION_PAYMENT_PROBLEM_msg = text
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
getThePlanHasExpiredTranslation() {
|
|
209
|
+
this.translate.get('ThePlanHasExpired')
|
|
210
|
+
.subscribe((text: string) => {
|
|
211
|
+
// this.deleteContact_msg = text;
|
|
212
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
213
|
+
this.THE_PLAN_HAS_EXPIRED_msg = text
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
getCurrentStoredProject() {
|
|
219
|
+
try {
|
|
220
|
+
const project = localStorage.getItem('last_project')
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
if (project) {
|
|
224
|
+
const projectObjct = JSON.parse(localStorage.getItem('last_project'))
|
|
225
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
|
|
226
|
+
|
|
227
|
+
this.projectID = projectObjct['id_project']['_id']
|
|
228
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PROJECT ID ', this.projectID);
|
|
229
|
+
|
|
230
|
+
this.prjct_name = projectObjct['id_project']['name']
|
|
231
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PROJECT NAME ', this.prjct_name);
|
|
232
|
+
|
|
233
|
+
this.plan_type = projectObjct['id_project']['profile']['type'];
|
|
234
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PLAN TYPE ', this.plan_type);
|
|
235
|
+
|
|
236
|
+
const trial_expired = projectObjct['id_project']['trialExpired']
|
|
237
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > TRIAL EXPIRED ', trial_expired);
|
|
238
|
+
|
|
239
|
+
const profile_name = projectObjct['id_project']['profile']['name'];
|
|
240
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT > PROFILE NAME ', profile_name);
|
|
241
|
+
|
|
242
|
+
this.plan_name = projectObjct['id_project']['profile']['name'];
|
|
243
|
+
this.plan_subscription_is_active = projectObjct['id_project']['isActiveSubscription'];
|
|
244
|
+
|
|
245
|
+
if (this.plan_type === 'free') {
|
|
246
|
+
|
|
247
|
+
if (trial_expired === false) {
|
|
248
|
+
this.getProPlanTrialTranslation();
|
|
249
|
+
} else if (trial_expired === true) {
|
|
250
|
+
this.getFreePlanTranslation();
|
|
251
|
+
}
|
|
252
|
+
} else if (this.plan_type === 'payment' && profile_name === 'pro') {
|
|
253
|
+
this.getProPlanTranslation();
|
|
254
|
+
} else if (this.plan_type === 'payment' && profile_name === 'enterprise') {
|
|
255
|
+
this.getEnterprisePlanTranslation();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
} catch (err) {
|
|
261
|
+
console.error('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ERR ', err)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
try {
|
|
265
|
+
this.tiledeskToken = this.appStorageService.getItem('tiledeskToken');
|
|
266
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET STORED TOKEN ', this.tiledeskToken)
|
|
267
|
+
} catch (err) {
|
|
268
|
+
console.error('[SIDEBAR-USER-DETAILS] - GET STORED TOKEN ', err)
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
getProPlanTrialTranslation() {
|
|
274
|
+
// this.profile_name_translated = this.PRO_PLAN_TRIAL_msg;
|
|
275
|
+
this.translate.get('ProPlanTrial')
|
|
276
|
+
.subscribe((text: string) => {
|
|
277
|
+
// this.deleteContact_msg = text;
|
|
278
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
279
|
+
this.profile_name_translated = text
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
getFreePlanTranslation() {
|
|
284
|
+
// this.profile_name_translated = this.FREE_PLAN_msg;
|
|
285
|
+
this.translate.get('FreePlan')
|
|
286
|
+
.subscribe((text: string) => {
|
|
287
|
+
// this.deleteContact_msg = text;
|
|
288
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
289
|
+
this.profile_name_translated = text
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
getProPlanTranslation() {
|
|
294
|
+
// this.profile_name_translated = this.PAYD_PLAN_NAME_PRO_msg;
|
|
295
|
+
this.translate.get('PaydPlanNamePro')
|
|
296
|
+
.subscribe((text: string) => {
|
|
297
|
+
// this.deleteContact_msg = text;
|
|
298
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
299
|
+
this.profile_name_translated = text
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
getEnterprisePlanTranslation() {
|
|
304
|
+
// this.profile_name_translated = this.PAYD_PLAN_NAME_ENTERPRISE_msg;
|
|
305
|
+
this.translate.get('PaydPlanNameEnterprise')
|
|
306
|
+
.subscribe((text: string) => {
|
|
307
|
+
// this.deleteContact_msg = text;
|
|
308
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
309
|
+
this.profile_name_translated = text
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
listenTocurrentProjectUserUserAvailability$() {
|
|
316
|
+
this.wsService.currentProjectUserAvailability$
|
|
317
|
+
.pipe(skip(1))
|
|
318
|
+
.subscribe((projectUser) => {
|
|
319
|
+
console.log('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS RES ', projectUser);
|
|
320
|
+
|
|
321
|
+
if (projectUser) {
|
|
322
|
+
this.IS_AVAILABLE = projectUser['user_available']
|
|
323
|
+
this.IS_BUSY = projectUser['isBusy']
|
|
324
|
+
this.USER_ROLE = projectUser['role']
|
|
325
|
+
console.log('[SIDEBAR-USER-DETAILS] -translateUserRole 1', this.USER_ROLE)
|
|
326
|
+
this.translateUserRole(this.USER_ROLE)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
}, (error) => {
|
|
332
|
+
this.logger.error('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS error ', error);
|
|
333
|
+
}, () => {
|
|
334
|
+
this.logger.log('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS * COMPLETE *');
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
translateUserRole(role) {
|
|
339
|
+
console.log('[SIDEBAR-USER-DETAILS] -translateUserRole ', role)
|
|
340
|
+
this.translate.get(role)
|
|
341
|
+
.subscribe((text: string) => {
|
|
342
|
+
// this.deleteContact_msg = text;
|
|
343
|
+
console.log('[SIDEBAR-USER-DETAILS] - GET GTTTTTN ', text)
|
|
344
|
+
this.USER_ROLE_LABEL = text
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
ngOnChanges() {
|
|
352
|
+
console.log('[SIDEBAR-USER-DETAILS] HAS_CLICKED_OPEN_USER_DETAIL', this.HAS_CLICKED_OPEN_USER_DETAIL)
|
|
353
|
+
var element = document.getElementById('user-details');
|
|
354
|
+
console.log('[SIDEBAR-USER-DETAILS] element', element)
|
|
355
|
+
if (this.HAS_CLICKED_OPEN_USER_DETAIL === true) {
|
|
356
|
+
element.classList.add("active");
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
subcribeToAuthStateChanged() {
|
|
361
|
+
this.messagingAuthService.BSAuthStateChanged.subscribe((state) => {
|
|
362
|
+
console.log('[SIDEBAR] BSAuthStateChanged ', state)
|
|
363
|
+
|
|
364
|
+
if (state === 'online') {
|
|
365
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
366
|
+
console.log('[SIDEBAR-USER-DETAILS] currentUser ', currentUser)
|
|
367
|
+
if (currentUser) {
|
|
368
|
+
this.user = currentUser;
|
|
369
|
+
this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(currentUser.uid)
|
|
370
|
+
console.log('[SIDEBAR-USER-DETAILS] photo_profile_URL ', this.photo_profile_URL)
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
})
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
closeUserDetailSidePanel() {
|
|
378
|
+
var element = document.getElementById('user-details');
|
|
379
|
+
element.classList.remove("active");
|
|
380
|
+
console.log('[SIDEBAR-USER-DETAILS] element', element);
|
|
381
|
+
this.HAS_CLICKED_OPEN_USER_DETAIL === true
|
|
382
|
+
// this.onCloseUserDetailsSidebar.emit(false);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
changeAvailabilityStateInUserDetailsSidebar(available) {
|
|
388
|
+
console.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.projectID, ' available 1: ', available);
|
|
389
|
+
|
|
390
|
+
// available = !available
|
|
391
|
+
// console.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.projectID, ' available 2 : ', available);
|
|
392
|
+
|
|
393
|
+
this.wsService.updateCurrentUserAvailability(this.tiledeskToken, this.projectID, available)
|
|
394
|
+
.subscribe((projectUser: any) => {
|
|
395
|
+
|
|
396
|
+
console.log('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED ', projectUser)
|
|
397
|
+
|
|
398
|
+
// NOTIFY TO THE USER SERVICE WHEN THE AVAILABLE / UNAVAILABLE BUTTON IS CLICKED
|
|
399
|
+
// this.usersService.availability_btn_clicked(true)
|
|
400
|
+
|
|
401
|
+
// if (this.project['id_project']._id === projectUser.id_project) {
|
|
402
|
+
// this.project['ws_projct_user_available'] = projectUser.user_available;
|
|
403
|
+
// // this.project['ws_projct_user_isBusy'] = projectUser['isBusy']
|
|
404
|
+
// }
|
|
405
|
+
|
|
406
|
+
}, (error) => {
|
|
407
|
+
console.error('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED - ERROR ', error);
|
|
408
|
+
|
|
409
|
+
}, () => {
|
|
410
|
+
console.log('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED * COMPLETE *');
|
|
411
|
+
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
public onLogout() {
|
|
416
|
+
// this.authService.logout();
|
|
417
|
+
this.closeUserDetailSidePanel()
|
|
418
|
+
// pubblico evento
|
|
419
|
+
this.events.publish('profileInfoButtonClick:logout', true);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
}
|
|
@@ -240,7 +240,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
240
240
|
|
|
241
241
|
setTimeout(() => {
|
|
242
242
|
this.showSpinner = false
|
|
243
|
-
},
|
|
243
|
+
}, 3000);
|
|
244
244
|
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -249,33 +249,34 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
249
249
|
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK;
|
|
250
250
|
this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key);
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
if (this.public_Key) {
|
|
253
|
+
let keys = this.public_Key.split("-");
|
|
254
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - public_Key keys', keys)
|
|
254
255
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
256
|
+
keys.forEach(key => {
|
|
257
|
+
if (key.includes("CAR")) {
|
|
258
|
+
let car = key.split(":");
|
|
259
|
+
if (car[1] === "F") {
|
|
260
|
+
this.areVisibleCAR = false;
|
|
261
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
262
|
+
} else {
|
|
263
|
+
this.areVisibleCAR = true;
|
|
264
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
265
|
+
}
|
|
266
266
|
}
|
|
267
|
-
}
|
|
268
267
|
|
|
269
|
-
|
|
268
|
+
});
|
|
270
269
|
|
|
271
|
-
|
|
270
|
+
if (!this.public_Key.includes("CAR")) {
|
|
271
|
+
this.areVisibleCAR = false;
|
|
272
|
+
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
272
275
|
this.areVisibleCAR = false;
|
|
273
|
-
this.logger.log('[CONVS-DETAIL] PUBLIC-KEY - areVisibleCAR', this.areVisibleCAR)
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
watchToConnectionStatus() {
|
|
278
|
-
|
|
279
280
|
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
280
281
|
this.checkInternet = isOnline
|
|
281
282
|
// console.log('[CONVS-LIST-PAGE] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
@@ -488,7 +489,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
488
489
|
"NO_CANNED_RESPONSES",
|
|
489
490
|
"YES_CANNED_RESPONSES",
|
|
490
491
|
"THERE_ARE_NO_CANNED_RESPONSES_AVAILABLE",
|
|
491
|
-
"TO_CREATE_THEM_GO_TO_THE_PROJECT"
|
|
492
|
+
"TO_CREATE_THEM_GO_TO_THE_PROJECT",
|
|
492
493
|
];
|
|
493
494
|
|
|
494
495
|
this.translationMap = this.customTranslateService.translateLanguage(keys);
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
<ion-header no-border class="ion-no-border">
|
|
2
|
-
<app-ddp-header *ngIf="conversationType ==='active'"
|
|
3
|
-
|
|
2
|
+
<app-ddp-header *ngIf="conversationType ==='active'"
|
|
3
|
+
[numberOpenConv]="numberOpenConv"
|
|
4
|
+
[supportMode]="supportMode"
|
|
5
|
+
[archived_btn]="archived_btn"
|
|
6
|
+
[teammates_btn]="teammates_btn"
|
|
7
|
+
(openContactsDirectory)=openContactsDirectory($event)
|
|
8
|
+
(openProfileInfo)=openProfileInfo($event)>
|
|
4
9
|
</app-ddp-header>
|
|
5
10
|
|
|
6
|
-
<app-option-header *ngIf="conversationType !=='active'"
|
|
11
|
+
<app-option-header *ngIf="conversationType !=='active'"
|
|
12
|
+
[headerTitle]=headerTitle
|
|
7
13
|
(onBackButton)=onBackButtonFN($event)>
|
|
8
14
|
</app-option-header>
|
|
9
15
|
</ion-header>
|
|
@@ -36,8 +42,8 @@
|
|
|
36
42
|
</ion-avatar>
|
|
37
43
|
<ion-label part="message-text" class="waiting-for-network-msg"> Waiting for network</ion-label>
|
|
38
44
|
</ion-item>
|
|
39
|
-
<!--
|
|
40
|
-
<ion-item *ngIf="
|
|
45
|
+
<!-- supportMode && -->
|
|
46
|
+
<ion-item *ngIf="displayNewConvsItem" class="ion-no-padding open-iframe-item">
|
|
41
47
|
<div tabindex="0"></div>
|
|
42
48
|
<!-- <ion-note class="pinned-project">
|
|
43
49
|
{{ 'PINNED_PROJECT' | translate }}
|
|
@@ -60,7 +60,8 @@ export class ConversationListPage implements OnInit {
|
|
|
60
60
|
public numberOpenConv = 0;
|
|
61
61
|
public loadingIsActive = true;
|
|
62
62
|
public supportMode: boolean;
|
|
63
|
-
|
|
63
|
+
public teammates_btn: boolean;
|
|
64
|
+
public archived_btn: boolean;
|
|
64
65
|
public convertMessage = convertMessage;
|
|
65
66
|
private isShowMenuPage = false;
|
|
66
67
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
@@ -81,7 +82,15 @@ export class ConversationListPage implements OnInit {
|
|
|
81
82
|
|
|
82
83
|
public displayNewConvsItem: boolean = true
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
tooltipOptions = {
|
|
86
|
+
'show-delay': 1500,
|
|
87
|
+
'tooltip-class': 'chat-tooltip',
|
|
88
|
+
'theme': 'light',
|
|
89
|
+
'shadow': false,
|
|
90
|
+
'hide-delay-mobile': 0,
|
|
91
|
+
'hideDelayAfterClick': 3000,
|
|
92
|
+
'hide-delay': 200
|
|
93
|
+
};
|
|
85
94
|
|
|
86
95
|
constructor(
|
|
87
96
|
private router: Router,
|
|
@@ -151,7 +160,7 @@ export class ConversationListPage implements OnInit {
|
|
|
151
160
|
// -----------------------------------------------
|
|
152
161
|
ngOnInit() {
|
|
153
162
|
this.watchToConnectionStatus();
|
|
154
|
-
this.
|
|
163
|
+
this.getAppConfigToHideDiplayBtns();
|
|
155
164
|
|
|
156
165
|
// const currentUrl = this.router.url;
|
|
157
166
|
// this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
|
|
@@ -195,9 +204,24 @@ export class ConversationListPage implements OnInit {
|
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
207
|
+
getAppConfigToHideDiplayBtns() {
|
|
208
|
+
const appConfig = this.appConfigProvider.getConfig();
|
|
209
|
+
console.log('[ION-LIST-CONVS-COMP] - appConfig ', appConfig)
|
|
210
|
+
if (appConfig && appConfig.supportMode) {
|
|
211
|
+
this.supportMode = appConfig.supportMode;
|
|
212
|
+
} else {
|
|
213
|
+
this.supportMode = false;
|
|
214
|
+
}
|
|
215
|
+
if (appConfig && appConfig.archivedButton) {
|
|
216
|
+
this.archived_btn = appConfig.archivedButton;
|
|
217
|
+
} else {
|
|
218
|
+
this.archived_btn = false;
|
|
219
|
+
}
|
|
220
|
+
if (appConfig && appConfig.teammatesButton) {
|
|
221
|
+
this.teammates_btn = appConfig.teammatesButton;
|
|
222
|
+
} else {
|
|
223
|
+
this.teammates_btn = false;
|
|
224
|
+
}
|
|
201
225
|
// console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
|
|
202
226
|
}
|
|
203
227
|
|
|
@@ -354,7 +378,7 @@ export class ConversationListPage implements OnInit {
|
|
|
354
378
|
|
|
355
379
|
|
|
356
380
|
initArchivedConversationsHandler() {
|
|
357
|
-
const keysConversation = ['CLOSED'];
|
|
381
|
+
const keysConversation = ['CLOSED', 'Resolve'];
|
|
358
382
|
this.translationMapConversation = this.translateService.translateLanguage(keysConversation);
|
|
359
383
|
|
|
360
384
|
this.archivedConversationsHandlerService.subscribeToConversations(() => {
|
|
@@ -402,7 +426,6 @@ export class ConversationListPage implements OnInit {
|
|
|
402
426
|
}
|
|
403
427
|
|
|
404
428
|
listenGoOffline() {
|
|
405
|
-
|
|
406
429
|
this.events.subscribe('go:offline', (offline) => {
|
|
407
430
|
this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
|
|
408
431
|
// this.events.unsubscribe('profileInfoButtonClick:logout')
|
|
@@ -556,6 +579,8 @@ export class ConversationListPage implements OnInit {
|
|
|
556
579
|
|
|
557
580
|
// let storedArchivedConv = localStorage.getItem('activeConversationSelected');
|
|
558
581
|
const keys = ['LABEL_ARCHIVED'];
|
|
582
|
+
// const keys = ['History'];
|
|
583
|
+
|
|
559
584
|
this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0]);
|
|
560
585
|
|
|
561
586
|
} else if (event === 'displayContact') {
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
</div>
|
|
56
56
|
|
|
57
57
|
<ion-list *ngIf="loggedUser">
|
|
58
|
-
<ion-item lines="none" class="sidebar-items" (click)="onClickArchivedConversation()">
|
|
58
|
+
<!-- <ion-item lines="none" class="sidebar-items" (click)="onClickArchivedConversation()">
|
|
59
59
|
<div tabindex="0"></div>
|
|
60
60
|
<ion-icon name="archive-outline" class="sidebar-icons"></ion-icon>
|
|
61
61
|
<ion-label class="sidebar-labels">
|
|
62
62
|
<h3>{{ 'LABEL_ARCHIVED' | translate }}</h3>
|
|
63
63
|
</ion-label>
|
|
64
|
-
</ion-item>
|
|
64
|
+
</ion-item> -->
|
|
65
65
|
|
|
66
66
|
<ion-item lines="none" class="sidebar-items" (click)="onLogout()">
|
|
67
67
|
<div tabindex="0"></div>
|