@paypal/paypal-js
Advanced tools
Comparing version 1.0.4 to 1.0.5
/*! | ||
* paypal-js v1.0.3 (2020-10-14T17:44:15.504Z) | ||
* paypal-js v1.0.4 (2020-11-14T18:27:29.664Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -42,2 +42,50 @@ * | ||
function allSettled(arr) { | ||
var P = this; | ||
return new P(function(resolve, reject) { | ||
if (!(arr && typeof arr.length !== 'undefined')) { | ||
return reject( | ||
new TypeError( | ||
typeof arr + | ||
' ' + | ||
arr + | ||
' is not iterable(cannot read property Symbol(Symbol.iterator))' | ||
) | ||
); | ||
} | ||
var args = Array.prototype.slice.call(arr); | ||
if (args.length === 0) return resolve([]); | ||
var remaining = args.length; | ||
function res(i, val) { | ||
if (val && (typeof val === 'object' || typeof val === 'function')) { | ||
var then = val.then; | ||
if (typeof then === 'function') { | ||
then.call( | ||
val, | ||
function(val) { | ||
res(i, val); | ||
}, | ||
function(e) { | ||
args[i] = { status: 'rejected', reason: e }; | ||
if (--remaining === 0) { | ||
resolve(args); | ||
} | ||
} | ||
); | ||
return; | ||
} | ||
} | ||
args[i] = { status: 'fulfilled', value: val }; | ||
if (--remaining === 0) { | ||
resolve(args); | ||
} | ||
} | ||
for (var i = 0; i < args.length; i++) { | ||
res(i, args[i]); | ||
} | ||
}); | ||
} | ||
// Store setTimeout reference so promise-polyfill will be unaffected by | ||
@@ -246,2 +294,4 @@ // other code modifying setTimeout (like sinon.useFakeTimers()) | ||
Promise.allSettled = allSettled; | ||
Promise.resolve = function(value) { | ||
@@ -411,3 +461,3 @@ if (value && typeof value === 'object' && value.constructor === Promise) { | ||
var version = '1.0.3'; | ||
var version = '1.0.4'; | ||
@@ -417,2 +467,4 @@ exports.loadScript = loadScript; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
return exports; | ||
@@ -419,0 +471,0 @@ |
/*! | ||
* paypal-js v1.0.3 (2020-10-14T17:44:15.504Z) | ||
* paypal-js v1.0.4 (2020-11-14T18:27:29.664Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -17,2 +17,2 @@ * | ||
*/ | ||
var paypalLoadScript=function(t){"use strict";var n=setTimeout;function e(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,n){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._immediateFn((function(){var e=1===t._state?n.onFulfilled:n.onRejected;if(null!==e){var r;try{r=e(t._value)}catch(t){return void u(n.promise,t)}a(n.promise,r)}else(1===t._state?a:u)(n.promise,t._value)}))):t._deferreds.push(n)}function a(t,n){try{if(n===t)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if(n instanceof o)return t._state=3,t._value=n,void c(t);if("function"==typeof e)return void s((r=e,i=n,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=n,c(t)}catch(n){u(t,n)}var r,i}function u(t,n){t._state=2,t._value=n,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn((function(){t._handled||o._unhandledRejectionFn(t._value)}));for(var n=0,e=t._deferreds.length;n<e;n++)i(t,t._deferreds[n]);t._deferreds=null}function f(t,n,e){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=e}function s(t,n){var e=!1;try{t((function(t){e||(e=!0,a(n,t))}),(function(t){e||(e=!0,u(n,t))}))}catch(t){if(e)return;e=!0,u(n,t)}}function l(t){var n="";return p(t,(function(e){0!==n.length&&(n+="&"),n+=e+"="+t[e]})),n}function d(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=document.createElement("script");return e.src=t,p(n,(function(t){e.setAttribute(t,n[t])})),e}function p(t,n){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n(e)}function h(t){var n=0;return p(t,(function(){return n++})),n}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,n){var e=new this.constructor(r);return i(this,new f(t,n,e)),e},o.prototype.finally=function(t){var n=this.constructor;return this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){return n.reject(e)}))}))},o.all=function(t){return new o((function(n,r){if(!e(t))return r(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return n([]);var i=o.length;function a(t,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var u=e.then;if("function"==typeof u)return void u.call(e,(function(n){a(t,n)}),r)}o[t]=e,0==--i&&n(o)}catch(t){r(t)}}for(var u=0;u<o.length;u++)a(u,o[u])}))},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o((function(n){n(t)}))},o.reject=function(t){return new o((function(n,e){e(t)}))},o.race=function(t){return new o((function(n,r){if(!e(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(n,r)}))},o._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){n(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var v,y=!1;return t.loadScript=function(t){return y?v:v=new o((function(n,e){if("undefined"==typeof window)return n(null);var r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n={queryParams:{},dataAttributes:{}};p(t,(function(e){"data-"===e.substring(0,5)?n.dataAttributes[e]=t[e]:n.queryParams[e]=t[e]}));var e=n.queryParams,r=n.dataAttributes;return{queryString:l(e),dataAttributes:r}}(t),o=r.queryString,i=r.dataAttributes,a="".concat("https://www.paypal.com/sdk/js","?").concat(o);if(function(t,n){var e=document.querySelector('script[src="'.concat(t,'"]'));if(!e)return null;var r=d(t,n);if(h(e.dataset)!==h(r.dataset))return null;var o=!0;return p(e.dataset,(function(t){e.dataset[t]!==r.dataset[t]&&(o=!1)})),o?e:null}(a,i)&&window.paypal)return n(window.paypal);y=!0,function(t){var n=t.url,e=t.dataAttributes,r=t.onSuccess,o=t.onError,i=d(n,e);i.onerror=o,i.onload=r,document.head.insertBefore(i,document.head.firstElementChild)}({url:a,dataAttributes:i,onSuccess:function(){return y=!1,window.paypal?n(window.paypal):e(new Error("The window.paypal global variable is not available."))},onError:function(){return y=!1,e(new Error('The script "'.concat(a,"\" didn't load correctly.")))}})}))},t.version="1.0.3",t}({});paypalLoadScript=paypalLoadScript.loadScript; | ||
var paypalLoadScript=function(t){"use strict";var n=setTimeout;function e(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=[],l(t,this)}function i(t,n){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._immediateFn((function(){var e=1===t._state?n.onFulfilled:n.onRejected;if(null!==e){var r;try{r=e(t._value)}catch(t){return void u(n.promise,t)}a(n.promise,r)}else(1===t._state?a:u)(n.promise,t._value)}))):t._deferreds.push(n)}function a(t,n){try{if(n===t)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var e=n.then;if(n instanceof o)return t._state=3,t._value=n,void c(t);if("function"==typeof e)return void l((r=e,i=n,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=n,c(t)}catch(n){u(t,n)}var r,i}function u(t,n){t._state=2,t._value=n,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn((function(){t._handled||o._unhandledRejectionFn(t._value)}));for(var n=0,e=t._deferreds.length;n<e;n++)i(t,t._deferreds[n]);t._deferreds=null}function f(t,n,e){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof n?n:null,this.promise=e}function l(t,n){var e=!1;try{t((function(t){e||(e=!0,a(n,t))}),(function(t){e||(e=!0,u(n,t))}))}catch(t){if(e)return;e=!0,u(n,t)}}function s(t){var n="";return p(t,(function(e){0!==n.length&&(n+="&"),n+=e+"="+t[e]})),n}function d(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=document.createElement("script");return e.src=t,p(n,(function(t){e.setAttribute(t,n[t])})),e}function p(t,n){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n(e)}function h(t){var n=0;return p(t,(function(){return n++})),n}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,n){var e=new this.constructor(r);return i(this,new f(t,n,e)),e},o.prototype.finally=function(t){var n=this.constructor;return this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){return n.reject(e)}))}))},o.all=function(t){return new o((function(n,r){if(!e(t))return r(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return n([]);var i=o.length;function a(t,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var u=e.then;if("function"==typeof u)return void u.call(e,(function(n){a(t,n)}),r)}o[t]=e,0==--i&&n(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(n,e){if(!t||void 0===t.length)return e(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 n([]);var o=r.length;function i(t,e){if(e&&("object"==typeof e||"function"==typeof e)){var a=e.then;if("function"==typeof a)return void a.call(e,(function(n){i(t,n)}),(function(e){r[t]={status:"rejected",reason:e},0==--o&&n(r)}))}r[t]={status:"fulfilled",value:e},0==--o&&n(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(n){n(t)}))},o.reject=function(t){return new o((function(n,e){e(t)}))},o.race=function(t){return new o((function(n,r){if(!e(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(n,r)}))},o._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){n(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var v,y=!1;return t.loadScript=function(t){return y?v:v=new o((function(n,e){if("undefined"==typeof window)return n(null);var r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n={queryParams:{},dataAttributes:{}};p(t,(function(e){"data-"===e.substring(0,5)?n.dataAttributes[e]=t[e]:n.queryParams[e]=t[e]}));var e=n.queryParams,r=n.dataAttributes;return{queryString:s(e),dataAttributes:r}}(t),o=r.queryString,i=r.dataAttributes,a="".concat("https://www.paypal.com/sdk/js","?").concat(o);if(function(t,n){var e=document.querySelector('script[src="'.concat(t,'"]'));if(!e)return null;var r=d(t,n);if(h(e.dataset)!==h(r.dataset))return null;var o=!0;return p(e.dataset,(function(t){e.dataset[t]!==r.dataset[t]&&(o=!1)})),o?e:null}(a,i)&&window.paypal)return n(window.paypal);y=!0,function(t){var n=t.url,e=t.dataAttributes,r=t.onSuccess,o=t.onError,i=d(n,e);i.onerror=o,i.onload=r,document.head.insertBefore(i,document.head.firstElementChild)}({url:a,dataAttributes:i,onSuccess:function(){return y=!1,window.paypal?n(window.paypal):e(new Error("The window.paypal global variable is not available."))},onError:function(){return y=!1,e(new Error('The script "'.concat(a,"\" didn't load correctly.")))}})}))},t.version="1.0.4",Object.defineProperty(t,"__esModule",{value:!0}),t}({});paypalLoadScript=paypalLoadScript.loadScript; |
/*! | ||
* paypal-js v1.0.3 (2020-10-14T17:44:15.504Z) | ||
* paypal-js v1.0.4 (2020-11-14T18:27:29.664Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -39,2 +39,50 @@ * | ||
function allSettled(arr) { | ||
var P = this; | ||
return new P(function(resolve, reject) { | ||
if (!(arr && typeof arr.length !== 'undefined')) { | ||
return reject( | ||
new TypeError( | ||
typeof arr + | ||
' ' + | ||
arr + | ||
' is not iterable(cannot read property Symbol(Symbol.iterator))' | ||
) | ||
); | ||
} | ||
var args = Array.prototype.slice.call(arr); | ||
if (args.length === 0) return resolve([]); | ||
var remaining = args.length; | ||
function res(i, val) { | ||
if (val && (typeof val === 'object' || typeof val === 'function')) { | ||
var then = val.then; | ||
if (typeof then === 'function') { | ||
then.call( | ||
val, | ||
function(val) { | ||
res(i, val); | ||
}, | ||
function(e) { | ||
args[i] = { status: 'rejected', reason: e }; | ||
if (--remaining === 0) { | ||
resolve(args); | ||
} | ||
} | ||
); | ||
return; | ||
} | ||
} | ||
args[i] = { status: 'fulfilled', value: val }; | ||
if (--remaining === 0) { | ||
resolve(args); | ||
} | ||
} | ||
for (var i = 0; i < args.length; i++) { | ||
res(i, args[i]); | ||
} | ||
}); | ||
} | ||
// Store setTimeout reference so promise-polyfill will be unaffected by | ||
@@ -243,2 +291,4 @@ // other code modifying setTimeout (like sinon.useFakeTimers()) | ||
Promise.allSettled = allSettled; | ||
Promise.resolve = function(value) { | ||
@@ -408,4 +458,4 @@ if (value && typeof value === 'object' && value.constructor === Promise) { | ||
var version = '1.0.3'; | ||
var version = '1.0.4'; | ||
export { loadScript, version }; |
/*! | ||
* paypal-js v1.0.3 (2020-10-14T17:44:15.504Z) | ||
* paypal-js v1.0.4 (2020-11-14T18:27:29.664Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -43,2 +43,50 @@ * | ||
function allSettled(arr) { | ||
var P = this; | ||
return new P(function(resolve, reject) { | ||
if (!(arr && typeof arr.length !== 'undefined')) { | ||
return reject( | ||
new TypeError( | ||
typeof arr + | ||
' ' + | ||
arr + | ||
' is not iterable(cannot read property Symbol(Symbol.iterator))' | ||
) | ||
); | ||
} | ||
var args = Array.prototype.slice.call(arr); | ||
if (args.length === 0) return resolve([]); | ||
var remaining = args.length; | ||
function res(i, val) { | ||
if (val && (typeof val === 'object' || typeof val === 'function')) { | ||
var then = val.then; | ||
if (typeof then === 'function') { | ||
then.call( | ||
val, | ||
function(val) { | ||
res(i, val); | ||
}, | ||
function(e) { | ||
args[i] = { status: 'rejected', reason: e }; | ||
if (--remaining === 0) { | ||
resolve(args); | ||
} | ||
} | ||
); | ||
return; | ||
} | ||
} | ||
args[i] = { status: 'fulfilled', value: val }; | ||
if (--remaining === 0) { | ||
resolve(args); | ||
} | ||
} | ||
for (var i = 0; i < args.length; i++) { | ||
res(i, args[i]); | ||
} | ||
}); | ||
} | ||
// Store setTimeout reference so promise-polyfill will be unaffected by | ||
@@ -247,2 +295,4 @@ // other code modifying setTimeout (like sinon.useFakeTimers()) | ||
Promise.allSettled = allSettled; | ||
Promise.resolve = function(value) { | ||
@@ -412,5 +462,5 @@ if (value && typeof value === 'object' && value.constructor === Promise) { | ||
var version = '1.0.3'; | ||
var version = '1.0.4'; | ||
exports.loadScript = loadScript; | ||
exports.version = version; |
{ | ||
"name": "@paypal/paypal-js", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Client-side loader for the PayPal JS SDK", | ||
@@ -34,17 +34,17 @@ "main": "dist/paypal.node.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.11.6", | ||
"@babel/preset-env": "^7.11.5", | ||
"@babel/core": "^7.12.3", | ||
"@babel/preset-env": "^7.12.1", | ||
"@rollup/plugin-babel": "^5.2.1", | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-replace": "^2.3.3", | ||
"babel-jest": "^26.5.2", | ||
"core-js": "^3.6.5", | ||
"eslint": "^7.11.0", | ||
"@rollup/plugin-commonjs": "^16.0.0", | ||
"@rollup/plugin-node-resolve": "^10.0.0", | ||
"@rollup/plugin-replace": "^2.3.4", | ||
"babel-jest": "^26.6.3", | ||
"core-js": "^3.7.0", | ||
"eslint": "^7.13.0", | ||
"filesize": "^6.1.0", | ||
"http-server": "^0.12.3", | ||
"jest": "^26.5.3", | ||
"jest": "^26.6.3", | ||
"jest-puppeteer": "^4.4.0", | ||
"puppeteer": "^5.3.1", | ||
"rollup": "^2.30.0", | ||
"puppeteer": "^5.4.1", | ||
"rollup": "^2.33.2", | ||
"rollup-plugin-filesize": "^9.0.2", | ||
@@ -55,4 +55,4 @@ "rollup-plugin-terser": "^7.0.2", | ||
"dependencies": { | ||
"promise-polyfill": "^8.1.3" | ||
"promise-polyfill": "^8.2.0" | ||
} | ||
} |
# PayPal JS | ||
A client-side loader for the [PayPal JS SDK](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/). | ||
> A client-side loader for the [PayPal JS SDK](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/) | ||
<a href="https://www.npmjs.com/package/@paypal/paypal-js"><img src="https://img.shields.io/npm/v/@paypal/paypal-js" alt="npm version"></a> | ||
<a href="https://www.npmjs.com/package/@paypal/paypal-js"><img src="https://img.shields.io/npm/dm/@paypal/paypal-js" alt="npm downloads"></a> | ||
<a href="https://github.com/paypal/paypal-js/actions?query=workflow%3ACI"><img src="https://github.com/paypal/paypal-js/workflows/CI/badge.svg" alt="CI Status"></a> | ||
<a href="https://david-dm.org/paypal/paypal-js"><img src="https://img.shields.io/david/paypal/paypal-js" alt="dependencies"></a> | ||
<a href="https://david-dm.org/paypal/paypal-js?type=dev"><img src="https://img.shields.io/david/dev/paypal/paypal-js" alt="dev dependencies"></a> | ||
<a href="https://github.com/paypal/paypal-js/blob/main/LICENSE.txt"><img src="https://img.shields.io/npm/l/@paypal/paypal-js" alt="GitHub license"></a> | ||
@@ -10,0 +9,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61627
1282
127
Updatedpromise-polyfill@^8.2.0