@chat21/chat21-web-widget 5.1.7-rc9 → 5.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,8 +6,18 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
- # 5.1.7-rc9
10
- - **removed**: 'DOMAIN_NOT_ALLOWED' in textarea footer component
9
+ # 5.1.11
10
+ - **bug-fixed**: departmentId and departmentName is incorrect in attributes
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
11
21
 
12
22
  # 5.1.7-rc8
13
23
  - **changed**: Updated the translations of the tooltips in the footer-component
package/deploy_prod.sh CHANGED
@@ -8,6 +8,9 @@ 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
+
11
14
  ## Push commit to git
12
15
  git add .
13
16
  git commit -m "version added: ### $version"
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.7-rc9",
4
+ "version": "5.1.11",
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>
@@ -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
  }
@@ -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
 
@@ -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,13 +365,10 @@ 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() {
371
+ this.logger.debug('[APP-COMP] initAll : ');
364
372
  this.addComponentToWindow(this.ngZone);
365
373
 
366
374
  //INIT TRIGGER-HANDLER
@@ -403,7 +411,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
403
411
 
404
412
 
405
413
  /** NETWORK STATUS */
406
- this.listenToNetworkStatus()
414
+ this.listenToNetworkStatus();
407
415
 
408
416
  }
409
417
 
@@ -446,7 +454,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
446
454
  that.triggerOnAuthStateChanged(that.stateLoggedUser);
447
455
  that.logger.debug('[APP-COMP] 1 - IMPOSTO STATO CONNESSO UTENTE ', autoStart);
448
456
 
449
-
457
+ this.initAudioNotification()
450
458
 
451
459
  new Promise(async (resolve, reject)=> {
452
460
  that.typingService.initialize(this.g.tenant);
@@ -472,26 +480,35 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
472
480
  that.listenToWidgetClick()
473
481
  }
474
482
 
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
+ }
475
488
 
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
+ }
476
494
 
477
495
  } else if (state && state === AUTH_STATE_OFFLINE && !this.forceDisconnect) {
478
496
  /** non sono loggato */
479
497
  that.logger.info('[APP-COMP] OFFLINE - NO CURRENT USER AUTENTICATE: ');
480
498
  that.g.setParameter('isLogged', false);
481
- that.hideWidget();
499
+ // that.hideWidget();
482
500
  // that.g.setParameter('isShown', false, true);
483
501
  that.triggerOnAuthStateChanged(that.stateLoggedUser);
484
- if (autoStart) {
502
+ if (autoStart || this.g.onPageChangeVisibilityDesktop === 'open' || this.g.onPageChangeVisibilityMobile === 'open') {
485
503
  that.authenticate();
486
504
  }
487
- }else if(state && state === AUTH_STATE_CLOSE ){
505
+ } else if(state && state === AUTH_STATE_CLOSE ){
488
506
  that.logger.info('[APP-COMP] CLOSE - CHANNEL CLOSED: ', this.chatManager);
489
507
  if(this.g.recipientId){
490
508
  this.chatManager.removeConversationHandler(this.g.recipientId)
491
509
  this.g.recipientId = null;
492
510
  }
493
- }
494
-
511
+ }
495
512
 
496
513
  });
497
514
  this.subscriptions.push(subAuthStateChanged);
@@ -736,6 +753,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
736
753
  // divWidgetContainer.style.display = 'block';
737
754
  // }
738
755
  // }, 500);
756
+ this.loading = false;
739
757
  }
740
758
  // ========= end:: START UI ============//
741
759
 
@@ -844,7 +862,13 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
844
862
  this.appStorageService.setItem('attributes', JSON.stringify(attributes));
845
863
  return attributes;
846
864
  }
847
-
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
+ }
848
872
 
