@chat21/chat21-web-widget 5.1.16 → 5.1.20-rc1

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.
Files changed (42) hide show
  1. package/.github/workflows/docker-community-push-latest.yml +23 -13
  2. package/.github/workflows/docker-image-tag-community-tag-push.yml +22 -12
  3. package/CHANGELOG.md +72 -1
  4. package/Dockerfile +4 -5
  5. package/angular.json +2 -1
  6. package/deploy_amazon_beta.sh +17 -7
  7. package/deploy_amazon_prod.sh +4 -4
  8. package/package.json +1 -1
  9. package/src/app/app.component.html +8 -1
  10. package/src/app/app.component.scss +60 -4
  11. package/src/app/app.component.ts +63 -28
  12. package/src/app/component/conversation-detail/conversation/conversation.component.ts +84 -10
  13. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  14. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +4 -0
  15. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +27 -1
  16. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +5 -5
  17. package/src/app/component/home-conversations/home-conversations.component.html +16 -6
  18. package/src/app/component/home-conversations/home-conversations.component.ts +29 -0
  19. package/src/app/component/launcher-button/launcher-button.component.html +1 -1
  20. package/src/app/component/launcher-button/launcher-button.component.ts +3 -2
  21. package/src/app/component/list-conversations/list-conversations.component.html +8 -3
  22. package/src/app/component/list-conversations/list-conversations.component.ts +29 -0
  23. package/src/app/component/message/html/html.component.html +5 -1
  24. package/src/app/component/message/html/html.component.scss +9 -0
  25. package/src/app/component/message/text/text.component.scss +75 -10
  26. package/src/app/component/message/text/text.component.ts +3 -2
  27. package/src/app/pipe/marked.pipe.ts +15 -4
  28. package/src/app/providers/translator.service.ts +2 -0
  29. package/src/app/sass/normalize.scss +1 -0
  30. package/src/app/utils/globals.ts +1 -1
  31. package/src/assets/i18n/en.json +1 -0
  32. package/src/assets/i18n/es.json +1 -0
  33. package/src/assets/i18n/fr.json +1 -0
  34. package/src/assets/i18n/it.json +1 -0
  35. package/src/chat21-core/providers/abstract/upload.service.ts +1 -1
  36. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
  37. package/src/chat21-core/providers/native/native-image-repo.ts +1 -1
  38. package/src/chat21-core/providers/native/native-upload-service.ts +76 -54
  39. package/src/chat21-core/providers/tiledesk/tiledesk-requests.service.ts +1 -1
  40. package/src/chat21-core/utils/utils.ts +5 -2
  41. package/src/iframe-style.css +36 -12
  42. package/.vscode/settings.json +0 -3
@@ -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
- - 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
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
- - '**' # Push events to every tag including hierarchical tags like
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
- - 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
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,9 +6,38 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
+ # 5.1.20-rc1
10
+ - **changed**: API for upload a file/iamges
11
+
12
+ # 5.1.19
13
+
14
+ # 5.1.19-rc1
15
+ - **bug fixed**: show bottom scroll button and unread message badge only when I'm not at the bottom of the page
16
+ - **changed**: allow HTML code to be inserted into messages, but do not parse the code. Ensure coexistence with Markdown.
17
+ - **bug fixed**: after sending a multi-line message, the text area remains open on multiple lines.
18
+ - **bug fixed**: fixed widget animation when opened
19
+ - **bug-fixed**: line-height in markdown
20
+ - **bug-fixed**: when i move to top mode and close the widget, the balloon moves to the right
21
+ - **changed**: saved the widget's size state to local storage. The parameter flow is (default → storage → settings → URL)
22
+
23
+ # 5.1.18
24
+ # 5.1.15-rc3
25
+ - **added**: Implemented Shadow DOM in the text component to isolate HTML and Markdown rendering in a safe and protected context
26
+ - **changed**: Adapted text component styles to support Shadow DOM (removed ::ng-deep, added styles for common markdown elements)
27
+ - **security**: HTML/Markdown content is now rendered in an isolated Shadow DOM, improving security and preventing interference with the rest of the application
28
+
29
+ # 5.1.17
30
+ - **bug-fixed**: set the maximum width on a message with iframe
31
+
9
32
  # 5.1.16
10
33
  - **changed**: "close chat" header conversation menu button enabled in chatbot-panel.html
