@chat21/chat21-web-widget 5.0.85 → 5.0.88

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,7 +6,33 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
- # 5.0.85 in PROD
9
+ # 5.0.88 in PROD
10
+
11
+ # 5.0.87 in PROD
12
+
13
+ # 5.0.86 in PROD
14
+
15
+ # 5.0.85-rc.2
16
+ - **added**: loading progress indicator while closing a conversation
17
+
18
+ # 5.0.85-rc.1
19
+ - **added**: hide header restart menu option if conversation is closed
20
+ - **removed**: continueConversationBeforeTime settings property
21
+
22
+ # 5.0.84 in PROD
23
+
24
+ # 5.0.84-rc.4
25
+ - **added**: checkAcceptedFile fn on dragleave event conversation-content component
26
+ - **added**: checkAcceptedFile fn in conversation-footer component
27
+
28
+ # 5.0.84-rc.3
29
+ - **changed**: index-dev lib order import
30
+
31
+ # 5.0.84-rc.2
32
+ - **changed**: bootstrap, jquery and font-awesome libs
33
+
34
+ # 5.0.84-rc.1
35
+ - **removed**: innerHtml from document element
10
36
 
11
37
  # 5.0.83 in PROD
12
38
 
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.85",
4
+ "version": "5.0.88",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -15,7 +15,7 @@
15
15
  [hideHeaderCloseButton]="g?.hideHeaderCloseButton"
16
16
  [hideHeaderBackButton]="g?.singleConversation"
17
17
  [hideCloseConversationOptionMenu]="(isConversationArchived || g?.hideCloseConversationOptionMenu)"
18
- [hideRestartConversationOptionsMenu]="((!g?.singleConversation && !hideTextAreaContent) || g?.hideRestartConversationOptionsMenu)"
18
+ [hideRestartConversationOptionsMenu]="(isConversationArchived || (!g?.singleConversation && !hideTextAreaContent) || g?.hideRestartConversationOptionsMenu)"
19
19
  [hideHeaderConversationOptionsMenu]="g?.hideHeaderConversationOptionsMenu"
20
20
  [hideSignOutOptionMenu]="(!g?.singleConversation || !g?.showLogoutOption)"
21
21
  [hideChatDetailOptionMenu]="(!g?.isDevMode)"
@@ -93,6 +93,7 @@
93
93
 
94
94
  <dialog #mydialog>
95
95
  <chat-confirm-close
96
+ [conversationId]="conversationId"
96
97
  [translationMap]="translationMapCloseChatDialog"
97
98
  [stylesMap]="stylesMap"
98
99
  (onDiaglogClosed)="onCloseDialog($event)">
@@ -116,7 +117,6 @@
116
117
  [channelType]="g?.channelType"
117
118
  [userFullname]="g?.userFullname"
118
119
  [userEmail]="g?.userEmail"
119
- [showContinueConversationButton]="g?.singleConversation && showContinueConversationButton"
120
120
  [showAttachmentButton]="g?.showAttachmentButton"
121
121
  [hideTextAreaContent]="(g?.singleConversation && hideTextAreaContent) || (isConversationArchived && !g?.allowReopen)"
122
122
  [isConversationArchived]="isConversationArchived"
@@ -39,6 +39,7 @@ import { CustomTranslateService } from 'src/chat21-core/providers/custom-transla
39
39
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
40
40
  import { TiledeskRequestsService } from 'src/chat21-core/providers/tiledesk/tiledesk-requests.service';
41
41
  import { ConversationContentComponent } from '../conversation-content/conversation-content.component';
42
+ import { checkAcceptedFile } from 'src/app/utils/utils';
42
43
  // import { TranslateService } from '@ngx-translate/core';
43
44
 
