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

@paypal/paypal-js

Package Overview
Dependencies
Maintainers
23
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 8.0.0-beta.5 to 8.0.0

4

dist/cjs/paypal-js.js
/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -191,3 +191,3 @@ *

// replaced with the package.json version at build time
var version = "8.0.0-beta.4";
var version = "8.0.0";

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

/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

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

*/
"use strict";function t(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function e(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 r(t,r){void 0===r&&(r=Promise),o(t,r);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 r((function(t,r){if("undefined"==typeof document)return t();!function(t){var r=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,i=e(r,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. Check the HTTP status code and response body in DevTools to learn more.'));return r(t)}})}))}function n(t){return window[t]}function o(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=r,exports.loadScript=function(a,i){if(void 0===i&&(i=Promise),o(a,i),"undefined"==typeof document)return i.resolve(null);var c=function(e){var r="https://www.paypal.com/sdk/js";e.sdkBaseUrl&&(r=e.sdkBaseUrl,delete e.sdkBaseUrl);var n=e,o=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),a=o.queryParams,i=o.attributes;return a["merchant-id"]&&-1!==a["merchant-id"].indexOf(",")&&(i["data-merchant-id"]=a["merchant-id"],a["merchant-id"]="*"),{url:"".concat(r,"?").concat(t(a)),attributes:i}}(a),u=c.url,s=c.attributes,d=s["data-namespace"]||"paypal",l=n(d);return function(t,r){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=e(t,r),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}(u,s)&&l?i.resolve(l):r({url:u,attributes:s},i).then((function(){var t=n(d);if(t)return t;throw new Error("The window.".concat(d," global variable is not available."))}))},exports.version="8.0.0-beta.4";
"use strict";function t(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function e(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 r(t,r){void 0===r&&(r=Promise),o(t,r);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 r((function(t,r){if("undefined"==typeof document)return t();!function(t){var r=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,i=e(r,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. Check the HTTP status code and response body in DevTools to learn more.'));return r(t)}})}))}function n(t){return window[t]}function o(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=r,exports.loadScript=function(a,i){if(void 0===i&&(i=Promise),o(a,i),"undefined"==typeof document)return i.resolve(null);var c=function(e){var r="https://www.paypal.com/sdk/js";e.sdkBaseUrl&&(r=e.sdkBaseUrl,delete e.sdkBaseUrl);var n=e,o=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),a=o.queryParams,i=o.attributes;return a["merchant-id"]&&-1!==a["merchant-id"].indexOf(",")&&(i["data-merchant-id"]=a["merchant-id"],a["merchant-id"]="*"),{url:"".concat(r,"?").concat(t(a)),attributes:i}}(a),u=c.url,s=c.attributes,d=s["data-namespace"]||"paypal",l=n(d);return function(t,r){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=e(t,r),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}(u,s)&&l?i.resolve(l):r({url:u,attributes:s},i).then((function(){var t=n(d);if(t)return t;throw new Error("The window.".concat(d," global variable is not available."))}))},exports.version="8.0.0";
/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -189,4 +189,4 @@ *

// replaced with the package.json version at build time
var version = "8.0.0-beta.4";
var version = "8.0.0";
export { loadCustomScript, loadScript, version };
/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

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

*/
function t(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function e(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 r(r,u){if(void 0===u&&(u=Promise),a(r,u),"undefined"==typeof document)return u.resolve(null);var c=function(e){var r="https://www.paypal.com/sdk/js";e.sdkBaseUrl&&(r=e.sdkBaseUrl,delete e.sdkBaseUrl);var n=e,o=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),a=o.queryParams,u=o.attributes;return a["merchant-id"]&&-1!==a["merchant-id"].indexOf(",")&&(u["data-merchant-id"]=a["merchant-id"],a["merchant-id"]="*"),{url:"".concat(r,"?").concat(t(a)),attributes:u}}(r),i=c.url,s=c.attributes,d=s["data-namespace"]||"paypal",l=o(d);return function(t,r){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=e(t,r),a=n.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var u=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(u=!1)})),u?n:null}(i,s)&&l?u.resolve(l):n({url:i,attributes:s},u).then((function(){var t=o(d);if(t)return t;throw new Error("The window.".concat(d," global variable is not available."))}))}function n(t,r){void 0===r&&(r=Promise),a(t,r);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 r((function(t,r){if("undefined"==typeof document)return t();!function(t){var r=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,u=e(r,n);u.onerror=a,u.onload=o,document.head.insertBefore(u,document.head.firstElementChild)}({url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(t)}})}))}function o(t){return window[t]}function a(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 u="8.0.0-beta.4";export{n as loadCustomScript,r as loadScript,u as version};
function t(t){var e="";return Object.keys(t).forEach((function(r){0!==e.length&&(e+="&"),e+=r+"="+t[r]})),e}function e(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 r(r,u){if(void 0===u&&(u=Promise),a(r,u),"undefined"==typeof document)return u.resolve(null);var c=function(e){var r="https://www.paypal.com/sdk/js";e.sdkBaseUrl&&(r=e.sdkBaseUrl,delete e.sdkBaseUrl);var n=e,o=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),a=o.queryParams,u=o.attributes;return a["merchant-id"]&&-1!==a["merchant-id"].indexOf(",")&&(u["data-merchant-id"]=a["merchant-id"],a["merchant-id"]="*"),{url:"".concat(r,"?").concat(t(a)),attributes:u}}(r),i=c.url,s=c.attributes,d=s["data-namespace"]||"paypal",l=o(d);return function(t,r){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=e(t,r),a=n.cloneNode();if(delete a.dataset.uidAuto,Object.keys(a.dataset).length!==Object.keys(o.dataset).length)return null;var u=!0;return Object.keys(a.dataset).forEach((function(t){a.dataset[t]!==o.dataset[t]&&(u=!1)})),u?n:null}(i,s)&&l?u.resolve(l):n({url:i,attributes:s},u).then((function(){var t=o(d);if(t)return t;throw new Error("The window.".concat(d," global variable is not available."))}))}function n(t,r){void 0===r&&(r=Promise),a(t,r);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 r((function(t,r){if("undefined"==typeof document)return t();!function(t){var r=t.url,n=t.attributes,o=t.onSuccess,a=t.onError,u=e(r,n);u.onerror=a,u.onload=o,document.head.insertBefore(u,document.head.firstElementChild)}({url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(t)}})}))}function o(t){return window[t]}function a(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 u="8.0.0";export{n as loadCustomScript,r as loadScript,u as version};
/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -192,3 +192,3 @@ *

// replaced with the package.json version at build time
var version = "8.0.0-beta.4";
var version = "8.0.0";

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

/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

@@ -563,3 +563,3 @@ *

// replaced with the package.json version at build time
var version = "8.0.0-beta.4";
var version = "8.0.0";

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

/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

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

*/
var paypalLoadScript=function(t){"use strict";function e(t,e){this.name="AggregateError",this.errors=t,this.message=e||""}e.prototype=Error.prototype;var n=setTimeout;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 u(e.promise,t)}c(e.promise,r)}else(1===t._state?c:u)(e.promise,t._value)}))):t._deferreds.push(e)}function c(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 s(t);if("function"==typeof n)return void l((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(e){u(t,e)}var r,o}function u(t,e){t._state=2,t._value=e,s(t)}function s(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 f(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,c(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(t){if(n)return;n=!0,u(e,t)}}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=Promise),m(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseUrl&&(e=t.sdkBaseUrl,delete t.sdkBaseUrl);var n=t,r=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),o=r.queryParams,i=r.attributes;return o["merchant-id"]&&-1!==o["merchant-id"].indexOf(",")&&(i["data-merchant-id"]=o["merchant-id"],o["merchant-id"]="*"),{url:"".concat(e,"?").concat(d(o)),attributes:i}}(t),r=n.url,o=n.attributes,i=o["data-namespace"]||"paypal",a=v(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):y({url:r,attributes:o},e).then((function(){var t=v(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=Promise),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 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. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}})}))}function v(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.")}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 f(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 c=r.then;if("function"==typeof c)return void c.call(r,(function(e){a(t,e)}),n)}o[t]=r,0==--i&&e(o)}catch(t){n(t)}}for(var c=0;c<o.length;c++)a(c,o[c])}))},i.any=function(t){var n=this;return new n((function(r,o){if(!t||void 0===t.length)return o(new TypeError("Promise.any accepts an array"));var i=Array.prototype.slice.call(t);if(0===i.length)return o();for(var a=[],c=0;c<i.length;c++)try{n.resolve(i[c]).then(r).catch((function(t){a.push(t),a.length===i.length&&o(new e(a,"All promises were rejected"))}))}catch(t){o(t)}}))},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 setImmediate&&function(t){setImmediate(t)}||function(t){n(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 h(t,i)},t.version="8.0.0-beta.4",t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
var paypalLoadScript=function(t){"use strict";function e(t,e){this.name="AggregateError",this.errors=t,this.message=e||""}e.prototype=Error.prototype;var n=setTimeout;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 u(e.promise,t)}c(e.promise,r)}else(1===t._state?c:u)(e.promise,t._value)}))):t._deferreds.push(e)}function c(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 s(t);if("function"==typeof n)return void l((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(e){u(t,e)}var r,o}function u(t,e){t._state=2,t._value=e,s(t)}function s(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 f(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,c(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(t){if(n)return;n=!0,u(e,t)}}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=Promise),m(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseUrl&&(e=t.sdkBaseUrl,delete t.sdkBaseUrl);var n=t,r=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),o=r.queryParams,i=r.attributes;return o["merchant-id"]&&-1!==o["merchant-id"].indexOf(",")&&(i["data-merchant-id"]=o["merchant-id"],o["merchant-id"]="*"),{url:"".concat(e,"?").concat(d(o)),attributes:i}}(t),r=n.url,o=n.attributes,i=o["data-namespace"]||"paypal",a=v(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):y({url:r,attributes:o},e).then((function(){var t=v(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=Promise),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 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. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}})}))}function v(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.")}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 f(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 c=r.then;if("function"==typeof c)return void c.call(r,(function(e){a(t,e)}),n)}o[t]=r,0==--i&&e(o)}catch(t){n(t)}}for(var c=0;c<o.length;c++)a(c,o[c])}))},i.any=function(t){var n=this;return new n((function(r,o){if(!t||void 0===t.length)return o(new TypeError("Promise.any accepts an array"));var i=Array.prototype.slice.call(t);if(0===i.length)return o();for(var a=[],c=0;c<i.length;c++)try{n.resolve(i[c]).then(r).catch((function(t){a.push(t),a.length===i.length&&o(new e(a,"All promises were rejected"))}))}catch(t){o(t)}}))},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 setImmediate&&function(t){setImmediate(t)}||function(t){n(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 h(t,i)},t.version="8.0.0",t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
/*!
* paypal-js v8.0.0-beta.4 (2023-12-11T21:51:22.299Z)
* paypal-js v8.0.0 (2023-12-20T19:17:15.167Z)
* Copyright 2020-present, PayPal, Inc. All rights reserved.

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

*/
var paypalLoadScript=function(t){"use strict";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=Promise),a(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. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}})}))}function o(t){return window[t]}function a(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=n,t.loadScript=function(t,i){if(void 0===i&&(i=Promise),a(t,i),"undefined"==typeof document)return i.resolve(null);var c=function(t){var r="https://www.paypal.com/sdk/js";t.sdkBaseUrl&&(r=t.sdkBaseUrl,delete t.sdkBaseUrl);var n=t,o=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),a=o.queryParams,i=o.attributes;return a["merchant-id"]&&-1!==a["merchant-id"].indexOf(",")&&(i["data-merchant-id"]=a["merchant-id"],a["merchant-id"]="*"),{url:"".concat(r,"?").concat(e(a)),attributes:i}}(t),u=c.url,s=c.attributes,d=s["data-namespace"]||"paypal",l=o(d);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}(u,s)&&l?i.resolve(l):n({url:u,attributes:s},i).then((function(){var t=o(d);if(t)return t;throw new Error("The window.".concat(d," global variable is not available."))}))},t.version="8.0.0-beta.4",t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
var paypalLoadScript=function(t){"use strict";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=Promise),a(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. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}})}))}function o(t){return window[t]}function a(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=n,t.loadScript=function(t,i){if(void 0===i&&(i=Promise),a(t,i),"undefined"==typeof document)return i.resolve(null);var c=function(t){var r="https://www.paypal.com/sdk/js";t.sdkBaseUrl&&(r=t.sdkBaseUrl,delete t.sdkBaseUrl);var n=t,o=Object.keys(n).filter((function(t){return void 0!==n[t]&&null!==n[t]&&""!==n[t]})).reduce((function(t,e){var r,o=n[e].toString();return r=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===e?t.attributes[e]=o:t.queryParams[e]=o,t}),{queryParams:{},attributes:{}}),a=o.queryParams,i=o.attributes;return a["merchant-id"]&&-1!==a["merchant-id"].indexOf(",")&&(i["data-merchant-id"]=a["merchant-id"],a["merchant-id"]="*"),{url:"".concat(r,"?").concat(e(a)),attributes:i}}(t),u=c.url,s=c.attributes,d=s["data-namespace"]||"paypal",l=o(d);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}(u,s)&&l?i.resolve(l):n({url:u,attributes:s},i).then((function(){var t=o(d);if(t)return t;throw new Error("The window.".concat(d," global variable is not available."))}))},t.version="8.0.0",t}({});window.paypalLoadCustomScript=paypalLoadScript.loadCustomScript,window.paypalLoadScript=paypalLoadScript.loadScript;
{
"name": "@paypal/paypal-js",
"version": "8.0.0-beta.5",
"version": "8.0.0",
"description": "Loading wrapper and TypeScript types for the PayPal JS SDK",

@@ -53,3 +53,3 @@ "main": "index.js",

"@paypal/paypal-rest-api-specifications": "^1.0.0",
"@playwright/test": "^1.40.0",
"@playwright/test": "^1.40.1",
"@rollup/plugin-commonjs": "25.0.7",

@@ -60,20 +60,20 @@ "@rollup/plugin-node-resolve": "15.2.3",

"@rollup/plugin-typescript": "11.1.5",
"@types/node": "^20.10.0",
"@types/node": "^20.10.5",
"@types/promise-polyfill": "6.0.6",
"@typescript-eslint/eslint-plugin": "6.12.0",
"@typescript-eslint/parser": "6.12.0",
"@vitest/coverage-v8": "^0.34.6",
"eslint": "8.54.0",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": "6.15.0",
"@vitest/coverage-v8": "^1.1.0",
"eslint": "8.56.0",
"filesize": "10.1.0",
"husky": "8.0.3",
"jsdom": "^23.0.0",
"lint-staged": "15.1.0",
"openapi-typescript": "^6.7.2",
"prettier": "3.1.0",
"rollup": "4.6.0",
"jsdom": "^23.0.1",
"lint-staged": "15.2.0",
"openapi-typescript": "^6.7.3",
"prettier": "3.1.1",
"rollup": "4.9.1",
"semver": "7.5.4",
"standard-version": "9.5.0",
"tslib": "2.6.2",
"typescript": "5.3.2",
"vitest": "0.34.1"
"typescript": "5.3.3",
"vitest": "1.1.0"
},