11
34
 
35
+ # 5.1.15-rc2
36
+ - **bug-fixed**: Bug fix for ifame message width
37
+
38
+ # 5.1.15-rc1
39
+ - **changed**: Load local translations before remote ones
40
+
12
41
  # 5.1.15
13
42
  - **changed**: Load local translations before remote ones
14
43
 
@@ -17,14 +46,56 @@
17
46
 
18
47
  # 5.1.13
19
48
  - **bug-fixed**: set default widget size
49
+
50
+ # 5.1.7-rc16
51
+ - **bug-fixed**: set default widget size
52
+
53
+ # 5.1.7-rc15
54
+ - **bug-fixed**: set the color of the buttons with visibility control to the font color
55
+
56
+ # 5.1.7-rc14
57
+ - **bug-fixed**: departmentId and departmentName is incorrect in attributes
58
+
59
+ # 5.1.7-rc13
60
+ - **changed**: Force authentication if ageChangeVisibilityDesktop or PageChangeVisibilityMobile is OPEN
61
+
62
+ # 5.1.7-rc12
63
+ - **changed**: Set the default autoStart value to false
64
+ - **added**: Added the open widget loading spinner
65
+ - **changed**: Load the widget without authentication and display the speech bubble
66
+
67
+ # 5.1.7-rc11
68
+ - **changed**: set default value autoStart false
69
+ - **added**:added loading spinner
70
+
71
+ # 5.1.7-rc10
72
+ - **changed**: load widget without authentication and display the balloon
73
+
74
+ # 5.1.7-rc9
75
+ - **removed**: 'DOMAIN_NOT_ALLOWED' in textarea footer component
76
+
77
+ # 5.1.7-rc8
78
+ # changes in the branch
79
+ - **changed**: Load local translations before remote ones
80
+ - **bug-fixed**: set default widget size
20
81
  - **changed**: Updated the translations of the tooltips in the footer-component
21
82
  - **changed**: Refactored the network-offline component and made it generic for displaying errors (now error-alert.component)
22
- - **bug-fixed**: set the color of the buttons with visibility control to the font color (setButtonColors function)
83
+
84
+ # 5.1.7-rc7
85
+ - **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
86
+
87
+ # 5.1.7-rc6
88
+ - **added**: Added MAX_ATTACHMENT_ERROR error message when uploading a file larger than 10 MB
23
89
 
24
90
  # 5.1.12
25
91
  - **bug-fixed**: check showEmojiFooterButton to enable/disable emojii
26
92
  - **bug-fixed**: markdown is fired as an emojii and blocked by isEmojii check fn
27
93
 
94
+ # 5.1.7-rc7
95
+ - **bug-fixed**: button new_conversation always appear. added subscription to conversationAdded
96
+
97
+ # 5.1.7-rc6
98
+ - **added**: Added MAX_ATTACHMENT_ERROR error message when uploading a file larger than 10 MB
28
99
 
29
100
  # 5.1.7-rc5
30
101
  - **bug-fixed**: bug fixed BUTTON STYLES
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", "-c", "envsubst < /usr/share/nginx/html/widget-config-template.json > /usr/share/nginx/html/widget-config.json && exec nginx -g 'daemon off;'"]
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"
@@ -2,8 +2,16 @@
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
+ npm i
6
+
7
+ cp src/environments/real_data/environment.pre.ts src/environments/environment.pre.ts
8
+
5
9
  ng build --configuration="pre" --aot=true --base-href
6
10
 
11
+ ### SET HASHING : START ###
12
+ cp ./src/launch_template.js ./dist/browser/launch.js
13
+ node ./src/build_launch.js
14
+ ### SET HASHING : END ###
7
15
 
8
16
  # ########## --->>>> NATIVE-MQTT folder START <<<<<------ ########## #
9
17
 
@@ -23,15 +31,17 @@ ng build --configuration="pre" --aot=true --base-href
23
31
 
24
32
 
25
33
  # ########## --->>>> FIREBASE folder START <<<<<------ ########## #
26
- cd dist
27
- aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control max-age=300
28
- aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control max-age=300
29
- cd ..
30
-
31
- #aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*"
32
- cd ..
34
+ cd dist/browser
35
+ aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control max-age=300 --exclude='launch.js' #7days
36
+ aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
37
+ aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control max-age=300 --exclude='launch.js' #7days
38
+ aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
39
+ cd ../..
33
40
 
