@chat21/chat21-web-widget 5.0.71-rc.1 → 5.0.71-rc.12
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/.github/workflows/build.yml +2 -2
- package/CHANGELOG.md +40 -0
- package/Dockerfile +1 -1
- package/package.json +1 -1
- package/src/app/app.component.ts +73 -94
- package/src/app/component/conversation-detail/conversation/conversation.component.html +3 -2
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +3 -2
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +4 -11
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +2 -3
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +2 -4
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +1 -1
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +8 -4
- package/src/app/component/last-message/last-message.component.scss +1 -1
- package/src/app/component/message/carousel/carousel.component.html +1 -1
- package/src/app/component/message/carousel/carousel.component.scss +1 -0
- package/src/app/component/message/carousel/carousel.component.ts +5 -4
- package/src/app/component/message/image/image.component.ts +0 -3
- package/src/app/providers/global-settings.service.ts +5 -0
- package/src/app/providers/translator.service.ts +2 -4
- package/src/app/sass/_variables.scss +1 -1
- package/src/app/utils/constants.ts +0 -3
- package/src/app/utils/globals.ts +4 -4
- package/src/app/utils/rules.ts +1 -1
- package/src/assets/i18n/en.json +5 -6
- package/src/assets/i18n/es.json +13 -10
- package/src/assets/i18n/fr.json +13 -10
- package/src/assets/i18n/it.json +13 -10
- package/src/assets/js/chat21client.js +5 -2
- package/src/assets/twp/chatbot-panel.html +205 -13
- package/src/assets/twp/index-dev.html +141 -33
- package/src/assets/twp/index.html +125 -39
- package/src/chat21-core/models/upload.ts +0 -1
- package/src/chat21-core/providers/abstract/upload.service.ts +3 -0
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +3 -3
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +11 -20
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +2 -1
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +128 -6
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +11 -21
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +7 -1
- package/src/chat21-core/providers/native/native-upload-service.ts +68 -0
- package/src/chat21-core/utils/constants.ts +24 -8
- package/src/chat21-core/utils/triggerHandler.ts +0 -1
- package/src/chat21-core/utils/utils-message.ts +31 -1
- package/src/chat21-core/utils/utils.ts +0 -39
- package/src/launch.js +0 -1
- package/src/widget-config-template.json +2 -2
- package/src/widget-config.json +2 -1
|
@@ -334,6 +334,11 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
334
334
|
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
335
335
|
conv.type = snap[k];
|
|
336
336
|
}
|
|
337
|
+
if (k === 'conversation_with_fullname') {
|
|
338
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
339
|
+
conv.conversation_with_fullname = snap[k];
|
|
340
|
+
}
|
|
341
|
+
conv = this.completeConversation(conv)
|
|
337
342
|
|
|
338
343
|
});
|
|
339
344
|
}
|
|
@@ -379,7 +384,8 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
379
384
|
this.isConversationClosingMap.delete(conversationId);
|
|
380
385
|
}
|
|
381
386
|
|
|
382
|
-
archiveConversation(conversationId: string) {
|
|
387
|
+
archiveConversation(conversationId: string) {
|
|
388
|
+
this.setConversationRead(conversationId)
|
|
383
389
|
this.chat21Service.chatClient.archiveConversation(conversationId);
|
|
384
390
|
}
|
|
385
391
|
|
|
@@ -77,4 +77,72 @@ export class NativeUploadService extends UploadService {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
uploadProfile(userId: string, upload: UploadModel): Promise<any> {
|
|
82
|
+
this.logger.log('[NATIVE UPLOAD] - upload new photo profile ... upload', upload)
|
|
83
|
+
const headers = new HttpHeaders({
|
|
84
|
+
Authorization: this.tiledeskToken,
|
|
85
|
+
// 'Content-Type': 'multipart/form-data',
|
|
86
|
+
});
|
|
87
|
+
const requestOptions = { headers: headers };
|
|
88
|
+
const formData = new FormData();
|
|
89
|
+
formData.append('file', upload.file);
|
|
90
|
+
|
|
91
|
+
// USE IMAGE API
|
|
92
|
+
const that = this;
|
|
93
|
+
const url = this.URL_TILEDESK_IMAGES + `/users/photo?force=true&user_id=${userId}`
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
that.http.put(url, formData, requestOptions).subscribe(data => {
|
|
96
|
+
const downloadURL = this.URL_TILEDESK_IMAGES + '?path=' + data['thumbnail'];
|
|
97
|
+
resolve(downloadURL)
|
|
98
|
+
// that.BSStateUpload.next({upload: upload});
|
|
99
|
+
}, (error) => {
|
|
100
|
+
reject(error)
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
delete(userId: string, path: string): Promise<any>{
|
|
106
|
+
this.logger.log('[NATIVE UPLOAD] - delete image ... upload', userId)
|
|
107
|
+
const headers = new HttpHeaders({
|
|
108
|
+
Authorization: this.tiledeskToken,
|
|
109
|
+
//'Content-Type': 'multipart/form-data',
|
|
110
|
+
});
|
|
111
|
+
const requestOptions = { headers: headers };
|
|
112
|
+
|
|
113
|
+
//USE IMAGE API
|
|
114
|
+
const that = this;
|
|
115
|
+
const url = this.URL_TILEDESK_IMAGES + '/users' + '?path=' + path.split('path=')[1]
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
that.http.delete(url, requestOptions).subscribe(data => {
|
|
118
|
+
// const downloadURL = this.URL_TILEDESK_IMAGES + '?path=' + data['filename'];
|
|
119
|
+
resolve(true)
|
|
120
|
+
// that.BSStateUpload.next({upload: upload});
|
|
121
|
+
}, (error) => {
|
|
122
|
+
reject(error)
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
deleteProfile(userId: string, path: string): Promise<any>{
|
|
128
|
+
this.logger.log('[NATIVE UPLOAD] - delete image ... upload', userId)
|
|
129
|
+
const headers = new HttpHeaders({
|
|
130
|
+
Authorization: this.tiledeskToken,
|
|
131
|
+
//'Content-Type': 'multipart/form-data',
|
|
132
|
+
});
|
|
133
|
+
const requestOptions = { headers: headers };
|
|
134
|
+
|
|
135
|
+
//USE IMAGE API
|
|
136
|
+
const that = this;
|
|
137
|
+
const url = this.URL_TILEDESK_IMAGES + '/users' + '?path=' + "uploads/users/"+ userId + "/images/photo.jpg"
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
that.http.delete(url, requestOptions).subscribe(data => {
|
|
140
|
+
// const downloadURL = this.URL_TILEDESK_IMAGES + '?path=' + data['filename'];
|
|
141
|
+
resolve(true)
|
|
142
|
+
// that.BSStateUpload.next({upload: upload});
|
|
143
|
+
}, (error) => {
|
|
144
|
+
reject(error)
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
80
148
|
}
|
|
@@ -68,13 +68,15 @@ export const MESSAGE_TYPE_INFO = 'INFO';
|
|
|
68
68
|
export const MESSAGE_TYPE_MINE = 'MINE';
|
|
69
69
|
export const MESSAGE_TYPE_OTHERS = 'OTHERS';
|
|
70
70
|
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
export enum INFO_MESSAGE_TYPE {
|
|
72
|
+
CHAT_REOPENED = 'CHAT_REOPENED',
|
|
73
|
+
CHAT_CLOSED = 'CHAT_CLOSED',
|
|
74
|
+
MEMBER_JOINED_GROUP = 'MEMBER_JOINED_GROUP',
|
|
75
|
+
MEMBER_LEFT_GROUP = "MEMBER_LEFT_GROUP",
|
|
76
|
+
LEAD_UPDATED = "LEAD_UPDATED",
|
|
77
|
+
TOUCHING_OPERATOR = "TOUCHING_OPERATOR",
|
|
78
|
+
LIVE_PAGE = "LIVE_PAGE"
|
|
79
|
+
}
|
|
78
80
|
|
|
79
81
|
// URLS
|
|
80
82
|
// export const URL_SOUND = 'assets/sounds/pling.mp3';
|
|
@@ -114,4 +116,18 @@ export const LogLevel = {
|
|
|
114
116
|
'WARN' : 1,
|
|
115
117
|
'INFO' : 2,
|
|
116
118
|
'DEBUG' : 3
|
|
117
|
-
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export enum PLAN_NAME {
|
|
122
|
+
A = 'Growth',
|
|
123
|
+
B = 'Scale',
|
|
124
|
+
C = 'Plus',
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export enum TYPE_BUTTON {
|
|
128
|
+
TEXT = 'text',
|
|
129
|
+
URL = 'url',
|
|
130
|
+
ACTION = 'action'
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const tranlatedLanguage = ['it', 'en', 'de', 'es', 'pt', 'fr', 'ru', 'tr', 'sr', 'ar', 'uk', 'sv', 'az', 'kk', 'uz']
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DepartmentModel } from './../../models/department';
|
|
2
2
|
import { Injectable, ElementRef } from '@angular/core';
|
|
3
|
-
import { Globals } from '../../app/utils/globals';
|
|
4
3
|
import { ConversationModel } from '../models/conversation';
|
|
5
4
|
import { LoggerInstance } from '../providers/logger/loggerInstance';
|
|
6
5
|
import { LoggerService } from '../providers/abstract/logger.service';
|
|
@@ -7,9 +7,18 @@ import {
|
|
|
7
7
|
MESSAGE_TYPE_OTHERS,
|
|
8
8
|
MAX_WIDTH_IMAGES,
|
|
9
9
|
CHANNEL_TYPE_GROUP,
|
|
10
|
-
TYPE_SUPPORT_GROUP
|
|
10
|
+
TYPE_SUPPORT_GROUP,
|
|
11
|
+
INFO_MESSAGE_TYPE
|
|
11
12
|
} from './constants';
|
|
12
13
|
|
|
14
|
+
/** */
|
|
15
|
+
export function isCarousel(message: any) {
|
|
16
|
+
if (message && message.type && message.type === 'gallery' && message?.attributes && message?.attributes?.attachment && message?.attributes?.attachment?.gallery ) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
/** */
|
|
14
23
|
export function isImage(message: any) {
|
|
15
24
|
if (message && message.type && message.type === 'image' && message.metadata && message.metadata.src) {
|
|
@@ -114,6 +123,27 @@ export function messageType(msgType: string, message: any) {
|
|
|
114
123
|
}
|
|
115
124
|
}
|
|
116
125
|
|
|
126
|
+
export function infoMessageType(msg: MessageModel): string{
|
|
127
|
+
if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.MEMBER_JOINED_GROUP){
|
|
128
|
+
return INFO_MESSAGE_TYPE.MEMBER_JOINED_GROUP
|
|
129
|
+
}
|
|
130
|
+
if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.CHAT_REOPENED){
|
|
131
|
+
return INFO_MESSAGE_TYPE.CHAT_REOPENED
|
|
132
|
+
}
|
|
133
|
+
if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.TOUCHING_OPERATOR){
|
|
134
|
+
return INFO_MESSAGE_TYPE.TOUCHING_OPERATOR
|
|
135
|
+
}
|
|
136
|
+
if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.LEAD_UPDATED){
|
|
137
|
+
return INFO_MESSAGE_TYPE.LEAD_UPDATED
|
|
138
|
+
}
|
|
139
|
+
if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP){
|
|
140
|
+
return INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP
|
|
141
|
+
}
|
|
142
|
+
if(msg && msg.attributes.messagelabel && msg.attributes.messagelabel.key === INFO_MESSAGE_TYPE.LIVE_PAGE){
|
|
143
|
+
return INFO_MESSAGE_TYPE.LIVE_PAGE
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
117
147
|
/** */
|
|
118
148
|
export function getSizeImg(message: any, maxWidthImage?: number): any {
|
|
119
149
|
try {
|
|
@@ -284,41 +284,6 @@ function convertUrlToTag(url) {
|
|
|
284
284
|
//// <a href="#" onclick="openPopup(' + url + ')">' + url + '</a>';
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
|
|
288
|
-
export function isPopupUrl(url) {
|
|
289
|
-
try {
|
|
290
|
-
const TEMP = url.split('popup=')[1];
|
|
291
|
-
// può essere seguito da & oppure "
|
|
292
|
-
if (TEMP) {
|
|
293
|
-
if (TEMP.startsWith('true')) {
|
|
294
|
-
return true;
|
|
295
|
-
} else {
|
|
296
|
-
return false;
|
|
297
|
-
}
|
|
298
|
-
} else {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
} catch (e) {
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export function popupUrl(windowContext, html, title) {
|
|
307
|
-
const url = stripTags(html);
|
|
308
|
-
const w = 600;
|
|
309
|
-
const h = 600; // screen.height - 40;
|
|
310
|
-
const left = (screen.width / 2) - (w / 2);
|
|
311
|
-
const top = (screen.height / 2) - (h / 2);
|
|
312
|
-
|
|
313
|
-
// tslint:disable-next-line:whitespace
|
|
314
|
-
// tslint:disable-next-line:max-line-length
|
|
315
|
-
const newWindow = windowContext.open(url, '_blank', 'fullscreen=1, titlebar=0, toolbar=no, location=0, status=0, menubar=0, scrollbars=0, resizable=0, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
|
316
|
-
if (windowContext.focus) {
|
|
317
|
-
newWindow.focus();
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
287
|
export function encodeHTML(str) {
|
|
323
288
|
return convert(str);
|
|
324
289
|
// return str.replace(/[\u00A0-\u9999<>&](?!#)/gim, function(i) {
|
|
@@ -343,10 +308,6 @@ function convert(str) {
|
|
|
343
308
|
return str;
|
|
344
309
|
}
|
|
345
310
|
|
|
346
|
-
export function stripTags(html) {
|
|
347
|
-
return (html.replace(/<.*?>/g, '')).trim();
|
|
348
|
-
}
|
|
349
|
-
|
|
350
311
|
export function htmlEntities(str) {
|
|
351
312
|
return String(str)
|
|
352
313
|
.replace(/&/g, '&')
|
package/src/launch.js
CHANGED
|
@@ -35,7 +35,6 @@ function ready(callbackFunction){
|
|
|
35
35
|
document.removeEventListener('mousedown', start);
|
|
36
36
|
document.removeEventListener('mousemove', start);
|
|
37
37
|
document.removeEventListener('touchstart', start);
|
|
38
|
-
document.removeEventListener('scroll', start);
|
|
39
38
|
document.removeEventListener('keydown', start);
|
|
40
39
|
}
|
|
41
40
|
|