@flopay/react 1.20.9 → 1.20.11
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,59 @@
|
|
|
1
|
+
import type { CheckoutRuntimeSetupKind } from '@flopay/js';
|
|
2
|
+
import type { ButtonsLayoutStyles, FloPayAppearance, SavedCardDisplay, ThemeId, VaultCardThemeColors } from '@flopay/shared';
|
|
3
|
+
import { FloPayError } from '@flopay/shared';
|
|
4
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
5
|
+
/** Verified terminal result from a no-charge setup, as 1.x's `FloPayCardSetup` reports it. */
|
|
6
|
+
interface FloPayRuntimeSetupCompleteEvent {
|
|
7
|
+
status: 'succeeded';
|
|
8
|
+
sessionId: string;
|
|
9
|
+
paymentMethod?: SavedCardDisplay;
|
|
10
|
+
}
|
|
11
|
+
interface FloPayRuntimeSetupDeclineEvent {
|
|
12
|
+
status: 'declined';
|
|
13
|
+
sessionId: string;
|
|
14
|
+
reason?: string;
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
interface FloPayRuntimeSetupCancelEvent {
|
|
18
|
+
status: 'cancelled';
|
|
19
|
+
sessionId: string;
|
|
20
|
+
}
|
|
21
|
+
/** A structured setup failure: type, code, retryable and, where supplied, param and statusCode. */
|
|
22
|
+
type FloPayRuntimeSetupError = FloPayError & {
|
|
23
|
+
retryable: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** The props of the hosted card setup and payment method setup, the same as 1.x's, plus the runtime. */
|
|
26
|
+
export interface FloPayRuntimeCardSetupProps {
|
|
27
|
+
/** A setup session the merchant's server created. */
|
|
28
|
+
sessionId: string;
|
|
29
|
+
nonce: string;
|
|
30
|
+
theme?: ThemeId | VaultCardThemeColors;
|
|
31
|
+
appearance?: FloPayAppearance;
|
|
32
|
+
buttonsStyles?: ButtonsLayoutStyles;
|
|
33
|
+
containerStyle?: CSSProperties;
|
|
34
|
+
strings?: Record<string, string>;
|
|
35
|
+
/** The Flo-origin runtime script. */
|
|
36
|
+
runtimeUrl: string;
|
|
37
|
+
/** How long the runtime has to load before `onError` fires. Defaults to 10 seconds. */
|
|
38
|
+
runtimeTimeoutMs?: number;
|
|
39
|
+
onReady?: () => void;
|
|
40
|
+
onValidation?: (message: string | null) => void;
|
|
41
|
+
onComplete?: (event: FloPayRuntimeSetupCompleteEvent) => void;
|
|
42
|
+
onDecline?: (event: FloPayRuntimeSetupDeclineEvent) => void;
|
|
43
|
+
onCancel?: (event: FloPayRuntimeSetupCancelEvent) => void;
|
|
44
|
+
onError?: (error: FloPayRuntimeSetupError) => void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Mounts one hosted setup of `kind` from the Flo-hosted runtime and relays its events to the
|
|
48
|
+
* latest callbacks, each isolated, with the 1.x payloads. The theme and wording are passed to
|
|
49
|
+
* the runtime unresolved, and a change updates the mounted setup in place. A new session (or
|
|
50
|
+
* runtime) replaces the mounted setup; an unmount unmounts it, and the runtime reports the
|
|
51
|
+
* cancellation.
|
|
52
|
+
*/
|
|
53
|
+
export declare function RuntimeSetup({ kind, props, }: {
|
|
54
|
+
kind: CheckoutRuntimeSetupKind;
|
|
55
|
+
props: FloPayRuntimeCardSetupProps;
|
|
56
|
+
}): ReactElement;
|
|
57
|
+
/** Card setup that runs from the Flo-hosted runtime (`setup: 'card'`), with 1.x's callbacks. */
|
|
58
|
+
export declare function FloPayRuntimeCardSetup(props: FloPayRuntimeCardSetupProps): ReactElement;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { FloPayRuntimeCardSetupProps } from './flopay-runtime-card-setup.js';
|
|
3
|
+
export type FloPayRuntimePaymentMethodSetupProps = FloPayRuntimeCardSetupProps;
|
|
4
|
+
/**
|
|
5
|
+
* Payment method setup that runs from the Flo-hosted runtime (`setup: 'payment_method'`): the
|
|
6
|
+
* runtime offers the methods the setup session advertises and verifies each saved method with
|
|
7
|
+
* the backend. The callbacks are 1.x's `FloPayPaymentMethodSetup` callbacks.
|
|
8
|
+
*/
|
|
9
|
+
export declare function FloPayRuntimePaymentMethodSetup(props: FloPayRuntimePaymentMethodSetupProps): ReactElement;
|