@flopay/vue 1.14.5 → 1.14.7

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.
@@ -1,156 +1,2 @@
1
- import * as vue from 'vue';
2
- import { PropType, VNode } from 'vue';
3
- import { ThemeId, VaultCardThemeColors, FloPayAppearance, ButtonsLayoutStyles } from '@flopay/shared';
4
- import { a as FloPayCardSetupCompleteEvent, F as FloPayCardSetupCancelEvent, b as FloPayCardSetupDeclineEvent, c as FloPayCardSetupError } from './hosted-setup-jpaaXDFA.js';
5
-
6
- /** Verified terminal result from saving any advertised payment method. */
7
- type FloPayPaymentMethodSetupCompleteEvent = FloPayCardSetupCompleteEvent;
8
- /** Provider-neutral terminal decline from saving a payment method. */
9
- type FloPayPaymentMethodSetupDeclineEvent = FloPayCardSetupDeclineEvent;
10
- /** Abandoned setup emitted when the surface unmounts before an outcome. */
11
- type FloPayPaymentMethodSetupCancelEvent = FloPayCardSetupCancelEvent;
12
- /** Props for {@link FloPayPaymentMethodSetup} (callbacks are emits). */
13
- interface FloPayPaymentMethodSetupProps {
14
- sessionId: string;
15
- nonce: string;
16
- billingApiUrl?: string;
17
- telemetry?: boolean;
18
- /**
19
- * The same `ThemeId` bundle `FloPayCheckout` and `FloPayCardSetup` resolve,
20
- * or raw `VaultCardThemeColors` for the hosted card widget. A preset also
21
- * themes the Stripe wallets and APMs and the outcome overlay. Defaults to
22
- * `'modern-light'`, which an unrecognized preset id also falls back to;
23
- * pass `'classic'` for the historic FloPay look.
24
- */
25
- theme?: ThemeId | VaultCardThemeColors;
26
- /**
27
- * Inline styles for the hosted card-widget container, with the same
28
- * precedence over the preset's pane surface (and a stored
29
- * `buttonsStyles.cardFormContainer`) as `FloPayCardSetup`.
30
- */
31
- containerStyle?: Record<string, string | number>;
32
- /**
33
- * Appearance override, the same prop and type as `FloPayCheckout`'s and
34
- * `FloPayCardSetup`'s (for example a client's saved embed theme
35
- * `appearance`). It replaces the preset's appearance outright, as checkout
36
- * does: its variables drive the hosted card fields and submit button, the
37
- * Stripe Elements of every wallet and APM, and the outcome overlay. Ignored
38
- * with raw `VaultCardThemeColors`; an empty `{}` is the same as omitting it.
39
- */
40
- appearance?: FloPayAppearance;
41
- /**
42
- * Buttons-layout style overrides, the same prop and type as
43
- * `FloPayCheckout`'s and `FloPayCardSetup`'s (for example a client's saved
44
- * embed theme `buttonsStyles`), merged over the preset's buttons layout the
45
- * way checkout merges them. `submitButton` and the `cardInput*` members style
46
- * the hosted card form, and `cardFormContainer` the pane around it and the
47
- * outcome overlay's panel. Ignored with raw `VaultCardThemeColors`; an empty
48
- * `{}` is the same as omitting it.
49
- */
50
- buttonsStyles?: ButtonsLayoutStyles;
51
- }
52
- /**
53
- * Saves any payment method the setup session advertises: the hosted vault
54
- * card, advertised Stripe wallets/APMs (each on the account the backend chose
55
- * for it) and the PayPal vault flow. Takes only `sessionId` + `nonce`, never
56
- * creates a session. Success is the backend's call, never the provider's: once
57
- * a wallet, APM or PayPal is accepted, the session is re-read until the
58
- * backend reports the method saved, and only then is `complete` emitted, once.
59
- * A `decline` is never paired with a `complete`.
60
- */
61
- declare const FloPayPaymentMethodSetup: vue.DefineComponent<vue.ExtractPropTypes<{
62
- sessionId: {
63
- type: StringConstructor;
64
- default: undefined;
65
- };
66
- nonce: {
67
- type: StringConstructor;
68
- default: undefined;
69
- };
70
- billingApiUrl: {
71
- type: StringConstructor;
72
- default: undefined;
73
- };
74
- telemetry: {
75
- type: BooleanConstructor;
76
- default: undefined;
77
- };
78
- theme: {
79
- type: PropType<ThemeId | VaultCardThemeColors>;
80
- default: string;
81
- };
82
- containerStyle: {
83
- type: PropType<Record<string, string | number>>;
84
- default: undefined;
85
- };
86
- appearance: {
87
- type: PropType<FloPayAppearance>;
88
- default: undefined;
89
- };
90
- buttonsStyles: {
91
- type: PropType<ButtonsLayoutStyles>;
92
- default: undefined;
93
- };
94
- }>, () => VNode<vue.RendererNode, vue.RendererElement, {
95
- [key: string]: any;
96
- }> | VNode<vue.RendererNode, vue.RendererElement, {
97
- [key: string]: any;
98
- }>[] | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
99
- ready: () => true;
100
- complete: (_event: FloPayPaymentMethodSetupCompleteEvent) => true;
101
- cancel: (_event: FloPayPaymentMethodSetupCancelEvent) => true;
102
- decline: (_event: FloPayPaymentMethodSetupDeclineEvent) => true;
103
- validation: (_message: string | null) => true;
104
- error: (_error: FloPayCardSetupError) => true;
105
- }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
106
- sessionId: {
107
- type: StringConstructor;
108
- default: undefined;
109
- };
110
- nonce: {
111
- type: StringConstructor;
112
- default: undefined;
113
- };
114
- billingApiUrl: {
115
- type: StringConstructor;
116
- default: undefined;
117
- };
118
- telemetry: {
119
- type: BooleanConstructor;
120
- default: undefined;
121
- };
122
- theme: {
123
- type: PropType<ThemeId | VaultCardThemeColors>;
124
- default: string;
125
- };
126
- containerStyle: {
127
- type: PropType<Record<string, string | number>>;
128
- default: undefined;
129
- };
130
- appearance: {
131
- type: PropType<FloPayAppearance>;
132
- default: undefined;
133
- };
134
- buttonsStyles: {
135
- type: PropType<ButtonsLayoutStyles>;
136
- default: undefined;
137
- };
138
- }>> & Readonly<{
139
- onComplete?: ((_event: FloPayCardSetupCompleteEvent) => any) | undefined;
140
- onCancel?: ((_event: FloPayCardSetupCancelEvent) => any) | undefined;
141
- onError?: ((_error: FloPayCardSetupError) => any) | undefined;
142
- onReady?: (() => any) | undefined;
143
- onDecline?: ((_event: FloPayCardSetupDeclineEvent) => any) | undefined;
144
- onValidation?: ((_message: string | null) => any) | undefined;
145
- }>, {
146
- nonce: string;
147
- sessionId: string;
148
- billingApiUrl: string;
149
- telemetry: boolean;
150
- appearance: FloPayAppearance;
151
- theme: VaultCardThemeColors | ThemeId;
152
- containerStyle: Record<string, string | number>;
153
- buttonsStyles: ButtonsLayoutStyles;
154
- }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
155
-
156
- export { FloPayPaymentMethodSetup, type FloPayPaymentMethodSetupCancelEvent, type FloPayPaymentMethodSetupCompleteEvent, type FloPayPaymentMethodSetupDeclineEvent, type FloPayPaymentMethodSetupProps };
1
+ export type { FloPayPaymentMethodSetupCancelEvent, FloPayPaymentMethodSetupCompleteEvent, FloPayPaymentMethodSetupDeclineEvent, FloPayPaymentMethodSetupProps, } from './flopay-payment-method-setup-main.js';
2
+ export { FloPayPaymentMethodSetup } from './flopay-payment-method-setup-main.js';
@@ -0,0 +1,108 @@
1
+ import { type PropType } from 'vue';
2
+ /** How a setup branch reports a technical failure: whether trying again can help. */
3
+ export interface SetupBranchFailure {
4
+ code: string;
5
+ retryable: boolean;
6
+ }
7
+ /** The setup session's customer, forwarded to the approval as checkout forwards it. */
8
+ export interface SetupCustomer {
9
+ userId: string;
10
+ email: string;
11
+ }
12
+ /**
13
+ * Renders PayPal's button in vault mode (save PayPal without a purchase). The
14
+ * click mints a PayPal vault setup token through the session-scoped intents
15
+ * contract (`paypal_vaulted`, `intentKind: 'setup'`); the approval hands the
16
+ * token to the billing API the same way checkout does. The branch never
17
+ * reports success itself: `confirmed` only says PayPal accepted the account,
18
+ * and the surface then waits for the backend to verify it.
19
+ */
20
+ export declare const PayPalSetupMethod: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
21
+ clientId: {
22
+ type: StringConstructor;
23
+ required: true;
24
+ };
25
+ environment: {
26
+ type: StringConstructor;
27
+ default: undefined;
28
+ };
29
+ /** The setup session's own currency, when the read carries one. A vault flow needs none. */
30
+ currency: {
31
+ type: StringConstructor;
32
+ default: undefined;
33
+ };
34
+ sessionId: {
35
+ type: StringConstructor;
36
+ required: true;
37
+ };
38
+ nonce: {
39
+ type: StringConstructor;
40
+ required: true;
41
+ };
42
+ billingApiUrl: {
43
+ type: StringConstructor;
44
+ required: true;
45
+ };
46
+ telemetry: {
47
+ type: BooleanConstructor;
48
+ default: undefined;
49
+ };
50
+ customer: {
51
+ type: PropType<SetupCustomer>;
52
+ required: true;
53
+ };
54
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
55
+ [key: string]: any;
56
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
57
+ /** The buyer started saving PayPal. */
58
+ submitting: () => true;
59
+ /** PayPal accepted the account and the billing API took the token. */
60
+ confirmed: () => true;
61
+ /** A technical failure; `retryable` says whether trying again can help. */
62
+ failed: (_error: unknown, _options: SetupBranchFailure) => true;
63
+ /** The buyer closed PayPal's window without an outcome (not a cancel). */
64
+ abandoned: () => true;
65
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
66
+ clientId: {
67
+ type: StringConstructor;
68
+ required: true;
69
+ };
70
+ environment: {
71
+ type: StringConstructor;
72
+ default: undefined;
73
+ };
74
+ /** The setup session's own currency, when the read carries one. A vault flow needs none. */
75
+ currency: {
76
+ type: StringConstructor;
77
+ default: undefined;
78
+ };
79
+ sessionId: {
80
+ type: StringConstructor;
81
+ required: true;
82
+ };
83
+ nonce: {
84
+ type: StringConstructor;
85
+ required: true;
86
+ };
87
+ billingApiUrl: {
88
+ type: StringConstructor;
89
+ required: true;
90
+ };
91
+ telemetry: {
92
+ type: BooleanConstructor;
93
+ default: undefined;
94
+ };
95
+ customer: {
96
+ type: PropType<SetupCustomer>;
97
+ required: true;
98
+ };
99
+ }>> & Readonly<{
100
+ onAbandoned?: (() => any) | undefined;
101
+ onConfirmed?: (() => any) | undefined;
102
+ onFailed?: ((_error: unknown, _options: SetupBranchFailure) => any) | undefined;
103
+ onSubmitting?: (() => any) | undefined;
104
+ }>, {
105
+ environment: string;
106
+ currency: string;
107
+ telemetry: boolean;
108
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,82 @@
1
+ import type { ProcessingOverlayStatus, ProcessingOverlayThemeColors } from '@flopay/shared';
2
+ import { type PropType } from 'vue';
3
+ /** Success hold before a setup surface reports `complete` (React's `PROCESSING_OVERLAY_SUCCESS_DELAY_MS`). */
4
+ export declare const PROCESSING_OVERLAY_SUCCESS_DELAY_MS = 600;
5
+ /** Failure hold before the overlay clears for a retry (React's `PROCESSING_OVERLAY_ERROR_DELAY_MS`). */
6
+ export declare const PROCESSING_OVERLAY_ERROR_DELAY_MS = 400;
7
+ /**
8
+ * React's `ProcessingOverlay`: the full-page processing / success / failure
9
+ * modal the setup surfaces draw over the hosted card form (the widget paints
10
+ * no in-iframe overlay). A named preset passes `theme` from
11
+ * `computeCardSetupOverlayTheme`; without it the modal keeps the neutral look.
12
+ */
13
+ export declare const ProcessingOverlay: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
14
+ status: {
15
+ type: PropType<ProcessingOverlayStatus>;
16
+ required: true;
17
+ };
18
+ errorMessage: {
19
+ type: PropType<string | null>;
20
+ default: null;
21
+ };
22
+ processingLabel: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ successLabel: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ errorLabel: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ /** Success sub-note; `null` omits it (surfaces that do not redirect). */
35
+ successNote: {
36
+ type: PropType<string | null>;
37
+ default: string;
38
+ };
39
+ theme: {
40
+ type: PropType<ProcessingOverlayThemeColors>;
41
+ default: undefined;
42
+ };
43
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
44
+ [key: string]: any;
45
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
46
+ status: {
47
+ type: PropType<ProcessingOverlayStatus>;
48
+ required: true;
49
+ };
50
+ errorMessage: {
51
+ type: PropType<string | null>;
52
+ default: null;
53
+ };
54
+ processingLabel: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ successLabel: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ errorLabel: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
66
+ /** Success sub-note; `null` omits it (surfaces that do not redirect). */
67
+ successNote: {
68
+ type: PropType<string | null>;
69
+ default: string;
70
+ };
71
+ theme: {
72
+ type: PropType<ProcessingOverlayThemeColors>;
73
+ default: undefined;
74
+ };
75
+ }>> & Readonly<{}>, {
76
+ errorMessage: string | null;
77
+ processingLabel: string;
78
+ successLabel: string;
79
+ errorLabel: string;
80
+ successNote: string | null;
81
+ theme: ProcessingOverlayThemeColors;
82
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,76 @@
1
+ import type { FloPay } from '@flopay/js';
2
+ import type { BuildTelemetryErrorEventInput, FloInstrumentEvent, FloInstrumentSource } from '@flopay/shared';
3
+ import { type PropType } from 'vue';
4
+ /** Props for the `FloPayProvider` component (React's `FloPayProviderProps`, minus `children`). */
5
+ export interface FloPayProviderProps {
6
+ /** A `FloPay` instance or a promise that resolves to one (from `loadFloPay()`). */
7
+ flopay: Promise<FloPay> | FloPay | null;
8
+ /** Stripe `FloPay` instance for the Stripe-rendered PayPal fallback. */
9
+ paypalFlopay?: Promise<FloPay> | FloPay | null;
10
+ /** Optional provider configuration. */
11
+ options?: {
12
+ billingApiUrl?: string;
13
+ };
14
+ /** Receives the versioned, privacy-safe checkout instrument feed (`@instrument`). */
15
+ onInstrument?: (event: FloInstrumentEvent) => void;
16
+ }
17
+ interface TelemetryBridgeLike {
18
+ subscribe?(observer: (event: FloInstrumentSource) => void): () => void;
19
+ /**
20
+ * React's `getFloPayTelemetryBridge(flopay)?.error(…)`: a privacy-safe
21
+ * technical error on the instance's Flo-owned telemetry (the channel that
22
+ * reaches Sentry). The reporter assigns the event id and sequence.
23
+ */
24
+ error?(input: Omit<BuildTelemetryErrorEventInput, 'eventId' | 'sequence'>): void;
25
+ }
26
+ /** The hidden telemetry bridge `@flopay/js` attaches to a `FloPay` instance, if any. */
27
+ export declare function telemetryBridge(flopay: FloPay): TelemetryBridgeLike | undefined;
28
+ /**
29
+ * Provides FloPay SDK state to the component tree (provide/inject). Browser
30
+ * work — resolving the SDK promise, telemetry, instruments — starts in
31
+ * `onMounted`, so server rendering renders the pending state and nothing else.
32
+ */
33
+ export declare const FloPayProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
34
+ flopay: {
35
+ type: PropType<Promise<FloPay> | FloPay | null>;
36
+ default: null;
37
+ };
38
+ paypalFlopay: {
39
+ type: PropType<Promise<FloPay> | FloPay | null>;
40
+ default: null;
41
+ };
42
+ options: {
43
+ type: PropType<{
44
+ billingApiUrl?: string;
45
+ }>;
46
+ default: undefined;
47
+ };
48
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
49
+ [key: string]: any;
50
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
51
+ instrument: (_event: FloInstrumentEvent) => true;
52
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
53
+ flopay: {
54
+ type: PropType<Promise<FloPay> | FloPay | null>;
55
+ default: null;
56
+ };
57
+ paypalFlopay: {
58
+ type: PropType<Promise<FloPay> | FloPay | null>;
59
+ default: null;
60
+ };
61
+ options: {
62
+ type: PropType<{
63
+ billingApiUrl?: string;
64
+ }>;
65
+ default: undefined;
66
+ };
67
+ }>> & Readonly<{
68
+ onInstrument?: ((_event: FloInstrumentEvent) => any) | undefined;
69
+ }>, {
70
+ flopay: FloPay | Promise<FloPay> | null;
71
+ paypalFlopay: FloPay | Promise<FloPay> | null;
72
+ options: {
73
+ billingApiUrl?: string;
74
+ };
75
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
76
+ export {};
@@ -0,0 +1,44 @@
1
+ import { type PaymentAPI } from '@flopay/js';
2
+ import type { CheckoutSession, NormalizedCheckoutSession, PaymentResult } from '@flopay/shared';
3
+ import { FloPayError } from '@flopay/shared';
4
+ /**
5
+ * The saved-payment charge shared by `FloPayAutomaticPaymentButton` and
6
+ * `FloPayCheckout`'s `confirm` / `auto` modes (React's saved-payment flow):
7
+ * the session-scoped `/process` with no client-built `tokenizedData`, the
8
+ * backend-owned 3DS challenge (one `/3ds/complete`, then the `/status`
9
+ * reconcile) and the async `202` status follow-up. No browser payment
10
+ * provider is loaded. Framework-free, so both Vue surfaces run the same code.
11
+ */
12
+ /** Success overlay hold before the completion callback (React's `PROCESSING_OVERLAY_SUCCESS_DELAY_MS`). */
13
+ export declare const SAVED_PAYMENT_SUCCESS_DELAY_MS = 600;
14
+ /** Whether the checkout reached a buyer-success terminal state. */
15
+ export declare function isTerminalSuccess(session: CheckoutSession | null | undefined): session is CheckoutSession & {
16
+ status: 'authorized' | 'complete';
17
+ };
18
+ /** React's `buildAuthorizedOrSucceededResult`: the merchant-facing terminal result. */
19
+ export declare function terminalResult(session: CheckoutSession, sessionId: string | null): PaymentResult;
20
+ export declare function readErrorCode(error: unknown): string | undefined;
21
+ /** Any thrown value as a {@link FloPayError}, keeping a string `code` when it has one. */
22
+ export declare function coerceError(error: unknown, fallback: string): FloPayError;
23
+ export interface ChargeSavedPaymentOptions {
24
+ api: PaymentAPI;
25
+ billingApiUrl: string;
26
+ /** The open (not terminal, not expired) session to charge. */
27
+ session: CheckoutSession;
28
+ /** Session-bound checkout token; defaults to the session's `clientSecret`. */
29
+ nonce?: string;
30
+ /**
31
+ * The session read the session came from. When the backend's auto-checkout
32
+ * already ran, its pending status URL (a `202`) or its challenge is followed
33
+ * instead of posting `/process` again.
34
+ */
35
+ unified?: NormalizedCheckoutSession | null;
36
+ /** Tears down an open 3DS challenge and its status poll (unmount). */
37
+ signal?: AbortSignal;
38
+ }
39
+ /**
40
+ * Charge the buyer's saved payment method for `session`. Resolves with the
41
+ * merchant-facing result; rejects with a {@link FloPayError} (a challenge
42
+ * cancelled through `signal` rejects with code `three_ds_aborted`).
43
+ */
44
+ export declare function chargeSavedPayment(options: ChargeSavedPaymentOptions): Promise<PaymentResult>;