@chat21/chat21-web-widget 5.0.83-rc.3 → 5.0.83-rc.4

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,6 +6,9 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
+ # 5.0.83-rc.4
10
+ - **added**: confirm-close modal before close a chat
11
+
9
12
  # 5.0.83-rc.3
10
13
  - **added**: send '/start' info message on restart header menu option
11
14
  - **bug-fixed**: close header menu option not send the last conversation id to close
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.83-rc.3",
4
+ "version": "5.0.83-rc.4",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -92,8 +92,10 @@
92
92
 
93
93
 
94
94
  <dialog #mydialog>
95
- <chat-confirm-close>
96
-
95
+ <chat-confirm-close
96
+ [translationMap]="translationMapCloseChatDialog"
97
+ [stylesMap]="stylesMap"
98
+ (onDiaglogClosed)="onCloseDialog($event)">
97
99
  </chat-confirm-close>
98
100
  </dialog>
99
101
 
@@ -160,6 +160,17 @@
160
160
  }
161
161
  }
162
162
 
163
+ dialog:-internal-dialog-in-top-layer{
164
+ border: 0px;
165
+ border-radius: 16px;
166
+ padding: 15px 15px;
167
+ &::backdrop {
168
+ border-radius: 16px;
169
+ }
170
+ }
171
+
172
+
173
+
163
174
  /* ==================== MOBILE VERSION ==================== */
164
175
  @media (max-width: 451px) {
165
176
  #chat21-conversation-component {
@@ -138,6 +138,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
138
138
  translationMapFooter: Map<string, string>;
139
139
  translationMapContent: Map<string, string>;
140
140
  translationMapPreview: Map<string, string>;
141
+ translationMapCloseChatDialog: Map<string, string>;
141
142
 
142
143
  // ========== begin:: typying =======
143
144
  public isTypings = false;
@@ -257,11 +258,18 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
257
258
  'LABEL_PREVIEW'
258
259
  ];
259
260
 
261
+ const keysCloseChatDialog= [
262
+ 'BACK',
263
+ 'CLOSE',
264
+ 'CLOSE_CHAT'
265
+ ];
266
+
260
267
 
261
268
  this.translationMapHeader = this.customTranslateService.translateLanguage(keysHeader);
262
269
  this.translationMapFooter = this.customTranslateService.translateLanguage(keysFooter);
263
270
  this.translationMapContent = this.customTranslateService.translateLanguage(keysContent);
264
271
  this.translationMapPreview = this.customTranslateService.translateLanguage(keysPreview);
272
+ this.translationMapCloseChatDialog = this.customTranslateService.translateLanguage(keysCloseChatDialog)
265
273
  }
266
274
 
267
275
  ngAfterViewInit() {
@@ -980,17 +988,32 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
980
988
  }
981
989
  /** CALLED BY: conv-header component */
982
990
  onCloseChat(){
983
- // this.mydialog.nativeElement.showModal()
984
991
  this.logger.debug('[CONV-COMP] close chat with uid ', this.conversation.uid, this.conversationId)
985
- this.tiledeskRequestService.closeSupportGroup(this.conversationId).then(data => {
986
- if(data === 'closed'){
987
- this.isMenuShow = false
988
- this.logger.debug('[CONV-COMP] chat closed successfully with uid ', this.conversationId)
989
- }
990
- }).catch(error => {
991
- this.logger.error('[CONV-COMP] ERROR while closing chat with id: ', this.conversationId, error)
992
- })
992
+ this.mydialog.nativeElement.showModal();
993
+ this.isMenuShow = false
994
+ }
995
+ /** CALLED BY: confirm-close modal component */
996
+ onCloseDialog(event: {type: string, data: any}){
997
+ this.logger.debug('[CONV-COMP] onCloseDialog data returned ', event)
998
+ switch(event.type){
999
+ case 'back':
1000
+ this.mydialog.nativeElement.close()
1001
+ break;
1002
+ case 'confirm':
1003
+ this.tiledeskRequestService.closeSupportGroup(this.conversationId).then(data => {
1004
+ if(data === 'closed'){
1005
+ this.mydialog.nativeElement.close()
1006
+ this.logger.debug('[CONV-COMP] chat closed successfully with uid ', this.conversationId)
1007
+ }
1008
+ }).catch(error => {
1009
+ this.logger.error('[CONV-COMP] ERROR while closing chat with id: ', this.conversationId, error)
1010
+ })
1011
+ break;
1012
+ }
1013
+
1014
+
993
1015
  }
1016
+
994
1017
  /** CALLED BY: conv-header component */
