@stripe/react-stripe-js
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -209,2 +209,19 @@ import { FunctionComponent, ReactNode } from "react"; | ||
} | ||
interface LinkAuthenticationElementProps extends ElementProps { | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeLinkAuthenticationElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeLinkAuthenticationElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type LinkAuthenticationElementComponent = FunctionComponent<LinkAuthenticationElementProps>; | ||
type P24BankElementComponent = FunctionComponent<P24BankElementProps>; | ||
@@ -268,2 +285,23 @@ interface EpsBankElementProps extends ElementProps { | ||
type PaymentRequestButtonElementComponent = FunctionComponent<PaymentRequestButtonElementProps>; | ||
interface ShippingAddressElementProps extends ElementProps { | ||
/** | ||
* An object containing [Element configuration options](https://stripe.com/docs/js/elements_object/create_element?type=afterpayClearpayMessage). | ||
*/ | ||
options?: stripeJs.StripeShippingAddressElementOptions; | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeShippingAddressElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeShippingAddressElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type ShippingAddressElementComponent = FunctionComponent<ShippingAddressElementProps>; | ||
interface AfterpayClearpayMessageElementProps { | ||
@@ -344,2 +382,7 @@ /** | ||
getElement(component: EpsBankElementComponent): stripeJs.StripeEpsBankElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `LinkAuthenticationElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `LinkAuthenticationElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: LinkAuthenticationElementComponent): stripeJs.StripeLinkAuthenticationElement | null; | ||
getElement(component: PaymentElementComponent): stripeJs.StripeElement | null; | ||
@@ -352,2 +395,7 @@ /** | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `ShippingAddressElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `ShippingAddressElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: ShippingAddressElementComponent): stripeJs.StripeShippingAddressElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `PaymentRequestButtonElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
@@ -453,5 +501,19 @@ * Returns `null` if no `PaymentRequestButtonElement` is rendered in the current `Elements` provider tree. | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const LinkAuthenticationElement: LinkAuthenticationElementComponent; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const ShippingAddressElement: ShippingAddressElementComponent; | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const AfterpayClearpayMessageElement: AfterpayClearpayMessageElementComponent; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, AfterpayClearpayMessageElement }; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, LinkAuthenticationElementProps, LinkAuthenticationElementComponent, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, ShippingAddressElementProps, ShippingAddressElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, LinkAuthenticationElement, ShippingAddressElement, AfterpayClearpayMessageElement }; |
@@ -209,2 +209,19 @@ import { FunctionComponent, ReactNode } from "react"; | ||
} | ||
interface LinkAuthenticationElementProps extends ElementProps { | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeLinkAuthenticationElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeLinkAuthenticationElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type LinkAuthenticationElementComponent = FunctionComponent<LinkAuthenticationElementProps>; | ||
type P24BankElementComponent = FunctionComponent<P24BankElementProps>; | ||
@@ -268,2 +285,23 @@ interface EpsBankElementProps extends ElementProps { | ||
type PaymentRequestButtonElementComponent = FunctionComponent<PaymentRequestButtonElementProps>; | ||
interface ShippingAddressElementProps extends ElementProps { | ||
/** | ||
* An object containing [Element configuration options](https://stripe.com/docs/js/elements_object/create_element?type=afterpayClearpayMessage). | ||
*/ | ||
options?: stripeJs.StripeShippingAddressElementOptions; | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeShippingAddressElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeShippingAddressElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type ShippingAddressElementComponent = FunctionComponent<ShippingAddressElementProps>; | ||
interface AfterpayClearpayMessageElementProps { | ||
@@ -344,2 +382,7 @@ /** | ||
getElement(component: EpsBankElementComponent): stripeJs.StripeEpsBankElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `LinkAuthenticationElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `LinkAuthenticationElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: LinkAuthenticationElementComponent): stripeJs.StripeLinkAuthenticationElement | null; | ||
getElement(component: PaymentElementComponent): stripeJs.StripeElement | null; | ||
@@ -352,2 +395,7 @@ /** | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `ShippingAddressElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `ShippingAddressElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: ShippingAddressElementComponent): stripeJs.StripeShippingAddressElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `PaymentRequestButtonElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
@@ -453,5 +501,19 @@ * Returns `null` if no `PaymentRequestButtonElement` is rendered in the current `Elements` provider tree. | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const LinkAuthenticationElement: LinkAuthenticationElementComponent; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const ShippingAddressElement: ShippingAddressElementComponent; | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const AfterpayClearpayMessageElement: AfterpayClearpayMessageElementComponent; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, AfterpayClearpayMessageElement }; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, LinkAuthenticationElementProps, LinkAuthenticationElementComponent, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, ShippingAddressElementProps, ShippingAddressElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, LinkAuthenticationElement, ShippingAddressElement, AfterpayClearpayMessageElement }; |
@@ -347,3 +347,3 @@ import React from 'react'; | ||
name: 'react-stripe-js', | ||
version: "1.5.0" | ||
version: "1.6.0" | ||
}); | ||
@@ -353,3 +353,3 @@ | ||
name: 'react-stripe-js', | ||
version: "1.5.0", | ||
version: "1.6.0", | ||
url: 'https://stripe.com/docs/stripe-js/react' | ||
@@ -587,7 +587,23 @@ }); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var LinkAuthenticationElement = createElementComponent('linkAuthentication', isServer); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var ShippingAddressElement = createElementComponent('shippingAddress', isServer); | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer); | ||
export { AfterpayClearpayMessageElement, AuBankAccountElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, Elements, ElementsConsumer, EpsBankElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, PaymentElement, PaymentRequestButtonElement, useElements, useStripe }; | ||
export { AfterpayClearpayMessageElement, AuBankAccountElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, Elements, ElementsConsumer, EpsBankElement, FpxBankElement, IbanElement, IdealBankElement, LinkAuthenticationElement, P24BankElement, PaymentElement, PaymentRequestButtonElement, ShippingAddressElement, useElements, useStripe }; |
@@ -353,3 +353,3 @@ 'use strict'; | ||
name: 'react-stripe-js', | ||
version: "1.5.0" | ||
version: "1.6.0" | ||
}); | ||
@@ -359,3 +359,3 @@ | ||
name: 'react-stripe-js', | ||
version: "1.5.0", | ||
version: "1.6.0", | ||
url: 'https://stripe.com/docs/stripe-js/react' | ||
@@ -593,5 +593,21 @@ }); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var LinkAuthenticationElement = createElementComponent('linkAuthentication', isServer); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var ShippingAddressElement = createElementComponent('shippingAddress', isServer); | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer); | ||
@@ -611,6 +627,8 @@ | ||
exports.IdealBankElement = IdealBankElement; | ||
exports.LinkAuthenticationElement = LinkAuthenticationElement; | ||
exports.P24BankElement = P24BankElement; | ||
exports.PaymentElement = PaymentElement; | ||
exports.PaymentRequestButtonElement = PaymentRequestButtonElement; | ||
exports.ShippingAddressElement = ShippingAddressElement; | ||
exports.useElements = useElements; | ||
exports.useStripe = useStripe; |
@@ -209,2 +209,19 @@ import { FunctionComponent, ReactNode } from "react"; | ||
} | ||
interface LinkAuthenticationElementProps extends ElementProps { | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeLinkAuthenticationElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeLinkAuthenticationElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type LinkAuthenticationElementComponent = FunctionComponent<LinkAuthenticationElementProps>; | ||
type P24BankElementComponent = FunctionComponent<P24BankElementProps>; | ||
@@ -268,2 +285,23 @@ interface EpsBankElementProps extends ElementProps { | ||
type PaymentRequestButtonElementComponent = FunctionComponent<PaymentRequestButtonElementProps>; | ||
interface ShippingAddressElementProps extends ElementProps { | ||
/** | ||
* An object containing [Element configuration options](https://stripe.com/docs/js/elements_object/create_element?type=afterpayClearpayMessage). | ||
*/ | ||
options?: stripeJs.StripeShippingAddressElementOptions; | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeShippingAddressElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeShippingAddressElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type ShippingAddressElementComponent = FunctionComponent<ShippingAddressElementProps>; | ||
interface AfterpayClearpayMessageElementProps { | ||
@@ -344,2 +382,7 @@ /** | ||
getElement(component: EpsBankElementComponent): stripeJs.StripeEpsBankElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `LinkAuthenticationElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `LinkAuthenticationElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: LinkAuthenticationElementComponent): stripeJs.StripeLinkAuthenticationElement | null; | ||
getElement(component: PaymentElementComponent): stripeJs.StripeElement | null; | ||
@@ -352,2 +395,7 @@ /** | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `ShippingAddressElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `ShippingAddressElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: ShippingAddressElementComponent): stripeJs.StripeShippingAddressElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `PaymentRequestButtonElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
@@ -453,5 +501,19 @@ * Returns `null` if no `PaymentRequestButtonElement` is rendered in the current `Elements` provider tree. | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const LinkAuthenticationElement: LinkAuthenticationElementComponent; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const ShippingAddressElement: ShippingAddressElementComponent; | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const AfterpayClearpayMessageElement: AfterpayClearpayMessageElementComponent; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, AfterpayClearpayMessageElement }; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, LinkAuthenticationElementProps, LinkAuthenticationElementComponent, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, ShippingAddressElementProps, ShippingAddressElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, LinkAuthenticationElement, ShippingAddressElement, AfterpayClearpayMessageElement }; |
@@ -430,3 +430,3 @@ (function (global, factory) { | ||
name: 'react-stripe-js', | ||
version: "1.5.0" | ||
version: "1.6.0" | ||
}); | ||
@@ -436,3 +436,3 @@ | ||
name: 'react-stripe-js', | ||
version: "1.5.0", | ||
version: "1.6.0", | ||
url: 'https://stripe.com/docs/stripe-js/react' | ||
@@ -670,5 +670,21 @@ }); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var LinkAuthenticationElement = createElementComponent('linkAuthentication', isServer); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var ShippingAddressElement = createElementComponent('shippingAddress', isServer); | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer); | ||
@@ -688,5 +704,7 @@ | ||
exports.IdealBankElement = IdealBankElement; | ||
exports.LinkAuthenticationElement = LinkAuthenticationElement; | ||
exports.P24BankElement = P24BankElement; | ||
exports.PaymentElement = PaymentElement; | ||
exports.PaymentRequestButtonElement = PaymentRequestButtonElement; | ||
exports.ShippingAddressElement = ShippingAddressElement; | ||
exports.useElements = useElements; | ||
@@ -693,0 +711,0 @@ exports.useStripe = useStripe; |
@@ -209,2 +209,19 @@ import { FunctionComponent, ReactNode } from "react"; | ||
} | ||
interface LinkAuthenticationElementProps extends ElementProps { | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeLinkAuthenticationElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeLinkAuthenticationElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type LinkAuthenticationElementComponent = FunctionComponent<LinkAuthenticationElementProps>; | ||
type P24BankElementComponent = FunctionComponent<P24BankElementProps>; | ||
@@ -268,2 +285,23 @@ interface EpsBankElementProps extends ElementProps { | ||
type PaymentRequestButtonElementComponent = FunctionComponent<PaymentRequestButtonElementProps>; | ||
interface ShippingAddressElementProps extends ElementProps { | ||
/** | ||
* An object containing [Element configuration options](https://stripe.com/docs/js/elements_object/create_element?type=afterpayClearpayMessage). | ||
*/ | ||
options?: stripeJs.StripeShippingAddressElementOptions; | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeShippingAddressElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeShippingAddressElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
type ShippingAddressElementComponent = FunctionComponent<ShippingAddressElementProps>; | ||
interface AfterpayClearpayMessageElementProps { | ||
@@ -344,2 +382,7 @@ /** | ||
getElement(component: EpsBankElementComponent): stripeJs.StripeEpsBankElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `LinkAuthenticationElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `LinkAuthenticationElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: LinkAuthenticationElementComponent): stripeJs.StripeLinkAuthenticationElement | null; | ||
getElement(component: PaymentElementComponent): stripeJs.StripeElement | null; | ||
@@ -352,2 +395,7 @@ /** | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `ShippingAddressElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `ShippingAddressElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement(component: ShippingAddressElementComponent): stripeJs.StripeShippingAddressElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `PaymentRequestButtonElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
@@ -453,5 +501,19 @@ * Returns `null` if no `PaymentRequestButtonElement` is rendered in the current `Elements` provider tree. | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const LinkAuthenticationElement: LinkAuthenticationElementComponent; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const ShippingAddressElement: ShippingAddressElementComponent; | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
declare const AfterpayClearpayMessageElement: AfterpayClearpayMessageElementComponent; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, AfterpayClearpayMessageElement }; | ||
export { ElementProps, AuBankAccountElementProps, AuBankAccountElementComponent, CardElementProps, CardElementComponent, CardNumberElementProps, CardNumberElementComponent, CardExpiryElementProps, CardExpiryElementComponent, CardCvcElementProps, CardCvcElementComponent, FpxBankElementProps, FpxBankElementComponent, IbanElementProps, IbanElementComponent, IdealBankElementProps, IdealBankElementComponent, P24BankElementProps, LinkAuthenticationElementProps, LinkAuthenticationElementComponent, P24BankElementComponent, EpsBankElementProps, EpsBankElementComponent, PaymentElementProps, PaymentElementComponent, PaymentRequestButtonElementProps, PaymentRequestButtonElementComponent, ShippingAddressElementProps, ShippingAddressElementComponent, AfterpayClearpayMessageElementProps, AfterpayClearpayMessageElementComponent, useElements, useStripe, Elements, ElementsConsumer, AuBankAccountElement, CardElement, CardNumberElement, CardExpiryElement, CardCvcElement, FpxBankElement, IbanElement, IdealBankElement, P24BankElement, EpsBankElement, PaymentElement, PaymentRequestButtonElement, LinkAuthenticationElement, ShippingAddressElement, AfterpayClearpayMessageElement }; |
@@ -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,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 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 u(e){return(u="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 c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(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 p(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 p(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 p(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 f=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},l=function(e){return null!==e&&"object"===u(e)},y=function(e,t,n){return l(e)?Object.keys(e).reduce((function(r,o){var u=!l(t)||!function e(t,n){if(!l(t)||!l(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 s=0;s<c.length;s+=1)i[c[s]]=!0;var p=Object.keys(i);if(p.length!==u.length)return!1;var f=t,y=n;return p.every((function(t){return e(f[t],y[t])}))}(e[o],t[o]);return n.includes(o)?(u&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),r):u?a(a({},r||{}),{},c({},o,e[o])):r}),null):null},m=function(e){if(null===e||l(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 l(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(m)};var t=m(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},b=t.createContext(null);b.displayName="ElementsContext";var v=function(e){var n=e.stripe,r=e.options,o=e.children,u=t.useRef(!1),c=t.useRef(!0),i=t.useMemo((function(){return d(n)}),[n]),a=s(t.useState((function(){return{stripe:null,elements:null}})),2),p=a[0],l=a[1],m=f(n);null!==m&&m!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),u.current||("sync"===i.tag&&(u.current=!0,l({stripe:i.stripe,elements:i.stripe.elements(r)})),"async"===i.tag&&(u.current=!0,i.stripePromise.then((function(e){e&&c.current&&l({stripe:e,elements:e.elements(r)})}))));var v=f(r);return t.useEffect((function(){if(p.elements){var e=y(r,v,["clientSecret","fonts"]);e&&p.elements.update(e)}}),[r,v,p.elements]),t.useEffect((function(){return function(){c.current=!1}}),[]),t.useEffect((function(){var e=p.stripe;e&&e._registerWrapper&&e.registerAppInfo&&(e._registerWrapper({name:"react-stripe-js",version:"1.5.0"}),e.registerAppInfo({name:"react-stripe-js",version:"1.5.0",url:"https://stripe.com/docs/stripe-js/react"}))}),[p.stripe]),t.createElement(b.Provider,{value:p},o)};v.propTypes={stripe:o.any,options:o.object};var h=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(b),e)},E=function(e){return(0,e.children)(h("mounts <ElementsConsumer>"))};E.propTypes={children:o.func.isRequired};var g=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},O=function(){},j=function(e,n){var r,u="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),c=n?function(e){h("mounts <".concat(u,">"));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,a=n.onBlur,s=void 0===a?O:a,p=n.onFocus,l=void 0===p?O:p,m=n.onReady,d=void 0===m?O:m,b=n.onChange,v=void 0===b?O:b,E=n.onEscape,j=void 0===E?O:E,P=n.onClick,S=void 0===P?O:P,C=h("mounts <".concat(u,">")).elements,k=t.useRef(null),w=t.useRef(null),R=g(d),A=g(s),x=g(l),T=g(S),B=g(v),_=g(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 R(t)})),t.on("change",B),t.on("blur",A),t.on("focus",x),t.on("escape",_),t.on("click",T)}}));var I=f(i);return t.useEffect((function(){if(k.current){var e=y(i,I,["paymentRequest"]);e&&k.current.update(e)}}),[i,I]),t.useLayoutEffect((function(){return function(){k.current&&k.current.destroy()}}),[]),t.createElement("div",{id:r,className:o,ref:w})};return c.propTypes={id:o.string,className:o.string,onChange:o.func,onBlur:o.func,onFocus:o.func,onReady:o.func,onClick:o.func,options:o.object},c.displayName=u,c.__elementType=e,c},P="undefined"==typeof window,S=j("auBankAccount",P),C=j("card",P),k=j("cardNumber",P),w=j("cardExpiry",P),R=j("cardCvc",P),A=j("fpxBank",P),x=j("iban",P),T=j("idealBank",P),B=j("p24Bank",P),_=j("epsBank",P),I=j("payment",P),N=j("paymentRequestButton",P),q=j("afterpayClearpayMessage",P);e.AfterpayClearpayMessageElement=q,e.AuBankAccountElement=S,e.CardCvcElement=R,e.CardElement=C,e.CardExpiryElement=w,e.CardNumberElement=k,e.Elements=v,e.ElementsConsumer=E,e.EpsBankElement=_,e.FpxBankElement=A,e.IbanElement=x,e.IdealBankElement=T,e.P24BankElement=B,e.PaymentElement=I,e.PaymentRequestButtonElement=N,e.useElements=function(){return h("calls useElements()").elements},e.useStripe=function(){return h("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,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 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 u(e){return(u="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 c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(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 p(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 p(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 p(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 l=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},f=function(e){return null!==e&&"object"===u(e)},y=function(e,t,n){return f(e)?Object.keys(e).reduce((function(r,o){var u=!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!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 s=0;s<c.length;s+=1)i[c[s]]=!0;var p=Object.keys(i);if(p.length!==u.length)return!1;var l=t,y=n;return p.every((function(t){return e(l[t],y[t])}))}(e[o],t[o]);return n.includes(o)?(u&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),r):u?a(a({},r||{}),{},c({},o,e[o])):r}),null):null},m=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(m)};var t=m(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}},b=t.createContext(null);b.displayName="ElementsContext";var v=function(e){var n=e.stripe,r=e.options,o=e.children,u=t.useRef(!1),c=t.useRef(!0),i=t.useMemo((function(){return d(n)}),[n]),a=s(t.useState((function(){return{stripe:null,elements:null}})),2),p=a[0],f=a[1],m=l(n);null!==m&&m!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),u.current||("sync"===i.tag&&(u.current=!0,f({stripe:i.stripe,elements:i.stripe.elements(r)})),"async"===i.tag&&(u.current=!0,i.stripePromise.then((function(e){e&&c.current&&f({stripe:e,elements:e.elements(r)})}))));var v=l(r);return t.useEffect((function(){if(p.elements){var e=y(r,v,["clientSecret","fonts"]);e&&p.elements.update(e)}}),[r,v,p.elements]),t.useEffect((function(){return function(){c.current=!1}}),[]),t.useEffect((function(){var e=p.stripe;e&&e._registerWrapper&&e.registerAppInfo&&(e._registerWrapper({name:"react-stripe-js",version:"1.6.0"}),e.registerAppInfo({name:"react-stripe-js",version:"1.6.0",url:"https://stripe.com/docs/stripe-js/react"}))}),[p.stripe]),t.createElement(b.Provider,{value:p},o)};v.propTypes={stripe:o.any,options:o.object};var h=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(b),e)},E=function(e){return(0,e.children)(h("mounts <ElementsConsumer>"))};E.propTypes={children:o.func.isRequired};var g=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},O=function(){},j=function(e,n){var r,u="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),c=n?function(e){h("mounts <".concat(u,">"));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,a=n.onBlur,s=void 0===a?O:a,p=n.onFocus,f=void 0===p?O:p,m=n.onReady,d=void 0===m?O:m,b=n.onChange,v=void 0===b?O:b,E=n.onEscape,j=void 0===E?O:E,S=n.onClick,P=void 0===S?O:S,k=h("mounts <".concat(u,">")).elements,C=t.useRef(null),w=t.useRef(null),A=g(d),R=g(s),x=g(f),T=g(P),B=g(v),_=g(j);t.useLayoutEffect((function(){if(null==C.current&&k&&null!=w.current){var t=k.create(e,i);C.current=t,t.mount(w.current),t.on("ready",(function(){return A(t)})),t.on("change",B),t.on("blur",R),t.on("focus",x),t.on("escape",_),t.on("click",T)}}));var I=l(i);return t.useEffect((function(){if(C.current){var e=y(i,I,["paymentRequest"]);e&&C.current.update(e)}}),[i,I]),t.useLayoutEffect((function(){return function(){C.current&&C.current.destroy()}}),[]),t.createElement("div",{id:r,className:o,ref:w})};return c.propTypes={id:o.string,className:o.string,onChange:o.func,onBlur:o.func,onFocus:o.func,onReady:o.func,onClick:o.func,options:o.object},c.displayName=u,c.__elementType=e,c},S="undefined"==typeof window,P=j("auBankAccount",S),k=j("card",S),C=j("cardNumber",S),w=j("cardExpiry",S),A=j("cardCvc",S),R=j("fpxBank",S),x=j("iban",S),T=j("idealBank",S),B=j("p24Bank",S),_=j("epsBank",S),I=j("payment",S),N=j("paymentRequestButton",S),q=j("linkAuthentication",S),D=j("shippingAddress",S),M=j("afterpayClearpayMessage",S);e.AfterpayClearpayMessageElement=M,e.AuBankAccountElement=P,e.CardCvcElement=A,e.CardElement=k,e.CardExpiryElement=w,e.CardNumberElement=C,e.Elements=v,e.ElementsConsumer=E,e.EpsBankElement=_,e.FpxBankElement=R,e.IbanElement=x,e.IdealBankElement=T,e.LinkAuthenticationElement=q,e.P24BankElement=B,e.PaymentElement=I,e.PaymentRequestButtonElement=N,e.ShippingAddressElement=D,e.useElements=function(){return h("calls useElements()").elements},e.useStripe=function(){return h("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@stripe/react-stripe-js", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "React components for Stripe.js and Stripe Elements", | ||
@@ -65,3 +65,3 @@ "main": "dist/react-stripe.js", | ||
"@storybook/react": "^6.2.9", | ||
"@stripe/stripe-js": "^1.18.0", | ||
"@stripe/stripe-js": "^1.19.1", | ||
"@testing-library/jest-dom": "^5.11.8", | ||
@@ -107,3 +107,3 @@ "@testing-library/react": "^11.2.3", | ||
"peerDependencies": { | ||
"@stripe/stripe-js": "^1.18.0", | ||
"@stripe/stripe-js": "^1.19.1", | ||
"react": "^16.8.0 || ^17.0.0", | ||
@@ -110,0 +110,0 @@ "react-dom": "^16.8.0 || ^17.0.0" |
@@ -13,4 +13,6 @@ import createElementComponent from './components/createElementComponent'; | ||
EpsBankElementComponent, | ||
LinkAuthenticationElementComponent, | ||
PaymentElementComponent, | ||
PaymentRequestButtonElementComponent, | ||
ShippingAddressElementComponent, | ||
AfterpayClearpayMessageElementComponent, | ||
@@ -127,4 +129,26 @@ } from './types'; | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
export const LinkAuthenticationElement: LinkAuthenticationElementComponent = createElementComponent( | ||
'linkAuthentication', | ||
isServer | ||
); | ||
/** | ||
* Requires beta access: | ||
* Contact [Stripe support](https://support.stripe.com/) for more information. | ||
* | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
export const ShippingAddressElement: ShippingAddressElementComponent = createElementComponent( | ||
'shippingAddress', | ||
isServer | ||
); | ||
/** | ||
* @docs https://stripe.com/docs/stripe-js/react#element-components | ||
*/ | ||
export const AfterpayClearpayMessageElement: AfterpayClearpayMessageElementComponent = createElementComponent( | ||
@@ -131,0 +155,0 @@ 'afterpayClearpayMessage', |
@@ -266,2 +266,27 @@ import {FunctionComponent} from 'react'; | ||
export interface LinkAuthenticationElementProps extends ElementProps { | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: ( | ||
event: stripeJs.StripeLinkAuthenticationElementChangeEvent | ||
) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeLinkAuthenticationElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
export type LinkAuthenticationElementComponent = FunctionComponent< | ||
LinkAuthenticationElementProps | ||
>; | ||
export type P24BankElementComponent = FunctionComponent<P24BankElementProps>; | ||
@@ -344,2 +369,30 @@ | ||
export interface ShippingAddressElementProps extends ElementProps { | ||
/** | ||
* An object containing [Element configuration options](https://stripe.com/docs/js/elements_object/create_element?type=afterpayClearpayMessage). | ||
*/ | ||
options?: stripeJs.StripeShippingAddressElementOptions; | ||
/** | ||
* Triggered when data exposed by this Element is changed (e.g., when there is an error). | ||
* For more information, refer to the [Stripe.js reference](https://stripe.com/docs/js/element/events/on_change?type=auBankAccountElement). | ||
*/ | ||
onChange?: (event: stripeJs.StripeShippingAddressElementChangeEvent) => any; | ||
/** | ||
* Triggered when the Element is fully rendered and can accept imperative `element.focus()` calls. | ||
* Called with a reference to the underlying [Element instance](https://stripe.com/docs/js/element). | ||
*/ | ||
onReady?: (element: stripeJs.StripeShippingAddressElement) => any; | ||
/** | ||
* Triggered when the escape key is pressed within the Element. | ||
*/ | ||
onEscape?: () => any; | ||
} | ||
export type ShippingAddressElementComponent = FunctionComponent< | ||
ShippingAddressElementProps | ||
>; | ||
export interface AfterpayClearpayMessageElementProps { | ||
@@ -457,3 +510,11 @@ /** | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `LinkAuthenticationElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `LinkAuthenticationElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement( | ||
component: LinkAuthenticationElementComponent | ||
): stripeJs.StripeLinkAuthenticationElement | null; | ||
getElement( | ||
component: PaymentElementComponent | ||
@@ -471,2 +532,10 @@ ): stripeJs.StripeElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `ShippingAddressElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
* Returns `null` if no `ShippingAddressElement` is rendered in the current `Elements` provider tree. | ||
*/ | ||
getElement( | ||
component: ShippingAddressElementComponent | ||
): stripeJs.StripeShippingAddressElement | null; | ||
/** | ||
* Returns the underlying [element instance](https://stripe.com/docs/js/elements_object/create_element?type=card) for the `PaymentRequestButtonElement` component in the current [Elements](https://stripe.com/docs/stripe-js/react#elements-provider) provider tree. | ||
@@ -473,0 +542,0 @@ * Returns `null` if no `PaymentRequestButtonElement` is rendered in the current `Elements` provider tree. |
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
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
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
260868
5512
1