@chat21/chat21-web-widget 5.0.51 → 5.0.52-rc.3
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 +9 -0
- package/dist/assets/twp/chatbot-panel.html +2 -23
- package/dist/assets/twp/index-dev.html +5 -5
- package/dist/launch.js +60 -1
- package/dist/main.js +1 -1
- package/dist/test.html +1 -1
- package/package.json +1 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.html +1 -0
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +12 -0
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +11 -0
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts +1 -0
- package/src/assets/twp/chatbot-panel.html +2 -23
- package/src/assets/twp/index-dev.html +5 -5
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +0 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +20 -14
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +1 -2
- package/src/launch.js +60 -1
- package/src/test.html +1 -1
package/dist/test.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Widget Test Page</title>
|
|
8
|
-
<script type="application/javascript">
|
|
8
|
+
<script type="application/javascript" async>
|
|
9
9
|
// Handler for .ready() called.
|
|
10
10
|
window.tiledeskSettings =
|
|
11
11
|
{
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
[stylesMap]="stylesMap"
|
|
22
22
|
[translationMap]="translationMapHeader"
|
|
23
23
|
[widgetTitle]="g?.project?.widgetTitle"
|
|
24
|
+
[build_version]="g?.singleConversation? g?.BUILD_VERSION: null"
|
|
24
25
|
[windowContext]="g?.windowContext"
|
|
25
26
|
[isMenuShow]="isMenuShow"
|
|
26
27
|
[isTypings]="isTypings"
|
package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html
CHANGED
|
@@ -139,6 +139,18 @@
|
|
|
139
139
|
<span class="label-menu-item">{{ translationMap?.get('LOGOUT') }}</span>
|
|
140
140
|
</div>
|
|
141
141
|
|
|
142
|
+
<!-- BUILD VERSION -->
|
|
143
|
+
<div class="c21-button build_version_menu" *ngIf="build_version">
|
|
144
|
+
<!-- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" class="icon-menu">
|
|
145
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
146
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
|
|
147
|
+
<title id="altIconTitle">{{g.LOGOUT}}</title>
|
|
148
|
+
</svg> -->
|
|
149
|
+
<span class="label-menu-item">{{build_version}}</span>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
142
154
|
<!-- ICON EDIT PROFILE -->
|
|
143
155
|
<!-- <div class="c21-header-button c21-right" *ngIf="messages && messages.length > 1">
|
|
144
156
|
<svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': g.themeForegroundColor }" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
|
package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss
CHANGED
|
@@ -130,5 +130,16 @@
|
|
|
130
130
|
stroke: $icon-fill-color;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
.build_version_menu {
|
|
134
|
+
color: $gray;
|
|
135
|
+
justify-content: center;
|
|
136
|
+
font-size: 0.8em;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.build_version_menu:hover {
|
|
140
|
+
cursor: default;
|
|
141
|
+
background-color: unset;
|
|
142
|
+
}
|
|
143
|
+
|
|
133
144
|
|
|
134
145
|
}
|
package/src/app/component/conversation-detail/conversation-header/conversation-header.component.ts
CHANGED
|
@@ -31,6 +31,7 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
|
|
|
31
31
|
@Input() stylesMap: Map<string, string>
|
|
32
32
|
@Input() translationMap: Map< string, string>;
|
|
33
33
|
@Input() widgetTitle: string;
|
|
34
|
+
@Input() build_version: string;
|
|
34
35
|
@Output() onBack = new EventEmitter();
|
|
35
36
|
@Output() onCloseWidget = new EventEmitter();
|
|
36
37
|
@Output() onSoundChange = new EventEmitter();
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
background-position: inherit;
|
|
109
109
|
background-attachment: fixed;
|
|
110
110
|
background-size: cover;
|
|
111
|
+
opacity: 0.4;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
.row {
|
|
@@ -261,6 +262,7 @@
|
|
|
261
262
|
calloutTimer: 1,
|
|
262
263
|
singleConversation: true,
|
|
263
264
|
restartConversation: true,
|
|
265
|
+
isLogEnabled: true,
|
|
264
266
|
hideCloseConversationOptionMenu: true
|
|
265
267
|
// autostart: false
|
|
266
268
|
|
|
@@ -418,29 +420,6 @@
|
|
|
418
420
|
// console.log('tiledesk_projectid: ', tiledesk_projectid);
|
|
419
421
|
// console.log('project_name: ', project_name);
|
|
420
422
|
|
|
421
|
-
window.onload = function() {
|
|
422
|
-
document.getElementById("project_id").innerHTML = '"' + tiledesk_projectid + '"';
|
|
423
|
-
// document.getElementById("project_name").innerHTML = project_name;
|
|
424
|
-
|
|
425
|
-
if(role !== 'agent'){
|
|
426
|
-
document.getElementById("testPageButton").style.display = 'block'
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// window.tileDeskAsyncInit = function() {
|
|
431
|
-
// window.tiledesk.on('onLoadParams', function(event_data) {
|
|
432
|
-
// // console.log('onLoadParams: ')
|
|
433
|
-
// window.tiledesk.open();
|
|
434
|
-
// });
|
|
435
|
-
|
|
436
|
-
// window.tiledesk.on('onInit', function(event_data) {
|
|
437
|
-
// setTimeout(() => {
|
|
438
|
-
// document.getElementById("preloader").style.display = "none";
|
|
439
|
-
// }, 1000);
|
|
440
|
-
|
|
441
|
-
// });
|
|
442
|
-
// };
|
|
443
|
-
|
|
444
423
|
function getQueryVariable(variable) {
|
|
445
424
|
var query = window.location.search.substring(1);
|
|
446
425
|
var vars = query.split("&");
|
|
@@ -460,11 +460,11 @@
|
|
|
460
460
|
document.getElementById('events').scrollTop = document.getElementById('events').scrollHeight
|
|
461
461
|
}, 1000);
|
|
462
462
|
//open widget after 3s if is closed
|
|
463
|
-
setTimeout(() => {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}, 3000);
|
|
463
|
+
// setTimeout(() => {
|
|
464
|
+
// if(event_data && event_data.detail && event_data.detail.global && !event_data.detail.global.isOpen){
|
|
465
|
+
// window.Tiledesk('open')
|
|
466
|
+
// }
|
|
467
|
+
// }, 3000);
|
|
468
468
|
});
|
|
469
469
|
|
|
470
470
|
window.Tiledesk('onAuthStateChanged', function(event_data) {
|
|
@@ -186,7 +186,6 @@ export class MQTTArchivedConversationsHandler extends ArchivedConversationsHandl
|
|
|
186
186
|
this.setClosingConversation(conversation.conversation_with, false);
|
|
187
187
|
this.logger.debug('[MQTTArchivedConversationsHandler] conversations:', conversation.uid, this.archivedConversations);
|
|
188
188
|
const index = this.searchIndexInArrayForConversationWith(this.archivedConversations, conversation.conversation_with);
|
|
189
|
-
console.log("NUOVA CONVER;.uid2" + conversation.uid)
|
|
190
189
|
if (index > -1) {
|
|
191
190
|
this.logger.debug('[MQTTArchivedConversationsHandler] TROVATO')
|
|
192
191
|
this.archivedConversations.splice(index, 1, conversation);
|
|
@@ -101,12 +101,19 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
101
101
|
}
|
|
102
102
|
this.chat21Service.chatClient.lastMessages(this.conversationWith, (err, messages) => {
|
|
103
103
|
if (!err) {
|
|
104
|
+
this.logger.log('[MQTTConversationHandlerSERVICE] message lastMessages:', messages);
|
|
104
105
|
messages.forEach(message => {
|
|
105
106
|
// this.addedMessage(msg);
|
|
106
107
|
const msg: MessageModel = message;
|
|
107
108
|
msg.uid = message.message_id;
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
|
|
110
|
+
//escape command message is already is in list checking by parendUid
|
|
111
|
+
if(this.messages.filter(message => message.attributes['parentUid'] === msg.uid).length > 0){
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (msg.attributes && msg.attributes.commands ) {
|
|
116
|
+
this.logger.debug('[MQTTConversationHandlerSERVICE] splitted message::::', this.messages)
|
|
110
117
|
this.addCommandMessage(msg)
|
|
111
118
|
} else {
|
|
112
119
|
// this.logger.debug('[MQTTConversationHandlerSERVICE] NOT splitted message::::', msg)
|
|
@@ -117,11 +124,16 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
117
124
|
});
|
|
118
125
|
const handler_message_added = this.chat21Service.chatClient.onMessageAddedInConversation(
|
|
119
126
|
this.conversationWith, (message, topic) => {
|
|
120
|
-
this.logger.log('[MQTTConversationHandlerSERVICE] message added:', message, 'on topic:', topic);
|
|
127
|
+
this.logger.log('[MQTTConversationHandlerSERVICE] message added:', message, 'on topic:', topic, this.messages);
|
|
121
128
|
// this.addedMessage(msg);
|
|
122
129
|
const msg: MessageModel = message;
|
|
123
130
|
msg.uid = message.message_id;
|
|
124
131
|
|
|
132
|
+
//escape command message is already is in list checking by parendUid
|
|
133
|
+
if(this.messages.filter(message => message.attributes['parentUid'] === msg.uid).length > 0){
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
125
137
|
if (msg.attributes && msg.attributes.commands) {
|
|
126
138
|
this.logger.debug('[MQTTConversationHandlerSERVICE] splitted message::::', msg)
|
|
127
139
|
this.addCommandMessage(msg)
|
|
@@ -133,7 +145,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
133
145
|
const handler_message_updated = this.chat21Service.chatClient.onMessageUpdatedInConversation(
|
|
134
146
|
this.conversationWith, (message, topic) => {
|
|
135
147
|
this.logger.log('[MQTTConversationHandlerSERVICE] message updated:', message, 'on topic:', topic);
|
|
136
|
-
this.
|
|
148
|
+
this.changed(message);
|
|
137
149
|
});
|
|
138
150
|
}
|
|
139
151
|
|
|
@@ -225,7 +237,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
225
237
|
/** */
|
|
226
238
|
private addedMessage(messageSnapshot: MessageModel) {
|
|
227
239
|
const msg = this.messageGenerate(messageSnapshot);
|
|
228
|
-
|
|
229
240
|
let isInfoMessage = messageType(MESSAGE_TYPE_INFO, msg)
|
|
230
241
|
if(isInfoMessage){
|
|
231
242
|
this.messageInfo.next(msg)
|
|
@@ -253,7 +264,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
253
264
|
|
|
254
265
|
|
|
255
266
|
/** */
|
|
256
|
-
private
|
|
267
|
+
private changed(patch: any) {
|
|
257
268
|
if(messageType(MESSAGE_TYPE_INFO, patch) ){
|
|
258
269
|
return;
|
|
259
270
|
}
|
|
@@ -400,18 +411,13 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
400
411
|
this.logger.log('[MQTTConversationHandlerSERVICE] updateMessageStatusReceived', msg);
|
|
401
412
|
if (msg['status'] < MSG_STATUS_RECEIVED) {
|
|
402
413
|
this.logger.log('[MQTTConversationHandlerSERVICE] status ', msg['status'], ' < (RECEIVED:200)', MSG_STATUS_RECEIVED);
|
|
414
|
+
let uid = msg.uid
|
|
415
|
+
msg.attributes.commands? uid = msg.attributes.parentUid: null
|
|
403
416
|
if (msg.sender !== this.loggedUser.uid && msg.status < MSG_STATUS_RECEIVED) {
|
|
404
417
|
this.logger.log('[MQTTConversationHandlerSERVICE] updating message with status received');
|
|
405
|
-
this.chat21Service.chatClient.updateMessageStatus(
|
|
418
|
+
this.chat21Service.chatClient.updateMessageStatus(uid, this.conversationWith, MSG_STATUS_RECEIVED, null);
|
|
406
419
|
}
|
|
407
420
|
}
|
|
408
|
-
// if (msg.status < MSG_STATUS_RECEIVED) {
|
|
409
|
-
// if (msg.sender !== this.loggedUser.uid && msg.status < MSG_STATUS_RECEIVED) {
|
|
410
|
-
// const urlNodeMessagesUpdate = this.urlNodeFirebase + '/' + msg.uid;
|
|
411
|
-
// this.logger.log('AGGIORNO STATO MESSAGGIO', urlNodeMessagesUpdate);
|
|
412
|
-
// firebase.database().ref(urlNodeMessagesUpdate).update({ status: MSG_STATUS_RECEIVED });
|
|
413
|
-
// }
|
|
414
|
-
// }
|
|
415
421
|
}
|
|
416
422
|
|
|
417
423
|
/**
|
|
@@ -192,7 +192,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
192
192
|
|
|
193
193
|
getLastConversation(callback: (conv: ConversationModel, error: string) => void): void {
|
|
194
194
|
this.chat21Service.chatClient.lastConversations( false, (err, conversations) => {
|
|
195
|
-
|
|
195
|
+
this.logger.debug('[MQTTConversationsHandler] getLastConversation ', conversations, 'err', err);
|
|
196
196
|
if (!err) {
|
|
197
197
|
if(conversations && conversations.length > 0){
|
|
198
198
|
callback(conversations[0], null)
|
|
@@ -224,7 +224,6 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
224
224
|
this.setClosingConversation(conversation.conversation_with, false);
|
|
225
225
|
this.logger.debug('[MQTTConversationsHandler] conversations:', conversation.uid, this.conversations);
|
|
226
226
|
const index = this.searchIndexInArrayForConversationWith(this.conversations, conversation.conversation_with);
|
|
227
|
-
console.log("NUOVA CONVER;.uid2" + conversation.uid)
|
|
228
227
|
if (index > -1) {
|
|
229
228
|
this.logger.debug('[MQTTConversationsHandler] TROVATO')
|
|
230
229
|
this.conversations.splice(index, 1, conversation);
|
package/src/launch.js
CHANGED
|
@@ -161,14 +161,73 @@ function loadIframe(tiledeskScriptBaseLocation) {
|
|
|
161
161
|
});
|
|
162
162
|
/**** END EVENST ****/
|
|
163
163
|
|
|
164
|
-
// ifrm.srcdoc = srcTileDesk
|
|
165
164
|
iDiv.appendChild(ifrm);
|
|
165
|
+
|
|
166
|
+
// buildIframeDOM(ifrm)
|
|
167
|
+
// ifrm.contentWindow.document.open();
|
|
168
|
+
// ifrm.document.srcdoc = srcTileDesk;
|
|
169
|
+
// ifrm.srcdoc = srcTileDesk
|
|
166
170
|
ifrm.contentWindow.document.open();
|
|
167
171
|
ifrm.contentWindow.document.write(srcTileDesk);
|
|
168
172
|
ifrm.contentWindow.document.close();
|
|
169
173
|
|
|
170
174
|
}
|
|
171
175
|
|
|
176
|
+
function buildIframeDOM(iframe){
|
|
177
|
+
|
|
178
|
+
var meta = document.createElement('meta');
|
|
179
|
+
meta.setAttribute('charset', 'utf-8')
|
|
180
|
+
var meta_2 = document.createElement('meta')
|
|
181
|
+
meta_2.setAttribute('name', 'viewport')
|
|
182
|
+
meta_2.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0')
|
|
183
|
+
var title = document.createElement('title')
|
|
184
|
+
title.title = 'Tilechat Widget'
|
|
185
|
+
var base = document.createElement('base')
|
|
186
|
+
base.setAttribute('href', './')
|
|
187
|
+
var link_1 = document.createElement('link')
|
|
188
|
+
link_1.setAttribute('rel', 'icon')
|
|
189
|
+
link_1.setAttribute('type', 'image/x-icon')
|
|
190
|
+
link_1.setAttribute('href', 'favicon.ico')
|
|
191
|
+
var link_2 = document.createElement('link')
|
|
192
|
+
link_2.setAttribute('rel', 'stylesheet')
|
|
193
|
+
link_2.setAttribute('type', 'text/css')
|
|
194
|
+
link_2.setAttribute('href', tiledeskScriptBaseLocation + '/assets/styles/tiledesk_v1.scss')
|
|
195
|
+
link_2.setAttribute('media','all')
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
let head = iframe.contentWindow.document.getElementsByTagName('head')[0]
|
|
199
|
+
head.appendChild(meta)
|
|
200
|
+
head.appendChild(meta_2)
|
|
201
|
+
head.appendChild(title)
|
|
202
|
+
head.appendChild(base)
|
|
203
|
+
head.appendChild(link_1)
|
|
204
|
+
head.appendChild(link_2)
|
|
205
|
+
|
|
206
|
+
var script_1 = document.createElement('script')
|
|
207
|
+
script_1.setAttribute('type','text/javascript')
|
|
208
|
+
script_1.setAttribute('src',tiledeskScriptBaseLocation + '/runtime.js')
|
|
209
|
+
var script_2 = document.createElement('script')
|
|
210
|
+
script_2.setAttribute('type','text/javascript')
|
|
211
|
+
script_2.setAttribute('src',tiledeskScriptBaseLocation + '/polyfills.js')
|
|
212
|
+
var script_3 = document.createElement('script')
|
|
213
|
+
script_3.setAttribute('type','text/javascript')
|
|
214
|
+
script_3.setAttribute('src',tiledeskScriptBaseLocation + '/styles.css')
|
|
215
|
+
var script_4 = document.createElement('script')
|
|
216
|
+
script_4.setAttribute('type','text/javascript')
|
|
217
|
+
script_4.setAttribute('src',tiledeskScriptBaseLocation + '/vendor.js')
|
|
218
|
+
var script_5 = document.createElement('script')
|
|
219
|
+
script_5.setAttribute('type','text/javascript')
|
|
220
|
+
script_5.setAttribute('src',tiledeskScriptBaseLocation + '/main.js')
|
|
221
|
+
|
|
222
|
+
let body= iframe.contentWindow.document.getElementsByTagName('body')[0]
|
|
223
|
+
body.appendChild(document.createElement('chat-root'))
|
|
224
|
+
body.appendChild(script_1)
|
|
225
|
+
body.appendChild(script_2)
|
|
226
|
+
body.appendChild(script_3)
|
|
227
|
+
body.appendChild(script_4)
|
|
228
|
+
body.appendChild(script_5)
|
|
229
|
+
}
|
|
230
|
+
|
|
172
231
|
|
|
173
232
|
function initAysncEvents() {
|
|
174
233
|
console.log('INIT ASYNC EVENTS')
|
package/src/test.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Widget Test Page</title>
|
|
8
|
-
<script type="application/javascript">
|
|
8
|
+
<script type="application/javascript" async>
|
|
9
9
|
// Handler for .ready() called.
|
|
10
10
|
window.tiledeskSettings =
|
|
11
11
|
{
|