@getopenpay/openpay-js 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 +41 -17
- package/dist/index.es.js +1086 -1045
- package/dist/index.umd.js +13 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,23 @@ import { PaymentRequest as PaymentRequest_2 } from '@stripe/stripe-js';
|
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
+
declare type AirwallexApplePayFlowCustomParams = {
|
|
7
|
+
overridePaymentRequest?: {
|
|
8
|
+
amount: Amount;
|
|
9
|
+
pending?: boolean;
|
|
10
|
+
label?: string;
|
|
11
|
+
applePayPaymentRequest?: ApplePayJS.ApplePayPaymentRequest;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
declare type AirwallexGooglePayFlowCustomParams = {
|
|
16
|
+
overridePaymentRequest?: {
|
|
17
|
+
amount: Amount;
|
|
18
|
+
pending?: boolean;
|
|
19
|
+
googlePayPaymentRequest?: google.payments.api.PaymentDataRequest;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
6
23
|
declare type AllCallbacks = {
|
|
7
24
|
onFocus?: (elementId: string, field: AllFieldNames) => void;
|
|
8
25
|
onBlur?: (elementId: string, field: AllFieldNames) => void;
|
|
@@ -26,6 +43,9 @@ declare type AllFieldNames = z.infer<typeof AllFieldNames>;
|
|
|
26
43
|
*/
|
|
27
44
|
declare const Amount = z.object({
|
|
28
45
|
amountAtom: z.number(),
|
|
46
|
+
/**
|
|
47
|
+
* The three-letter ISO 4217 currency code for the payment.
|
|
48
|
+
*/
|
|
29
49
|
currency: RequiredString,
|
|
30
50
|
});
|
|
31
51
|
|
|
@@ -92,6 +112,8 @@ declare type CustomInitParams = {
|
|
|
92
112
|
};
|
|
93
113
|
};
|
|
94
114
|
|
|
115
|
+
declare type DefaultFieldValues = Partial<Record<FieldNameEnum, string>>;
|
|
116
|
+
|
|
95
117
|
declare type ElementProps<PlaceholderType extends z.ZodTypeAny = z.ZodString> = {
|
|
96
118
|
styles?: ElementsStyle<z.ZodOptional<PlaceholderType>>;
|
|
97
119
|
};
|
|
@@ -159,6 +181,10 @@ export declare enum FieldName {
|
|
|
159
181
|
PROMOTION_CODE = 'promotionCode',
|
|
160
182
|
}
|
|
161
183
|
|
|
184
|
+
declare const FieldNameEnum = z.nativeEnum(FieldName);
|
|
185
|
+
|
|
186
|
+
declare type FieldNameEnum = z.infer<typeof FieldNameEnum>;
|
|
187
|
+
|
|
162
188
|
declare class FormCallbacks {
|
|
163
189
|
private static readonly NOOP = () => {};
|
|
164
190
|
private _callbacks: Required<AllCallbacks>;
|
|
@@ -203,22 +229,16 @@ declare class FormCallbacks {
|
|
|
203
229
|
}
|
|
204
230
|
}
|
|
205
231
|
|
|
206
|
-
declare type
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
startFlow: () => Promise<void>;
|
|
210
|
-
}
|
|
211
|
-
| {
|
|
212
|
-
isAvailable: false;
|
|
232
|
+
declare type InitAirwallexApplePayFlowResult = {
|
|
233
|
+
isAvailable: boolean;
|
|
234
|
+
isLoading: boolean;
|
|
235
|
+
startFlow: (customParams?: AirwallexApplePayFlowCustomParams) => Promise<void>;
|
|
213
236
|
};
|
|
214
237
|
|
|
215
|
-
declare type
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
startFlow: () => Promise<void>;
|
|
219
|
-
}
|
|
220
|
-
| {
|
|
221
|
-
isAvailable: false;
|
|
238
|
+
declare type InitAirwallexGooglePayFlowResult = {
|
|
239
|
+
isAvailable: boolean;
|
|
240
|
+
isLoading: boolean;
|
|
241
|
+
startFlow: (customParams?: AirwallexGooglePayFlowCustomParams) => Promise<void>;
|
|
222
242
|
};
|
|
223
243
|
|
|
224
244
|
declare type InitialStatus = {
|
|
@@ -525,11 +545,11 @@ export declare class OpenPayForm {
|
|
|
525
545
|
initialize: (initParams: InitOjsFlowParams) => Promise<void>;
|
|
526
546
|
};
|
|
527
547
|
readonly airwallexGooglePay: {
|
|
528
|
-
publisher: LoadedOncePublisher<
|
|
548
|
+
publisher: LoadedOncePublisher<InitAirwallexGooglePayFlowResult>;
|
|
529
549
|
initialize: (initParams: InitOjsFlowParams) => Promise<void>;
|
|
530
550
|
};
|
|
531
551
|
readonly airwallexApplePay: {
|
|
532
|
-
publisher: LoadedOncePublisher<
|
|
552
|
+
publisher: LoadedOncePublisher<InitAirwallexApplePayFlowResult>;
|
|
533
553
|
initialize: (initParams: InitOjsFlowParams) => Promise<void>;
|
|
534
554
|
};
|
|
535
555
|
};
|
|
@@ -563,7 +583,7 @@ export declare class OpenPayForm {
|
|
|
563
583
|
* Runs the common credit card flow
|
|
564
584
|
*/
|
|
565
585
|
submitCard: () => void;
|
|
566
|
-
generalSubmit: (method: SubmitMethod) => void | Promise<void>;
|
|
586
|
+
generalSubmit: (method: SubmitMethod, settings?: SubmitSettings) => void | Promise<void>;
|
|
567
587
|
/**
|
|
568
588
|
* Alias for submitCard
|
|
569
589
|
*/
|
|
@@ -613,6 +633,10 @@ declare type StripeLinkController = {
|
|
|
613
633
|
|
|
614
634
|
declare type SubmitMethod = 'pockyt-paypal' | 'airwallex-google-pay' | 'airwallex-apple-pay';
|
|
615
635
|
|
|
636
|
+
declare type SubmitSettings = {
|
|
637
|
+
defaultFieldValues?: DefaultFieldValues;
|
|
638
|
+
};
|
|
639
|
+
|
|
616
640
|
declare type SuccessStatus<T> = {
|
|
617
641
|
status: 'success';
|
|
618
642
|
isSuccess: true;
|