@chat21/chat21-ionic 3.0.59-rc4 → 3.0.59

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 (63) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +5 -0
  3. package/config.xml +2 -2
  4. package/env.sample +3 -1
  5. package/package.json +1 -1
  6. package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
  7. package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
  8. package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
  9. package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
  10. package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
  11. package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  12. package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
  13. package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
  14. package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
  15. package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
  16. package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
  17. package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  18. package/resources/Android/splash.png +0 -0
  19. package/src/app/app.component.scss +10 -5
  20. package/src/app/app.component.ts +393 -234
  21. package/src/app/app.module.ts +12 -7
  22. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  23. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +7 -6
  24. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +2 -1
  25. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  26. package/src/app/components/authentication/login/login.component.html +8 -8
  27. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -4
  28. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +7 -2
  29. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  30. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  31. package/src/app/components/project-item/project-item.component.html +61 -16
  32. package/src/app/components/project-item/project-item.component.scss +165 -38
  33. package/src/app/components/project-item/project-item.component.ts +58 -36
  34. package/src/app/pages/authentication/login/login.page.html +1 -2
  35. package/src/app/pages/conversation-detail/conversation-detail.page.ts +2 -0
  36. package/src/app/pages/conversations-list/conversations-list.page.html +12 -7
  37. package/src/app/pages/conversations-list/conversations-list.page.scss +279 -261
  38. package/src/app/pages/conversations-list/conversations-list.page.ts +149 -17
  39. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +10 -2
  40. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  41. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +47 -36
  42. package/src/app/services/app-config.ts +77 -5
  43. package/src/app/services/websocket/websocket-js.ts +12 -14
  44. package/src/app/services/websocket/websocket.service.ts +26 -8
  45. package/src/assets/i18n/en.json +2 -1
  46. package/src/assets/i18n/it.json +2 -1
  47. package/src/assets/js/chat21client.js +144 -82
  48. package/src/assets/logo.png +0 -0
  49. package/src/assets/transparent.png +0 -0
  50. package/src/chat-config-pre-test.json +3 -1
  51. package/src/chat-config-template.json +4 -1
  52. package/src/chat-config.json +4 -1
  53. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +1 -1
  54. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -1
  55. package/src/chat21-core/providers/firebase/firebase-notifications.ts +31 -23
  56. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +27 -27
  57. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -5
  58. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
  59. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
  60. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +12 -3
  61. package/src/chat21-core/utils/utils-message.ts +2 -2
  62. package/src/firebase-messaging-sw-template.js +1 -1
  63. package/src/assets/images/tiledesk_logo_50x50.png +0 -0
@@ -35,7 +35,8 @@ import { Platform } from '@ionic/angular';
35
35
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
36
36
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
37
37
  import { NetworkService } from 'src/app/services/network-service/network.service';
38
-
38
+ import { Subject } from 'rxjs';
39
+ import { takeUntil } from 'rxjs/operators'
39
40
 
40
41
  @Component({
41
42
  selector: 'app-conversations-list',
@@ -43,7 +44,10 @@ import { NetworkService } from 'src/app/services/network-service/network.service
43
44
  styleUrls: ['./conversations-list.page.scss'],
44
45
  })
