@chat21/chat21-ionic 3.4.27-rc16 → 3.4.27-rc18

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,8 +8,15 @@
8
8
  ### **Copyrigth**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.27-rc18
12
+ - **added**: triggerOnUpdateNewConversationBadge to update conversation badge count in parent component
13
+
14
+ # 3.4.27-rc17
15
+ - **bug-fixed**: setNotification not called when click on a conversation
16
+
11
17
  # 3.4.27-rc16
12
-
18
+ - **bug-fixed**: setNotification not called when resolve a conversation
19
+
13
20
  # 3.4.27-rc15
14
21
  - **changed**: /images with /img in assets folder
15
22
 
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-rc16",
4
+ "version": "3.4.27-rc18",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -1125,14 +1125,19 @@ export class AppComponent implements OnInit {
1125
1125
  if (conversation && conversation.is_new === true && this.isInitialized) {
1126
1126
  this.manageTabNotification('conv_added', conversation.sound)
1127
1127
  this.manageEventNewConversation(conversation)
1128
- this.setNotification();
1128
+ //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1129
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1129
1130
  }
1130
1131
  if(conversation) this.updateConversationsOnStorage()
1131
1132
  });
1132
1133
 
1133
1134
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
1134
1135
  // console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
1135
- if(conversation) this.updateConversationsOnStorage();
1136
+ if(conversation){
1137
+ this.updateConversationsOnStorage();
1138
+ //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1139
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1140
+ }
1136
1141
  });
1137
1142
 
1138
1143
  this.conversationsHandlerService.conversationChangedDetailed.subscribe((changes: {value: ConversationModel, previousValue: ConversationModel}) => {
@@ -1156,7 +1161,8 @@ export class AppComponent implements OnInit {
1156
1161
  if(conversation) {
1157
1162
  this.updateConversationsOnStorage();
1158
1163
  this.segmentResolved(conversation);
1159
- this.setNotification();
1164
+ //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1165
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1160
1166
  this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
1161
1167
  }
1162
1168
  });
@@ -1282,9 +1288,9 @@ export class AppComponent implements OnInit {
1282
1288
  }
1283
1289
 
1284
1290
  goToDashboardLogin(){
1285
- let DASHBOARD_URL = this.appConfigProvider.getConfig().dashboardUrl + '#/login'
1286
- const myWindow = window.open(DASHBOARD_URL, '_self');
1287
- myWindow.focus();
1291
+ // let DASHBOARD_URL = this.appConfigProvider.getConfig().dashboardUrl + '#/login'
1292
+ // const myWindow = window.open(DASHBOARD_URL, '_self');
1293
+ // myWindow.focus();
1288
1294
  }
1289
1295
 
1290
1296
  connetWebsocket(tiledeskToken) {
@@ -1400,8 +1406,6 @@ export class AppComponent implements OnInit {
1400
1406
  if(conversation && conversation.is_new){
1401
1407
  this.audio_NewConv.pause();
1402
1408
  this.conversationsHandlerService.setConversationRead(conversation.uid)
1403
- //UPDATE NOTIFICATION FOR NEW CONVERSATION COUNT
1404
- this.setNotification();
1405
1409
  }
1406
1410
  }
1407
1411
 
@@ -1479,7 +1483,7 @@ export class AppComponent implements OnInit {
1479
1483
  }
1480
1484
 
1481
1485
  //INIT NOTIFICATION FOR NEW CONVERSATION COUNT
1482
- this.setNotification();
1486
+ this.triggerOnUpdateNewConversationBadge(this.conversationsHandlerService.countIsNew());
1483
1487
  });
1484
1488
 
1485
1489
  }
@@ -1696,14 +1700,6 @@ export class AppComponent implements OnInit {
1696
1700
  this.triggerEvents.triggerOnNewConversationInit(conversation)
1697
1701
  }
1698
1702
 
1699
- private setNotification() {
1700
- this.logger.log('[APP-COMP] setNotification for NEW CONVERSATION');
1701
- if(window['AGENTDESKTOP']){
1702
- this.logger.log('[APP-COMP] manageNotification AGENTDESKTOP exist', window['AGENTDESKTOP'], this.conversationsHandlerService.countIsNew().toString());
1703
- window['AGENTDESKTOP']['TAB'].Badge(this.conversationsHandlerService.countIsNew().toString())
1704
- }
1705
- }
1706
-
1707
1703
 
1708
1704
  @HostListener('document:visibilitychange', [])
1709
1705
  visibilitychange() {
@@ -1770,6 +1766,11 @@ export class AppComponent implements OnInit {
1770
1766
  this.triggerEvents.triggerOnInit(detailOBJ)
1771
1767
  }
1772
1768
 
1769
+ private triggerOnUpdateNewConversationBadge(count: number){
1770
+ const detailOBJ = { event: 'onUpdateNewConversationBadge', count: count.toString() }
1771
+ this.triggerEvents.triggerOnUpdateNewConversationBadge(detailOBJ)
1772
+ }
1773
+
1773
1774
 
1774
1775
  // @HostListener('mouseenter', ['$event'])
1775
1776
  // onMouseEnter(event: any) {
@@ -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
  }