@chat21/chat21-ionic 3.0.65-rc2 → 3.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/deploy_amazon_prod.sh +3 -3
  3. package/package.json +3 -3
  4. package/src/app/app.component.ts +65 -67
  5. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +0 -10
  6. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.html +49 -4
  7. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
  8. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +18 -30
  9. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -1
  10. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
  11. package/src/app/components/ddp-header/ddp-header.component.html +20 -5
  12. package/src/app/components/ddp-header/ddp-header.component.ts +8 -0
  13. package/src/app/components/project-item/project-item.component.ts +5 -0
  14. package/src/app/components/sidebar/sidebar.component.ts +41 -71
  15. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +12 -23
  16. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +3 -0
  17. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +88 -136
  18. package/src/app/directives/truncate.pipe.ts +0 -1
  19. package/src/app/pages/authentication/login/login.page.ts +0 -1
  20. package/src/app/pages/conversation-detail/conversation-detail.page.ts +47 -72
  21. package/src/app/pages/conversations-list/conversations-list.page.html +3 -1
  22. package/src/app/pages/conversations-list/conversations-list.page.ts +50 -5
  23. package/src/app/pages/loader-preview/loader-preview.page.ts +12 -43
  24. package/src/assets/i18n/ar.json +266 -0
  25. package/src/assets/i18n/uk.json +266 -0
  26. package/src/chat-config-pre.json +1 -0
  27. package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +1 -2
  28. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +2 -4
  29. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +29 -25
  30. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +2 -3
  31. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +4 -4
  32. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +66 -60
  33. package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +5 -5
  34. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -3
  35. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +2 -2
  36. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
  37. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +3 -6
  38. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +3 -3
  39. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +4 -4
  40. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +10 -5
  41. package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +5 -5
  42. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +3 -2
  43. package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +5 -0
  44. package/src/chat21-core/providers/native/native-upload-service.ts +2 -9
  45. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -1
  46. package/src/chat21-core/utils/constants.ts +1 -1
  47. package/src/global.scss +2 -2
  48. package/deploy_prod.sh +0 -14
@@ -83,21 +83,14 @@ export class SidebarComponent implements OnInit {
83
83
 
84
84
 
85
85
  getStoredProjectAndUserRole() {
86
- const stored_project = localStorage.getItem('last_project')
87
- this.logger.log('[SIDEBAR] stored_project ', stored_project)
88
- if (stored_project && stored_project !== 'undefined') {
89
- const project = JSON.parse(stored_project)
90
- this.logger.log('[SIDEBAR] project ', project)
91
-
92
- this.project_id = project.id_project.id
93
- this.logger.log('[SIDEBAR] project_id ', this.project_id)
94
-
95
- this.USER_ROLE = project.role;
96
- this.logger.log('[SIDEBAR] USER_ROLE ', this.USER_ROLE)
97
- this.buildURLs(this.USER_ROLE)
98
- } else {
99
- this.logger.error('[SIDEBAR] stored_project not found in storage', stored_project)
100
- }
86
+ this.events.subscribe('storage:last_project',project =>{
87
+ this.logger.log('[SIDEBAR] stored_project ', project)
88
+ if (project && project !== 'undefined') {
89
+ this.project_id = project.id_project.id
90
+ this.USER_ROLE = project.role;
91
+ this.buildURLs(this.USER_ROLE)
92
+ }
93
+ })
101
94
  }
102
95
 
103
96
  buildURLs(USER_ROLE) {
@@ -134,6 +127,7 @@ export class SidebarComponent implements OnInit {
134
127
  this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(this.currentUser.uid)
135
128
  this.logger.log('[SIDEBAR] photo_profile_URL ', this.photo_profile_URL)
136
129
  this.checkIfExistPhotoProfile(this.photo_profile_URL)
130
+ this.checkAndRemoveDashboardForegroundCount()
137
131
  }
138
132
  } else {
139
133
  this.logger.error('[SIDEBAR] BSAuthStateChanged current user not found in storage')
@@ -156,6 +150,18 @@ export class SidebarComponent implements OnInit {
156
150
  })
157
151
  }
158
152
 
