@chat21/chat21-ionic 3.4.20 → 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
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
### **Copyrigth**:
|
|
9
9
|
*Tiledesk SRL*
|
|
10
10
|
|
|
11
|
+
# 3.4.21-rc2
|
|
12
|
+
- **added**: count in newConversation handler event
|
|
13
|
+
|
|
14
|
+
# 3.4.21-rc1
|
|
15
|
+
- **added**: implement badge notification for agentDesktop sw when new conversation is assigned to logged agent
|
|
16
|
+
|
|
11
17
|
# 3.4.20 in PROD
|
|
12
18
|
|
|
13
19
|
# 3.4.19 in PROD
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -168,6 +168,7 @@ export class AppComponent implements OnInit {
|
|
|
168
168
|
}, { capture: true });
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
|
|
171
172
|
listenChatAlreadyOpenWithoutParamsInMobileMode() {
|
|
172
173
|
this.events.subscribe('noparams:mobile', (isAlreadyOpenInMobileMode) => {
|
|
173
174
|
// console.log('[APP-COMP] Chat is Already Open In Mobile Mode ', isAlreadyOpenInMobileMode)
|
|
@@ -332,7 +333,7 @@ export class AppComponent implements OnInit {
|
|
|
332
333
|
|
|
333
334
|
listenToPostMsgs() {
|
|
334
335
|
window.addEventListener("message", (event) => {
|
|
335
|
-
this.logger.log("[APP-COMP] message event ", event);
|
|
336
|
+
// this.logger.log("[APP-COMP] message event ", event);
|
|
336
337
|
|
|
337
338
|
if (event && event.data && event.data.action && event.data.parameter) {
|
|
338
339
|
if (event.data.action === 'openJoinConversationModal') {
|
|
@@ -1632,10 +1633,9 @@ export class AppComponent implements OnInit {
|
|
|
1632
1633
|
}
|
|
1633
1634
|
|
|
1634
1635
|
private manageEventNewConversation(conversation){
|
|
1635
|
-
this.triggerEvents.triggerOnNewConversationInit(conversation)
|
|
1636
|
+
this.triggerEvents.triggerOnNewConversationInit(conversation, this.conversationsHandlerService.countIsNew())
|
|
1636
1637
|
}
|
|
1637
1638
|
|
|
1638
|
-
|
|
1639
1639
|
@HostListener('document:visibilitychange', [])
|
|
1640
1640
|
visibilitychange() {
|
|
1641
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();
|