perimeterx-js-core 0.37.0 → 0.37.2

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.
@@ -54,6 +54,7 @@ var createBlockData = function (config, context, base64Utils) {
54
54
  uuid: context.uuid || '',
55
55
  isMobile: context.isMobile,
56
56
  customLogo: config.customLogo || '',
57
+ customBlockOnErrorMessage: config.customBlockOnErrorMessage || '',
57
58
  blockAction: context.blockAction,
58
59
  hostUrl: hostUrl,
59
60
  cssRef: cssRef,
@@ -200,6 +200,13 @@ var ConfigurationBase = /** @class */ (function () {
200
200
  enumerable: false,
201
201
  configurable: true
202
202
  });
203
+ Object.defineProperty(ConfigurationBase.prototype, "customBlockOnErrorMessage", {
204
+ get: function () {
205
+ return this.configParams.px_custom_block_on_error_message;
206
+ },
207
+ enumerable: false,
208
+ configurable: true
209
+ });
203
210
  Object.defineProperty(ConfigurationBase.prototype, "enforcedRoutes", {
204
211
  get: function () {
205
212
  return this.configParams.px_enforced_routes;
@@ -111,6 +111,7 @@ var defaultConfigurationParams = function () { return ({
111
111
  px_js_ref: '',
112
112
  px_custom_cookie_header: 'x-px-cookies',
113
113
  px_custom_logo: '',
114
+ px_custom_block_on_error_message: '',
114
115
  px_graphql_enabled: true,
115
116
  px_graphql_routes: ['/graphql'],
116
117
  px_graphql_keywords: [],
@@ -75,7 +75,7 @@ var CustomParametersUtils;
75
75
  context.logger.debug('no response available for response custom parameters');
76
76
  return [2 /*return*/, null];
77
77
  }
78
- return [4 /*yield*/, config.enrichResponseCustomParameters(config.getActiveConfig(), context.response.getUnderlyingResponse())];
78
+ return [4 /*yield*/, config.enrichResponseCustomParameters(config.getActiveConfig(), context.response.getUnderlyingResponse(), context.requestData.request.getUnderlyingRequest())];
79
79
  case 2:
80
80
  parameters = _a.sent();
81
81
  return [2 /*return*/, CustomParametersUtils.normalizeResponseCustomParams(parameters)];
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CAPTCHA_TEMPLATE = void 0;
4
- exports.CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.</div></div><div class=\"px-captcha-error-refid\">Reference ID ' + window._pxUuid + '</div>';\n document.body.appendChild(div);\n if (window._pxMobile) {\n setTimeout(function() {\n location.href = '/px/captcha_close?status=-1';\n }, 5000);\n }\n };\n </script>\n {{jsRef}}\n</body>\n</html>\n";
4
+ exports.CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxCustomOnErrorMessage = '{{customBlockOnErrorMessage}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">' + (window._pxCustomOnErrorMessage || ('Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.')) + '</div></div><div class=\"px-captcha-error-refid\">Reference ID ' + window._pxUuid + '</div>';\n document.body.appendChild(div);\n if (window._pxMobile) {\n setTimeout(function() {\n location.href = '/px/captcha_close?status=-1';\n }, 5000);\n }\n };\n </script>\n {{jsRef}}\n</body>\n</html>\n";
@@ -15,4 +15,4 @@ exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
15
15
  exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
16
16
  exports.URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
17
17
  exports.REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
18
- exports.CORE_MODULE_VERSION = 'JS Core 0.37.0';
18
+ exports.CORE_MODULE_VERSION = 'JS Core 0.37.2';
@@ -49,6 +49,7 @@ export const createBlockData = (config, context, base64Utils) => {
49
49
  uuid: context.uuid || '',
50
50
  isMobile: context.isMobile,
51
51
  customLogo: config.customLogo || '',
52
+ customBlockOnErrorMessage: config.customBlockOnErrorMessage || '',
52
53
  blockAction: context.blockAction,
53
54
  hostUrl,
54
55
  cssRef,
@@ -158,6 +158,9 @@ export class ConfigurationBase {
158
158
  get customLogo() {
159
159
  return this.configParams.px_custom_logo;
160
160
  }
161
+ get customBlockOnErrorMessage() {
162
+ return this.configParams.px_custom_block_on_error_message;
163
+ }
161
164
  get enforcedRoutes() {
162
165
  return this.configParams.px_enforced_routes;
163
166
  }
@@ -108,6 +108,7 @@ export const defaultConfigurationParams = () => ({
108
108
  px_js_ref: '',
109
109
  px_custom_cookie_header: 'x-px-cookies',
110
110
  px_custom_logo: '',
111
+ px_custom_block_on_error_message: '',
111
112
  px_graphql_enabled: true,
112
113
  px_graphql_routes: ['/graphql'],
113
114
  px_graphql_keywords: [],
@@ -20,7 +20,7 @@ export var CustomParametersUtils;
20
20
  context.logger.debug('no response available for response custom parameters');
21
21
  return null;
22
22
  }
23
- const parameters = await config.enrichResponseCustomParameters(config.getActiveConfig(), context.response.getUnderlyingResponse());
23
+ const parameters = await config.enrichResponseCustomParameters(config.getActiveConfig(), context.response.getUnderlyingResponse(), context.requestData.request.getUnderlyingRequest());
24
24
  return CustomParametersUtils.normalizeResponseCustomParams(parameters);
25
25
  }
26
26
  catch (e) {
@@ -15,6 +15,7 @@ export const CAPTCHA_TEMPLATE = `<!DOCTYPE html>
15
15
  window._pxAppId = '{{appId}}';
16
16
  window._pxHostUrl = '{{hostUrl}}';
17
17
  window._pxCustomLogo = '{{customLogo}}';
18
+ window._pxCustomOnErrorMessage = '{{customBlockOnErrorMessage}}';
18
19
  window._pxJsClientSrc = '{{jsClientSrc}}';
19
20
  window._pxMobile = {{isMobile}};
20
21
  window._pxFirstPartyEnabled = {{firstPartyEnabled}};
@@ -62,7 +63,7 @@ export const CAPTCHA_TEMPLATE = `<!DOCTYPE html>
62
63
  document.head.appendChild(style);
63
64
  var div = document.createElement('div');
64
65
  div.className = 'px-captcha-error-container';
65
- div.innerHTML = '<div class="px-captcha-error-header">Before we continue...</div><div class="px-captcha-error-message">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class="px-captcha-error-button">Press & Hold</div><div class="px-captcha-error-wrapper"><div class="px-captcha-error"><img class="px-captcha-error" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC">Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.</div></div><div class="px-captcha-error-refid">Reference ID ' + window._pxUuid + '</div>';
66
+ div.innerHTML = '<div class="px-captcha-error-header">Before we continue...</div><div class="px-captcha-error-message">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class="px-captcha-error-button">Press & Hold</div><div class="px-captcha-error-wrapper"><div class="px-captcha-error"><img class="px-captcha-error" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC">' + (window._pxCustomOnErrorMessage || ('Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.')) + '</div></div><div class="px-captcha-error-refid">Reference ID ' + window._pxUuid + '</div>';
66
67
  document.body.appendChild(div);
67
68
  if (window._pxMobile) {
68
69
  setTimeout(function() {
@@ -12,4 +12,4 @@ export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
12
12
  export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
13
13
  export const URL_REGEX = /^(https?:)\/\/(([^@\s:\/]+):?([^@\s\/]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)(\/?[^?#]*)(\?[^#]*|)(#.*|)$/;
14
14
  export const REGEX_STRUCTURE = /^\/(.+?)\/([gimsuyvd]*)$/;
15
- export const CORE_MODULE_VERSION = 'JS Core 0.37.0';
15
+ export const CORE_MODULE_VERSION = 'JS Core 0.37.2';
@@ -13,6 +13,7 @@ export type BlockData = {
13
13
  vid?: string;
14
14
  uuid?: string;
15
15
  customLogo?: string;
16
+ customBlockOnErrorMessage?: string;
16
17
  jsRef?: string;
17
18
  isMobile?: boolean;
18
19
  blockAction: BlockAction;
@@ -66,6 +66,7 @@ export declare abstract class ConfigurationBase<Req, Res, Supported extends stri
66
66
  get bypassMonitorHeader(): string;
67
67
  get customCookieHeader(): string;
68
68
  get customLogo(): string;
69
+ get customBlockOnErrorMessage(): string;
69
70
  get enforcedRoutes(): Array<string | RegExp>;
70
71
  get customIsEnforcedRequest(): CustomRequestFunction<Req> | null;
71
72
  get filteredExtensions(): string[];
@@ -190,6 +190,11 @@ export interface IConfiguration<Req, Res, Supported extends string, Added> {
190
190
  * A URL to a custom logo that should be added to the block page.
191
191
  */
192
192
  readonly customLogo: string;
193
+ /**
194
+ * A custom error message to display in the block page fallback UI when the captcha script fails to load.
195
+ * When set, overrides the default "Please check your internet connection or disable your ad-blocker" message.
196
+ */
197
+ readonly customBlockOnErrorMessage: string;
193
198
  /**
194
199
  * The maximum expected iterations for PBKDF2. Used for Cookie v3 only.
195
200
  */
@@ -103,6 +103,7 @@ export type CommonConfigurationParams<Req, Res, Supported extends string, Added>
103
103
  px_js_ref?: string;
104
104
  px_custom_cookie_header?: string;
105
105
  px_custom_logo?: string;
106
+ px_custom_block_on_error_message?: string;
106
107
  px_jwt_cookie_name?: string;
107
108
  px_jwt_cookie_user_id_field_name?: string;
108
109
  px_jwt_cookie_additional_field_names?: string[];
@@ -1,4 +1,4 @@
1
1
  import { CustomParameters, ResponseCustomParameters } from './CustomParameters';
2
2
  import { ActiveConfigurationParams } from '../config';
3
3
  export type CustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, request: Req) => CustomParameters | Promise<CustomParameters>;
4
- export type ResponseCustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, response: Res) => ResponseCustomParameters | Promise<ResponseCustomParameters>;
4
+ export type ResponseCustomParametersFunction<Req, Res, Supported extends string, Added> = (config: ActiveConfigurationParams<Req, Res, Supported, Added>, response: Res, request?: Req) => ResponseCustomParameters | Promise<ResponseCustomParameters>;
@@ -1 +1 @@
1
- export declare const CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.</div></div><div class=\"px-captcha-error-refid\">Reference ID ' + window._pxUuid + '</div>';\n document.body.appendChild(div);\n if (window._pxMobile) {\n setTimeout(function() {\n location.href = '/px/captcha_close?status=-1';\n }, 5000);\n }\n };\n </script>\n {{jsRef}}\n</body>\n</html>\n";
1
+ export declare const CAPTCHA_TEMPLATE = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"description\" content=\"px-captcha\">\n <title>Access to this page has been denied</title>\n {{cssRef}}\n</head>\n<body>\n <script>\n /* PerimeterX assignments */\n window._pxVid = '{{vid}}';\n window._pxUuid = '{{uuid}}';\n window._pxAppId = '{{appId}}';\n window._pxHostUrl = '{{hostUrl}}';\n window._pxCustomLogo = '{{customLogo}}';\n window._pxCustomOnErrorMessage = '{{customBlockOnErrorMessage}}';\n window._pxJsClientSrc = '{{jsClientSrc}}';\n window._pxMobile = {{isMobile}};\n window._pxFirstPartyEnabled = {{firstPartyEnabled}};\n\n var pxCaptchaSrc = '{{blockScript}}';\n var script = document.createElement('script');\n script.src = pxCaptchaSrc;\n script.onload = onScriptLoad;\n script.onerror = onScriptError;\n var onScriptErrorCalled;\n document.head.appendChild(script);\n var timeoutID = setTimeout(onScriptError, 5000);\n function onScriptLoad() {\n clearTimeout(timeoutID);\n setTimeout(function() {\n if (!isContentLoaded()) {\n onScriptError();\n }\n }, 2500);\n }\n function onScriptError() {\n if (onScriptErrorCalled) {\n return;\n }\n onScriptErrorCalled = true;\n script = document.createElement('script');\n script.src = '{{altBlockScript}}';\n script.onload = function() {\n clearTimeout(timeoutID);\n };\n script.onerror = window._pxOnError;\n document.head.appendChild(script);\n timeoutID = setTimeout(function() {\n if (!isContentLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isContentLoaded() {\n return !!document.querySelector('div,span');\n }\n window._pxOnError = function () {\n var style = document.createElement('style');\n style.innerText = '@import url(https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap);body{background-color:#fafbfc}.px-captcha-error-container{position:fixed;height:340px;background-color:#fff;font-family:Roboto,sans-serif}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:67px 0 33px;font-weight:500;line-height:.83;text-align:center}.px-captcha-error-message{color:#f0f1f2;font-size:18px;margin:0 0 29px;line-height:1.33;text-align:center}.px-captcha-error-button{text-align:center;line-height:48px;width:253px;margin:auto;border-radius:50px;border:solid 1px #f0f1f2;font-size:20px;color:#f0f1f2}.px-captcha-error-wrapper{margin:18px 0 0}div.px-captcha-error{margin:auto;text-align:center;width:400px;height:30px;font-size:12px;background-color:#fcf0f2;color:#ce0e2d}img.px-captcha-error{margin:6px 8px -2px 0}.px-captcha-error-refid{border-top:solid 1px #f0eeee;height:27px;margin:13px 0 0;border-radius:0 0 3px 3px;background-color:#fafbfc;font-size:10px;line-height:2.5;text-align:center;color:#b1b5b8}@media (min-width:620px){.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (min-width:481px) and (max-width:620px){.px-captcha-error-container{width:85%;top:50%;left:50%;margin-top:-170px;margin-left:-42.5%;border-radius:3px;box-shadow:0 2px 9px -1px rgba(0,0,0,.13)}}@media (max-width:480px){body{background-color:#fff}.px-captcha-error-header{color:#f0f1f2;font-size:29px;margin:55px 0 33px}.px-captcha-error-container{width:530px;top:50%;left:50%;margin-top:-170px;margin-left:-265px}.px-captcha-error-refid{position:fixed;width:100%;left:0;bottom:0;border-radius:0;font-size:14px;line-height:2}}@media (max-width:390px){div.px-captcha-error{font-size:10px}.px-captcha-error-refid{font-size:11px;line-height:2.5}}';\n document.head.appendChild(style);\n var div = document.createElement('div');\n div.className = 'px-captcha-error-container';\n div.innerHTML = '<div class=\"px-captcha-error-header\">Before we continue...</div><div class=\"px-captcha-error-message\">Press & Hold to confirm you are<br>a human (and not a bot).</div><div class=\"px-captcha-error-button\">Press & Hold</div><div class=\"px-captcha-error-wrapper\"><div class=\"px-captcha-error\"><img class=\"px-captcha-error\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAMAAADDGrRQAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTNYELOEGONQILd0AONwALtwEL+AAL9MFLfkJSNQGLdMJLdQJLdQGLdQKLtYFLNcELdUGLdcBL9gFL88OLdUFLNEOLglBhT4AAAAXdFJOUwC8CqgNIRgRoAS1dWWuR4RTjzgryZpYblfkcAAAAI9JREFUGNNdj+sWhCAIhAdvqGVa1r7/oy6RZ7eaH3D4ZACBIed9wlOOMtUnSrEmZ6cHa9YAIfsbCkWrdpi/c50Bk2CO9mNLdMAu03wJA3HpEnfpxbyOg6ruyx8JJi6KNstnslp1dbPd9GnqmuYq7mmcv1zjnbQw8cV0xzkqo+fX1zkjUOO7wnrInUTxJiruC3vtBNRoQQn2AAAAAElFTkSuQmCC\">' + (window._pxCustomOnErrorMessage || ('Please check your internet connection' + (window._pxMobile ? '' : ' or disable your ad-blocker') + '.')) + '</div></div><div class=\"px-captcha-error-refid\">Reference ID ' + window._pxUuid + '</div>';\n document.body.appendChild(div);\n if (window._pxMobile) {\n setTimeout(function() {\n location.href = '/px/captcha_close?status=-1';\n }, 5000);\n }\n };\n </script>\n {{jsRef}}\n</body>\n</html>\n";
@@ -12,4 +12,4 @@ export declare const PUSH_DATA_FEATURE_HEADER_NAME = "x-px-feature";
12
12
  export declare const EMAIL_ADDRESS_REGEX: RegExp;
13
13
  export declare const URL_REGEX: RegExp;
14
14
  export declare const REGEX_STRUCTURE: RegExp;
15
- export declare const CORE_MODULE_VERSION = "JS Core 0.37.0";
15
+ export declare const CORE_MODULE_VERSION = "JS Core 0.37.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perimeterx-js-core",
3
- "version": "0.37.0",
3
+ "version": "0.37.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "typesVersions": {