@@ -80,0 +80,0 @@ "dependencies": {

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

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

@@ -236,3 +236,3 @@

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

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

@@ -7,28 +7,14 @@ import type {

export type CheckoutOrdersV2 = {
export interface CheckoutOrdersV2 {
components: components;
operations: operations;
paths: paths;
};
}
export type CreateOrder = CheckoutOrdersV2["operations"]["orders.create"];
export type PatchOrder = CheckoutOrdersV2["operations"]["orders.patch"];
export type GetOrder = CheckoutOrdersV2["operations"]["orders.get"];
export type AuthorizeOrder = CheckoutOrdersV2["operations"]["orders.authorize"];
export type CaptureOrder = CheckoutOrdersV2["operations"]["orders.capture"];
export type CreateOrderRequestBody =
CreateOrder["requestBody"]["content"]["application/json"];
export type PatchOrderRequestBody = NonNullable<
PatchOrder["requestBody"]
>["content"]["application/json"];
export type OrderSuccessResponseBody =
CheckoutOrdersV2["components"]["schemas"]["order_request"];
export type OrderResponseBody =
CheckoutOrdersV2["components"]["schemas"]["order"];
export type OrderSuccessResponseBodyMinimal = Pick<
OrderSuccessResponseBody,
"id" | "status" | "links"
>;
export type OrderErrorResponseBody =
CheckoutOrdersV2["components"]["schemas"]["error_default"];
export type PatchOrderRequestBody =
CheckoutOrdersV2["components"]["schemas"]["patch_request"];

@@ -35,0 +21,0 @@ export type PurchaseUnit = components["schemas"]["purchase_unit_request"];

@@ -7,24 +7,13 @@ import type {

export type BillingSubscriptionsV1 = {
export interface BillingSubscriptionsV1 {
components: components;
operations: operations;
paths: paths;
};
}
export type CreateSubscription =
BillingSubscriptionsV1["operations"]["subscriptions.create"];
export type ReviseSubscription =
BillingSubscriptionsV1["operations"]["subscriptions.revise"];
export type CreateSubscriptionRequestBody = NonNullable<
CreateSubscription["requestBody"]
>["content"]["application/json"];
export type ReviseSubscriptionRequestBody = NonNullable<
CreateSubscription["requestBody"]
>["content"]["application/json"];
export type SubscriptionSuccessResponseBody =
export type CreateSubscriptionRequestBody =
BillingSubscriptionsV1["components"]["schemas"]["subscription_request_post"];
export type ReviseSubscriptionRequestBody =
BillingSubscriptionsV1["components"]["schemas"]["subscription_revise_request"];
export type SubscriptionResponseBody =
BillingSubscriptionsV1["components"]["schemas"]["plan"];
export type SubscriptionErrorResponseBody =
BillingSubscriptionsV1["components"]["schemas"]["error_default"];
import type {
CreateOrderRequestBody,
OrderSuccessResponseBody,
OrderResponseBody,
PatchOrderRequestBody,

@@ -10,3 +10,3 @@ ShippingOption,

ReviseSubscriptionRequestBody,
SubscriptionSuccessResponseBody,
SubscriptionResponseBody,
} from "../apis/subscriptions";

@@ -65,3 +65,3 @@ import type { FUNDING_SOURCE } from "./funding-eligibility";

*/
capture: () => Promise<OrderSuccessResponseBody>;
capture: () => Promise<OrderResponseBody>;
/**

@@ -72,7 +72,7 @@ * Authorizes payment for an order.

*/
authorize: () => Promise<OrderSuccessResponseBody>;
authorize: () => Promise<OrderResponseBody>;
/**
* Shows details for an order, by ID
*/
get: () => Promise<OrderSuccessResponseBody>;
get: () => Promise<OrderResponseBody>;
/**

@@ -85,3 +85,3 @@ * Updates an order with a `CREATED` or `APPROVED` status.

subscription?: {
get: () => Promise<SubscriptionSuccessResponseBody>;
get: () => Promise<SubscriptionResponseBody>;
activate: () => Promise<void>;

@@ -97,3 +97,3 @@ };

type PartialShippingAddress = {
export type PartialShippingAddress = {
city: string;

@@ -176,3 +176,3 @@ state: string;

export type OnShippingAddressChangeData = {
type OnShippingAddressChangeData = {
amount: CurrencyCodeAndValue;

@@ -179,0 +179,0 @@ orderID?: string;

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