995
1018
  onRestartChat(){
996
1019
  //restart SAME conversation calling /start againg
@@ -1,5 +1,32 @@
1
1
  <div class="modal-container">
2
- CLOSE CONVERSATION MODAL
2
+ <div class="header">
3
+ <!-- ICON CLOSE CHAT -->
4
+ <button tabindex="-1" class="c21-header-button c21-right c21-close c21-button-clean" (click)="onBack()">
5
+ <svg role="img" aria-labelledby="altIconTitle" [ngStyle]="{'fill': stylesMap?.get('themeColor') }" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">
6
+ <path fill="none" d="M0 0h24v24H0V0z" />
7
+ <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
8
+ <title id="altIconTitle">{{ translationMap?.get('CLOSE') }}</title>
9
+ </svg>
10
+ </button>
11
+ </div>
12
+ <div class="content">
13
+ <div class="text">Are you sure you wanna close this chat?</div>
14
+ <div class="options">
15
+
16
+ <!-- BUTTON CANCEL-->
17
+ <span class="v-align-center c21-label-button back-button" (click)="onBack()">
18
+ {{translationMap?.get('BACK')}}
19
+ </span>
20
+
21
+ <!-- BUTTON CLOSE-->
22
+ <button tabindex="1040" aflistconv #aflistconv class="c21-button-primary" (click)="onConfirm()" [ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('themeForegroundColor') }">
23
+ <span class="v-align-center c21-label-button">
24
+ {{translationMap?.get('CLOSE_CHAT')}}
25
+ </span>
26
+ <div class="clear"></div>
27
+ </button>
28
+ </div>
29
+ </div>
3
30
  </div>
4
31
 
5
32
 
@@ -0,0 +1,51 @@
1
+ .modal-container{
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 5px;
5
+ }
6
+
7
+ .header{
8
+ display: flex;
9
+ justify-content: flex-end;
10
+ }
11
+
12
+ .content{
13
+ font-size: 1.2em;
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 15px;
17
+ .text{
18
+ max-width: calc(100% - 30px);
19
+ }
20
+ .options{
21
+ display: flex;
22
+ justify-content: flex-end;
23
+ align-items: center;
24
+ gap: 15px;
25
+
26
+ &:hover{
27
+ cursor: pointer;
28
+ }
29
+
30
+ .back-button{
31
+ color: #777777
32
+ }
33
+
34
+ }
35
+
36
+
37
+ }
38
+
39
+ .c21-header-button{
40
+ width: 30px;
41
+ height: 30px;
42
+ }
43
+
44
+ button.c21-button-primary{
45
+ margin: 0 !important;
46
+ height: 30px !important;
47
+
48
+ .c21-label-button{
49
+ margin: 0 !important;
50
+ }
51
+ }
@@ -1,4 +1,5 @@
1
- import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
1
+ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
2
+
2
3
 
3
4
  @Component({
4
5
  selector: 'chat-confirm-close',
@@ -7,18 +8,26 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
7
8
  })
8
9
  export class ConfirmCloseComponent implements OnInit{
9
10
 
10
- @ViewChild('mydialog') mydialog: ElementRef;
11
+ @Input() translationMap: Map< string, string>;
12
+ @Input() stylesMap: Map<string, string>;
13
+ @Output() onDiaglogClosed = new EventEmitter<{type: string, data: any}>();
11
14
 
12
15
  constructor() { }
13
16
 
14
17
  ngOnInit(): void {
15
- // console.log('[CONFIRM CLOSE MODAL] onInit-->', this.dialog);
18
+ console.log('[CONFIRM CLOSE MODAL] onInit');
16
19
  // this.dialog.showModal();
17
20
  }
18
21
 
19
22
  ngAfterViewInit(){
20
- // console.log('[CONFIRM CLOSE MODAL] ngAfterViewInit-->', this.mydialog);
21
- // this.mydialog.nativeElement.showModal()
23
+ }
24
+
25
+ onBack(){
26
+ this.onDiaglogClosed.emit({type: 'back', data: null});
27
+ }
28
+
29
+ onConfirm(){
30
+ this.onDiaglogClosed.emit({type: 'confirm', data: null});
22
31
  }
23
32
 
24
33
  }
@@ -55,6 +55,7 @@
55
55
  "CLOSE_CHAT": "Close chat",
56
56
  "MINIMIZE":"Minimize",
57
57
  "MAXIMIZE":"Maximize",
58
+ "CONFIRM_CLOSE_CHAT":"Are you sure you wanna close this chat?",
58
59
 
59
60
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"you",
60
61
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"have been added to ",
@@ -55,6 +55,7 @@
55
55
  "CLOSE_CHAT": "Cerrar chat",
56
56
  "MINIMIZE":"Minimizar",
57
57
  "MAXIMIZE":"Maximizar",
58
+ "CONFIRM_CLOSE_CHAT":"¿Estás segura de que quieres cerrar este chat?",
58
59
 
59
60
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"tú",
60
61
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"han sido agregados a ",
@@ -55,6 +55,7 @@
55
55
  "CLOSE_CHAT": "Fermer le chat",
56
56
  "MINIMIZE":"Minimiser",
57
57
  "MAXIMIZE":"Maximiser",
58
+ "CONFIRM_CLOSE_CHAT":"Etes-vous sûr de vouloir fermer cette discussion?",
58
59
 
59
60
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"toi",
60
61
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"ont été ajoutés à ",
@@ -55,6 +55,7 @@
55
55
  "CLOSE_CHAT": "Chiudi chat",
56
56
  "MINIMIZE":"Minimizza",
57
57
  "MAXIMIZE":"Massimizza",
58
+ "CONFIRM_CLOSE_CHAT":"Vuoi davvero chiudere questa chat?",
58
59
 
59
60
  "INFO_SUPPORT_USER_ADDED_SUBJECT":"tu",
60
61
  "INFO_SUPPORT_USER_ADDED_YOU_VERB":"sei stato aggiunto ",