Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@paypal/paypal-js

Package Overview
Dependencies
Maintainers
39
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paypal/paypal-js - npm Package Compare versions

Comparing version 4.2.1 to 4.2.2

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [4.2.2](https://github.com/paypal/paypal-js/compare/v4.2.1...v4.2.2) (2021-12-17)
### Bug Fixes
- **types:** add additional sdk attributes ([48abf67](https://github.com/paypal/paypal-js/commit/48abf672dd7ad6759d46116ee315da8735450e82))
- **types:** remove unused CreateOrderActions type for hostedFields ([#137](https://github.com/paypal/paypal-js/issues/137)) ([63b675c](https://github.com/paypal/paypal-js/commit/63b675c1da2017974f097f5bf2da077dbf6ff49a))
### [4.2.1](https://github.com/paypal/paypal-js/compare/v4.2.0...v4.2.1) (2021-11-24)

@@ -7,0 +14,0 @@

4

dist/cjs/paypal-js.js
/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -273,3 +273,3 @@ *

var version = "4.2.1";
var version = "4.2.2";

@@ -276,0 +276,0 @@ exports.loadCustomScript = loadCustomScript;

/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -17,2 +17,2 @@ *

*/
"use strict";function t(t){var r="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(r=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],r=t["data-merchant-id"],n="",o="";Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"==typeof e&&e.length>0?n=e:"string"==typeof r&&r.length>0&&(n="*",o=r);t["merchant-id"]=n,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,r){var n=t[r].toString();return"data-"===r.substring(0,5)?e.dataAttributes[r]=n:e.queryParams[r]=n,e}),{queryParams:{},dataAttributes:{}}),o=n.queryParams,a=n.dataAttributes;return{url:"".concat(r,"?").concat(e(o)),dataAttributes:a}}function e(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function r(t,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),"data-csp-nonce"===t&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function n(t,e){void 0===e&&(e=o()),i(t,e);var n=t.url,a=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==a&&"object"!=typeof a)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,i=r(e,n);i.onerror=a,i.onload=o,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:a,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(r){return 200===r.status&&e(t),r.text()})).then((function(t){var r=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(r))})).catch((function(t){e(t)})):e(t)}})}))}function o(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function a(t){return window[t]}function i(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}Object.defineProperty(exports,"__esModule",{value:!0});exports.loadCustomScript=n,exports.loadScript=function(e,u){if(void 0===u&&(u=o()),i(e,u),"undefined"==typeof window)return u.resolve(null);var c=t(e),s=c.url,d=c.dataAttributes,l=d["data-namespace"]||"paypal",f=a(l);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),a=n.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(i=!1)})),i?n:null}(s,d)&&f?u.resolve(f):n({url:s,attributes:d},u).then((function(){var t=a(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))}))},exports.version="4.2.1";
"use strict";function t(t){var r="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(r=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],r=t["data-merchant-id"],n="",o="";Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"==typeof e&&e.length>0?n=e:"string"==typeof r&&r.length>0&&(n="*",o=r);t["merchant-id"]=n,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,r){var n=t[r].toString();return"data-"===r.substring(0,5)?e.dataAttributes[r]=n:e.queryParams[r]=n,e}),{queryParams:{},dataAttributes:{}}),o=n.queryParams,a=n.dataAttributes;return{url:"".concat(r,"?").concat(e(o)),dataAttributes:a}}function e(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function r(t,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),"data-csp-nonce"===t&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function n(t,e){void 0===e&&(e=o()),i(t,e);var n=t.url,a=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==a&&"object"!=typeof a)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,i=r(e,n);i.onerror=a,i.onload=o,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:a,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(r){return 200===r.status&&e(t),r.text()})).then((function(t){var r=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(r))})).catch((function(t){e(t)})):e(t)}})}))}function o(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function a(t){return window[t]}function i(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}Object.defineProperty(exports,"__esModule",{value:!0});exports.loadCustomScript=n,exports.loadScript=function(e,u){if(void 0===u&&(u=o()),i(e,u),"undefined"==typeof window)return u.resolve(null);var c=t(e),s=c.url,d=c.dataAttributes,l=d["data-namespace"]||"paypal",f=a(l);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),a=n.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(i=!1)})),i?n:null}(s,d)&&f?u.resolve(f):n({url:s,attributes:d},u).then((function(){var t=a(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))}))},exports.version="4.2.2";
/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -269,4 +269,4 @@ *

