@stripe/react-stripe-js
Advanced tools
Comparing version 1.15.0 to 1.16.0
@@ -16,7 +16,11 @@ import { FunctionComponent, PropsWithChildren, ReactNode } from "react"; | ||
*/ | ||
onBlur?: () => any; | ||
onBlur?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
/** | ||
* Triggered when the Element receives focus. | ||
*/ | ||
onFocus?: () => any; | ||
onFocus?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
} | ||
@@ -767,5 +771,2 @@ interface AuBankAccountElementProps extends ElementProps { | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -772,0 +773,0 @@ */ |
@@ -16,7 +16,11 @@ import { FunctionComponent, PropsWithChildren, ReactNode } from "react"; | ||
*/ | ||
onBlur?: () => any; | ||
onBlur?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
/** | ||
* Triggered when the Element receives focus. | ||
*/ | ||
onFocus?: () => any; | ||
onFocus?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
} | ||
@@ -767,5 +771,2 @@ interface AuBankAccountElementProps extends ElementProps { | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -772,0 +773,0 @@ */ |
@@ -376,3 +376,3 @@ import React from 'react'; | ||
name: 'react-stripe-js', | ||
version: "1.15.0" | ||
version: "1.16.0" | ||
}); | ||
@@ -382,3 +382,3 @@ | ||
name: 'react-stripe-js', | ||
version: "1.15.0", | ||
version: "1.16.0", | ||
url: 'https://stripe.com/docs/stripe-js/react' | ||
@@ -788,5 +788,2 @@ }); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -793,0 +790,0 @@ */ |
@@ -382,3 +382,3 @@ 'use strict'; | ||
name: 'react-stripe-js', | ||
version: "1.15.0" | ||
version: "1.16.0" | ||
}); | ||
@@ -388,3 +388,3 @@ | ||
name: 'react-stripe-js', | ||
version: "1.15.0", | ||
version: "1.16.0", | ||
url: 'https://stripe.com/docs/stripe-js/react' | ||
@@ -794,5 +794,2 @@ }); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -799,0 +796,0 @@ */ |
@@ -16,7 +16,11 @@ import { FunctionComponent, PropsWithChildren, ReactNode } from "react"; | ||
*/ | ||
onBlur?: () => any; | ||
onBlur?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
/** | ||
* Triggered when the Element receives focus. | ||
*/ | ||
onFocus?: () => any; | ||
onFocus?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
} | ||
@@ -767,5 +771,2 @@ interface AuBankAccountElementProps extends ElementProps { | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -772,0 +773,0 @@ */ |
@@ -459,3 +459,3 @@ (function (global, factory) { | ||
name: 'react-stripe-js', | ||
version: "1.15.0" | ||
version: "1.16.0" | ||
}); | ||
@@ -465,3 +465,3 @@ | ||
name: 'react-stripe-js', | ||
version: "1.15.0", | ||
version: "1.16.0", | ||
url: 'https://stripe.com/docs/stripe-js/react' | ||
@@ -871,5 +871,2 @@ }); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -876,0 +873,0 @@ */ |
@@ -16,7 +16,11 @@ import { FunctionComponent, PropsWithChildren, ReactNode } from "react"; | ||
*/ | ||
onBlur?: () => any; | ||
onBlur?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
/** | ||
* Triggered when the Element receives focus. | ||
*/ | ||
onFocus?: () => any; | ||
onFocus?: (event: { | ||
elementType: stripeJs.StripeElementType; | ||
}) => any; | ||
} | ||
@@ -767,5 +771,2 @@ interface AuBankAccountElementProps extends ElementProps { | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -772,0 +773,0 @@ */ |
@@ -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";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function n(){}function r(){}r.resetWarningCache=n;var o=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(){function e(e,t,n,r,o,a){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==a){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 o={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:r,resetWarningCache:n};return o.PropTypes=o,o}()}));function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e){return(i="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 u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,a=[],c=!0,i=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);c=!0);}catch(e){i=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(i)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return l(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 l(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 l(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}var p=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},f=function(e){return null!==e&&"object"===i(e)},m=function(e,t,n){return f(e)?Object.keys(e).reduce((function(r,o){var a=!f(t)||!function e(t,n){if(!f(t)||!f(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 t===n;var a=Object.keys(t),c=Object.keys(n);if(a.length!==c.length)return!1;for(var i={},u=0;u<a.length;u+=1)i[a[u]]=!0;for(var s=0;s<c.length;s+=1)i[c[s]]=!0;var l=Object.keys(i);if(l.length!==a.length)return!1;var p=t,m=n;return l.every((function(t){return e(p[t],m[t])}))}(e[o],t[o]);return n.includes(o)?(a&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),r):a?c(c({},r||{}),{},u({},o,e[o])):r}),null):null},y=function(e){if(null===e||f(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.")},d=function(e){if(function(e){return f(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(y)};var t=y(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},h=t.createContext(null);h.displayName="ElementsContext";var v=t.createContext(null);v.displayName="CartElementContext";var g=function(e){var n=e.stripe,r=e.options,o=e.children,a=t.useMemo((function(){return d(n)}),[n]),c=s(t.useState(null),2),i=c[0],u=c[1],l=s(t.useState(null),2),f=l[0],y=l[1],g=s(t.useState((function(){return{stripe:"sync"===a.tag?a.stripe:null,elements:"sync"===a.tag?a.stripe.elements(r):null}})),2),E=g[0],b=g[1];t.useEffect((function(){var e=!0,t=function(e){b((function(t){return t.stripe?t:{stripe:e,elements:e.elements(r)}}))};return"async"!==a.tag||E.stripe?"sync"!==a.tag||E.stripe||t(a.stripe):a.stripePromise.then((function(n){n&&e&&t(n)})),function(){e=!1}}),[a,E,r]);var C=p(n);t.useEffect((function(){null!==C&&C!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")}),[C,n]);var O=p(r);return t.useEffect((function(){if(E.elements){var e=m(r,O,["clientSecret","fonts"]);e&&E.elements.update(e)}}),[r,O,E.elements]),t.useEffect((function(){var e=E.stripe;e&&e._registerWrapper&&e.registerAppInfo&&(e._registerWrapper({name:"react-stripe-js",version:"1.15.0"}),e.registerAppInfo({name:"react-stripe-js",version:"1.15.0",url:"https://stripe.com/docs/stripe-js/react"}))}),[E.stripe]),t.createElement(h.Provider,{value:E},t.createElement(v.Provider,{value:{cart:i,setCart:u,cartState:f,setCartState:y}},o))};g.propTypes={stripe:o.any,options:o.object};var E=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(h),e)},b=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(v),e)},C=function(e){return(0,e.children)(E("mounts <ElementsConsumer>"))};C.propTypes={children:o.func.isRequired};var O=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},S=function(){},j=function(e,n){var r,a="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),c=n?function(e){E("mounts <".concat(a,">")),b("mounts <".concat(a,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,o=n.className,c=n.options,i=void 0===c?{}:c,u=n.onBlur,s=void 0===u?S:u,l=n.onFocus,f=void 0===l?S:l,y=n.onReady,d=void 0===y?S:y,h=n.onChange,v=void 0===h?S:h,g=n.onEscape,C=void 0===g?S:g,j=n.onClick,k=void 0===j?S:j,w=n.onLoadError,P=void 0===w?S:w,A=n.onLoaderStart,x=void 0===A?S:A,R=n.onNetworksChange,B=void 0===R?S:R,T=n.onCheckout,_=void 0===T?S:T,I=n.onLineItemClick,N=void 0===I?S:I,M=n.onConfirm,L=void 0===M?S:M,q=n.onCancel,D=void 0===q?S:q,U=n.onShippingAddressChange,W=void 0===U?S:U,F=n.onShippingRateChange,Y=void 0===F?S:F,H=E("mounts <".concat(a,">")).elements,V=t.useRef(null),$=t.useRef(null),z=b("mounts <".concat(a,">")),G=z.setCart,J=z.setCartState,K=O(d),Q=O(s),X=O(f),Z=O(k),ee=O(v),te=O(C),ne=O(P),re=O(x),oe=O(B),ae=O(_),ce=O(N),ie=O(L),ue=O(D),se=O(W),le=O(Y);t.useLayoutEffect((function(){if(null==V.current&&H&&null!=$.current){var t=H.create(e,i);"cart"===e&&G&&G(t),V.current=t,t.mount($.current),t.on("ready",(function(n){"cart"===e?(J&&J(n),K(n)):K("payButton"===e?n:t)})),t.on("change",(function(t){"cart"===e&&J&&J(t),ee(t)})),t.on("blur",Q),t.on("focus",X),t.on("escape",te),t.on("loaderror",ne),t.on("loaderstart",re),t.on("networkschange",oe),t.on("click",Z),t.on("checkout",(function(t){"cart"===e&&J&&J(t),ae(t)})),t.on("lineitemclick",ce),t.on("confirm",ie),t.on("cancel",ue),t.on("shippingaddresschange",se),t.on("shippingratechange",le)}}));var pe=p(i);return t.useEffect((function(){if(V.current){var e=m(i,pe,["paymentRequest"]);e&&V.current.update(e)}}),[i,pe]),t.useLayoutEffect((function(){return function(){V.current&&(V.current.destroy(),V.current=null)}}),[]),t.createElement("div",{id:r,className:o,ref:$})};return c.propTypes={id:o.string,className:o.string,onChange:o.func,onBlur:o.func,onFocus:o.func,onReady:o.func,onEscape:o.func,onClick:o.func,onLoadError:o.func,onLoaderStart:o.func,onNetworksChange:o.func,onCheckout:o.func,onLineItemClick:o.func,onConfirm:o.func,onCancel:o.func,onShippingAddressChange:o.func,onShippingRateChange:o.func,options:o.object},c.displayName=a,c.__elementType=e,c},k="undefined"==typeof window,w=j("auBankAccount",k),P=j("card",k),A=j("cardNumber",k),x=j("cardExpiry",k),R=j("cardCvc",k),B=j("fpxBank",k),T=j("iban",k),_=j("idealBank",k),I=j("p24Bank",k),N=j("epsBank",k),M=j("payment",k),L=j("payButton",k),q=j("paymentRequestButton",k),D=j("linkAuthentication",k),U=j("address",k),W=j("shippingAddress",k),F=j("cart",k),Y=j("paymentMethodMessaging",k),H=j("affirmMessage",k),V=j("afterpayClearpayMessage",k);e.AddressElement=U,e.AffirmMessageElement=H,e.AfterpayClearpayMessageElement=V,e.AuBankAccountElement=w,e.CardCvcElement=R,e.CardElement=P,e.CardExpiryElement=x,e.CardNumberElement=A,e.CartElement=F,e.Elements=g,e.ElementsConsumer=C,e.EpsBankElement=N,e.FpxBankElement=B,e.IbanElement=T,e.IdealBankElement=_,e.LinkAuthenticationElement=D,e.P24BankElement=I,e.PayButtonElement=L,e.PaymentElement=M,e.PaymentMethodMessagingElement=Y,e.PaymentRequestButtonElement=q,e.ShippingAddressElement=W,e.useCartElement=function(){return b("calls useCartElement()").cart},e.useCartElementState=function(){return b("calls useCartElementState()").cartState},e.useElements=function(){return E("calls useElements()").elements},e.useStripe=function(){return E("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";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;function n(){}function r(){}r.resetWarningCache=n;var o=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(){function e(e,t,n,r,o,a){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==a){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 o={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:r,resetWarningCache:n};return o.PropTypes=o,o}()}));function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e){return(i="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 u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,a=[],c=!0,i=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);c=!0);}catch(e){i=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(i)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return l(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 l(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 l(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}var p=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},f=function(e){return null!==e&&"object"===i(e)},m=function(e,t,n){return f(e)?Object.keys(e).reduce((function(r,o){var a=!f(t)||!function e(t,n){if(!f(t)||!f(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 t===n;var a=Object.keys(t),c=Object.keys(n);if(a.length!==c.length)return!1;for(var i={},u=0;u<a.length;u+=1)i[a[u]]=!0;for(var s=0;s<c.length;s+=1)i[c[s]]=!0;var l=Object.keys(i);if(l.length!==a.length)return!1;var p=t,m=n;return l.every((function(t){return e(p[t],m[t])}))}(e[o],t[o]);return n.includes(o)?(a&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),r):a?c(c({},r||{}),{},u({},o,e[o])):r}),null):null},y=function(e){if(null===e||f(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.")},d=function(e){if(function(e){return f(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(y)};var t=y(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},h=t.createContext(null);h.displayName="ElementsContext";var v=t.createContext(null);v.displayName="CartElementContext";var g=function(e){var n=e.stripe,r=e.options,o=e.children,a=t.useMemo((function(){return d(n)}),[n]),c=s(t.useState(null),2),i=c[0],u=c[1],l=s(t.useState(null),2),f=l[0],y=l[1],g=s(t.useState((function(){return{stripe:"sync"===a.tag?a.stripe:null,elements:"sync"===a.tag?a.stripe.elements(r):null}})),2),E=g[0],b=g[1];t.useEffect((function(){var e=!0,t=function(e){b((function(t){return t.stripe?t:{stripe:e,elements:e.elements(r)}}))};return"async"!==a.tag||E.stripe?"sync"!==a.tag||E.stripe||t(a.stripe):a.stripePromise.then((function(n){n&&e&&t(n)})),function(){e=!1}}),[a,E,r]);var C=p(n);t.useEffect((function(){null!==C&&C!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")}),[C,n]);var O=p(r);return t.useEffect((function(){if(E.elements){var e=m(r,O,["clientSecret","fonts"]);e&&E.elements.update(e)}}),[r,O,E.elements]),t.useEffect((function(){var e=E.stripe;e&&e._registerWrapper&&e.registerAppInfo&&(e._registerWrapper({name:"react-stripe-js",version:"1.16.0"}),e.registerAppInfo({name:"react-stripe-js",version:"1.16.0",url:"https://stripe.com/docs/stripe-js/react"}))}),[E.stripe]),t.createElement(h.Provider,{value:E},t.createElement(v.Provider,{value:{cart:i,setCart:u,cartState:f,setCartState:y}},o))};g.propTypes={stripe:o.any,options:o.object};var E=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(h),e)},b=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(v),e)},C=function(e){return(0,e.children)(E("mounts <ElementsConsumer>"))};C.propTypes={children:o.func.isRequired};var O=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},S=function(){},j=function(e,n){var r,a="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),c=n?function(e){E("mounts <".concat(a,">")),b("mounts <".concat(a,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,o=n.className,c=n.options,i=void 0===c?{}:c,u=n.onBlur,s=void 0===u?S:u,l=n.onFocus,f=void 0===l?S:l,y=n.onReady,d=void 0===y?S:y,h=n.onChange,v=void 0===h?S:h,g=n.onEscape,C=void 0===g?S:g,j=n.onClick,k=void 0===j?S:j,w=n.onLoadError,P=void 0===w?S:w,A=n.onLoaderStart,x=void 0===A?S:A,R=n.onNetworksChange,B=void 0===R?S:R,T=n.onCheckout,_=void 0===T?S:T,I=n.onLineItemClick,N=void 0===I?S:I,M=n.onConfirm,L=void 0===M?S:M,q=n.onCancel,D=void 0===q?S:q,U=n.onShippingAddressChange,W=void 0===U?S:U,F=n.onShippingRateChange,Y=void 0===F?S:F,H=E("mounts <".concat(a,">")).elements,V=t.useRef(null),$=t.useRef(null),z=b("mounts <".concat(a,">")),G=z.setCart,J=z.setCartState,K=O(d),Q=O(s),X=O(f),Z=O(k),ee=O(v),te=O(C),ne=O(P),re=O(x),oe=O(B),ae=O(_),ce=O(N),ie=O(L),ue=O(D),se=O(W),le=O(Y);t.useLayoutEffect((function(){if(null==V.current&&H&&null!=$.current){var t=H.create(e,i);"cart"===e&&G&&G(t),V.current=t,t.mount($.current),t.on("ready",(function(n){"cart"===e?(J&&J(n),K(n)):K("payButton"===e?n:t)})),t.on("change",(function(t){"cart"===e&&J&&J(t),ee(t)})),t.on("blur",Q),t.on("focus",X),t.on("escape",te),t.on("loaderror",ne),t.on("loaderstart",re),t.on("networkschange",oe),t.on("click",Z),t.on("checkout",(function(t){"cart"===e&&J&&J(t),ae(t)})),t.on("lineitemclick",ce),t.on("confirm",ie),t.on("cancel",ue),t.on("shippingaddresschange",se),t.on("shippingratechange",le)}}));var pe=p(i);return t.useEffect((function(){if(V.current){var e=m(i,pe,["paymentRequest"]);e&&V.current.update(e)}}),[i,pe]),t.useLayoutEffect((function(){return function(){V.current&&(V.current.destroy(),V.current=null)}}),[]),t.createElement("div",{id:r,className:o,ref:$})};return c.propTypes={id:o.string,className:o.string,onChange:o.func,onBlur:o.func,onFocus:o.func,onReady:o.func,onEscape:o.func,onClick:o.func,onLoadError:o.func,onLoaderStart:o.func,onNetworksChange:o.func,onCheckout:o.func,onLineItemClick:o.func,onConfirm:o.func,onCancel:o.func,onShippingAddressChange:o.func,onShippingRateChange:o.func,options:o.object},c.displayName=a,c.__elementType=e,c},k="undefined"==typeof window,w=j("auBankAccount",k),P=j("card",k),A=j("cardNumber",k),x=j("cardExpiry",k),R=j("cardCvc",k),B=j("fpxBank",k),T=j("iban",k),_=j("idealBank",k),I=j("p24Bank",k),N=j("epsBank",k),M=j("payment",k),L=j("payButton",k),q=j("paymentRequestButton",k),D=j("linkAuthentication",k),U=j("address",k),W=j("shippingAddress",k),F=j("cart",k),Y=j("paymentMethodMessaging",k),H=j("affirmMessage",k),V=j("afterpayClearpayMessage",k);e.AddressElement=U,e.AffirmMessageElement=H,e.AfterpayClearpayMessageElement=V,e.AuBankAccountElement=w,e.CardCvcElement=R,e.CardElement=P,e.CardExpiryElement=x,e.CardNumberElement=A,e.CartElement=F,e.Elements=g,e.ElementsConsumer=C,e.EpsBankElement=N,e.FpxBankElement=B,e.IbanElement=T,e.IdealBankElement=_,e.LinkAuthenticationElement=D,e.P24BankElement=I,e.PayButtonElement=L,e.PaymentElement=M,e.PaymentMethodMessagingElement=Y,e.PaymentRequestButtonElement=q,e.ShippingAddressElement=W,e.useCartElement=function(){return b("calls useCartElement()").cart},e.useCartElementState=function(){return b("calls useCartElementState()").cartState},e.useElements=function(){return E("calls useElements()").elements},e.useStripe=function(){return E("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@stripe/react-stripe-js", | ||
"version": "1.15.0", | ||
"version": "1.16.0", | ||
"description": "React components for Stripe.js and Stripe Elements", | ||
@@ -65,3 +65,3 @@ "main": "dist/react-stripe.js", | ||
"@storybook/react": "^6.5.0-beta.8", | ||
"@stripe/stripe-js": "^1.44.1", | ||
"@stripe/stripe-js": "^1.46.0", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
@@ -68,0 +68,0 @@ "@testing-library/react": "^13.1.1", |
@@ -157,5 +157,2 @@ import createElementComponent from './components/createElementComponent'; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
@@ -162,0 +159,0 @@ */ |
@@ -19,3 +19,3 @@ import {FunctionComponent} from 'react'; | ||
*/ | ||
onBlur?: () => any; | ||
onBlur?: (event: {elementType: stripeJs.StripeElementType}) => any; | ||
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
onFocus?: () => any; | ||
onFocus?: (event: {elementType: stripeJs.StripeElementType}) => any; | ||
} | ||
@@ -28,0 +28,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
388433
8147