perimeterx-js-core 0.21.3 → 0.21.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.
@@ -17,9 +17,12 @@ var renderHtml = function (htmlTemplate, blockData) {
17
17
  exports.renderHtml = renderHtml;
18
18
  var createBlockData = function (config, context, base64Utils) {
19
19
  var captchaScriptSuffix = '/captcha.js';
20
- var b64EncodedUrl = base64Utils.base64Encode(context.requestData.rawUrl);
20
+ var b64EncodedUrl = config.enableBlockedUrlOnCaptchaBlockPage
21
+ ? base64Utils.base64Encode(context.requestData.rawUrl)
22
+ : '';
23
+ var bParam = b64EncodedUrl && "&b=".concat(b64EncodedUrl);
21
24
  var b64HttpMethod = base64Utils.base64Encode(context.requestData.method);
22
- var captchaParams = "?a=".concat(context.blockAction, "&u=").concat(context.uuid, "&v=").concat(context.vid || '', "&m=").concat(context.isMobile ? '1' : '0', "&b=").concat(b64EncodedUrl, "&h=").concat(b64HttpMethod);
25
+ var captchaParams = "?a=".concat(context.blockAction, "&u=").concat(context.uuid, "&v=").concat(context.vid || '', "&m=").concat(context.isMobile ? '1' : '0').concat(bParam, "&h=").concat(b64HttpMethod);
23
26
  var jsClientSrc = "".concat(config.backendClientUrl, "/").concat(config.appId, "/main.min.js");
24
27
  var blockScript = "".concat(config.backendCaptchaUrl, "/").concat(config.appId).concat(captchaScriptSuffix).concat(captchaParams);
25
28
  var hostUrl = config.backendCollectorUrl;
@@ -695,6 +695,13 @@ var ConfigurationBase = /** @class */ (function () {
695
695
  enumerable: false,
696
696
  configurable: true
697
697
  });
698
+ Object.defineProperty(ConfigurationBase.prototype, "enableBlockedUrlOnCaptchaBlockPage", {
699
+ get: function () {
700
+ return true;
701
+ },
702
+ enumerable: false,
703
+ configurable: true
704
+ });
698
705
  return ConfigurationBase;
699
706
  }());
700
707
  exports.ConfigurationBase = ConfigurationBase;
@@ -14,4 +14,4 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
14
14
  exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
15
15
  exports.URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
16
16
  exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
17
- exports.CORE_MODULE_VERSION = 'JS Core 0.21.3';
17
+ exports.CORE_MODULE_VERSION = 'JS Core 0.21.4';
@@ -12,9 +12,12 @@ export const renderHtml = (htmlTemplate, blockData) => {
12
12
  };
13
13
  export const createBlockData = (config, context, base64Utils) => {
14
14
  const captchaScriptSuffix = '/captcha.js';
15
- const b64EncodedUrl = base64Utils.base64Encode(context.requestData.rawUrl);
15
+ const b64EncodedUrl = config.enableBlockedUrlOnCaptchaBlockPage
16
+ ? base64Utils.base64Encode(context.requestData.rawUrl)
17
+ : '';
18
+ const bParam = b64EncodedUrl && `&b=${b64EncodedUrl}`;
16
19
  const b64HttpMethod = base64Utils.base64Encode(context.requestData.method);
17
- const captchaParams = `?a=${context.blockAction}&u=${context.uuid}&v=${context.vid || ''}&m=${context.isMobile ? '1' : '0'}&b=${b64EncodedUrl}&h=${b64HttpMethod}`;
20
+ const captchaParams = `?a=${context.blockAction}&u=${context.uuid}&v=${context.vid || ''}&m=${context.isMobile ? '1' : '0'}${bParam}&h=${b64HttpMethod}`;
18
21
  let jsClientSrc = `${config.backendClientUrl}/${config.appId}/main.min.js`;
19
22
  let blockScript = `${config.backendCaptchaUrl}/${config.appId}${captchaScriptSuffix}${captchaParams}`;
20
23
  let hostUrl = config.backendCollectorUrl;
@@ -342,4 +342,7 @@ export class ConfigurationBase {
342
342
  get securedPxhdEnabled() {
343
343
  return this.activeConfigParams.px_secured_pxhd_enabled;
344
344
  }
345
+ get enableBlockedUrlOnCaptchaBlockPage() {
346
+ return true;
347
+ }
345
348
  }
@@ -11,4 +11,4 @@ export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
11
11
  export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
12
12
  export const URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
13
13
  export const REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
14
- export const CORE_MODULE_VERSION = 'JS Core 0.21.3';
14
+ export const CORE_MODULE_VERSION = 'JS Core 0.21.4';
@@ -112,4 +112,5 @@ export declare abstract class ConfigurationBase<Req, Res, ParamsType extends Con
112
112
  get remoteConfigMaxFetchAttempts(): number;
113
113
  get urlDecodeReservedCharacters(): boolean;
114
114
  get securedPxhdEnabled(): boolean;
115
+ get enableBlockedUrlOnCaptchaBlockPage(): boolean;
115
116
  }
@@ -369,6 +369,10 @@ export interface IConfiguration<Req, Res, ParamsType extends ConfigurationParams
369
369
  * Whether to add the Secure attribute when setting the PXHD cookie.
370
370
  */
371
371
  readonly securedPxhdEnabled: boolean;
372
+ /**
373
+ * Whether to include the request url in captcha block page
374
+ */
375
+ readonly enableBlockedUrlOnCaptchaBlockPage: boolean;
372
376
  /**
373
377
  * Returns an object representation of the current configuration.
374
378
  */
@@ -11,4 +11,4 @@ export declare const PUSH_DATA_FEATURE_HEADER_NAME = "x-px-feature";
11
11
  export declare const EMAIL_ADDRESS_REGEX: RegExp;
12
12
  export declare const URL_REGEX: RegExp;
13
13
  export declare const REGEX_STRUCTURE: RegExp;
14
- export declare const CORE_MODULE_VERSION = "JS Core 0.21.3";
14
+ export declare const CORE_MODULE_VERSION = "JS Core 0.21.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perimeterx-js-core",
3
- "version": "0.21.3",
3
+ "version": "0.21.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "typesVersions": {