@getopenpay/openpay-js-react 0.2.10 → 0.2.12

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
@@ -1,4 +1,3 @@
1
- import { ApplePayOption } from '@stripe/stripe-js/dist/stripe-js/elements/apple-pay';
2
1
  import { FC } from 'react';
3
2
  import { z } from 'zod';
4
3
 
@@ -52,6 +51,25 @@ export declare const Amount = z.object({
52
51
 
53
52
  export declare type Amount = z.infer<typeof Amount>;
54
53
 
54
+ declare type ApplePayFlowCustomParams = {
55
+ /**
56
+ * In case of multiple processors available for ApplePay, the preferredProcessor setting will
57
+ * determine which processor to use.
58
+ * If `preferredProcessor` is not set or is not available, the first available processor will be used
59
+ *
60
+ * **Note**: this processor choice is for the whole process of showing PaymentRequest UI, verification and charging.
61
+ * It won't perform fallback processor charging when payment failed.
62
+ */
63
+ preferredProcessor?: PaymentProcessor;
64
+ overridePaymentRequest?: {
65
+ amount: Amount;
66
+ pending?: boolean;
67
+ label?: string;
68
+ applePayPaymentRequest?: ApplePayJS.ApplePayPaymentRequest;
69
+ };
70
+ defaultFieldValues?: DefaultFieldValues;
71
+ };
72
+
55
73
  export declare const CardCvcElement: FC<ElementProps>;
56
74
 
57
75
  export declare const CardElement: FC<ElementProps<typeof CardPlaceholder>>;
@@ -160,7 +178,7 @@ export declare type ElementsFormProps = {
160
178
  onCheckoutStarted?: () => void;
161
179
  onCheckoutSuccess?: (invoiceUrls: string[], subscriptionIds: string[], customerId: string) => void;
162
180
  onSetupPaymentMethodSuccess?: (paymentMethodId: string) => void;
163
- onCheckoutError?: (message: string) => void;
181
+ onCheckoutError?: (message: string, errorCode?: string) => void;
164
182
  baseUrl?: string;
165
183
  enableDynamicPreviews?: boolean;
166
184
  customInitParams?: CustomInitParams;
@@ -221,6 +239,25 @@ declare const FieldNameEnum = z.nativeEnum(FieldName);
221
239
 
222
240
  declare type FieldNameEnum = z.infer<typeof FieldNameEnum>;
223
241
 
242
+ declare type GooglePayFlowCustomParams = {
243
+ /**
244
+ * In case of multiple processors available for GooglePay, the preferredProcessor setting will
245
+ * determine which processor to use.
246
+ * If `preferredProcessor` is not set or is not available, the first available processor will be used
247
+ *
248
+ * **Note**: this processor choice is for the whole process of showing PaymentRequest UI, verification and charging.
249
+ * It won't perform fallback processor charging when payment failed.
250
+ */
251
+ preferredProcessor?: PaymentProcessor;
252
+ overridePaymentRequest?: {
253
+ amount: Amount;
254
+ pending?: boolean;
255
+ label?: string;
256
+ googlePayPaymentRequest?: PaymentDataRequest;
257
+ };
258
+ defaultFieldValues?: DefaultFieldValues;
259
+ };
260
+
224
261
  export declare type InitAirwallexApplePayFlowResult = {
225
262
  isAvailable: boolean;
226
263
  isLoading: boolean;
@@ -233,7 +270,7 @@ export declare type InitAirwallexGooglePayFlowResult = {
233
270
  startFlow: (customParams?: AirwallexGooglePayFlowCustomParams) => Promise<void>;
234
271
  };
235
272
 
236
- declare type OnCheckoutError = (message: string) => void;
273
+ declare type OnCheckoutError = (message: string, errorCode?: string) => void;
237
274
 
238
275
  declare type OnCheckoutStarted = () => void;
239
276
 
@@ -243,6 +280,12 @@ declare type OnSetupPaymentMethodSuccess = (paymentMethodId: string) => void;
243
280
 
244
281
  declare type OnValidationError = (field: AllFieldNames, errors: string[], elementId?: string) => void;
245
282
 
283
+ declare type PaymentDataRequest = google.payments.api.PaymentDataRequest;
284
+
285
+ declare const PaymentProcessor = z.enum(['stripe', 'airwallex', 'authorize_net']);
286
+
287
+ declare type PaymentProcessor = z.infer<typeof PaymentProcessor>;
288
+
246
289
  declare const PaymentRequestProvider = z.enum(['apple_pay', 'google_pay']);
247
290
 
248
291
  declare type PaymentRequestProvider = z.infer<typeof PaymentRequestProvider>;
@@ -250,8 +293,8 @@ declare type PaymentRequestProvider = z.infer<typeof PaymentRequestProvider>;
250
293
  export declare type PaymentRequestStartParams = {
251
294
  overridePaymentRequest?: {
252
295
  amount: Amount;
253
- pending: boolean;
254
- stripeApplePay?: ApplePayOption;
296
+ pending?: boolean;
297
+ applePayPaymentRequest?: ApplePayJS.ApplePayPaymentRequest;
255
298
  };
256
299
  };
257
300
 
@@ -263,8 +306,10 @@ export declare type PaymentRequestStatus = {
263
306
 
264
307
  declare type ProcessorSpecificSubmitSettings<T extends SubmitMethod = SubmitMethod> = {
265
308
  'pockyt-paypal': { useRedirectFlow?: boolean };
266
- 'airwallex-google-pay': AirwallexGooglePayFlowCustomParams;
267
- 'airwallex-apple-pay': AirwallexApplePayFlowCustomParams;
309
+ 'airwallex-google-pay': GooglePayFlowCustomParams;
310
+ 'airwallex-apple-pay': ApplePayFlowCustomParams;
311
+ 'authorizenet-google-pay': GooglePayFlowCustomParams;
312
+ 'authorizenet-apple-pay': ApplePayFlowCustomParams;
268
313
  }[T];
269
314
 
270
315
  declare type PRStatuses = Record<PaymentRequestProvider, PaymentRequestStatus>;
@@ -275,7 +320,9 @@ declare type StripeLinkController = {
275
320
  waitForButtonToMount: () => Promise<HTMLElement>;
276
321
  };
277
322
 
278
- declare type SubmitMethod = 'pockyt-paypal' | 'airwallex-google-pay' | 'airwallex-apple-pay';
323
+ declare const SubmitMethod = z.nativeEnum(SubmitMethods);
324
+
325
+ declare type SubmitMethod = z.infer<typeof SubmitMethod>;
279
326
 
280
327
  declare type SubmitSettings<T extends SubmitMethod = SubmitMethod> = ProcessorSpecificSubmitSettings<T> &
281
328
  CommonSubmitSettings;