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

@paypal/paypal-js

Package Overview
Dependencies
Maintainers
22
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 5.1.4 to 5.1.5

12

dist/cjs/paypal-js.js
/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -150,4 +150,4 @@ *

validateArguments(options, PromisePonyfill);
// resolve with null when running in Node
if (typeof window === "undefined")
// resolve with null when running in Node or Deno
if (typeof document === "undefined")
return PromisePonyfill.resolve(null);

@@ -190,4 +190,4 @@ var _a = processOptions(options), url = _a.url, dataAttributes = _a.dataAttributes;

return new PromisePonyfill(function (resolve, reject) {
// resolve with undefined when running in Node
if (typeof window === "undefined")
// resolve with undefined when running in Node or Deno
if (typeof document === "undefined")
return resolve();

@@ -243,3 +243,3 @@ insertScriptElement({

// replaced with the package.json version at build time
var version = "5.1.4";
var version = "5.1.5";

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

/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* 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.")}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="5.1.4";
"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 document)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.")}exports.loadCustomScript=n,exports.loadScript=function(e,u){if(void 0===u&&(u=o()),i(e,u),"undefined"==typeof document)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="5.1.5";
/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -148,4 +148,4 @@ *

validateArguments(options, PromisePonyfill);
// resolve with null when running in Node
if (typeof window === "undefined")
// resolve with null when running in Node or Deno
if (typeof document === "undefined")
return PromisePonyfill.resolve(null);

@@ -188,4 +188,4 @@ var _a = processOptions(options), url = _a.url, dataAttributes = _a.dataAttributes;

return new PromisePonyfill(function (resolve, reject) {
// resolve with undefined when running in Node
if (typeof window === "undefined")
// resolve with undefined when running in Node or Deno
if (typeof document === "undefined")
return resolve();

@@ -241,4 +241,4 @@ insertScriptElement({

// replaced with the package.json version at build time
var version = "5.1.4";
var version = "5.1.5";
export { loadCustomScript, loadScript, version };
/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* 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="5.1.4";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 document)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 document)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="5.1.5";export{o as loadCustomScript,n as loadScript,c as version};
/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -151,4 +151,4 @@ *

validateArguments(options, PromisePonyfill);
// resolve with null when running in Node
if (typeof window === "undefined")
// resolve with null when running in Node or Deno
if (typeof document === "undefined")
return PromisePonyfill.resolve(null);

@@ -191,4 +191,4 @@ var _a = processOptions(options), url = _a.url, dataAttributes = _a.dataAttributes;

return new PromisePonyfill(function (resolve, reject) {
// resolve with undefined when running in Node
if (typeof window === "undefined")
// resolve with undefined when running in Node or Deno
if (typeof document === "undefined")
return resolve();

@@ -244,3 +244,3 @@ insertScriptElement({

// replaced with the package.json version at build time
var version = "5.1.4";
var version = "5.1.5";

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

/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -472,4 +472,4 @@ *

validateArguments(options, PromisePonyfill);
// resolve with null when running in Node
if (typeof window === "undefined")
// resolve with null when running in Node or Deno
if (typeof document === "undefined")
return PromisePonyfill.resolve(null);

@@ -512,4 +512,4 @@ var _a = processOptions(options), url = _a.url, dataAttributes = _a.dataAttributes;

return new PromisePonyfill(function (resolve, reject) {
// resolve with undefined when running in Node
if (typeof window === "undefined")
// resolve with undefined when running in Node or Deno
if (typeof document === "undefined")
return resolve();

@@ -571,3 +571,3 @@ insertScriptElement({

// replaced with the package.json version at build time
var version = "5.1.4";
var version = "5.1.5";

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

/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

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

*/
var paypalLoadScript=function(t){"use strict";var e=setTimeout;function n(t){return Boolean(t&&void 0!==t.length)}function r(){}function o(t){if(!(this instanceof o))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=[],s(t,this)}function i(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._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 u(e.promise,t)}a(e.promise,r)}else(1===t._state?a:u)(e.promise,t._value)}))):t._deferreds.push(e)}function a(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 o)return t._state=3,t._value=e,void c(t);if("function"==typeof n)return void s((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}var r,i}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn((function(){t._handled||o._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)i(t,t._deferreds[e]);t._deferreds=null}function f(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function s(t,e){var n=!1;try{t((function(t){n||(n=!0,a(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(t){if(n)return;n=!0,u(e,t)}}function l(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(d(r)),dataAttributes:o}}function d(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function p(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 h(t,e){if(void 0===e&&(e=y()),m(t,e),"undefined"==typeof window)return e.resolve(null);var n=l(t),r=n.url,o=n.dataAttributes,i=o["data-namespace"]||"paypal",a=w(i);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var r=p(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):v({url:r,attributes:o},e).then((function(){var t=w(i);if(t)return t;throw new Error("The window.".concat(i," global variable is not available."))}))}function v(t,e){void 0===e&&(e=y()),m(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=p(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 y(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function w(t){return window[t]}function m(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.")}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(r);return i(this,new f(t,e,n)),n},o.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)}))}))},o.all=function(t){return new o((function(e,r){if(!n(t))return r(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,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,(function(e){a(t,e)}),r)}o[t]=n,0==--i&&e(o)}catch(t){r(t)}}for(var u=0;u<o.length;u++)a(u,o[u])}))},o.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])}))},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o((function(e){e(t)}))},o.reject=function(t){return new o((function(e,n){n(t)}))},o.race=function(t){return new o((function(e,r){if(!n(t))return r(new TypeError("Promise.race accepts an array"));for(var i=0,a=t.length;i<a;i++)o.resolve(t[i]).then(e,r)}))},o._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){e(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};return t.loadCustomScript=function(t){return v(t,o)},t.loadScript=function(t){return h(t,o)},t.version="5.1.4",t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
var paypalLoadScript=function(t){"use strict";var e=setTimeout;function n(t){return Boolean(t&&void 0!==t.length)}function r(){}function o(t){if(!(this instanceof o))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=[],s(t,this)}function i(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._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 u(e.promise,t)}a(e.promise,r)}else(1===t._state?a:u)(e.promise,t._value)}))):t._deferreds.push(e)}function a(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 o)return t._state=3,t._value=e,void c(t);if("function"==typeof n)return void s((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}var r,i}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn((function(){t._handled||o._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)i(t,t._deferreds[e]);t._deferreds=null}function f(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function s(t,e){var n=!1;try{t((function(t){n||(n=!0,a(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(t){if(n)return;n=!0,u(e,t)}}function l(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(d(r)),dataAttributes:o}}function d(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function p(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 h(t,e){if(void 0===e&&(e=y()),w(t,e),"undefined"==typeof document)return e.resolve(null);var n=l(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=p(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):v({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 v(t,e){void 0===e&&(e=y()),w(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 document)return t();!function(t){var e=t.url,n=t.attributes,r=t.onSuccess,o=t.onError,i=p(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 y(){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 w(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.")}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(r);return i(this,new f(t,e,n)),n},o.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)}))}))},o.all=function(t){return new o((function(e,r){if(!n(t))return r(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,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,(function(e){a(t,e)}),r)}o[t]=n,0==--i&&e(o)}catch(t){r(t)}}for(var u=0;u<o.length;u++)a(u,o[u])}))},o.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])}))},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o((function(e){e(t)}))},o.reject=function(t){return new o((function(e,n){n(t)}))},o.race=function(t){return new o((function(e,r){if(!n(t))return r(new TypeError("Promise.race accepts an array"));for(var i=0,a=t.length;i<a;i++)o.resolve(t[i]).then(e,r)}))},o._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){e(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};return t.loadCustomScript=function(t){return v(t,o)},t.loadScript=function(t){return h(t,o)},t.version="5.1.5",t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
/*!
* paypal-js v5.1.4 (2022-11-29T23:08:21.847Z)
* paypal-js v5.1.5 (2023-03-21T20:10:17.743Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

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

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

@@ -47,26 +47,26 @@ "main": "index.js",

"devDependencies": {
"@commitlint/cli": "17.3.0",
"@commitlint/config-conventional": "17.3.0",
"@playwright/test": "^1.28.1",
"@rollup/plugin-commonjs": "23.0.3",
"@commitlint/cli": "17.4.4",
"@commitlint/config-conventional": "17.4.4",
"@playwright/test": "^1.31.1",
"@rollup/plugin-commonjs": "24.0.1",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-replace": "5.0.1",
"@rollup/plugin-terser": "^0.1.0",
"@rollup/plugin-typescript": "10.0.1",
"@types/jest": "29.2.3",
"@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "11.0.0",
"@types/jest": "29.4.0",
"@types/promise-polyfill": "6.0.4",
"@typescript-eslint/eslint-plugin": "5.45.0",
"@typescript-eslint/parser": "5.45.0",
"eslint": "8.28.0",
"filesize": "10.0.5",
"husky": "8.0.2",
"jest": "29.3.1",
"jest-environment-jsdom": "29.3.1",
"lint-staged": "13.0.4",
"prettier": "2.8.0",
"rollup": "3.5.0",
"@typescript-eslint/eslint-plugin": "5.54.0",
"@typescript-eslint/parser": "5.54.0",
"eslint": "8.35.0",
"filesize": "10.0.6",
"husky": "8.0.3",
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3",
"lint-staged": "13.1.2",
"prettier": "2.8.4",
"rollup": "3.17.3",
"semver": "7.3.8",
"standard-version": "9.5.0",
"ts-jest": "29.0.3",
"tslib": "2.4.1",
"ts-jest": "29.0.5",
"tslib": "2.5.0",
"typescript": "4.8.4"

@@ -73,0 +73,0 @@ },

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

[build-badge]: https://img.shields.io/github/workflow/status/paypal/paypal-js/validate?logo=github&style=flat-square
[build-badge]: https://img.shields.io/github/actions/workflow/status/paypal/paypal-js/validate.yml?branch=main&logo=github&style=flat-square
[build]: https://github.com/paypal/paypal-js/actions?query=workflow%3Avalidate

@@ -225,3 +225,3 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/paypal/paypal-js.svg?style=flat-square

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

@@ -237,3 +237,3 @@

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

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

@@ -222,5 +222,2 @@ import type { Address, AmountWithCurrencyCode } from "./commons";

method?: string;
title?: string;
mediaType?: string;
encType?: string;
};

@@ -242,4 +239,26 @@

export type OrderResponseBody = {
export type OrderResponseBodyMinimal = {
/**
* The ID of the order
* @readonly
*/
id: string;
/**
* The order status
*/
status:
| "CREATED"
| "SAVED"
| "APPROVED"
| "VOIDED"
| "COMPLETED"
| "PAYER_ACTION_REQUIRED";
/**
* An array of request-related HATEOAS links
*/
links: LinkDescription[];
};
export type OrderResponseBody = OrderResponseBodyMinimal & {
/**
* The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6).

@@ -259,7 +278,2 @@ * Seconds are required while fractional seconds are optional

/**
* The ID of the order
* @readonly
*/
id: string;
/**
* @type {INTENT}

@@ -274,16 +288,2 @@ */

/**
* The order status
*/
status:
| "COMPLETED"
| "SAVED"
| "APPROVED"
| "VOIDED"
| "COMPLETED"
| "PAYER_ACTION_REQUIRED";
/**
* An array of request-related HATEOAS links
*/
links: LinkDescription[];
/**
* The instruction to process an order

@@ -290,0 +290,0 @@ */

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

order: {
patch: () => Promise<OrderResponseBody>;
patch: () => Promise<void>;
};

@@ -106,0 +106,0 @@ };

@@ -29,2 +29,3 @@ interface PayPalScriptQueryParameters {

"data-sdk-integration-source"?: string;
"data-uid"?: string;
"data-user-id-token"?: string;

@@ -31,0 +32,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