44
45
  @Component({
@@ -90,7 +91,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
90
91
  footerMessagePlaceholder: string = '';
91
92
  textInputTextArea: String;
92
93
  isTrascriptDownloadEnabled = false;
93
- showContinueConversationButton: boolean = false
94
+ // showContinueConversationButton: boolean = false
94
95
  // ========= begin:: gestione scroll view messaggi ======= //
95
96
  //startScroll = true; // indica lo stato dello scroll: true/false -> è in movimento/ è fermo
96
97
  isScrolling = false;
@@ -261,7 +262,8 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
261
262
  const keysCloseChatDialog= [
262
263
  'BACK',
263
264
  'CLOSE',
264
- 'CLOSE_CHAT'
265
+ 'CLOSE_CHAT',
266
+ 'CONFIRM_CLOSE_CHAT'
265
267
  ];
266
268
 
267
269
 
@@ -401,8 +403,8 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
401
403
  this.conversation = conv;
402
404
  this.isConversationArchived = true;
403
405
  /**calc time difference between now and last conversation timestamp to allow "Continue" button */
404
- let duration = getDateDifference(this.conversation.timestamp, Date.now())
405
- duration.hours < this.g.continueConversationBeforeTime? this.showContinueConversationButton = true: this.showContinueConversationButton = false
406
+ // let duration = getDateDifference(this.conversation.timestamp, Date.now())
407
+ // duration.hours < this.g.continueConversationBeforeTime? this.showContinueConversationButton = true: this.showContinueConversationButton = false
406
408
  callback(this.isConversationArchived)
407
409
  }else if(!conv) {
408
410
  callback(null);
@@ -990,6 +992,7 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
990
992
  onCloseChat(){
991
993
  this.logger.debug('[CONV-COMP] close chat with uid ', this.conversation.uid, this.conversationId)
992
994
  this.mydialog.nativeElement.showModal();
995
+ // this.isClosingConversation = false;
993
996
  this.isMenuShow = false
994
997
  }
995
998
  /** CALLED BY: confirm-close modal component */
@@ -1346,34 +1349,32 @@ export class ConversationComponent implements OnInit, AfterViewInit, OnChanges {
1346
1349
  var mimeType = fileList[0].type
1347
1350
  this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType)
1348
1351
 
1349
- // if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
1350
- // this.logger.log('[CONV-COMP] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
1351
- // this.checkAcceptedFile(mimeType);
1352
- // const isAccepted = this.checkAcceptedFile(mimeType)
1353
- // this.logger.log('[CONV-COMP] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP',isAccepted)
1354
- // if (isAccepted === true) {
1355
1352
  this.dropEvent = event
1356
- // } else {
1357
- // this.logger.log( '[CONV-COMP] ----> FILE - DROP mimeType files ', mimeType,'NOT SUPPORTED FILE TYPE')
1358
- // this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger','toast-custom-class', 5000 )
1359
- // // this.presentToastOnlyImageFilesAreAllowedToDrag()
1360
- // }
1361
1353
 
1362
1354
  }
1363
1355
  }
1364
1356
 
1365
1357
  allowDrop(event: any) {
1366
- event.preventDefault()
1367
- event.stopPropagation()
1358
+ event.preventDefault();
1359
+ event.stopPropagation();
1368
1360
  this.logger.log('[CONV-COMP] ----> FILE - (dragover) allowDrop ev ', event)
1369
1361
  this.isHovering = true
1370
1362
  }
1371
1363
 
1372
1364
  drag(event){
1373
- event.preventDefault()
1365
+ event.preventDefault();
1366
+ this.logger.log('[CONV-COMP] ----> FILE - (dragleave) drag ev ', event)
1367
+ if (event.dataTransfer && event.dataTransfer.files) {
1368
+ const files = event.dataTransfer.files;
1369
+ const canUploadFile = checkAcceptedFile(files[0].type, this.appConfigService.getConfig().fileUploadAccept)
1370
+ if(!canUploadFile){
1371
+ this.logger.error('[IMAGE-UPLOAD] detectFiles: can not upload current file type--> NOT ALLOWED', this.appConfigService.getConfig().fileUploadAccept)
1372
+ return;
1373
+ }
1374
+ }
1374
1375
  event.stopPropagation()
1375
- console.log('dragleave-->', event)
1376
1376
  this.isHovering = false
1377
1377
  }
1378
1378
 
1379
1379
  }
1380
+
@@ -107,10 +107,10 @@
107
107
  </span>
108
108
  <div class="clear"></div>
109
109
  </button>
