@chat21/chat21-web-widget 5.0.100 → 5.0.102
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 -2
- package/package.json +1 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +0 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +8 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +9 -1
- package/src/chat21-core/utils/constants.ts +2 -0
- package/src/chat21-core/utils/utils-message.ts +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
-
# 5.0.
|
|
10
|
-
- **bug-fixed**:
|
|
9
|
+
# 5.0.102
|
|
10
|
+
- **bug-fixed**: cannot add message if array is empty
|
|
11
|
+
|
|
12
|
+
# 5.0.101
|
|
13
|
+
- **bug-fixed**: removed private note msgs
|
|
11
14
|
|
|
12
15
|
# 5.0.99
|
|
13
16
|
|
package/package.json
CHANGED
|
@@ -407,7 +407,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
407
407
|
// duration.hours < this.g.continueConversationBeforeTime? this.showContinueConversationButton = true: this.showContinueConversationButton = false
|
|
408
408
|
callback(this.isConversationArchived)
|
|
409
409
|
}else if(!conv) {
|
|
410
|
-
this.isConversationArchived = true
|
|
411
410
|
callback(null);
|
|
412
411
|
}
|
|
413
412
|
})
|
|
@@ -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){
|
|
@@ -464,6 +470,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
464
470
|
const that = this;
|
|
465
471
|
const commands = msg.attributes.commands;
|
|
466
472
|
let i=0;
|
|
473
|
+
if(commands.length === 0) return;
|
|
467
474
|
return new Promise((resolve, reject)=>{
|
|
468
475
|
function execute(command){
|
|
469
476
|
if(command.type === "message"){
|
|
@@ -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)
|
|
@@ -458,6 +465,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
458
465
|
const that = this;
|
|
459
466
|
const commands = msg.attributes.commands;
|
|
460
467
|
let i=0;
|
|
468
|
+
if(commands.length === 0) return;
|
|
461
469
|
return new Promise((resolve, reject)=>{
|
|
462
470
|
function execute(command){
|
|
463
471
|
if(command.type === "message"){
|
|
@@ -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
|
}
|