@getopenpay/openpay-js-react 0.2.2 → 0.2.4-alpha.4cdb512

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
@@ -2,6 +2,23 @@ import { ApplePayOption } from '@stripe/stripe-js/dist/stripe-js/elements/apple-
2
2
  import { FC } from 'react';
3
3
  import { z } from 'zod';
4
4
 
5
+ declare type AirwallexApplePayFlowCustomParams = {
6
+ overridePaymentRequest?: {
7
+ amount: Amount;
8
+ pending?: boolean;
9
+ label?: string;
10
+ applePayPaymentRequest?: ApplePayJS.ApplePayPaymentRequest;
11
+ };
12
+ };
13
+
14
+ declare type AirwallexGooglePayFlowCustomParams = {
15
+ overridePaymentRequest?: {
16
+ amount: Amount;
17
+ pending?: boolean;
18
+ googlePayPaymentRequest?: google.payments.api.PaymentDataRequest;
19
+ };
20
+ };
21
+
5
22
  declare type AllCallbacks = {
6
23
  onFocus?: (elementId: string, field: AllFieldNames) => void;
7
24
  onBlur?: (elementId: string, field: AllFieldNames) => void;
@@ -25,6 +42,9 @@ declare type AllFieldNames = z.infer<typeof AllFieldNames>;
25
42
  */
26
43
  export declare const Amount = z.object({
27
44
  amountAtom: z.number(),
45
+ /**
46
+ * The three-letter ISO 4217 currency code for the payment.
47
+ */
28
48
  currency: RequiredString,
29
49
  });
30
50
 
@@ -84,6 +104,8 @@ declare type CustomInitParams = {
84
104
  };
85
105
  };
86
106
 
107
+ declare type DefaultFieldValues = Partial<Record<FieldNameEnum, string>>;
108
+
87
109
  export declare type DynamicPreview = {
88
110
  amount: Amount | null;
89
111
  isLoading: boolean;
@@ -107,13 +129,13 @@ export declare const ElementsForm: FC<ElementsFormPropsReact>;
107
129
 
108
130
  export declare type ElementsFormChildrenProps = {
109
131
  submit: () => void;
110
- submitWith: (method: SubmitMethod) => void;
132
+ submitWith: (method: SubmitMethod, settings?: SubmitSettings) => void;
111
133
  applePay: PaymentRequestStatus;
112
134
  googlePay: PaymentRequestStatus;
113
135
  stripeLink: StripeLinkController | null;
114
136
  airwallex: {
115
- googlePay: InitGooglePayFlowResult | null;
116
- applePay: InitApplePayFlowResult | null;
137
+ googlePay: InitAirwallexGooglePayFlowResult;
138
+ applePay: InitAirwallexApplePayFlowResult;
117
139
  };
118
140
  loaded: boolean;
119
141
  preview: DynamicPreview;
@@ -189,22 +211,20 @@ export declare enum FieldName {
189
211
  PROMOTION_CODE = 'promotionCode',
190
212
  }
191
213
 
192
- declare type InitApplePayFlowResult =
193
- | {
194
- isAvailable: true;
195
- startFlow: () => Promise<void>;
196
- }
197
- | {
198
- isAvailable: false;
214
+ declare const FieldNameEnum = z.nativeEnum(FieldName);
215
+
216
+ declare type FieldNameEnum = z.infer<typeof FieldNameEnum>;
217
+
218
+ export declare type InitAirwallexApplePayFlowResult = {
219
+ isAvailable: boolean;
220
+ isLoading: boolean;
221
+ startFlow: (customParams?: AirwallexApplePayFlowCustomParams) => Promise<void>;
199
222
  };
200
223
 
201
- declare type InitGooglePayFlowResult =
202
- | {
203
- isAvailable: true;
204
- startFlow: () => Promise<void>;
205
- }
206
- | {
207
- isAvailable: false;
224
+ export declare type InitAirwallexGooglePayFlowResult = {
225
+ isAvailable: boolean;
226
+ isLoading: boolean;
227
+ startFlow: (customParams?: AirwallexGooglePayFlowCustomParams) => Promise<void>;
208
228
  };
209
229
 
210
230
  declare type OnCheckoutError = (message: string) => void;
@@ -245,6 +265,10 @@ declare type StripeLinkController = {
245
265
 
246
266
  declare type SubmitMethod = 'pockyt-paypal' | 'airwallex-google-pay' | 'airwallex-apple-pay';
247
267
 
268
+ declare type SubmitSettings = {
269
+ defaultFieldValues?: DefaultFieldValues;
270
+ };
271
+
248
272
  export declare const useOpenPayElements: () => ElementsContextValue;
249
273
 
250
274
  export { }