110
- <button *ngIf="showContinueConversationButton" tabindex="1040" class="c21-button-primary" (click)="onContinueConversation()" [ngStyle]="{'background-color': stylesMap.get('themeColor'), 'border-color': stylesMap.get('themeColor'), 'color': stylesMap?.get('foregroundColor')}">
110
+ <!-- <button *ngIf="showContinueConversationButton" tabindex="1040" class="c21-button-primary" (click)="onContinueConversation()" [ngStyle]="{'background-color': stylesMap.get('themeColor'), 'border-color': stylesMap.get('themeColor'), 'color': stylesMap?.get('foregroundColor')}">
111
111
  <span class="v-align-center c21-label-button">
112
112
  {{translationMap?.get('CONTINUE')}}
113
113
  </span>
114
114
  <div class="clear"></div>
115
- </button>
115
+ </button> -->
116
116
  </div>
@@ -1,5 +1,6 @@
1
1
  import { Component, ComponentFactoryResolver, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewContainerRef } from '@angular/core';
2
2
  import { Globals } from 'src/app/utils/globals';
3
+ import { checkAcceptedFile } from 'src/app/utils/utils';
3
4
  import { MessageModel } from 'src/chat21-core/models/message';
4
5
  import { UploadModel } from 'src/chat21-core/models/upload';
5
6
  import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service';
@@ -27,7 +28,7 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
27
28
  @Input() userFullname: string;
28
29
  @Input() userEmail: string;
29
30
  @Input() showAttachmentButton: boolean;
30
- @Input() showContinueConversationButton: boolean;
31
+ // @Input() showContinueConversationButton: boolean;
31
32
  @Input() isConversationArchived: boolean;
32
33
  @Input() hideTextAreaContent: boolean;
33
34
  @Input() hideTextReply: boolean;
@@ -129,48 +130,56 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
129
130
 
130
131
  const that = this;
131
132
  if (event.target.files && event.target.files[0]) {
132
- const nameFile = event.target.files[0].name;
133
- const typeFile = event.target.files[0].type;
134
- const size = event.target.files[0].size
135
- const reader = new FileReader();
136
- that.logger.debug('[CONV-FOOTER] OK preload: ', nameFile, typeFile, reader);
137
- reader.addEventListener('load', function () {
138
- that.logger.debug('[CONV-FOOTER] addEventListener load', reader.result);
139
- that.isFileSelected = true;
140
- // se inizia con image
141
- if (typeFile.startsWith('image') && !typeFile.includes('svg')) {
142
- const imageXLoad = new Image;
143
- that.logger.debug('[CONV-FOOTER] onload ', imageXLoad);
144
- imageXLoad.src = reader.result.toString();
145
- imageXLoad.title = nameFile;
146
- imageXLoad.onload = function () {
147
- that.logger.debug('[CONV-FOOTER] onload image');
148
- // that.arrayFilesLoad.push(imageXLoad);
149
- const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
150
- that.arrayFilesLoad[0] = { uid: uid, file: imageXLoad, type: typeFile, size: size };
151
- that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
152
- // SEND MESSAGE
153
- that.loadFile();
154
- };
155
- } else {
156
- that.logger.debug('[CONV-FOOTER] onload file');
157
- const fileXLoad = {
158
- src: reader.result.toString(),
159
- title: nameFile
160
- };
133
+
134
+ const canUploadFile = checkAcceptedFile(event.target.files[0].type, this.fileUploadAccept)
135
+ if(!canUploadFile){
136
+ this.logger.error('[IMAGE-UPLOAD] detectFiles: can not upload current file type--> NOT ALLOWED', this.fileUploadAccept)
137
+ this.isFilePendingToUpload = false;
138
+ return;
139
+ }
140
+
141
+ const nameFile = event.target.files[0].name;
142
+ const typeFile = event.target.files[0].type;
143
+ const size = event.target.files[0].size
144
+ const reader = new FileReader();
145
+ that.logger.debug('[CONV-FOOTER] OK preload: ', nameFile, typeFile, reader);
146
+ reader.addEventListener('load', function () {
147
+ that.logger.debug('[CONV-FOOTER] addEventListener load', reader.result);
148
+ that.isFileSelected = true;
149
+ // se inizia con image
150
+ if (typeFile.startsWith('image') && !typeFile.includes('svg')) {
151
+ const imageXLoad = new Image;
152
+ that.logger.debug('[CONV-FOOTER] onload ', imageXLoad);
153
+ imageXLoad.src = reader.result.toString();
154
+ imageXLoad.title = nameFile;
155
+ imageXLoad.onload = function () {
156
+ that.logger.debug('[CONV-FOOTER] onload image');
161
157
  // that.arrayFilesLoad.push(imageXLoad);
162
158
  const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
163
- that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile, size: size };
159
+ that.arrayFilesLoad[0] = { uid: uid, file: imageXLoad, type: typeFile, size: size };
164
160
  that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
165
161
  // SEND MESSAGE
166
162
  that.loadFile();
167
- }
168
- }, false);
169
-
170
- if (event.target.files[0]) {
171
- reader.readAsDataURL(event.target.files[0]);
172
- that.logger.debug('[CONV-FOOTER] reader-result: ', event.target.files[0]);
163
+ };
164
+ } else {
165
+ that.logger.debug('[CONV-FOOTER] onload file');
166
+ const fileXLoad = {
167
+ src: reader.result.toString(),
168
+ title: nameFile
169
+ };
170
+ // that.arrayFilesLoad.push(imageXLoad);
171
+ const uid = (new Date().getTime()).toString(36); // imageXLoad.src.substring(imageXLoad.src.length - 16);
172
+ that.arrayFilesLoad[0] = { uid: uid, file: fileXLoad, type: typeFile, size: size };
173
+ that.logger.debug('[CONV-FOOTER] OK: ', that.arrayFilesLoad[0]);
174
+ // SEND MESSAGE
175
+ that.loadFile();
173
176
  }
177
+ }, false);
178
+
179
+ if (event.target.files[0]) {
180
+ reader.readAsDataURL(event.target.files[0]);
181
+ that.logger.debug('[CONV-FOOTER] reader-result: ', event.target.files[0]);
182
+ }
174
183
  }