34
41
  aws cloudfront create-invalidation --distribution-id E2V5O0YPR61V8P --paths "/*"
42
+
43
+ git restore src/environments/environment.pre.ts
44
+
35
45
  # echo new version deployed $NEW_VER/$NEW_BUILD/ on s3://tiledesk-widget-pre/v2
36
46
  echo new version deployed $version/ on s3://tiledesk-widget-pre/v5 and s3://tiledesk-widget-pre/v5/$version/
37
47
  echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget-pre/v5/index.html
@@ -35,7 +35,7 @@ aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*
35
35
 
36
36
  git restore src/environments/environment.prod.ts
37
37
 
38
- echo new version deployed $version on s3://tiledesk-widget/v6
39
- echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget/v6/index.html
40
- echo https://widget.tiledesk.com/v6/index.html
41
- echo https://widget.tiledesk.com/v6/$version/index.html
38
+ echo new version deployed $version on s3://tiledesk-widget/v5
39
+ echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget/v5/index.html
40
+ echo https://widget.tiledesk.com/v5/index.html
41
+ echo https://widget.tiledesk.com/v5/$version/index.html
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-web-widget",
3
3
  "author": "Tiledesk SRL",
4
- "version": "5.1.16",
4
+ "version": "5.1.20-rc1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -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>
@@ -488,14 +488,11 @@ chat-root {
488
488
  right: 0px;
489
489
  top: 0px;
490
490
  bottom: 0px;
491
- // border-radius: 16px;
492
491
  overflow: hidden;
493
492
  background-color: transparent;
494
- // border: 1px solid #cccccc; //NEW GAB
495
493
  margin: 0px;
496
494
  padding: 0px;
497
- // box-shadow:rgba(0, 0, 0, 0.16) 0px 8px 36px 0px; //NEW GAB
498
-
495
+ opacity: 0;
499
496
  &.full-screen-mode {
500
497
  width: 100%;
501
498
  height: 100%;
@@ -764,4 +761,63 @@ chat-root {
764
761
  }
765
762
  }
766
763
 
764
+ // ========= BEGIN: LOADING SPINNER ========= //
765
+ .tiledesk-loading-overlay {
766
+ position: absolute;
767
+ top: 0;
768
+ left: 0;
769
+ width: 100%;
770
+ height: 100%;
771
+ background-color: rgba(248, 249, 250, 0.95);
772
+ display: flex;
773
+ justify-content: center;
774
+ align-items: center;
775
+ z-index: 9999;
776
+ backdrop-filter: blur(2px);
777
+ }
778
+
779
+ .tiledesk-loading-spinner {
780
+ display: flex;
781
+ flex-direction: column;
782
+ align-items: center;
783
+ gap: 16px;
784
+ }
785
+
786
+ .spinner-circle {
787
+ width: 50px;
788
+ height: 50px;
789
+ border: 4px solid rgba(59, 130, 246, 0.2);
790
+ border-top-color: #3b82f6;
791
+ border-radius: 50%;
792
+ animation: spin 0.8s linear infinite;
793
+ }
794
+
795
+ @keyframes spin {
796
+ 0% {
797
+ transform: rotate(0deg);
798
+ }
799
+ 100% {
800
+ transform: rotate(360deg);
801
+ }
802
+ }
803
+
804
+ .loading-text {
805
+ font-family: var(--font-family-bubble-message, 'Roboto', 'Google Sans', Helvetica, Arial, sans-serif);
806
+ font-size: 14px;
807
+ font-weight: 500;
808
+ color: #3b82f6;
809
+ letter-spacing: 0.5px;
810
+ animation: pulse 1.5s ease-in-out infinite;
811
+ }
812
+
813
+ @keyframes pulse {
814
+ 0%, 100% {
815
+ opacity: 1;
816
+ }
817
+ 50% {
818
+ opacity: 0.5;
819
+ }
820
+ }
821
+ // ========= END: LOADING SPINNER ========= //
822
+
767
823
  }
@@ -106,6 +106,10 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
106
106
 
107
107
  forceDisconnect: boolean = false;
108
108
 
109
+ //network status
110
+ isOnline: boolean = true;
111
+ loading: boolean = false;
112
+
109
113
  // alert error message
110
114
  isShowErrorMessage: boolean = false;