849
873
  private async initConversationsHandler(tenant: string, senderId: string) {
850
874
  this.logger.debug('[APP-COMP] initialize: ListConversationsComponent');
@@ -1117,6 +1141,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1117
1141
  * 3 - reinit widget
1118
1142
  */
1119
1143
  private reInit() {
1144
+ this.logger.debug('[APP-COMP] reInit');
1120
1145
  // if (!firebase.auth().currentUser) {
1121
1146
  if (!this.tiledeskAuthService.getCurrentUser()) {
1122
1147
  this.logger.debug('[APP-COMP] reInit ma NON SONO LOGGATO!');
@@ -1150,7 +1175,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1150
1175
  */
1151
1176
  private restart() {
1152
1177
  // if (!firebase.auth().currentUser) {
1153
-
1178
+ this.logger.debug('[APP-COMP] restart');
1154
1179
  this.hideWidget();
1155
1180
  // that.triggerOnAuthStateChanged(resp);
1156
1181
  if (this.g.autoStart !== false) {
@@ -1603,23 +1628,47 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1603
1628
  this.f21_close();
1604
1629
  }
1605
1630
 
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
+
1606
1645
  /**
1607
1646
  * LAUNCHER BUTTON:
1608
1647
  * onClick button open/close widget
1609
1648
  */
1610
1649
  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() {
1611
1660
  this.g.setParameter('displayEyeCatcherCard', 'none');
1612
1661
  // const conversationActive: ConversationModel = JSON.parse(this.appStorageService.getItem('activeConversation'));
1613
1662
  const recipientId : string = this.appStorageService.getItem('recipientId')
1614
1663
  this.g.setParameter('recipientId', recipientId);
1615
1664
  this.logger.debug('[APP-COMP] openCloseWidget', recipientId, this.g.isOpen, this.g.startFromHome);
1665
+
1616
1666
  if (this.g.isOpen === false) {
1617
1667
  if(this.forceDisconnect){
1618
1668
  this.logger.log('[FORCE] onOpenCloseWidget --> reconnect', this.forceDisconnect)
1619
1669
  this.messagingAuthService.createCustomToken(this.g.tiledeskToken)
1620
1670
  this.forceDisconnect = false;
1621
1671
  }
1622
-
1623
1672
  if (!recipientId) {
1624
1673
  if(this.g.singleConversation){
1625
1674
  this.isOpenHome = false;
@@ -1639,29 +1688,22 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
1639
1688
  this.isOpenHome = false;
1640
1689
  this.isOpenConversation = true;
1641
1690
  this.startUI()
1642
- // this.isOpenSelectionDepartment = false;
1643
1691
  }
1644
- // if (!conversationActive && !this.g.startFromHome) {
1645
- // this.isOpenHome = false;
1646
- // this.isOpenConversation = true;
1647
- // this.startNwConversation();
1648
- // } else if (conversationActive) {
1649
- // this.isOpenHome = false;
1650
- // this.isOpenConversation = true;
1651
- // }
1652
- // this.g.startFromHome = true;
1653
1692
  this.triggerOnOpenEvent();
1654
-
1655
1693
  } else {
1656
1694
  this.triggerOnCloseEvent();
1657
1695
  }
1658
1696
  //change status to the widget
1659
1697
  this.g.setIsOpen(!this.g.isOpen);
1660
1698
  this.appStorageService.setItem('isOpen', this.g.isOpen);
1661
-
1699
+ //show loading if widget is open and user is not logged
1700
+ if(this.g.isOpen === true && !this.g.isLogged){
1701
+ this.loading = true;
1702
+ }
1662
1703
  // this.saveBadgeNewConverstionNumber();
1663
1704
  }
1664
1705
 
1706
+
1665
1707
  /**
1666
1708
  * MODAL SELECTION DEPARTMENT:
1667
1709
  * selected department
@@ -1441,5 +1441,4 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1441
1441
  this.isHovering = false
1442
1442
  }
1443
1443
 
1444
- }
1445
-
1444
+ }
@@ -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.isLogged == true && g.isOpen == false"
4
+ *ngIf="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,8 +67,9 @@ 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
- this.onButtonClicked.emit( this.g.isOpen );
71
- }
70
+
71
+ }
72
+ this.onButtonClicked.emit( this.g.isOpen );
72
73
  }
73
74
 
74
75
  }
@@ -1936,7 +1936,7 @@ export class GlobalSettingsService {
1936
1936
  if (this.globals.departmentID) {
1937
1937
  this.globals.departments.forEach(department => {
1938
1938
  if (department._id === this.globals.departmentID) {
1939
- this.logger.debug('[GLOBAL-SET] setDepartmentFromExternal > EXTERNAL DEPARTMENT ::::' + department._id);
1939
+ console.log('[GLOBAL-SET] setDepartmentFromExternal > EXTERNAL DEPARTMENT ::::' + department._id);
1940
1940
  this.globals.setParameter('departmentDefault', department);
1941
1941
  this.setDepartment(department);
1942
1942
  isValidID = true;
@@ -1964,7 +1964,7 @@ export class GlobalSettingsService {
1964
1964
  * save attributes in this.appStorageService
1965
1965
  */
1966
1966
  setDepartment(department) {
1967
- this.logger.debug('[GLOBAL-SET] setDepartment: ', JSON.stringify(department));
1967
+ this.logger.log('[GLOBAL-SET] setDepartment: ', JSON.stringify(department));
1968
1968
  this.globals.setParameter('departmentSelected', department);
1969
1969
  // let attributes = this.globals.attributes;
1970
1970
  let attributes: any = JSON.parse(this.appStorageService.getItem('attributes'));
@@ -1983,7 +1983,7 @@ export class GlobalSettingsService {
1983
1983
  this.logger.debug('[GLOBAL-SET] setDepartment > setAttributes: ', JSON.stringify(attributes));
1984
1984
  this.globals.setParameter('departmentSelected', department);
1985
1985
  this.globals.setParameter('attributes', attributes);
1986
- // this.appStorageService.setItem('attributes', JSON.stringify(attributes));
1986
+ this.appStorageService.setItem('attributes', JSON.stringify(attributes));
1987
1987
 
1988
1988
  }
1989
1989
  // ========= end:: GET DEPARTEMENTS ============//
@@ -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 = true;
250
+ this.autoStart = false;
251
251
  /** start Authentication and startUI */
252
252
  this.startHidden = false;
253
253
  /** show/hide all widget -> js call: showAllWidget */
@@ -13,7 +13,7 @@
13
13
  bottom: 0px;
14
14
  width: auto;
15
15
  height: auto;
16
- display: none;
16
+ display: block;
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
- transition:
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
- transition: width 200ms, height 200ms, max-height 200ms, transform 300ms cubic-bezier(0, 1.2, 1, 1), opacity 83ms ease-out;
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
- transition: width 200ms, height 200ms, max-height 200ms, transform 300ms cubic-bezier(0, 1.2, 1, 1), opacity 83ms ease-out;
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
  }