@chat21/chat21-ionic 3.0.107-rc.5 → 3.0.107-rc.7

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 CHANGED
@@ -1,12 +1,19 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.107.rc.7
4
+ - bug-fixed: unassigned-convs not laoded custom external style via postMessage or event.subscribe methods
5
+ - bug-fixed: delete all old css class style while uploading (via postMessge) a new class
6
+ - bug-fixed: customStyle removed if refresh page or window.resize event is handled --> restore saved style from storage
7
+
8
+ ### 3.0.107.rc.6
9
+ - bug-fixed: set is_new=false before archive an active conversation (not show not-read blu pointer and bold recipient fullname and last text)
10
+
3
11
  ### 3.0.107.rc.5
4
12
  - bug-fixed: user info is not updated in sidebar-user-detail with SSO
5
13
 
6
14
  ### 3.0.107.rc.4
7
15
  - bug-fixed: SSO, createCustomToken pass old token to authenticate chat engine module
8
16
 
9
-
10
17
  ### 3.0.107.rc.3
11
18
  - bug-fixed: update tiledek_token after signInWithCustomToken
12
19
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.107-rc.5",
4
+ "version": "3.0.107-rc.7",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -319,6 +319,8 @@ export class AppComponent implements OnInit {
319
319
  this.initializeApp('oninit');
320
320
  this.loadCustomScript(appconfig)
321
321
  this.listenToPostMsgs();
322
+
323
+ this.loadStyle(JSON.parse(this.appStorageService.getItem('style')))
322
324
  }
323
325
 
324
326
 