111
115
  errorMessage: string = '';
@@ -149,7 +153,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
149
153
  this.logger.info('[APP-CONF]---------------- ngAfterViewInit: APP.COMPONENT ---------------- ')
150
154
 
151
155
  // Initialize translation map and enable buttons
152
- const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON'];
156
+ const keys = ['MAXIMIZE', 'MINIMIZE', 'CENTER', 'BUTTON_CLOSE_TO_ICON', 'LABEL_LOADING'];
153
157
  this.translationMap = this.translateService.translateLanguage(keys);
154
158
  this.isButtonsDisabled = false;
155
159
 
@@ -262,7 +266,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
262
266
  this.tiledeskRequestsService.initialize(this.appConfigService.getConfig().apiUrl, this.g.projectid)
263
267
  this.messagingAuthService.initialize();
264
268
  this.chatManager.initialize();
265
- this.uploadService.initialize();
269
+ this.uploadService.initialize(this.g.projectid);
266
270
  }
267
271
 
268
272
 
@@ -316,8 +320,15 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
316
320
  this.g.setIsOpen(isOpen)
317
321
  this.appStorageService.setItem('isOpen', isOpen)
318
322
  }
319
-
320
-
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
+
321
332
  /**CHECK IF JWT IS IN URL PARAMETERS */
322
333
  this.logger.debug('[APP-COMP] check if token is passed throw url: ', this.g.jwt);
323
334
  if (this.g.jwt) {
@@ -354,10 +365,6 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
354
365
  this.subscriptions.push(obsSettingsService);
355
366
  this.globalSettingsService.initWidgetParamiters(this.g, this.el);
356
367
 
357
- // SET AUDIO
358
- this.audio = new Audio();
359
- this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
360
- this.audio.load();
361
368
  }
362
369
 
363
370
  private initAll() {
@@ -448,7 +455,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
448
455
  that.triggerOnAuthStateChanged(that.stateLoggedUser);
449
456
  that.logger.debug('[APP-COMP] 1 - IMPOSTO STATO CONNESSO UTENTE ', autoStart);
450
457
 
451
-
458
+ this.initAudioNotification()
452
459
 
453
460
  new Promise(async (resolve, reject)=> {
454
461
  that.typingService.initialize(this.g.tenant);
@@ -474,26 +481,30 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
474
481
  that.listenToWidgetClick()
475
482
  }
476
483
 
484
+ /** DDP IF AUTOSTART IS FALSE, SHOW WIDGET */
485
+ if(!autoStart){
486
+ that.logger.info('[APP-COMP] AUTOSTART IS FALSE AND LOGGED SUCCESSFULLY ');
487
+ this.g.setParameter('isShown', true, true);
488
+ }
477
489
 
478
490
 
479
491
  } else if (state && state === AUTH_STATE_OFFLINE && !this.forceDisconnect) {
480
492
  /** non sono loggato */
481
493
  that.logger.info('[APP-COMP] OFFLINE - NO CURRENT USER AUTENTICATE: ');
482
494
  that.g.setParameter('isLogged', false);
483
- that.hideWidget();
495
+ // that.hideWidget();
484
496
  // that.g.setParameter('isShown', false, true);
485
497
  that.triggerOnAuthStateChanged(that.stateLoggedUser);
486
- if (autoStart) {
498
+ if (autoStart || this.g.onPageChangeVisibilityDesktop === 'open' || this.g.onPageChangeVisibilityMobile === 'open') {
487
499
  that.authenticate();
488
500
  }
489
- }else if(state && state === AUTH_STATE_CLOSE ){
501
+ } else if(state && state === AUTH_STATE_CLOSE ){
490
502
  that.logger.info('[APP-COMP] CLOSE - CHANNEL CLOSED: ', this.chatManager);
491
503
  if(this.g.recipientId){
492
504
  this.chatManager.removeConversationHandler(this.g.recipientId)
493
505
  this.g.recipientId = null;
494
506
  }
495
- }
496
-
507
+ }
497
508
 
498
509
  });
499
510
  this.subscriptions.push(subAuthStateChanged);
@@ -738,6 +749,8 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
738
749
  // divWidgetContainer.style.display = 'block';
739
750
  // }
740
751
  // }, 500);
752
+
753
+ this.loading = false;
741
754
  }
742
755
  // ========= end:: START UI ============//
