@chat21/chat21-web-widget 5.0.70 → 5.0.71-rc.1
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 +5 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +23 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +2 -1
- package/src/app/component/message/carousel/carousel.component.html +5 -1
- package/src/app/component/message/carousel/carousel.component.scss +21 -0
- package/src/app/component/message/carousel/carousel.component.ts +1 -1
- package/src/assets/images/icons/no-image.svg +6 -0
- package/src/assets/js/chat21client.js +6 -2
- package/src/assets/twp/chatbot-panel.html +19 -9
- package/src/chat21-core/models/conversation.ts +2 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +3 -0
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# chat21-web-widget ver 5.0
|
|
2
2
|
|
|
3
|
+
### 5.0.71-rc.1
|
|
4
|
+
- added: ability to start conversation from an intent hiddenMessage name
|
|
5
|
+
- added: postMessage to notice parent the current message
|
|
6
|
+
- changed: carousel UI if image is not available
|
|
7
|
+
|
|
3
8
|
### 5.0.70 in PROD
|
|
4
9
|
|
|
5
10
|
### 5.0.70-rc.1
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -748,6 +748,25 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
748
748
|
this.appStorageService.setItem('recipientId', newConvId)
|
|
749
749
|
this.logger.debug('[APP-COMP] recipientId: ', this.g.recipientId);
|
|
750
750
|
this.isConversationArchived = false;
|
|
751
|
+
|
|
752
|
+
if(window.location.search && window.location.search.substring(1).split('&').find((param => param.includes('tiledesk_hiddenMessage')))){
|
|
753
|
+
let hiddenMessage = window.location.search.substring(1).split('&').find((param => param.includes('tiledesk_hiddenMessage'))).split('=')[1]
|
|
754
|
+
let participant = window.location.search.substring(1).split('&').find((param => param.includes('tiledesk_participants'))).split('=')[1]
|
|
755
|
+
this.logger.debug('[APP-COMP] startNewConversation ', window.location.search.substring(1).split('&').find((param => param.includes('tiledesk_hiddenMessage'))))
|
|
756
|
+
let message: any = {}
|
|
757
|
+
message.attributes = { subtype: 'info', ...this.g.attributes}
|
|
758
|
+
message.userAgent = this.g.attributes['client']
|
|
759
|
+
message.request_id = newConvId
|
|
760
|
+
message.sourcePage = this.g.attributes['sourcePage']
|
|
761
|
+
message.language = this.g.lang
|
|
762
|
+
message.text = '/'+ hiddenMessage
|
|
763
|
+
message.participants = [ participant ]
|
|
764
|
+
message.departmentid = this.g.attributes.departmentId
|
|
765
|
+
// this.sendMessage(message)
|
|
766
|
+
this.tiledeskRequestsService.sendMessageToRequest(newConvId, this.g.tiledeskToken, message)
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
|
|
751
770
|
this.triggerNewConversationEvent(newConvId);
|
|
752
771
|
}
|
|
753
772
|
|
|
@@ -781,9 +800,12 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
781
800
|
if (this.g.windowContext.window.location) {
|
|
782
801
|
attributes['sourcePage'] = this.g.windowContext.window.location.href;
|
|
783
802
|
}
|
|
784
|
-
if(this.g.windowContext.window.document){
|
|
803
|
+
if(this.g.windowContext.window.document) {
|
|
785
804
|
attributes['sourceTitle'] = this.g.windowContext.window.document.title;
|
|
786
805
|
}
|
|
806
|
+
// if(this.g.windowContext.window.document && this.g.windowContext.window.document.cookie) {
|
|
807
|
+
// attributes['cookie'] = this.g.windowContext.window.document.cookie;
|
|
808
|
+
// }
|
|
787
809
|
if (projectid) {
|
|
788
810
|
attributes['projectId'] = projectid;
|
|
789
811
|
}
|
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
<!-- <div class="card" style="width: 17px;"></div> -->
|
|
9
9
|
<div class="card" *ngFor="let card of gallery; let i = index">
|
|
10
10
|
<div [style.opacity]="i+1 === activeElement? 1: 0.5">
|
|
11
|
-
<div class="card-image">
|
|
11
|
+
<div class="card-image" *ngIf="card?.preview?.src !== ''">
|
|
12
12
|
<img [src]="card?.preview?.src" alt="img" draggable="false">
|
|
13
13
|
</div>
|
|
14
|
+
<div class="card-image card-image-placeholder" *ngIf="card?.preview?.src == ''">
|
|
15
|
+
<img src="assets/images/icons/no-image.svg" alt="img" draggable="false">
|
|
16
|
+
<span>Image not available</span>
|
|
17
|
+
</div>
|
|
14
18
|
<div class="card-content">
|
|
15
19
|
<div class="card-title">{{card?.title}}</div>
|
|
16
20
|
<div class="card-description">{{card?.description}}</div>
|
|
@@ -100,6 +100,26 @@
|
|
|
100
100
|
.carousel .card .card-image {
|
|
101
101
|
height: 150px;
|
|
102
102
|
width: var(--cardWidth);
|
|
103
|
+
border-radius: 8px 8px 0px 0px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.carousel .card .card-image-placeholder{
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
gap: 10px;
|
|
111
|
+
background: #c1b9b952;
|
|
112
|
+
align-items: center;
|
|
113
|
+
|
|
114
|
+
img{
|
|
115
|
+
width: 30px;
|
|
116
|
+
height: 30px;
|
|
117
|
+
filter: brightness(0) saturate(100%) invert(44%) sepia(8%) saturate(449%) hue-rotate(190deg) brightness(94%) contrast(93%);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
span{
|
|
121
|
+
font-size: 0.8rem;
|
|
122
|
+
}
|
|
103
123
|
}
|
|
104
124
|
.card .card-image img {
|
|
105
125
|
height: 100%;
|
|
@@ -110,6 +130,7 @@
|
|
|
110
130
|
display: block;
|
|
111
131
|
max-width: 100% !important;
|
|
112
132
|
border-radius: 8px 8px 0px 0px;
|
|
133
|
+
|
|
113
134
|
}
|
|
114
135
|
.carousel .card .card-content {
|
|
115
136
|
// font-weight: 500;
|
|
@@ -76,7 +76,7 @@ export class CarouselComponent implements OnInit{
|
|
|
76
76
|
ngOnChanges(changes: SimpleChanges){
|
|
77
77
|
if(this.message && this.message.attributes && this.message.attributes?.attachment && this.message.attributes?.attachment?.gallery){
|
|
78
78
|
this.gallery = this.message.attributes.attachment.gallery
|
|
79
|
-
console.log('carrrrrrrrr', this.wrapper, this.elementRef.nativeElement.querySelector(".card"))
|
|
79
|
+
// console.log('carrrrrrrrr', this.wrapper, this.elementRef.nativeElement.querySelector(".card"))
|
|
80
80
|
// this.firstCardWidth = (this.elementRef.nativeElement.querySelector(".card") as HTMLElement).offsetWidth
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
|
2
|
+
<g>
|
|
3
|
+
<rect fill="none" height="24" width="24"/>
|
|
4
|
+
<path d="M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"/>
|
|
5
|
+
</g>
|
|
6
|
+
</svg>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Chat21Client
|
|
3
3
|
|
|
4
|
-
v0.1.12.
|
|
4
|
+
v0.1.12.7
|
|
5
5
|
|
|
6
6
|
@Author Andrea Sponziello
|
|
7
7
|
@Member Gabriele Panico
|
|
@@ -1000,7 +1000,10 @@ class Chat21Client {
|
|
|
1000
1000
|
|
|
1001
1001
|
this.client.on('connect', // TODO if token is wrong it must reply with an error!
|
|
1002
1002
|
() => {
|
|
1003
|
-
if (this.log) {
|
|
1003
|
+
if (this.log) {
|
|
1004
|
+
console.log("Chat client connected. User:" + user_id)
|
|
1005
|
+
console.log("Chat client connected. this.connected:" + this.connected)
|
|
1006
|
+
}
|
|
1004
1007
|
if (!this.connected) {
|
|
1005
1008
|
if (this.log) {console.log("Chat client first connection for:" + user_id)}
|
|
1006
1009
|
this.connected = true
|
|
@@ -1027,6 +1030,7 @@ class Chat21Client {
|
|
|
1027
1030
|
);
|
|
1028
1031
|
this.client.on('close',
|
|
1029
1032
|
() => {
|
|
1033
|
+
this.connected = false
|
|
1030
1034
|
if (this.log) {console.log("Chat client close event");}
|
|
1031
1035
|
}
|
|
1032
1036
|
);
|
|
@@ -377,11 +377,12 @@
|
|
|
377
377
|
}
|
|
378
378
|
}, 1000);
|
|
379
379
|
|
|
380
|
+
//open widget after 3s if is closed
|
|
380
381
|
setTimeout(() => {
|
|
381
382
|
if(event_data && event_data.detail && event_data.detail.global && !event_data.detail.global.isOpen){
|
|
382
383
|
window.Tiledesk('open')
|
|
383
384
|
}
|
|
384
|
-
},
|
|
385
|
+
}, 1000);
|
|
385
386
|
|
|
386
387
|
});
|
|
387
388
|
|
|
@@ -391,11 +392,11 @@
|
|
|
391
392
|
// document.getElementById("preloader").style.display = "none";
|
|
392
393
|
// }, 1000);
|
|
393
394
|
//open widget after 3s if is closed
|
|
394
|
-
setTimeout(() => {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}, 3000);
|
|
395
|
+
// setTimeout(() => {
|
|
396
|
+
// if(event_data && event_data.detail && event_data.detail.global && !event_data.detail.global.isOpen){
|
|
397
|
+
// window.Tiledesk('open')
|
|
398
|
+
// }
|
|
399
|
+
// }, 3000);
|
|
399
400
|
});
|
|
400
401
|
|
|
401
402
|
window.Tiledesk('onAuthStateChanged', function(event_data) {
|
|
@@ -405,6 +406,15 @@
|
|
|
405
406
|
// window.Tiledesk('show')
|
|
406
407
|
// }
|
|
407
408
|
});
|
|
409
|
+
|
|
410
|
+
window.Tiledesk('onMessageCreated', function(event_data) {
|
|
411
|
+
console.log("onMessageCreated!", event_data);
|
|
412
|
+
window.parent.postMessage(event_data.detail, '*')
|
|
413
|
+
// if(event_data.detail.isLogged){
|
|
414
|
+
// console.log("isLogged!!!!", event_data);
|
|
415
|
+
// window.Tiledesk('show')
|
|
416
|
+
// }
|
|
417
|
+
});
|
|
408
418
|
</script>
|
|
409
419
|
|
|
410
420
|
<script type="application/javascript">
|
|
@@ -453,14 +463,14 @@
|
|
|
453
463
|
</div>
|
|
454
464
|
|
|
455
465
|
<header id="header">
|
|
456
|
-
<ul class="nav navbar-nav navbar-left">
|
|
466
|
+
<!-- <ul class="nav navbar-nav navbar-left">
|
|
457
467
|
<li class="sign-up"><button class="share-btn" onclick="copyLink()">SHARE THIS PROTOTYPE</button></li>
|
|
458
|
-
</ul>
|
|
468
|
+
</ul> -->
|
|
459
469
|
</header>
|
|
460
470
|
<!-- The actual snackbar -->
|
|
461
471
|
<div id="snackbar">Copied to clipboard...</div>
|
|
462
472
|
|
|
463
|
-
<div id="wrapper" class="mockup">
|
|
473
|
+
<!-- <div id="wrapper" class="mockup"> -->
|
|
464
474
|
</div>
|
|
465
475
|
|
|
466
476
|
<footer id="footer">
|
|
@@ -150,6 +150,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
150
150
|
this.logger.debug('[MQTTConversationsHandler] connecting MQTT conversations handler');
|
|
151
151
|
this.chat21Service.chatClient.onConversationAdded( (conv) => {
|
|
152
152
|
let conversation = this.completeConversation(conv); // needed to get the "conversation_with", and find the conv in the conv-history
|
|
153
|
+
conversation.sound = true
|
|
153
154
|
this.logger.log("[MQTTConversationsHandler] onConversationAdded completed:",conversation);
|
|
154
155
|
const index = this.searchIndexInArrayForConversationWith(this.conversations, conversation.conversation_with);
|
|
155
156
|
if (index > -1) {
|
|
@@ -162,6 +163,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
162
163
|
}
|
|
163
164
|
});
|
|
164
165
|
this.chat21Service.chatClient.onConversationUpdated( (conv, topic) => {
|
|
166
|
+
conv.sound = true;
|
|
165
167
|
this.logger.debug('[MQTTConversationsHandler] conversation updated:', JSON.stringify(conv));
|
|
166
168
|
this.changed(conv);
|
|
167
169
|
});
|
|
@@ -184,6 +186,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
184
186
|
this.logger.debug('[MQTTConversationsHandler] Last conversations', conversations, 'err', err);
|
|
185
187
|
if (!err) {
|
|
186
188
|
conversations.forEach(conv => {
|
|
189
|
+
conv.sound = false;
|
|
187
190
|
this.added(conv);
|
|
188
191
|
});
|
|
189
192
|
loaded();
|
|
@@ -49,7 +49,7 @@ export class MQTTPresenceService extends PresenceService {
|
|
|
49
49
|
const that = this;
|
|
50
50
|
let local_BSIsOnline = new BehaviorSubject<any>(null);
|
|
51
51
|
this.webSocketService.wsRequesterStatus$.subscribe((data: any) => {
|
|
52
|
-
this.logger.log('[NATIVEPresenceSERVICE] $subs to wsService - data ', data, userid);
|
|
52
|
+
// this.logger.log('[NATIVEPresenceSERVICE] $subs to wsService - data ', data, userid);
|
|
53
53
|
if (data && data.presence && data.presence.status === 'online' ) {
|
|
54
54
|
that.BSIsOnline.next({ uid: data.uuid_user, isOnline: true });
|
|
55
55
|
local_BSIsOnline.next({ uid: data.uuid_user, isOnline: true });
|