@chat21/chat21-web-widget 5.1.11 → 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 -22
- package/Dockerfile +5 -4
- package/angular.json +1 -2
- package/deploy_prod.sh +0 -3
- package/package.json +1 -1
- package/src/app/app.component.html +4 -11
- package/src/app/app.component.scss +1 -60
- package/src/app/app.component.ts +31 -91
- package/src/app/app.module.ts +10 -16
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +6 -19
- 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/launcher-button/launcher-button.component.html +1 -1
- package/src/app/component/launcher-button/launcher-button.component.ts +2 -3
- 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/translator.service.ts +0 -2
- package/src/app/utils/constants.ts +0 -3
- package/src/app/utils/globals.ts +1 -1
- 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/iframe-style.css +5 -5
- 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,28 +6,9 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
-
# 5.1.
|
|
10
|
-
- **bug-fixed**:
|
|
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
|
-
|
|
26
|
-
# 5.1.7-rc7
|
|
27
|
-
- **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
|
|
28
|
-
|
|
29
|
-
# 5.1.7-rc6
|
|
30
|
-
- **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
|
|
31
12
|
|
|
32
13
|
# 5.1.7-rc5
|
|
33
14
|
- **bug-fixed**: bug fixed BUTTON STYLES
|
|
@@ -49,6 +30,8 @@
|
|
|
49
30
|
- **bug-fixed**: bug fixed min-height message-receive
|
|
50
31
|
- **bug-fixed**: bug-fixed css footer
|
|
51
32
|
|
|
33
|
+
# 5.1.7
|
|
34
|
+
|
|
52
35
|
# 5.1.6
|
|
53
36
|
|
|
54
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/deploy_prod.sh
CHANGED
|
@@ -8,9 +8,6 @@ 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
|
-
|
|
14
11
|
## Push commit to git
|
|
15
12
|
git add .
|
|
16
13
|
git commit -m "version added: ### $version"
|
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>
|
|
@@ -145,12 +145,5 @@
|
|
|
145
145
|
<chat-launcher-button *ngIf="isInitialized"
|
|
146
146
|
(onButtonClicked)="onOpenCloseWidget($event)">
|
|
147
147
|
</chat-launcher-button>
|
|
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>
|
|
148
|
+
|
|
156
149
|
</div>
|
|
@@ -571,7 +571,7 @@ chat-root {
|
|
|
571
571
|
/***************************
|
|
572
572
|
***** NETWORK OFFLINE ******
|
|
573
573
|
****************************/
|
|
574
|
-
chat-
|
|
574
|
+
chat-network-offline {
|
|
575
575
|
position: absolute;
|
|
576
576
|
width: 100%;
|
|
577
577
|
height: 100%;
|
|
@@ -764,63 +764,4 @@ 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
|
-
|
|
826
767
|
}
|
package/src/app/app.component.ts
CHANGED
|
@@ -108,14 +108,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
108
108
|
|
|
109
109
|
//network status
|
|
110
110
|
isOnline: boolean = true;
|
|
111
|
-
loading: boolean = false;
|
|
112
111
|
|
|
113
|
-
// alert error message
|
|
114
|
-
isShowErrorMessage: boolean = false;
|
|
115
|
-
errorMessage: string = '';
|
|
116
|
-
errorKeyMessage: string = null;
|
|
117
|
-
errorParams: Record<string, any> = {};
|
|
118
|
-
|
|
119
112
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
120
113
|
constructor(
|
|
121
114
|
private el: ElementRef,
|
|
@@ -153,7 +146,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
153
146
|
this.logger.info('[APP-CONF]---------------- ngAfterViewInit: APP.COMPONENT ---------------- ')
|
|
154
147
|
|
|
155
148
|
// Initialize translation map and enable buttons
|
|
156
|
-
const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON'
|
|
149
|
+
const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON'];
|
|
157
150
|
this.translationMap = this.translateService.translateLanguage(keys);
|
|
158
151
|
this.isButtonsDisabled = false;
|
|
159
152
|
|
|
@@ -320,15 +313,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
320
313
|
this.g.setIsOpen(isOpen)
|
|
321
314
|
this.appStorageService.setItem('isOpen', isOpen)
|
|
322
315
|
}
|
|
323
|
-
|
|
324
|
-
|
|
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
|
-
|
|
316
|
+
|
|
317
|
+
|
|
332
318
|
/**CHECK IF JWT IS IN URL PARAMETERS */
|
|
333
319
|
this.logger.debug('[APP-COMP] check if token is passed throw url: ', this.g.jwt);
|
|
334
320
|
if (this.g.jwt) {
|
|
@@ -365,10 +351,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
365
351
|
this.subscriptions.push(obsSettingsService);
|
|
366
352
|
this.globalSettingsService.initWidgetParamiters(this.g, this.el);
|
|
367
353
|
|
|
354
|
+
// SET AUDIO
|
|
355
|
+
this.audio = new Audio();
|
|
356
|
+
this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
|
|
357
|
+
this.audio.load();
|
|
368
358
|
}
|
|
369
359
|
|
|
370
360
|
private initAll() {
|
|
371
|
-
this.logger.debug('[APP-COMP] initAll : ');
|
|
372
361
|
this.addComponentToWindow(this.ngZone);
|
|
373
362
|
|
|
374
363
|
//INIT TRIGGER-HANDLER
|
|
@@ -411,7 +400,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
411
400
|
|
|
412
401
|
|
|
413
402
|
/** NETWORK STATUS */
|
|
414
|
-
this.listenToNetworkStatus()
|
|
403
|
+
this.listenToNetworkStatus()
|
|
415
404
|
|
|
416
405
|
}
|
|
417
406
|
|
|
@@ -454,7 +443,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
454
443
|
that.triggerOnAuthStateChanged(that.stateLoggedUser);
|
|
455
444
|
that.logger.debug('[APP-COMP] 1 - IMPOSTO STATO CONNESSO UTENTE ', autoStart);
|
|
456
445
|
|
|
457
|
-
|
|
446
|
+
|
|
458
447
|
|
|
459
448
|
new Promise(async (resolve, reject)=> {
|
|
460
449
|
that.typingService.initialize(this.g.tenant);
|
|
@@ -480,35 +469,26 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
480
469
|
that.listenToWidgetClick()
|
|
481
470
|
}
|
|
482
471
|
|
|
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
|
-
}
|
|
488
472
|
|
|
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
|
-
}
|
|
494
473
|
|
|
495
474
|
} else if (state && state === AUTH_STATE_OFFLINE && !this.forceDisconnect) {
|
|
496
475
|
/** non sono loggato */
|
|
497
476
|
that.logger.info('[APP-COMP] OFFLINE - NO CURRENT USER AUTENTICATE: ');
|
|
498
477
|
that.g.setParameter('isLogged', false);
|
|
499
|
-
|
|
478
|
+
that.hideWidget();
|
|
500
479
|
// that.g.setParameter('isShown', false, true);
|
|
501
480
|
that.triggerOnAuthStateChanged(that.stateLoggedUser);
|
|
502
|
-
if (autoStart
|
|
481
|
+
if (autoStart) {
|
|
503
482
|
that.authenticate();
|
|
504
483
|
}
|
|
505
|
-
}
|
|
484
|
+
}else if(state && state === AUTH_STATE_CLOSE ){
|
|
506
485
|
that.logger.info('[APP-COMP] CLOSE - CHANNEL CLOSED: ', this.chatManager);
|
|
507
486
|
if(this.g.recipientId){
|
|
508
487
|
this.chatManager.removeConversationHandler(this.g.recipientId)
|
|
509
488
|
this.g.recipientId = null;
|
|
510
489
|
}
|
|
511
|
-
}
|
|
490
|
+
}
|
|
491
|
+
|
|
512
492
|
|
|
513
493
|
});
|
|
514
494
|
this.subscriptions.push(subAuthStateChanged);
|
|
@@ -753,7 +733,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
753
733
|
// divWidgetContainer.style.display = 'block';
|
|
754
734
|
// }
|
|
755
735
|
// }, 500);
|
|
756
|
-
this.loading = false;
|
|
757
736
|
}
|
|
758
737
|
// ========= end:: START UI ============//
|
|
759
738
|
|
|
@@ -862,13 +841,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
862
841
|
this.appStorageService.setItem('attributes', JSON.stringify(attributes));
|
|
863
842
|
return attributes;
|
|
864
843
|
}
|
|
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
|
-
}
|
|
844
|
+
|
|
872
845
|
|
|
873
846
|
private async initConversationsHandler(tenant: string, senderId: string) {
|
|
874
847
|
this.logger.debug('[APP-COMP] initialize: ListConversationsComponent');
|
|
@@ -1141,7 +1114,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1141
1114
|
* 3 - reinit widget
|
|
1142
1115
|
*/
|
|
1143
1116
|
private reInit() {
|
|
1144
|
-
this.logger.debug('[APP-COMP] reInit');
|
|
1145
1117
|
// if (!firebase.auth().currentUser) {
|
|
1146
1118
|
if (!this.tiledeskAuthService.getCurrentUser()) {
|
|
1147
1119
|
this.logger.debug('[APP-COMP] reInit ma NON SONO LOGGATO!');
|
|
@@ -1175,7 +1147,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1175
1147
|
*/
|
|
1176
1148
|
private restart() {
|
|
1177
1149
|
// if (!firebase.auth().currentUser) {
|
|
1178
|
-
|
|
1150
|
+
|
|
1179
1151
|
this.hideWidget();
|
|
1180
1152
|
// that.triggerOnAuthStateChanged(resp);
|
|
1181
1153
|
if (this.g.autoStart !== false) {
|
|
@@ -1628,47 +1600,23 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1628
1600
|
this.f21_close();
|
|
1629
1601
|
}
|
|
1630
1602
|
|
|
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
|
-
|
|
1645
1603
|
/**
|
|
1646
1604
|
* LAUNCHER BUTTON:
|
|
1647
1605
|
* onClick button open/close widget
|
|
1648
1606
|
*/
|
|
1649
1607
|
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() {
|
|
1660
1608
|
this.g.setParameter('displayEyeCatcherCard', 'none');
|
|
1661
1609
|
// const conversationActive: ConversationModel = JSON.parse(this.appStorageService.getItem('activeConversation'));
|
|
1662
1610
|
const recipientId : string = this.appStorageService.getItem('recipientId')
|
|
1663
1611
|
this.g.setParameter('recipientId', recipientId);
|
|
1664
1612
|
this.logger.debug('[APP-COMP] openCloseWidget', recipientId, this.g.isOpen, this.g.startFromHome);
|
|
1665
|
-
|
|
1666
1613
|
if (this.g.isOpen === false) {
|
|
1667
1614
|
if(this.forceDisconnect){
|
|
1668
1615
|
this.logger.log('[FORCE] onOpenCloseWidget --> reconnect', this.forceDisconnect)
|
|
1669
1616
|
this.messagingAuthService.createCustomToken(this.g.tiledeskToken)
|
|
1670
1617
|
this.forceDisconnect = false;
|
|
1671
1618
|
}
|
|
1619
|
+
|
|
1672
1620
|
if (!recipientId) {
|
|
1673
1621
|
if(this.g.singleConversation){
|
|
1674
1622
|
this.isOpenHome = false;
|
|
@@ -1688,22 +1636,29 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1688
1636
|
this.isOpenHome = false;
|
|
1689
1637
|
this.isOpenConversation = true;
|
|
1690
1638
|
this.startUI()
|
|
1639
|
+
// this.isOpenSelectionDepartment = false;
|
|
1691
1640
|
}
|
|
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;
|
|
1692
1650
|
this.triggerOnOpenEvent();
|
|
1651
|
+
|
|
1693
1652
|
} else {
|
|
1694
1653
|
this.triggerOnCloseEvent();
|
|
1695
1654
|
}
|
|
1696
1655
|
//change status to the widget
|
|
1697
1656
|
this.g.setIsOpen(!this.g.isOpen);
|
|
1698
1657
|
this.appStorageService.setItem('isOpen', this.g.isOpen);
|
|
1699
|
-
|
|
1700
|
-
if(this.g.isOpen === true && !this.g.isLogged){
|
|
1701
|
-
this.loading = true;
|
|
1702
|
-
}
|
|
1658
|
+
|
|
1703
1659
|
// this.saveBadgeNewConverstionNumber();
|
|
1704
1660
|
}
|
|
1705
1661
|
|
|
1706
|
-
|
|
1707
1662
|
/**
|
|
1708
1663
|
* MODAL SELECTION DEPARTMENT:
|
|
1709
1664
|
* selected department
|
|
@@ -2260,23 +2215,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
2260
2215
|
}
|
|
2261
2216
|
|
|
2262
2217
|
private listenToNetworkStatus(){
|
|
2263
|
-
window.addEventListener('online', () =>
|
|
2264
|
-
|
|
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
|
-
});
|
|
2218
|
+
window.addEventListener('online', () => this.isOnline = true);
|
|
2219
|
+
window.addEventListener('offline', () => this.isOnline = false);
|
|
2280
2220
|
}
|
|
2281
2221
|
|
|
2282
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) {
|
|
@@ -1441,4 +1427,5 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
1441
1427
|
this.isHovering = false
|
|
1442
1428
|
}
|
|
1443
1429
|
|
|
1444
|
-
}
|
|
1430
|
+
}
|
|
1431
|
+
|
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
|
|
@@ -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.isOpen == false"
|
|
4
|
+
*ngIf="g.isLogged == true && 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,9 +67,8 @@ 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
|
-
}
|
|
72
|
-
this.onButtonClicked.emit( this.g.isOpen );
|
|
70
|
+
this.onButtonClicked.emit( this.g.isOpen );
|
|
71
|
+
}
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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/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 = true;
|
|
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,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
|
+
|
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: none;
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,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
|
-
|