@flopay/vue 1.14.4 → 1.14.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/automatic-payment-button.d.ts +277 -0
- package/dist/buyer-identity-fallback.d.ts +82 -0
- package/dist/card-setup-entry.d.ts +2 -160
- package/dist/context.d.ts +56 -0
- package/dist/direct-paypal-button.d.ts +325 -0
- package/dist/{card-setup-entry.d.cts → flopay-card-setup.d.ts} +17 -19
- package/dist/flopay-checkout.d.ts +435 -0
- package/dist/{payment-method-setup-entry.d.cts → flopay-payment-method-setup-main.d.ts} +17 -21
- package/dist/hooks.d.ts +22 -0
- package/dist/hosted-setup.d.ts +116 -0
- package/dist/index.d.ts +20 -1947
- package/dist/payment-method-setup-entry.d.ts +2 -156
- package/dist/payment-method-setup-paypal.d.ts +108 -0
- package/dist/processing-overlay.d.ts +82 -0
- package/dist/provider.d.ts +76 -0
- package/dist/saved-payment.d.ts +44 -0
- package/dist/split-card-form.d.ts +691 -0
- package/dist/stripe-elements.d.ts +280 -0
- package/dist/stripe-paypal-continuation.d.ts +28 -0
- package/dist/vault-card-fields.d.ts +118 -0
- package/package.json +5 -5
- package/dist/hosted-setup-jpaaXDFA.d.cts +0 -33
- package/dist/hosted-setup-jpaaXDFA.d.ts +0 -33
- package/dist/index.d.cts +0 -1947
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import type { AVSFieldConfig, ButtonsLayoutStyles, ButtonsLayoutTheme, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, PaymentResult, ThemeId, VaultCardFieldKey, WalletPresentation } from '@flopay/shared';
|
|
2
|
+
import { FloPayError } from '@flopay/shared';
|
|
3
|
+
import { type PropType } from 'vue';
|
|
4
|
+
import { type SplitCardFormBeforeButtonClick } from './split-card-form.js';
|
|
5
|
+
/** Props for {@link FloPayCheckout} (React's `FloPayCheckoutProps`; callbacks are emits). */
|
|
6
|
+
export interface FloPayCheckoutProps {
|
|
7
|
+
/** An existing checkout session id (with its `nonce`). */
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
/** Session-bound checkout token returned with {@link FloPayCheckoutProps.sessionId}. */
|
|
10
|
+
nonce?: string;
|
|
11
|
+
/** Inline session draft: the checkout creates the session itself. */
|
|
12
|
+
createSession?: InlineSessionDraft;
|
|
13
|
+
billingApiUrl?: string;
|
|
14
|
+
telemetry?: boolean;
|
|
15
|
+
locale?: string;
|
|
16
|
+
layout?: 'default' | 'buttons';
|
|
17
|
+
showPayPal?: boolean;
|
|
18
|
+
showStripe?: boolean;
|
|
19
|
+
/** Explicit Stripe method list (`[]` = card only); defaults to the session's. */
|
|
20
|
+
enabledPaymentMethods?: string[];
|
|
21
|
+
/** @deprecated Session-driven visibility (`enabledPaymentMethods`) decides. */
|
|
22
|
+
showApplePay?: boolean;
|
|
23
|
+
/** @deprecated Session-driven visibility (`enabledPaymentMethods`) decides. */
|
|
24
|
+
showGooglePay?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Theme bundle (`'classic'`, `'modern-light'`, `'modern-dark'`, `'bold-light'`,
|
|
27
|
+
* `'bold-dark'`, `'glass-light'`, `'glass-dark'`) for the card form, the
|
|
28
|
+
* hosted vault widget and the Stripe methods. Explicit `appearance` /
|
|
29
|
+
* `buttonsStyles` still override their halves.
|
|
30
|
+
*/
|
|
31
|
+
theme?: ThemeId;
|
|
32
|
+
/** Visual appearance for the payment elements; wins over the theme bundle's. */
|
|
33
|
+
appearance?: FloPayAppearance;
|
|
34
|
+
/** @deprecated Use `theme`. Legacy buttons-layout preset, used only without `theme`. */
|
|
35
|
+
buttonsTheme?: ButtonsLayoutTheme;
|
|
36
|
+
/** Style overrides merged on top of the resolved theme bundle / `buttonsTheme` preset. */
|
|
37
|
+
buttonsStyles?: ButtonsLayoutStyles;
|
|
38
|
+
/** Additional CSS class for the form wrapper. */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Final, localized wording for the hosted card form's submit button. */
|
|
41
|
+
submitLabel?: string | null;
|
|
42
|
+
/** Address verification: `true` (country + postcode) or per-field {@link AVSFieldConfig}. */
|
|
43
|
+
enableAVS?: boolean | AVSFieldConfig;
|
|
44
|
+
/** Layout for AVS fields: `row` (side by side, default) or `column` (stacked). */
|
|
45
|
+
avsLayout?: 'row' | 'column';
|
|
46
|
+
/**
|
|
47
|
+
* Order of the hosted vault card rows, a permutation of
|
|
48
|
+
* `['name', 'number', 'expiry']` (visual and tab order). Vault card path only.
|
|
49
|
+
*/
|
|
50
|
+
cardFieldOrder?: VaultCardFieldKey[];
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Not rendered, as in React: the default-layout security footer
|
|
53
|
+
* was removed. Accepted so integrations ported from React keep compiling.
|
|
54
|
+
*/
|
|
55
|
+
showSecurityFooter?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Ignored, as in React: the Stripe publishable key comes only
|
|
58
|
+
* from the session's `gateways.stripe.publishableKey`.
|
|
59
|
+
*/
|
|
60
|
+
fallbackPublishableKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Override the session's `checkoutMode`: `'full'` shows the payment form
|
|
63
|
+
* (default), `'confirm'` a confirm button that charges the saved payment
|
|
64
|
+
* method, `'auto'` charges it on mount and falls back to `'full'` on failure.
|
|
65
|
+
*/
|
|
66
|
+
checkoutMode?: CheckoutMode;
|
|
67
|
+
/**
|
|
68
|
+
* Label for the saved-payment confirm button in `confirm` mode. Default:
|
|
69
|
+
* `'Confirm Purchase'`. The hosted card button uses `submitLabel` instead.
|
|
70
|
+
* React's `renderConfirmButton` is the `renderConfirmButton` slot, which
|
|
71
|
+
* receives `{ onConfirm, isProcessing }`.
|
|
72
|
+
*/
|
|
73
|
+
confirmLabel?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Seed a checkout error message: shown above the confirm button or the
|
|
76
|
+
* payment form until the buyer's next attempt.
|
|
77
|
+
*/
|
|
78
|
+
initialErrorMessage?: string | null;
|
|
79
|
+
/**
|
|
80
|
+
* React's `initialPayPalOrderId`: a backend-created PayPal order to resume
|
|
81
|
+
* instead of creating a new one. It goes to the built-in form's
|
|
82
|
+
* `directPaypal.existingOrderId`.
|
|
83
|
+
*/
|
|
84
|
+
initialPayPalOrderId?: string;
|
|
85
|
+
/** React's `debug`: the built-in form's gating panels and PayPal tracer. Off by default. */
|
|
86
|
+
debug?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The all-in-one checkout. Given `createSession`, an inline full-mode session
|
|
90
|
+
* is created detached (`deferDataAttachment: true`): the hosted card form
|
|
91
|
+
* mounts from the shell while the catalog is attached by a background claim,
|
|
92
|
+
* and payment is gated only until that claim settles. `deferDataAttachment:
|
|
93
|
+
* false` keeps the one-shot create. It renders exactly the methods the
|
|
94
|
+
* session advertises and sends no gateway hint or provider selection.
|
|
95
|
+
*
|
|
96
|
+
* Slots: `default` renders inside the checkout context (alongside the form);
|
|
97
|
+
* `layout` replaces the built-in `SplitCardForm` with a custom layout, whose
|
|
98
|
+
* `SplitCardForm` receives the session, nonce and `submitLabel` unless it
|
|
99
|
+
* sets them itself. `cardButtonContent`, `cardBackButtonContent`,
|
|
100
|
+
* `cardTitleContent` and `cardPreFormSlot` (React's content props) pass to
|
|
101
|
+
* the built-in `SplitCardForm`. `renderConfirmButton` (React's render prop)
|
|
102
|
+
* replaces the `confirm`-mode button and receives `{ onConfirm, isProcessing }`.
|
|
103
|
+
*
|
|
104
|
+
* Modes (React's): `full` renders the payment form; `confirm` renders a
|
|
105
|
+
* confirm button that charges the buyer's saved payment method; `auto`
|
|
106
|
+
* charges it on mount. A failed saved payment shows its error and falls back
|
|
107
|
+
* to `full`. A session that is already paid emits `sessionCompleted` with its
|
|
108
|
+
* success URL (an authorized one also `complete`) and renders no form.
|
|
109
|
+
*/
|
|
110
|
+
export declare const FloPayCheckout: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
111
|
+
sessionId: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: undefined;
|
|
114
|
+
};
|
|
115
|
+
nonce: {
|
|
116
|
+
type: StringConstructor;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
119
|
+
createSession: {
|
|
120
|
+
type: PropType<InlineSessionDraft>;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
checkoutMode: {
|
|
124
|
+
type: PropType<CheckoutMode>;
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
billingApiUrl: {
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
telemetry: {
|
|
132
|
+
type: BooleanConstructor;
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
135
|
+
locale: {
|
|
136
|
+
type: StringConstructor;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
layout: {
|
|
140
|
+
type: PropType<'default' | 'buttons'>;
|
|
141
|
+
default: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* React's `walletPresentation` (default `'auto'`): the preferred approval
|
|
145
|
+
* presentation for Stripe-routed PayPal, passed to the built-in form and
|
|
146
|
+
* to a custom-layout form that leaves its own unset.
|
|
147
|
+
*/
|
|
148
|
+
walletPresentation: {
|
|
149
|
+
type: PropType<WalletPresentation>;
|
|
150
|
+
default: string;
|
|
151
|
+
};
|
|
152
|
+
showPayPal: {
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
default: boolean;
|
|
155
|
+
};
|
|
156
|
+
showStripe: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
160
|
+
enabledPaymentMethods: {
|
|
161
|
+
type: PropType<string[]>;
|
|
162
|
+
default: undefined;
|
|
163
|
+
};
|
|
164
|
+
/** @deprecated Session-driven visibility decides (React parity). */
|
|
165
|
+
showApplePay: {
|
|
166
|
+
type: BooleanConstructor;
|
|
167
|
+
default: boolean;
|
|
168
|
+
};
|
|
169
|
+
/** @deprecated Session-driven visibility decides (React parity). */
|
|
170
|
+
showGooglePay: {
|
|
171
|
+
type: BooleanConstructor;
|
|
172
|
+
default: boolean;
|
|
173
|
+
};
|
|
174
|
+
theme: {
|
|
175
|
+
type: PropType<ThemeId>;
|
|
176
|
+
default: undefined;
|
|
177
|
+
};
|
|
178
|
+
appearance: {
|
|
179
|
+
type: PropType<FloPayAppearance>;
|
|
180
|
+
default: undefined;
|
|
181
|
+
};
|
|
182
|
+
buttonsTheme: {
|
|
183
|
+
type: PropType<ButtonsLayoutTheme>;
|
|
184
|
+
default: undefined;
|
|
185
|
+
};
|
|
186
|
+
buttonsStyles: {
|
|
187
|
+
type: PropType<ButtonsLayoutStyles>;
|
|
188
|
+
default: undefined;
|
|
189
|
+
};
|
|
190
|
+
className: {
|
|
191
|
+
type: StringConstructor;
|
|
192
|
+
default: undefined;
|
|
193
|
+
};
|
|
194
|
+
submitLabel: {
|
|
195
|
+
type: PropType<string | null>;
|
|
196
|
+
default: undefined;
|
|
197
|
+
};
|
|
198
|
+
enableAVS: {
|
|
199
|
+
type: PropType<boolean | AVSFieldConfig>;
|
|
200
|
+
default: undefined;
|
|
201
|
+
};
|
|
202
|
+
avsLayout: {
|
|
203
|
+
type: PropType<'row' | 'column'>;
|
|
204
|
+
default: undefined;
|
|
205
|
+
};
|
|
206
|
+
cardFieldOrder: {
|
|
207
|
+
type: PropType<VaultCardFieldKey[]>;
|
|
208
|
+
default: undefined;
|
|
209
|
+
};
|
|
210
|
+
/** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
|
|
211
|
+
showSecurityFooter: {
|
|
212
|
+
type: BooleanConstructor;
|
|
213
|
+
default: undefined;
|
|
214
|
+
};
|
|
215
|
+
/** @deprecated Ignored (React parity); see {@link FloPayCheckoutProps.fallbackPublishableKey}. */
|
|
216
|
+
fallbackPublishableKey: {
|
|
217
|
+
type: StringConstructor;
|
|
218
|
+
default: undefined;
|
|
219
|
+
};
|
|
220
|
+
confirmLabel: {
|
|
221
|
+
type: StringConstructor;
|
|
222
|
+
default: undefined;
|
|
223
|
+
};
|
|
224
|
+
initialErrorMessage: {
|
|
225
|
+
type: PropType<string | null>;
|
|
226
|
+
default: null;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* React's `onBeforeButtonClick` (a function prop: its result is read),
|
|
230
|
+
* passed to the built-in `SplitCardForm`. It runs before the buttons-layout
|
|
231
|
+
* card tile opens and before PayPal creates its order.
|
|
232
|
+
*/
|
|
233
|
+
onBeforeButtonClick: {
|
|
234
|
+
type: PropType<SplitCardFormBeforeButtonClick>;
|
|
235
|
+
default: undefined;
|
|
236
|
+
};
|
|
237
|
+
initialPayPalOrderId: {
|
|
238
|
+
type: StringConstructor;
|
|
239
|
+
default: undefined;
|
|
240
|
+
};
|
|
241
|
+
debug: {
|
|
242
|
+
type: BooleanConstructor;
|
|
243
|
+
default: boolean;
|
|
244
|
+
};
|
|
245
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
246
|
+
[key: string]: any;
|
|
247
|
+
}>[] | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
248
|
+
[key: string]: any;
|
|
249
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
250
|
+
complete: (_result: PaymentResult) => true;
|
|
251
|
+
error: (_error: FloPayError) => true;
|
|
252
|
+
instrument: (_event: FloInstrumentEvent) => true;
|
|
253
|
+
decline: (_decline: DeclineEvent) => true;
|
|
254
|
+
cancel: (_event: FloPayPaymentCancelEvent) => true;
|
|
255
|
+
buttonClick: (_method: CheckoutButtonMethod) => true;
|
|
256
|
+
countryChange: (_country: string) => true;
|
|
257
|
+
zipChange: (_zip: string) => true;
|
|
258
|
+
sessionCompleted: (_successUrl: string) => true;
|
|
259
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
260
|
+
sessionId: {
|
|
261
|
+
type: StringConstructor;
|
|
262
|
+
default: undefined;
|
|
263
|
+
};
|
|
264
|
+
nonce: {
|
|
265
|
+
type: StringConstructor;
|
|
266
|
+
default: undefined;
|
|
267
|
+
};
|
|
268
|
+
createSession: {
|
|
269
|
+
type: PropType<InlineSessionDraft>;
|
|
270
|
+
default: undefined;
|
|
271
|
+
};
|
|
272
|
+
checkoutMode: {
|
|
273
|
+
type: PropType<CheckoutMode>;
|
|
274
|
+
default: undefined;
|
|
275
|
+
};
|
|
276
|
+
billingApiUrl: {
|
|
277
|
+
type: StringConstructor;
|
|
278
|
+
default: undefined;
|
|
279
|
+
};
|
|
280
|
+
telemetry: {
|
|
281
|
+
type: BooleanConstructor;
|
|
282
|
+
default: undefined;
|
|
283
|
+
};
|
|
284
|
+
locale: {
|
|
285
|
+
type: StringConstructor;
|
|
286
|
+
default: undefined;
|
|
287
|
+
};
|
|
288
|
+
layout: {
|
|
289
|
+
type: PropType<'default' | 'buttons'>;
|
|
290
|
+
default: string;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* React's `walletPresentation` (default `'auto'`): the preferred approval
|
|
294
|
+
* presentation for Stripe-routed PayPal, passed to the built-in form and
|
|
295
|
+
* to a custom-layout form that leaves its own unset.
|
|
296
|
+
*/
|
|
297
|
+
walletPresentation: {
|
|
298
|
+
type: PropType<WalletPresentation>;
|
|
299
|
+
default: string;
|
|
300
|
+
};
|
|
301
|
+
showPayPal: {
|
|
302
|
+
type: BooleanConstructor;
|
|
303
|
+
default: boolean;
|
|
304
|
+
};
|
|
305
|
+
showStripe: {
|
|
306
|
+
type: BooleanConstructor;
|
|
307
|
+
default: boolean;
|
|
308
|
+
};
|
|
309
|
+
enabledPaymentMethods: {
|
|
310
|
+
type: PropType<string[]>;
|
|
311
|
+
default: undefined;
|
|
312
|
+
};
|
|
313
|
+
/** @deprecated Session-driven visibility decides (React parity). */
|
|
314
|
+
showApplePay: {
|
|
315
|
+
type: BooleanConstructor;
|
|
316
|
+
default: boolean;
|
|
317
|
+
};
|
|
318
|
+
/** @deprecated Session-driven visibility decides (React parity). */
|
|
319
|
+
showGooglePay: {
|
|
320
|
+
type: BooleanConstructor;
|
|
321
|
+
default: boolean;
|
|
322
|
+
};
|
|
323
|
+
theme: {
|
|
324
|
+
type: PropType<ThemeId>;
|
|
325
|
+
default: undefined;
|
|
326
|
+
};
|
|
327
|
+
appearance: {
|
|
328
|
+
type: PropType<FloPayAppearance>;
|
|
329
|
+
default: undefined;
|
|
330
|
+
};
|
|
331
|
+
buttonsTheme: {
|
|
332
|
+
type: PropType<ButtonsLayoutTheme>;
|
|
333
|
+
default: undefined;
|
|
334
|
+
};
|
|
335
|
+
buttonsStyles: {
|
|
336
|
+
type: PropType<ButtonsLayoutStyles>;
|
|
337
|
+
default: undefined;
|
|
338
|
+
};
|
|
339
|
+
className: {
|
|
340
|
+
type: StringConstructor;
|
|
341
|
+
default: undefined;
|
|
342
|
+
};
|
|
343
|
+
submitLabel: {
|
|
344
|
+
type: PropType<string | null>;
|
|
345
|
+
default: undefined;
|
|
346
|
+
};
|
|
347
|
+
enableAVS: {
|
|
348
|
+
type: PropType<boolean | AVSFieldConfig>;
|
|
349
|
+
default: undefined;
|
|
350
|
+
};
|
|
351
|
+
avsLayout: {
|
|
352
|
+
type: PropType<'row' | 'column'>;
|
|
353
|
+
default: undefined;
|
|
354
|
+
};
|
|
355
|
+
cardFieldOrder: {
|
|
356
|
+
type: PropType<VaultCardFieldKey[]>;
|
|
357
|
+
default: undefined;
|
|
358
|
+
};
|
|
359
|
+
/** @deprecated Not rendered (React parity); see {@link FloPayCheckoutProps.showSecurityFooter}. */
|
|
360
|
+
showSecurityFooter: {
|
|
361
|
+
type: BooleanConstructor;
|
|
362
|
+
default: undefined;
|
|
363
|
+
};
|
|
364
|
+
/** @deprecated Ignored (React parity); see {@link FloPayCheckoutProps.fallbackPublishableKey}. */
|
|
365
|
+
fallbackPublishableKey: {
|
|
366
|
+
type: StringConstructor;
|
|
367
|
+
default: undefined;
|
|
368
|
+
};
|
|
369
|
+
confirmLabel: {
|
|
370
|
+
type: StringConstructor;
|
|
371
|
+
default: undefined;
|
|
372
|
+
};
|
|
373
|
+
initialErrorMessage: {
|
|
374
|
+
type: PropType<string | null>;
|
|
375
|
+
default: null;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* React's `onBeforeButtonClick` (a function prop: its result is read),
|
|
379
|
+
* passed to the built-in `SplitCardForm`. It runs before the buttons-layout
|
|
380
|
+
* card tile opens and before PayPal creates its order.
|
|
381
|
+
*/
|
|
382
|
+
onBeforeButtonClick: {
|
|
383
|
+
type: PropType<SplitCardFormBeforeButtonClick>;
|
|
384
|
+
default: undefined;
|
|
385
|
+
};
|
|
386
|
+
initialPayPalOrderId: {
|
|
387
|
+
type: StringConstructor;
|
|
388
|
+
default: undefined;
|
|
389
|
+
};
|
|
390
|
+
debug: {
|
|
391
|
+
type: BooleanConstructor;
|
|
392
|
+
default: boolean;
|
|
393
|
+
};
|
|
394
|
+
}>> & Readonly<{
|
|
395
|
+
onButtonClick?: ((_method: CheckoutButtonMethod) => any) | undefined;
|
|
396
|
+
onCancel?: ((_event: FloPayPaymentCancelEvent) => any) | undefined;
|
|
397
|
+
onComplete?: ((_result: PaymentResult) => any) | undefined;
|
|
398
|
+
onCountryChange?: ((_country: string) => any) | undefined;
|
|
399
|
+
onDecline?: ((_decline: DeclineEvent) => any) | undefined;
|
|
400
|
+
onError?: ((_error: FloPayError) => any) | undefined;
|
|
401
|
+
onInstrument?: ((_event: FloInstrumentEvent) => any) | undefined;
|
|
402
|
+
onSessionCompleted?: ((_successUrl: string) => any) | undefined;
|
|
403
|
+
onZipChange?: ((_zip: string) => any) | undefined;
|
|
404
|
+
}>, {
|
|
405
|
+
sessionId: string;
|
|
406
|
+
nonce: string;
|
|
407
|
+
createSession: InlineSessionDraft;
|
|
408
|
+
checkoutMode: CheckoutMode;
|
|
409
|
+
billingApiUrl: string;
|
|
410
|
+
telemetry: boolean;
|
|
411
|
+
locale: string;
|
|
412
|
+
layout: "buttons" | "default";
|
|
413
|
+
walletPresentation: WalletPresentation;
|
|
414
|
+
showPayPal: boolean;
|
|
415
|
+
showStripe: boolean;
|
|
416
|
+
enabledPaymentMethods: string[];
|
|
417
|
+
showApplePay: boolean;
|
|
418
|
+
showGooglePay: boolean;
|
|
419
|
+
theme: ThemeId;
|
|
420
|
+
appearance: FloPayAppearance;
|
|
421
|
+
buttonsTheme: ButtonsLayoutTheme;
|
|
422
|
+
buttonsStyles: ButtonsLayoutStyles;
|
|
423
|
+
className: string;
|
|
424
|
+
submitLabel: string | null;
|
|
425
|
+
enableAVS: boolean | AVSFieldConfig;
|
|
426
|
+
avsLayout: "column" | "row";
|
|
427
|
+
cardFieldOrder: VaultCardFieldKey[];
|
|
428
|
+
showSecurityFooter: boolean;
|
|
429
|
+
fallbackPublishableKey: string;
|
|
430
|
+
confirmLabel: string;
|
|
431
|
+
initialErrorMessage: string | null;
|
|
432
|
+
onBeforeButtonClick: SplitCardFormBeforeButtonClick;
|
|
433
|
+
initialPayPalOrderId: string;
|
|
434
|
+
debug: boolean;
|
|
435
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PropType, VNode } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
import { a as FloPayCardSetupCompleteEvent, F as FloPayCardSetupCancelEvent, b as FloPayCardSetupDeclineEvent, c as FloPayCardSetupError } from './hosted-setup-jpaaXDFA.cjs';
|
|
5
|
-
|
|
1
|
+
import type { ButtonsLayoutStyles, FloPayAppearance, ThemeId, VaultCardThemeColors } from '@flopay/shared';
|
|
2
|
+
import { type PropType, type VNode } from 'vue';
|
|
3
|
+
import { type FloPayCardSetupCancelEvent, type FloPayCardSetupCompleteEvent, type FloPayCardSetupDeclineEvent, type FloPayCardSetupError } from './hosted-setup.js';
|
|
6
4
|
/** Verified terminal result from saving any advertised payment method. */
|
|
7
|
-
type FloPayPaymentMethodSetupCompleteEvent = FloPayCardSetupCompleteEvent;
|
|
5
|
+
export type FloPayPaymentMethodSetupCompleteEvent = FloPayCardSetupCompleteEvent;
|
|
8
6
|
/** Provider-neutral terminal decline from saving a payment method. */
|
|
9
|
-
type FloPayPaymentMethodSetupDeclineEvent = FloPayCardSetupDeclineEvent;
|
|
7
|
+
export type FloPayPaymentMethodSetupDeclineEvent = FloPayCardSetupDeclineEvent;
|
|
10
8
|
/** Abandoned setup emitted when the surface unmounts before an outcome. */
|
|
11
|
-
type FloPayPaymentMethodSetupCancelEvent = FloPayCardSetupCancelEvent;
|
|
9
|
+
export type FloPayPaymentMethodSetupCancelEvent = FloPayCardSetupCancelEvent;
|
|
12
10
|
/** Props for {@link FloPayPaymentMethodSetup} (callbacks are emits). */
|
|
13
|
-
interface FloPayPaymentMethodSetupProps {
|
|
11
|
+
export interface FloPayPaymentMethodSetupProps {
|
|
14
12
|
sessionId: string;
|
|
15
13
|
nonce: string;
|
|
16
14
|
billingApiUrl?: string;
|
|
@@ -58,7 +56,7 @@ interface FloPayPaymentMethodSetupProps {
|
|
|
58
56
|
* backend reports the method saved, and only then is `complete` emitted, once.
|
|
59
57
|
* A `decline` is never paired with a `complete`.
|
|
60
58
|
*/
|
|
61
|
-
declare const FloPayPaymentMethodSetup: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
59
|
+
export declare const FloPayPaymentMethodSetup: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
62
60
|
sessionId: {
|
|
63
61
|
type: StringConstructor;
|
|
64
62
|
default: undefined;
|
|
@@ -91,18 +89,18 @@ declare const FloPayPaymentMethodSetup: vue.DefineComponent<vue.ExtractPropTypes
|
|
|
91
89
|
type: PropType<ButtonsLayoutStyles>;
|
|
92
90
|
default: undefined;
|
|
93
91
|
};
|
|
94
|
-
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
92
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
95
93
|
[key: string]: any;
|
|
96
|
-
}> | VNode<vue.RendererNode, vue.RendererElement, {
|
|
94
|
+
}>[] | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
97
95
|
[key: string]: any;
|
|
98
|
-
}>
|
|
96
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
99
97
|
ready: () => true;
|
|
100
98
|
complete: (_event: FloPayPaymentMethodSetupCompleteEvent) => true;
|
|
101
99
|
cancel: (_event: FloPayPaymentMethodSetupCancelEvent) => true;
|
|
102
100
|
decline: (_event: FloPayPaymentMethodSetupDeclineEvent) => true;
|
|
103
101
|
validation: (_message: string | null) => true;
|
|
104
102
|
error: (_error: FloPayCardSetupError) => true;
|
|
105
|
-
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
103
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
106
104
|
sessionId: {
|
|
107
105
|
type: StringConstructor;
|
|
108
106
|
default: undefined;
|
|
@@ -136,21 +134,19 @@ declare const FloPayPaymentMethodSetup: vue.DefineComponent<vue.ExtractPropTypes
|
|
|
136
134
|
default: undefined;
|
|
137
135
|
};
|
|
138
136
|
}>> & Readonly<{
|
|
139
|
-
onComplete?: ((_event: FloPayCardSetupCompleteEvent) => any) | undefined;
|
|
140
137
|
onCancel?: ((_event: FloPayCardSetupCancelEvent) => any) | undefined;
|
|
138
|
+
onComplete?: ((_event: FloPayCardSetupCompleteEvent) => any) | undefined;
|
|
139
|
+
onDecline?: ((_event: FloPayCardSetupDeclineEvent) => any) | undefined;
|
|
141
140
|
onError?: ((_error: FloPayCardSetupError) => any) | undefined;
|
|
142
141
|
onReady?: (() => any) | undefined;
|
|
143
|
-
onDecline?: ((_event: FloPayCardSetupDeclineEvent) => any) | undefined;
|
|
144
142
|
onValidation?: ((_message: string | null) => any) | undefined;
|
|
145
143
|
}>, {
|
|
146
|
-
nonce: string;
|
|
147
144
|
sessionId: string;
|
|
145
|
+
nonce: string;
|
|
148
146
|
billingApiUrl: string;
|
|
149
147
|
telemetry: boolean;
|
|
150
|
-
appearance: FloPayAppearance;
|
|
151
148
|
theme: VaultCardThemeColors | ThemeId;
|
|
152
149
|
containerStyle: Record<string, string | number>;
|
|
150
|
+
appearance: FloPayAppearance;
|
|
153
151
|
buttonsStyles: ButtonsLayoutStyles;
|
|
154
|
-
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
155
|
-
|
|
156
|
-
export { FloPayPaymentMethodSetup, type FloPayPaymentMethodSetupCancelEvent, type FloPayPaymentMethodSetupCompleteEvent, type FloPayPaymentMethodSetupDeclineEvent, type FloPayPaymentMethodSetupProps };
|
|
152
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FloPay } from '@flopay/js';
|
|
2
|
+
import { type ShallowRef } from 'vue';
|
|
3
|
+
import { type CheckoutState } from './context.js';
|
|
4
|
+
export type { CheckoutState } from './context.js';
|
|
5
|
+
/**
|
|
6
|
+
* The current `FloPay` instance as a ref: `null` while the provider's
|
|
7
|
+
* `loadFloPay()` promise is pending (or outside a `FloPayProvider`), then the
|
|
8
|
+
* instance. Read it as `useFloPay().value`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useFloPay(): Readonly<ShallowRef<FloPay | null>>;
|
|
11
|
+
/**
|
|
12
|
+
* The Stripe `FloPay` instance dedicated to the Stripe-rendered PayPal
|
|
13
|
+
* fallback, or `null` when PayPal is disabled. Direct PayPal
|
|
14
|
+
* (`gateways.paypal`) does not use this instance.
|
|
15
|
+
*/
|
|
16
|
+
export declare function usePayPalFloPay(): Readonly<ShallowRef<FloPay | null>>;
|
|
17
|
+
/**
|
|
18
|
+
* Reactive checkout state from the enclosing `FloPayCheckout`
|
|
19
|
+
* (`session`, `loading`, `error`, `claimPending`). Outside a checkout it is
|
|
20
|
+
* the same idle default the React hook returns.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCheckout(): CheckoutState;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ButtonsLayoutStyles, CardCaptureAdapter, CardCaptureMountOptions, FloPayAppearance, FloPayErrorType, NormalizedCheckoutSession, SavedCardDisplay, ThemeId, VaultCardThemeColors } from '@flopay/shared';
|
|
2
|
+
import { FloPayError } from '@flopay/shared';
|
|
3
|
+
import { type Ref, type ShallowRef } from 'vue';
|
|
4
|
+
/** Verified terminal result from a no-charge setup. */
|
|
5
|
+
export interface FloPayCardSetupCompleteEvent {
|
|
6
|
+
status: 'succeeded';
|
|
7
|
+
sessionId: string;
|
|
8
|
+
/** Present when the backend terminal message includes the saved-card display DTO. */
|
|
9
|
+
paymentMethod?: SavedCardDisplay;
|
|
10
|
+
}
|
|
11
|
+
/** Provider-neutral terminal decline from verification. */
|
|
12
|
+
export interface FloPayCardSetupDeclineEvent {
|
|
13
|
+
status: 'declined';
|
|
14
|
+
sessionId: string;
|
|
15
|
+
reason?: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Abandoned setup result emitted when the component unmounts pre-terminally. */
|
|
19
|
+
export interface FloPayCardSetupCancelEvent {
|
|
20
|
+
status: 'cancelled';
|
|
21
|
+
sessionId: string;
|
|
22
|
+
}
|
|
23
|
+
/** Structured technical/validation failure from a setup surface. */
|
|
24
|
+
export declare class FloPayCardSetupError extends FloPayError {
|
|
25
|
+
readonly retryable: boolean;
|
|
26
|
+
constructor(message: string, type: FloPayErrorType, options: {
|
|
27
|
+
code: string;
|
|
28
|
+
retryable: boolean;
|
|
29
|
+
param?: string;
|
|
30
|
+
statusCode?: number;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** Unknown failures are retryable; FloPay errors only for network, rate-limit, 5xx or timeout. */
|
|
34
|
+
export declare function asCardSetupError(error: unknown, overrides?: {
|
|
35
|
+
code?: string;
|
|
36
|
+
retryable?: boolean;
|
|
37
|
+
}): FloPayCardSetupError;
|
|
38
|
+
/**
|
|
39
|
+
* React's `FloPayCardSetup` and `FloPayPaymentMethodSetup` theme resolution
|
|
40
|
+
* (`resolveCardSetupTheme` in `@flopay/shared`): a `ThemeId` plus a client's stored `appearance` and
|
|
41
|
+
* `buttonsStyles` resolve exactly as `FloPayCheckout` resolves them, so one
|
|
42
|
+
* stored theme renders the same hosted card form on both surfaces. The
|
|
43
|
+
* `appearance` override replaces the preset's, `buttonsStyles` merges over the
|
|
44
|
+
* preset layout, empty `{}` groups count as absent, raw colors pass through
|
|
45
|
+
* untouched (overrides ignored), `'classic'` without overrides keeps the
|
|
46
|
+
* explicit `null` reset, and an unknown preset id renders `modern-light`. The
|
|
47
|
+
* effective theme drives the hosted fields and submit button, the pane beneath
|
|
48
|
+
* the merchant's `containerStyle`, and the outcome overlay; its `appearance`
|
|
49
|
+
* also goes to the Stripe Elements of the payment-method setup form. Nothing
|
|
50
|
+
* here is a mount input: a change only re-skins the mounted widget, its
|
|
51
|
+
* container and the overlay.
|
|
52
|
+
*/
|
|
53
|
+
export declare function useCardSetupTheme(source: {
|
|
54
|
+
theme?: ThemeId | VaultCardThemeColors | undefined;
|
|
55
|
+
appearance?: FloPayAppearance | undefined;
|
|
56
|
+
buttonsStyles?: ButtonsLayoutStyles | undefined;
|
|
57
|
+
containerStyle?: Record<string, string | number> | undefined;
|
|
58
|
+
}): {
|
|
59
|
+
vaultTheme: import("vue").ComputedRef<VaultCardThemeColors | null>;
|
|
60
|
+
surfaceStyle: import("vue").ComputedRef<Record<string, string | number> | undefined>;
|
|
61
|
+
overlayTheme: import("vue").ComputedRef<import("@flopay/shared").ProcessingOverlayThemeColors | undefined>;
|
|
62
|
+
appearance: import("vue").ComputedRef<FloPayAppearance | undefined>;
|
|
63
|
+
};
|
|
64
|
+
interface SetupProps {
|
|
65
|
+
sessionId?: string;
|
|
66
|
+
nonce?: string;
|
|
67
|
+
billingApiUrl?: string;
|
|
68
|
+
telemetry?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** What the hosted card's outcome overlay shows; `null` hides it. */
|
|
71
|
+
export interface HostedCardOverlay {
|
|
72
|
+
status: 'processing' | 'success' | 'error';
|
|
73
|
+
message: string | null;
|
|
74
|
+
}
|
|
75
|
+
interface SetupEmitters {
|
|
76
|
+
complete: (event: FloPayCardSetupCompleteEvent) => void;
|
|
77
|
+
decline: (event: FloPayCardSetupDeclineEvent) => void;
|
|
78
|
+
cancel: (event: FloPayCardSetupCancelEvent) => void;
|
|
79
|
+
error: (error: FloPayCardSetupError) => void;
|
|
80
|
+
/**
|
|
81
|
+
* React's processing / success / failure overlay over the hosted card:
|
|
82
|
+
* processing from the widget's `submitting`, success held before
|
|
83
|
+
* `complete`, failure held after a decline or a mid-submission error, then
|
|
84
|
+
* cleared so the buyer can retry in place.
|
|
85
|
+
*/
|
|
86
|
+
overlay: (state: HostedCardOverlay | null) => void;
|
|
87
|
+
}
|
|
88
|
+
interface HostedSetupState {
|
|
89
|
+
capture: ShallowRef<CardCaptureAdapter | null>;
|
|
90
|
+
/**
|
|
91
|
+
* The adapter's mount options for the hosted card form: the block's `html`,
|
|
92
|
+
* or, for a verification-required block without one, the billing API's
|
|
93
|
+
* credential-free hosted form shell (sdk#414).
|
|
94
|
+
*/
|
|
95
|
+
vault: ShallowRef<CardCaptureMountOptions | null>;
|
|
96
|
+
session: ShallowRef<NormalizedCheckoutSession | null>;
|
|
97
|
+
loadError: Ref<FloPayCardSetupError | null>;
|
|
98
|
+
/** Marks a terminal outcome reached outside the hosted card (wallet/APM). */
|
|
99
|
+
settle: () => void;
|
|
100
|
+
/**
|
|
101
|
+
* A hosted-widget error message. Mid-submission it flips the overlay to the
|
|
102
|
+
* failure state (then clears it); a pre-submit load error never paints a
|
|
103
|
+
* failure over a form the buyer has not submitted.
|
|
104
|
+
*/
|
|
105
|
+
widgetFailed: (message: string) => void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Reads a merchant-created setup session with its nonce (`GET`, never a
|
|
109
|
+
* `POST /sessions/setup`) and prepares the hosted card capture. The hosted
|
|
110
|
+
* widget owns the charge-free verification and 3DS; this never posts a 3DS
|
|
111
|
+
* completion of its own. Runs only in the browser (`onMounted`).
|
|
112
|
+
*/
|
|
113
|
+
export declare function useHostedSetup(props: SetupProps, emitters: SetupEmitters, options: {
|
|
114
|
+
requireVault: (session: NormalizedCheckoutSession) => boolean;
|
|
115
|
+
}): HostedSetupState;
|
|
116
|
+
export {};
|