153
+ checkAndRemoveDashboardForegroundCount(){
154
+ try {
155
+ const dashboardForegroundCount = localStorage.getItem('dshbrd----foregroundcount')
156
+ this.logger.log('[SIDEBAR] - THERE IS DASHBOARD FOREGROUND COUNT', dashboardForegroundCount)
157
+ if (dashboardForegroundCount && dashboardForegroundCount !== 'undefined') {
158
+ localStorage.setItem('dshbrd----foregroundcount', '0')
159
+ }
160
+ } catch (err) {
161
+ this.logger.error('Get local storage dshbrd----foregroundcount ', err)
162
+ }
163
+ }
164
+
159
165
  createUserAvatar(currentUser) {
160
166
  this.logger.log('[SIDEBAR] - createProjectUserAvatar ', currentUser)
161
167
  let fullname = ''
@@ -227,62 +233,26 @@ export class SidebarComponent implements OnInit {
227
233
 
228
234
 
229
235
  translateLabels() {
230
- this.getConversationsTranslation();
231
- this.getContactsTranslation();
232
- this.getActivitiesTranslation();
233
- this.getAppsTranslation();
234
- this.getAnalyticsTranslation();
235
- this.getHistoryTranslation();
236
- this.getSettingsTranslation()
237
- }
238
-
239
- getConversationsTranslation() {
240
- this.translate.get('Conversations')
241
- .subscribe((text: string) => {
242
- this.conversations_lbl = text
243
- });
244
- }
245
-
246
- getContactsTranslation() {
247
- this.translate.get('LABEL_CONTACTS')
248
- .subscribe((text: string) => {
249
- this.contacts_lbl = text
250
- });
251
- }
252
-
253
- getAppsTranslation() {
254
- this.translate.get('Apps')
255
- .subscribe((text: string) => {
256
- this.apps_lbl = text
257
- });
258
- }
259
-
260
- getAnalyticsTranslation() {
261
- this.translate.get('Analytics')
262
- .subscribe((text: string) => {
263
- this.analytics_lbl = text
264
- });
265
- }
266
-
267
- getActivitiesTranslation() {
268
- this.translate.get('Activities')
269
- .subscribe((text: string) => {
270
- this.activities_lbl = text
271
- });
272
- }
273
-
274
- getHistoryTranslation() {
275
- this.translate.get('History')
276
- .subscribe((text: string) => {
277
- this.history_lbl = text
278
- });
279
- }
280
-
281
- getSettingsTranslation() {
282
- this.translate.get('Settings')
283
- .subscribe((text: string) => {
284
- this.settings_lbl = text
285
- });
236
+ const keys= [
237
+ 'Conversations',
238
+ 'LABEL_CONTACTS',
239
+ 'Apps',
240
+ 'Analytics',
241
+ 'Activities',
242
+ 'History',
243
+ 'Settings'
244
+ ]
245
+
246
+ this.translate.get(keys).subscribe((text: string) => {
247
+ this.conversations_lbl = text['Conversations'];
248
+ this.contacts_lbl = text['LABEL_CONTACTS']
249
+ this.apps_lbl = text['Apps']
250
+ this.analytics_lbl = text['Analytics']
251
+ this.activities_lbl = text['Activities']
252
+ this.history_lbl = text['History']
253
+ this.settings_lbl = text['Settings']
254
+
255
+ });
286
256
  }
287
257
 
288
258
  getOSCODE() {
@@ -25,9 +25,9 @@
25
25
  onerror="this.src='assets/images/no_image_user.png'" />
26
26
 
27
27
  <div *ngIf="!USER_PHOTO_PROFILE_EXIST" class="user-img-in-sidebar-user-details"
28
- [ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + user?.fillColour + ')'}">
28
+ [ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + user?.color + ')'}">
29
29
  <span id="sidebaravatar-altenative-user-avatar" class="sidebar-user-details-altenative-user-avatar">
30
- {{ user?.fullname_initial }}
30
+ {{ user?.avatar }}
31
31
  </span>
32
32
  </div>
33
33
 
@@ -36,9 +36,7 @@
36
36
  <div class="user-details-user-isbusy" *ngIf="IS_BUSY === true" style="cursor:pointer"
37
37
  matTooltipClass="custom-mat-tooltip" matTooltip="{{IS_BUSY_msg}}" #tooltip="matTooltip"
38
38
  matTooltipPosition='right' matTooltipHideDelay="100">
39
- <span class="material-icons user-details-user-isbusy-icon">
40
- access_time
41
- </span>
39
+ <span class="material-icons user-details-user-isbusy-icon">access_time</span>
42
40
  </div>
43
41
 
44
42
 
@@ -78,22 +76,20 @@
78
76
  <hr class="first-divider">
79
77
 
80
78
  <section *ngIf="isVisiblePAY" class="user-details-plan-info">
81
- <span class="material-icons user-details-plan-icon">
82
- apps
83
- </span>
79
+ <span class="material-icons user-details-plan-icon">apps</span>
84
80
  <span>
85
- <div> {{prjct_name}} </div>
81
+ <div> {{project?.name}} </div>
86
82
  <div style="display: inline-block; margin-left: 26px;"> {{ profile_name_translated }} </div>
87
83
 
88
- <div *ngIf="plan_type === 'payment' && plan_subscription_is_active === false"
89
- style="color:#f44336; position:relative; top: -1px;;display: inline-block;">
90
- <i *ngIf="plan_name !== 'enterprise'" class="material-icons" style="vertical-align: middle; color:#f44336; cursor:pointer;
84
+ <div *ngIf="project?.type === 'payment' && project?.isActiveSubscription === false"
85
+ style="color:#f44336; position:relative; top: -1px;display: inline-block;">
86
+ <i *ngIf="project?.plan_name !== 'enterprise'" class="material-icons" style="vertical-align: middle; color:#f44336; cursor:pointer;
91
87
  font-size: 16px;" matTooltipClass="custom-mat-tooltip"
92
88
  matTooltip="{{ SUBSCRIPTION_PAYMENT_PROBLEM_msg }}" #tooltip="matTooltip" matTooltipPosition='right'
93
89
  matTooltipHideDelay="100">
94
90
  error_outline
95
91
  </i>
96
- <i *ngIf="plan_name === 'enterprise'" class="material-icons" style="vertical-align: middle; color:#f44336; cursor:pointer;
92
+ <i *ngIf="project?.plan_name === 'enterprise'" class="material-icons" style="vertical-align: middle; color:#f44336; cursor:pointer;
97
93
  font-size: 16px;" matTooltipClass="custom-mat-tooltip" matTooltip="{{ THE_PLAN_HAS_EXPIRED_msg }}"
98
94
  #tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100">
99
95
  error_outline
@@ -103,12 +99,8 @@
103
99
  </section>
104
100
 
105
101
  <section class="user-details-help-center">
106
- <span class="material-icons user-details-help-center-icon">
107
- support
108
- </span>
109
- <span class="user-details-help-center" (click)="goToHelpCenter()">
110
- Help center
111
- </span>
102
+ <span class="material-icons user-details-help-center-icon">support</span>
103
+ <span class="user-details-help-center" (click)="goToHelpCenter()"> Help center</span>
112
104
  </section>
113
105
 
114
106
  <!-- <hr class="second-divider" style="margin-top: 20px;border: 0;
@@ -128,10 +120,7 @@
128
120
  </section>
129
121
 
130
122
  <section class="user-details-footer-chat-version">
131
- <div class="chat-version">
132
- <!-- &copy; {{test | date: 'yyyy'}} {{company_name}} ver {{version}} -->
133
- ver {{version}}
134
- </div>
123
+ <div class="chat-version"> ver {{version}}</div>
135
124
  </section>
136
125
 
137
126
  </div>
@@ -280,6 +280,9 @@ button.user-details-btn-close {
280
280
  font-size: 20px;
281
281
  vertical-align: middle;
282
282
  margin-right: 3px;
283
+ svg{
284
+ fill: #a9afbb
285
+ }
283
286
  }
284
287
 
285
288
  .user-details-help-center {
@@ -46,19 +46,14 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
46
46
  profile_name_translated: string;
47
47
  SubscriptionPaymentProblem: string;
48
48
  user: any
49
- projectID: any
50
49
  tiledeskToken: string;
51
- prjct_name: string;
52
- plan_type: string;
50
+ project: { _id: string, name: string, type: string, isActiveSubscription: boolean, plan_name: string}
53
51
  _prjct_profile_name: string;
54
52
 
55
53
  isVisiblePAY: boolean;
56
54
  public_Key: any
57
- plan_name: string;
58
- plan_subscription_is_active: boolean;
59
55
  USER_PHOTO_PROFILE_EXIST: boolean;
60
56
  version: string
61
- test: Date = new Date();
62
57
  company_name: string = 'Tiledesk'
63
58
  DASHBOARD_URL: string;
64
59
  constructor(
@@ -77,10 +72,9 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
77
72
  ngOnInit() {
78
73
  this.DASHBOARD_URL = this.appConfigProvider.getConfig().dashboardUrl + '#/project/';
79
74
  this.version = PACKAGE.version;
80
- this.getCurrentChatLangAndTranslateLabels();
81
75
  this.subcribeToAuthStateChanged();
82
76
  this.listenTocurrentProjectUserUserAvailability$();
83
- this.getCurrentStoredProject();
77
+ this.listenToCurrentStoredProject();
84
78
  this.getOSCODE();
85
79
  // this.listenOpenUserSidebarEvent();
86
80
  }
@@ -90,15 +84,14 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
90
84
  this.logger.log('[SIDEBAR-USER-DETAILS] BSAuthStateChanged ', state)
91
85
 
92
86
  if (state === 'online') {
93
-
94
87
  const storedCurrentUser = this.appStorageService.getItem('currentUser')
95
88
  if (storedCurrentUser && storedCurrentUser !== 'undefined') {
96
89
  const currentUser = JSON.parse(storedCurrentUser);
97
90
  this.logger.log('[SIDEBAR-USER-DETAILS] - subcribeToAuthStateChanged - currentUser ', currentUser)
98
91
  if (currentUser) {
99
92
  this.user = currentUser;
100
- this.createUserAvatar(this.user)
101
- this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(currentUser.uid)
93
+ this.getCurrentChatLangAndTranslateLabels(this.user);
94
+ this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(this.user.uid)
102
95
  this.logger.log('[SIDEBAR-USER-DETAILS] photo_profile_URL ', this.photo_profile_URL);
103
96
  this.checkIfExistPhotoProfile(this.photo_profile_URL)
104
97
  }
@@ -124,23 +117,6 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
124
117
  }
125
118
 
126
119
 
127
- createUserAvatar(currentUser) {
128
- this.logger.log('[SIDEBAR-USER-DETAILS] - createProjectUserAvatar ', currentUser)
129
- let fullname = ''
130
- if (currentUser && currentUser.firstname && currentUser.lastname) {
131
- fullname = currentUser.firstname + ' ' + currentUser.lastname
132
- currentUser['fullname_initial'] = avatarPlaceholder(fullname)
133
- currentUser['fillColour'] = getColorBck(fullname)
134
- } else if (currentUser && currentUser.firstname) {
135
- fullname = currentUser.firstname
136
- currentUser['fullname_initial'] = avatarPlaceholder(fullname)
137
- currentUser['fillColour'] = getColorBck(fullname)
138
- } else {
139
- currentUser['fullname_initial'] = 'N/A'
140
- currentUser['fillColour'] = 'rgb(98, 100, 167)'
141
- }
142
- }
143
-
144
120
  verifyImageURL(image_url, callBack) {
145
121
  const img = new Image();
146
122
  img.src = image_url;
@@ -184,64 +160,64 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
184
160
  }
185
161
 
186
162
 
187
- getCurrentChatLangAndTranslateLabels() {
163
+ getCurrentChatLangAndTranslateLabels(currentUser) {
188
164
  this.browserLang = this.translate.getBrowserLang();
189
- const storedCurrentUser = this.appStorageService.getItem('currentUser')
190
-
191
- if (storedCurrentUser && storedCurrentUser !== 'undefined') {
192
- const currentUser = JSON.parse(storedCurrentUser);
193
- this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser ', currentUser)
194
- this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - browserLang ', this.browserLang)
195
- let currentUserId = ''
196
- if (currentUser) {
197
- currentUserId = currentUser.uid
198
- this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUserId ', currentUserId)
199
- }
165
+ this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser ', currentUser)
166
+ this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - browserLang ', this.browserLang)
200
167
 
201
- const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
202
- this.logger.log('[SIDEBAR-USER-DETAILS] stored_preferred_lang: ', stored_preferred_lang);
168
+ const stored_preferred_lang = localStorage.getItem(currentUser.uid + '_lang');
169
+ this.logger.log('[SIDEBAR-USER-DETAILS] stored_preferred_lang: ', stored_preferred_lang);
203
170
 
204
171
 
205
- this.chat_lang = ''
206
- if (this.browserLang && !stored_preferred_lang) {
207
- this.chat_lang = this.browserLang
208
- // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
209
-
210
- this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
211
- this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
212
- } else if (this.browserLang && stored_preferred_lang) {
213
- this.chat_lang = stored_preferred_lang
214
- // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
215
- this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
216
- this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
217
- }
172
+ this.chat_lang = ''
173
+ if (this.browserLang && !stored_preferred_lang) {
174
+ this.chat_lang = this.browserLang
175
+ // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
218
176
 
177
+ this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
178
+ this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
179
+ } else if (this.browserLang && stored_preferred_lang) {
180
+ this.chat_lang = stored_preferred_lang
181
+ // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
182
+ this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
183
+ this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
184
+ }
219
185
 
220
- if (tranlatedLanguage.includes(this.chat_lang)) {
221
- this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
222
- this.translate.use(this.chat_lang);
223
- this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
224
- } else {
225
- this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
226
- this.translate.use('en');
227
- this.flag_url = "assets/images/language_flag/en.png"
228
- this.chat_lang = 'en'
229
- }
230
-
186
+ if (tranlatedLanguage.includes(this.chat_lang)) {
187
+ this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
188
+ this.translate.use(this.chat_lang);
189
+ this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
231
190
  } else {
232
- this.logger.error('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser not found in storage')
191
+ this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
192
+ this.translate.use('en');
193
+ this.flag_url = "assets/images/language_flag/en.png"
194
+ this.chat_lang = 'en'
233
195
  }
196
+
234
197
  this.translateLabels()
235
198
  }
236
199
 
237
200
  translateLabels() {
238
- this.getEditProfileTranslation();
239
- this.getAvailableTranslation();
240
- this.getUnavailableTranslation();
241
- this.getIsBusyTranslation();
242
- this.getSubscriptionPaymentProblemTranslation();
243
- this.getThePlanHasExpiredTranslation();
244
- this.getLogoutTranslation();
201
+ let keys= [
202
+ 'EditProfile',
203
+ 'Available',
204
+ 'Unavailable',
205
+ 'Busy',
206
+ 'LABEL_LOGOUT',
207
+ 'SubscriptionPaymentProblem',
208
+ 'ThePlanHasExpired'
209
+ ]
210
+
211
+ this.translate.get(keys).subscribe((text: string) => {
212
+ this.EditProfileLabel = text['EditProfile'];
213
+ this.IS_AVAILABLE_msg = text['Available']
214
+ this.IS_UNAVAILABLE_msg = text['Unavailable']
215
+ this.IS_BUSY_msg = text['Busy']
216
+ this.LOGOUT_msg = text['LABEL_LOGOUT']
217
+ this.SUBSCRIPTION_PAYMENT_PROBLEM_msg = text['SubscriptionPaymentProblem']
218
+ this.THE_PLAN_HAS_EXPIRED_msg = text['ThePlanHasExpired']
219
+
220
+ });
245
221
  }
246
222
 
247
223
 
@@ -275,92 +251,77 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
275
251
  }
276
252
 
277
253
  getEditProfileTranslation() {
278
- this.translate.get('EditProfile')
279
- .subscribe((text: string) => {
254
+ this.translate.get('EditProfile').subscribe((text: string) => {
280
255
  this.EditProfileLabel = text
281
256
  });
282
257
  }
283
258
 
284
-
285
-
286
259
  getAvailableTranslation() {
287
- this.translate.get('Available')
288
- .subscribe((text: string) => {
260
+ this.translate.get('Available').subscribe((text: string) => {
289
261
  this.IS_AVAILABLE_msg = text
290
- });
262
+ });
291
263
  }
292
264
  getUnavailableTranslation() {
293
- this.translate.get('Unavailable')
294
- .subscribe((text: string) => {
265
+ this.translate.get('Unavailable').subscribe((text: string) => {
295
266
  this.IS_UNAVAILABLE_msg = text
296
- });
267
+ });
297
268
  }
298
269
 
299
270
  getIsBusyTranslation() {
300
- this.translate.get('Busy')
301
- .subscribe((text: string) => {
271
+ this.translate.get('Busy').subscribe((text: string) => {
302
272
  this.IS_BUSY_msg = text
303
- });
273
+ });
304
274
  }
305
275
 
306
276
  getLogoutTranslation() {
307
- this.translate.get('LABEL_LOGOUT')
308
- .subscribe((text: string) => {
277
+ this.translate.get('LABEL_LOGOUT').subscribe((text: string) => {
309
278
  this.LOGOUT_msg = text
310
- });
279
+ });
311
280
  }
312
281
 
313
282
  getSubscriptionPaymentProblemTranslation() {
314
- this.translate.get('SubscriptionPaymentProblem')
315
- .subscribe((text: string) => {
283
+ this.translate.get('SubscriptionPaymentProblem').subscribe((text: string) => {
316
284
  this.SUBSCRIPTION_PAYMENT_PROBLEM_msg = text
317
- });
285
+ });
318
286
  }
319
287
 
320
288
  getThePlanHasExpiredTranslation() {
321
- this.translate.get('ThePlanHasExpired')
322
- .subscribe((text: string) => {
289
+ this.translate.get('ThePlanHasExpired').subscribe((text: string) => {
323
290
  this.THE_PLAN_HAS_EXPIRED_msg = text
324
- });
291
+ });
325
292
  }
326
293
 
327
294
 
328
- getCurrentStoredProject() {
329
- try {
330
- const project = localStorage.getItem('last_project')
331
- if (project && project !== 'undefined') {
332
- const projectObjct = JSON.parse(localStorage.getItem('last_project'))
295
+ listenToCurrentStoredProject() {
296
+ this.events.subscribe('storage:last_project', projectObjct => {
297
+ if (projectObjct && projectObjct !== 'undefined') {
333
298
  // console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
334
299
 
335
- this.projectID = projectObjct['id_project']['_id']
336
-
337
- this.prjct_name = projectObjct['id_project']['name']
300
+ this.project = {
301
+ _id: projectObjct['id_project']['_id'],
302
+ name: projectObjct['id_project']['name'],
303
+ type: projectObjct['id_project']['profile']['type'],
304
+ isActiveSubscription: projectObjct['id_project']['isActiveSubscription'],
305
+ plan_name: projectObjct['id_project']['profile']['name']
306
+ }
338
307
 
339
- this.plan_type = projectObjct['id_project']['profile']['type'];
340
-
341
- const trial_expired = projectObjct['id_project']['trialExpired']
342
-
308
+ const trial_expired = projectObjct['id_project']['trialExpired']
343
309
  const profile_name = projectObjct['id_project']['profile']['name'];
344
-
345
- this.plan_name = projectObjct['id_project']['profile']['name'];
346
- this.plan_subscription_is_active = projectObjct['id_project']['isActiveSubscription'];
347
-
348
- if (this.plan_type === 'free') {
310
+
311
+ if (this.project.type === 'free') {
349
312
 
350
313
  if (trial_expired === false) {
351
314
  this.getProPlanTrialTranslation();
352
315
  } else if (trial_expired === true) {
353
316
  this.getFreePlanTranslation();
354
317
  }
355
- } else if (this.plan_type === 'payment' && profile_name === 'pro') {
318
+ } else if (this.project.type === 'payment' && profile_name === 'pro') {
356
319
  this.getProPlanTranslation();
357
- } else if (this.plan_type === 'payment' && profile_name === 'enterprise') {
320
+ } else if (this.project.type === 'payment' && profile_name === 'enterprise') {
358
321
  this.getEnterprisePlanTranslation();
359
322
  }
360
323
  }
361
- } catch (err) {
362
- this.logger.error('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ERR ', err)
363
- }
324
+ })
364
325
 
365
326
  try {
366
327
  this.tiledeskToken = this.appStorageService.getItem('tiledeskToken');
@@ -372,37 +333,31 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
372
333
 
373
334
 
374
335
  getProPlanTrialTranslation() {
375
- this.translate.get('ProPlanTrial')
376
- .subscribe((text: string) => {
336
+ this.translate.get('ProPlanTrial').subscribe((text: string) => {
377
337
  this.profile_name_translated = text
378
338
  });
379
339
  }
380
340
 
381
341
  getFreePlanTranslation() {
382
- this.translate.get('FreePlan')
383
- .subscribe((text: string) => {
342
+ this.translate.get('FreePlan').subscribe((text: string) => {
384
343
  this.profile_name_translated = text
385
344
  });
386
345
  }
387
346
 
388
347
  getProPlanTranslation() {
389
- this.translate.get('PaydPlanNamePro')
390
- .subscribe((text: string) => {
348
+ this.translate.get('PaydPlanNamePro').subscribe((text: string) => {
391
349
  this.profile_name_translated = text
392
350
  });
393
351
  }
394
352
 
395
353
  getEnterprisePlanTranslation() {
396
- this.translate.get('PaydPlanNameEnterprise')
397
- .subscribe((text: string) => {
354
+ this.translate.get('PaydPlanNameEnterprise').subscribe((text: string) => {
398
355
  this.profile_name_translated = text
399
356
  });
400
357
  }
401
358
 
402
359
  listenTocurrentProjectUserUserAvailability$() {
403
- this.wsService.currentProjectUserAvailability$
404
- .pipe(skip(1))
405
- .subscribe((projectUser) => {
360
+ this.wsService.currentProjectUserAvailability$.pipe(skip(1)).subscribe((projectUser) => {
406
361
  this.logger.log('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS RES ', projectUser);
407
362
 
408
363
  if (projectUser) {
@@ -412,8 +367,6 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
412
367
  this.translateUserRole(this.USER_ROLE)
413
368
  }
414
369
 
415
-
416
-
417
370
  }, (error) => {
418
371
  this.logger.error('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS error ', error);
419
372
  }, () => {
@@ -422,8 +375,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
422
375
  }
423
376
 
424
377
  translateUserRole(role) {
425
- this.translate.get(role)
426
- .subscribe((text: string) => {
378
+ this.translate.get(role).subscribe((text: string) => {
427
379
  this.USER_ROLE_LABEL = text
428
380
  });
429
381
  }
@@ -436,9 +388,9 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
436
388
 
437
389
 
438
390
  changeAvailabilityStateInUserDetailsSidebar(available) {
439
- this.logger.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.projectID, ' available 1: ', available);
391
+ this.logger.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.project._id, ' available 1: ', available);
440
392
 
441
- this.wsService.updateCurrentUserAvailability(this.tiledeskToken, this.projectID, available)
393
+ this.wsService.updateCurrentUserAvailability(this.tiledeskToken, this.project._id, available)
442
394
  .subscribe((projectUser: any) => {
443
395
 
444
396
  this.logger.log('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED ', projectUser)
@@ -453,7 +405,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
453
405
  }
454
406
 
455
407
  goToUserProfile() {
456
- let url = this.DASHBOARD_URL + this.projectID + '/user-profile'
408
+ let url = this.DASHBOARD_URL + this.project._id + '/user-profile'
457
409
  const myWindow = window.open(url, '_self');
458
410
  myWindow.focus();
459
411
  }
@@ -6,7 +6,6 @@ import { Pipe, PipeTransform } from '@angular/core';
6
6
  export class TruncatePipe implements PipeTransform {
7
7
 
8
8
  transform(value: string, character: number): any {
9
- console.log('stringggg', value, character)
10
9
  if(value && value.length > character)
11
10
  return value.substring(0, character) + ' ...'
12
11
  else
@@ -110,7 +110,6 @@ export class LoginPage implements OnInit {
110
110
  'Email must be a valid email',
111
111
  'Password is required',
112
112
  'Password must be at least 6 characters long'
113
-
114
113
  ];
115
114
  this.translationMap = this.translateService.translateLanguage(keys);
116
115
  }