@chat21/chat21-web-widget 5.1.0-rc10 → 5.1.0-rc12
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 +15 -0
- package/angular.json +2 -2
- package/deploy_beta.sh +10 -0
- package/deploy_prod.sh +9 -0
- package/package.json +1 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +69 -40
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.scss +1 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +7 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +8 -1
- package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +14 -0
- package/src/chat21-core/utils/constants.ts +2 -0
- package/src/chat21-core/utils/utils-message.ts +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
+
# 5.1.0-rc12
|
|
10
|
+
- **added**: ability to get all my request from Tiledesk API
|
|
11
|
+
|
|
12
|
+
# 5.1.0-rc11
|
|
13
|
+
- **bug-fixed**: removed private note msgs
|
|
14
|
+
|
|
9
15
|
# 5.1.0-rc10
|
|
10
16
|
- **bug-fixed**: minor fix allowed urls
|
|
11
17
|
|
|
@@ -30,6 +36,15 @@
|
|
|
30
36
|
|
|
31
37
|
# 5.1.0-rc2
|
|
32
38
|
- **added**: angular 17
|
|
39
|
+
# 5.0.99
|
|
40
|
+
|
|
41
|
+
# 5.0.99-rc1
|
|
42
|
+
- **bug-fixed**: audio duration not showed in mobile browser
|
|
43
|
+
|
|
44
|
+
# 5.0.98
|
|
45
|
+
- **bug-fixed**: meta info not rendered correctly
|
|
46
|
+
|
|
47
|
+
# 5.0.97
|
|
33
48
|
|
|
34
49
|
# 5.0.96
|
|
35
50
|
|
package/angular.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"index": "src/index.html",
|
|
25
25
|
"polyfills": [
|
|
26
26
|
"src/polyfills.ts",
|
|
27
|
-
"@angular/localize/init"
|
|
27
|
+
"@angular/localize/init"
|
|
28
28
|
],
|
|
29
29
|
"tsConfig": "tsconfig.app.json",
|
|
30
30
|
"assets": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
],
|
|
52
52
|
"scripts": [
|
|
53
53
|
"src/assets/js/mqtt/4.2.6/mqtt.min.js",
|
|
54
|
-
"node_modules/bootstrap/dist/js/bootstrap.min.js"
|
|
54
|
+
"node_modules/bootstrap/dist/js/bootstrap.min.js"
|
|
55
55
|
],
|
|
56
56
|
"extractLicenses": false,
|
|
57
57
|
"allowedCommonJsDependencies": [
|
package/deploy_beta.sh
CHANGED
|
@@ -4,6 +4,16 @@ echo "version $version"
|
|
|
4
4
|
echo "____________WIDGET-V5______________"
|
|
5
5
|
echo "CREATING TAG ON GIT FOR version: $version"
|
|
6
6
|
|
|
7
|
+
# Get curent branch name
|
|
8
|
+
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
9
|
+
remote_name=$(git config --get branch.$current_branch.remote)
|
|
10
|
+
|
|
11
|
+
## Push commit to git
|
|
12
|
+
git add .
|
|
13
|
+
git commit -m "version added: ### $version"
|
|
14
|
+
git push "$remote_name" "$current_branch"
|
|
15
|
+
|
|
16
|
+
|
|
7
17
|
# Get curent branch name
|
|
8
18
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
9
19
|
remote_name=$(git config --get branch.$current_branch.remote)
|
package/deploy_prod.sh
CHANGED
|
@@ -13,6 +13,15 @@ git add .
|
|
|
13
13
|
git commit -m "version added: ### $version"
|
|
14
14
|
git push "$remote_name" "$current_branch"
|
|
15
15
|
|
|
16
|
+
# Get curent branch name
|
|
17
|
+
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
18
|
+
remote_name=$(git config --get branch.$current_branch.remote)
|
|
19
|
+
|
|
20
|
+
## Push commit to git
|
|
21
|
+
git add .
|
|
22
|
+
git commit -m "version added: ### $version"
|
|
23
|
+
git push "$remote_name" "$current_branch"
|
|
24
|
+
|
|
16
25
|
if [ "$version" != "" ]; then
|
|
17
26
|
git tag -a "$version" -m "`git log -1 --format=%s`"
|
|
18
27
|
echo "Created a new tag, $version"
|
package/package.json
CHANGED
|
@@ -363,14 +363,21 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
363
363
|
// this.logger.debug('[CONV-COMP] ------ 5: updateConversationbage ------ ');
|
|
364
364
|
// this.updateConversationBadge();
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
this.getConversationDetail((isConversationArchived) => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}) //check if conv is archived or not
|
|
366
|
+
|
|
367
|
+
// this.getConversationDetail((isConversationArchived) => {
|
|
368
|
+
// this.logger.debug('[CONV-COMP] ------ 6: updateConversationbage ------ ');
|
|
369
|
+
// this.updateConversationBadge();
|
|
370
|
+
// return;
|
|
371
|
+
// }) //check if conv is archived or not
|
|
372
372
|
// this.checkListMessages();
|
|
373
373
|
|
|
374
|
+
this.logger.debug('[CONV-COMP] ------ 5: getConversationDetail ------ ', this.conversationId);
|
|
375
|
+
await this.getConversationDetail();
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
this.logger.debug('[CONV-COMP] ------ 6: updateConversationBadge ------ ');
|
|
379
|
+
this.updateConversationBadge();
|
|
380
|
+
|
|
374
381
|
if(this.g.customAttributes){
|
|
375
382
|
this.updateUserInfo(this.g.customAttributes)
|
|
376
383
|
}
|
|
@@ -384,7 +391,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
384
391
|
* @param callback
|
|
385
392
|
* @returns isConversationArchived (status conversation archived: boolean)
|
|
386
393
|
*/
|
|
387
|
-
|
|
394
|
+
getConversationDetail_old(callback:(isConversationArchived: boolean)=>void){
|
|
388
395
|
// if(!this.isConversationArchived){
|
|
389
396
|
//get conversation from 'conversations' firebase node
|
|
390
397
|
this.logger.debug('[CONV-COMP] getConversationDetail: isConversationArchived???', this.isConversationArchived, this.conversationWith)
|
|
@@ -414,39 +421,60 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
414
421
|
})
|
|
415
422
|
}
|
|
416
423
|
});
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* @description get detail of conversation by uid and then return callback with conversation status
|
|
428
|
+
* @param callback
|
|
429
|
+
* @returns isConversationArchived (status conversation archived: boolean)
|
|
430
|
+
*/
|
|
431
|
+
async getConversationDetail(): Promise<boolean | null> {
|
|
432
|
+
this.logger.debug('[CONV-COMP] getConversationDetail: isConversationArchived???', this.isConversationArchived, this.conversationWith);
|
|
433
|
+
|
|
434
|
+
const conv = await new Promise<any>((resolve) => {
|
|
435
|
+
this.conversationsHandlerService.getConversationDetail(this.conversationWith, resolve);
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
if (conv) {
|
|
439
|
+
this.logger.debug('[CONV-COMP] getConversationDetail: conversationsHandlerService ', this.conversationWith, conv, this.isConversationArchived);
|
|
440
|
+
this.conversation = conv;
|
|
441
|
+
this.isConversationArchived = false;
|
|
442
|
+
return this.isConversationArchived;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
this.logger.debug('[CONV-COMP] getConversationDetail: conv not exist --> search in archived list', this.isConversationArchived, this.conversationWith);
|
|
446
|
+
|
|
447
|
+
const archivedConv = await new Promise<any>((resolve) => {
|
|
448
|
+
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, resolve);
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
if (archivedConv) {
|
|
452
|
+
this.logger.debug('[CONV-COMP] getConversationDetail: archivedConversationsHandlerService', this.conversationWith, archivedConv, this.isConversationArchived);
|
|
453
|
+
this.conversation = archivedConv;
|
|
454
|
+
this.isConversationArchived = true;
|
|
455
|
+
return this.isConversationArchived;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
//FALLBACK TO TILEDESK
|
|
459
|
+
const requests_list = await this.tiledeskRequestService.getMyRequests().catch(err => {
|
|
460
|
+
this.logger.error('[CONV-COMP] getConversationDetail: error getting request from Tiledesk', err);
|
|
461
|
+
this.isConversationArchived=true
|
|
462
|
+
return { requests: [] }
|
|
463
|
+
});
|
|
464
|
+
if (requests_list && requests_list.requests.length > 0) {
|
|
465
|
+
this.logger.debug('[CONV-COMP] getConversationDetail: request exist on Tiledesk', requests_list);
|
|
466
|
+
let conversation = requests_list.requests.find((request)=> request.request_id === this.conversationId)
|
|
467
|
+
if(conversation){
|
|
468
|
+
this.isConversationArchived = false
|
|
469
|
+
return this.isConversationArchived
|
|
470
|
+
}
|
|
471
|
+
this.logger.debug('[CONV-COMP] getConversationDetail: request NOT EXIST on Tiledesk', requests_list);
|
|
472
|
+
this.isConversationArchived = true
|
|
473
|
+
return this.isConversationArchived
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
this.isConversationArchived = true;
|
|
477
|
+
return null;
|
|
450
478
|
}
|
|
451
479
|
|
|
452
480
|
/**
|
|
@@ -744,6 +772,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
744
772
|
subscribtion = this.conversationHandlerService.messageAdded.pipe(takeUntil(this.unsubscribe$)).subscribe((msg: MessageModel) => {
|
|
745
773
|
this.logger.debug('[CONV-COMP] ***** DETAIL messageAdded *****', msg);
|
|
746
774
|
if (msg) {
|
|
775
|
+
|
|
747
776
|
that.newMessageAdded(msg);
|
|
748
777
|
this.checkMessagesLegntForTranscriptDownloadMenuOption();
|
|
749
778
|
this.resetTimeout();
|
|
@@ -15,7 +15,7 @@ import { LoggerService } from '../abstract/logger.service';
|
|
|
15
15
|
import { LoggerInstance } from '../logger/loggerInstance';
|
|
16
16
|
|
|
17
17
|
// utils
|
|
18
|
-
import { MSG_STATUS_RECEIVED, TYPE_DIRECT, MESSAGE_TYPE_INFO, INFO_MESSAGE_TYPE } from '../../utils/constants';
|
|
18
|
+
import { MSG_STATUS_RECEIVED, TYPE_DIRECT, MESSAGE_TYPE_INFO, INFO_MESSAGE_TYPE, MESSAGE_TYPE_PRIVATE } from '../../utils/constants';
|
|
19
19
|
import { compareValues, searchIndexInArrayForUid, conversationMessagesRef } from '../../utils/utils';
|
|
20
20
|
import { v4 as uuidv4 } from 'uuid';
|
|
21
21
|
import { messageType, checkIfIsMemberJoinedGroup, hideInfoMessage, isJustRecived, isSender, infoMessageType } from '../../utils/utils-message';
|
|
@@ -230,6 +230,12 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
230
230
|
private addedNew(message:MessageModel){
|
|
231
231
|
const msg = this.messageCommandGenerate(message);
|
|
232
232
|
if(this.isValidMessage(msg)){
|
|
233
|
+
|
|
234
|
+
// do not add 'private' msg in widget array messages
|
|
235
|
+
let isPrivateMessage = messageType(MESSAGE_TYPE_PRIVATE, msg)
|
|
236
|
+
if(isPrivateMessage){
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
233
239
|
// msg.attributes && msg.attributes['subtype'] === 'info'
|
|
234
240
|
let isInfoMessage = messageType(MESSAGE_TYPE_INFO, msg)
|
|
235
241
|
if(isInfoMessage){
|
|
@@ -15,7 +15,7 @@ import { UserModel } from '../../models/user';
|
|
|
15
15
|
import { ConversationHandlerService } from '../abstract/conversation-handler.service';
|
|
16
16
|
|
|
17
17
|
// utils
|
|
18
|
-
import { MSG_STATUS_RECEIVED, TYPE_DIRECT, MESSAGE_TYPE_INFO, INFO_MESSAGE_TYPE } from '../../utils/constants';
|
|
18
|
+
import { MSG_STATUS_RECEIVED, TYPE_DIRECT, MESSAGE_TYPE_INFO, INFO_MESSAGE_TYPE, MESSAGE_TYPE_PRIVATE } from '../../utils/constants';
|
|
19
19
|
import { compareValues, searchIndexInArrayForUid } from '../../utils/utils';
|
|
20
20
|
import { messageType, checkIfIsMemberJoinedGroup, hideInfoMessage, isJustRecived, isSender, infoMessageType } from '../../utils/utils-message';
|
|
21
21
|
import { v4 as uuidv4 } from 'uuid';
|
|
@@ -262,6 +262,13 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
262
262
|
/** */
|
|
263
263
|
private addedMessage(messageSnapshot: MessageModel): Promise<boolean> {
|
|
264
264
|
const msg = this.messageGenerate(messageSnapshot);
|
|
265
|
+
|
|
266
|
+
// do not add 'private' msg in widget array messages
|
|
267
|
+
let isPrivateMessage = messageType(MESSAGE_TYPE_PRIVATE, msg)
|
|
268
|
+
if(isPrivateMessage){
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
265
272
|
let isInfoMessage = messageType(MESSAGE_TYPE_INFO, msg)
|
|
266
273
|
if(isInfoMessage){
|
|
267
274
|
this.messageInfo.next(msg)
|
|
@@ -68,4 +68,18 @@ export class TiledeskRequestsService {
|
|
|
68
68
|
return res
|
|
69
69
|
})
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
public getMyRequests(): Promise<{ requests: Array<any>}> {
|
|
73
|
+
this.tiledeskToken = this.appStorage.getItem('tiledeskToken')
|
|
74
|
+
const url = this.URL_TILEDESK_REQUEST + '/me?preflight=true'
|
|
75
|
+
this.logger.log('[TILEDESK-SERVICE] - GET REQUEST url ', url);
|
|
76
|
+
const httpOptions = {
|
|
77
|
+
headers: new HttpHeaders({
|
|
78
|
+
'Content-Type': 'application/json',
|
|
79
|
+
Authorization: this.tiledeskToken
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return this.http.get<{ requests: Array<any>}>(url, httpOptions).toPromise()
|
|
84
|
+
}
|
|
71
85
|
}
|
|
@@ -71,6 +71,8 @@ export const TYPE_POPUP_DETAIL_MESSAGE = 'DETAIL_MESSAGE';
|
|
|
71
71
|
export const MESSAGE_TYPE_INFO = 'INFO';
|
|
72
72
|
export const MESSAGE_TYPE_MINE = 'MINE';
|
|
73
73
|
export const MESSAGE_TYPE_OTHERS = 'OTHERS';
|
|
74
|
+
export const MESSAGE_TYPE_PRIVATE = 'PRIVATE';
|
|
75
|
+
|
|
74
76
|
|
|
75
77
|
export enum INFO_MESSAGE_TYPE {
|
|
76
78
|
CHAT_REOPENED = 'CHAT_REOPENED',
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
MESSAGE_TYPE_OTHERS,
|
|
8
8
|
MAX_WIDTH_IMAGES,
|
|
9
9
|
INFO_MESSAGE_TYPE,
|
|
10
|
-
CHANNEL_TYPE
|
|
10
|
+
CHANNEL_TYPE,
|
|
11
|
+
MESSAGE_TYPE_PRIVATE
|
|
11
12
|
} from '../../chat21-core/utils/constants';
|
|
12
13
|
/** */
|
|
13
14
|
export function isCarousel(message: any) {
|
|
@@ -103,10 +104,20 @@ export function isFirstMessage(messages, senderId, index):boolean{
|
|
|
103
104
|
return false;
|
|
104
105
|
}
|
|
105
106
|
|
|
107
|
+
export function isPrivate(message: any) {
|
|
108
|
+
if (message && message.attributes && message.attributes.subtype === 'private') {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
|
|
107
115
|
/** */
|
|
108
116
|
export function messageType(msgType: string, message: any) {
|
|
109
117
|
|
|
118
|
+
if (msgType === MESSAGE_TYPE_PRIVATE) {
|
|
119
|
+
return isPrivate(message);
|
|
120
|
+
}
|
|
110
121
|
if (msgType === MESSAGE_TYPE_INFO) {
|
|
111
122
|
return isInfo(message);
|
|
112
123
|
}
|