@chat21/chat21-ionic 3.4.21-rc2 → 3.4.21-rc3

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,9 @@
8
8
  ### **Copyrigth**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.21-rc3
12
+ - **changed**: badge notification for agentDesktop
13
+
11
14
  # 3.4.21-rc2
12
15
  - **added**: count in newConversation handler event
13
16
 
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.21-rc2",
4
+ "version": "3.4.21-rc3",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -1111,6 +1111,7 @@ export class AppComponent implements OnInit {
1111
1111
  if (conversation && conversation.is_new === true && this.isInitialized) {
1112
1112
  this.manageTabNotification('conv_added', conversation.sound)
1113
1113
  this.manageEventNewConversation(conversation)
1114
+ this.manageNotification(conversation);
1114
1115
  }
1115
1116
  if(conversation) this.updateConversationsOnStorage()
1116
1117
  });
@@ -1633,9 +1634,18 @@ export class AppComponent implements OnInit {
1633
1634
  }
1634
1635
 
1635
1636
  private manageEventNewConversation(conversation){
1636
- this.triggerEvents.triggerOnNewConversationInit(conversation, this.conversationsHandlerService.countIsNew())
1637
+ this.triggerEvents.triggerOnNewConversationInit(conversation)
1637
1638
  }
1638
1639
 
1640
+ private manageNotification(conversation: ConversationModel) {
1641
+ this.logger.log('[APP-COMP] manageNotification conversation', conversation);
1642
+ if(window['AGENTDESKTOP']){
1643
+ this.logger.log('[APP-COMP] manageNotification AGENTDESKTOP exist', window['AGENTDESKTOP']);
1644
+ window['AGENTDESKTOP']['TAB'].Badge(this.conversationsHandlerService.countIsNew().toString())
1645
+ }
1646
+ }
1647
+
1648
+
1639
1649
  @HostListener('document:visibilitychange', [])
1640
1650
  visibilitychange() {
1641
1651
  // this.logger.debug("document TITLE", document.hidden, document.title);
@@ -73,14 +73,14 @@ export class TriggerEvents {
73
73
 
74
74
  }
75
75
 
76
- public triggerOnNewConversationInit(conversation: ConversationModel, countIsNew: Number){
76
+ public triggerOnNewConversationInit(conversation: ConversationModel){
77
77
  this.logger.debug(' ---------------- triggerOnNewConversation ---------------- ', conversation);
78
78
  try {
79
- const onNewConversation = new CustomEvent('onNewConversation', { detail: { conversation: conversation, count: countIsNew} });
79
+ const onNewConversation = new CustomEvent('onNewConversation', { detail: { conversation: conversation} });
80
80
  const windowContext = this.windowContext;
81
81
  if (windowContext){
82
82
  // windowContext.document.dispatchEvent(onNewConversation);
83
- windowContext.postMessage({type: "onNewConversation", detail: { conversation: conversation, count: countIsNew}}, '*')
83
+ windowContext.postMessage({type: "onNewConversation", detail: { conversation: conversation}}, '*')
84
84
  }
85
85
  } catch (e) {
86
86
  this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
@@ -12,24 +12,6 @@
12
12
  script.onload = () => {
13
13
  console.log('AgentDesktop SDK caricato');
14
14
  window.agentDesktopLoaded = true;
15
-
16
- const TILEDESK_EVENT = {
17
- AUTH_CHANGED: 'onAuthStateChanged',
18
- NEW_CONVERSATION: 'onNewConversation',
19
- }
20
-
21
- window.addEventListener( 'message', function(event){
22
- if(event && event.data && event.data.type){
23
- switch(event.data.type){
24
- case TILEDESK_EVENT.NEW_CONVERSATION: {
25
- console.log('HANDLED onNewConversation:', event.data)
26
- let count = event.data.detail.count.toString()
27
- window['AGENTDESKTOP']['TAB'].Badge(count)
28
- break;
29
- }
30
- }
31
- }
32
- })
33
15
  };
34
16
 
35
17
  script.onerror = (error) => {