@chat21/chat21-web-widget 5.1.4 → 5.1.7-rc14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docker-community-push-latest.yml +23 -13
- package/.github/workflows/docker-image-tag-community-tag-push.yml +22 -12
- package/CHANGELOG.md +53 -0
- package/Dockerfile +4 -5
- package/angular.json +2 -1
- package/package.json +1 -1
- package/src/app/app.component.html +11 -4
- package/src/app/app.component.scss +60 -1
- package/src/app/app.component.ts +83 -36
- package/src/app/app.module.ts +16 -10
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +1 -1
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +20 -5
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +1 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +8 -11
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +25 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +57 -23
- package/src/app/component/{network-offline/network-offline.component.html → error-alert/error-alert.component.html} +4 -2
- package/src/app/component/{network-offline/network-offline.component.scss → error-alert/error-alert.component.scss} +3 -1
- package/src/app/component/{network-offline/network-offline.component.spec.ts → error-alert/error-alert.component.spec.ts} +8 -6
- package/src/app/component/error-alert/error-alert.component.ts +47 -0
- package/src/app/component/launcher-button/launcher-button.component.html +1 -1
- package/src/app/component/launcher-button/launcher-button.component.ts +3 -2
- package/src/app/component/message/buttons/action-button/action-button.component.scss +6 -6
- package/src/app/component/message/buttons/action-button/action-button.component.ts +1 -1
- package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -5
- package/src/app/component/message/buttons/link-button/link-button.component.ts +2 -2
- package/src/app/component/message/buttons/text-button/text-button.component.scss +9 -12
- package/src/app/component/message/buttons/text-button/text-button.component.ts +4 -4
- package/src/app/component/message-attachment/message-attachment.component.html +3 -7
- package/src/app/providers/global-settings.service.ts +3 -3
- package/src/app/providers/translator.service.ts +8 -2
- package/src/app/sass/_variables.scss +1 -1
- package/src/app/utils/constants.ts +3 -0
- package/src/app/utils/globals.ts +2 -2
- package/src/app/utils/utils.ts +10 -12
- package/src/assets/i18n/en.json +4 -1
- package/src/assets/i18n/es.json +6 -1
- package/src/assets/i18n/fr.json +6 -1
- package/src/assets/i18n/it.json +6 -3
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +2 -2
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +22 -11
- package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +1 -1
- package/src/chat21-core/utils/utils.ts +15 -4
- package/src/iframe-style.css +6 -6
- package/deploy_amazon_beta.sh +0 -47
- package/deploy_amazon_prod.sh +0 -41
- package/src/app/component/network-offline/network-offline.component.ts +0 -24
|
@@ -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,12 +12,22 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
- name: Check out the repo
|
|
16
|
+
uses: actions/checkout@v2
|
|
17
|
+
|
|
18
|
+
- name: Set up Docker Buildx
|
|
19
|
+
uses: docker/setup-buildx-action@v2
|
|
20
|
+
|
|
21
|
+
- name: Log in to Docker Hub
|
|
22
|
+
uses: docker/login-action@v2
|
|
23
|
+
with:
|
|
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
|
|
@@ -3,20 +3,30 @@ name: Publish Docker Community image tags
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
tags:
|
|
6
|
-
- '**'
|
|
7
|
-
jobs:
|
|
6
|
+
- '**' # Trigger su qualsiasi tag
|
|
8
7
|
|
|
8
|
+
jobs:
|
|
9
9
|
push_to_registry:
|
|
10
10
|
name: Push Docker image to Docker Hub
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
|
+
|
|
12
13
|
steps:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
- name: Check out the repo
|
|
15
|
+
uses: actions/checkout@v2
|
|
16
|
+
|
|
17
|
+
- name: Set up Docker Buildx
|
|
18
|
+
uses: docker/setup-buildx-action@v2
|
|
19
|
+
|
|
20
|
+
- name: Log in to Docker Hub
|
|
21
|
+
uses: docker/login-action@v2
|
|
22
|
+
with:
|
|
23
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
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 }}
|
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,60 @@
|
|
|
6
6
|
### **Copyrigth**:
|
|
7
7
|
*Tiledesk SRL*
|
|
8
8
|
|
|
9
|
+
# 5.1.7-rc14
|
|
10
|
+
- **bug-fixed**: departmentId and departmentName is incorrect in attributes
|
|
9
11
|
|
|
12
|
+
# 5.1.7-rc13
|
|
13
|
+
- **changed**: Force authentication if ageChangeVisibilityDesktop or PageChangeVisibilityMobile is OPEN
|
|
14
|
+
|
|
15
|
+
# 5.1.7-rc12
|
|
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.7-rc11
|
|
21
|
+
- **changed**: set default value autoStart false
|
|
22
|
+
- **added**:added loading spinner
|
|
23
|
+
|
|
24
|
+
# 5.1.7-rc10
|
|
25
|
+
- **changed**: load widget without authentication and display the balloon
|
|
26
|
+
|
|
27
|
+
# 5.1.7-rc9
|
|
28
|
+
- **removed**: 'DOMAIN_NOT_ALLOWED' in textarea footer component
|
|
29
|
+
|
|
30
|
+
# 5.1.7-rc8
|
|
31
|
+
- **changed**: Updated the translations of the tooltips in the footer-component
|
|
32
|
+
- **changed**: Refactored the network-offline component and made it generic for displaying errors (now error-alert.component)
|
|
33
|
+
|
|
34
|
+
# 5.1.7-rc7
|
|
35
|
+
- **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
|
|
36
|
+
|
|
37
|
+
# 5.1.7-rc6
|
|
38
|
+
- **added**: Added MAX_ATTACHMENT_ERROR error message when uploading a file larger than 10 MB
|
|
39
|
+
|
|
40
|
+
# 5.1.7-rc5
|
|
41
|
+
- **bug-fixed**: bug fixed BUTTON STYLES
|
|
42
|
+
|
|
43
|
+
# 5.1.7-rc4
|
|
44
|
+
- **bug-fixed**: bug fixed widget fullscreen style
|
|
45
|
+
|
|
46
|
+
# 5.1.7-rc3
|
|
47
|
+
- **changed**: replace extractUrls
|
|
48
|
+
|
|
49
|
+
# 5.1.7-rc2
|
|
50
|
+
- **bug-fixed**: translations completed
|
|
51
|
+
- **changed**: set wait to 0 if messages have already been read
|
|
52
|
+
|
|
53
|
+
# 5.1.7-rc1
|
|
54
|
+
- **changed**: replace fullname with firstname
|
|
55
|
+
- **added**: added tooltip on attachment an emoji
|
|
56
|
+
- **bug-fixed**: bug fixed button color
|
|
57
|
+
- **bug-fixed**: bug fixed min-height message-receive
|
|
58
|
+
- **bug-fixed**: bug-fixed css footer
|
|
59
|
+
|
|
60
|
+
# 5.1.6
|
|
61
|
+
|
|
62
|
+
# 5.1.5
|
|
10
63
|
# 5.1.4
|
|
11
64
|
|
|
12
65
|
# 5.1.3-rc1
|
package/Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
### STAGE 1: Build ###
|
|
2
2
|
|
|
3
3
|
# We label our stage as ‘builder’
|
|
4
|
-
FROM node:20.12.2-alpine3.19 as builder
|
|
4
|
+
FROM --platform=$BUILDPLATFORM node:20.12.2-alpine3.19 as builder
|
|
5
5
|
|
|
6
6
|
COPY package.json package-lock.json ./
|
|
7
7
|
|
|
@@ -15,12 +15,11 @@ COPY . .
|
|
|
15
15
|
|
|
16
16
|
## Build the angular app in production mode and store the artifacts in dist folder
|
|
17
17
|
|
|
18
|
-
RUN npx ng build --configuration="prod" --output-path=dist --base-href=./ --output-hashing=none
|
|
19
18
|
|
|
19
|
+
RUN npx ng build --configuration="prod" --output-path=dist --base-href=./ --output-hashing=none
|
|
20
20
|
|
|
21
21
|
### STAGE 2: Setup ###
|
|
22
|
-
|
|
23
|
-
FROM nginx:1.14.1-alpine
|
|
22
|
+
FROM --platform=$BUILDPLATFORM nginx:1.14.1-alpine
|
|
24
23
|
|
|
25
24
|
## Copy our default nginx config
|
|
26
25
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
@@ -33,4 +32,4 @@ COPY --from=builder /ng-app/dist/browser /usr/share/nginx/html
|
|
|
33
32
|
|
|
34
33
|
RUN echo "Chat21 Web Widget Started!!"
|
|
35
34
|
|
|
36
|
-
CMD ["/bin/sh",
|
|
35
|
+
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,7 +44,8 @@
|
|
|
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"
|
|
47
|
+
"src/environments/real_data/widget-config-aws-stage.json",
|
|
48
|
+
"src/environments/real_data/widget-config-aws-aruba.json"
|
|
48
49
|
],
|
|
49
50
|
"styles": [
|
|
50
51
|
"src/app/sass/styles.scss"
|
package/package.json
CHANGED
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
|
|
106
106
|
<!--
|
|
107
107
|
****************************************
|
|
108
|
-
|
|
108
|
+
********* MODALE ERROR ALERT ***********
|
|
109
109
|
****************************************
|
|
110
110
|
-->
|
|
111
|
-
<div *ngIf="g.isOpen &&
|
|
112
|
-
<chat-
|
|
111
|
+
<div *ngIf="g.isOpen && isShowErrorMessage" class="modal-page star-rating-widget active">
|
|
112
|
+
<chat-error-alert [errorMessage]="errorMessage" [errorKeyMessage]="errorKeyMessage" [errorParams]="errorParams"></chat-error-alert>
|
|
113
113
|
</div>
|
|
114
114
|
|
|
115
115
|
</div>
|
|
@@ -145,5 +145,12 @@
|
|
|
145
145
|
<chat-launcher-button *ngIf="isInitialized"
|
|
146
146
|
(onButtonClicked)="onOpenCloseWidget($event)">
|
|
147
147
|
</chat-launcher-button>
|
|
148
|
-
|
|
148
|
+
|
|
149
|
+
<!-- Loading Spinner -->
|
|
150
|
+
<div *ngIf="loading" class="tiledesk-loading-overlay">
|
|
151
|
+
<div class="tiledesk-loading-spinner">
|
|
152
|
+
<div class="spinner-circle"></div>
|
|
153
|
+
<div class="loading-text">{{ translationMap.get('LABEL_LOADING') }}</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
149
156
|
</div>
|
|
@@ -571,7 +571,7 @@ chat-root {
|
|
|
571
571
|
/***************************
|
|
572
572
|
***** NETWORK OFFLINE ******
|
|
573
573
|
****************************/
|
|
574
|
-
chat-
|
|
574
|
+
chat-error-alert {
|
|
575
575
|
position: absolute;
|
|
576
576
|
width: 100%;
|
|
577
577
|
height: 100%;
|
|
@@ -764,4 +764,63 @@ chat-root {
|
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
|
|
767
|
+
// ========= BEGIN: LOADING SPINNER ========= //
|
|
768
|
+
.tiledesk-loading-overlay {
|
|
769
|
+
position: absolute;
|
|
770
|
+
top: 0;
|
|
771
|
+
left: 0;
|
|
772
|
+
width: 100%;
|
|
773
|
+
height: 100%;
|
|
774
|
+
background-color: rgba(248, 249, 250, 0.95);
|
|
775
|
+
display: flex;
|
|
776
|
+
justify-content: center;
|
|
777
|
+
align-items: center;
|
|
778
|
+
z-index: 9999;
|
|
779
|
+
backdrop-filter: blur(2px);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.tiledesk-loading-spinner {
|
|
783
|
+
display: flex;
|
|
784
|
+
flex-direction: column;
|
|
785
|
+
align-items: center;
|
|
786
|
+
gap: 16px;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.spinner-circle {
|
|
790
|
+
width: 50px;
|
|
791
|
+
height: 50px;
|
|
792
|
+
border: 4px solid rgba(59, 130, 246, 0.2);
|
|
793
|
+
border-top-color: #3b82f6;
|
|
794
|
+
border-radius: 50%;
|
|
795
|
+
animation: spin 0.8s linear infinite;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
@keyframes spin {
|
|
799
|
+
0% {
|
|
800
|
+
transform: rotate(0deg);
|
|
801
|
+
}
|
|
802
|
+
100% {
|
|
803
|
+
transform: rotate(360deg);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
.loading-text {
|
|
808
|
+
font-family: var(--font-family-bubble-message, 'Roboto', 'Google Sans', Helvetica, Arial, sans-serif);
|
|
809
|
+
font-size: 14px;
|
|
810
|
+
font-weight: 500;
|
|
811
|
+
color: #3b82f6;
|
|
812
|
+
letter-spacing: 0.5px;
|
|
813
|
+
animation: pulse 1.5s ease-in-out infinite;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
@keyframes pulse {
|
|
817
|
+
0%, 100% {
|
|
818
|
+
opacity: 1;
|
|
819
|
+
}
|
|
820
|
+
50% {
|
|
821
|
+
opacity: 0.5;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
// ========= END: LOADING SPINNER ========= //
|
|
825
|
+
|
|
767
826
|
}
|
package/src/app/app.component.ts
CHANGED
|
@@ -108,7 +108,14 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
108
108
|
|
|
109
109
|
//network status
|
|
110
110
|
isOnline: boolean = true;
|
|
111
|
+
loading: boolean = false;
|
|
111
112
|
|
|
113
|
+
// alert error message
|
|
114
|
+
isShowErrorMessage: boolean = false;
|
|
115
|
+
errorMessage: string = '';
|
|
116
|
+
errorKeyMessage: string = null;
|
|
117
|
+
errorParams: Record<string, any> = {};
|
|
118
|
+
|
|
112
119
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
113
120
|
constructor(
|
|
114
121
|
private el: ElementRef,
|
|
@@ -146,7 +153,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
146
153
|
this.logger.info('[APP-CONF]---------------- ngAfterViewInit: APP.COMPONENT ---------------- ')
|
|
147
154
|
|
|
148
155
|
// Initialize translation map and enable buttons
|
|
149
|
-
const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON'];
|
|
156
|
+
const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON', 'LABEL_LOADING'];
|
|
150
157
|
this.translationMap = this.translateService.translateLanguage(keys);
|
|
151
158
|
this.isButtonsDisabled = false;
|
|
152
159
|
|
|
@@ -313,8 +320,15 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
313
320
|
this.g.setIsOpen(isOpen)
|
|
314
321
|
this.appStorageService.setItem('isOpen', isOpen)
|
|
315
322
|
}
|
|
316
|
-
|
|
317
|
-
|
|
323
|
+
|
|
324
|
+
if(this.g.onPageChangeVisibilityDesktop === 'last'){
|
|
325
|
+
this.logger.debug('[APP-COMP2] ------this.g.isOpen: ', this.g.isOpen)
|
|
326
|
+
if(this.g.isOpen){
|
|
327
|
+
this.g.autoStart = true;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
318
332
|
/**CHECK IF JWT IS IN URL PARAMETERS */
|
|
319
333
|
this.logger.debug('[APP-COMP] check if token is passed throw url: ', this.g.jwt);
|
|
320
334
|
if (this.g.jwt) {
|
|
@@ -351,10 +365,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
351
365
|
this.subscriptions.push(obsSettingsService);
|
|
352
366
|
this.globalSettingsService.initWidgetParamiters(this.g, this.el);
|
|
353
367
|
|
|
354
|
-
// SET AUDIO
|
|
355
|
-
this.audio = new Audio();
|
|
356
|
-
this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
|
|
357
|
-
this.audio.load();
|
|
358
368
|
}
|
|
359
369
|
|
|
360
370
|
private initAll() {
|
|
@@ -400,7 +410,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
400
410
|
|
|
401
411
|
|
|
402
412
|
/** NETWORK STATUS */
|
|
403
|
-
this.listenToNetworkStatus()
|
|
413
|
+
this.listenToNetworkStatus();
|
|
404
414
|
|
|
405
415
|
}
|
|
406
416
|
|
|
@@ -443,7 +453,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
443
453
|
that.triggerOnAuthStateChanged(that.stateLoggedUser);
|
|
444
454
|
that.logger.debug('[APP-COMP] 1 - IMPOSTO STATO CONNESSO UTENTE ', autoStart);
|
|
445
455
|
|
|
446
|
-
|
|
456
|
+
this.initAudioNotification()
|
|
447
457
|
|
|
448
458
|
new Promise(async (resolve, reject)=> {
|
|
449
459
|
that.typingService.initialize(this.g.tenant);
|
|
@@ -469,26 +479,30 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
469
479
|
that.listenToWidgetClick()
|
|
470
480
|
}
|
|
471
481
|
|
|
482
|
+
/** DDP IF AUTOSTART IS FALSE, SHOW WIDGET */
|
|
483
|
+
if(!autoStart){
|
|
484
|
+
that.logger.info('[APP-COMP] AUTOSTART IS FALSE AND LOGGED SUCCESSFULLY ');
|
|
485
|
+
this.g.setParameter('isShown', true, true);
|
|
486
|
+
}
|
|
472
487
|
|
|
473
488
|
|
|
474
489
|
} else if (state && state === AUTH_STATE_OFFLINE && !this.forceDisconnect) {
|
|
475
490
|
/** non sono loggato */
|
|
476
491
|
that.logger.info('[APP-COMP] OFFLINE - NO CURRENT USER AUTENTICATE: ');
|
|
477
492
|
that.g.setParameter('isLogged', false);
|
|
478
|
-
that.hideWidget();
|
|
493
|
+
// that.hideWidget();
|
|
479
494
|
// that.g.setParameter('isShown', false, true);
|
|
480
495
|
that.triggerOnAuthStateChanged(that.stateLoggedUser);
|
|
481
|
-
if (autoStart) {
|
|
496
|
+
if (autoStart || this.g.onPageChangeVisibilityDesktop === 'open' || this.g.onPageChangeVisibilityMobile === 'open') {
|
|
482
497
|
that.authenticate();
|
|
483
498
|
}
|
|
484
|
-
}else if(state && state === AUTH_STATE_CLOSE ){
|
|
499
|
+
} else if(state && state === AUTH_STATE_CLOSE ){
|
|
485
500
|
that.logger.info('[APP-COMP] CLOSE - CHANNEL CLOSED: ', this.chatManager);
|
|
486
501
|
if(this.g.recipientId){
|
|
487
502
|
this.chatManager.removeConversationHandler(this.g.recipientId)
|
|
488
503
|
this.g.recipientId = null;
|
|
489
504
|
}
|
|
490
|
-
}
|
|
491
|
-
|
|
505
|
+
}
|
|
492
506
|
|
|
493
507
|
});
|
|
494
508
|
this.subscriptions.push(subAuthStateChanged);
|
|
@@ -733,6 +747,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
733
747
|
// divWidgetContainer.style.display = 'block';
|
|
734
748
|
// }
|
|
735
749
|
// }, 500);
|
|
750
|
+
|
|
751
|
+
this.loading = false;
|
|
736
752
|
}
|
|
737
753
|
// ========= end:: START UI ============//
|
|
738
754
|
|
|
@@ -841,7 +857,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
841
857
|
this.appStorageService.setItem('attributes', JSON.stringify(attributes));
|
|
842
858
|
return attributes;
|
|
843
859
|
}
|
|
844
|
-
|
|
860
|
+
|
|
861
|
+
// SET AUDIO
|
|
862
|
+
private initAudioNotification(){
|
|
863
|
+
this.audio = new Audio();
|
|
864
|
+
this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
|
|
865
|
+
this.audio.load();
|
|
866
|
+
}
|
|
845
867
|
|
|
846
868
|
private async initConversationsHandler(tenant: string, senderId: string) {
|
|
847
869
|
this.logger.debug('[APP-COMP] initialize: ListConversationsComponent');
|
|
@@ -1600,23 +1622,46 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1600
1622
|
this.f21_close();
|
|
1601
1623
|
}
|
|
1602
1624
|
|
|
1625
|
+
|
|
1626
|
+
/** DDP reload widget */
|
|
1627
|
+
async reloadWidget() {
|
|
1628
|
+
this.openCloseWidget();
|
|
1629
|
+
this.logger.debug('[APP-COMP-1] AAA - hideWidget');
|
|
1630
|
+
await Promise.all([
|
|
1631
|
+
this.authenticate(),
|
|
1632
|
+
// this.initAll()
|
|
1633
|
+
]);
|
|
1634
|
+
this.logger.debug('[APP-COMP-1] CCC - showWidget');
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
|
|
1603
1638
|
/**
|
|
1604
1639
|
* LAUNCHER BUTTON:
|
|
1605
1640
|
* onClick button open/close widget
|
|
1606
1641
|
*/
|
|
1607
1642
|
onOpenCloseWidget($event) {
|
|
1643
|
+
this.logger.debug('[APP-COMP] onOpenCloseWidget', $event, this.g.isLogged);
|
|
1644
|
+
if(!this.g.isLogged){
|
|
1645
|
+
this.reloadWidget();
|
|
1646
|
+
} else {
|
|
1647
|
+
this.openCloseWidget();
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
/** DDP show widget */
|
|
1652
|
+
openCloseWidget() {
|
|
1608
1653
|
this.g.setParameter('displayEyeCatcherCard', 'none');
|
|
1609
1654
|
// const conversationActive: ConversationModel = JSON.parse(this.appStorageService.getItem('activeConversation'));
|
|
1610
1655
|
const recipientId : string = this.appStorageService.getItem('recipientId')
|
|
1611
1656
|
this.g.setParameter('recipientId', recipientId);
|
|
1612
1657
|
this.logger.debug('[APP-COMP] openCloseWidget', recipientId, this.g.isOpen, this.g.startFromHome);
|
|
1658
|
+
|
|
1613
1659
|
if (this.g.isOpen === false) {
|
|
1614
1660
|
if(this.forceDisconnect){
|
|
1615
1661
|
this.logger.log('[FORCE] onOpenCloseWidget --> reconnect', this.forceDisconnect)
|
|
1616
1662
|
this.messagingAuthService.createCustomToken(this.g.tiledeskToken)
|
|
1617
1663
|
this.forceDisconnect = false;
|
|
1618
1664
|
}
|
|
1619
|
-
|
|
1620
1665
|
if (!recipientId) {
|
|
1621
1666
|
if(this.g.singleConversation){
|
|
1622
1667
|
this.isOpenHome = false;
|
|
@@ -1636,29 +1681,22 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
1636
1681
|
this.isOpenHome = false;
|
|
1637
1682
|
this.isOpenConversation = true;
|
|
1638
1683
|
this.startUI()
|
|
1639
|
-
// this.isOpenSelectionDepartment = false;
|
|
1640
1684
|
}
|
|
1641
|
-
// if (!conversationActive && !this.g.startFromHome) {
|
|
1642
|
-
// this.isOpenHome = false;
|
|
1643
|
-
// this.isOpenConversation = true;
|
|
1644
|
-
// this.startNwConversation();
|
|
1645
|
-
// } else if (conversationActive) {
|
|
1646
|
-
// this.isOpenHome = false;
|
|
1647
|
-
// this.isOpenConversation = true;
|
|
1648
|
-
// }
|
|
1649
|
-
// this.g.startFromHome = true;
|
|
1650
1685
|
this.triggerOnOpenEvent();
|
|
1651
|
-
|
|
1652
1686
|
} else {
|
|
1653
1687
|
this.triggerOnCloseEvent();
|
|
1654
1688
|
}
|
|
1655
1689
|
//change status to the widget
|
|
1656
1690
|
this.g.setIsOpen(!this.g.isOpen);
|
|
1657
1691
|
this.appStorageService.setItem('isOpen', this.g.isOpen);
|
|
1658
|
-
|
|
1692
|
+
//show loading if widget is open and user is not logged
|
|
1693
|
+
if(this.g.isOpen === true && !this.g.isLogged){
|
|
1694
|
+
this.loading = true;
|
|
1695
|
+
}
|
|
1659
1696
|
// this.saveBadgeNewConverstionNumber();
|
|
1660
1697
|
}
|
|
1661
1698
|
|
|
1699
|
+
|
|
1662
1700
|
/**
|
|
1663
1701
|
* MODAL SELECTION DEPARTMENT:
|
|
1664
1702
|
* selected department
|
|
@@ -2189,12 +2227,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
2189
2227
|
this.el.nativeElement.style.setProperty('--chat-header-height', this.g.hideHeaderConversation? '0px': null)
|
|
2190
2228
|
this.el.nativeElement.style.setProperty('--font-size-bubble-message', this.g.fontSize)
|
|
2191
2229
|
this.el.nativeElement.style.setProperty('--font-family-bubble-message', this.g.fontFamily)
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
this.styleMapConversation.set('buttonBackgroundColor', this.g.bubbleReceivedBackground)
|
|
2195
|
-
this.styleMapConversation.set('buttonTextColor', this.g.bubbleReceivedTextColor)
|
|
2196
|
-
this.styleMapConversation.set('buttonHoverBackgroundColor',this.g.bubbleSentBackground)
|
|
2197
|
-
this.styleMapConversation.set('buttonHoverTextColor', this.g.bubbleSentTextColor)
|
|
2198
2230
|
|
|
2199
2231
|
}
|
|
2200
2232
|
|
|
@@ -2221,8 +2253,23 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
2221
2253
|
}
|
|
2222
2254
|
|
|
2223
2255
|
private listenToNetworkStatus(){
|
|
2224
|
-
window.addEventListener('online', () =>
|
|
2225
|
-
|
|
2256
|
+
window.addEventListener('online', () => {
|
|
2257
|
+
this.isShowErrorMessage = false;
|
|
2258
|
+
this.errorMessage = null;
|
|
2259
|
+
this.errorKeyMessage = null;
|
|
2260
|
+
});
|
|
2261
|
+
window.addEventListener('offline', () => {
|
|
2262
|
+
this.isShowErrorMessage = true;
|
|
2263
|
+
this.errorMessage = null;
|
|
2264
|
+
this.errorKeyMessage = 'CONNECTION_NETWORK_ERROR';
|
|
2265
|
+
});
|
|
2266
|
+
window.addEventListener('tooltipErrorMessage', (event: CustomEvent) => {
|
|
2267
|
+
// console.log('event-------------------> tooltipErrorMessage', event);
|
|
2268
|
+
this.isShowErrorMessage = event.detail?.error;
|
|
2269
|
+
this.errorKeyMessage = event.detail?.keyMessage || null;
|
|
2270
|
+
this.errorMessage = event.detail?.message || null;
|
|
2271
|
+
this.errorParams = event.detail?.params || {};
|
|
2272
|
+
});
|
|
2226
2273
|
}
|
|
2227
2274
|
|
|
2228
2275
|
// ========= 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,7 +234,8 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
234
234
|
'LABEL_START_NW_CONV',
|
|
235
235
|
'CONTINUE',
|
|
236
236
|
'EMOJI_NOT_ELLOWED',
|
|
237
|
-
'
|
|
237
|
+
'ATTACHMENT',
|
|
238
|
+
'EMOJI'
|
|
238
239
|
];
|
|
239
240
|
|
|
240
241
|
const keysContent = [
|
|
@@ -456,7 +457,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
456
457
|
return this.isConversationArchived;
|
|
457
458
|
}
|
|
458
459
|
|
|
459
|
-
//FALLBACK TO TILEDESK
|
|
460
|
+
// //FALLBACK TO TILEDESK
|
|
460
461
|
const requests_list = await this.tiledeskRequestService.getMyRequests().catch(err => {
|
|
461
462
|
this.logger.error('[CONV-COMP] getConversationDetail: error getting request from Tiledesk', err);
|
|
462
463
|
this.isConversationArchived=true
|
|
@@ -474,9 +475,9 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
474
475
|
return this.isConversationArchived
|
|
475
476
|
}
|
|
476
477
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
this.isConversationArchived = false;
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
480
481
|
|
|
481
482
|
/**
|
|
482
483
|
* this.g.recipientId:
|
|
@@ -826,6 +827,20 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
826
827
|
this.subscriptions.push(subscribe);
|
|
827
828
|
}
|
|
828
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
|
+
|
|
829
844
|
subscribtionKey = 'messageWait';
|
|
830
845
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
831
846
|
if (!subscribtion) {
|