New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@paypal/sdk-client

Package Overview
Dependencies
Maintainers
31
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paypal/sdk-client - npm Package Compare versions

Comparing version

to
4.0.155

2

package.json
{
"name": "@paypal/sdk-client",
"version": "4.0.154",
"version": "4.0.155",
"description": "Shared config between PayPal/Braintree.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,3 +8,5 @@ "use strict";

PAYPAL: '.paypal.com',
PAYPAL_CHINA: '.paypal.cn',
PAYPALOBJECTS: 'www.paypalobjects.com',
PAYPALOBJECTS_CHINA: 'objects.paypal.cn',
PAYPALOBJECTS_QA: '.paypalinc.com',

@@ -11,0 +13,0 @@ LOCALTUNNEL: 'loca.lt',

@@ -65,7 +65,10 @@ "use strict";

function isLegacySDKUrl(hostname, pathname) {
if (hostname === _constants.HOST.PAYPALOBJECTS) {
const legacyHostnames = [_constants.HOST.PAYPALOBJECTS, _constants.HOST.PAYPALOBJECTS_CHINA];
if (legacyHostnames.includes(hostname)) {
return true;
}
const isValidHostname = hostname.endsWith(_constants.HOST.PAYPAL) || hostname.endsWith(_constants.HOST.PAYPALOBJECTS_QA);
const validHostnameEndings = [_constants.HOST.PAYPAL, _constants.HOST.PAYPAL_CHINA, _constants.HOST.PAYPALOBJECTS_QA];
const isValidHostname = validHostnameEndings.some(validHostname => hostname.endsWith(validHostname));

@@ -80,3 +83,3 @@ if (isValidHostname && pathname.match(_constants.LEGACY_SDK_PATH)) {

function isSDKUrl(hostname) {
if (hostname.endsWith(_constants.HOST.PAYPAL)) {
if (hostname.endsWith(_constants.HOST.PAYPAL) || hostname.endsWith(_constants.HOST.PAYPAL_CHINA)) {
return true;

@@ -83,0 +86,0 @@ }

@@ -58,8 +58,19 @@ /* @flow */

function isLegacySDKUrl(hostname : string, pathname : string) : boolean {
if (hostname === HOST.PAYPALOBJECTS) {
const legacyHostnames = [
HOST.PAYPALOBJECTS,
HOST.PAYPALOBJECTS_CHINA
];
if (legacyHostnames.includes(hostname)) {
return true;
}
const isValidHostname = hostname.endsWith(HOST.PAYPAL) || hostname.endsWith(HOST.PAYPALOBJECTS_QA);
const validHostnameEndings = [
HOST.PAYPAL,
HOST.PAYPAL_CHINA,
HOST.PAYPALOBJECTS_QA
];
const isValidHostname = validHostnameEndings.some(validHostname => hostname.endsWith(validHostname));
if (isValidHostname && pathname.match(LEGACY_SDK_PATH)) {

@@ -73,3 +84,3 @@ return true;

function isSDKUrl(hostname : string) : boolean {
if (hostname.endsWith(HOST.PAYPAL)) {
if (hostname.endsWith(HOST.PAYPAL) || hostname.endsWith(HOST.PAYPAL_CHINA)) {
return true;

@@ -83,3 +94,3 @@ }

const localUrls = [ HOST.LOCALHOST_8000, HOST.LOCALHOST_8443, HOST.LOCALTUNNEL ];
// eslint-disable-next-line no-process-env

@@ -110,3 +121,3 @@ return process.env.NODE_ENV === 'development' && localUrls.some(url => host.includes(url));

}
if (sdkUrl.match(/&{2,}/) || sdkUrl.match(/&$/)) {

@@ -152,3 +163,3 @@ throw new Error(`Expected sdk url to not contain double ampersand or end in ampersand`);

}
if (!pathname) {

@@ -264,3 +275,3 @@ throw new Error(`Expected pathname for sdk url`);

};
return {

@@ -267,0 +278,0 @@ getSDKLoader