perimeterx-js-core 0.4.3 → 0.4.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.
@@ -177,6 +177,7 @@ var DefaultFirstParty = /** @class */ (function () {
177
177
  });
178
178
  };
179
179
  DefaultFirstParty.prototype.prepareFirstPartyHeaders = function (url, requestData, vid) {
180
+ var _a;
180
181
  var headers = __assign({}, requestData.headers);
181
182
  try {
182
183
  headers = (0, utils_1.removeSensitiveHeaders)(headers, this.config.sensitiveHeaders);
@@ -184,7 +185,10 @@ var DefaultFirstParty = /** @class */ (function () {
184
185
  this.setXffHeader(headers, requestData.ip);
185
186
  this.addFirstPartyHeaders(headers, requestData.ip);
186
187
  if (vid) {
187
- headers[http_1.COOKIE_HEADER_NAME] = (headers[http_1.COOKIE_HEADER_NAME] || []).concat(["pxvid=".concat(vid)]);
188
+ var vidCookieString = "pxvid=".concat(vid);
189
+ var existingCookies = (_a = headers[http_1.COOKIE_HEADER_NAME]) === null || _a === void 0 ? void 0 : _a.join('; ');
190
+ var newCookies = existingCookies ? "".concat(existingCookies, "; ").concat(vidCookieString) : vidCookieString;
191
+ headers[http_1.COOKIE_HEADER_NAME] = [newCookies];
188
192
  }
189
193
  }
190
194
  catch (e) {
@@ -1,5 +1,6 @@
1
1
  import { IConfiguration } from '../config';
2
2
  export declare const getDefaultFirstPartyPrefix: (appId: string) => string;
3
+ export declare const getFirstPartyPaths: (config: IConfiguration, callback?: (prefix: string) => string) => string[];
3
4
  export declare const getFirstPartySensorScriptPaths: (config: IConfiguration) => string[];
4
5
  export declare const getFirstPartyCaptchaScriptPathPrefixes: (config: IConfiguration) => string[];
5
6
  export declare const getFirstPartyXhrPathPrefixes: (config: IConfiguration) => string[];
@@ -1,22 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFirstPartyXhrPathPrefix = exports.getFirstPartyCaptchaScriptPathPrefix = exports.getFirstPartySensorScriptPath = exports.getFirstPartyXhrPathPrefixes = exports.getFirstPartyCaptchaScriptPathPrefixes = exports.getFirstPartySensorScriptPaths = exports.getDefaultFirstPartyPrefix = void 0;
3
+ exports.getFirstPartyXhrPathPrefix = exports.getFirstPartyCaptchaScriptPathPrefix = exports.getFirstPartySensorScriptPath = exports.getFirstPartyXhrPathPrefixes = exports.getFirstPartyCaptchaScriptPathPrefixes = exports.getFirstPartySensorScriptPaths = exports.getFirstPartyPaths = exports.getDefaultFirstPartyPrefix = void 0;
4
4
  var getDefaultFirstPartyPrefix = function (appId) { return appId.substring(2); };
5
5
  exports.getDefaultFirstPartyPrefix = getDefaultFirstPartyPrefix;
6
6
  var getFirstPartyPaths = function (config, callback) {
7
7
  var allPrefixes = [config.firstPartyPrefix, (0, exports.getDefaultFirstPartyPrefix)(config.appId)];
8
- return Array.from(new Set(allPrefixes)).map(callback);
8
+ var prefixes = Array.from(new Set(allPrefixes));
9
+ return callback ? prefixes.map(callback) : prefixes;
9
10
  };
11
+ exports.getFirstPartyPaths = getFirstPartyPaths;
10
12
  var getFirstPartySensorScriptPaths = function (config) {
11
- return getFirstPartyPaths(config, exports.getFirstPartySensorScriptPath);
13
+ return (0, exports.getFirstPartyPaths)(config, exports.getFirstPartySensorScriptPath);
12
14
  };
13
15
  exports.getFirstPartySensorScriptPaths = getFirstPartySensorScriptPaths;
14
16
  var getFirstPartyCaptchaScriptPathPrefixes = function (config) {
15
- return getFirstPartyPaths(config, exports.getFirstPartyCaptchaScriptPathPrefix);
17
+ return (0, exports.getFirstPartyPaths)(config, exports.getFirstPartyCaptchaScriptPathPrefix);
16
18
  };
17
19
  exports.getFirstPartyCaptchaScriptPathPrefixes = getFirstPartyCaptchaScriptPathPrefixes;
18
20
  var getFirstPartyXhrPathPrefixes = function (config) {
19
- return getFirstPartyPaths(config, exports.getFirstPartyXhrPathPrefix);
21
+ return (0, exports.getFirstPartyPaths)(config, exports.getFirstPartyXhrPathPrefix);
20
22
  };
21
23
  exports.getFirstPartyXhrPathPrefixes = getFirstPartyXhrPathPrefixes;
22
24
  var getFirstPartySensorScriptPath = function (prefix) { return "/".concat(prefix, "/init.js"); };
@@ -7,4 +7,4 @@ export declare const BYPASS_MONITOR_HEADER_VALUE = "1";
7
7
  export declare const X_PX_AUTHORIZATION_HEADER_NAME = "x-px-authorization";
8
8
  export declare const X_PX_ORIGINAL_TOKEN_HEADER_NAME = "x-px-original-token";
9
9
  export declare const X_PX_BYPASS_REASON_HEADER_NAME = "x-px-bypass-reason";
10
- export declare const CORE_MODULE_VERSION = "JS Core 0.4.3";
10
+ export declare const CORE_MODULE_VERSION = "JS Core 0.4.4";
@@ -10,4 +10,4 @@ exports.BYPASS_MONITOR_HEADER_VALUE = '1';
10
10
  exports.X_PX_AUTHORIZATION_HEADER_NAME = 'x-px-authorization';
11
11
  exports.X_PX_ORIGINAL_TOKEN_HEADER_NAME = 'x-px-original-token';
12
12
  exports.X_PX_BYPASS_REASON_HEADER_NAME = 'x-px-bypass-reason';
13
- exports.CORE_MODULE_VERSION = 'JS Core 0.4.3';
13
+ exports.CORE_MODULE_VERSION = 'JS Core 0.4.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perimeterx-js-core",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",