@getopenpay/openpay-js 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
@@ -10,6 +10,7 @@ declare type AirwallexApplePayFlowCustomParams = {
10
10
  label?: string;
11
11
  applePayPaymentRequest?: ApplePayJS.ApplePayPaymentRequest;
12
12
  };
13
+ defaultFieldValues?: DefaultFieldValues;
13
14
  };
14
15
 
15
16
  declare type AirwallexGooglePayFlowCustomParams = {
@@ -18,6 +19,7 @@ declare type AirwallexGooglePayFlowCustomParams = {
18
19
  pending?: boolean;
19
20
  googlePayPaymentRequest?: google.payments.api.PaymentDataRequest;
20
21
  };
22
+ defaultFieldValues?: DefaultFieldValues;
21
23
  };
22
24
 
23
25
  declare type AllCallbacks = {
@@ -583,7 +585,35 @@ export declare class OpenPayForm {
583
585
  * Runs the common credit card flow
584
586
  */
585
587
  submitCard: () => void;
586
- generalSubmit: (method: SubmitMethod, settings?: SubmitSettings) => void | Promise<void>;
588
+ getAvailablePaymentMethods: () => ({
589
+ name: string;
590
+ } | {
591
+ isAvailable: true;
592
+ pr: PaymentRequest_2;
593
+ availableProviders: {
594
+ applePay: boolean;
595
+ googlePay: boolean;
596
+ };
597
+ name: string;
598
+ } | {
599
+ isAvailable: boolean;
600
+ isLoading: boolean;
601
+ startFlow: (customParams?: AirwallexGooglePayFlowCustomParams) => Promise<void>;
602
+ name: string;
603
+ } | {
604
+ isAvailable: boolean;
605
+ isLoading: boolean;
606
+ startFlow: (customParams?: AirwallexApplePayFlowCustomParams) => Promise<void>;
607
+ name: string;
608
+ } | {
609
+ isAvailable: true;
610
+ controller: StripeLinkController;
611
+ name: string;
612
+ } | {
613
+ isAvailable: false;
614
+ name: string;
615
+ })[] | undefined;
616
+ generalSubmit: <T extends SubmitMethod>(method: T, settings?: SubmitSettings<T>) => void | Promise<void>;
587
617
  /**
588
618
  * Alias for submitCard
589
619
  */
@@ -633,9 +663,11 @@ declare type StripeLinkController = {
633
663
 
634
664
  declare type SubmitMethod = 'pockyt-paypal' | 'airwallex-google-pay' | 'airwallex-apple-pay';
635
665
 
636
- declare type SubmitSettings = {
637
- defaultFieldValues?: DefaultFieldValues;
638
- };
666
+ declare type SubmitSettings<T extends SubmitMethod = SubmitMethod> = {
667
+ 'pockyt-paypal': { defaultFieldValues?: DefaultFieldValues };
668
+ 'airwallex-google-pay': AirwallexGooglePayFlowCustomParams;
669
+ 'airwallex-apple-pay': AirwallexApplePayFlowCustomParams;
670
+ }[T];
639
671
 
640
672
  declare type SuccessStatus<T> = {
641
673
  status: 'success';