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

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,12 @@
6
6
  ### **Copyrigth**:
7
7
  *Tiledesk SRL*
8
8
 
9
+ # 5.1.0-rc18
10
+ - **bug-fixed**: allowedOnSpecificUrl
11
+
12
+ # 5.1.0-rc17
13
+ - **added**: allowedOnSpecificUrl and allowedOnSpecificUrlList to manage list of pattern url to allow to load the widget
14
+
9
15
  # 5.1.0-rc16
10
16
  - **added**: hideOnSpecificUrlList replaced in favour of hideOnSpecificDomainList
11
17
 
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-rc18",
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
  }
@@ -1977,9 +1977,14 @@ export class GlobalSettingsService {
1977
1977
  }
1978
1978
 
1979
1979
  manageLoadingDomains(): boolean {
1980
+ const { allowedOnSpecificUrl, allowedOnSpecificUrlList } = this.globals;
1981
+
1982
+ if(!allowedOnSpecificUrl){
1983
+ return true
1984
+ }
1980
1985
 
1981
- if(!this.globals.hideOnSpecificUrlList || !this.globals.hideOnSpecificUrl){
1982
- console.log('No hideOnSpecificUrlList or hideOnSpecificUrl');
1986
+ if (!Array.isArray(allowedOnSpecificUrlList) || allowedOnSpecificUrlList.length === 0) {
1987
+ console.log('allowedOnSpecificUrl is true and allowedOnSpecificUrlList is empty or not set');
1983
1988
  return true
1984
1989
  }
1985
1990
 
@@ -1992,13 +1997,13 @@ export class GlobalSettingsService {
1992
1997
  }
1993
1998
 
1994
1999
  const currentUrl = this.globals.windowContext.location.href;
1995
- const shouldHide = this.globals.hideOnSpecificUrlList.some(pattern => {
2000
+ const shouldShow = allowedOnSpecificUrlList.some(pattern => {
1996
2001
  const regex = wildcardToRegex(pattern);
1997
2002
  return regex.test(currentUrl);
1998
2003
  });
1999
2004
 
2000
2005
  // let isAllowedToLoad = !isAllowedUrlInText(this.globals.windowContext.location.origin, this.globals.hideOnSpecificDomainList)
2001
- return !shouldHide
2006
+ return shouldShow
2002
2007
  }
2003
2008
 
2004
2009
  }
@@ -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