@chat21/chat21-web-widget 5.1.7-rc9 → 5.1.12
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 +13 -23
- package/.github/workflows/docker-image-tag-community-tag-push.yml +12 -22
- package/CHANGELOG.md +5 -12
- package/Dockerfile +5 -4
- package/angular.json +1 -2
- 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 +5 -23
- package/src/app/app.module.ts +10 -16
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +4 -18
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +1 -1
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +0 -25
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +22 -42
- package/src/app/component/{error-alert/error-alert.component.html → network-offline/network-offline.component.html} +2 -4
- package/src/app/component/{error-alert/error-alert.component.scss → network-offline/network-offline.component.scss} +1 -3
- package/src/app/component/{error-alert/error-alert.component.spec.ts → network-offline/network-offline.component.spec.ts} +6 -8
- package/src/app/component/network-offline/network-offline.component.ts +24 -0
- package/src/app/providers/global-settings.service.ts +3 -3
- package/src/app/providers/translator.service.ts +0 -2
- package/src/app/utils/constants.ts +0 -3
- package/src/assets/i18n/en.json +1 -2
- package/src/assets/i18n/es.json +1 -2
- package/src/assets/i18n/fr.json +1 -2
- package/src/assets/i18n/it.json +1 -2
- package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +1 -1
- package/src/chat21-core/utils/utils.ts +11 -11
- package/src/app/component/error-alert/error-alert.component.ts +0 -47
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
name: Docker Image Community latest CI
|
|
2
2
|
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
5
|
branches: [ master ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
10
|
push_to_registry:
|
|
@@ -12,22 +12,12 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
25
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
26
|
-
|
|
27
|
-
- name: Build and push multiarch Docker image
|
|
28
|
-
uses: docker/build-push-action@v3
|
|
29
|
-
with:
|
|
30
|
-
context: .
|
|
31
|
-
push: true
|
|
32
|
-
platforms: linux/amd64,linux/arm64
|
|
33
|
-
tags: chat21/chat21-web-widget:latest
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
name: Check out the repo
|
|
17
|
+
- uses: docker/build-push-action@v1
|
|
18
|
+
with:
|
|
19
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
20
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
21
|
+
repository: chat21/chat21-web-widget
|
|
22
|
+
push: true
|
|
23
|
+
tags: latest
|
|
@@ -3,30 +3,20 @@ name: Publish Docker Community image tags
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
tags:
|
|
6
|
-
- '**'
|
|
7
|
-
|
|
6
|
+
- '**' # Push events to every tag including hierarchical tags like
|
|
8
7
|
jobs:
|
|
8
|
+
|
|
9
9
|
push_to_registry:
|
|
10
10
|
name: Push Docker image to Docker Hub
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
12
|
steps:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
25
|
-
|
|
26
|
-
- name: Build and push multiarch Docker image
|
|
27
|
-
uses: docker/build-push-action@v3
|
|
28
|
-
with:
|
|
29
|
-
context: .
|
|
30
|
-
push: true
|
|
31
|
-
platforms: linux/amd64,linux/arm64
|
|
32
|
-
tags: chat21/chat21-web-widget:${{ github.ref_name }}
|
|
13
|
+
- name: Check out the repo
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
- name: Push to Docker Hub
|
|
16
|
+
uses: docker/build-push-action@v1
|
|
17
|
+
with:
|
|
18
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
19
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
20
|
+
repository: chat21/chat21-web-widget
|
|
21
|
+
push: true
|
|
22
|
+
tag_with_ref: true
|
package/CHANGELOG.md
CHANGED
|
@@ -6,18 +6,9 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
-
# 5.1.
|
|
10
|
-
- **
|
|
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
|
-
|
|
16
|
-
# 5.1.7-rc7
|
|
17
|
-
- **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
|
|
18
|
-
|
|
19
|
-
# 5.1.7-rc6
|
|
20
|
-
- **added**: Added MAX_ATTACHMENT_ERROR error message when uploading a file larger than 10 MB
|
|
9
|
+
# 5.1.12
|
|
10
|
+
- **bug-fixed**: check showEmojiFooterButton to enable/disable emojii
|
|
11
|
+
- **bug-fixed**: markdown is fired as an emojii and blocked by isEmojii check fn
|
|
21
12
|
|
|
22
13
|
# 5.1.7-rc5
|
|
23
14
|
- **bug-fixed**: bug fixed BUTTON STYLES
|
|
@@ -39,6 +30,8 @@
|
|
|
39
30
|
- **bug-fixed**: bug fixed min-height message-receive
|
|
40
31
|
- **bug-fixed**: bug-fixed css footer
|
|
41
32
|
|
|
33
|
+
# 5.1.7
|
|
34
|
+
|
|
42
35
|
# 5.1.6
|
|
43
36
|
|
|
44
37
|
# 5.1.5
|
package/Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
### STAGE 1: Build ###
|
|
2
2
|
|
|
3
3
|
# We label our stage as ‘builder’
|
|
4
|
-
FROM
|
|
4
|
+
FROM node:20.12.2-alpine3.19 as builder
|
|
5
5
|
|
|
6
6
|
COPY package.json package-lock.json ./
|
|
7
7
|
|
|
@@ -15,11 +15,12 @@ COPY . .
|
|
|
15
15
|
|
|
16
16
|
## Build the angular app in production mode and store the artifacts in dist folder
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
RUN npx ng build --configuration="prod" --output-path=dist --base-href=./ --output-hashing=none
|
|
20
19
|
|
|
20
|
+
|
|
21
21
|
### STAGE 2: Setup ###
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
FROM nginx:1.14.1-alpine
|
|
23
24
|
|
|
24
25
|
## Copy our default nginx config
|
|
25
26
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
@@ -32,4 +33,4 @@ COPY --from=builder /ng-app/dist/browser /usr/share/nginx/html
|
|
|
32
33
|
|
|
33
34
|
RUN echo "Chat21 Web Widget Started!!"
|
|
34
35
|
|
|
35
|
-
CMD ["/bin/sh",
|
|
36
|
+
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/widget-config-template.json > /usr/share/nginx/html/widget-config.json && exec nginx -g 'daemon off;'"]
|
package/angular.json
CHANGED
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
"src/environments/real_data/widget-config-docker.json",
|
|
45
45
|
"src/environments/real_data/widget-config-native-mqtt.json",
|
|
46
46
|
"src/environments/real_data/widget-config-native-prod.json",
|
|
47
|
-
"src/environments/real_data/widget-config-aws-stage.json"
|
|
48
|
-
"src/environments/real_data/widget-config-aws-aruba.json"
|
|
47
|
+
"src/environments/real_data/widget-config-aws-stage.json"
|
|
49
48
|
],
|
|
50
49
|
"styles": [
|
|
51
50
|
"src/app/sass/styles.scss"
|
package/package.json
CHANGED
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
|
|
106
106
|
<!--
|
|
107
107
|
****************************************
|
|
108
|
-
|
|
108
|
+
******* MODALE OFFLINE NETWORK *********
|
|
109
109
|
****************************************
|
|
110
110
|
-->
|
|
111
|
-
<div *ngIf="g.isOpen &&
|
|
112
|
-
<chat-
|
|
111
|
+
<div *ngIf="g.isOpen && !isOnline" class="modal-page star-rating-widget active">
|
|
112
|
+
<chat-network-offline></chat-network-offline>
|
|
113
113
|
</div>
|
|
114
114
|
|
|
115
115
|
</div>
|
package/src/app/app.component.ts
CHANGED
|
@@ -106,12 +106,9 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
106
106
|
|
|
107
107
|
forceDisconnect: boolean = false;
|
|
108
108
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
errorKeyMessage: string = null;
|
|
113
|
-
errorParams: Record<string, any> = {};
|
|
114
|
-
|
|
109
|
+
//network status
|
|
110
|
+
isOnline: boolean = true;
|
|
111
|
+
|
|
115
112
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
116
113
|
constructor(
|
|
117
114
|
private el: ElementRef,
|
|
@@ -2218,23 +2215,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
2218
2215
|
}
|
|
2219
2216
|
|
|
2220
2217
|
private listenToNetworkStatus(){
|
|
2221
|
-
window.addEventListener('online', () =>
|
|
2222
|
-
|
|
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
|
-
});
|
|
2218
|
+
window.addEventListener('online', () => this.isOnline = true);
|
|
2219
|
+
window.addEventListener('offline', () => this.isOnline = false);
|
|
2238
2220
|
}
|
|
2239
2221
|
|
|
2240
2222
|
// ========= begin:: DESTROY ALL SUBSCRIPTIONS ============//
|
package/src/app/app.module.ts
CHANGED
|
@@ -59,8 +59,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
|
59
59
|
import { environment } from 'src/environments/environment';
|
|
60
60
|
|
|
61
61
|
//THIRD-PART MODULES
|
|
62
|
-
import {
|
|
63
|
-
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
62
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
64
63
|
// import { MomentModule } from 'ngx-moment';
|
|
65
64
|
import { PickerModule } from '@ctrl/ngx-emoji-mart';
|
|
66
65
|
import { LoggerModule, NGXLogger, NgxLoggerLevel } from "ngx-logger";
|
|
@@ -135,7 +134,7 @@ import { Rules } from './utils/rules';
|
|
|
135
134
|
import { ScriptService } from 'src/chat21-core/providers/scripts/script.service';
|
|
136
135
|
import { CarouselComponent } from './component/message/carousel/carousel.component';
|
|
137
136
|
import { BrandService } from './providers/brand.service';
|
|
138
|
-
import {
|
|
137
|
+
import { NetworkOfflineComponent } from './component/network-offline/network-offline.component';
|
|
139
138
|
import { ConfirmCloseComponent } from './modals/confirm-close/confirm-close.component';
|
|
140
139
|
|
|
141
140
|
|
|
@@ -205,11 +204,6 @@ export function conversationHandlerFactory(chat21Service: Chat21Service, appConf
|
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
206
|
|
|
208
|
-
// ngx-translate Http loader factory
|
|
209
|
-
export function createTranslateLoader(http: HttpClient) {
|
|
210
|
-
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
207
|
export function typingFactory(chat21Service: Chat21Service, appConfig: AppConfigService) {
|
|
214
208
|
const config = appConfig.getConfig()
|
|
215
209
|
if (config.chatEngine === CHAT_ENGINE_MQTT) {
|
|
@@ -306,7 +300,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
306
300
|
LikeUnlikeComponent,
|
|
307
301
|
TooltipDirective,
|
|
308
302
|
CarouselComponent,
|
|
309
|
-
|
|
303
|
+
NetworkOfflineComponent,
|
|
310
304
|
ConfirmCloseComponent
|
|
311
305
|
],
|
|
312
306
|
imports: [BrowserModule,
|
|
@@ -314,13 +308,13 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
|
|
|
314
308
|
FormsModule,
|
|
315
309
|
ReactiveFormsModule,
|
|
316
310
|
PickerModule,
|
|
317
|
-
TranslateModule.forRoot(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
311
|
+
TranslateModule.forRoot(//),
|
|
312
|
+
{
|
|
313
|
+
// loader: {
|
|
314
|
+
// provide: TranslateLoader,
|
|
315
|
+
// useFactory: (createTranslateLoader),
|
|
316
|
+
// deps: [HttpClient]
|
|
317
|
+
// }
|
|
324
318
|
}),
|
|
325
319
|
LoggerModule.forRoot({
|
|
326
320
|
level: NgxLoggerLevel.DEBUG,
|
|
@@ -457,7 +457,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
457
457
|
return this.isConversationArchived;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
//
|
|
460
|
+
//FALLBACK TO TILEDESK
|
|
461
461
|
const requests_list = await this.tiledeskRequestService.getMyRequests().catch(err => {
|
|
462
462
|
this.logger.error('[CONV-COMP] getConversationDetail: error getting request from Tiledesk', err);
|
|
463
463
|
this.isConversationArchived=true
|
|
@@ -475,9 +475,9 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
475
475
|
return this.isConversationArchived
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
478
|
+
this.isConversationArchived = true;
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
481
|
|
|
482
482
|
/**
|
|
483
483
|
* this.g.recipientId:
|
|
@@ -827,20 +827,6 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
827
827
|
this.subscriptions.push(subscribe);
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
-
subscribtionKey = 'conversationsAdded';
|
|
831
|
-
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
832
|
-
if(!subscribtion){
|
|
833
|
-
|
|
834
|
-
subscribtion = this.chatManager.conversationsHandlerService.conversationChanged.pipe(takeUntil(this.unsubscribe$)).subscribe((conversation) => {
|
|
835
|
-
this.logger.debug('[CONV-COMP] ***** DATAIL conversationsChanged *****', conversation, this.conversationWith, this.isConversationArchived);
|
|
836
|
-
if(conversation && conversation.recipient === this.conversationId){
|
|
837
|
-
this.isConversationArchived = false
|
|
838
|
-
}
|
|
839
|
-
});
|
|
840
|
-
const subscribe = {key: subscribtionKey, value: subscribtion };
|
|
841
|
-
this.subscriptions.push(subscribe);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
830
|
subscribtionKey = 'messageWait';
|
|
845
831
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
846
832
|
if (!subscribtion) {
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<span class="v-align-center">
|
|
24
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">
|
|
25
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"/>
|
|
26
|
-
<title id="altIconTitle">{{ 'MAX_ATTACHMENT'
|
|
26
|
+
<title id="altIconTitle">{{ attachmentTooltip || translationMap?.get('MAX_ATTACHMENT') }}</title>
|
|
27
27
|
</svg>
|
|
28
28
|
|
|
29
29
|
</span>
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss
CHANGED
|
@@ -418,28 +418,3 @@ textarea:active{
|
|
|
418
418
|
border: none;
|
|
419
419
|
// margin: -2px -2px 0px;
|
|
420
420
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// aggiungi un'animazione di fade in e fade out quando .star-rating-widget è visibile con transition
|
|
424
|
-
.star-rating-widget {
|
|
425
|
-
transition: all 0.5s ease-in-out;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.star-rating-widget {
|
|
429
|
-
position: absolute;
|
|
430
|
-
left: 0;
|
|
431
|
-
right: 0;
|
|
432
|
-
bottom: -52px;
|
|
433
|
-
height: 100%;
|
|
434
|
-
width: 100%;
|
|
435
|
-
flex-direction: row;
|
|
436
|
-
justify-content: center;
|
|
437
|
-
background-color: rgb(255, 255, 255);
|
|
438
|
-
flex-wrap: nowrap;
|
|
439
|
-
&.active {
|
|
440
|
-
bottom: 0px;
|
|
441
|
-
}
|
|
442
|
-
&.inactive {
|
|
443
|
-
bottom: -52px;
|
|
444
|
-
}
|
|
445
|
-
}
|
package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
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';
|
|
4
2
|
import { Globals } from 'src/app/utils/globals';
|
|
5
3
|
import { checkAcceptedFile } from 'src/app/utils/utils';
|
|
6
4
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
@@ -85,10 +83,8 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
85
83
|
|
|
86
84
|
showAlertEmoji: boolean = false
|
|
87
85
|
|
|
88
|
-
file_size_limit =
|
|
86
|
+
file_size_limit: number = 10;
|
|
89
87
|
attachmentTooltip: string = '';
|
|
90
|
-
isErrorNetwork: boolean = false;
|
|
91
|
-
|
|
92
88
|
|
|
93
89
|
convertColorToRGBA = convertColorToRGBA;
|
|
94
90
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
@@ -97,7 +93,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
97
93
|
private uploadService: UploadService) { }
|
|
98
94
|
|
|
99
95
|
ngOnInit() {
|
|
100
|
-
|
|
96
|
+
this.updateAttachmentTooltip();
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
|
|
@@ -113,9 +109,9 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
113
109
|
this.onDrop(this.dropEvent)
|
|
114
110
|
}
|
|
115
111
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
if(changes['translationMap'] && changes['translationMap'].currentValue !== undefined){
|
|
113
|
+
this.updateAttachmentTooltip();
|
|
114
|
+
}
|
|
119
115
|
|
|
120
116
|
}
|
|
121
117
|
|
|
@@ -124,24 +120,24 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
124
120
|
// setTimeout(() => {
|
|
125
121
|
this.showEmojiPicker = true
|
|
126
122
|
// }, 500);
|
|
127
|
-
|
|
123
|
+
this.updateAttachmentTooltip();
|
|
128
124
|
}
|
|
129
125
|
|
|
130
126
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
updateAttachmentTooltip() {
|
|
128
|
+
// Use setTimeout to wait for the async translation map to be populated
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
this.logger.log('[CONV-FOOTER] updateAttachmentTooltip - translationMap:', this.translationMap);
|
|
131
|
+
if (this.translationMap && this.translationMap.has('MAX_ATTACHMENT')) {
|
|
132
|
+
const template = this.translationMap.get('MAX_ATTACHMENT');
|
|
133
|
+
this.logger.log('[CONV-FOOTER] MAX_ATTACHMENT template:', template);
|
|
134
|
+
this.attachmentTooltip = template.replace('{{file_size_limit}}', this.file_size_limit.toString());
|
|
135
|
+
this.logger.log('[CONV-FOOTER] attachmentTooltip:', this.attachmentTooltip);
|
|
136
|
+
} else {
|
|
137
|
+
this.logger.log('[CONV-FOOTER] MAX_ATTACHMENT not found in translationMap');
|
|
138
|
+
}
|
|
139
|
+
}, 500);
|
|
140
|
+
}
|
|
145
141
|
|
|
146
142
|
// ========= begin:: functions send image ======= //
|
|
147
143
|
// START LOAD IMAGE //
|
|
@@ -231,12 +227,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
231
227
|
const fileXLoad = this.arrayFilesLoad[0].file;
|
|
232
228
|
const uid = this.arrayFilesLoad[0].uid;
|
|
233
229
|
const type = this.arrayFilesLoad[0].type;
|
|
234
|
-
const size = this.arrayFilesLoad[0].size
|
|
235
|
-
if(size > this.file_size_limit * 1024 * 1024){
|
|
236
|
-
this.logger.error('[CONV-FOOTER] file size is greater than the limit: ', size, this.file_size_limit * 1024 * 1024);
|
|
237
|
-
this.showErrorNetwork();
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
230
|
+
const size = this.arrayFilesLoad[0].size
|
|
240
231
|
this.logger.log('[CONV-FOOTER] that.fileXLoad: ', type);
|
|
241
232
|
let metadata;
|
|
242
233
|
if (type.startsWith('image') && !type.includes('svg')) {
|
|
@@ -273,17 +264,6 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
273
264
|
}
|
|
274
265
|
|
|
275
266
|
|
|
276
|
-
private showErrorNetwork() {
|
|
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' } }));
|
|
280
|
-
setTimeout(() => {
|
|
281
|
-
this.isFilePendingToUpload = false;
|
|
282
|
-
this.hideTextReply = false;
|
|
283
|
-
window.dispatchEvent(new CustomEvent('tooltipErrorMessage', { detail: { error: false, message: '', keyMessage: null } }));
|
|
284
|
-
}, 5000);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
267
|
uploadSingle(metadata, file, messageText?: string) {
|
|
288
268
|
const that = this;
|
|
289
269
|
try {
|
|
@@ -570,7 +550,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
|
|
|
570
550
|
|
|
571
551
|
checkForEmojii(text){
|
|
572
552
|
//remove emojii only if "emojii" exist and is set to false
|
|
573
|
-
if(this.
|
|
553
|
+
if(!this.showEmojiFooterButton){
|
|
574
554
|
this.showAlertEmoji = isEmoji(text);
|
|
575
555
|
if(this.showAlertEmoji){
|
|
576
556
|
return false
|
|
@@ -3,8 +3,6 @@
|
|
|
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
|
+
{{ translationMap.get('CONNECTION_NETWORK_ERROR')}}
|
|
7
7
|
</div>
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
</div>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { NetworkOfflineComponent } from './network-offline.component';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
5
|
+
describe('NetworkOfflineComponent', () => {
|
|
6
|
+
let component: NetworkOfflineComponent;
|
|
7
|
+
let fixture: ComponentFixture<NetworkOfflineComponent>;
|
|
8
8
|
|
|
9
9
|
beforeEach(async () => {
|
|
10
10
|
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [
|
|
11
|
+
declarations: [ NetworkOfflineComponent ]
|
|
12
12
|
})
|
|
13
13
|
.compileComponents();
|
|
14
14
|
|
|
15
|
-
fixture = TestBed.createComponent(
|
|
15
|
+
fixture = TestBed.createComponent(NetworkOfflineComponent);
|
|
16
16
|
component = fixture.componentInstance;
|
|
17
17
|
fixture.detectChanges();
|
|
18
18
|
});
|
|
@@ -21,5 +21,3 @@ describe('ErrorAlertComponent', () => {
|
|
|
21
21
|
expect(component).toBeTruthy();
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
}
|
|
@@ -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 ============//
|
|
@@ -263,7 +263,6 @@ export class TranslatorService {
|
|
|
263
263
|
'CLOSED',
|
|
264
264
|
'LABEL_PREVIEW',
|
|
265
265
|
'MAX_ATTACHMENT',
|
|
266
|
-
'MAX_ATTACHMENT_ERROR',
|
|
267
266
|
'EMOJI'
|
|
268
267
|
];
|
|
269
268
|
|
|
@@ -320,7 +319,6 @@ export class TranslatorService {
|
|
|
320
319
|
globals.LABEL_PREVIEW = res['LABEL_PREVIEW']
|
|
321
320
|
globals.LABEL_ERROR_FIELD_REQUIRED= res['LABEL_ERROR_FIELD_REQUIRED']
|
|
322
321
|
globals.MAX_ATTACHMENT = res['MAX_ATTACHMENT']
|
|
323
|
-
globals.MAX_ATTACHMENT_ERROR = res['MAX_ATTACHMENT_ERROR']
|
|
324
322
|
globals.EMOJI = res['EMOJI']
|
|
325
323
|
|
|
326
324
|
|
package/src/assets/i18n/en.json
CHANGED
|
@@ -95,7 +95,6 @@
|
|
|
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 {{
|
|
99
|
-
"MAX_ATTACHMENT_ERROR": "The file exceeds the maximum allowed size",
|
|
98
|
+
"MAX_ATTACHMENT": "Max allowed size {{file_size_limit}}Mb",
|
|
100
99
|
"EMOJI": "Emoji"
|
|
101
100
|
}
|
package/src/assets/i18n/es.json
CHANGED
|
@@ -95,7 +95,6 @@
|
|
|
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 {{
|
|
99
|
-
"MAX_ATTACHMENT_ERROR": "El archivo supera el tamaño máximo permitido",
|
|
98
|
+
"MAX_ATTACHMENT": "Tamaño máximo permitido {{file_size_limit}}Mb",
|
|
100
99
|
"EMOJI": "Emoji"
|
|
101
100
|
}
|
package/src/assets/i18n/fr.json
CHANGED
|
@@ -95,7 +95,6 @@
|
|
|
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 {{
|
|
99
|
-
"MAX_ATTACHMENT_ERROR": "Le fichier dépasse la taille maximale autorisée",
|
|
98
|
+
"MAX_ATTACHMENT": "Taille maximale autorisée {{file_size_limit}}Mo",
|
|
100
99
|
"EMOJI": "Emoji"
|
|
101
100
|
}
|
package/src/assets/i18n/it.json
CHANGED
|
@@ -93,7 +93,6 @@
|
|
|
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 {{
|
|
97
|
-
"MAX_ATTACHMENT_ERROR": "Il file supera la dimensione massima consentita",
|
|
96
|
+
"MAX_ATTACHMENT": "Dimensione massima consentita {{file_size_limit}}Mb",
|
|
98
97
|
"EMOJI": "Emoji"
|
|
99
98
|
}
|
|
@@ -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 + 'me?preflight=true'
|
|
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({
|
|
@@ -333,12 +333,15 @@ export function replaceEndOfLine(text) {
|
|
|
333
333
|
|
|
334
334
|
export function isEmoji(str: string) {
|
|
335
335
|
// tslint:disable-next-line:max-line-length
|
|
336
|
-
const ranges = ['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
|
|
337
|
-
if (str.match(ranges.join('|'))) {
|
|
338
|
-
|
|
339
|
-
} else {
|
|
340
|
-
|
|
341
|
-
}
|
|
336
|
+
// const ranges = ['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
|
|
337
|
+
// if (str.match(ranges.join('|'))) {
|
|
338
|
+
// return true;
|
|
339
|
+
// } else {
|
|
340
|
+
// return false;
|
|
341
|
+
// }
|
|
342
|
+
const emojiRegex = /\p{Extended_Pictographic}/u;
|
|
343
|
+
return emojiRegex.test(str);
|
|
344
|
+
|
|
342
345
|
}
|
|
343
346
|
|
|
344
347
|
export function setColorFromString(str: string) {
|
|
@@ -661,11 +664,6 @@ export function isAllowedUrlInText(text: string, allowedUrls: string[]) {
|
|
|
661
664
|
return nonWhitelistedDomains.length === 0;
|
|
662
665
|
}
|
|
663
666
|
|
|
664
|
-
// function extractUrls(text: string): string[] {
|
|
665
|
-
// const urlRegex = /https?:\/\/[^\s]+/g;
|
|
666
|
-
// return text.match(urlRegex) || [];
|
|
667
|
-
// }
|
|
668
|
-
|
|
669
667
|
function extractUrls(text: string): string[] {
|
|
670
668
|
// Rileva URL con o senza protocollo (http/https)
|
|
671
669
|
const urlRegex = /\b((https?:\/\/)?(www\.)?[a-z0-9.-]+\.[a-z]{2,})(\/[^\s]*)?/gi;
|
|
@@ -680,3 +678,5 @@ function extractUrls(text: string): string[] {
|
|
|
680
678
|
}
|
|
681
679
|
|
|
682
680
|
|
|
681
|
+
|
|
682
|
+
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
|