@chat21/chat21-ionic 3.4.27-rc17 → 3.4.27-rc19

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
@@ -8,6 +8,12 @@
8
8
  ### **Copyrigth**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.27-rc19
12
+ - **added**: window.parent['openTicketOnHDA']
13
+
14
+ # 3.4.27-rc18
15
+ - **added**: triggerOnUpdateNewConversationBadge to update conversation badge count in parent component
16
+
11
17
  # 3.4.27-rc17
12
18
  - **bug-fixed**: setNotification not called when click on a conversation
13
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.4.27-rc17",
4
+ "version": "3.4.27-rc19",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -1126,7 +1126,7 @@ export class AppComponent implements OnInit {
1126
1126
  this.manageTabNotification('conv_added', conversation.sound)
1127
1127
  this.manageEventNewConversation(conversation)
1128
1128
  //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1129
- this.setNotification();
1129
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1130
1130
  }
1131
1131
  if(conversation) this.updateConversationsOnStorage()
1132
1132
  });
@@ -1136,7 +1136,7 @@ export class AppComponent implements OnInit {
1136
1136
  if(conversation){
1137
1137
  this.updateConversationsOnStorage();
1138
1138
  //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1139
- this.setNotification();
1139
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1140
1140
  }
1141
1141
  });
1142
1142
 
@@ -1162,7 +1162,7 @@ export class AppComponent implements OnInit {
1162
1162
  this.updateConversationsOnStorage();
1163
1163
  this.segmentResolved(conversation);
1164
1164
  //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1165
- this.setNotification();
1165
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1166
1166
  this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
1167
1167
  }
1168
1168
  });
@@ -1483,7 +1483,7 @@ export class AppComponent implements OnInit {
1483
1483
  }
1484
1484
 
1485
1485
  //INIT NOTIFICATION FOR NEW CONVERSATION COUNT
1486
- this.setNotification();
1486
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1487
1487
  });
1488
1488
 
1489
1489
  }
@@ -1700,14 +1700,6 @@ export class AppComponent implements OnInit {
1700
1700
  this.triggerEvents.triggerOnNewConversationInit(conversation)
1701
1701
  }
1702
1702
 
1703
- private setNotification() {
1704
- this.logger.log('[APP-COMP] setNotification for NEW CONVERSATION', this.conversationsHandlerService.countIsNew().toString());
1705
- if(window['AGENTDESKTOP']){
1706
- this.logger.log('[APP-COMP] manageNotification AGENTDESKTOP exist', window['AGENTDESKTOP'], this.conversationsHandlerService.countIsNew().toString());
1707
- window['AGENTDESKTOP']['TAB'].Badge(this.conversationsHandlerService.countIsNew().toString())
1708
- }
1709
- }
1710
-
1711
1703
 
1712
1704
  @HostListener('document:visibilitychange', [])
1713
1705
  visibilitychange() {
@@ -1774,6 +1766,11 @@ export class AppComponent implements OnInit {
1774
1766
  this.triggerEvents.triggerOnInit(detailOBJ)
1775
1767
  }
1776
1768
 
1769
+ private triggerOnUpdateNewConversationBadge(count: number){
1770
+ const detailOBJ = { event: 'onUpdateNewConversationBadge', count: count.toString() }
1771
+ this.triggerEvents.triggerOnUpdateNewConversationBadge(detailOBJ)
1772
+ }
1773
+
1777
1774
 
1778
1775
  // @HostListener('mouseenter', ['$event'])
1779
1776
  // onMouseEnter(event: any) {
@@ -1938,10 +1938,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1938
1938
  }
1939
1939
 
1940
1940
 
1941
- onOpenTicket() {
1941
+ onOpenTicket(event) {
1942
1942
  this.logger.debug('[CONVS-DETAIL] openTicketOnExternalService - conversationWith ', this.conversationWith)
1943
- if(window['openTicketOnHDA']){
1944
- window['openTicketOnHDA'](this.conversationWith)
1943
+ if(window.parent['openTicketOnHDA']){
1944
+ window.parent['openTicketOnHDA'](this.conversationWith)
1945
1945
  }
1946
1946
 
1947
1947
  }
@@ -102,5 +102,19 @@ export class TriggerEvents {
102
102
  }
103
103
  }
104
104
 
105
+ public triggerOnUpdateNewConversationBadge(detailObj: {}) {
106
+ this.logger.debug(' ---------------- triggerOnInitEvent ---------------- ', detailObj);
107
+ try {
108
+ const onBeforeInit = new CustomEvent('onUpdateNewConversationBadge', { detail: detailObj });
109
+ const windowContext = this.windowContext;
110
+ if (windowContext){
111
+ // windowContext.document.dispatchEvent(onNewConversation);
112
+ windowContext.postMessage({type: "onUpdateNewConversationBadge", detail: detailObj }, '*')
113
+ }
114
+ } catch (e) {
115
+ this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
116
+ }
117
+ }
118
+
105
119
 
106
120
  }