175
184
  }
176
185
  }
@@ -502,11 +511,11 @@ export class ConversationFooterComponent implements OnInit, OnChanges {
502
511
  this.onNewConversationButtonClicked.emit();
503
512
  }
504
513
 
505
- onContinueConversation(){
506
- this.hideTextAreaContent = false;
507
- this.onBackButton.emit(false)
508
- this.restoreTextArea()
509
- }
514
+ // onContinueConversation(){
515
+ // this.hideTextAreaContent = false;
516
+ // this.onBackButton.emit(false)
517
+ // this.restoreTextArea()
518
+ // }
510
519
 
511
520
  onBackButtonFN(){
512
521
  this.onBackButton.emit(false)
@@ -69,16 +69,7 @@
69
69
  [themeColor]="stylesMap.get('themeColor')"
70
70
  [foregroundColor]="stylesMap.get('foregroundColor')">
71
71
  </chat-html>
72
- <!-- <p #messageEl class="message_innerhtml marked" [innerHTML]="printMessage(message, messageEl, this) | marked"></p> -->
73
- <!-- <div *ngIf="isPopupUrl(message.text); then contentPopup else contentNewTab">here
74
- is ignored</div>
75
- <ng-template #contentPopup>
76
- <p style="text-decoration: underline; padding:8px; cursor: pointer;"
77
- (click)="popupUrl(g.windowContext, message.text,'windowName')">{{strip_tags(message.text)}}</p>
78
- </ng-template>
79
- <ng-template #contentNewTab>
80
- <p #messageEl [innerHTML]="printMessage(message, messageEl, this) | linky"></p>
81
- </ng-template> -->
72
+
82
73
  </div>
83
74
 
84
75
  </div>
@@ -10,16 +10,31 @@
10
10
  </button>
11
11
  </div>
12
12
  <div class="content">
13
- <div class="text">Are you sure you wanna close this chat?</div>
13
+ <div class="text">{{ translationMap?.get('CONFIRM_CLOSE_CHAT') }}</div>
14
14
  <div class="options">
15
15
 
16
16
  <!-- BUTTON CANCEL-->
17
- <span class="v-align-center c21-label-button back-button" (click)="onBack()">
17
+ <span class="v-align-center c21-label-button back-button" [class.disabled]="isLoadingActive" (click)="onBack()">
18
18
  {{translationMap?.get('BACK')}}
19
19
  </span>
20
20
 
21
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') }">
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('foregroundColor') }">
23
+ <span *ngIf="isLoadingActive" class="spinner-container">
24
+ <svg xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="25" height="25" [ngStyle]="{'fill': stylesMap?.get('foregroundColor') }"
25
+ viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
26
+ <path fill="inherit" d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
27
+ <animateTransform
28
+ attributeName="transform"
29
+ attributeType="XML"
30
+ type="rotate"
31
+ dur="1s"
32
+ from="0 50 50"
33
+ to="360 50 50"
34
+ repeatCount="indefinite" />
35
+ </path>
36
+ </svg>
37
+ </span>
23
38
  <span class="v-align-center c21-label-button">
