@chat21/chat21-web-widget 5.1.7-rc7 → 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/CHANGELOG.md +7 -0
- 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 -5
- package/src/app/app.module.ts +16 -10
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +1 -14
- 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/utils/constants.ts +3 -0
- 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/app/component/network-offline/network-offline.component.ts +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
+
# 5.1.7-rc9
|
|
10
|
+
- **removed**: 'DOMAIN_NOT_ALLOWED' in textarea footer component
|
|
11
|
+
|
|
12
|
+
# 5.1.7-rc8
|
|
13
|
+
- **changed**: Updated the translations of the tooltips in the footer-component
|
|
14
|
+
- **changed**: Refactored the network-offline component and made it generic for displaying errors (now error-alert.component)
|
|
15
|
+
|
|
9
16
|
# 5.1.7-rc7
|
|
10
17
|
- **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
|
|
11
18
|
|
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/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>
|
package/src/app/app.component.ts
CHANGED
|
@@ -106,9 +106,12 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
106
106
|
|
|
107
107
|
forceDisconnect: boolean = false;
|
|
108
108
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
// alert error message
|
|
110
|
+
isShowErrorMessage: boolean = false;
|
|
111
|
+
errorMessage: string = '';
|
|
112
|
+
errorKeyMessage: string = null;
|
|
113
|
+
errorParams: Record<string, any> = {};
|
|
114
|
+
|
|
112
115
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
113
116
|
constructor(
|
|
114
117
|
private el: ElementRef,
|
|
@@ -2215,8 +2218,23 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
2215
2218
|
}
|
|
2216
2219
|
|
|
2217
2220
|
private listenToNetworkStatus(){
|
|
2218
|
-
window.addEventListener('online', () =>
|
|
2219
|
-
|
|
2221
|
+
window.addEventListener('online', () => {
|
|
2222
|
+
this.isShowErrorMessage = false;
|
|
2223
|
+
this.errorMessage = null;
|
|
2224
|
+
this.errorKeyMessage = null;
|
|
2225
|
+
});
|
|
2226
|
+
window.addEventListener('offline', () => {
|
|
2227
|
+
this.isShowErrorMessage = true;
|
|
2228
|
+
this.errorMessage = null;
|
|
2229
|
+
this.errorKeyMessage = 'CONNECTION_NETWORK_ERROR';
|
|
2230
|
+
});
|
|
2231
|
+
window.addEventListener('tooltipErrorMessage', (event: CustomEvent) => {
|
|
2232
|
+
// console.log('event-------------------> tooltipErrorMessage', event);
|
|
2233
|
+
this.isShowErrorMessage = event.detail?.error;
|
|
2234
|
+
this.errorKeyMessage = event.detail?.keyMessage || null;
|
|
2235
|
+
this.errorMessage = event.detail?.message || null;
|
|
2236
|
+
this.errorParams = event.detail?.params || {};
|
|
2237
|
+
});
|
|
2220
2238
|
}
|
|
2221
2239
|
|
|
2222
2240
|
// ========= 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
|
}
|
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
|
+
|
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
|
}
|
|
@@ -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
|
-
}
|