@chat21/chat21-ionic 3.4.21-rc1 → 3.4.21-rc2
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
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -333,7 +333,7 @@ export class AppComponent implements OnInit {
|
|
|
333
333
|
|
|
334
334
|
listenToPostMsgs() {
|
|
335
335
|
window.addEventListener("message", (event) => {
|
|
336
|
-
this.logger.log("[APP-COMP] message event ", event);
|
|
336
|
+
// this.logger.log("[APP-COMP] message event ", event);
|
|
337
337
|
|
|
338
338
|
if (event && event.data && event.data.action && event.data.parameter) {
|
|
339
339
|
if (event.data.action === 'openJoinConversationModal') {
|
|
@@ -1111,7 +1111,6 @@ 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);
|
|
1115
1114
|
}
|
|
1116
1115
|
if(conversation) this.updateConversationsOnStorage()
|
|
1117
1116
|
});
|
|
@@ -1634,18 +1633,9 @@ export class AppComponent implements OnInit {
|
|
|
1634
1633
|
}
|
|
1635
1634
|
|
|
1636
1635
|
private manageEventNewConversation(conversation){
|
|
1637
|
-
this.triggerEvents.triggerOnNewConversationInit(conversation)
|
|
1636
|
+
this.triggerEvents.triggerOnNewConversationInit(conversation, this.conversationsHandlerService.countIsNew())
|
|
1638
1637
|
}
|
|
1639
1638
|
|
|
1640
|
-
private manageNotification(conversation: ConversationModel) {
|
|
1641
|
-
this.logger.log('[APP-COMP] manageNotification AGENTDESKTOP', conversation);
|
|
1642
|
-
if(window['AGENTDESKTOP']){
|
|
1643
|
-
this.logger.log('[APP-COMP] manageNotification AGENTDESKTOP', window['AGENTDESKTOP']);
|
|
1644
|
-
window['AGENTDESKTOP']['TAB'].Badge(this.conversationsHandlerService.countIsNew())
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
1639
|
@HostListener('document:visibilitychange', [])
|
|
1650
1640
|
visibilitychange() {
|
|
1651
1641
|
// 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){
|
|
76
|
+
public triggerOnNewConversationInit(conversation: ConversationModel, countIsNew: Number){
|
|
77
77
|
this.logger.debug(' ---------------- triggerOnNewConversation ---------------- ', conversation);
|
|
78
78
|
try {
|
|
79
|
-
const onNewConversation = new CustomEvent('onNewConversation', { detail: { conversation: conversation} });
|
|
79
|
+
const onNewConversation = new CustomEvent('onNewConversation', { detail: { conversation: conversation, count: countIsNew} });
|
|
80
80
|
const windowContext = this.windowContext;
|
|
81
81
|
if (windowContext){
|
|
82
82
|
// windowContext.document.dispatchEvent(onNewConversation);
|
|
83
|
-
windowContext.postMessage({type: "onNewConversation", detail: { conversation: conversation}}, '*')
|
|
83
|
+
windowContext.postMessage({type: "onNewConversation", detail: { conversation: conversation, count: countIsNew}}, '*')
|
|
84
84
|
}
|
|
85
85
|
} catch (e) {
|
|
86
86
|
this.logger.error('[TRIGGER-HANDLER] > Error:' + e);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function loadAgentDesktopScript() {
|
|
2
|
+
if (document.getElementById('agentdesktop-sdk')) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const script = document.createElement('script');
|
|
7
|
+
script.id = 'agentdesktop-sdk';
|
|
8
|
+
script.type = 'text/javascript';
|
|
9
|
+
script.src = 'https://devcti.aruba.it/AD/widget/agentdesktop_widget.js';
|
|
10
|
+
script.async = true;
|
|
11
|
+
|
|
12
|
+
script.onload = () => {
|
|
13
|
+
console.log('AgentDesktop SDK caricato');
|
|
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
|
+
};
|
|
34
|
+
|
|
35
|
+
script.onerror = (error) => {
|
|
36
|
+
console.error('Errore nel caricamento AgentDesktop SDK', error);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if (document.body) {
|
|
45
|
+
document.body.appendChild(script);
|
|
46
|
+
} else {
|
|
47
|
+
window.addEventListener('DOMContentLoaded', function() {
|
|
48
|
+
document.body.appendChild(script);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
loadAgentDesktopScript();
|