@chat21/chat21-web-widget 5.1.6 → 5.1.7-rc9
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/docker-community-push-latest.yml +23 -13
- package/.github/workflows/docker-image-tag-community-tag-push.yml +22 -12
- package/CHANGELOG.md +33 -0
- package/Dockerfile +4 -5
- package/angular.json +2 -1
- package/deploy_amazon_prod.sh +5 -5
- package/package.json +1 -1
- package/src/app/app.component.html +3 -3
- package/src/app/app.component.scss +1 -1
- package/src/app/app.component.ts +23 -11
- package/src/app/app.module.ts +16 -10
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +1 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +20 -5
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +1 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +8 -11
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +25 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +57 -23
- package/src/app/component/{network-offline/network-offline.component.html → error-alert/error-alert.component.html} +4 -2
- package/src/app/component/{network-offline/network-offline.component.scss → error-alert/error-alert.component.scss} +3 -1
- package/src/app/component/{network-offline/network-offline.component.spec.ts → error-alert/error-alert.component.spec.ts} +8 -6
- package/src/app/component/error-alert/error-alert.component.ts +47 -0
- package/src/app/component/message/buttons/action-button/action-button.component.scss +6 -6
- package/src/app/component/message/buttons/action-button/action-button.component.ts +1 -1
- package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -5
- package/src/app/component/message/buttons/link-button/link-button.component.ts +2 -2
- package/src/app/component/message/buttons/text-button/text-button.component.scss +9 -12
- package/src/app/component/message/buttons/text-button/text-button.component.ts +4 -4
- package/src/app/component/message-attachment/message-attachment.component.html +3 -7
- package/src/app/providers/translator.service.ts +8 -2
- package/src/app/sass/_variables.scss +1 -1
- package/src/app/utils/constants.ts +3 -0
- package/src/app/utils/utils.ts +8 -10
- package/src/assets/i18n/en.json +4 -1
- package/src/assets/i18n/es.json +6 -1
- package/src/assets/i18n/fr.json +6 -1
- package/src/assets/i18n/it.json +6 -3
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +2 -2
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +22 -11
- package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +1 -1
- package/src/chat21-core/utils/utils.ts +15 -4
- package/src/iframe-style.css +1 -1
- package/src/app/component/network-offline/network-offline.component.ts +0 -24
|
@@ -410,8 +410,8 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
410
410
|
message.text = INFO_SUPPORT_LEAD_UPDATED;
|
|
411
411
|
} else if (infoMessageType(message) === INFO_MESSAGE_TYPE.MEMBER_LEFT_GROUP) {
|
|
412
412
|
let subject: string;
|
|
413
|
-
if (message.attributes.messagelabel.parameters.
|
|
414
|
-
subject = message.attributes.messagelabel.parameters.
|
|
413
|
+
if (message.attributes.messagelabel.parameters.firstname) {
|
|
414
|
+
subject = message.attributes.messagelabel.parameters.firstname;
|
|
415
415
|
}else{
|
|
416
416
|
subject = message.attributes.messagelabel.parameters.member_id;
|
|
417
417
|
}
|
|
@@ -464,16 +464,17 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
464
464
|
private async addCommandMessage(msg: MessageModel): Promise<boolean>{
|
|
465
465
|
const that = this;
|
|
466
466
|
const commands = msg.attributes.commands;
|
|
467
|
+
that.logger.debug('[MQTTConversationHandlerSERVICE] addCommandMessage: ', commands)
|
|
467
468
|
let i=0;
|
|
468
469
|
if(commands.length === 0) return;
|
|
469
470
|
return new Promise((resolve, reject)=>{
|
|
470
471
|
function execute(command){
|
|
472
|
+
that.logger.debug('[MQTTConversationHandlerSERVICE] command: ', command, i)
|
|
471
473
|
if(command.type === "message"){
|
|
472
474
|
that.logger.debug('[MQTTConversationHandlerSERVICE] addCommandMessage --> type="message"', command, i)
|
|
473
475
|
if (i >= 2) {
|
|
474
|
-
|
|
475
476
|
//check if previus wait message type has time value, otherwize set to 1000ms
|
|
476
|
-
!commands[i-1].time? commands[i-1].time= 1000 : commands[i-1].time
|
|
477
|
+
!commands[i-1].time? commands[i-1].time= 1000 : commands[i-1].time;
|
|
477
478
|
command.message.timestamp = commands[i-2].message.timestamp + commands[i-1].time;
|
|
478
479
|
|
|
479
480
|
/** CHECK IF MESSAGE IS JUST RECEIVED: IF false, set next message time (if object exist) to 0 -> this allow to show it immediately */
|
|
@@ -483,12 +484,14 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
483
484
|
command.message.timestamp = previewsTimeMsg + 100
|
|
484
485
|
commands[i+1]? commands[i+1].time = 0 : null
|
|
485
486
|
}
|
|
486
|
-
}
|
|
487
|
+
}
|
|
488
|
+
else { /**MANAGE FIRST MESSAGE */
|
|
487
489
|
command.message.timestamp = msg.timestamp;
|
|
488
490
|
if(!isJustRecived(that.startTime.getTime(), msg.timestamp)){
|
|
489
491
|
commands[i+1]? commands[i+1].time = 0 : null
|
|
490
492
|
}
|
|
491
493
|
}
|
|
494
|
+
|
|
492
495
|
that.generateMessageObject(msg, command.message, i, function () {
|
|
493
496
|
i += 1
|
|
494
497
|
if (i < commands.length) {
|
|
@@ -499,28 +502,36 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
499
502
|
resolve(true)
|
|
500
503
|
}
|
|
501
504
|
})
|
|
502
|
-
}else if(command.type === "wait"){
|
|
503
|
-
that.logger.debug('[MQTTConversationHandlerSERVICE] addCommandMessage --> type="wait"', command, i, commands.length)
|
|
505
|
+
} else if(command.type === "wait"){
|
|
504
506
|
//publish waiting event to simulate user typing
|
|
505
507
|
if(isJustRecived(that.startTime.getTime(), msg.timestamp)){
|
|
506
508
|
// console.log('message just received::', command, i, commands)
|
|
507
509
|
that.messageWait.next({uid: that.conversationWith, uidUserTypingNow: msg.sender, nameUserTypingNow: msg.sender_fullname, waitTime: command.time, command: command})
|
|
508
510
|
}
|
|
509
|
-
|
|
511
|
+
that.logger.debug('[MQTTConversationHandlerSERVICE] addCommandMessage: --> msg.status: ', msg.status)
|
|
512
|
+
|
|
513
|
+
const executeNext = () => {
|
|
510
514
|
i += 1
|
|
511
515
|
if (i < commands.length) {
|
|
512
516
|
execute(commands[i])
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
517
|
+
} else {
|
|
515
518
|
that.logger.debug('[MQTTConversationHandlerSERVICE] addCommandMessage --> last command executed (send message), exit')
|
|
516
519
|
resolve(true)
|
|
517
520
|
}
|
|
518
|
-
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if(msg.status === MSG_STATUS_RECEIVED){
|
|
524
|
+
executeNext()
|
|
525
|
+
} else {
|
|
526
|
+
setTimeout(executeNext, command.time)
|
|
527
|
+
}
|
|
519
528
|
}
|
|
520
529
|
}
|
|
521
530
|
execute(commands[0]) //START render first message
|
|
522
531
|
})
|
|
523
532
|
}
|
|
533
|
+
|
|
534
|
+
|
|
524
535
|
|
|
525
536
|
private generateMessageObject(message, command_message, index, callback) {
|
|
526
537
|
let parentUid = message.uid
|
|
@@ -71,7 +71,7 @@ export class TiledeskRequestsService {
|
|
|
71
71
|
|
|
72
72
|
public getMyRequests(): Promise<{ requests: Array<any>}> {
|
|
73
73
|
this.tiledeskToken = this.appStorage.getItem('tiledeskToken')
|
|
74
|
-
const url = this.URL_TILEDESK_REQUEST + '
|
|
74
|
+
const url = this.URL_TILEDESK_REQUEST + 'me?preflight=true'
|
|
75
75
|
this.logger.log('[TILEDESK-SERVICE] - GET REQUEST url ', url);
|
|
76
76
|
const httpOptions = {
|
|
77
77
|
headers: new HttpHeaders({
|
|
@@ -661,11 +661,22 @@ export function isAllowedUrlInText(text: string, allowedUrls: string[]) {
|
|
|
661
661
|
return nonWhitelistedDomains.length === 0;
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
+
// function extractUrls(text: string): string[] {
|
|
665
|
+
// const urlRegex = /https?:\/\/[^\s]+/g;
|
|
666
|
+
// return text.match(urlRegex) || [];
|
|
667
|
+
// }
|
|
668
|
+
|
|
664
669
|
function extractUrls(text: string): string[] {
|
|
665
|
-
|
|
666
|
-
|
|
670
|
+
// Rileva URL con o senza protocollo (http/https)
|
|
671
|
+
const urlRegex = /\b((https?:\/\/)?(www\.)?[a-z0-9.-]+\.[a-z]{2,})(\/[^\s]*)?/gi;
|
|
672
|
+
const matches = text.match(urlRegex) || [];
|
|
673
|
+
// Normalizza: aggiunge https:// se manca, così il parsing con new URL() funziona
|
|
674
|
+
return matches.map((url) => {
|
|
675
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
676
|
+
return 'https://' + url;
|
|
677
|
+
}
|
|
678
|
+
return url;
|
|
679
|
+
});
|
|
667
680
|
}
|
|
668
681
|
|
|
669
682
|
|
|
670
|
-
|
|
671
|
-
|
package/src/iframe-style.css
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'chat-network-offline',
|
|
6
|
-
templateUrl: './network-offline.component.html',
|
|
7
|
-
styleUrls: ['./network-offline.component.scss']
|
|
8
|
-
})
|
|
9
|
-
export class NetworkOfflineComponent implements OnInit {
|
|
10
|
-
|
|
11
|
-
translationMap: Map< string, string>;
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
private customTranslateService: CustomTranslateService
|
|
15
|
-
){}
|
|
16
|
-
|
|
17
|
-
ngOnInit(): void {
|
|
18
|
-
let keys = [
|
|
19
|
-
'CONNECTION_NETWORK_ERROR'
|
|
20
|
-
]
|
|
21
|
-
this.translationMap = this.customTranslateService.translateLanguage(keys)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|