24
39
  {{translationMap?.get('CLOSE_CHAT')}}
25
40
  </span>
@@ -28,12 +28,23 @@
28
28
  }
29
29
 
30
30
  .back-button{
31
- color: #777777
31
+ color: #777777;
32
+
33
+ &.disabled{
34
+ cursor: not-allowed;
35
+ pointer-events: none;
36
+ opacity: 0.6
37
+ }
32
38
  }
33
39
 
34
- }
40
+ .spinner-container{
41
+ width: inherit;
42
+ height: inherit;
43
+ display: flex;
44
+ align-items: center;
45
+ }
35
46
 
36
-
47
+ }
37
48
  }
38
49
 
39
50
  .c21-header-button{
@@ -44,6 +55,8 @@
44
55
  button.c21-button-primary{
45
56
  margin: 0 !important;
46
57
  height: 30px !important;
58
+ display: flex;
59
+ align-items: center;
47
60
 
48
61
  .c21-label-button{
49
62
  margin: 0 !important;
@@ -1,4 +1,6 @@
1
- import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
1
+ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, SimpleChange, SimpleChanges, ViewChild, OnDestroy } from '@angular/core';
2
+ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
3
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
2
4
 
3
5
 
4
6
  @Component({
@@ -7,18 +9,33 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild }
7
9
  styleUrls: ['./confirm-close.component.scss']
8
10
  })
9
11
  export class ConfirmCloseComponent implements OnInit{
10
-
12
+
13
+ @Input() isLoadingActive: boolean;
14
+ @Input() conversationId: string;
15
+
11
16
  @Input() translationMap: Map< string, string>;
12
17
  @Input() stylesMap: Map<string, string>;
13
18
  @Output() onDiaglogClosed = new EventEmitter<{type: string, data: any}>();
14
19
 
20
+ private logger: LoggerService = LoggerInstance.getInstance();
15
21
  constructor() { }
16
22
 
17
23
  ngOnInit(): void {
18
- console.log('[CONFIRM CLOSE MODAL] onInit');
24
+ this.logger.log('[CONFIRM CLOSE MODAL] onInit', this.isLoadingActive, this.stylesMap);
19
25
  // this.dialog.showModal();
20
26
  }
21
27
 
28
+ ngOnChanges(changes: SimpleChanges){
29
+ if(changes &&
30
+ changes['conversationId'] &&
31
+ changes['conversationId'].previousValue !== undefined &&
32
+ (changes['conversationId'].previousValue !== changes['conversationId'].currentValue) &&
33
+ changes['conversationId'].currentValue
34
+ ){
35
+ this.isLoadingActive = false;
36
+ }
37
+ }
38
+
22
39
  ngAfterViewInit(){
23
40
  }
24
41
 
@@ -27,6 +44,7 @@ export class ConfirmCloseComponent implements OnInit{
27
44
  }
28
45
 
29
46
  onConfirm(){
47
+ this.isLoadingActive = true;
30
48
  this.onDiaglogClosed.emit({type: 'confirm', data: null});
31
49
  }
32
50
 
@@ -974,7 +974,7 @@ export class GlobalSettingsService {
974
974
  globals.singleConversation = (TEMP === true) ? true : false;
975
975
  }
976
976
  TEMP = tiledeskSettings['restartConversation'];
977
- // this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > continueConversationBeforeTime:: ', TEMP]);
977
+ // this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > restartConversation:: ', TEMP]);
978
978
  if (TEMP !== undefined) {
979
979
  globals.restartConversation = (TEMP === true) ? true : false;
980
980
  }
@@ -1001,11 +1001,11 @@ export class GlobalSettingsService {
1001
1001
  globals.showInfoMessage.push('CHAT_CLOSED')
1002
1002
  }
1003
1003
  }
1004
- TEMP = tiledeskSettings['continueConversationBeforeTime'];
1005
- // this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > continueConversationBeforeTime:: ', TEMP]);
1006
- if (TEMP !== undefined) {
1007
- globals.continueConversationBeforeTime = +TEMP;
1008
- }
1004
+ // TEMP = tiledeskSettings['continueConversationBeforeTime'];
1005
+ // // this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > continueConversationBeforeTime:: ', TEMP]);
1006
+ // if (TEMP !== undefined) {
1007
+ // globals.continueConversationBeforeTime = +TEMP;
1008
+ // }
1009
1009
  TEMP = tiledeskSettings['participants'];
1010
1010
  // this.logger.debug('[GLOBAL-SET] setVariablesFromSettings > participants:: ', TEMP]);
1011
1011
  if (TEMP !== undefined) {
@@ -1310,10 +1310,10 @@ export class GlobalSettingsService {
1310
1310
  this.globals.showInfoMessage.push('CHAT_CLOSED')
1311
1311
  }
1312
1312
  }
1313
- TEMP = el.nativeElement.getAttribute('continueConversationBeforeTime');
1314
- if (TEMP !== null) {
1315
- this.globals.continueConversationBeforeTime = +TEMP;
1316
- }
1313
+ // TEMP = el.nativeElement.getAttribute('continueConversationBeforeTime');
1314
+ // if (TEMP !== null) {
1315
+ // this.globals.continueConversationBeforeTime = +TEMP;
1316
+ // }
1317
1317
  TEMP = el.nativeElement.getAttribute('participants');
1318
1318
  if (TEMP !== null) {
1319
1319
  this.globals.participants = TEMP.split(',').map(key => { return key.trim()});
@@ -1755,10 +1755,10 @@ export class GlobalSettingsService {
1755
1755
  }
1756
1756
  }
1757
1757
 
1758
- TEMP = getParameterByName(windowContext, 'tiledesk_continueConversationBeforeTime');
1759
- if (TEMP) {
1760
- globals.continueConversationBeforeTime = +TEMP;
1761
- }
1758
+ // TEMP = getParameterByName(windowContext, 'tiledesk_continueConversationBeforeTime');
1759
+ // if (TEMP) {
1760
+ // globals.continueConversationBeforeTime = +TEMP;
1761
+ // }
1762
1762
 
1763
1763
  TEMP = getParameterByName(windowContext, 'tiledesk_participants');
1764
1764
  if (TEMP) {
@@ -201,7 +201,7 @@ export class Globals {
201
201
  showInfoMessage: Array<string>; // ******* new ********
202
202
  typingLocation: string; // ******* new ********
203
203
  allowReopen: boolean; // ******* new ********
204
- continueConversationBeforeTime: number; // ******* new ********
204
+ // continueConversationBeforeTime: number; // ******* new ********
205
205
  participants: Array<string>; // ******* new ********
206
206
  whatsappNumber: string; // ******* new ********
207
207
  messangerPageTitle: string; // ******* new ********
@@ -378,7 +378,7 @@ export class Globals {
378
378
  /** set the location of typing indicator (header or content) */
379
379
  this.allowReopen = false;
380
380
  /** enable the user to reopen a closed conversation */
381
- this.continueConversationBeforeTime = 48;
381
+ // this.continueConversationBeforeTime = 48;
382
382
  /** enable user to continue archived confersation before the value time from last timeout message */
383
383
  this.participants = [];
384
384
  /** enable user to talk with specific chat-bots/humans */
@@ -387,3 +387,48 @@ export function getUnique(arr, comp) {
387
387
  // eliminate the dead keys & store unique objects
388
388
  .filter(e => arr[e]).map(e => arr[e]);
389
389
  }
390
+
391
+ export function checkAcceptedFile(fileType, fileUploadAccept ): boolean{
392
+
393
+ if (fileUploadAccept === '*/*') {
394
+ return true
395
+ }
396
+ // Dividi la stringa fileUploadAccept in un array di tipi accettati
397
+ const acceptedTypes = fileUploadAccept.split(',');
398
+
399
+ // Verifica se il tipo di file è accettato
400
+ return acceptedTypes.some((accept) => {
401
+ accept = accept.trim();
402
+ // Controlla per i tipi MIME con wildcard, come image/*
403
+ if (accept.endsWith('/*')) {
404
+ const baseMimeType = fileType.split('/')[0]; // Ottieni la parte principale del MIME type
405
+ return accept.replace('/*', '') === baseMimeType;
406
+ }
407
+
408
+ // Controlla se l'accettazione è un MIME type esatto (come image/jpeg)
409
+ if (accept === fileType) {
410
+ return true;
411
+ }
412
+
413
+ // Controlla per le estensioni di file specifiche come .pdf o .txt
414
+ return fileType === getMimeTypeFromExtension(accept);
415
+ });
416
+
417
+ }
418
+
419
+ function getMimeTypeFromExtension(extension: string): string {
420
+ // Rimuovi il punto dall'estensione e ottieni il MIME type
421
+ const mimeTypes: { [key: string]: string } = {
422
+ '.jpg': 'image/jpeg',
423
+ '.jpeg': 'image/jpeg',
424
+ '.png': 'image/png',
425
+ '.gif': 'image/gif',
426
+ '.pdf': 'application/pdf',
427
+ '.txt': 'text/plain',
428
+ '.doc': 'application/msword',
429
+ '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
430
+ '.wav' : 'audio/wav'
431
+ // Aggiungi altri tipi MIME se necessario
432
+ };
433
+ return mimeTypes[extension] || '';
434
+ }
@@ -148,6 +148,9 @@
148
148
  <meta property="og:image" content="https://tiledesk.com/wp-content/uploads/2022/12/6029654-02-min.png" />
149
149
  <meta property="og:locale" content="en">
150
150
 
151
+ <link href="./tiledesk_widget_files/bootstrap.min.css" rel="stylesheet" type="text/css">
152
+ <link href="./tiledesk_widget_files/website-poly.min.css" rel="stylesheet" type="text/css">
153
+
151
154
 
152
155
  <script type="application/javascript">
153
156
  window.tiledeskSettings = {
@@ -307,11 +310,5 @@
307
310
  <div id="preloader">
308
311
  <div class="loader"></div>
309
312
  </div>
310
-
311
- <div>
312
- <link href="./tiledesk_widget_files/bootstrap.min.css" rel="stylesheet" type="text/css">
313
- <!-- <link href="./tiledesk_widget_files/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
314
- <link href="./tiledesk_widget_files/website-poly.min.css" rel="stylesheet" type="text/css">
315
- </div>
316
313
  </body>
317
314
  </html>
@@ -438,10 +438,12 @@
438
438
  <meta property="og:locale" content="en">
439
439
 
440
440
  <link rel="icon" type="image/png" href="./tiledesk_widget_files/logo-short.png">
441
- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
441
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" rel="stylesheet">
442
+ <link href="./tiledesk_widget_files/bootstrap.min.css" rel="stylesheet" type="text/css">
443
+ <link href="./tiledesk_widget_files/website-poly.min.css" rel="stylesheet" type="text/css">
442
444
  <script defer="" src="./tiledesk_widget_files/jquery.min.js"></script>
443
445
  <script defer="" src="./tiledesk_widget_files/bootstrap.min.js"></script>
444
-
446
+
445
447
  <!-- <script type="application/javascript">
446
448
  window.tiledeskSettings = {
447
449
  marginX: "100px",
@@ -592,7 +594,7 @@
592
594
  }
593
595
 
594
596
  window.onload = function() {
595
- document.getElementById("tiledesk_widgetTitle").innerHTML = tiledesk_widgetTitle;
597
+ document.getElementById("tiledesk_widgetTitle").value = tiledesk_widgetTitle;
596
598
  }
597
599
 
598
600
 
@@ -712,15 +714,5 @@
712
714
  </script>
713
715
 
714
716
  <!-- Google Analytics -->
715
-
716
-
717
-
718
-
719
- <div>
720
- <link href="./tiledesk_widget_files/bootstrap.min.css" rel="stylesheet" type="text/css">
721
- <!-- <link href="./tiledesk_widget_files/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
722
- <link href="./tiledesk_widget_files/website-poly.min.css" rel="stylesheet" type="text/css">
723
- <!-- <link href="./tiledesk_widget_files/css" rel="stylesheet" type="text/css"> -->
724
- </div>
725
717
  </body>
726
718
  </html>