@chat21/chat21-ionic 3.4.21 → 3.4.22

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
@@ -8,6 +8,9 @@
8
8
  ### **Copyrigth**:
9
9
  *Tiledesk SRL*
10
10
 
11
+ # 3.4.22 in PROD
12
+ - **added**: managed allowed_upload_extentions from project settings
13
+
11
14
  # 3.4.21 in PROD
12
15
 
13
16
  # 3.4.20 in PROD
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.4.21",
4
+ "version": "3.4.22",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -210,7 +210,7 @@
210
210
  [isCopilotEnabled]="isCopilotEnabled"
211
211
  [supportMode]="supportMode"
212
212
  [leadInfo]="leadInfo"
213
- [fileUploadAccept]="appConfigProvider.getConfig().fileUploadAccept"
213
+ [fileUploadAccept]="fileUploadAccept"
214
214
  [emailSection]="isEmailEnabled"
215
215
  [offlineMsgEmail]="offlineMsgEmail"
216
216
  [whatsappTemplatesSection]="isWhatsappTemplatesEnabled"
@@ -154,6 +154,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
154
154
  isEmailEnabled: boolean;
155
155
  offlineMsgEmail: boolean;
156
156
  isWhatsappTemplatesEnabled: boolean;
157
+ fileUploadAccept: string;
157
158
  //SOUND
158
159
  setTimeoutSound: any;
159
160
  audio: any;
@@ -490,7 +491,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
490
491
  this.showMessageWelcome = false
491
492
 
492
493
  const appconfig = this.appConfigProvider.getConfig()
493
- this.tenant = appconfig.firebaseConfig.tenant
494
+ this.tenant = appconfig.firebaseConfig.tenant;
494
495
  this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant)
495
496
 
496
497
  this.logger.log('[CONVS-DETAIL] - initialize -> conversationWith: ', this.conversationWith, ' -> conversationWithFullname: ', this.conversationWithFullname)
@@ -570,7 +571,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
570
571
  const projectId = project.id_project
571
572
  this.canShowCanned = this.projectPlanUtils.checkPlanIsExpired(project)
572
573
  this.offlineMsgEmail = this.checkOfflineMsgEmailIsEnabled(project)
573
- this.isCopilotEnabled = this.projectPlanUtils.checkProjectProfileFeature(project, 'copilot')
574
+ this.isCopilotEnabled = this.projectPlanUtils.checkProjectProfileFeature(project, 'copilot');
575
+ this.fileUploadAccept = this.checkAcceptedUploadFile(project)
574
576
  }
575
577
  }, (error) => {
576
578
  this.logger.error('[CONVS-DETAIL] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
@@ -599,6 +601,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
599
601
  return check
600
602
  }
601
603
 
604
+ checkAcceptedUploadFile(project: Project): string {
605
+
606
+ if(project && project?.settings?.allowed_upload_extentions){
607
+ return this.g.fileUploadAccept = project?.settings?.allowed_upload_extentions
608
+ }
609
+
610
+ return this.appConfigProvider.getConfig().fileUploadAccept
611
+ }
612
+
602
613
  // getProjectIdSelectedConversation(conversationWith: string): string{
603
614
  // const conversationWith_segments = conversationWith.split('-')
604
615
  // // Removes the last element of the array if is = to the separator
@@ -2001,8 +2012,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
2001
2012
 
2002
2013
  checkAcceptedFile(draggedFileMimeType) {
2003
2014
  let isAcceptFile = false
2004
- this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept)
2005
- const accept_files = this.appConfigProvider.getConfig().fileUploadAccept
2015
+ this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ', this.fileUploadAccept)
2016
+ const accept_files = this.fileUploadAccept
2006
2017
  this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - mimeType: ', draggedFileMimeType)
2007
2018
  if (accept_files === '*/*') {
2008
2019
  isAcceptFile = true
@@ -2168,7 +2179,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
2168
2179
  this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType)
2169
2180
 
2170
2181
  // const isAccepted = this.checkAcceptedFile(mimeType)
2171
- const canUploadFile = checkAcceptedFile(mimeType, this.appConfigProvider.getConfig().fileUploadAccept)
2182
+ const canUploadFile = checkAcceptedFile(mimeType, this.fileUploadAccept)
2172
2183
  if(!canUploadFile){
2173
2184
  this.presentToast(this.translationsMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'), 'danger', 'toast-custom-class', 5000)
2174
2185
  return;
@@ -54,7 +54,8 @@ export class GlobalSettingsService {
54
54
  this.globals.supportMode = getParameterValue('supportMode', this.appConfigService.getConfig());
55
55
  /** INIT STORAGE SERVICE */
56
56
  this.appStorageService.initialize(environment.storage_prefix, this.globals.persistence, '')
57
-
57
+ /** INIT FILEUPLOADACCEPT parameter */
58
+ this.globals.fileUploadAccept = this.appConfigService.getConfig().fileUploadAccept;
58
59
  /** LOAD PARAMETERS
59
60
  * set parameters in globals
60
61
  */
@@ -13,6 +13,7 @@ export class Globals {
13
13
  persistence: string;
14
14
  lang: string;
15
15
  jwt: string;
16
+ fileUploadAccept: string;
16
17
 
17
18
  constructor(
18
19
  ) { }
@@ -32,6 +33,7 @@ export class Globals {
32
33
  this.logLevel = 'ERROR'
33
34
  this.persistence = 'local';
34
35
  this.lang = 'en'
36
+ this.fileUploadAccept = 'image/*,.pdf,.txt'
35
37
 
36
38
  }
37
39