@paypal/paypal-js
Advanced tools
Comparing version 2.1.2 to 2.1.3
/*! | ||
* paypal-js v2.1.2 (2021-01-10T17:22:23.865Z) | ||
* paypal-js v2.1.3 (2021-01-25T02:24:12.167Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -157,3 +157,3 @@ * | ||
var version = '2.1.2'; | ||
var version = '2.1.3'; | ||
@@ -160,0 +160,0 @@ exports.loadScript = loadScript; |
/*! | ||
* paypal-js v2.1.2 (2021-01-10T17:22:23.865Z) | ||
* paypal-js v2.1.3 (2021-01-25T02:24:12.167Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -17,2 +17,2 @@ * | ||
*/ | ||
var paypalLoadScript=function(t){"use strict";function r(t){var r="";return n(t,(function(e){0!==r.length&&(r+="&"),r+=e+"="+t[e]})),r}function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=document.createElement("script");return e.src=t,n(r,(function(t){e.setAttribute(t,r[t]),"data-csp-nonce"===t&&e.setAttribute("nonce",r["data-csp-nonce"])})),e}function n(t,r){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&r(e)}function a(t){var r=0;return n(t,(function(){return r++})),r}var o,i=!1;return t.loadScript=function(t,u){if(!(t instanceof Object))throw new Error("Invalid arguments. Expected an object to be passed into loadScript().");if(void 0===u){if("undefined"==typeof Promise)throw new Error("Failed to load the PayPal JS SDK script because Promise is undefined. To resolve the issue, use a Promise polyfill.");u=Promise}return i?o:o=new u((function(o,u){if("undefined"==typeof window)return o(null);var c=function(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL);var a={queryParams:{},dataAttributes:{}};n(t,(function(r){var e="data-"===r.substring(0,5)?"dataAttributes":"queryParams";a[e][r]=t[r].toString()}));var o=a.queryParams,i=a.dataAttributes;return{url:"".concat(e,"?").concat(r(o)),dataAttributes:i}}(t),s=c.url,d=c.dataAttributes;if(function(t,r){var o=document.querySelector('script[src="'.concat(t,'"]'));if(null===o)return null;var i=e(t,r);if(a(o.dataset)!==a(i.dataset))return null;var u=!0;return n(o.dataset,(function(t){o.dataset[t]!==i.dataset[t]&&(u=!1)})),u?o:null}(s,d)&&window.paypal)return o(window.paypal);i=!0,function(t){var r=t.url,n=t.dataAttributes,a=t.onSuccess,o=t.onError,i=e(r,n);i.onerror=o,i.onload=a,document.head.insertBefore(i,document.head.firstElementChild)}({url:s,dataAttributes:d,onSuccess:function(){return i=!1,window.paypal?o(window.paypal):u(new Error("The window.paypal global variable is not available."))},onError:function(){return i=!1,u(new Error('The script "'.concat(s,"\" didn't load correctly.")))}})}))},t.version="2.1.2",Object.defineProperty(t,"__esModule",{value:!0}),t}({});paypalLoadScript=paypalLoadScript.loadScript; | ||
var paypalLoadScript=function(t){"use strict";function r(t){var r="";return n(t,(function(e){0!==r.length&&(r+="&"),r+=e+"="+t[e]})),r}function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=document.createElement("script");return e.src=t,n(r,(function(t){e.setAttribute(t,r[t]),"data-csp-nonce"===t&&e.setAttribute("nonce",r["data-csp-nonce"])})),e}function n(t,r){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&r(e)}function a(t){var r=0;return n(t,(function(){return r++})),r}var o,i=!1;return t.loadScript=function(t,u){if(!(t instanceof Object))throw new Error("Invalid arguments. Expected an object to be passed into loadScript().");if(void 0===u){if("undefined"==typeof Promise)throw new Error("Failed to load the PayPal JS SDK script because Promise is undefined. To resolve the issue, use a Promise polyfill.");u=Promise}return i?o:o=new u((function(o,u){if("undefined"==typeof window)return o(null);var c=function(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL);var a={queryParams:{},dataAttributes:{}};n(t,(function(r){var e="data-"===r.substring(0,5)?"dataAttributes":"queryParams";a[e][r]=t[r].toString()}));var o=a.queryParams,i=a.dataAttributes;return{url:"".concat(e,"?").concat(r(o)),dataAttributes:i}}(t),s=c.url,d=c.dataAttributes;if(function(t,r){var o=document.querySelector('script[src="'.concat(t,'"]'));if(null===o)return null;var i=e(t,r);if(a(o.dataset)!==a(i.dataset))return null;var u=!0;return n(o.dataset,(function(t){o.dataset[t]!==i.dataset[t]&&(u=!1)})),u?o:null}(s,d)&&window.paypal)return o(window.paypal);i=!0,function(t){var r=t.url,n=t.dataAttributes,a=t.onSuccess,o=t.onError,i=e(r,n);i.onerror=o,i.onload=a,document.head.insertBefore(i,document.head.firstElementChild)}({url:s,dataAttributes:d,onSuccess:function(){return i=!1,window.paypal?o(window.paypal):u(new Error("The window.paypal global variable is not available."))},onError:function(){return i=!1,u(new Error('The script "'.concat(s,"\" didn't load correctly.")))}})}))},t.version="2.1.3",Object.defineProperty(t,"__esModule",{value:!0}),t}({});paypalLoadScript=paypalLoadScript.loadScript; |
/*! | ||
* paypal-js v2.1.2 (2021-01-10T17:22:23.865Z) | ||
* paypal-js v2.1.3 (2021-01-25T02:24:12.167Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -154,4 +154,4 @@ * | ||
var version = '2.1.2'; | ||
var version = '2.1.3'; | ||
export { loadScript, version }; |
/*! | ||
* paypal-js v2.1.2 (2021-01-10T17:22:23.865Z) | ||
* paypal-js v2.1.3 (2021-01-25T02:24:12.167Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -466,3 +466,3 @@ * | ||
// replaced with the package.json version at build time | ||
const version = '2.1.2'; | ||
const version = '2.1.3'; | ||
@@ -469,0 +469,0 @@ exports.loadScript = loadScript$1; |
/*! | ||
* paypal-js v2.1.2 (2021-01-10T17:22:23.865Z) | ||
* paypal-js v2.1.3 (2021-01-25T02:24:12.167Z) | ||
* 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=[],l(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 l((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 s(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function l(t,e){var n=!1;try{t((function(t){n||(n=!0,a(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(t){if(n)return;n=!0,u(e,t)}}function f(t){let e="";return p(t,(n=>{0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function d(t,e={}){const n=document.createElement("script");return n.src=t,p(e,(t=>{n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function p(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n)}function h(t){let e=0;return p(t,(()=>e++)),e}let y;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 s(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)};let v=!1;function w(t,e){if(!(t instanceof Object))throw new Error("Invalid arguments. Expected an object to be passed into loadScript().");if(void 0===e){if("undefined"==typeof Promise)throw new Error("Failed to load the PayPal JS SDK script because Promise is undefined. To resolve the issue, use a Promise polyfill.");e=Promise}return v?y:y=new e(((e,n)=>{if("undefined"==typeof window)return e(null);const{url:r,dataAttributes:o}=function(t){let e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL);const n={queryParams:{},dataAttributes:{}};p(t,(e=>{const r="data-"===e.substring(0,5)?"dataAttributes":"queryParams";n[r][e]=t[e].toString()}));const{queryParams:r,dataAttributes:o}=n;return{url:`${e}?${f(r)}`,dataAttributes:o}}(t);if(function(t,e){const n=document.querySelector(`script[src="${t}"]`);if(null===n)return null;const r=d(t,e);if(h(n.dataset)!==h(r.dataset))return null;let o=!0;return p(n.dataset,(t=>{n.dataset[t]!==r.dataset[t]&&(o=!1)})),o?n:null}(r,o)&&window.paypal)return e(window.paypal);v=!0,function({url:t,dataAttributes:e,onSuccess:n,onError:r}){const o=d(t,e);o.onerror=r,o.onload=n,document.head.insertBefore(o,document.head.firstElementChild)}({url:r,dataAttributes:o,onSuccess:()=>(v=!1,window.paypal?e(window.paypal):n(new Error("The window.paypal global variable is not available."))),onError:()=>(v=!1,n(new Error(`The script "${r}" didn't load correctly.`)))})}))}return t.loadScript=function(t){return w(t,o)},t.version="2.1.2",Object.defineProperty(t,"__esModule",{value:!0}),t}({});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=[],l(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 l((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 s(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function l(t,e){var n=!1;try{t((function(t){n||(n=!0,a(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(t){if(n)return;n=!0,u(e,t)}}function f(t){let e="";return p(t,(n=>{0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function d(t,e={}){const n=document.createElement("script");return n.src=t,p(e,(t=>{n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function p(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n)}function h(t){let e=0;return p(t,(()=>e++)),e}let y;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 s(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)};let v=!1;function w(t,e){if(!(t instanceof Object))throw new Error("Invalid arguments. Expected an object to be passed into loadScript().");if(void 0===e){if("undefined"==typeof Promise)throw new Error("Failed to load the PayPal JS SDK script because Promise is undefined. To resolve the issue, use a Promise polyfill.");e=Promise}return v?y:y=new e(((e,n)=>{if("undefined"==typeof window)return e(null);const{url:r,dataAttributes:o}=function(t){let e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL);const n={queryParams:{},dataAttributes:{}};p(t,(e=>{const r="data-"===e.substring(0,5)?"dataAttributes":"queryParams";n[r][e]=t[e].toString()}));const{queryParams:r,dataAttributes:o}=n;return{url:`${e}?${f(r)}`,dataAttributes:o}}(t);if(function(t,e){const n=document.querySelector(`script[src="${t}"]`);if(null===n)return null;const r=d(t,e);if(h(n.dataset)!==h(r.dataset))return null;let o=!0;return p(n.dataset,(t=>{n.dataset[t]!==r.dataset[t]&&(o=!1)})),o?n:null}(r,o)&&window.paypal)return e(window.paypal);v=!0,function({url:t,dataAttributes:e,onSuccess:n,onError:r}){const o=d(t,e);o.onerror=r,o.onload=n,document.head.insertBefore(o,document.head.firstElementChild)}({url:r,dataAttributes:o,onSuccess:()=>(v=!1,window.paypal?e(window.paypal):n(new Error("The window.paypal global variable is not available."))),onError:()=>(v=!1,n(new Error(`The script "${r}" didn't load correctly.`)))})}))}return t.loadScript=function(t){return w(t,o)},t.version="2.1.3",Object.defineProperty(t,"__esModule",{value:!0}),t}({});paypalLoadScript=paypalLoadScript.loadScript; |
/*! | ||
* paypal-js v2.1.2 (2021-01-10T17:22:23.865Z) | ||
* paypal-js v2.1.3 (2021-01-25T02:24:12.167Z) | ||
* Copyright 2020-present, PayPal, Inc. All rights reserved. | ||
@@ -158,5 +158,5 @@ * | ||
var version = '2.1.2'; | ||
var version = '2.1.3'; | ||
exports.loadScript = loadScript; | ||
exports.version = version; |
{ | ||
"name": "@paypal/paypal-js", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Client-side loader for the PayPal JS SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/paypal.node.js", |
@@ -65,5 +65,5 @@ # paypal-js | ||
### Setting Options | ||
### Passing Arguments | ||
The `options` object can be used to set query parameters and script attributes. | ||
The `loadScript` function accepts an object for configuring the JS SDK. It's used for setting query parameters and script attributes. | ||
@@ -155,4 +155,8 @@ #### Query Parameters | ||
Note that the above CDN location points to the latest release of paypal-js. It is advised that when you deploy your site, you import the specific version you have developed and tested with (ex: https://unpkg.com/@paypal/paypal-js@1.0.0/dist/paypal.browser.min.js). | ||
Note that the above CDN location points to the latest release of paypal-js. It is advised that when you deploy your site, you import the specific version you have developed and tested with (ex: https://unpkg.com/@paypal/paypal-js@2.1.3/dist/paypal.browser.min.js). | ||
## TypeScript Support | ||
This package includes TypeScript type definitions for the PayPal JS SDK. This includes types for the `window.paypal` namespace. We support projects using TypeScript versions >= 3.8. | ||
## Releasing | ||
@@ -159,0 +163,0 @@ |
@@ -1,2 +0,2 @@ | ||
// https://developer.paypal.com/docs/api/orders/v2 | ||
// https://developer.paypal.com/docs/api/orders/v2/#orders-create-request-body | ||
@@ -33,4 +33,4 @@ type SHIPPING_PREFERENCE = "GET_FROM_FILE" | "NO_SHIPPING" | "SET_PROVIDED_ADDRESS"; | ||
type Payee = { | ||
merchant_id: string; | ||
email_address: string; | ||
merchant_id?: string; | ||
email_address?: string; | ||
} | ||
@@ -57,3 +57,3 @@ | ||
amount: Amount; | ||
payee: Payee; | ||
payee?: Payee; | ||
} | ||
@@ -60,0 +60,0 @@ |
import type { CreateOrderRequestBody } from '../apis/orders'; | ||
import type { CreateSubscriptionRequestBody } from '../apis/subscriptions'; | ||
type CreateOrderData = Record<string, unknown>; | ||
@@ -11,2 +13,10 @@ | ||
type CreateSubscriptionData = Record<string, unknown>; | ||
type CreateSubscriptionActions = { | ||
subscription: { | ||
create: (options: CreateSubscriptionRequestBody) => Promise<string>; | ||
} | ||
}; | ||
type OnApproveOrderData = Record<string, unknown>; | ||
@@ -29,4 +39,5 @@ | ||
export interface PayPalButtonsComponentProps { | ||
createBillingAgreement?: () => Promise<string>; | ||
createOrder?: (data: CreateOrderData, actions: CreateOrderActions) => Promise<string>; | ||
createSubscription?: (data: Record<string, unknown>, actions: Record<string, unknown>) => void; | ||
createSubscription?: (data: CreateSubscriptionData, actions: CreateSubscriptionActions) => Promise<string>; | ||
@@ -33,0 +44,0 @@ fundingSource?: string; |
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
72888
17
1145
174