743
756
 
@@ -846,7 +859,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
846
859
  this.appStorageService.setItem('attributes', JSON.stringify(attributes));
847
860
  return attributes;
848
861
  }
849
-
862
+
863
+ // SET AUDIO
864
+ private initAudioNotification(){
865
+ this.audio = new Audio();
866
+ this.audio.src = this.g.baseLocation + URL_SOUND_LIST_CONVERSATION;
867
+ this.audio.load();
868
+ }
850
869
 
851
870
  private async initConversationsHandler(tenant: string, senderId: string) {
852
871
  this.logger.debug('[APP-COMP] initialize: ListConversationsComponent');
@@ -1605,23 +1624,46 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1605
1624
  this.f21_close();
1606
1625
  }
1607
1626
 
1627
+
1628
+ /** DDP reload widget */
1629
+ async reloadWidget() {
1630
+ this.openCloseWidget();
1631
+ this.logger.debug('[APP-COMP-1] AAA - hideWidget');
1632
+ await Promise.all([
1633
+ this.authenticate(),
1634
+ // this.initAll()
1635
+ ]);
1636
+ this.logger.debug('[APP-COMP-1] CCC - showWidget');
1637
+ }
1638
+
1639
+
1608
1640
  /**
1609
1641
  * LAUNCHER BUTTON:
1610
1642
  * onClick button open/close widget
1611
1643
  */
1612
1644
  onOpenCloseWidget($event) {
1645
+ this.logger.debug('[APP-COMP] onOpenCloseWidget', $event, this.g.isLogged);
1646
+ if(!this.g.isLogged){
1647
+ this.reloadWidget();
1648
+ } else {
1649
+ this.openCloseWidget();
1650
+ }
1651
+ }
1652
+
1653
+ /** DDP show widget */
1654
+ openCloseWidget() {
1613
1655
  this.g.setParameter('displayEyeCatcherCard', 'none');
1614
1656
  // const conversationActive: ConversationModel = JSON.parse(this.appStorageService.getItem('activeConversation'));
1615
1657
  const recipientId : string = this.appStorageService.getItem('recipientId')
1616
1658
  this.g.setParameter('recipientId', recipientId);
1617
1659
  this.logger.debug('[APP-COMP] openCloseWidget', recipientId, this.g.isOpen, this.g.startFromHome);
1660
+
1618
1661
  if (this.g.isOpen === false) {
1619
1662
  if(this.forceDisconnect){
1620
1663
  this.logger.log('[FORCE] onOpenCloseWidget --> reconnect', this.forceDisconnect)
1621
1664
  this.messagingAuthService.createCustomToken(this.g.tiledeskToken)
1622
1665
  this.forceDisconnect = false;
1623
1666
  }
1624
-
1625
1667
  if (!recipientId) {
1626
1668
  if(this.g.singleConversation){
1627
1669
  this.isOpenHome = false;
@@ -1641,29 +1683,22 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1641
1683
  this.isOpenHome = false;
1642
1684
  this.isOpenConversation = true;
1643
1685
  this.startUI()
1644
- // this.isOpenSelectionDepartment = false;
1645
1686
  }
1646
- // if (!conversationActive && !this.g.startFromHome) {
1647
- // this.isOpenHome = false;
1648
- // this.isOpenConversation = true;
1649
- // this.startNwConversation();
1650
- // } else if (conversationActive) {
1651
- // this.isOpenHome = false;
1652
- // this.isOpenConversation = true;
1653
- // }
1654
- // this.g.startFromHome = true;
1655
1687
  this.triggerOnOpenEvent();
1656
-
1657
1688
  } else {
1658
1689
  this.triggerOnCloseEvent();
1659
1690
  }
1660
1691
  //change status to the widget
1661
1692
  this.g.setIsOpen(!this.g.isOpen);
1662
1693
  this.appStorageService.setItem('isOpen', this.g.isOpen);
1663
-
1694
+ //show loading if widget is open and user is not logged
1695
+ if(this.g.isOpen === true && !this.g.isLogged){
1696
+ this.loading = true;
1697
+ }
1664
1698
  // this.saveBadgeNewConverstionNumber();
1665
1699
  }
1666
1700
 
1701
+
1667
1702
  /**
1668
1703
  * MODAL SELECTION DEPARTMENT:
1669
1704
  * selected department