@getopenpay/openpay-js 0.1.0

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.
@@ -0,0 +1,58 @@
1
+ import { CdeConnection } from '@getopenpay/utils';
2
+ import { CheckoutPaymentMethod } from '@getopenpay/utils';
3
+ import { ElementProps } from '@getopenpay/utils';
4
+ import { ElementsFormProps } from '@getopenpay/utils';
5
+ import { FieldName } from '@getopenpay/utils';
6
+ import { PaymentRequestPaymentMethodEvent } from '@stripe/stripe-js';
7
+ import { PaymentRequestStatus } from '@getopenpay/utils';
8
+
9
+ export declare type Config = Omit<ElementsFormProps, 'children'> & {
10
+ formTarget?: string;
11
+ onPaymentRequestLoad?: (paymentRequests: Record<'apple_pay' | 'google_pay', PaymentRequestStatus>) => void;
12
+ };
13
+
14
+ declare class ConnectionManager {
15
+ private connections;
16
+ constructor();
17
+ addConnection(id: string, connection: CdeConnection): void;
18
+ getConnection(): CdeConnection;
19
+ }
20
+
21
+ export declare type ElementType = 'card' | 'card-number' | 'card-expiry' | 'card-cvc';
22
+
23
+ export { FieldName }
24
+
25
+ export declare class OpenPayForm {
26
+ config: Config;
27
+ formId: string;
28
+ sessionId: null | string;
29
+ checkoutPaymentMethods: Array<CheckoutPaymentMethod>;
30
+ formTarget: string;
31
+ checkoutFired: boolean;
32
+ private referer;
33
+ private eventHandler;
34
+ private formProperties;
35
+ private connectionManager;
36
+ private stripePm;
37
+ private paymentRequests;
38
+ private elements;
39
+ constructor(config: Config);
40
+ getStripePm(): PaymentRequestPaymentMethodEvent | undefined;
41
+ getConnectionManager(): ConnectionManager;
42
+ setFormHeight(height: string): void;
43
+ private initPaymentRequests;
44
+ createElement(type: ElementType, options?: ElementProps): {
45
+ type: ElementType;
46
+ node: HTMLIFrameElement;
47
+ mount: (selector: string) => HTMLIFrameElement | undefined;
48
+ };
49
+ private buildQueryString;
50
+ private connectToElement;
51
+ submit(): void;
52
+ onUserCompletePaymentRequestUI(stripePm: PaymentRequestPaymentMethodEvent, checkoutPaymentMethod: CheckoutPaymentMethod): Promise<void>;
53
+ onPaymentRequestError(errMsg: string): void;
54
+ private initializePaymentRequests;
55
+ destroy(): void;
56
+ }
57
+
58
+ export { }