var version = "4.2.1";
var version = "4.2.2";
export { loadCustomScript, loadScript, version };
/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -17,2 +17,2 @@ *

*/
function t(t){var r="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(r=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],r=t["data-merchant-id"],n="",o="";Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"==typeof e&&e.length>0?n=e:"string"==typeof r&&r.length>0&&(n="*",o=r);t["merchant-id"]=n,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,r){var n=t[r].toString();return"data-"===r.substring(0,5)?e.dataAttributes[r]=n:e.queryParams[r]=n,e}),{queryParams:{},dataAttributes:{}}),o=n.queryParams,a=n.dataAttributes;return{url:"".concat(r,"?").concat(e(o)),dataAttributes:a}}function e(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function r(t,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),"data-csp-nonce"===t&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function n(e,n){if(void 0===n&&(n=a()),u(e,n),"undefined"==typeof window)return n.resolve(null);var c=t(e),s=c.url,d=c.dataAttributes,f=d["data-namespace"]||"paypal",l=i(f);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),a=n.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(i=!1)})),i?n:null}(s,d)&&l?n.resolve(l):o({url:s,attributes:d},n).then((function(){var t=i(f);if(t)return t;throw new Error("The window.".concat(f," global variable is not available."))}))}function o(t,e){void 0===e&&(e=a()),u(t,e);var n=t.url,o=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,i=r(e,n);i.onerror=a,i.onload=o,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(r){return 200===r.status&&e(t),r.text()})).then((function(t){var r=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(r))})).catch((function(t){e(t)})):e(t)}})}))}function a(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function i(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}var c="4.2.1";export{o as loadCustomScript,n as loadScript,c as version};
function t(t){var r="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(r=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],r=t["data-merchant-id"],n="",o="";Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"==typeof e&&e.length>0?n=e:"string"==typeof r&&r.length>0&&(n="*",o=r);t["merchant-id"]=n,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,r){var n=t[r].toString();return"data-"===r.substring(0,5)?e.dataAttributes[r]=n:e.queryParams[r]=n,e}),{queryParams:{},dataAttributes:{}}),o=n.queryParams,a=n.dataAttributes;return{url:"".concat(r,"?").concat(e(o)),dataAttributes:a}}function e(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function r(t,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),"data-csp-nonce"===t&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function n(e,n){if(void 0===n&&(n=a()),u(e,n),"undefined"==typeof window)return n.resolve(null);var c=t(e),s=c.url,d=c.dataAttributes,f=d["data-namespace"]||"paypal",l=i(f);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),a=n.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(i=!1)})),i?n:null}(s,d)&&l?n.resolve(l):o({url:s,attributes:d},n).then((function(){var t=i(f);if(t)return t;throw new Error("The window.".concat(f," global variable is not available."))}))}function o(t,e){void 0===e&&(e=a()),u(t,e);var n=t.url,o=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,i=r(e,n);i.onerror=a,i.onload=o,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(r){return 200===r.status&&e(t),r.text()})).then((function(t){var r=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(r))})).catch((function(t){e(t)})):e(t)}})}))}function a(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function i(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}var c="4.2.2";export{o as loadCustomScript,n as loadScript,c as version};
/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -272,3 +272,3 @@ *

var version = "4.2.1";
var version = "4.2.2";

@@ -275,0 +275,0 @@ exports.loadCustomScript = loadCustomScript;

/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -571,3 +571,3 @@ *

// replaced with the package.json version at build time
var version = "4.2.1";
var version = "4.2.2";

@@ -574,0 +574,0 @@ exports.loadCustomScript = loadCustomScript;

/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -17,2 +17,2 @@ *

*/
var paypalLoadScript=function(t){"use strict";var e=setTimeout,n="undefined"!=typeof setImmediate?setImmediate:null;function r(t){return Boolean(t&&void 0!==t.length)}function o(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void c(e.promise,t)}u(e.promise,r)}else(1===t._state?u:c)(e.promise,t._value)}))):t._deferreds.push(e)}function u(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void f(t);if("function"==typeof n)return void l((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,f(t)}catch(e){c(t,e)}var r,o}function c(t,e){t._state=2,t._value=e,f(t)}function f(t){2===t._state&&0===t._deferreds.length&&i._immediateFn((function(){t._handled||i._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function s(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function l(t,e){var n=!1;try{t((function(t){n||(n=!0,u(e,t))}),(function(t){n||(n=!0,c(e,t))}))}catch(t){if(n)return;n=!0,c(e,t)}}function d(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],n=t["data-merchant-id"],r="",o="";Array.isArray(e)?e.length>1?(r="*",o=e.toString()):r=e.toString():"string"==typeof e&&e.length>0?r=e:"string"==typeof n&&n.length>0&&(r="*",o=n);t["merchant-id"]=r,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,n){var r=t[n].toString();return"data-"===n.substring(0,5)?e.dataAttributes[n]=r:e.queryParams[n]=r,e}),{queryParams:{},dataAttributes:{}}),r=n.queryParams,o=n.dataAttributes;return{url:"".concat(e,"?").concat(p(r)),dataAttributes:o}}function p(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function h(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function v(t,e){if(void 0===e&&(e=w()),b(t,e),"undefined"==typeof window)return e.resolve(null);var n=d(t),r=n.url,o=n.dataAttributes,i=o["data-namespace"]||"paypal",a=m(i);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var r=h(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(r.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==r.dataset[t]&&(i=!1)})),i?n:null}(r,o)&&a?e.resolve(a):y({url:r,attributes:o},e).then((function(){var t=m(i);if(t)return t;throw new Error("The window.".concat(i," global variable is not available."))}))}function y(t,e){void 0===e&&(e=w()),b(t,e);var n=t.url,r=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==r&&"object"!=typeof r)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,r=t.onSuccess,o=t.onError,i=h(e,n);i.onerror=o,i.onload=r,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(n){return 200===n.status&&e(t),n.text()})).then((function(t){var n=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(n))})).catch((function(t){e(t)})):e(t)}})}))}function w(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function m(t){return window[t]}function b(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var n=new this.constructor(o);return a(this,new s(t,e,n)),n},i.prototype.finally=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))},i.all=function(t){return new i((function(e,n){if(!r(t))return n(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return e([]);var i=o.length;function a(t,r){try{if(r&&("object"==typeof r||"function"==typeof r)){var u=r.then;if("function"==typeof u)return void u.call(r,(function(e){a(t,e)}),n)}o[t]=r,0==--i&&e(o)}catch(t){n(t)}}for(var u=0;u<o.length;u++)a(u,o[u])}))},i.allSettled=function(t){return new this((function(e,n){if(!t||void 0===t.length)return n(new TypeError(typeof t+" "+t+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var o=r.length;function i(t,n){if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,(function(e){i(t,e)}),(function(n){r[t]={status:"rejected",reason:n},0==--o&&e(r)}))}r[t]={status:"fulfilled",value:n},0==--o&&e(r)}for(var a=0;a<r.length;a++)i(a,r[a])}))},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i((function(e){e(t)}))},i.reject=function(t){return new i((function(e,n){n(t)}))},i.race=function(t){return new i((function(e,n){if(!r(t))return n(new TypeError("Promise.race accepts an array"));for(var o=0,a=t.length;o<a;o++)i.resolve(t[o]).then(e,n)}))},i._immediateFn="function"==typeof n&&function(t){n(t)}||function(t){e(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};return t.loadCustomScript=function(t){return y(t,i)},t.loadScript=function(t){return v(t,i)},t.version="4.2.1",Object.defineProperty(t,"__esModule",{value:!0}),t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
var paypalLoadScript=function(t){"use strict";var e=setTimeout,n="undefined"!=typeof setImmediate?setImmediate:null;function r(t){return Boolean(t&&void 0!==t.length)}function o(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void c(e.promise,t)}u(e.promise,r)}else(1===t._state?u:c)(e.promise,t._value)}))):t._deferreds.push(e)}function u(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void f(t);if("function"==typeof n)return void l((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,f(t)}catch(e){c(t,e)}var r,o}function c(t,e){t._state=2,t._value=e,f(t)}function f(t){2===t._state&&0===t._deferreds.length&&i._immediateFn((function(){t._handled||i._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function s(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function l(t,e){var n=!1;try{t((function(t){n||(n=!0,u(e,t))}),(function(t){n||(n=!0,c(e,t))}))}catch(t){if(n)return;n=!0,c(e,t)}}function d(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],n=t["data-merchant-id"],r="",o="";Array.isArray(e)?e.length>1?(r="*",o=e.toString()):r=e.toString():"string"==typeof e&&e.length>0?r=e:"string"==typeof n&&n.length>0&&(r="*",o=n);t["merchant-id"]=r,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,n){var r=t[n].toString();return"data-"===n.substring(0,5)?e.dataAttributes[n]=r:e.queryParams[n]=r,e}),{queryParams:{},dataAttributes:{}}),r=n.queryParams,o=n.dataAttributes;return{url:"".concat(e,"?").concat(p(r)),dataAttributes:o}}function p(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function h(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function v(t,e){if(void 0===e&&(e=w()),b(t,e),"undefined"==typeof window)return e.resolve(null);var n=d(t),r=n.url,o=n.dataAttributes,i=o["data-namespace"]||"paypal",a=m(i);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var r=h(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(r.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==r.dataset[t]&&(i=!1)})),i?n:null}(r,o)&&a?e.resolve(a):y({url:r,attributes:o},e).then((function(){var t=m(i);if(t)return t;throw new Error("The window.".concat(i," global variable is not available."))}))}function y(t,e){void 0===e&&(e=w()),b(t,e);var n=t.url,r=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==r&&"object"!=typeof r)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,r=t.onSuccess,o=t.onError,i=h(e,n);i.onerror=o,i.onload=r,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(n){return 200===n.status&&e(t),n.text()})).then((function(t){var n=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(n))})).catch((function(t){e(t)})):e(t)}})}))}function w(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function m(t){return window[t]}function b(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var n=new this.constructor(o);return a(this,new s(t,e,n)),n},i.prototype.finally=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))},i.all=function(t){return new i((function(e,n){if(!r(t))return n(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return e([]);var i=o.length;function a(t,r){try{if(r&&("object"==typeof r||"function"==typeof r)){var u=r.then;if("function"==typeof u)return void u.call(r,(function(e){a(t,e)}),n)}o[t]=r,0==--i&&e(o)}catch(t){n(t)}}for(var u=0;u<o.length;u++)a(u,o[u])}))},i.allSettled=function(t){return new this((function(e,n){if(!t||void 0===t.length)return n(new TypeError(typeof t+" "+t+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var o=r.length;function i(t,n){if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,(function(e){i(t,e)}),(function(n){r[t]={status:"rejected",reason:n},0==--o&&e(r)}))}r[t]={status:"fulfilled",value:n},0==--o&&e(r)}for(var a=0;a<r.length;a++)i(a,r[a])}))},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i((function(e){e(t)}))},i.reject=function(t){return new i((function(e,n){n(t)}))},i.race=function(t){return new i((function(e,n){if(!r(t))return n(new TypeError("Promise.race accepts an array"));for(var o=0,a=t.length;o<a;o++)i.resolve(t[o]).then(e,n)}))},i._immediateFn="function"==typeof n&&function(t){n(t)}||function(t){e(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};return t.loadCustomScript=function(t){return y(t,i)},t.loadScript=function(t){return v(t,i)},t.version="4.2.2",Object.defineProperty(t,"__esModule",{value:!0}),t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
/*!
* paypal-js v4.2.1 (2021-11-24T18:08:45.085Z)
* paypal-js v4.2.2 (2021-12-17T22:31:37.036Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -17,2 +17,2 @@ *

*/
var paypalLoadScript=function(t){"use strict";function e(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],r=t["data-merchant-id"],n="",o="";Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"==typeof e&&e.length>0?n=e:"string"==typeof r&&r.length>0&&(n="*",o=r);t["merchant-id"]=n,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,r){var n=t[r].toString();return"data-"===r.substring(0,5)?e.dataAttributes[r]=n:e.queryParams[r]=n,e}),{queryParams:{},dataAttributes:{}}),o=n.queryParams,a=n.dataAttributes;return{url:"".concat(e,"?").concat(r(o)),dataAttributes:a}}function r(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function n(t,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),"data-csp-nonce"===t&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function o(t,e){void 0===e&&(e=a()),u(t,e);var r=t.url,o=t.attributes;if("string"!=typeof r||0===r.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,r=t.attributes,o=t.onSuccess,a=t.onError,i=n(e,r);i.onerror=a,i.onload=o,document.head.insertBefore(i,document.head.firstElementChild)}({url:r,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(r,'" failed to load.'));return window.fetch?fetch(r).then((function(r){return 200===r.status&&e(t),r.text()})).then((function(t){var r=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(r))})).catch((function(t){e(t)})):e(t)}})}))}function a(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function i(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}return t.loadCustomScript=o,t.loadScript=function(t,r){if(void 0===r&&(r=a()),u(t,r),"undefined"==typeof window)return r.resolve(null);var c=e(t),s=c.url,d=c.dataAttributes,l=d["data-namespace"]||"paypal",f=i(l);return function(t,e){var r=document.querySelector('script[src="'.concat(t,'"]'));if(null===r)return null;var o=n(t,e),a=r.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(i=!1)})),i?r:null}(s,d)&&f?r.resolve(f):o({url:s,attributes:d},r).then((function(){var t=i(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))}))},t.version="4.2.1",Object.defineProperty(t,"__esModule",{value:!0}),t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
var paypalLoadScript=function(t){"use strict";function e(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],r=t["data-merchant-id"],n="",o="";Array.isArray(e)?e.length>1?(n="*",o=e.toString()):n=e.toString():"string"==typeof e&&e.length>0?n=e:"string"==typeof r&&r.length>0&&(n="*",o=r);t["merchant-id"]=n,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,r){var n=t[r].toString();return"data-"===r.substring(0,5)?e.dataAttributes[r]=n:e.queryParams[r]=n,e}),{queryParams:{},dataAttributes:{}}),o=n.queryParams,a=n.dataAttributes;return{url:"".concat(e,"?").concat(r(o)),dataAttributes:a}}function r(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function n(t,e){void 0===e&&(e={});var r=document.createElement("script");return r.src=t,Object.keys(e).forEach((function(t){r.setAttribute(t,e[t]),"data-csp-nonce"===t&&r.setAttribute("nonce",e["data-csp-nonce"])})),r}function o(t,e){void 0===e&&(e=a()),u(t,e);var r=t.url,o=t.attributes;if("string"!=typeof r||0===r.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,r=t.attributes,o=t.onSuccess,a=t.onError,i=n(e,r);i.onerror=a,i.onload=o,document.head.insertBefore(i,document.head.firstElementChild)}({url:r,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(r,'" failed to load.'));return window.fetch?fetch(r).then((function(r){return 200===r.status&&e(t),r.text()})).then((function(t){var r=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(r))})).catch((function(t){e(t)})):e(t)}})}))}function a(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function i(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}return t.loadCustomScript=o,t.loadScript=function(t,r){if(void 0===r&&(r=a()),u(t,r),"undefined"==typeof window)return r.resolve(null);var c=e(t),s=c.url,d=c.dataAttributes,l=d["data-namespace"]||"paypal",f=i(l);return function(t,e){var r=document.querySelector('script[src="'.concat(t,'"]'));if(null===r)return null;var o=n(t,e),a=r.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var i=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(i=!1)})),i?r:null}(s,d)&&f?r.resolve(f):o({url:s,attributes:d},r).then((function(){var t=i(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))}))},t.version="4.2.2",Object.defineProperty(t,"__esModule",{value:!0}),t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
{
"name": "@paypal/paypal-js",
"version": "4.2.1",
"version": "4.2.2",
"description": "Client-side loader for the PayPal JS SDK",

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

"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@babel/preset-typescript": "^7.16.0",
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.5",
"@babel/preset-typescript": "^7.16.5",
"@commitlint/cli": "^15.0.0",

@@ -54,3 +54,3 @@ "@commitlint/config-conventional": "^15.0.0",

"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-node-resolve": "^13.1.1",
"@rollup/plugin-replace": "^3.0.0",

@@ -60,24 +60,22 @@ "@rollup/plugin-typescript": "^8.3.0",

"@types/promise-polyfill": "^6.0.4",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"babel-jest": "^27.3.1",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"babel-jest": "^27.4.5",
"check-node-version": "^4.2.1",
"eslint": "^8.3.0",
"eslint": "^8.4.1",
"eslint-plugin-compat": "^4.0.0",
"filesize": "^8.0.6",
"husky": "^7.0.4",
"jest": "^27.3.1",
"jest-puppeteer": "^6.0.1",
"jest": "^27.4.5",
"jest-puppeteer": "^6.0.3",
"lint-staged": "^12.1.2",
"pinst": "^2.1.6",
"prettier": "^2.4.1",
"puppeteer": "^11.0.0",
"rollup": "^2.60.1",
"rollup-plugin-filesize": "^9.1.1",
"prettier": "^2.5.1",
"puppeteer": "^12.0.1",
"rollup": "^2.61.1",
"rollup-plugin-terser": "^7.0.2",
"serve": "^13.0.2",
"shelljs": "^0.8.4",
"standard-version": "^9.3.2",
"tslib": "^2.3.1",
"typescript": "^4.5.2"
"typescript": "^4.5.4"
},

