@chat21/chat21-web-widget 5.1.7-rc7 → 5.1.11
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 +17 -0
- package/deploy_amazon_prod.sh +5 -5
- package/deploy_prod.sh +3 -0
- package/package.json +1 -1
- package/src/app/app.component.html +11 -4
- package/src/app/app.component.scss +60 -1
- package/src/app/app.component.ts +91 -31
- package/src/app/app.module.ts +16 -10
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +2 -16
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +4 -21
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +36 -44
- 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/launcher-button/launcher-button.component.html +1 -1
- package/src/app/component/launcher-button/launcher-button.component.ts +3 -2
- package/src/app/providers/global-settings.service.ts +3 -3
- package/src/app/utils/constants.ts +3 -0
- package/src/app/utils/globals.ts +1 -1
- package/src/assets/i18n/en.json +1 -1
- package/src/assets/i18n/es.json +1 -1
- package/src/assets/i18n/fr.json +1 -1
- package/src/assets/i18n/it.json +1 -1
- package/src/iframe-style.css +5 -5
- package/src/app/component/network-offline/network-offline.component.ts +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
+
# 5.1.11
|
|
10
|
+
- **bug-fixed**: departmentId and departmentName is incorrect in attributes
|
|
11
|
+
|
|
12
|
+
# 5.1.10
|
|
13
|
+
- **changed**: Force authentication if ageChangeVisibilityDesktop or PageChangeVisibilityMobile is OPEN
|
|
14
|
+
|
|
15
|
+
# 5.1.9
|
|
16
|
+
- **changed**: Set the default autoStart value to false
|
|
17
|
+
- **added**: Added the open widget loading spinner
|
|
18
|
+
- **changed**: Load the widget without authentication and display the speech bubble
|
|
19
|
+
|
|
20
|
+
# 5.1.8
|
|
21
|
+
|
|
22
|
+
# 5.1.7-rc8
|
|
23
|
+
- **changed**: Updated the translations of the tooltips in the footer-component
|
|
24
|
+
- **changed**: Refactored the network-offline component and made it generic for displaying errors (now error-alert.component)
|
|
25
|
+
|
|
9
26
|
# 5.1.7-rc7
|
|
10
27
|
- **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
|
|
11
28
|
|
package/deploy_amazon_prod.sh
CHANGED
|
@@ -33,9 +33,9 @@ cd ../..
|
|
|
33
33
|
|
|
34
34
|
aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*"
|
|
35
35
|
|
|
36
|
-
git restore src/environments/environment.
|
|
36
|
+
git restore src/environments/environment.prod.ts
|
|
37
37
|
|
|
38
|
-
echo new version deployed $version on s3://tiledesk-widget/
|
|
39
|
-
echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget/
|
|
40
|
-
echo https://widget.tiledesk.com/
|
|
41
|
-
echo https://widget.tiledesk.com/
|
|
38
|
+
echo new version deployed $version on s3://tiledesk-widget/v6
|
|
39
|
+
echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget/v6/index.html
|
|
40
|
+
echo https://widget.tiledesk.com/v6/index.html
|
|
41
|
+
echo https://widget.tiledesk.com/v6/$version/index.html
|
package/deploy_prod.sh
CHANGED
|
@@ -8,6 +8,9 @@ echo "CREATING TAG ON GIT FOR version: $version"
|
|
|
8
8
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
9
9
|
remote_name=$(git config --get branch.$current_branch.remote)
|
|
10
10
|
|
|
11
|
+
# Update dependencies
|
|
12
|
+
npm i
|
|
13
|
+
|
|
11
14
|
## Push commit to git
|
|
12
15
|
git add .
|
|
13
16
|
git commit -m "version added: ### $version"
|
package/package.json
CHANGED
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
|
|
106
106
|
<!--
|
|
107
107
|
****************************************
|
|
108
|
-
|
|
108
|
+
********* MODALE ERROR ALERT ***********
|
|
109
109
|
****************************************
|
|
110
110
|
-->
|
|
111
|
-
<div *ngIf="g.isOpen &&
|
|
112
|
-
<chat-
|
|
111
|
+
<div *ngIf="g.isOpen && isShowErrorMessage" class="modal-page star-rating-widget active">
|
|
112
|
+
<chat-error-alert [errorMessage]="errorMessage" [errorKeyMessage]="errorKeyMessage" [errorParams]="errorParams"></chat-error-alert>
|
|
113
113
|
</div>
|
|
114
114
|
|
|
115
115
|
</div>
|
|
@@ -145,5 +145,12 @@
|
|
|
145
145
|
<chat-launcher-button *ngIf="isInitialized"
|
|
146
146
|
(onButtonClicked)="onOpenCloseWidget($event)">
|
|
147
147
|
</chat-launcher-button>
|
|
148
|
-
|
|
148
|
+
|
|
149
|
+
<!-- Loading Spinner -->
|
|
150
|
+
<div *ngIf="loading" class="tiledesk-loading-overlay">
|
|
151
|
+
<div class="tiledesk-loading-spinner">
|
|
152
|
+
<div class="spinner-circle"></div>
|
|
153
|
+
<div class="loading-text">{{ translationMap.get('LABEL_LOADING') }}</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
149
156
|
</div>
|
|
@@ -571,7 +571,7 @@ chat-root {
|
|
|
571
571
|
/***************************
|
|
572
572
|
***** NETWORK OFFLINE ******
|
|
573
573
|
****************************/
|
|
574
|
-
chat-
|
|
574
|
+
chat-error-alert {
|
|
575
575
|
position: absolute;
|
|
576
576
|
width: 100%;
|
|
577
577
|
height: 100%;
|
|
@@ -764,4 +764,63 @@ chat-root {
|
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
|
|
767
|
+
// ========= BEGIN: LOADING SPINNER ========= //
|
|
768
|
+
.tiledesk-loading-overlay {
|
|
769
|
+
position: absolute;
|
|
770
|
+
top: 0;
|
|
771
|
+
left: 0;
|
|
772
|
+
width: 100%;
|
|
773
|
+
height: 100%;
|
|
774
|
+
background-color: rgba(248, 249, 250, 0.95);
|
|
775
|
+
display: flex;
|
|
776
|
+
justify-content: center;
|
|
777
|
+
align-items: center;
|
|
778
|
+
z-index: 9999;
|
|
779
|
+
backdrop-filter: blur(2px);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.tiledesk-loading-spinner {
|
|
783
|
+
display: flex;
|
|
784
|
+
flex-direction: column;
|
|
785
|
+
align-items: center;
|
|
786
|
+
gap: 16px;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.spinner-circle {
|
|
790
|
+
width: 50px;
|
|
791
|
+
height: 50px;
|
|
792
|
+
border: 4px solid rgba(59, 130, 246, 0.2);
|
|
793
|
+
border-top-color: #3b82f6;
|
|
794
|
+
border-radius: 50%;
|
|
795
|
+
animation: spin 0.8s linear infinite;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
@keyframes spin {
|
|
799
|
+
0% {
|
|
800
|
+
transform: rotate(0deg);
|
|
801
|
+
}
|
|
802
|
+
100% {
|
|
803
|
+
transform: rotate(360deg);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
.loading-text {
|
|
808
|
+
font-family: var(--font-family-bubble-message, 'Roboto', 'Google Sans', Helvetica, Arial, sans-serif);
|
|
809
|
+
font-size: 14px;
|
|
810
|
+
font-weight: 500;
|
|
811
|
+
color: #3b82f6;
|
|
812
|
+
letter-spacing: 0.5px;
|
|
813
|
+
animation: pulse 1.5s ease-in-out infinite;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
@keyframes pulse {
|
|
817
|
+
0%, 100% {
|
|
818
|
+
opacity: 1;
|
|
819
|
+
}
|
|
820
|
+
50% {
|
|
821
|
+
opacity: 0.5;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
// ========= END: LOADING SPINNER ========= //
|
|
825
|
+
|
|
767
826
|
}
|
package/src/app/app.component.ts
CHANGED
|
@@ -108,7 +108,14 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
108
108
|
|
|
109
109
|
//network status
|
|
110
110
|
isOnline: boolean = true;
|
|
111
|
+
loading: boolean = false;
|
|
111
112
|
|
|
113
|
+
// alert error message
|
|
114
|
+
isShowErrorMessage: boolean = false;
|
|
115
|
+
errorMessage: string = '';
|
|
116
|
+
errorKeyMessage: string = null;
|
|
117
|
+
errorParams: Record<string, any> = {};
|
|
118
|
+
|
|
112
119
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
113
120
|
constructor(
|
|
114
121
|
private el: ElementRef,
|
|
@@ -146,7 +153,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
146
153
|
this.logger.info('[APP-CONF]---------------- ngAfterViewInit: APP.COMPONENT ---------------- ')
|
|
147
154
|
|
|
148
155
|
// Initialize translation map and enable buttons
|
|
149
|
-
const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON'];
|
|
156
|
+
const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON', 'LABEL_LOADING'];
|
|
150
157
|
this.translationMap = this.translateService.translateLanguage(keys);
|
|
151
158
|
this.isButtonsDisabled = false;
|
|
152
159
|
|
|
@@ -313,8 +320,15 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
313
320
|
this.g.setIsOpen(isOpen)
|
|
314
321
|
this.appStorageService.setItem('isOpen', isOpen)
|
|
315
322
|
}
|
|
316
|
-
|
|
317
|
-
|
|
323
|
+
|
|
324
|
+
if(this.g.onPageChangeVisibilityDesktop === 'last'){
|
|
325
|
+
this.logger.debug('[APP-COMP2] ------this.g.isOpen: ', this.g.isOpen)
|
|
326
|
+
if(this.g.isOpen){
|
|
327
|
+
this.g.autoStart = true;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
318
332
|
/**CHECK IF JWT IS IN URL PARAMETERS */
|
|
319
333
|
this.logger.debug('[APP-COMP] check if token is passed throw url: ', this.g.jwt);
|
|
320
334
|
if (this.g.jwt) {
|
|
@@ -351,13 +365,10 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
351
365
|
this.subscriptions.push(obsSettingsService);
|
|
352
366
|
this.globalSettingsService.initWidgetParamiters(this.g, this.el);
|
|
353
367
|
|
|
354
|
-
// SET AUDIO
|
|
355
|
-
this.audio = new Audio();
|
|
356
|
-
this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
|
|
357
|
-
this.audio.load();
|
|
358
368
|
}
|
|
359
369
|
|
|
360
370
|
private initAll() {
|
|
371
|
+
this.logger.debug('[APP-COMP] initAll : ');
|
|
361
372
|
this.addComponentToWindow(this.ngZone);
|
|
362
373
|
|
|
363
374
|
//INIT TRIGGER-HANDLER
|
|
@@ -400,7 +411,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
400
411
|
|
|
401
412
|
|
|
402
413
|
/** NETWORK STATUS */
|
|
403
|
-
this.listenToNetworkStatus()
|
|
414
|
+
this.listenToNetworkStatus();
|
|
404
415
|
|
|
405
416
|
}
|
|
406
417
|
|
|
@@ -443,7 +454,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
443
454
|
that.triggerOnAuthStateChanged(that.stateLoggedUser);
|
|
444
455
|
that.logger.debug('[APP-COMP] 1 - IMPOSTO STATO CONNESSO UTENTE ', autoStart);
|
|
445
456
|
|
|
446
|
-
|
|
457
|
+
this.initAudioNotification()
|
|
447
458
|
|
|
448
459
|
new Promise(async (resolve, reject)=> {
|
|
449
460
|
that.typingService.initialize(this.g.tenant);
|
|
@@ -469,26 +480,35 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
469
480
|
that.listenToWidgetClick()
|
|
470
481
|
}
|
|
471
482
|
|
|
483
|
+
/** DDP IF AUTOSTART IS FALSE, SHOW WIDGET */
|
|
484
|
+
if(!autoStart){
|
|
485
|
+
that.logger.info('[APP-COMP] AUTOSTART IS FALSE AND LOGGED SUCCESSFULLY ');
|
|
486
|
+
this.g.setParameter('isShown', true, true);
|
|
487
|
+
}
|
|
472
488
|
|
|
489
|
+
/** DDP IF AUTOSTART IS FALSE, SHOW WIDGET */
|
|
490
|
+
if(!autoStart){
|
|
491
|
+
that.logger.info('[APP-COMP] AUTOSTART IS FALSE AND LOGGED SUCCESSFULLY ');
|
|
492
|
+
this.g.setParameter('isShown', true, true);
|
|
493
|
+
}
|
|
473
494
|
|
|
474
495
|
} else if (state && state === AUTH_STATE_OFFLINE && !this.forceDisconnect) {
|
|
475
496
|
/** non sono loggato */
|
|
476
497
|
that.logger.info('[APP-COMP] OFFLINE - NO CURRENT USER AUTENTICATE: ');
|
|
477
498
|
that.g.setParameter('isLogged', false);
|
|
478
|
-
that.hideWidget();
|
|
499
|
+
// that.hideWidget();
|
|
479
500
|
// that.g.setParameter('isShown', false, true);
|
|
480
501
|
that.triggerOnAuthStateChanged(that.stateLoggedUser);
|
|
481
|
-
if (autoStart) {
|
|
502
|
+
if (autoStart || this.g.onPageChangeVisibilityDesktop === 'open' || this.g.onPageChangeVisibilityMobile === 'open') {
|
|
482
503
|
that.authenticate();
|
|
483
504
|
}
|
|
484
|
-
}else if(state && state === AUTH_STATE_CLOSE ){
|
|
505
|
+
} else if(state && state === AUTH_STATE_CLOSE ){
|
|
485
506
|
that.logger.info('[APP-COMP] CLOSE - CHANNEL CLOSED: ', this.chatManager);
|
|
486
507
|
if(this.g.recipientId){
|
|
487
508
|
this.chatManager.removeConversationHandler(this.g.recipientId)
|
|
488
509
|
this.g.recipientId = null;
|
|
489
510
|
}
|
|
490
|
-
}
|
|
491
|
-
|
|
511
|
+
}
|
|
492
512
|
|
|
493
513
|
});
|
|
494
514
|
this.subscriptions.push(subAuthStateChanged);
|
|
@@ -733,6 +753,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
733
753
|
// divWidgetContainer.style.display = 'block';
|
|
734
754
|
// }
|
|
735
755
|
// }, 500);
|
|
756
|
+
this.loading = false;
|
|
736
757
|
}
|
|
737
758
|
// ========= end:: START UI ============//
|
|
738
759
|
|
|
@@ -841,7 +862,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
841
862
|
this.appStorageService.setItem('attributes', JSON.stringify(attributes));
|
|
842
863
|
return attributes;
|
|
843
864
|
}
|
|
844
|
-
|
|
865
|
+
|
|
866
|
+
// SET AUDIO
|
|
867
|
+
private initAudioNotification(){
|
|
868
|
+
this.audio = new Audio();
|
|
869
|
+
this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
|
|
870
|
+
this.audio.load();
|
|
871
|
+
}
|
|
845
872
|
|
|
846
873
|
private async initConversationsHandler(tenant: string, senderId: string) {
|
|
847
874
|
this.logger.debug('[APP-COMP] initialize: ListConversationsComponent');
|
|
@@ -1114,6 +1141,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1114
1141
|
* 3 - reinit widget
|
|
1115
1142
|
*/
|
|
1116
1143
|
private reInit() {
|
|
1144
|
+
this.logger.debug('[APP-COMP] reInit');
|
|
1117
1145
|
// if (!firebase.auth().currentUser) {
|
|
1118
1146
|
if (!this.tiledeskAuthService.getCurrentUser()) {
|
|
1119
1147
|
this.logger.debug('[APP-COMP] reInit ma NON SONO LOGGATO!');
|
|
@@ -1147,7 +1175,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1147
1175
|
*/
|
|
1148
1176
|
private restart() {
|
|
1149
1177
|
// if (!firebase.auth().currentUser) {
|
|
1150
|
-
|
|
1178
|
+
this.logger.debug('[APP-COMP] restart');
|
|
1151
1179
|
this.hideWidget();
|
|
1152
1180
|
// that.triggerOnAuthStateChanged(resp);
|
|
1153
1181
|
if (this.g.autoStart !== false) {
|
|
@@ -1600,23 +1628,47 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1600
1628
|
this.f21_close();
|
|
1601
1629
|
}
|
|
1602
1630
|
|
|
1631
|
+
|
|
1632
|
+
/** DDP reload widget */
|
|
1633
|
+
async reloadWidget() {
|
|
1634
|
+
// prima deve aprire il widget e poi mostrare il loading
|
|
1635
|
+
this.openCloseWidget();
|
|
1636
|
+
this.logger.debug('[APP-COMP-1] AAA - hideWidget');
|
|
1637
|
+
await Promise.all([
|
|
1638
|
+
this.authenticate(),
|
|
1639
|
+
// this.initAll()
|
|
1640
|
+
]);
|
|
1641
|
+
this.logger.debug('[APP-COMP-1] CCC - showWidget');
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
|
|
1603
1645
|
/**
|
|
1604
1646
|
* LAUNCHER BUTTON:
|
|
1605
1647
|
* onClick button open/close widget
|
|
1606
1648
|
*/
|
|
1607
1649
|
onOpenCloseWidget($event) {
|
|
1650
|
+
this.logger.debug('[APP-COMP] onOpenCloseWidget', $event, this.g.isLogged);
|
|
1651
|
+
if(!this.g.isLogged){
|
|
1652
|
+
this.reloadWidget();
|
|
1653
|
+
} else {
|
|
1654
|
+
this.openCloseWidget();
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
/** DDP show widget */
|
|
1659
|
+
openCloseWidget() {
|
|
1608
1660
|
this.g.setParameter('displayEyeCatcherCard', 'none');
|
|
1609
1661
|
// const conversationActive: ConversationModel = JSON.parse(this.appStorageService.getItem('activeConversation'));
|
|
1610
1662
|
const recipientId : string = this.appStorageService.getItem('recipientId')
|
|
1611
1663
|
this.g.setParameter('recipientId', recipientId);
|
|
1612
1664
|
this.logger.debug('[APP-COMP] openCloseWidget', recipientId, this.g.isOpen, this.g.startFromHome);
|
|
1665
|
+
|
|
1613
1666
|
if (this.g.isOpen === false) {
|
|
1614
1667
|
if(this.forceDisconnect){
|
|
1615
1668
|
this.logger.log('[FORCE] onOpenCloseWidget --> reconnect', this.forceDisconnect)
|
|
1616
1669
|
this.messagingAuthService.createCustomToken(this.g.tiledeskToken)
|
|
1617
1670
|
this.forceDisconnect = false;
|
|
1618
1671
|
}
|
|
1619
|
-
|
|
1620
1672
|
if (!recipientId) {
|
|
1621
1673
|
if(this.g.singleConversation){
|
|
1622
1674
|
this.isOpenHome = false;
|
|
@@ -1636,29 +1688,22 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1636
1688
|
this.isOpenHome = false;
|
|
1637
1689
|
this.isOpenConversation = true;
|
|
1638
1690
|
this.startUI()
|
|
1639
|
-
// this.isOpenSelectionDepartment = false;
|
|
1640
1691
|
}
|
|
1641
|
-
// if (!conversationActive && !this.g.startFromHome) {
|
|
1642
|
-
// this.isOpenHome = false;
|
|
1643
|
-
// this.isOpenConversation = true;
|
|
1644
|
-
// this.startNwConversation();
|
|
1645
|
-
// } else if (conversationActive) {
|
|
1646
|
-
// this.isOpenHome = false;
|
|
1647
|
-
// this.isOpenConversation = true;
|
|
1648
|
-
// }
|
|
1649
|
-
// this.g.startFromHome = true;
|
|
1650
1692
|
this.triggerOnOpenEvent();
|
|
1651
|
-
|
|
1652
1693
|
} else {
|
|
1653
1694
|
this.triggerOnCloseEvent();
|
|
1654
1695
|
}
|
|
1655
1696
|
//change status to the widget
|
|
1656
1697
|
this.g.setIsOpen(!this.g.isOpen);
|
|
1657
1698
|
this.appStorageService.setItem('isOpen', this.g.isOpen);
|
|
1658
|
-
|
|
1699
|
+
//show loading if widget is open and user is not logged
|
|
1700
|
+
if(this.g.isOpen === true && !this.g.isLogged){
|
|
1701
|
+
this.loading = true;
|
|
1702
|
+
}
|
|
1659
1703
|
// this.saveBadgeNewConverstionNumber();
|
|
1660
1704
|
}
|
|
1661
1705
|
|
|
1706
|
+
|
|
1662
1707
|
/**
|
|
1663
1708
|
* MODAL SELECTION DEPARTMENT:
|
|
1664
1709
|
* selected department
|
|
@@ -2215,8 +2260,23 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
2215
2260
|
}
|
|
2216
2261
|
|
|
2217
2262
|
private listenToNetworkStatus(){
|
|
2218
|
-
window.addEventListener('online', () =>
|
|
2219
|
-
|
|
2263
|
+
window.addEventListener('online', () => {
|
|
2264
|
+
this.isShowErrorMessage = false;
|
|
2265
|
+
this.errorMessage = null;
|
|
2266
|
+
this.errorKeyMessage = null;
|
|
2267
|
+
});
|
|
2268
|
+
window.addEventListener('offline', () => {
|
|
2269
|
+
this.isShowErrorMessage = true;
|
|
2270
|
+
this.errorMessage = null;
|
|
2271
|
+
this.errorKeyMessage = 'CONNECTION_NETWORK_ERROR';
|
|
2272
|
+
});
|
|
2273
|
+
window.addEventListener('tooltipErrorMessage', (event: CustomEvent) => {
|
|
2274
|
+
// console.log('event-------------------> tooltipErrorMessage', event);
|
|
2275
|
+
this.isShowErrorMessage = event.detail?.error;
|
|
2276
|
+
this.errorKeyMessage = event.detail?.keyMessage || null;
|
|
2277
|
+
this.errorMessage = event.detail?.message || null;
|
|
2278
|
+
this.errorParams = event.detail?.params || {};
|
|
2279
|
+
});
|
|
2220
2280
|
}
|
|
2221
2281
|
|
|
2222
2282
|
// ========= begin:: DESTROY ALL SUBSCRIPTIONS ============//
|
package/src/app/app.module.ts
CHANGED
|
@@ -59,7 +59,8 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
|
59
59
|
import { environment } from 'src/environments/environment';
|
|
60
60
|
|
|
61
61
|
//THIRD-PART MODULES
|
|
62
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
62
|
+
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
|
63
|
+
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
63
64
|
// import { MomentModule } from 'ngx-moment';
|
|
64
65
|
import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
65
66
|
import { LoggerModule, NGXLogger, NgxLoggerLevel } from "ngx-logger";
|
|
@@ -134,7 +135,7 @@ import { Rules } from './utils/rules';
|
|
|
134
135
|
import { ScriptService } from 'src/chat21-core/providers/scripts/script.service';
|
|
135
136
|
import { CarouselComponent } from './component/message/carousel/carousel.component';
|
|
136
137
|
import { BrandService } from './providers/brand.service';
|
|
137
|
-
import {
|
|
138
|
+
import { ErrorAlertComponent } from './component/error-alert/error-alert.component';
|
|
138
139
|
import { ConfirmCloseComponent } from './modals/confirm-close/confirm-close.component';
|
|
139
140
|
|
|
140
141
|
|
|
@@ -204,6 +205,11 @@ export function conversationHandlerFactory(chat21Service: Chat21Service, appConf
|
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
207
|
|
|
208
|
+
// ngx-translate Http loader factory
|
|
209
|
+
export function createTranslateLoader(http: HttpClient) {
|
|
210
|
+
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
|
211
|
+
}
|
|
212
|
+
|
|
207
213
|
export function typingFactory(chat21Service: Chat21Service, appConfig: AppConfigService) {
|
|
208
214
|
const config = appConfig.getConfig()
|
|
209
215
|
if (config.chatEngine === CHAT_ENGINE_MQTT) {
|
|
@@ -300,7 +306,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
300
306
|
LikeUnlikeComponent,
|
|
301
307
|
TooltipDirective,
|
|
302
308
|
CarouselComponent,
|
|
303
|
-
|
|
309
|
+
ErrorAlertComponent,
|
|
304
310
|
ConfirmCloseComponent
|
|
305
311
|
],
|
|
306
312
|
imports: [BrowserModule,
|
|
@@ -308,13 +314,13 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
308
314
|
FormsModule,
|
|
309
315
|
ReactiveFormsModule,
|
|
310
316
|
PickerModule,
|
|
311
|
-
TranslateModule.forRoot(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
317
|
+
TranslateModule.forRoot({
|
|
318
|
+
defaultLanguage: 'en',
|
|
319
|
+
loader: {
|
|
320
|
+
provide: TranslateLoader,
|
|
321
|
+
useFactory: (createTranslateLoader),
|
|
322
|
+
deps: [HttpClient]
|
|
323
|
+
}
|
|
318
324
|
}),
|
|
319
325
|
LoggerModule.forRoot({
|
|
320
326
|
level: NgxLoggerLevel.DEBUG,
|
|
@@ -234,9 +234,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
234
234
|
'LABEL_START_NW_CONV',
|
|
235
235
|
'CONTINUE',
|
|
236
236
|
'EMOJI_NOT_ELLOWED',
|
|
237
|
-
'
|
|
238
|
-
'MAX_ATTACHMENT',
|
|
239
|
-
'MAX_ATTACHMENT_ERROR',
|
|
237
|
+
'ATTACHMENT',
|
|
240
238
|
'EMOJI'
|
|
241
239
|
];
|
|
242
240
|
|
|
@@ -465,7 +463,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
465
463
|
this.isConversationArchived=true
|
|
466
464
|
return { requests: [] }
|
|
467
465
|
});
|
|
468
|
-
console.log('requesttttttt', requests_list)
|
|
469
466
|
if (requests_list && requests_list.requests.length > 0) {
|
|
470
467
|
this.logger.debug('[CONV-COMP] getConversationDetail: request exist on Tiledesk', requests_list);
|
|
471
468
|
let conversation = requests_list.requests.find((request)=> request.request_id === this.conversationId)
|
|
@@ -836,16 +833,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
836
833
|
|
|
837
834
|
subscribtion = this.chatManager.conversationsHandlerService.conversationChanged.pipe(takeUntil(this.unsubscribe$)).subscribe((conversation) => {
|
|
838
835
|
this.logger.debug('[CONV-COMP] ***** DATAIL conversationsChanged *****', conversation, this.conversationWith, this.isConversationArchived);
|
|
839
|
-
// if(conversation && conversation.recipient === this.g.senderId && isUserBanned(conversation)){
|
|
840
|
-
// return;
|
|
841
|
-
// }
|
|
842
|
-
// if(conversation && conversation.sender !== this.senderId){
|
|
843
|
-
// const checkContentScrollPosition = that.conversationContent.checkContentScrollPosition();
|
|
844
|
-
// if(checkContentScrollPosition && conversation.is_new){ //update conversation if scroolToBottom is to the end
|
|
845
|
-
// this.logger.debug('[CONV-COMP] updateConversationBadge...')
|
|
846
|
-
// that.updateConversationBadge();
|
|
847
|
-
// }
|
|
848
|
-
// }
|
|
849
836
|
if(conversation && conversation.recipient === this.conversationId){
|
|
850
837
|
this.isConversationArchived = false
|
|
851
838
|
}
|
|
@@ -1454,5 +1441,4 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
1454
1441
|
this.isHovering = false
|
|
1455
1442
|
}
|
|
1456
1443
|
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1444
|
+
}
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div tabindex="-1" class="c21-powered-by" [innerHTML]="poweredBy" (click)="managePoweredBy($event)"></div>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
-
<!-- ALERT EMOJI
|
|
7
|
+
<!-- ALERT EMOJI -->
|
|
8
8
|
<div id="textAlert" *ngIf="!hideTextAreaContent && showAlertEmoji" class="fade-in-bottom" [class.hideTextReply]="hideTextReply">
|
|
9
9
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" version="1.1" viewBox="0 0 110 135">
|
|
10
10
|
<path d="M55,25.8c-23,0-41.7,18.7-41.7,41.7s18.7,41.7,41.7,41.7,41.7-18.7,41.7-41.7-18.7-41.7-41.7-41.7ZM55,91.5c-3.4,0-6.2-2.8-6.2-6.2s2.8-6.2,6.2-6.2,6.2,2.8,6.2,6.2-2.8,6.2-6.2,6.2ZM60.3,70.1c-.2,2.8-2.5,4.9-5.3,4.9s-5.1-2.2-5.3-4.9l-1.6-22.3c-.3-4,2.9-7.4,6.9-7.4s7.2,3.4,6.9,7.4l-1.6,22.3Z"/>
|
|
@@ -12,12 +12,6 @@
|
|
|
12
12
|
<div tabindex="-1" class="alertText">{{translationMap.get('EMOJI_NOT_ELLOWED')}}</div>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div id="textAlert" *ngIf="!hideTextAreaContent && showAlertUrl" class="fade-in-bottom" [class.hideTextReply]="hideTextReply">
|
|
16
|
-
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" version="1.1" viewBox="0 0 110 135">
|
|
17
|
-
<path d="M55,25.8c-23,0-41.7,18.7-41.7,41.7s18.7,41.7,41.7,41.7,41.7-18.7,41.7-41.7-18.7-41.7-41.7-41.7ZM55,91.5c-3.4,0-6.2-2.8-6.2-6.2s2.8-6.2,6.2-6.2,6.2,2.8,6.2,6.2-2.8,6.2-6.2,6.2ZM60.3,70.1c-.2,2.8-2.5,4.9-5.3,4.9s-5.1-2.2-5.3-4.9l-1.6-22.3c-.3-4,2.9-7.4,6.9-7.4s7.2,3.4,6.9,7.4l-1.6,22.3Z"/>
|
|
18
|
-
</svg>
|
|
19
|
-
<div tabindex="-1" class="alertText">{{translationMap.get('DOMAIN_NOT_ALLOWED')}}</div>
|
|
20
|
-
</div>
|
|
21
15
|
</div>
|
|
22
16
|
|
|
23
17
|
<!-- TEXTAREA + ICONS: conv active-->
|
|
@@ -29,7 +23,7 @@
|
|
|
29
23
|
<span class="v-align-center">
|
|
30
24
|
<svg role="img" aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" width="24px" height="24" viewBox="0 0 24 24" fill="currentColor">
|
|
31
25
|
<path d="M9.9,22.7c0,0-.1,0-.2,0-1.9.3-3.7-.2-5.2-1.4-3-2.3-3.6-6.4-1.4-9.5L9.5,2.5c.4-.5,1.1-.6,1.6-.3.5.4.6,1.1.3,1.6l-6.5,9.4c-1.4,2-1,4.8.9,6.3,1,.8,2.2,1.1,3.5.9,1.3-.2,2.4-.9,3.1-1.9l6-8.7c.9-1.2.6-3-.6-3.9-.6-.5-1.4-.6-2.1-.5-.8.1-1.4.5-1.9,1.1l-5.8,8.2c-.3.5-.2,1.1.2,1.5.2.2.5.3.8.2.3,0,.6-.2.7-.4l4.7-6.2c.4-.5,1.1-.6,1.6-.2.5.4.6,1.1.2,1.6l-4.7,6.2c-.5.7-1.4,1.2-2.3,1.3-.9.1-1.8-.2-2.5-.7-1.4-1.1-1.6-3.1-.6-4.6l5.8-8.2c.8-1.1,2-1.9,3.4-2.1,1.4-.2,2.7.1,3.8,1,2.2,1.7,2.7,4.8,1.1,7.1l-6,8.7c-1.1,1.5-2.6,2.5-4.4,2.8h0Z"/>
|
|
32
|
-
<title id="altIconTitle">{{
|
|
26
|
+
<title id="altIconTitle">{{ 'MAX_ATTACHMENT' | translate: { FILE_SIZE_LIMIT: file_size_limit } }}</title>
|
|
33
27
|
</svg>
|
|
34
28
|
|
|
35
29
|
</span>
|
|
@@ -68,7 +62,7 @@
|
|
|
68
62
|
|
|
69
63
|
|
|
70
64
|
|
|
71
|
-
<div *ngIf="!isStopRec" class="visible-text-area" [class.hasError]="showAlertEmoji
|
|
65
|
+
<div *ngIf="!isStopRec" class="visible-text-area" [class.hasError]="showAlertEmoji" [class.disabled] = "( isConversationArchived || hideTextReply)? true : null">
|
|
72
66
|
<!-- isFilePendingToUpload || -->
|
|
73
67
|
<textarea
|
|
74
68
|
[attr.disabled] = "(hideTextReply)? true : null"
|
|
@@ -91,7 +85,7 @@
|
|
|
91
85
|
</div>
|
|
92
86
|
|
|
93
87
|
<!-- ICON SEND -->
|
|
94
|
-
<div *ngIf="(textInputTextArea !== '' && !isStopRec) || !showAudioRecorderFooterButton" tabindex="-1" class="chat21-textarea-button" [class.disabled]="showAlertEmoji
|
|
88
|
+
<div *ngIf="(textInputTextArea !== '' && !isStopRec) || !showAudioRecorderFooterButton" tabindex="-1" class="chat21-textarea-button" [class.disabled]="showAlertEmoji" [class.active]="textInputTextArea && !hideTextReply" id="chat21-button-send" (click)="onSendPressed($event)">
|
|
95
89
|
<span class="v-align-center">
|
|
96
90
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="24" width="24" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve" fill="currentColor">
|
|
97
91
|
<path d="M1.8,20.6V3.4l20.2,8.6L1.8,20.6ZM3.9,17.3l12.6-5.4L3.9,6.6v3.7l6.4,1.6-6.4,1.6v3.8ZM3.9,17.3V6.6v10.7Z"/>
|
|
@@ -149,14 +143,3 @@
|
|
|
149
143
|
<div class="clear"></div>
|
|
150
144
|
</button> -->
|
|
151
145
|
</div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<!--
|
|
155
|
-
****************************************
|
|
156
|
-
******* MODALE OFFLINE NETWORK *********
|
|
157
|
-
****************************************
|
|
158
|
-
-->
|
|
159
|
-
|
|
160
|
-
<div class="star-rating-widget" [class.active]="isErrorNetwork" [class.inactive]="!isErrorNetwork">
|
|
161
|
-
<chat-network-offline [keyErrorMessage]="'MAX_ATTACHMENT_ERROR'"></chat-network-offline>
|
|
162
|
-
</div>
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Component, ComponentFactoryResolver, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { error } from 'console';
|
|
3
|
+
import { FILE_SIZE_LIMIT } from 'src/app/utils/constants';
|
|
2
4
|
import { Globals } from 'src/app/utils/globals';
|
|
3
5
|
import { checkAcceptedFile } from 'src/app/utils/utils';
|
|
4
6
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
@@ -82,12 +84,12 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
showAlertEmoji: boolean = false
|
|
85
|
-
showAlertUrl: boolean = false;
|
|
86
87
|
|
|
87
|
-
file_size_limit
|
|
88
|
+
file_size_limit = FILE_SIZE_LIMIT;
|
|
88
89
|
attachmentTooltip: string = '';
|
|
89
90
|
isErrorNetwork: boolean = false;
|
|
90
91
|
|
|
92
|
+
|
|
91
93
|
convertColorToRGBA = convertColorToRGBA;
|
|
92
94
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
93
95
|
constructor(private chatManager: ChatManager,
|
|
@@ -95,7 +97,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
95
97
|
private uploadService: UploadService) { }
|
|
96
98
|
|
|
97
99
|
ngOnInit() {
|
|
98
|
-
this.updateAttachmentTooltip();
|
|
100
|
+
// this.updateAttachmentTooltip();
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
|
|
@@ -111,9 +113,9 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
111
113
|
this.onDrop(this.dropEvent)
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
if(changes['translationMap'] && changes['translationMap'].currentValue !== undefined){
|
|
115
|
-
|
|
116
|
-
}
|
|
116
|
+
// if(changes['translationMap'] && changes['translationMap'].currentValue !== undefined){
|
|
117
|
+
// this.updateAttachmentTooltip();
|
|
118
|
+
// }
|
|
117
119
|
|
|
118
120
|
}
|
|
119
121
|
|
|
@@ -122,24 +124,24 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
122
124
|
// setTimeout(() => {
|
|
123
125
|
this.showEmojiPicker = true
|
|
124
126
|
// }, 500);
|
|
125
|
-
this.updateAttachmentTooltip();
|
|
127
|
+
// this.updateAttachmentTooltip();
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
|
|
129
|
-
updateAttachmentTooltip() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
131
|
+
// updateAttachmentTooltip() {
|
|
132
|
+
// // Use setTimeout to wait for the async translation map to be populated
|
|
133
|
+
// setTimeout(() => {
|
|
134
|
+
// this.logger.log('[CONV-FOOTER] updateAttachmentTooltip - translationMap:', this.translationMap);
|
|
135
|
+
// if (this.translationMap && this.translationMap.has('MAX_ATTACHMENT')) {
|
|
136
|
+
// const template = this.translationMap.get('MAX_ATTACHMENT');
|
|
137
|
+
// this.logger.log('[CONV-FOOTER] MAX_ATTACHMENT template:', template);
|
|
138
|
+
// // this.attachmentTooltip = template.replace('{{file_size_limit}}', this.file_size_limit.toString());
|
|
139
|
+
// this.logger.log('[CONV-FOOTER] attachmentTooltip:', this.attachmentTooltip);
|
|
140
|
+
// } else {
|
|
141
|
+
// this.logger.log('[CONV-FOOTER] MAX_ATTACHMENT not found in translationMap');
|
|
142
|
+
// }
|
|
143
|
+
// }, 500);
|
|
144
|
+
// }
|
|
143
145
|
|
|
144
146
|
// ========= begin:: functions send image ======= //
|
|
145
147
|
// START LOAD IMAGE //
|
|
@@ -272,11 +274,13 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
272
274
|
|
|
273
275
|
|
|
274
276
|
private showErrorNetwork() {
|
|
275
|
-
|
|
277
|
+
// posso anche passare solo keyMessage, nel caso non voglio passare un messaggio custom posso passare message e params(se il messaggio possiede dei parametri),
|
|
278
|
+
//window.dispatchEvent(new CustomEvent('tooltipErrorMessage', { detail: { error: true, message: 'File size is greater than the limit {{file_size_limit}}', keyMessage: null, params: { file_size_limit: this.file_size_limit } } }));
|
|
279
|
+
window.dispatchEvent(new CustomEvent('tooltipErrorMessage', { detail: { error: true, keyMessage: 'MAX_ATTACHMENT' } }));
|
|
276
280
|
setTimeout(() => {
|
|
277
|
-
this.isErrorNetwork = false;
|
|
278
281
|
this.isFilePendingToUpload = false;
|
|
279
282
|
this.hideTextReply = false;
|
|
283
|
+
window.dispatchEvent(new CustomEvent('tooltipErrorMessage', { detail: { error: false, message: '', keyMessage: null } }));
|
|
280
284
|
}, 5000);
|
|
281
285
|
}
|
|
282
286
|
|
|
@@ -365,10 +369,9 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
365
369
|
this.onEmojiiPickerShow.emit(false)
|
|
366
370
|
this.logger.log('[CONV-FOOTER] SEND MESSAGE: ', msg, type, metadata, additional_attributes);
|
|
367
371
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
return
|
|
372
|
+
let check = this.checkForEmojii(this.textInputTextArea)
|
|
373
|
+
if(!check){
|
|
374
|
+
return;
|
|
372
375
|
}
|
|
373
376
|
|
|
374
377
|
if (msg && msg.trim() !== '' || type === TYPE_MSG_IMAGE || type === TYPE_MSG_FILE ) {
|
|
@@ -578,22 +581,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
578
581
|
this.showAlertEmoji = false;
|
|
579
582
|
return true
|
|
580
583
|
}
|
|
581
|
-
|
|
582
|
-
checkForUrlDomain(text){
|
|
583
|
-
if(this.project && this.project.settings?.allowed_urls === true && this.project.settings?.allowed_urls_list){
|
|
584
|
-
this.showAlertUrl = !isAllowedUrlInText(text, this.project.settings?.allowed_urls_list);
|
|
585
|
-
if(this.showAlertUrl){
|
|
586
|
-
return false
|
|
587
|
-
}
|
|
588
|
-
this.showAlertUrl = false
|
|
589
|
-
return true
|
|
590
|
-
}
|
|
591
|
-
this.showAlertUrl = false
|
|
592
|
-
return true
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
|
|
597
584
|
|
|
598
585
|
|
|
599
586
|
onTextAreaChange(){
|
|
@@ -602,7 +589,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
602
589
|
|
|
603
590
|
//reset alert to defalt values before checking again
|
|
604
591
|
this.showAlertEmoji= false;
|
|
605
|
-
this.showAlertUrl = false;
|
|
606
592
|
let check = this.checkForEmojii(this.textInputTextArea)
|
|
607
593
|
if(!check){
|
|
608
594
|
return;
|
|
@@ -612,6 +598,9 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
612
598
|
onSendPressed(event) {
|
|
613
599
|
this.logger.log('[CONV-FOOTER] onSendPressed:event', event);
|
|
614
600
|
event.preventDefault();
|
|
601
|
+
if(this.showAlertEmoji){
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
615
604
|
this.logger.log('[CONV-FOOTER] AppComponent::onSendPressed::isFilePendingToUpload:', this.isFilePendingToUpload);
|
|
616
605
|
if (this.isFilePendingToUpload) {
|
|
617
606
|
this.logger.log('[CONV-FOOTER] AppComponent::onSendPressed', 'is a file');
|
|
@@ -739,6 +728,9 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
739
728
|
const keyCode = event.which || event.keyCode;
|
|
740
729
|
this.textInputTextArea = ((document.getElementById('chat21-main-message-context') as HTMLInputElement).value);
|
|
741
730
|
if (keyCode === 13) { // ENTER pressed
|
|
731
|
+
if(this.showAlertEmoji){
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
742
734
|
if (this.textInputTextArea && this.textInputTextArea.trim() !== '') {
|
|
743
735
|
// that.logger.log('[CONV-FOOTER] sendMessage -> ', this.textInputTextArea);
|
|
744
736
|
// this.resizeInputField();
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
<path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/>
|
|
4
4
|
</svg>
|
|
5
5
|
<div class="alert-content">
|
|
6
|
-
{{
|
|
6
|
+
{{ errorMessage }}
|
|
7
7
|
</div>
|
|
8
|
-
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ErrorAlertComponent } from './error-alert.component';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
5
|
+
describe('ErrorAlertComponent', () => {
|
|
6
|
+
let component: ErrorAlertComponent;
|
|
7
|
+
let fixture: ComponentFixture<ErrorAlertComponent>;
|
|
8
8
|
|
|
9
9
|
beforeEach(async () => {
|
|
10
10
|
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [
|
|
11
|
+
declarations: [ ErrorAlertComponent ]
|
|
12
12
|
})
|
|
13
13
|
.compileComponents();
|
|
14
14
|
|
|
15
|
-
fixture = TestBed.createComponent(
|
|
15
|
+
fixture = TestBed.createComponent(ErrorAlertComponent);
|
|
16
16
|
component = fixture.componentInstance;
|
|
17
17
|
fixture.detectChanges();
|
|
18
18
|
});
|
|
@@ -21,3 +21,5 @@ describe('NetworkOfflineComponent', () => {
|
|
|
21
21
|
expect(component).toBeTruthy();
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
3
|
+
import * as CONSTANTS from 'src/app/utils/constants';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'chat-error-alert',
|
|
7
|
+
templateUrl: './error-alert.component.html',
|
|
8
|
+
styleUrls: ['./error-alert.component.scss']
|
|
9
|
+
})
|
|
10
|
+
export class ErrorAlertComponent implements OnInit {
|
|
11
|
+
|
|
12
|
+
@Input() errorMessage: string = '';
|
|
13
|
+
@Input() errorKeyMessage: string = '';
|
|
14
|
+
@Input() errorParams: Record<string, any> = {};
|
|
15
|
+
|
|
16
|
+
translationMap: Map<string, string>;
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
private customTranslateService: CustomTranslateService,
|
|
20
|
+
){}
|
|
21
|
+
|
|
22
|
+
ngOnInit(): void {
|
|
23
|
+
let rawMessage: string = '';
|
|
24
|
+
// Combina costanti globali + parametri passati come input
|
|
25
|
+
const replacements = { ...CONSTANTS, ...this.errorParams };
|
|
26
|
+
if (this.errorKeyMessage) {
|
|
27
|
+
// Traduci il messaggio e sostituisci i placeholder
|
|
28
|
+
rawMessage = this.customTranslateService
|
|
29
|
+
.translateLanguage([this.errorKeyMessage])
|
|
30
|
+
.get(this.errorKeyMessage);
|
|
31
|
+
} else if (this.errorMessage) {
|
|
32
|
+
rawMessage = this.errorMessage;
|
|
33
|
+
}
|
|
34
|
+
this.errorMessage = this.interpolate(rawMessage, replacements);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Sostituisce {{placeholders}} con i valori corrispondenti */
|
|
38
|
+
private interpolate(template: string, variables: Record<string, any>): string {
|
|
39
|
+
return template.replace(/\{\{(.*?)\}\}/g, (_, key) => {
|
|
40
|
+
const trimmedKey = key.trim();
|
|
41
|
+
return variables[trimmedKey] ?? `{{${trimmedKey}}}`;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- tabindex="000"-->
|
|
2
2
|
|
|
3
3
|
<button aflauncherbutton #aflauncherbutton id="c21-launcher-button" class="c21-button-clean scale-in-center"
|
|
4
|
-
*ngIf="g.
|
|
4
|
+
*ngIf="g.isOpen == false"
|
|
5
5
|
[ngClass]="{'c21-align-left' : g.align === 'left', 'c21-align-right' : g.align !== 'left'}"
|
|
6
6
|
[ngStyle]="{ 'background-color': g.baloonImage? null: g.themeColor, 'bottom': g.marginY+'px!important', 'left':(g.align==='left')?g.marginX+'px!important':'', 'right':(g.align==='right')?g.marginX+'px!important':'', 'width': g.launcherWidth, 'height': g.launcherHeight, 'border-radius': g.baloonShape}"
|
|
7
7
|
(click)="openCloseWidget()"
|
|
@@ -67,8 +67,9 @@ export class LauncherButtonComponent implements OnInit, AfterViewInit {
|
|
|
67
67
|
// this.g.isOpen = !this.g.isOpen;
|
|
68
68
|
// this.g.setIsOpen(!this.g.isOpen);
|
|
69
69
|
// this.appStorageService.setItem('isOpen', this.g.isOpen);
|
|
70
|
-
|
|
71
|
-
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
this.onButtonClicked.emit( this.g.isOpen );
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
}
|
|
@@ -1936,7 +1936,7 @@ export class GlobalSettingsService {
|
|
|
1936
1936
|
if (this.globals.departmentID) {
|
|
1937
1937
|
this.globals.departments.forEach(department => {
|
|
1938
1938
|
if (department._id === this.globals.departmentID) {
|
|
1939
|
-
|
|
1939
|
+
console.log('[GLOBAL-SET] setDepartmentFromExternal > EXTERNAL DEPARTMENT ::::' + department._id);
|
|
1940
1940
|
this.globals.setParameter('departmentDefault', department);
|
|
1941
1941
|
this.setDepartment(department);
|
|
1942
1942
|
isValidID = true;
|
|
@@ -1964,7 +1964,7 @@ export class GlobalSettingsService {
|
|
|
1964
1964
|
* save attributes in this.appStorageService
|
|
1965
1965
|
*/
|
|
1966
1966
|
setDepartment(department) {
|
|
1967
|
-
this.logger.
|
|
1967
|
+
this.logger.log('[GLOBAL-SET] setDepartment: ', JSON.stringify(department));
|
|
1968
1968
|
this.globals.setParameter('departmentSelected', department);
|
|
1969
1969
|
// let attributes = this.globals.attributes;
|
|
1970
1970
|
let attributes: any = JSON.parse(this.appStorageService.getItem('attributes'));
|
|
@@ -1983,7 +1983,7 @@ export class GlobalSettingsService {
|
|
|
1983
1983
|
this.logger.debug('[GLOBAL-SET] setDepartment > setAttributes: ', JSON.stringify(attributes));
|
|
1984
1984
|
this.globals.setParameter('departmentSelected', department);
|
|
1985
1985
|
this.globals.setParameter('attributes', attributes);
|
|
1986
|
-
|
|
1986
|
+
this.appStorageService.setItem('attributes', JSON.stringify(attributes));
|
|
1987
1987
|
|
|
1988
1988
|
}
|
|
1989
1989
|
// ========= end:: GET DEPARTEMENTS ============//
|
package/src/app/utils/globals.ts
CHANGED
|
@@ -247,7 +247,7 @@ export class Globals {
|
|
|
247
247
|
|
|
248
248
|
// ============ BEGIN: SET EXTERNAL PARAMETERS ==============//
|
|
249
249
|
this.baseLocation = 'https://widget.tiledesk.com/v2';
|
|
250
|
-
this.autoStart =
|
|
250
|
+
this.autoStart = false;
|
|
251
251
|
/** start Authentication and startUI */
|
|
252
252
|
this.startHidden = false;
|
|
253
253
|
/** show/hide all widget -> js call: showAllWidget */
|
package/src/assets/i18n/en.json
CHANGED
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"CONNECTION_NETWORK_ERROR": "Our apologies. There was some trouble connecting to network",
|
|
96
96
|
"EMOJI_NOT_ELLOWED":"Emoji not allowed",
|
|
97
97
|
"DOMAIN_NOT_ALLOWED":"URL contains a non-allowed domain",
|
|
98
|
+
"MAX_ATTACHMENT": "Max allowed size {{FILE_SIZE_LIMIT}}Mb",
|
|
98
99
|
"MAX_ATTACHMENT_ERROR": "The file exceeds the maximum allowed size",
|
|
99
|
-
"MAX_ATTACHMENT": "Max allowed size {{file_size_limit}}Mb",
|
|
100
100
|
"EMOJI": "Emoji"
|
|
101
101
|
}
|
package/src/assets/i18n/es.json
CHANGED
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"CONNECTION_NETWORK_ERROR": "Nuestras disculpas. Hubo algunos problemas para conectarse a la red",
|
|
96
96
|
"EMOJI_NOT_ELLOWED":"Emoji no permitido",
|
|
97
97
|
"DOMAIN_NOT_ALLOWED":"La URL contiene un dominio no permitido",
|
|
98
|
+
"MAX_ATTACHMENT": "Tamaño máximo permitido {{FILE_SIZE_LIMIT}}Mb",
|
|
98
99
|
"MAX_ATTACHMENT_ERROR": "El archivo supera el tamaño máximo permitido",
|
|
99
|
-
"MAX_ATTACHMENT": "Tamaño máximo permitido {{file_size_limit}}Mb",
|
|
100
100
|
"EMOJI": "Emoji"
|
|
101
101
|
}
|
package/src/assets/i18n/fr.json
CHANGED
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"CONNECTION_NETWORK_ERROR": "Nos excuses. Il y a eu des problèmes de connexion au réseau",
|
|
96
96
|
"EMOJI_NOT_ELLOWED":"Emoji non autorisé",
|
|
97
97
|
"DOMAIN_NOT_ALLOWED":"L'URL contient un domaine non autorisé",
|
|
98
|
+
"MAX_ATTACHMENT": "Taille maximale autorisée {{FILE_SIZE_LIMIT}}Mo",
|
|
98
99
|
"MAX_ATTACHMENT_ERROR": "Le fichier dépasse la taille maximale autorisée",
|
|
99
|
-
"MAX_ATTACHMENT": "Taille maximale autorisée {{file_size_limit}}Mo",
|
|
100
100
|
"EMOJI": "Emoji"
|
|
101
101
|
}
|
package/src/assets/i18n/it.json
CHANGED
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"CONNECTION_NETWORK_ERROR": "Ci scusiamo. Si sono verificati problemi di connessione di rete",
|
|
94
94
|
"EMOJI_NOT_ELLOWED":"Emoji non consentiti",
|
|
95
95
|
"DOMAIN_NOT_ALLOWED":"L'URL contiene un dominio non consentito",
|
|
96
|
+
"MAX_ATTACHMENT": "Dimensione massima consentita {{FILE_SIZE_LIMIT}}Mb",
|
|
96
97
|
"MAX_ATTACHMENT_ERROR": "Il file supera la dimensione massima consentita",
|
|
97
|
-
"MAX_ATTACHMENT": "Dimensione massima consentita {{file_size_limit}}Mb",
|
|
98
98
|
"EMOJI": "Emoji"
|
|
99
99
|
}
|
package/src/iframe-style.css
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
bottom: 0px;
|
|
14
14
|
width: auto;
|
|
15
15
|
height: auto;
|
|
16
|
-
display:
|
|
16
|
+
display: block;
|
|
17
17
|
z-index: 3000000000; /*999999*/;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
max-width: 1024px;
|
|
67
67
|
max-height: 100%;
|
|
68
68
|
|
|
69
|
-
transition:
|
|
69
|
+
/* transition:
|
|
70
70
|
width 300ms,
|
|
71
71
|
height 300ms,
|
|
72
72
|
max-height 300ms,
|
|
73
73
|
transform 300ms cubic-bezier(0, 1.2, 1, 1),
|
|
74
|
-
opacity 300ms ease-out;
|
|
74
|
+
opacity 300ms ease-out; */
|
|
75
75
|
/* per migliorare le prestazioni quando si usa transform */
|
|
76
76
|
will-change: transform, opacity, width, height;
|
|
77
77
|
}
|
|
@@ -151,14 +151,14 @@
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
#tiledesk-container.open #tiledeskdiv.min-size {
|
|
154
|
-
transition: width 200ms, height 200ms, max-height 200ms, transform 300ms cubic-bezier(0, 1.2, 1, 1), opacity 83ms ease-out;
|
|
154
|
+
/* transition: width 200ms, height 200ms, max-height 200ms, transform 300ms cubic-bezier(0, 1.2, 1, 1), opacity 83ms ease-out; */
|
|
155
155
|
width: var(--iframeMinWidth);
|
|
156
156
|
height: var(--iframeMinHeight);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
#tiledesk-container.open #tiledeskdiv.max-size {
|
|
160
160
|
/* transition: width 1s, height 1s; */
|
|
161
|
-
transition: width 200ms, height 200ms, max-height 200ms, transform 300ms cubic-bezier(0, 1.2, 1, 1), opacity 83ms ease-out;
|
|
161
|
+
/* transition: width 200ms, height 200ms, max-height 200ms, transform 300ms cubic-bezier(0, 1.2, 1, 1), opacity 83ms ease-out; */
|
|
162
162
|
width: var(--iframeMaxWidth);
|
|
163
163
|
height: var(--iframeMaxHeight);
|
|
164
164
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Component, Input, 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
|
-
@Input() keyErrorMessage: string = 'CONNECTION_NETWORK_ERROR';
|
|
12
|
-
translationMap: Map< string, string>;
|
|
13
|
-
|
|
14
|
-
constructor(
|
|
15
|
-
private customTranslateService: CustomTranslateService
|
|
16
|
-
){}
|
|
17
|
-
|
|
18
|
-
ngOnInit(): void {
|
|
19
|
-
let keys = [
|
|
20
|
-
this.keyErrorMessage
|
|
21
|
-
]
|
|
22
|
-
this.translationMap = this.customTranslateService.translateLanguage(keys)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}
|