Skip to content

Commit decfc17

Browse files
Add onChange to Shipping and Billing Address Element (#637)
* Add onChange to Shipping and Billing Address Element * Reuse types
1 parent cf83e39 commit decfc17

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

‎src/checkout/types/index.ts‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ElementProps,
66
PaymentElementProps as RootPaymentElementProps,
77
ExpressCheckoutElementProps as RootExpressCheckoutElementProps,
8+
AddressElementProps as RootAddressElementProps,
89
} from '../../types';
910

1011
export interface CurrencySelectorElementProps extends ElementProps {
@@ -37,25 +38,23 @@ export type CurrencySelectorElementComponent = FunctionComponent<
3738
CurrencySelectorElementProps
3839
>;
3940

40-
export interface BillingAddressElementProps extends ElementProps {
41+
export type BillingAddressElementProps = Omit<
42+
RootAddressElementProps,
43+
'options'
44+
> & {
4145
options?: stripeJs.StripeCheckoutAddressElementOptions;
42-
onReady?: (element: stripeJs.StripeAddressElement) => any;
43-
onEscape?: () => any;
44-
onLoadError?: (event: {elementType: 'address'; error: StripeError}) => any;
45-
onLoaderStart?: (event: {elementType: 'address'}) => any;
46-
}
46+
};
4747

4848
export type BillingAddressElementComponent = FunctionComponent<
4949
BillingAddressElementProps
5050
>;
5151

52-
export interface ShippingAddressElementProps extends ElementProps {
52+
export type ShippingAddressElementProps = Omit<
53+
RootAddressElementProps,
54+
'options'
55+
> & {
5356
options?: stripeJs.StripeCheckoutAddressElementOptions;
54-
onReady?: (element: stripeJs.StripeAddressElement) => any;
55-
onEscape?: () => any;
56-
onLoadError?: (event: {elementType: 'address'; error: StripeError}) => any;
57-
onLoaderStart?: (event: {elementType: 'address'}) => any;
58-
}
57+
};
5958

6059
export type ShippingAddressElementComponent = FunctionComponent<
6160
ShippingAddressElementProps

0 commit comments

Comments
 (0)