@@ -84,0 +82,0 @@ "dependencies": {

@@ -209,3 +209,3 @@ # paypal-js

```html
<script src="https://unpkg.com/@paypal/paypal-js@4.2.1/dist/iife/paypal-js.legacy.min.js"></script>
<script src="https://unpkg.com/@paypal/paypal-js@4.2.2/dist/iife/paypal-js.legacy.min.js"></script>
```

@@ -221,3 +221,3 @@

<head>
<script src="https://unpkg.com/@paypal/paypal-js@4.2.1/dist/iife/paypal-js.min.js"></script>
<script src="https://unpkg.com/@paypal/paypal-js@4.2.2/dist/iife/paypal-js.min.js"></script>
</head>

@@ -224,0 +224,0 @@ <body>

@@ -1,17 +0,17 @@

export type ShippingOptionType = 'SHIPPING' | 'PICKUP';
export type ShippingOptionType = "SHIPPING" | "PICKUP";
export type ShippingAddress = {
city: string,
state: string,
country_code: string,
postal_code: string
city: string;
state: string;
country_code: string;
postal_code: string;
};
export type SelectedShippingOption = {
label: string,
type: ShippingOptionType,
label: string;
type: ShippingOptionType;
amount: {
currency_code: string,
value: string
}
};
currency_code: string;
value: string;
};
};

