perimeterx-js-core 0.18.0 → 0.18.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.
@@ -19,7 +19,7 @@ exports.renderHtml = renderHtml;
19
19
  var createBlockData = function (config, context, base64Utils) {
20
20
  var _a, _b;
21
21
  var captchaScriptSuffix = '/captcha.js';
22
- var b64EncodedUrl = base64Utils.base64Encode(context.requestData.url.href);
22
+ var b64EncodedUrl = base64Utils.base64Encode(context.requestData.rawUrl);
23
23
  var b64HttpMethod = base64Utils.base64Encode(context.requestData.method);
24
24
  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
25
  var jsClientSrc = "".concat(config.backendClientUrl, "/").concat(config.appId, "/main.min.js");
@@ -1 +1 @@
1
- {type:commonjs}
1
+ {"type":"commonjs"}
@@ -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 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 (isCaptchaNotLoaded()) {\n onScriptError();\n }\n }, 1000);\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 (isCaptchaNotLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isCaptchaNotLoaded() {\n return !document.querySelector('div');\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._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";
@@ -13,4 +13,4 @@ exports.PUSH_DATA_HMAC_HEADER_NAME = 'x-px-pushdata';
13
13
  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
- exports.CORE_MODULE_VERSION = 'JS Core 0.18.0';
16
+ exports.CORE_MODULE_VERSION = 'JS Core 0.18.2';
@@ -13,7 +13,7 @@ export const renderHtml = (htmlTemplate, blockData) => {
13
13
  };
14
14
  export const createBlockData = (config, context, base64Utils) => {
15
15
  const captchaScriptSuffix = '/captcha.js';
16
- const b64EncodedUrl = base64Utils.base64Encode(context.requestData.url.href);
16
+ const b64EncodedUrl = base64Utils.base64Encode(context.requestData.rawUrl);
17
17
  const b64HttpMethod = base64Utils.base64Encode(context.requestData.method);
18
18
  const captchaParams = `?a=${context.blockAction}&u=${context.uuid}&v=${context.vid || ''}&m=${context.isMobile ? '1' : '0'}&b=${b64EncodedUrl}&h=${b64HttpMethod}`;
19
19
  let jsClientSrc = `${config.backendClientUrl}/${config.appId}/main.min.js`;
@@ -8,69 +8,70 @@ export const CAPTCHA_TEMPLATE = `<!DOCTYPE html>
8
8
  {{cssRef}}
9
9
  </head>
10
10
  <body>
11
- <script>
12
- /* PerimeterX assignments */
13
- window._pxVid = '{{vid}}';
14
- window._pxUuid = '{{uuid}}';
15
- window._pxAppId = '{{appId}}';
16
- window._pxHostUrl = '{{hostUrl}}';
17
- window._pxCustomLogo = '{{customLogo}}';
18
- window._pxJsClientSrc = '{{jsClientSrc}}';
19
- window._pxMobile = {{isMobile}};
20
- window._pxFirstPartyEnabled = {{firstPartyEnabled}};
21
- var pxCaptchaSrc = '{{blockScript}}';
22
- var script = document.createElement('script');
23
- script.src = pxCaptchaSrc;
24
- script.onload = onScriptLoad;
25
- script.onerror = onScriptError;
26
- var onScriptErrorCalled;
27
- document.head.appendChild(script);
28
- var timeoutID = setTimeout(onScriptError, 5000);
29
- function onScriptLoad() {
30
- clearTimeout(timeoutID);
31
- setTimeout(function() {
32
- if (isCaptchaNotLoaded()) {
33
- onScriptError();
34
- }
35
- }, 1000);
36
- }
37
- function onScriptError() {
38
- if (onScriptErrorCalled) {
39
- return;
40
- }
41
- onScriptErrorCalled = true;
42
- script = document.createElement('script');
43
- script.src = '{{altBlockScript}}';
44
- script.onload = function() {
45
- clearTimeout(timeoutID);
46
- };
47
- script.onerror = window._pxOnError;
11
+ <script>
12
+ /* PerimeterX assignments */
13
+ window._pxVid = '{{vid}}';
14
+ window._pxUuid = '{{uuid}}';
15
+ window._pxAppId = '{{appId}}';
16
+ window._pxHostUrl = '{{hostUrl}}';
17
+ window._pxCustomLogo = '{{customLogo}}';
18
+ window._pxJsClientSrc = '{{jsClientSrc}}';
19
+ window._pxMobile = {{isMobile}};
20
+ window._pxFirstPartyEnabled = {{firstPartyEnabled}};
21
+
22
+ var pxCaptchaSrc = '{{blockScript}}';
23
+ var script = document.createElement('script');
24
+ script.src = pxCaptchaSrc;
25
+ script.onload = onScriptLoad;
26
+ script.onerror = onScriptError;
27
+ var onScriptErrorCalled;
48
28
  document.head.appendChild(script);
49
- timeoutID = setTimeout(function() {
50
- if (isCaptchaNotLoaded()) {
51
- window._pxOnError();
52
- }
53
- }, 5000);
54
- }
55
- function isCaptchaNotLoaded() {
56
- return !document.querySelector('div');
57
- }
58
- window._pxOnError = function () {
59
- var style = document.createElement('style');
60
- 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}}';
61
- document.head.appendChild(style);
62
- var div = document.createElement('div');
63
- div.className = 'px-captcha-error-container';
64
- 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>';
65
- document.body.appendChild(div);
66
- if (window._pxMobile) {
29
+ var timeoutID = setTimeout(onScriptError, 5000);
30
+ function onScriptLoad() {
31
+ clearTimeout(timeoutID);
67
32
  setTimeout(function() {
68
- location.href = '/px/captcha_close?status=-1';
33
+ if (!isContentLoaded()) {
34
+ onScriptError();
35
+ }
36
+ }, 2500);
37
+ }
38
+ function onScriptError() {
39
+ if (onScriptErrorCalled) {
40
+ return;
41
+ }
42
+ onScriptErrorCalled = true;
43
+ script = document.createElement('script');
44
+ script.src = '{{altBlockScript}}';
45
+ script.onload = function() {
46
+ clearTimeout(timeoutID);
47
+ };
48
+ script.onerror = window._pxOnError;
49
+ document.head.appendChild(script);
50
+ timeoutID = setTimeout(function() {
51
+ if (!isContentLoaded()) {
52
+ window._pxOnError();
53
+ }
69
54
  }, 5000);
70
55
  }
71
- };
72
- </script>
73
- {{jsRef}}
56
+ function isContentLoaded() {
57
+ return !!document.querySelector('div,span');
58
+ }
59
+ window._pxOnError = function () {
60
+ var style = document.createElement('style');
61
+ 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}}';
62
+ document.head.appendChild(style);
63
+ var div = document.createElement('div');
64
+ 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
+ document.body.appendChild(div);
67
+ if (window._pxMobile) {
68
+ setTimeout(function() {
69
+ location.href = '/px/captcha_close?status=-1';
70
+ }, 5000);
71
+ }
72
+ };
73
+ </script>
74
+ {{jsRef}}
74
75
  </body>
75
76
  </html>
76
77
  `;
@@ -10,4 +10,4 @@ export const PUSH_DATA_HMAC_HEADER_NAME = 'x-px-pushdata';
10
10
  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
- export const CORE_MODULE_VERSION = 'JS Core 0.18.0';
13
+ export const CORE_MODULE_VERSION = 'JS Core 0.18.2';
@@ -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 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 (isCaptchaNotLoaded()) {\n onScriptError();\n }\n }, 1000);\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 (isCaptchaNotLoaded()) {\n window._pxOnError();\n }\n }, 5000);\n }\n function isCaptchaNotLoaded() {\n return !document.querySelector('div');\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._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";
@@ -10,4 +10,4 @@ export declare const PUSH_DATA_HMAC_HEADER_NAME = "x-px-pushdata";
10
10
  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
- export declare const CORE_MODULE_VERSION = "JS Core 0.18.0";
13
+ export declare const CORE_MODULE_VERSION = "JS Core 0.18.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perimeterx-js-core",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "typesVersions": {
@@ -31,7 +31,7 @@
31
31
  "scripts": {
32
32
  "prebuild": "npm run clean",
33
33
  "build": "npm run build:cjs && npm run build:esm && npm run build:dec",
34
- "build:cjs": "tsc -p tsconfig.cjs.json && echo \"{\"type\":\"commonjs\"}\" >> ./lib/cjs/package.json",
34
+ "build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' >> ./lib/cjs/package.json",
35
35
  "build:esm": "tsc -p tsconfig.esm.json",
36
36
  "build:dec": "tsc -p tsconfig.dec.json",
37
37
  "clean": "rm -rf lib",