@stripe/react-stripe-js
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -303,3 +303,3 @@ import React from 'react'; | ||
name: 'react-stripe-js', | ||
version: "1.2.1" | ||
version: "1.2.2" | ||
}); | ||
@@ -447,3 +447,3 @@ }, [ctx.stripe]); | ||
}, [options]); | ||
React.useEffect(function () { | ||
React.useLayoutEffect(function () { | ||
return function () { | ||
@@ -450,0 +450,0 @@ if (elementRef.current) { |
@@ -309,3 +309,3 @@ 'use strict'; | ||
name: 'react-stripe-js', | ||
version: "1.2.1" | ||
version: "1.2.2" | ||
}); | ||
@@ -453,3 +453,3 @@ }, [ctx.stripe]); | ||
}, [options]); | ||
React.useEffect(function () { | ||
React.useLayoutEffect(function () { | ||
return function () { | ||
@@ -456,0 +456,0 @@ if (elementRef.current) { |
@@ -386,3 +386,3 @@ (function (global, factory) { | ||
name: 'react-stripe-js', | ||
version: "1.2.1" | ||
version: "1.2.2" | ||
}); | ||
@@ -530,3 +530,3 @@ }, [ctx.stripe]); | ||
}, [options]); | ||
React.useEffect(function () { | ||
React.useLayoutEffect(function () { | ||
return function () { | ||
@@ -533,0 +533,0 @@ if (elementRef.current) { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactStripe={},e.React)}(this,(function(e,t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,u=void 0;try{for(var c,i=e[Symbol.iterator]();!(r=(c=i.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,u=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw u}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function c(){}function i(){}i.resetWarningCache=c;var a=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(){function e(e,t,n,r,o,u){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==u){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:c};return n.PropTypes=n,n}()})),s=function(e){return null!==e&&"object"===n(e)},p=function e(t,n){if(!s(t)||!s(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var o="[object Object]"===Object.prototype.toString.call(t);if(o!==("[object Object]"===Object.prototype.toString.call(n)))return!1;if(!o&&!r)return!1;var u=Object.keys(t),c=Object.keys(n);if(u.length!==c.length)return!1;for(var i={},a=0;a<u.length;a+=1)i[u[a]]=!0;for(var p=0;p<c.length;p+=1)i[c[p]]=!0;var f=Object.keys(i);if(f.length!==u.length)return!1;var l=t,y=n;return f.every((function(t){return e(l[t],y[t])}))},f=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},l=function(e){if(null===e||s(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},y=function(e){if(function(e){return s(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(l)};var t=l(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},m=t.createContext(null);m.displayName="ElementsContext";var d=function(e){var n=e.stripe,r=e.options,u=e.children,c=t.useRef(!1),i=t.useRef(!0),a=t.useMemo((function(){return y(n)}),[n]),s=o(t.useState((function(){return{stripe:null,elements:null}})),2),l=s[0],d=s[1],v=f(n),h=f(r);return null!==v&&(v!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),p(r,h)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),c.current||("sync"===a.tag&&(c.current=!0,d({stripe:a.stripe,elements:a.stripe.elements(r)})),"async"===a.tag&&(c.current=!0,a.stripePromise.then((function(e){e&&i.current&&d({stripe:e,elements:e.elements(r)})})))),t.useEffect((function(){return function(){i.current=!1}}),[]),t.useEffect((function(){var e=l.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.2.1"})}),[l.stripe]),t.createElement(m.Provider,{value:l},u)};d.propTypes={stripe:a.any,options:a.object};var v=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(m),e)},h=function(e){return(0,e.children)(v("mounts <ElementsConsumer>"))};h.propTypes={children:a.func.isRequired};var b=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},g=function(e){if(!s(e))return{};e.paymentRequest;return r(e,["paymentRequest"])},E=function(){},O=function(e,n){var r,o="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),u=n?function(e){v("mounts <".concat(o,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,u=n.className,c=n.options,i=void 0===c?{}:c,a=n.onBlur,s=void 0===a?E:a,f=n.onFocus,l=void 0===f?E:f,y=n.onReady,m=void 0===y?E:y,d=n.onChange,h=void 0===d?E:d,O=n.onEscape,j=void 0===O?E:O,S=n.onClick,R=void 0===S?E:S,C=v("mounts <".concat(o,">")).elements,k=t.useRef(null),w=t.useRef(null),x=b(m),P=b(s),T=b(l),A=b(R),_=b(h),B=b(j);t.useLayoutEffect((function(){if(null==k.current&&C&&null!=w.current){var t=C.create(e,i);k.current=t,t.mount(w.current),t.on("ready",(function(){return x(t)})),t.on("change",_),t.on("blur",P),t.on("focus",T),t.on("escape",B),t.on("click",A)}}));var I=t.useRef(i);return t.useEffect((function(){I.current&&I.current.paymentRequest!==i.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=g(i);0===Object.keys(e).length||p(e,g(I.current))||k.current&&(k.current.update(e),I.current=i)}),[i]),t.useEffect((function(){return function(){k.current&&k.current.destroy()}}),[]),t.createElement("div",{id:r,className:u,ref:w})};return u.propTypes={id:a.string,className:a.string,onChange:a.func,onBlur:a.func,onFocus:a.func,onReady:a.func,onClick:a.func,options:a.object},u.displayName=o,u.__elementType=e,u},j="undefined"==typeof window,S=O("auBankAccount",j),R=O("card",j),C=O("cardNumber",j),k=O("cardExpiry",j),w=O("cardCvc",j),x=O("fpxBank",j),P=O("iban",j),T=O("idealBank",j),A=O("paymentRequestButton",j);e.AuBankAccountElement=S,e.CardCvcElement=w,e.CardElement=R,e.CardExpiryElement=k,e.CardNumberElement=C,e.Elements=d,e.ElementsConsumer=h,e.FpxBankElement=x,e.IbanElement=P,e.IdealBankElement=T,e.PaymentRequestButtonElement=A,e.useElements=function(){return v("calls useElements()").elements},e.useStripe=function(){return v("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactStripe={},e.React)}(this,(function(e,t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,u=void 0;try{for(var c,i=e[Symbol.iterator]();!(r=(c=i.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,u=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw u}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function c(){}function i(){}i.resetWarningCache=c;var a=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(){function e(e,t,n,r,o,u){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==u){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:c};return n.PropTypes=n,n}()})),s=function(e){return null!==e&&"object"===n(e)},p=function e(t,n){if(!s(t)||!s(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var o="[object Object]"===Object.prototype.toString.call(t);if(o!==("[object Object]"===Object.prototype.toString.call(n)))return!1;if(!o&&!r)return!1;var u=Object.keys(t),c=Object.keys(n);if(u.length!==c.length)return!1;for(var i={},a=0;a<u.length;a+=1)i[u[a]]=!0;for(var p=0;p<c.length;p+=1)i[c[p]]=!0;var f=Object.keys(i);if(f.length!==u.length)return!1;var l=t,y=n;return f.every((function(t){return e(l[t],y[t])}))},f=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},l=function(e){if(null===e||s(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},y=function(e){if(function(e){return s(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(l)};var t=l(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},m=t.createContext(null);m.displayName="ElementsContext";var d=function(e){var n=e.stripe,r=e.options,u=e.children,c=t.useRef(!1),i=t.useRef(!0),a=t.useMemo((function(){return y(n)}),[n]),s=o(t.useState((function(){return{stripe:null,elements:null}})),2),l=s[0],d=s[1],v=f(n),h=f(r);return null!==v&&(v!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),p(r,h)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),c.current||("sync"===a.tag&&(c.current=!0,d({stripe:a.stripe,elements:a.stripe.elements(r)})),"async"===a.tag&&(c.current=!0,a.stripePromise.then((function(e){e&&i.current&&d({stripe:e,elements:e.elements(r)})})))),t.useEffect((function(){return function(){i.current=!1}}),[]),t.useEffect((function(){var e=l.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.2.2"})}),[l.stripe]),t.createElement(m.Provider,{value:l},u)};d.propTypes={stripe:a.any,options:a.object};var v=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(m),e)},h=function(e){return(0,e.children)(v("mounts <ElementsConsumer>"))};h.propTypes={children:a.func.isRequired};var b=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},g=function(e){if(!s(e))return{};e.paymentRequest;return r(e,["paymentRequest"])},E=function(){},O=function(e,n){var r,o="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),u=n?function(e){v("mounts <".concat(o,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,u=n.className,c=n.options,i=void 0===c?{}:c,a=n.onBlur,s=void 0===a?E:a,f=n.onFocus,l=void 0===f?E:f,y=n.onReady,m=void 0===y?E:y,d=n.onChange,h=void 0===d?E:d,O=n.onEscape,j=void 0===O?E:O,S=n.onClick,R=void 0===S?E:S,C=v("mounts <".concat(o,">")).elements,k=t.useRef(null),w=t.useRef(null),x=b(m),P=b(s),T=b(l),A=b(R),_=b(h),B=b(j);t.useLayoutEffect((function(){if(null==k.current&&C&&null!=w.current){var t=C.create(e,i);k.current=t,t.mount(w.current),t.on("ready",(function(){return x(t)})),t.on("change",_),t.on("blur",P),t.on("focus",T),t.on("escape",B),t.on("click",A)}}));var I=t.useRef(i);return t.useEffect((function(){I.current&&I.current.paymentRequest!==i.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=g(i);0===Object.keys(e).length||p(e,g(I.current))||k.current&&(k.current.update(e),I.current=i)}),[i]),t.useLayoutEffect((function(){return function(){k.current&&k.current.destroy()}}),[]),t.createElement("div",{id:r,className:u,ref:w})};return u.propTypes={id:a.string,className:a.string,onChange:a.func,onBlur:a.func,onFocus:a.func,onReady:a.func,onClick:a.func,options:a.object},u.displayName=o,u.__elementType=e,u},j="undefined"==typeof window,S=O("auBankAccount",j),R=O("card",j),C=O("cardNumber",j),k=O("cardExpiry",j),w=O("cardCvc",j),x=O("fpxBank",j),P=O("iban",j),T=O("idealBank",j),A=O("paymentRequestButton",j);e.AuBankAccountElement=S,e.CardCvcElement=w,e.CardElement=R,e.CardExpiryElement=k,e.CardNumberElement=C,e.Elements=d,e.ElementsConsumer=h,e.FpxBankElement=x,e.IbanElement=P,e.IdealBankElement=T,e.PaymentRequestButtonElement=A,e.useElements=function(){return v("calls useElements()").elements},e.useStripe=function(){return v("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@stripe/react-stripe-js", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "React components for Stripe.js and Stripe Elements", | ||
@@ -5,0 +5,0 @@ "main": "dist/react-stripe.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
202871
4338