@@ -55,17 +55,17 @@ import type { CreateOrderRequestBody, OrderResponseBody } from "../apis/orders";

export type OnShippingChangeData = {
orderID?: string,
paymentID?: string,
paymentToken?: string,
shipping_address?: ShippingAddress,
selected_shipping_option?: SelectedShippingOption,
buyerAccessToken?: string,
forceRestAPI: boolean
orderID?: string;
paymentID?: string;
paymentToken?: string;
shipping_address?: ShippingAddress;
selected_shipping_option?: SelectedShippingOption;
buyerAccessToken?: string;
forceRestAPI: boolean;
};
export type OnShippingChangeActions = {
resolve: () => Promise<void>,
reject: () => Promise<void>,
resolve: () => Promise<void>;
reject: () => Promise<void>;
order: {
patch: () => Promise<OrderResponseBody>
}
patch: () => Promise<OrderResponseBody>;
};
};

@@ -72,0 +72,0 @@

@@ -1,3 +0,1 @@

import type { CreateOrderRequestBody } from "../apis/orders";
type UnknownObject = Record<string, unknown>;

@@ -65,8 +63,2 @@

export type CreateOrderActions = {
order: {
create: (options: CreateOrderRequestBody) => Promise<string>;
};
};
export interface PayPalHostedFieldsComponentOptions {

@@ -73,0 +65,0 @@ createOrder: () => Promise<string>;

interface PayPalScriptQueryParameters {
"buyer-country"?: string;
"client-id": string;
// loadScript() supports an array and will convert it
// to the correct merchant-id and data-merchant-id string values
"merchant-id"?: string[] | string;
currency?: string;
intent?: string;
commit?: boolean;
vault?: boolean | string;
components?: string;
currency?: string;
debug?: boolean | string;
"disable-card"?: string;
"disable-funding"?: string;
"enable-funding"?: string;
"disable-card"?: string;
"integration-date"?: string;
debug?: boolean | string;
"buyer-country"?: string;
intent?: string;
locale?: string;
// loadScript() supports an array and will convert it
// to the correct merchant-id and data-merchant-id string values
"merchant-id"?: string[] | string;
vault?: boolean | string;
}
interface PayPalScriptDataAttributes {
"data-partner-attribution-id"?: string;
"data-client-token"?: string;
"data-csp-nonce"?: string;
"data-page-type"?: string;
"data-client-token"?: string;
"data-client-metadata-id"?: string;
"data-merchant-id"?: string;
"data-namespace"?: string;
"data-page-type"?: string;
"data-partner-attribution-id"?: string;
"data-sdk-integration-source"?: string;
"data-user-id-token"?: string;
}

@@ -29,0 +31,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc