@getopenpay/openpay-js-react 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ declare type AirwallexApplePayFlowCustomParams = {
9
9
  label?: string;
10
10
  applePayPaymentRequest?: ApplePayJS.ApplePayPaymentRequest;
11
11
  };
12
+ defaultFieldValues?: DefaultFieldValues;
12
13
  };
13
14
 
14
15
  declare type AirwallexGooglePayFlowCustomParams = {
@@ -17,6 +18,7 @@ declare type AirwallexGooglePayFlowCustomParams = {
17
18
  pending?: boolean;
18
19
  googlePayPaymentRequest?: google.payments.api.PaymentDataRequest;
19
20
  };
21
+ defaultFieldValues?: DefaultFieldValues;
20
22
  };
21
23
 
22
24
  declare type AllCallbacks = {
@@ -129,7 +131,7 @@ export declare const ElementsForm: FC<ElementsFormPropsReact>;
129
131
 
130
132
  export declare type ElementsFormChildrenProps = {
131
133
  submit: () => void;
132
- submitWith: (method: SubmitMethod, settings?: SubmitSettings) => void;
134
+ submitWith: <T extends SubmitMethod>(method: T, settings?: SubmitSettings<T>) => void;
133
135
  applePay: PaymentRequestStatus;
134
136
  googlePay: PaymentRequestStatus;
135
137
  stripeLink: StripeLinkController | null;
@@ -265,9 +267,11 @@ declare type StripeLinkController = {
265
267
 
266
268
  declare type SubmitMethod = 'pockyt-paypal' | 'airwallex-google-pay' | 'airwallex-apple-pay';
267
269
 
268
- declare type SubmitSettings = {
269
- defaultFieldValues?: DefaultFieldValues;
270
- };
270
+ declare type SubmitSettings<T extends SubmitMethod = SubmitMethod> = {
271
+ 'pockyt-paypal': { defaultFieldValues?: DefaultFieldValues };
272
+ 'airwallex-google-pay': AirwallexGooglePayFlowCustomParams;
273
+ 'airwallex-apple-pay': AirwallexApplePayFlowCustomParams;
274
+ }[T];
271
275
 
272
276
  export declare const useOpenPayElements: () => ElementsContextValue;
273
277