@chat21/chat21-web-widget 5.0.81 → 5.0.82-rc.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-web-widget",
3
3
  "author": "Tiledesk SRL",
4
- "version": "5.0.81",
4
+ "version": "5.0.82-rc.2",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -18,6 +18,7 @@
18
18
  [hideRestartConversationOptionsMenu]="((!g?.singleConversation && !hideTextAreaContent) || g?.hideRestartConversationOptionsMenu)"
19
19
  [hideHeaderConversationOptionsMenu]="g?.hideHeaderConversationOptionsMenu"
20
20
  [hideSignOutOptionMenu]="(!g?.singleConversation || !g?.showLogoutOption)"
21
+ [hideChatDetailOptionMenu]="(!g?.isDevMode)"
21
22
  [stylesMap]="stylesMap"
22
23
  [translationMap]="translationMapHeader"
23
24
  [widgetTitle]="g?.project?.widgetTitle"
@@ -29,11 +30,7 @@
29
30
  [typingLocation]="g?.typingLocation"
30
31
  (onBack)="onBackHomeFN()"
31
32
  (onCloseWidget)="onCloseWidgetFN()"
32
- (onSoundChange)="onSoundChangeFN($event)"
33
- (onCloseChat)="onCloseChat($event)"
34
- (onRestartChat)="onRestartChat($event)"
35
- (onWidgetHeightChange)="onWidgetHeightChange($event)"
36
- (onSignOut)="onSignOutFN($event)"
33
+ (onMenuOptionClick)="onMenuOptionClick($event)"
37
34
  (onMenuOptionShow)="onMenuOption($event)">
38
35
  </chat-conversation-header>
39
36
 
@@ -14,7 +14,7 @@ import { ConversationModel } from 'src/chat21-core/models/conversation';
14
14
 
15
15
  // utils
16
16
  import { v4 as uuidv4 } from 'uuid';
17
- import { UID_SUPPORT_GROUP_MESSAGES } from 'src/app/utils/constants';
17
+ import { HEADER_MENU_OPTION, UID_SUPPORT_GROUP_MESSAGES } from 'src/app/utils/constants';
18
18
  import { CHANNEL_TYPE, INFO_MESSAGE_TYPE, TYPE_MSG_TEXT } from 'src/chat21-core/utils/constants';
19
19
  import { getDateDifference } from 'src/chat21-core/utils/utils';
20
20
  import { isJustRecived, isUserBanned } from 'src/chat21-core/utils/utils-message';
@@ -219,7 +219,8 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
219
219
  'MINIMIZE',
220
220
  'CLOSE_CHAT',
221
221
  'RESTART',
222
- 'LOGOUT'
222
+ 'LOGOUT',
223
+ 'OPEN_DETAIL'
223
224
  ];
224
225
 
225
226
  const keysFooter = [
@@ -976,7 +977,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
976
977
  this.onSoundChange.emit(soundEnabled)
977
978
  }
978
979
  /** CALLED BY: conv-header component */
