@chat21/chat21-web-widget 5.0.83-rc.2 → 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,13 @@
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
+
12
+ # 5.0.83-rc.3
13
+ - **added**: send '/start' info message on restart header menu option
14
+ - **bug-fixed**: close header menu option not send the last conversation id to close
15
+
9
16
  # 5.0.83-rc.2
10
17
  - **changed**: ui improvements on audio elements
11
18
 
@@ -2,7 +2,12 @@
2
2
  version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
- ng build --configuration="pre" --aot=true --base-href --output-hashing none --build-optimizer=true
5
+ ng build --configuration="pre" --aot=true --base-href --build-optimizer=true
6
+
7
+ ### SET HASHING : START ###
8
+ cp ./src/launch_template.js ./dist/launch.js
9
+ node ./src/build_launch.js
10
+ ### SET HASHING : END ###
6
11
 
7
12
  # ########## --->>>> NATIVE-MQTT folder START <<<<<------ ########## #
8
13
 
@@ -23,11 +28,13 @@ ng build --configuration="pre" --aot=true --base-href --output-hashing none --bu
23
28
 
24
29
  # ########## --->>>> FIREBASE folder START <<<<<------ ########## #
25
30
  cd dist
26
- aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control max-age=300
27
- aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control max-age=300
31
+ aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control max-age=300 --exclude='launch.js' #7days
32
+ aws s3 sync . s3://tiledesk-widget-pre/v5/$version/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
33
+ aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control max-age=300 --exclude='launch.js' #7days
34
+ aws s3 sync . s3://tiledesk-widget-pre/v5/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
28
35
  cd ..
29
36
 
30
- #aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*"
37
+ aws cloudfront create-invalidation --distribution-id E2V5O0YPR61V8P --paths "/*"
31
38
  # echo new version deployed $NEW_VER/$NEW_BUILD/ on s3://tiledesk-widget-pre/v2
32
39
  echo new version deployed $version/ on s3://tiledesk-widget-pre/v5 and s3://tiledesk-widget-pre/v5/$version/
33
40
  echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-widget-pre/v5/index.html
@@ -3,7 +3,13 @@ version=`node -e 'console.log(require("./package.json").version)'`
3
3
  echo "version $version"
4
4
 
5
5
  # --build-optimizer=false if localstorage is disabled (webview) appears https://github.com/firebase/angularfire/issues/970
6
- ng build --configuration="prod" --aot=true --base-href --output-hashing none --build-optimizer=true --vendor-chunk=true
6
+ ng build --configuration="prod" --aot=true --build-optimizer=true --vendor-chunk=true
7
+ ##--base-href='./v5/' --output-hashing none
8
+
9
+ ### SET HASHING : START ###
10
+ cp ./src/launch_template.js ./dist/launch.js
11
+ node ./src/build_launch.js
12
+ ### SET HASHING : END ###
7
13
 
8
14
  #### FIREBASE #####
9
15
  # cd dist
@@ -12,12 +18,13 @@ ng build --configuration="prod" --aot=true --base-href --output-hashing none --b
12
18
  # aws s3 sync . s3://tiledesk-widget/v5/ --cache-control max-age=300
13
19
  # cd ..
14
20
 
15
-
16
21
  # #### MQTT #####
17
22
  cd dist
18
23
  # aws s3 sync . s3://tiledesk-widget/v5/latest/
19
- aws s3 sync . s3://tiledesk-widget/v6/$version/ --cache-control max-age=300
20
- aws s3 sync . s3://tiledesk-widget/v6/ --cache-control max-age=300
24
+ aws s3 sync . s3://tiledesk-widget/v6/$version/ --cache-control max-age=86400 --exclude='launch.js' #8days
25
+ aws s3 sync . s3://tiledesk-widget/v6/$version/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
26
+ aws s3 sync . s3://tiledesk-widget/v6/ --cache-control max-age=86400 --exclude='launch.js' #8days
27
+ aws s3 sync . s3://tiledesk-widget/v6/ --cache-control "no-store,no-cache,private" --exclude='*' --include='launch.js'
21
28
  cd ..
22
29
 
23
30
  aws cloudfront create-invalidation --distribution-id E3EJDWEHY08CZZ --paths "/*"
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.2",
4
+ "version": "5.0.83-rc.4",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -135,6 +135,7 @@ import { ScriptService } from 'src/chat21-core/providers/scripts/script.service'
135
135
  import { CarouselComponent } from './component/message/carousel/carousel.component';
136
136
  import { BrandService } from './providers/brand.service';
137
137
  import { NetworkOfflineComponent } from './component/network-offline/network-offline.component';
138
+ import { ConfirmCloseComponent } from './modals/confirm-close/confirm-close.component';
138
139
 
139
140
 
140
141
 
@@ -300,7 +301,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
300
301
  TooltipDirective,
301
302
  CarouselComponent,
302
303
  NetworkOfflineComponent,
303
-
304
+ ConfirmCloseComponent
304
305
  ],
305
306
  imports: [
306
307
  BrowserModule,
@@ -90,6 +90,15 @@
90
90
  (onCloseModalPreview)="onCloseModalPreview()">
91
91
  </chat-conversation-attachment-preview>
92
92
 
93
+
94
+ <dialog #mydialog>
95
+ <chat-confirm-close
96
+ [translationMap]="translationMapCloseChatDialog"
97
+ [stylesMap]="stylesMap"
98
+ (onDiaglogClosed)="onCloseDialog($event)">
99
+ </chat-confirm-close>
100
+ </dialog>
101
+
93
102
  <!-- FOOTER -->
94
103
  <!-- [class.maximize-width]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)" -->
95
104
  <div id="chat21-footer">