@@ -411,9 +413,11 @@ export class AppComponent implements OnInit {
411
413
  async loadStyle(data){
412
414
  console.log('[APP-COMPO] event: style ...', data)
413
415
  this.appStorageService.setItem('style', JSON.stringify(data))
414
- if(!data.parameter){
416
+ if(!data || !data.parameter){
415
417
 
416
418
  /** remove class from chat-IFRAME */
419
+ let className = document.body.className.replace(new RegExp(/style-\S*/gm), '')
420
+ document.body.className = className
417
421
  document.body.classList.remove('light')
418
422
  document.body.classList.remove('dark')
419
423
  document.body.classList.remove('custom')
@@ -425,15 +429,34 @@ export class AppComponent implements OnInit {
425
429
  /** remove class from dashoard-IFRAME */
426
430
  var iframeWin = <HTMLIFrameElement>document.getElementById("iframeConsole")
427
431
  if(iframeWin){
432
+ let className = iframeWin.contentDocument.body.className.replace(new RegExp(/style-\S*/gm), '')
433
+ iframeWin.contentDocument.body.className = className
428
434
  iframeWin.contentDocument.body.classList.remove('light')
429
435
  iframeWin.contentDocument.body.classList.remove('dark')
430
436
  iframeWin.contentDocument.body.classList.remove('custom')
437
+
431
438
  let link = iframeWin.contentDocument.getElementById('themeCustom');
432
439
  if(link){
433
440
  link.remove();
434
441
  }
435
442
  }
436
443
 
444
+ /** remove class from dashoard-IFRAME-unsassigned-convs */
445
+ var iframeWinUnassigned = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
446
+ if(iframeWinUnassigned){
447
+ let className = iframeWin.contentDocument.body.className.replace(new RegExp(/style-\S*/gm), '')
448
+ iframeWinUnassigned.contentDocument.body.className = className
449
+ iframeWinUnassigned.contentDocument.body.classList.remove('light')
450
+ iframeWinUnassigned.contentDocument.body.classList.remove('dark')
451
+ iframeWinUnassigned.contentDocument.body.classList.remove('custom')
452
+
453
+ let link = iframeWinUnassigned.contentDocument.getElementById('themeCustom');
454
+ if(link){
455
+ link.remove();
456
+ }
457
+ }
458
+
459
+
437
460
  /** remove style INFO from storage */
438
461
  this.appStorageService.removeItem('style')
439
462
 
@@ -447,14 +470,17 @@ export class AppComponent implements OnInit {
447
470
  link.rel = 'stylesheet';
448
471
  link.type = 'text/css';
449
472
  link.media='all';
450
-
451
473
  this.logger.log('[APP-COMP] create link element...', link)
452
474
  let head = document.getElementsByTagName('head')[0];
453
475
  head.appendChild(link);
476
+
454
477
  /** add class to body element as theme type ('light', 'dark', 'custom') */
455
478
  document.body.classList.add(data.type)
456
479
 
457
- /** publish event to info-support-group component */
480
+ /** publish event to
481
+ * - info-support-group component
482
+ * - unassigned-conversations component
483
+ */
458
484
  this.events.publish('style', data)
459
485
 
460
486
  // var iframeWin = <HTMLIFrameElement>document.getElementById("iframeConsole")
@@ -21,28 +21,28 @@ export class InfoSupportGroupComponent implements OnInit {
21
21
  ) { }
22
22
 
23
23
  ngOnInit() {
24
- this.logger.log('InfoSupportGroupComponent - urlConversationSupportGroup: ', this.urlConversationSupportGroup);
25
- this.events.subscribe('style', (data)=>this.loadStyle(data) )
24
+ this.logger.log('[InfoSupportGroupComponent] - urlConversationSupportGroup: ', this.urlConversationSupportGroup);
25
+ this.events.subscribe('style', (data)=>this.loadStyle(data))
26
26
  }
27
27
 
28
28
  ngOnDestroy() {
29
29
  // this.logger.log('ngOnDestroy ConversationDetailPage: ');
30
- this.logger.log('InfoSupportGroupComponent - ngOnDestroy ');
30
+ this.logger.log('[InfoSupportGroupComponent] - ngOnDestroy ');
31
31
 
32
32
  }
33
33
 
34
34
  onLoad(iframe){
35
35
  let styleData = this.appStorageService.getItem('style')
36
- console.log('styleeeeee', styleData)
36
+ console.log('[InfoSupportGroupComponent] styleeeeee', styleData)
37
37
  if(styleData && styleData !== 'undefined'){
38
38
  this.loadStyle(JSON.parse(styleData))
39
39
  }
40
40
  }
41
-
42
-
43
41
  async loadStyle(data){
44
42
  var iframeWin = <HTMLIFrameElement>document.getElementById("iframeConsole")
45
43
  if(!data.parameter){
44
+ let className = iframeWin.contentDocument.body.className.replace(new RegExp(/style-\S*/gm), '')
45
+ iframeWin.contentDocument.body.className = className
46
46
  iframeWin.contentWindow.document.body.classList.remove('light')
47
47
  iframeWin.contentWindow.document.body.classList.remove('dark')
48
48
  iframeWin.contentWindow.document.body.classList.remove('custom')
@@ -531,7 +531,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
531
531
  this.addEventsKeyboard()
532
532
  this.updateConversationBadge() // AGGIORNO STATO DELLA CONVERSAZIONE A 'LETTA' (is_new = false)
533
533
 
534
-
535
534
  }
536
535
 
537
536
  _getProjectIdByConversationWith(conversationWith: string) {
@@ -5,6 +5,8 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
5
5
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
6
6
  import { DomSanitizer } from '@angular/platform-browser'
7
7
  import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
8
+ import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
9
+ import { EventsService } from 'src/app/services/events-service';
8
10
 
9
11
 
10
12
  @Component({
@@ -34,6 +36,8 @@ export class UnassignedConversationsPage implements OnInit {
34
36
  private navService: NavProxyService,
35
37
  private sanitizer: DomSanitizer,
36
38
  private translateService: CustomTranslateService,
39
+ private appStorageService: AppStorageService,
40
+ private events : EventsService
37
41
  ) { }
38
42
 
39
43
  ngOnInit() {
@@ -46,6 +50,7 @@ export class UnassignedConversationsPage implements OnInit {
46
50
  this.buildIFRAME();
47
51
  this.listenToPostMsg();
48
52
  this.hideHotjarFeedbackBtn();
53
+ this.events.subscribe('style', (data)=>this.loadStyle(data))
49
54
  }
50
55
 
51
56
  ngOnDestroy(){
@@ -89,7 +94,8 @@ export class UnassignedConversationsPage implements OnInit {
89
94
  if (iframeWin) {
90
95
  iframeWin.addEventListener("load", function () {
91
96
  self.logger.log("[UNASSIGNED-CONVS-PAGE] GET - Finish");
92
-
97
+ self.onLoad(iframeWin)
98
+
93
99
  const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
94
100
  input !== null && input.tagName === 'IFRAME';
95
101
 
@@ -98,17 +104,58 @@ export class UnassignedConversationsPage implements OnInit {
98
104
  iframeWin.contentWindow.postMessage(msg, '*');
99
105
  }
100
106
 
107
+
101
108
 
102
109
  let spinnerElem = <HTMLElement>document.querySelector('.loader-spinner-wpr')
103
110
 
104
111
  self.logger.log('[APP-STORE-INSTALL] GET iframeDoc readyState spinnerElem', spinnerElem)
105
112
  spinnerElem.classList.add("hide-stretchspinner")
106
113
 
114
+
115
+
107
116
  });
108
117
  }
109
118
 
110
119
  }
111
120
 
121
+ onLoad(iframe){
122
+ let styleData = this.appStorageService.getItem('style')
123
+ console.log('[UNASSIGNED-CONVS-PAGE] styleeeeee', styleData)
124
+ if(styleData && styleData !== 'undefined'){
125
+ this.loadStyle(JSON.parse(styleData))
126
+ }
127
+ }
128
+ async loadStyle(data){
129
+ var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
130
+ if(!data.parameter){
131
+ let className = iframeWin.contentDocument.body.className.replace(new RegExp(/style-\S*/gm), '')
132
+ iframeWin.contentDocument.body.className = className
133
+ iframeWin.contentWindow.document.body.classList.remove('light')
134
+ iframeWin.contentWindow.document.body.classList.remove('dark')
135
+ iframeWin.contentWindow.document.body.classList.remove('custom')
136
+ let link = iframeWin.contentWindow.document.getElementById('themeCustom');
137
+ if(link){
138
+ link.remove();
139
+ }
140
+ return;
141
+ }
142
+
143
+ // Create link
144
+ let link = iframeWin.contentWindow.document.createElement('link');
145
+ link.id= 'themeCustom'
146
+ link.href = data.parameter;
147
+ link.rel = 'stylesheet';
148
+ link.type = 'text/css';
149
+ link.media='all';
150
+
151
+ console.log('linkkkk', link, iframeWin.contentWindow.document)
152
+ let head = iframeWin.contentWindow.document.getElementsByTagName('head')[0];
153
+ head.appendChild(link);
154
+ iframeWin.contentWindow.document.body.classList.add(data.type) //ADD class to body element as theme type ('light', 'dark', 'custom')
155
+ return;
156
+ }
157
+
158
+
112
159
  listenToPostMsg() {
113
160
  window.addEventListener("message", (event) => {
114
161
  // console.log("[UNASSIGNED-CONVS-PAGE] message event ", event);
@@ -8,11 +8,32 @@ body.light{
8
8
  --list-bkg-color: green;
9
9
  }
10
10
 
11
- body.dark{
11
+ body.style-1{
12
12
  background-color: blue;
13
13
  --list-bkg-color: blue;
14
14
  }
15
15
 
16
16
  body.light .navbar{
17
17
  background-color: red;
18
+ }
19
+
20
+ body.light ion-button .button-native {
21
+ background-color: red;
22
+ }
23
+
24
+ body.light ion-button {
25
+ background-color: red;
26
+ }
27
+
28
+ body.style-1 ion-button .button-native {
29
+ background-color: red;
30
+ }
31
+
32
+ /* body.dark :host(.button-native) {
33
+ border: 1px solid red;
34
+ } */
35
+
36
+
37
+ body.style-1 ion-col div.buttons-left {
38
+ background-color: blue;
18
39
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  <div class="event-wrp" id="onThemeColor">
14
14
  <span class="badge">EVENT</span>
15
- <label>themeColor </label>
15
+ <label>themeColor LIGHT</label>
16
16
  <label class="switch">
17
17
  <input type="checkbox" name="themeColor" onclick="onCLickThemeColor(this)">
18
18
  <span class="slider round"></span>
@@ -34,15 +34,16 @@
34
34
  // cssLink.type = "text/css";
35
35
  // console.log('framessss', frames['myIFrame'])
36
36
  // frames['myIFrame'].contentWindow.document.body.appendChild(cssLink);
37
- let msg= { action: "style", type: 'light', parameter: 'http://localhost:8080/assets/customStyle.css'}
38
- frames['myIFrame'].contentWindow.postMessage(msg, '*');
37
+
38
+ // let msg= { action: "style", type: 'light', parameter: 'http://localhost:8080/assets/customStyle.css'}
39
+ // frames['myIFrame'].contentWindow.postMessage(msg, '*');
39
40
  }
40
41
 
41
42
 
42
43
  function onCLickThemeColor(event){
43
44
  console.log('onCLickThemeColor: status-->',event.checked);
44
45
  if(event.checked){
45
- let msg= { action: "style", type: 'light', parameter: 'http://localhost:8080/assets/customStyle.css'}
46
+ let msg= { action: "style", type: 'style-1', parameter: 'http://localhost:8080/assets/customStyle.css'}
46
47
  frames['myIFrame'].contentWindow.postMessage(msg, '*');
47
48
  }else{
48
49
  let msg= { action: "style", parameter: ''}
@@ -272,6 +272,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
272
272
  archiveConversation(conversationId: string) {
273
273
  const that = this
274
274
  this.setClosingConversation(conversationId, true);
275
+ this.setConversationRead(conversationId)
275
276
  const index = searchIndexInArrayForUid(this.conversations, conversationId);
276
277
  // if (index > -1) {
277
278
  // this.conversations.splice(index, 1);
@@ -374,7 +374,8 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
374
374
  this.isConversationClosingMap.delete(conversationId);
375
375
  }
376
376
 
377
- archiveConversation(conversationId: string) {
377
+ archiveConversation(conversationId: string) {
378
+ this.setConversationRead(conversationId)
378
379
  this.chat21Service.chatClient.archiveConversation(conversationId);
379
380
  }
380
381
 
@@ -112,7 +112,7 @@ export class NativeUploadService extends UploadService {
112
112
 
113
113
  //USE IMAGE API
114
114
  const that = this;
115
- const url = this.URL_TILEDESK_IMAGES + '/users' + '?path=' + path
115
+ const url = this.URL_TILEDESK_IMAGES + '/users' + '?path=' + path.split('path=')[1]
116
116
  return new Promise((resolve, reject) => {
117
117
  that.http.delete(url, requestOptions).subscribe(data => {
118
118
  // const downloadURL = this.URL_TILEDESK_IMAGES + '?path=' + data['filename'];