979
- onCloseChat(event){
980
+ onCloseChat(){
980
981
  this.logger.debug('[CONV-COMP] close chat with uid ', this.conversation.uid)
981
982
  this.tiledeskRequestService.closeSupportGroup(this.conversation.uid).then(data => {
982
983
  if(data === 'closed'){
@@ -988,7 +989,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
988
989
  })
989
990
  }
990
991
  /** CALLED BY: conv-header component */
991
- onRestartChat(event){
992
+ onRestartChat(){
992
993
  this.hideTextAreaContent = true
993
994
  }
994
995
  /** CALLED BY: conv-header component */
@@ -1005,6 +1006,42 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1005
1006
  onSignOutFN(event){
1006
1007
  this.onSignOut.emit(true)
1007
1008
  }
1009
+
1010
+ /** CALLED BY: conv-header conv-content component */
1011
+ onMenuOptionClick(event){
1012
+ switch(event){
1013
+ case HEADER_MENU_OPTION.LOGOUT:
1014
+ this.onSignOut.emit(true)
1015
+ break;
1016
+ case HEADER_MENU_OPTION.VOLUME_ON:{
1017
+ let soundEnabled = true
1018
+ this.onSoundChange.emit(soundEnabled)
1019
+ break;
1020
+ }
1021
+ case HEADER_MENU_OPTION.VOLUME_OFF:{
1022
+ let soundEnabled = false
1023
+ this.onSoundChange.emit(soundEnabled)
1024
+ break;
1025
+ }
1026
+ case HEADER_MENU_OPTION.TRANSCRIPT:
1027
+ break;
1028
+ case HEADER_MENU_OPTION.CLOSE:
1029
+ this.onCloseChat()
1030
+ break;
1031
+ case HEADER_MENU_OPTION.DETAIL:
1032
+ //TODO
1033
+ break;
1034
+ case HEADER_MENU_OPTION.RESTART:
1035
+ this.onRestartChat()
1036
+ break;
1037
+ case HEADER_MENU_OPTION.MAXIMIZE:
1038
+ this.onWidgetHeightChange('max')
1039
+ break;
1040
+ case HEADER_MENU_OPTION.MINIMIZE:
1041
+ this.onWidgetHeightChange('min')
1042
+ break;
1043
+ }
1044
+ }
1008
1045
  /** CALLED BY: conv-header conv-content component */
1009
1046
  onMenuOption(event:boolean){
1010
1047
  this.isMenuShow = event;
@@ -92,6 +92,20 @@
92
92
  <span class="label-menu-item">{{ translationMap?.get('CLOSE_CHAT') }}</span>
93
93
  </div>
94
94
 
95
+ <!-- ICON OPEN CHAT DETAIL -->
96
+ <!-- <div class="c21-header-button c21-right" *ngIf="!hideChatDetailOptionMenu"(click)="openDetail()">
97
+ <svg role="img" id="archive" aria-labelledby="altIconTitle" class="icon-menu" xmlns="http://www.w3.org/2000/svg"
98
+ width="20px" height="20px" viewBox="0 0 18.17 18.12">
99
+ <path d="M13.1,15.54H2.03c-.92,0-1.66-.74-1.66-1.66V2.81c0-.92.74-1.66,1.66-1.66h6.09v1.11H2.03c-.31,0-.55.25-.55.55v11.07c0,.3.25.55.55.55h11.07c.31,0,.55-.25.55-.55v-6.09h1.11v6.09c0,.92-.74,1.66-1.66,1.66"/>
100
+ <rect stroke-width="0" x="9.55" y="0" width="6.13" height="1.75"/>
101
+ <rect stroke-width="0" x="11.82" y="2.19" width="6.13" height="1.75" transform="translate(11.82 17.94) rotate(-90)"/>
102
+ <rect stroke-width="0" x="4.69" y="4.06" width="11.52" height="1.75" transform="translate(-.43 8.83) rotate(-45)"/>
103
+ <title id="altIconTitle">{{ translationMap?.get('OPEN_DETAIL') }}</title>
104
+ </svg>
105
+ <span class="label-menu-item">{{ translationMap?.get('OPEN_DETAIL') }}</span>
106
+ </div> -->
107
+
108
+
95
109
  <!-- ICON RESTART CONVERSATION -->
96
110
  <div class="c21-header-button c21-right" *ngIf="!hideRestartConversationOptionsMenu" (click)="restartChat()">
97
111
  <svg role="img" id="refresh" aria-labelledby="altIconTitle" class="icon-menu" xmlns="http://www.w3.org/2000/svg"
@@ -1,6 +1,7 @@
1
1
  import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
2
2
  import { Globals } from 'src/app//utils/globals';
3
3
  import { AppConfigService } from 'src/app/providers/app-config.service';
4
+ import { HEADER_MENU_OPTION } from 'src/app/utils/constants';
4
5
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
5
6
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
6
7
  import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
@@ -27,6 +28,7 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
27
28
  @Input() hideHeaderBackButton: boolean;
28
29
  @Input() hideHeaderConversationOptionsMenu: boolean;
29
30
  @Input() hideSignOutOptionMenu: boolean;
31
+ @Input() hideChatDetailOptionMenu: boolean;
30
32
  @Input() windowContext;
31
33
  @Input() stylesMap: Map<string, string>
32
34
  @Input() translationMap: Map< string, string>;
@@ -34,11 +36,7 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
34
36
  @Input() build_version: string;
35
37
  @Output() onBack = new EventEmitter();
36
38
  @Output() onCloseWidget = new EventEmitter();
37
- @Output() onSoundChange = new EventEmitter();
38
- @Output() onCloseChat = new EventEmitter();
39
- @Output() onRestartChat = new EventEmitter();
40
- @Output() onWidgetHeightChange = new EventEmitter<string>();
41
- @Output() onSignOut = new EventEmitter();
39
+ @Output() onMenuOptionClick = new EventEmitter();
42
40
  @Output() onMenuOptionShow = new EventEmitter();
43
41
  // ========= end:: Input/Output values
44
42
 
@@ -63,12 +61,11 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
63
61
  public g: Globals,
64
62
  public appConfigService: AppConfigService,) {
65
63
  this.API_URL = this.appConfigService.getConfig().apiUrl;
66
- }
64
+ }
67
65
 
68
66
  ngOnInit() {
69
67
  this.logger.debug('[CONV-HEADER] ngOnInit: conversation-header COMPONENT ', this.translationMap);
70
68
  this.membersConversation.push(this.senderId)
71
- //this.initializeTyping();
72
69
  }
73
70
 
74
71
  ngOnChanges(changes: SimpleChanges){
@@ -88,17 +85,38 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
88
85
  this.onBack.emit();
89
86
  }
90
87
 
91
- closeChat(){
92
- this.onCloseChat.emit();
88
+ closeWidget() {
89
+ this.onCloseWidget.emit();
93
90
  }
94
91
 
92
+
93
+ closeChat(){
94
+ this.onMenuOptionClick.emit(HEADER_MENU_OPTION.CLOSE)
95
+ }
95
96
  restartChat(){
96
- this.onRestartChat.emit();
97
+ this.onMenuOptionClick.emit(HEADER_MENU_OPTION.RESTART)
97
98
  this.onMenuOptionShow.emit(false)
98
99
  }
99
-
100
- closeWidget() {
101
- this.onCloseWidget.emit();
100
+ openDetail(){
101
+ this.onMenuOptionClick.emit(HEADER_MENU_OPTION.DETAIL)
102
+ }
103
+ signOut(){
104
+ this.onMenuOptionClick.emit(HEADER_MENU_OPTION.LOGOUT)
105
+ }
106
+ /**
107
+ * @param status : string 'max' || 'min'
108
+ */
109
+ maximizeMinimize(status){
110
+ this.heightStatus = status
111
+ if(status === 'min') this.onMenuOptionClick.emit(HEADER_MENU_OPTION.MINIMIZE)
112
+ if(status === 'max') this.onMenuOptionClick.emit(HEADER_MENU_OPTION.MAXIMIZE)
113
+ this.onMenuOptionShow.emit(false)
114
+ }
115
+ toggleSound() {
116
+ this.soundEnabled = !this.soundEnabled
117
+ if(this.soundEnabled) this.onMenuOptionClick.emit(HEADER_MENU_OPTION.VOLUME_ON)
118
+ if(!this.soundEnabled) this.onMenuOptionClick.emit(HEADER_MENU_OPTION.VOLUME_OFF)
119
+ this.onMenuOptionShow.emit(false)
102
120
  }
103
121
  // =========== END: event emitter function ====== //
104
122
 
@@ -108,28 +126,11 @@ export class ConversationHeaderComponent implements OnInit, OnChanges {
108
126
  windowContext.open(url, '_blank');
109
127
  this.onMenuOptionShow.emit(false)
110
128
  }
111
-
112
- toggleSound() {
113
- this.onMenuOptionShow.emit(false)
114
- this.onSoundChange.emit(!this.soundEnabled)
115
- }
116
-
117
- signOut(){
118
- this.onSignOut.emit(true)
119
- }
120
129
 
121
130
  toggleMenu() {
122
131
  this.onMenuOptionShow.emit(!this.isMenuShow)
123
132
  }
124
133
 
125
- /**
126
- *
127
- * @param status : string 'max' || 'min'
128
- */
129
- maximizeMinimize(status){
130
- this.heightStatus = status
131
- this.onWidgetHeightChange.emit(status)
132
- }
133
134
 
134
135
 
135
136
 
@@ -1779,6 +1779,11 @@ export class GlobalSettingsService {
1779
1779
  if (TEMP) {
1780
1780
  globals.hiddenMessage = TEMP;
1781
1781
  }
1782
+
1783
+ TEMP = getParameterByName(windowContext, 'td_draft');
1784
+ if (TEMP) {
1785
+ globals.isDevMode = stringToBoolean(TEMP);
1786
+ }
1782
1787
 
1783
1788
  }
1784
1789
 
@@ -64,3 +64,15 @@ export const IMG_PROFILE_DEFAULT = '/assets/images/avatar_male_tiledesk.svg';
64
64
  // start conversation bot (proxy)
65
65
  export const PROXY_MSG_START = '__start';
66
66
 
67
+ export const HEADER_MENU_OPTION = {
68
+ LOGOUT : 'logout',
69
+ VOLUME_ON : 'volume_on',
70
+ VOLUME_OFF : 'volume_off',
71
+ TRANSCRIPT : 'transcript',
72
+ CLOSE : 'close',
73
+ DETAIL : 'detail',
74
+ RESTART : 'restart',
75
+ MAXIMIZE : 'maximize',
76
+ MINIMIZE : 'minimize'
77
+ }
78
+
@@ -215,6 +215,7 @@ export class Globals {
215
215
  displayOnDesktop: boolean; // ******* new ********
216
216
 
217
217
  hiddenMessage: string; // ******* new ********
218
+ isDevMode: boolean; // ******* new ********
218
219
  constructor(
219
220
  ) { }
220
221
 
@@ -465,6 +466,8 @@ export class Globals {
465
466
 
466
467
  this.newConversationStart = true;
467
468
 
469
+ this.isDevMode = false;
470
+
468
471
  }
469
472
 
470
473
 
package/src/launch.js CHANGED
@@ -7,36 +7,44 @@ ready(function() {
7
7
  initWidget();
8
8
  });
9
9
 
10
+
10
11
  /** */
11
12
  function ready(callbackFunction){
12
- // if(document.readyState != 'loading'){
13
- // console.log('in ifffffff', document.readyState)
14
- // callbackFunction()
15
- // }
16
- // else{
17
- // document.addEventListener("DOMContentLoaded", callbackFunction)
18
- // }
19
- document.addEventListener('scroll', start);
20
- document.addEventListener('mousedown', start);
21
- document.addEventListener('mousemove', start);
22
- document.addEventListener('touchstart', start);
23
- document.addEventListener('keydown', start);
24
-
25
- function start(){
26
- if(document.readyState==='complete'){
27
- callbackFunction()
28
- }else if(window.attachEvent){
29
- window.attachEvent('onload',callbackFunction);
30
- }else{
31
- window.addEventListener('load',callbackFunction,false);
32
- }
33
-
34
- document.removeEventListener('scroll', start);
35
- document.removeEventListener('mousedown', start);
36
- document.removeEventListener('mousemove', start);
37
- document.removeEventListener('touchstart', start);
38
- document.removeEventListener('keydown', start);
13
+ // if(document.readyState != 'loading'){
14
+ // console.log('in ifffffff', document.readyState)
15
+ // callbackFunction()
16
+ // }
17
+ // else{
18
+ // document.addEventListener("DOMContentLoaded", callbackFunction)
19
+ // }
20
+ document.addEventListener('scroll', start);
21
+ document.addEventListener('mousedown', start);
22
+ document.addEventListener('mousemove', start);
23
+ document.addEventListener('touchstart', start);
24
+ document.addEventListener('keydown', start);
25
+
26
+ let time = 5000;
27
+ let timeout = setTimeout(()=> {
28
+ console.log('in timeout')
29
+ start();
30
+ }, time)
31
+
32
+ function start(){
33
+ clearTimeout(timeout);
34
+ if(document.readyState==='complete'){
35
+ callbackFunction()
36
+ }else if(window.attachEvent){
37
+ window.attachEvent('onload',callbackFunction);
38
+ }else{
39
+ window.addEventListener('load',callbackFunction,false);
39
40
  }
41
+
42
+ document.removeEventListener('scroll', start);
43
+ document.removeEventListener('mousedown', start);
44
+ document.removeEventListener('mousemove', start);
45
+ document.removeEventListener('touchstart', start);
46
+ document.removeEventListener('keydown', start);
47
+ }
40
48
 
41
49
 
42
50
  }
@@ -7,37 +7,44 @@ ready(function() {
7
7
  initWidget();
8
8
  });
9
9
 
10
+
10
11
  /** */
11
12
  function ready(callbackFunction){
12
- // if(document.readyState != 'loading'){
13
- // console.log('in ifffffff', document.readyState)
14
- // callbackFunction()
15
- // }
16
- // else{
17
- // document.addEventListener("DOMContentLoaded", callbackFunction)
18
- // }
19
- document.addEventListener('scroll', start);
20
- document.addEventListener('mousedown', start);
21
- document.addEventListener('mousemove', start);
22
- document.addEventListener('touchstart', start);
23
- document.addEventListener('keydown', start);
24
-
25
- function start(){
26
- if(document.readyState==='complete'){
27
- callbackFunction()
28
- }else if(window.attachEvent){
29
- window.attachEvent('onload',callbackFunction);
30
- }else{
31
- window.addEventListener('load',callbackFunction,false);
32
- }
33
-
34
- document.removeEventListener('scroll', start);
35
- document.removeEventListener('mousedown', start);
36
- document.removeEventListener('mousemove', start);
37
- document.removeEventListener('touchstart', start);
38
- document.removeEventListener('scroll', start);
39
- document.removeEventListener('keydown', start);
13
+ // if(document.readyState != 'loading'){
14
+ // console.log('in ifffffff', document.readyState)
15
+ // callbackFunction()
16
+ // }
17
+ // else{
18
+ // document.addEventListener("DOMContentLoaded", callbackFunction)
19
+ // }
20
+ document.addEventListener('scroll', start);
21
+ document.addEventListener('mousedown', start);
22
+ document.addEventListener('mousemove', start);
23
+ document.addEventListener('touchstart', start);
24
+ document.addEventListener('keydown', start);
25
+
26
+ let time = 5000;
27
+ let timeout = setTimeout(()=> {
28
+ console.log('in timeout')
29
+ start();
30
+ }, time)
31
+
32
+ function start(){
33
+ if(document.readyState==='complete'){
34
+ callbackFunction()
35
+ }else if(window.attachEvent){
36
+ window.attachEvent('onload',callbackFunction);
37
+ }else{
38
+ window.addEventListener('load',callbackFunction,false);
40
39
  }
40
+
41
+ document.removeEventListener('scroll', start);
42
+ document.removeEventListener('mousedown', start);
43
+ document.removeEventListener('mousemove', start);
44
+ document.removeEventListener('touchstart', start);
45
+ document.removeEventListener('scroll', start);
46
+ document.removeEventListener('keydown', start);
47
+ }
41
48
 
42
49
 
43
50
  }