@@ -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 {
@@ -50,6 +50,8 @@ import { ConversationContentComponent } from '../conversation-content/conversati
50
50
  })
51
51
  export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
52
52
  @ViewChild('afConversationComponent') private afConversationComponent: ElementRef; // l'ID del div da scrollare
53
+ @ViewChild('mydialog') mydialog: ElementRef;
54
+
53
55
  // @HostListener('window:resize', ['$event'])
54
56
  // ========= begin:: Input/Output values
55
57
  // @Input() elRoot: ElementRef;
@@ -136,6 +138,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
136
138
  translationMapFooter: Map<string, string>;
137
139
  translationMapContent: Map<string, string>;
138
140
  translationMapPreview: Map<string, string>;
141
+ translationMapCloseChatDialog: Map<string, string>;
139
142
 
140
143
  // ========== begin:: typying =======
141
144
  public isTypings = false;
@@ -255,11 +258,18 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
255
258
  'LABEL_PREVIEW'
256
259
  ];
257
260
 
261
+ const keysCloseChatDialog= [
262
+ 'BACK',
263
+ 'CLOSE',
264
+ 'CLOSE_CHAT'
265
+ ];
266
+
258
267
 
259
268
  this.translationMapHeader = this.customTranslateService.translateLanguage(keysHeader);
260
269
  this.translationMapFooter = this.customTranslateService.translateLanguage(keysFooter);
261
270
  this.translationMapContent = this.customTranslateService.translateLanguage(keysContent);
262
271
  this.translationMapPreview = this.customTranslateService.translateLanguage(keysPreview);
272
+ this.translationMapCloseChatDialog = this.customTranslateService.translateLanguage(keysCloseChatDialog)
263
273
  }
264
274
 
265
275
  ngAfterViewInit() {
@@ -978,19 +988,42 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
978
988
  }
979
989
  /** CALLED BY: conv-header component */
980
990
  onCloseChat(){
981
- this.logger.debug('[CONV-COMP] close chat with uid ', this.conversation.uid)
982
- this.tiledeskRequestService.closeSupportGroup(this.conversation.uid).then(data => {
983
- if(data === 'closed'){
984
- this.isMenuShow = false
985
- this.logger.debug('[CONV-COMP] chat closed successfully with uid ', this.conversation.uid)
986
- }
987
- }).catch(error => {
988
- this.logger.error('[CONV-COMP] ERROR while closing chat with id: ', this.conversation.uid, error)
989
- })
991
+ this.logger.debug('[CONV-COMP] close chat with uid ', this.conversation.uid, this.conversationId)
992
+ this.mydialog.nativeElement.showModal();
993
+ this.isMenuShow = false
990
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
+
1015
+ }
1016
+
991
1017
  /** CALLED BY: conv-header component */
992
1018
  onRestartChat(){
993
- this.hideTextAreaContent = true
1019
+ //restart SAME conversation calling /start againg
1020
+ let attributes = {
1021
+ subtype: 'info',
1022
+ ... this.g.attributes
1023
+ }
1024
+ this.conversationFooter.sendMessage('/start', TYPE_MSG_TEXT, null, attributes)
1025
+
1026
+ // this.hideTextAreaContent = true
994
1027
  }
995
1028
  /** CALLED BY: conv-header component */
996
1029
  onWidgetHeightChange(mode){
@@ -0,0 +1,33 @@
1
+ <div class="modal-container">
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>
30
+ </div>
31
+
32
+
33
+
@@ -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
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ConfirmCloseComponent } from './confirm-close.component';
4
+
5
+ describe('ConfirmCloseComponent', () => {
6
+ let component: ConfirmCloseComponent;
7
+ let fixture: ComponentFixture<ConfirmCloseComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ ConfirmCloseComponent ]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(ConfirmCloseComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,33 @@
1
+ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
2
+
3
+
4
+ @Component({
5
+ selector: 'chat-confirm-close',
6
+ templateUrl: './confirm-close.component.html',
7
+ styleUrls: ['./confirm-close.component.scss']
8
+ })
9
+ export class ConfirmCloseComponent implements OnInit{
10
+
11
+ @Input() translationMap: Map< string, string>;
12
+ @Input() stylesMap: Map<string, string>;
13
+ @Output() onDiaglogClosed = new EventEmitter<{type: string, data: any}>();
14
+
15
+ constructor() { }
16
+
17
+ ngOnInit(): void {
18
+ console.log('[CONFIRM CLOSE MODAL] onInit');
19
+ // this.dialog.showModal();
20
+ }
21
+
22
+ ngAfterViewInit(){
23
+ }
24
+
25
+ onBack(){
26
+ this.onDiaglogClosed.emit({type: 'back', data: null});
27
+ }
28
+
29
+ onConfirm(){
30
+ this.onDiaglogClosed.emit({type: 'confirm', data: null});
31
+ }
32
+
33
+ }
@@ -25,6 +25,14 @@ export class BrandResources {
25
25
  // var icon = document.querySelector("link[rel~='icon']") as HTMLElement;
26
26
  // icon.setAttribute('href', this.brand['FAVICON_URL'])
27
27
 
28
+ /** META sharing ELEMENTS */
29
+ if(this.brand['META_SHARE_INFO'] && this.brand['META_SHARE_INFO'].length > 0){
30
+ Object.keys(this.brand['META_SHARE_INFO']).forEach(key => {
31
+ var meta = document.querySelector("meta[property^='og:"+key.toLowerCase()+"']") as HTMLElement;
32
+ meta.setAttribute('content', this.brand['META_SHARE_INFO'][key])
33
+ })
34
+ }
35
+
28
36
  /** CSS */
29
37
  document.documentElement.style.setProperty('--base-brand-color', this.brand['BRAND_PRIMARY_COLOR']);
30
38
 
@@ -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 ",