@chat21/chat21-web-widget 5.1.0-rc16 → 5.1.0-rc17

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.1.0-rc17
10
+ - **added**: allowedOnSpecificUrl and allowedOnSpecificUrlList to manage list of pattern url to allow to load the widget
11
+
9
12
  # 5.1.0-rc16
10
13
  - **added**: hideOnSpecificUrlList replaced in favour of hideOnSpecificDomainList
11
14
 
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.1.0-rc16",
4
+ "version": "5.1.0-rc17",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.tiledesk.com",
7
7
  "repository": {
@@ -516,11 +516,11 @@ export class GlobalSettingsService {
516
516
  if (variables.hasOwnProperty('showAudioRecorderFooterButton')) {
517
517
  globals['showAudioRecorderFooterButton'] = variables['showAudioRecorderFooterButton'];
518
518
  }
519
- if (variables.hasOwnProperty('hideOnSpecificUrl')) {
520
- globals['hideOnSpecificUrl'] = variables['hideOnSpecificUrl'];
519
+ if (variables.hasOwnProperty('allowedOnSpecificUrl')) {
520
+ globals['allowedOnSpecificUrl'] = variables['allowedOnSpecificUrl'];
521
521
  }
522
- if (variables.hasOwnProperty('hideOnSpecificUrlList')) {
523
- globals['hideOnSpecificUrlList'] = variables['hideOnSpecificUrlList'];
522
+ if (variables.hasOwnProperty('allowedOnSpecificUrlList')) {
523
+ globals['allowedOnSpecificUrlList'] = variables['allowedOnSpecificUrlList'];
524
524
  }
525
525
 
526
526
  }
@@ -1978,8 +1978,8 @@ export class GlobalSettingsService {
1978
1978
 
1979
1979
  manageLoadingDomains(): boolean {
1980
1980
 
1981
- if(!this.globals.hideOnSpecificUrlList || !this.globals.hideOnSpecificUrl){
1982
- console.log('No hideOnSpecificUrlList or hideOnSpecificUrl');
1981
+ if(this.globals.allowedOnSpecificUrl && (!this.globals.allowedOnSpecificUrlList || this.globals.allowedOnSpecificUrlList.length === 0) ){
1982
+ console.log('allowedOnSpecificUrl is true and allowedOnSpecificUrlList is empty or not set');
1983
1983
  return true
1984
1984
  }
1985
1985
 
@@ -1992,13 +1992,13 @@ export class GlobalSettingsService {
1992
1992
  }
1993
1993
 
1994
1994
  const currentUrl = this.globals.windowContext.location.href;
1995
- const shouldHide = this.globals.hideOnSpecificUrlList.some(pattern => {
1995
+ const shouldShow = this.globals.allowedOnSpecificUrlList.some(pattern => {
1996
1996
  const regex = wildcardToRegex(pattern);
1997
1997
  return regex.test(currentUrl);
1998
1998
  });
1999
1999
 
2000
2000
  // let isAllowedToLoad = !isAllowedUrlInText(this.globals.windowContext.location.origin, this.globals.hideOnSpecificDomainList)
2001
- return !shouldHide
2001
+ return shouldShow
2002
2002
  }
2003
2003
 
2004
2004
  }
@@ -219,8 +219,8 @@ export class Globals {
219
219
  showAttachmentFooterButton: boolean // ******* new ********
220
220
  showAudioRecorderFooterButton: boolean // ******* new ********
221
221
 
222
- hideOnSpecificUrl: boolean // ******* new ********
223
- hideOnSpecificUrlList: Array<string> // ******* new ********
222
+ allowedOnSpecificUrl: boolean // ******* new ********
223
+ allowedOnSpecificUrlList: Array<string> // ******* new ********
224
224
  constructor(
225
225
  ) { }
226
226
 
@@ -420,10 +420,10 @@ export class Globals {
420
420
  this.showAttachmentFooterButton = true;
421
421
  /** show/hide rec audio option in footer chat-detail page */
422
422
  this.showAudioRecorderFooterButton = true;
423
- /** enabled to set a list of domain not able to load the widget **/
424
- this.hideOnSpecificUrl = false
425
- /** set a list of domain not able to load the widget */
426
- this.hideOnSpecificUrlList = [];
423
+ /** enabled to set a list of pattern url able to load the widget **/
424
+ this.allowedOnSpecificUrl = false
425
+ /** set a list of pattern url able to load the widget */
426
+ this.allowedOnSpecificUrlList = [];
427
427
 
428
428
  // ============ END: SET EXTERNAL PARAMETERS ==============//
429
429