45
46
  export class ConversationListPage implements OnInit {
47
+
46
48
  @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
49
+
50
+ private unsubscribe$: Subject<any> = new Subject<any>();
47
51
  private subscriptions: Array<string>;
48
52
  public tenant: string;
49
53
  public loggedUserUid: string;
@@ -55,7 +59,7 @@ export class ConversationListPage implements OnInit {
55
59
  public showPlaceholder = true;
56
60
  public numberOpenConv = 0;
57
61
  public loadingIsActive = true;
58
- public supportMode = environment.supportMode;
62
+ public supportMode: boolean;
59
63
 
60
64
  public convertMessage = convertMessage;
61
65
  private isShowMenuPage = false;
@@ -72,6 +76,11 @@ export class ConversationListPage implements OnInit {
72
76
  public lastProjectId: string;
73
77
  public isOnline: boolean = true;
74
78
  public checkInternet: boolean;
79
+
80
+ public displayNewConvsItem: boolean = true
81
+
82
+
83
+
75
84
  constructor(
76
85
  private router: Router,
77
86
  private route: ActivatedRoute,
@@ -90,22 +99,107 @@ export class ConversationListPage implements OnInit {
90
99
  public appConfigProvider: AppConfigProvider,
91
100
  public platform: Platform,
92
101
  private networkService: NetworkService,
102
+
93
103
  ) {
94
104
  this.listenToAppCompConvsLengthOnInitConvs();
95
105
  this.listenToLogoutEvent();
106
+ this.listenGoOnline();
107
+ this.listenGoOffline();
96
108
  this.listenToSwPostMessage();
109
+ this.listenSupportConvIdHasChanged();
110
+ // this.listenDirectConvIdHasChanged();
111
+ }
97
112
 
113
+ listenSupportConvIdHasChanged() {
114
+ this.events.subscribe('supportconvid:haschanged', (IDConv) => {
115
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', IDConv);
116
+ if (IDConv) {
117
+ // const conversationSelected = this.conversations.find(item => item.uid === convId);
118
+ // this.onConversationSelected(conversationSelected)
119
+ this.setUidConvSelected(IDConv, 'active');
120
+ }
121
+ if (!IDConv) {
122
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select');
123
+
124
+ const chatTabCount = +localStorage.getItem('tabCount')
125
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ', chatTabCount);
126
+ if (chatTabCount && chatTabCount > 0) {
127
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ', chatTabCount);
128
+ if (checkPlatformIsMobile()) {
129
+ this.logger.log('[CONVS-LIST-PAGE] - the chat is in mobile mode ', checkPlatformIsMobile());
130
+ this.events.publish('noparams:mobile', true);
131
+ }
132
+ }
133
+ }
134
+ });
98
135
  }
99
136
 
137
+ // listenDirectConvIdHasChanged() {
138
+ // this.events.subscribe('directconvid:haschanged', (contact_id) => {
139
+ // // console.log('[CONVS-LIST-PAGE] - listen To directconvid:haschanged - contact_id', contact_id);
140
+ // if (contact_id) {
141
+ // this.uidConvSelected = contact_id
142
+ // }
143
+ // });
144
+ // }
145
+
100
146
 
101
147
  // -----------------------------------------------
102
148
  // @ Lifehooks
103
149
  // -----------------------------------------------
104
- ngOnInit() {
105
- this.watchToConnectionStatus()
150
+ ngOnInit() {
151
+ this.watchToConnectionStatus();
152
+ this.getSupportMode();
153
+
154
+ // const currentUrl = this.router.url;
155
+ // this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
156
+ // this.route.queryParams.subscribe(params => {
157
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
158
+ // if (params && params.convId) {
159
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convId:', params.convId);
160
+
161
+ // const conversationSelected = this.conversations.find(item => item.uid === params.convId);
162
+ // if (conversationSelected) {
163
+ // this.conversationSelected = conversationSelected;
164
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
165
+ // setTimeout(() => {
166
+ // // this.navigateByUrl('active', params.convId)
167
+ // }, 0);
168
+ // }
169
+
170
+ // } else {
171
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params No convId Params ');
172
+ // }
173
+ // if (params && params.contact_id && params.contact_fullname) {
174
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
175
+ // setTimeout(() => {
176
+ // this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
177
+ // }, 0);
178
+ // this.uidConvSelected = params.contact_id
179
+ // } else {
180
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No contact_id and contact_fullname Params ');
181
+ // }
182
+
183
+ // if (params && params.conversation_detail) {
184
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
185
+ // setTimeout(() => {
186
+ // this.router.navigateByUrl('conversation-detail/');
187
+ // }, 0);
188
+ // } else {
189
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No conversation_detail Params ');
190
+ // }
191
+
192
+ // });
193
+ }
194
+
195
+
196
+
197
+ getSupportMode() {
198
+ this.supportMode = this.appConfigProvider.getConfig().supportMode;
199
+ // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
106
200
  }
107
201
 
108
- watchToConnectionStatus() {
202
+ watchToConnectionStatus() {
109
203
  this.networkService.checkInternetFunc().subscribe(isOnline => {
110
204
  this.checkInternet = isOnline
111
205
  this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
@@ -158,7 +252,7 @@ watchToConnectionStatus() {
158
252
  // Opens the Unassigned Conversations iframe
159
253
  // ---------------------------------------------------------
160
254
  openUnassignedConversations(UNASSIGNED_CONVS_URL) {
161
-
255
+
162
256
  if (checkPlatformIsMobile()) {
163
257
  presentModal(this.modalController, UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
164
258
  } else {
@@ -211,12 +305,20 @@ watchToConnectionStatus() {
211
305
 
212
306
  private listnerStart() {
213
307
  const that = this;
214
- this.chatManager.BSStart.subscribe((data: any) => {
215
- this.logger.log('[CONVS-LIST-PAGE] ***** BSStart Current user *****', data);
216
- if (data) {
217
- that.initialize();
218
- }
219
- });
308
+ this.chatManager.BSStart
309
+ .pipe(
310
+ takeUntil(that.unsubscribe$)
311
+ )
312
+ .subscribe((data: any) => {
313
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
314
+ if (data) {
315
+ that.initialize();
316
+ }
317
+ }, error => {
318
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
319
+ }, () => {
320
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
321
+ });
220
322
  }
221
323
 
222
324
 
@@ -252,7 +354,6 @@ watchToConnectionStatus() {
252
354
  if (!this.archivedConversations || this.archivedConversations.length === 0) {
253
355
  this.loadingIsActive = false;
254
356
  }
255
-
256
357
  }
257
358
 
258
359
 
@@ -272,9 +373,32 @@ watchToConnectionStatus() {
272
373
  });
273
374
  }
274
375
 
376
+ listenGoOnline() {
377
+ this.events.subscribe('go:online', (goonline) => {
378
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
379
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
380
+ if (goonline === true) {
381
+ this.displayNewConvsItem = true
382
+ }
383
+ });
384
+ }
385
+
386
+ listenGoOffline() {
387
+
388
+ this.events.subscribe('go:offline', (offline) => {
389
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
390
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
391
+ if (offline === true) {
392
+ this.displayNewConvsItem = false
393
+ }
394
+ });
395
+ }
396
+
275
397
  listenToLogoutEvent() {
276
398
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
277
399
  this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
400
+
401
+
278
402
  this.conversations = []
279
403
  this.conversationsHandlerService.conversations = [];
280
404
  this.uidConvSelected = null;
@@ -385,6 +509,9 @@ watchToConnectionStatus() {
385
509
  * evento richiamato quando si seleziona un utente nell'elenco degli user
386
510
  * apro dettaglio conversazione
387
511
  */
512
+ // --------------------------------
513
+ // !!!!!! IS USED? ?????
514
+ // ------------------------------
388
515
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
389
516
  this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
390
517
  this.uidConvSelected = user.uid;
@@ -475,6 +602,7 @@ watchToConnectionStatus() {
475
602
  this.initConversationsHandler();
476
603
  this.initVariables();
477
604
  this.initSubscriptions();
605
+
478
606
  // this.initHandlerEventEmitter();
479
607
  }
480
608
 
@@ -519,6 +647,7 @@ watchToConnectionStatus() {
519
647
  setUidConvSelected(uidConvSelected: string, conversationType?: string,) {
520
648
  this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
521
649
  this.uidConvSelected = uidConvSelected;
650
+ this.logger.log('uidConvSelected', uidConvSelected)
522
651
  // this.conversationsHandlerService.uidConvSelected = uidConvSelected;
523
652
  if (uidConvSelected) {
524
653
  let conversationSelected;
@@ -529,7 +658,7 @@ watchToConnectionStatus() {
529
658
  }
530
659
  if (conversationSelected) {
531
660
  this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
532
- this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' has already been loaded');
661
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
533
662
  this.conversationSelected = conversationSelected;
534
663
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
535
664
  }
@@ -537,7 +666,7 @@ watchToConnectionStatus() {
537
666
  }
538
667
 
539
668
  onConversationSelected(conversation: ConversationModel) {
540
- //console.log('returnSelectedConversation::', conversation)
669
+ this.logger.log('onConversationSelected conversation', conversation)
541
670
  if (conversation.archived) {
542
671
  this.navigateByUrl('archived', conversation.uid)
543
672
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
@@ -634,6 +763,7 @@ watchToConnectionStatus() {
634
763
 
635
764
 
636
765
  navigateByUrl(converationType: string, uidConvSelected: string) {
766
+ this.logger.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
637
767
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
638
768
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
639
769
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
@@ -641,12 +771,14 @@ watchToConnectionStatus() {
641
771
 
642
772
  this.setUidConvSelected(uidConvSelected, converationType);
643
773
  if (checkPlatformIsMobile()) {
644
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_MOBILE 1', this.navService);
774
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
775
+ this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
645
776
  let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
646
777
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
647
778
  this.router.navigateByUrl(pageUrl);
648
779
  } else {
649
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_DESKTOP 2', this.navService);
780
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
781
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
650
782
  let pageUrl = 'conversation-detail/' + this.uidConvSelected;
651
783
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
652
784
  pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
@@ -1,6 +1,6 @@
1
1
  <ion-header>
2
2
  <ion-toolbar>
3
- <ion-title>{{translationMap.get('UnassignedConversations') }}</ion-title>
3
+ <ion-title>{{translationMap?.get('NewConversations') }}</ion-title>
4
4
  <ion-buttons slot="end">
5
5
  <ion-button ion-button fill="clear" (click)="onClose()">
6
6
  <ion-icon slot="icon-only" name="close"></ion-icon>
@@ -9,6 +9,14 @@
9
9
  </ion-toolbar>
10
10
  </ion-header>
11
11
 
12
- <ion-content overflow-scroll="true" id="iframe-ion-content">
12
+ <ion-content overflow-scroll="true" id="iframe-ion-content"
13
+ [ngClass]="{'ion-content-black-background' : isProjectsForPanel === true}">
13
14
  <!-- <iframe id="i_frame" style="width:100%; height:99%" frameBorder="0" allowfullscreen [src]="unassigned_convs_url_sanitized"></iframe> -->
15
+ <!-- <div class="stretchspinner-unassigned-convs">
16
+ <div class="rect1"></div>
17
+ <div class="rect2"></div>
18
+ <div class="rect3"></div>
19
+ <div class="rect4"></div>
20
+ <div class="rect5"></div>
21
+ </div> -->
14
22
  </ion-content>
@@ -0,0 +1,79 @@
1
+ .ion-content-black-background {
2
+ --background: #2d323e
3
+ }
4
+
5
+ // -------------------------------------------------
6
+ // stretch spinner https://tobiasahlin.com/spinkit/
7
+ // -------------------------------------------------
8
+ .stretchspinner-unassigned-convs {
9
+ margin: 100px auto;
10
+ width: 50px;
11
+ height: 40px;
12
+ text-align: center;
13
+ font-size: 10px;
14
+ position: absolute;
15
+ margin: auto;
16
+ top: 0;
17
+ left: 0;
18
+ bottom: 0;
19
+ right: 0;
20
+ }
21
+
22
+ .stretchspinner-unassigned-convs > div {
23
+ background-color: #3ea9f5;
24
+ height: 100%;
25
+ width: 6px;
26
+ display: inline-block;
27
+
28
+ -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
29
+ animation: sk-stretchdelay 1.2s infinite ease-in-out;
30
+ }
31
+
32
+ .stretchspinner-unassigned-convs .rect2 {
33
+ -webkit-animation-delay: -1.1s;
34
+ animation-delay: -1.1s;
35
+ }
36
+
37
+ .stretchspinner-unassigned-convs .rect3 {
38
+ -webkit-animation-delay: -1s;
39
+ animation-delay: -1s;
40
+ }
41
+
42
+ .stretchspinner-unassigned-convs .rect4 {
43
+ -webkit-animation-delay: -0.9s;
44
+ animation-delay: -0.9s;
45
+ }
46
+
47
+ .stretchspinner-unassigned-convs .rect5 {
48
+ -webkit-animation-delay: -0.8s;
49
+ animation-delay: -0.8s;
50
+ }
51
+
52
+ @-webkit-keyframes sk-stretchdelay {
53
+ 0%,
54
+ 40%,
55
+ 100% {
56
+ -webkit-transform: scaleY(0.4);
57
+ }
58
+ 20% {
59
+ -webkit-transform: scaleY(1);
60
+ }
61
+ }
62
+
63
+ @keyframes sk-stretchdelay {
64
+ 0%,
65
+ 40%,
66
+ 100% {
67
+ transform: scaleY(0.4);
68
+ -webkit-transform: scaleY(0.4);
69
+ }
70
+ 20% {
71
+ transform: scaleY(1);
72
+ -webkit-transform: scaleY(1);
73
+ }
74
+ }
75
+
76
+
77
+ .hide-stretchspinner {
78
+ display: none;
79
+ }
@@ -17,9 +17,12 @@ export class UnassignedConversationsPage implements OnInit {
17
17
  @Input() unassigned_convs_url: any;
18
18
  unassigned_convs_url_sanitized: any;
19
19
  private logger: LoggerService = LoggerInstance.getInstance();
20
- has_loaded: boolean;
20
+ // has_loaded: boolean;
21
21
  ion_content: any;
22
22
  iframe: any;
23
+
24
+ isProjectsForPanel: boolean = false
25
+
23
26
  public translationMap: Map<string, string>;
24
27
  constructor(
25
28
  private modalController: ModalController,
@@ -29,62 +32,70 @@ export class UnassignedConversationsPage implements OnInit {
29
32
  ) { }
30
33
 
31
34
  ngOnInit() {
32
- const keys = ['UnassignedConversations'];
35
+ const keys = ['UnassignedConversations', 'NewConversations'];
33
36
  this.translationMap = this.translateService.translateLanguage(keys);
37
+ this.buildIFRAME();
38
+ this.listenToPostMsg();
39
+ this.hideHotjarFeedbackBtn();
40
+ }
41
+
42
+ hideHotjarFeedbackBtn() {
43
+ const hotjarFeedbackBtn = <HTMLElement>document.querySelector("#_hj_feedback_container > div > button")
44
+ if (hotjarFeedbackBtn) {
45
+ hotjarFeedbackBtn.style.display = "none";
46
+ }
47
+ }
34
48
 
49
+ buildIFRAME() {
35
50
  this.logger.log('[UNASSIGNED-CONVS-PAGE] - UNASSIGNED CONVS URL (ngOnInit)', this.unassigned_convs_url);
36
- // this.unassigned_convs_url_sanitized = this.sanitizer.bypassSecurityTrustResourceUrl(this.unassigned_convs_url);
37
- // this.unassigned_convs_url_sanitized = this.sanitizer.bypassSecurityTrustHtml(this.unassigned_convs_url);
38
51
  this.unassigned_convs_url_sanitized = this.sanitizer.sanitize(SecurityContext.URL, this.unassigned_convs_url)
39
52
  this.logger.log('[UNASSIGNED-CONVS-PAGE] - UNASSIGNED CONVS URL SANITIZED (ngOnInit)', this.unassigned_convs_url_sanitized);
40
- this.has_loaded = false
53
+ // this.has_loaded = false
41
54
 
42
55
  this.ion_content = document.getElementById("iframe-ion-content");
43
56
  this.iframe = document.createElement("iframe");
44
57
  this.iframe.src = this.unassigned_convs_url_sanitized;
45
58
  this.iframe.width = "100%";
46
- this.iframe.height = "99.6%";
59
+ this.iframe.height = "99%";
47
60
  this.iframe.id = "unassigned-convs-iframe"
48
61
  this.iframe.frameBorder = "0";
49
62
  this.iframe.style.border = "none";
50
63
  this.iframe.style.background = "white";
51
64
  this.ion_content.appendChild(this.iframe);
52
65
 
53
- // }
54
-
55
- // window.addEventListener("message", (event) => {
56
- // console.log("[UNASSIGNED-CONVS-PAGE] message event ", event);
66
+ // this.getIframeHaLoaded()
67
+ }
57
68
 
58
- // if (event && event.data) {
59
- // if (event.data === 'finished') {
60
- // this.has_loaded = true
69
+ getIframeHaLoaded() {
70
+ var self = this;
71
+ var iframe = document.getElementById('unassigned-convs-iframe') as HTMLIFrameElement;;
72
+ this.logger.log('[APP-STORE-INSTALL] GET iframe ', iframe)
73
+ if (iframe) {
74
+ iframe.addEventListener("load", function () {
75
+ self.logger.log("[APP-STORE-INSTALL] GET - Finish");
76
+ let spinnerElem = <HTMLElement>document.querySelector('.stretchspinner-unassigned-convs')
61
77
 
62
- // }
63
- // }
64
- // });
78
+ self.logger.log('[APP-STORE-INSTALL] GET iframeDoc readyState spinnerElem', spinnerElem)
79
+ spinnerElem.classList.add("hide-stretchspinner")
65
80
 
81
+ });
82
+ }
66
83
  }
67
84
 
68
-
69
-
70
- // getIframeHaLoaded() {
71
- // var self = this;
72
- // var iframe = document.getElementById('i_frame') as HTMLIFrameElement;;
73
- // if (iframe) {
74
- // iframe.addEventListener("load", function () {
75
- // console.log("[UNASSIGNED-CONVS-PAGE] GET - Finish");
76
- // self.has_loaded = true
77
-
78
-
79
- // });
80
- // }
81
- // }
82
-
83
- // loadDeferredIframe(unassigned_convs_url_sanitized) {
84
- // // this function will load the Google homepage into the iframe
85
- // var iframe = document.getElementById("my-deferred-iframe");
86
- // iframe.src = "./" // here goes your url
87
- // };
85
+ listenToPostMsg() {
86
+ window.addEventListener("message", (event) => {
87
+ // console.log("[UNASSIGNED-CONVS-PAGE] message event ", event);
88
+
89
+ if (event && event.data) {
90
+ if (event.data === 'onInitProjectsForPanel') {
91
+ this.isProjectsForPanel = true;
92
+ }
93
+ if (event.data === 'onDestroyProjectsForPanel') {
94
+ this.isProjectsForPanel = false;
95
+ }
96
+ }
97
+ });
98
+ }
88
99
 
89
100
 
90
101
  async onClose() {
@@ -18,18 +18,90 @@ export class AppConfigProvider {
18
18
 
19
19
  /** */
20
20
  loadAppConfig() {
21
- const that = this;
22
- return this.http.get(this.appConfig.remoteConfigUrl).toPromise().then(data => {
23
- that.appConfig = data;
21
+ // const that = this;
22
+ // return this.http.get(this.appConfig.remoteConfigUrl).toPromise().then(data => {
23
+ // that.appConfig = data;
24
+ // }).catch(err => {
25
+ // console.log('error loadAppConfig' + err);
26
+ // });
27
+
28
+ // ---- new
29
+
30
+
31
+ return this.http.get(this.appConfig.remoteConfigUrl)
32
+ .toPromise().then((data: any ) => {
33
+ // console.log('AppConfigService loadAppConfig data: ', data);
34
+
35
+ const allconfig = data
36
+ // console.log('[APP-CONFIG-SERVICE] - loadAppConfig allconfig: ', allconfig);
37
+
38
+ if (allconfig.hasOwnProperty('wsUrlRel')) {
39
+
40
+ // console.log('[APP-CONFIG-SERVICE] - loadAppConfig allconfig !!!! exist wsUrlRel ->: ', allconfig.wsUrlRel);
41
+ var wsUrlRelIsEmpty = this.isEmpty(allconfig.wsUrlRel)
42
+ // console.log('[APP-CONFIG-SERVICE] - loadAppConfig allconfig !!!! exist wsUrlRel -> wsUrlRelIsEmpty ?', wsUrlRelIsEmpty);
43
+
44
+ if (wsUrlRelIsEmpty === false) {
45
+ // console.log('[APP-CONFIG-SERVICE]- loadAppConfig allconfig !!!! exist - SERVER_BASE_URL', data.apiUrl);
46
+
47
+ // if (allconfig.apiUrl.indexOf("http://") !== -1) {
48
+
49
+ // const ws_url = allconfig.apiUrl.replace("http://", "ws://").slice(0, -1) + allconfig.wsUrlRel;
50
+ // // console.log('AppConfigService loadAppConfig allconfig !!!! exist - SERVER_BASE_URL protocol is HTTP - wsUrl', ws_url);
51
+
52
+ // allconfig.wsUrl = ws_url
53
+
54
+ // } else if (allconfig.apiUrl.indexOf("https://") !== -1) {
55
+
56
+ // const ws_url = allconfig.apiUrl.replace("https://", "wss://").slice(0, -1) + allconfig.wsUrlRel;
57
+
58
+ // allconfig.wsUrl = ws_url
59
+
60
+ // // console.log('AppConfigService loadAppConfig allconfig !!!! exist - SERVER_BASE_URL protocol is HTTPS - wsUrl', ws_url);
61
+ // } else {
62
+
63
+
64
+ // console.log('AppConfigService loadAppConfig allconfig !!!! exist - SERVER_BASE_URL !!! IS RELATIVE - window.location ', window.location);
65
+
66
+ // console.log(window.location)
67
+
68
+ if (window.location.protocol === 'http:') {
69
+ allconfig.wsUrl = 'ws://' + window.location.hostname + allconfig.wsUrlRel
70
+
71
+ } else if (window.location.protocol === 'https:') {
72
+
73
+ allconfig.wsUrl = 'wss://' + window.location.hostname + allconfig.wsUrlRel
74
+ } else {
75
+
76
+ allconfig.wsUrl = 'ws://' + window.location.hostname + allconfig.wsUrlRel
77
+ }
78
+ // }
79
+
80
+ } else {
81
+ // console.log('[APP-CONFIG-SERVICE] loadAppConfig allconfig !!!! exist wsUrlRel but IS EMPTY');
82
+ }
83
+
84
+ } else {
85
+
86
+ // console.log('[APP-CONFIG-SERVICE] loadAppConfig allconfig !!!! does not exist wsUrlRel');
87
+ }
88
+
89
+ this.appConfig = allconfig;
90
+
91
+
24
92
  }).catch(err => {
25
- // console.log('error loadAppConfig' + err);
93
+ console.error('error loadAppConfig' + err);
26
94
  });
27
95
  }
28
96
 
97
+ isEmpty(wsUrlRel: string) {
98
+ return (wsUrlRel === undefined || wsUrlRel == null || wsUrlRel.length <= 0) ? true : false;
99
+ }
100
+
29
101
  /** */
30
102
  getConfig() {
31
103
  return this.appConfig;
32
104
  }
33
-
105
+
34
106
 
35
107
  }