@chat21/chat21-ionic 3.0.88-rc.2 → 3.0.89-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/components/canned-response/canned-response.component.ts +16 -15
- package/src/app/pages/conversation-detail/conversation-detail.page.html +1 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +21 -19
- package/src/app/pages/conversations-list/conversations-list.page.ts +10 -1
- package/src/chat-config-native-mqtt.json +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +14 -13
- package/src/chat21-core/utils/utils-message.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.89-rc.1
|
|
4
|
+
- bug-fixed: projectId/project_name is undefined in conversations-list component
|
|
5
|
+
|
|
6
|
+
### 3.0.88 in PROD
|
|
7
|
+
|
|
3
8
|
### 3.0.88-rc.2
|
|
4
9
|
- added: enable email only if active by env parameter
|
|
5
10
|
- added: emailSection env variable
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
|
|
|
7
7
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
8
8
|
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
9
9
|
import { compareValues, htmlEntities } from 'src/chat21-core/utils/utils';
|
|
10
|
+
import { getProjectIdSelectedConversation } from 'src/chat21-core/utils/utils-message';
|
|
10
11
|
|
|
11
12
|
@Component({
|
|
12
13
|
selector: 'app-canned-response',
|
|
@@ -49,7 +50,7 @@ export class CannedResponseComponent implements OnInit {
|
|
|
49
50
|
ngOnChanges(changes: SimpleChange){
|
|
50
51
|
this.logger.debug('[CANNED] - loadTagsCanned strSearch ', this.currentString)
|
|
51
52
|
if(changes && changes['conversationWith'] && (changes['conversationWith'].previousValue !== changes['conversationWith'].currentValue)){
|
|
52
|
-
this.projectID =
|
|
53
|
+
this.projectID = getProjectIdSelectedConversation(this.conversationWith)
|
|
53
54
|
this.loadStoredCanned(this.projectID)
|
|
54
55
|
}
|
|
55
56
|
if(this.currentString !== undefined){
|
|
@@ -57,21 +58,21 @@ export class CannedResponseComponent implements OnInit {
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
getProjectIdSelectedConversation(conversationWith: string): string{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
// getProjectIdSelectedConversation(conversationWith: string): string{
|
|
62
|
+
// const conversationWith_segments = conversationWith.split('-')
|
|
63
|
+
// // Removes the last element of the array if is = to the separator
|
|
64
|
+
// if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
65
|
+
// conversationWith_segments.pop()
|
|
66
|
+
// }
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
68
|
+
// this.logger.log('[CANNED] - getProjectIdSelectedConversation conversationWith_segments ', conversationWith_segments)
|
|
69
|
+
// let projectId = ''
|
|
70
|
+
// if (conversationWith_segments.length === 4) {
|
|
71
|
+
// projectId = conversationWith_segments[2]
|
|
72
|
+
// this.logger.log('[CANNED] - getProjectIdSelectedConversation projectId ', projectId)
|
|
73
|
+
// }
|
|
74
|
+
// return projectId
|
|
75
|
+
// }
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
loadStoredCanned(projectId){
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
[supportMode]="supportMode"
|
|
232
232
|
[leadInfo]="leadInfo"
|
|
233
233
|
[fileUploadAccept]="appConfigProvider.getConfig().fileUploadAccept"
|
|
234
|
-
[emailSection]="
|
|
234
|
+
[emailSection]="isEmailEnabled"
|
|
235
235
|
[isOpenInfoConversation]="openInfoConversation"
|
|
236
236
|
[translationMap]="translationsMap"
|
|
237
237
|
[dropEvent]="dropEvent"
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
setChannelType,
|
|
67
67
|
} from '../../../chat21-core/utils/utils'
|
|
68
68
|
import {
|
|
69
|
+
getProjectIdSelectedConversation,
|
|
69
70
|
isFirstMessage,
|
|
70
71
|
isInfo,
|
|
71
72
|
isMine,
|
|
@@ -146,6 +147,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
146
147
|
public_Key: any;
|
|
147
148
|
areVisibleCAR: boolean;
|
|
148
149
|
supportMode: boolean;
|
|
150
|
+
isEmailEnabled: boolean;
|
|
149
151
|
//SOUND
|
|
150
152
|
setTimeoutSound: any;
|
|
151
153
|
audio: any;
|
|
@@ -483,6 +485,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
483
485
|
|
|
484
486
|
this.messages = [] // list messages of conversation
|
|
485
487
|
this.isFileSelected = false // indicates if a file has been selected (image to upload)
|
|
488
|
+
this.isEmailEnabled = (this.appConfigProvider.getConfig().emailSection === 'true' || this.appConfigProvider.getConfig().emailSection === true)? true: false;
|
|
486
489
|
|
|
487
490
|
if (checkPlatformIsMobile()) {
|
|
488
491
|
this.isMobile = true
|
|
@@ -556,21 +559,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
556
559
|
})
|
|
557
560
|
}
|
|
558
561
|
|
|
559
|
-
getProjectIdSelectedConversation(conversationWith: string): string{
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
562
|
+
// getProjectIdSelectedConversation(conversationWith: string): string{
|
|
563
|
+
// const conversationWith_segments = conversationWith.split('-')
|
|
564
|
+
// // Removes the last element of the array if is = to the separator
|
|
565
|
+
// if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
566
|
+
// conversationWith_segments.pop()
|
|
567
|
+
// }
|
|
568
|
+
|
|
569
|
+
// this.logger.log('[CONVS-DETAIL] - getProjectIdSelectedConversation conversationWith_segments ', conversationWith_segments)
|
|
570
|
+
// let projectId = ''
|
|
571
|
+
// if (conversationWith_segments.length === 4) {
|
|
572
|
+
// projectId = conversationWith_segments[2]
|
|
573
|
+
// this.logger.log('[CONVS-DETAIL] - getProjectIdSelectedConversation projectId ', projectId)
|
|
574
|
+
// }
|
|
575
|
+
// return projectId
|
|
576
|
+
// }
|
|
574
577
|
|
|
575
578
|
@HostListener('window:resize', ['$event'])
|
|
576
579
|
onResize(event: any) {
|
|
@@ -803,7 +806,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
803
806
|
}
|
|
804
807
|
|
|
805
808
|
}else {
|
|
806
|
-
const projectId =
|
|
809
|
+
const projectId = getProjectIdSelectedConversation(this.conversationWith)
|
|
807
810
|
let project = localStorage.getItem(projectId)
|
|
808
811
|
if(project){
|
|
809
812
|
project = JSON.parse(project)
|
|
@@ -904,7 +907,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
904
907
|
getLeadDetail(){
|
|
905
908
|
if(this.channelType !== TYPE_DIRECT){
|
|
906
909
|
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
907
|
-
const projectId =
|
|
910
|
+
const projectId = getProjectIdSelectedConversation(this.conversationWith)
|
|
908
911
|
this.logger.debug('[CONVS-DETAIL] getLeadDetail - section ', projectId)
|
|
909
912
|
this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
|
|
910
913
|
this.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
|
|
@@ -1020,8 +1023,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1020
1023
|
attributes,
|
|
1021
1024
|
)
|
|
1022
1025
|
|
|
1023
|
-
|
|
1024
|
-
if(emailEnabled && !this.leadIsOnline && this.leadInfo && this.leadInfo.email){
|
|
1026
|
+
if(this.isEmailEnabled && !this.leadIsOnline && this.leadInfo && this.leadInfo.email){
|
|
1025
1027
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1026
1028
|
this.sendEmail(msg)
|
|
1027
1029
|
}
|
|
@@ -48,6 +48,7 @@ import { NetworkService } from 'src/app/services/network-service/network.service
|
|
|
48
48
|
import { Subject } from 'rxjs'
|
|
49
49
|
import { takeUntil } from 'rxjs/operators'
|
|
50
50
|
import { TYPE_DIRECT } from 'src/chat21-core/utils/constants';
|
|
51
|
+
import { getProjectIdSelectedConversation } from 'src/chat21-core/utils/utils-message';
|
|
51
52
|
|
|
52
53
|
@Component({
|
|
53
54
|
selector: 'app-conversations-list',
|
|
@@ -505,7 +506,7 @@ export class ConversationListPage implements OnInit {
|
|
|
505
506
|
})
|
|
506
507
|
|
|
507
508
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
508
|
-
|
|
509
|
+
this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
|
|
509
510
|
// that.conversationsChanged(conversations)
|
|
510
511
|
if (conversation) {
|
|
511
512
|
this.onImageLoaded(conversation)
|
|
@@ -760,6 +761,14 @@ export class ConversationListPage implements OnInit {
|
|
|
760
761
|
project = JSON.parse(project)
|
|
761
762
|
conversation.attributes.project_name = project['name']
|
|
762
763
|
}
|
|
764
|
+
}else{
|
|
765
|
+
const projectId = getProjectIdSelectedConversation(conversation.uid)
|
|
766
|
+
let project = localStorage.getItem(projectId)
|
|
767
|
+
if(project){
|
|
768
|
+
project = JSON.parse(project)
|
|
769
|
+
conversation.attributes.projectId = project['_id']
|
|
770
|
+
conversation.attributes.project_name = project['name']
|
|
771
|
+
}
|
|
763
772
|
}
|
|
764
773
|
// if(conversation.conversation_with_fullname === 'Guest '){
|
|
765
774
|
// conversation.conversation_with_fullname = 'guest' + '#' + this.getUUidConversation(conversation.uid)
|
|
@@ -254,58 +254,59 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
254
254
|
const index = searchIndexInArrayForUid(this.conversations, conversation.conversation_with);
|
|
255
255
|
if (index > -1) {
|
|
256
256
|
// const conv = this.conversations[index];
|
|
257
|
-
|
|
257
|
+
this.logger.log("Conversation to update found", this.conversations[index]);
|
|
258
258
|
this.updateConversationWithSnapshot(this.conversations[index], conversation);
|
|
259
259
|
this.logger.debug('[MQTTConversationsHandler] conversationchanged.isnew', JSON.stringify(conversation))
|
|
260
|
-
this.conversations.sort(compareValues('timestamp', 'desc'));
|
|
261
260
|
this.logger.log("this.conversations:" + JSON.stringify(this.conversations));
|
|
261
|
+
this.logger.log("Conversation updated --> ", this.conversations[index]);
|
|
262
262
|
this.conversationChanged.next(this.conversations[index]);
|
|
263
|
+
this.conversations.sort(compareValues('timestamp', 'desc'));
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
private updateConversationWithSnapshot(conv: ConversationModel, snap: any) {
|
|
267
268
|
this.logger.debug('[MQTTConversationsHandler] updating conv', conv, 'with snap', snap)
|
|
268
269
|
Object.keys(snap).forEach(k => {
|
|
269
|
-
this.logger.debug('[MQTTConversationsHandler] key:' + k);
|
|
270
|
+
// this.logger.debug('[MQTTConversationsHandler] key:' + k);
|
|
270
271
|
if (k === 'is_new') {
|
|
271
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
272
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
272
273
|
conv.is_new = snap[k];
|
|
273
274
|
}
|
|
274
275
|
if (k === 'text') {
|
|
275
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
276
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
276
277
|
conv.last_message_text = snap[k];
|
|
277
278
|
conv.text = snap[k];
|
|
278
279
|
}
|
|
279
280
|
if (k === 'recipient') {
|
|
280
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
281
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
281
282
|
conv.recipient = snap[k];
|
|
282
283
|
}
|
|
283
284
|
if (k === 'recipient_fullname') {
|
|
284
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
285
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
285
286
|
conv.recipient_fullname = snap[k];
|
|
286
287
|
}
|
|
287
288
|
if (k === 'sender') {
|
|
288
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
289
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
289
290
|
conv.sender = snap[k];
|
|
290
291
|
}
|
|
291
292
|
if (k === 'sender_fullname') {
|
|
292
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
293
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
293
294
|
conv.sender_fullname = snap[k];
|
|
294
295
|
}
|
|
295
296
|
if (k === 'attributes') {
|
|
296
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
297
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
297
298
|
conv.attributes = snap[k];
|
|
298
299
|
}
|
|
299
300
|
if (k === 'timestamp') {
|
|
300
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
301
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
301
302
|
conv.timestamp = snap[k];
|
|
302
303
|
}
|
|
303
304
|
if (k === 'status') {
|
|
304
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
305
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
305
306
|
conv.status = this.setStatusConversation(conv.sender, conv.uid);
|
|
306
307
|
}
|
|
307
308
|
if (k === 'type') {
|
|
308
|
-
this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
309
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
309
310
|
conv.type = snap[k];
|
|
310
311
|
}
|
|
311
312
|
});
|
|
@@ -166,4 +166,17 @@ export function hideInfoMessage(msg, infoMessageKeyEnabled): boolean{
|
|
|
166
166
|
return true
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
export function getProjectIdSelectedConversation(conversationWith: string): string{
|
|
170
|
+
const conversationWith_segments = conversationWith.split('-')
|
|
171
|
+
// Removes the last element of the array if is = to the separator
|
|
172
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
173
|
+
conversationWith_segments.pop()
|
|
174
|
+
}
|
|
175
|
+
let projectId = ''
|
|
176
|
+
if (conversationWith_segments.length === 4) {
|
|
177
|
+
projectId = conversationWith_segments[2]
|
|
178
|
+
}
|
|
179
|
+
return projectId
|
|
180
|
+
}
|
|
181
|
+
|
|
169
182
|
|