@flopay/react 1.4.1 → 1.4.2
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/README.md +93 -165
- package/dist/index.cjs +1131 -1653
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -180
- package/dist/index.d.ts +71 -180
- package/dist/index.mjs +919 -1434
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -18,12 +18,18 @@ interface FloPayProviderProps {
|
|
|
18
18
|
options?: {
|
|
19
19
|
locale?: string;
|
|
20
20
|
appearance?: FloPayAppearance;
|
|
21
|
+
/**
|
|
22
|
+
* Client secret for an existing non-card PaymentIntent or SetupIntent.
|
|
23
|
+
* The SDK verifies the provider intent against the `PaymentElement`'s
|
|
24
|
+
* explicit `paymentMethodTypes` allowlist before mounting and rejects card
|
|
25
|
+
* or undeclared methods. Card checkout uses the hosted vault.
|
|
26
|
+
*/
|
|
21
27
|
clientSecret?: string;
|
|
22
|
-
/** Total amount in
|
|
28
|
+
/** Total amount in cents for deferred non-card Elements without a client secret. */
|
|
23
29
|
amount?: number;
|
|
24
|
-
/** ISO 4217 currency code
|
|
30
|
+
/** ISO 4217 currency code for deferred non-card Elements without a client secret. */
|
|
25
31
|
currency?: string;
|
|
26
|
-
/** How payment methods are created
|
|
32
|
+
/** How non-card payment methods are created: `'manual'` or `'auto'` (needed for PayPal). */
|
|
27
33
|
paymentMethodCreation?: 'manual' | 'auto';
|
|
28
34
|
/** Requests reusable payment credentials for future payments. */
|
|
29
35
|
setupFutureUsage?: 'off_session' | 'on_session';
|
|
@@ -35,13 +41,20 @@ interface FloPayProviderProps {
|
|
|
35
41
|
/**
|
|
36
42
|
* Provides FloPay SDK context to the component tree.
|
|
37
43
|
*
|
|
38
|
-
* Wrap
|
|
44
|
+
* Wrap provider-context elements with this provider:
|
|
39
45
|
*
|
|
40
46
|
* ```tsx
|
|
41
47
|
* <FloPayProvider flopay={loadFloPay('pk_test_...')}>
|
|
42
|
-
* <
|
|
48
|
+
* <PaymentElement options={{ paymentMethodTypes: ['cashapp', 'ideal'] }} />
|
|
43
49
|
* </FloPayProvider>
|
|
44
50
|
* ```
|
|
51
|
+
*
|
|
52
|
+
* `FloPayCheckout` is a standalone integration that owns its provider and
|
|
53
|
+
* session-specific Elements setup:
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <FloPayCheckout sessionId="sess_..." />
|
|
57
|
+
* ```
|
|
45
58
|
*/
|
|
46
59
|
declare function FloPayProvider({ flopay: floPayProp, paypalFlopay: paypalFloPayProp, options, children, }: FloPayProviderProps): React.ReactElement;
|
|
47
60
|
|
|
@@ -82,8 +95,6 @@ interface FloPayCheckoutProps {
|
|
|
82
95
|
onError?: (error: FloPayError) => void;
|
|
83
96
|
/** Called when a payment is declined or the authentication step fails. */
|
|
84
97
|
onDecline?: (decline: DeclineEvent) => void;
|
|
85
|
-
/** Called when the full cardholder name input changes. */
|
|
86
|
-
onFullNameChange?: (value: string) => void;
|
|
87
98
|
/** Called when the AVS country dropdown changes. */
|
|
88
99
|
onCountryChange?: (country: string) => void;
|
|
89
100
|
/** Called when the AVS ZIP/postcode input changes. */
|
|
@@ -95,8 +106,8 @@ interface FloPayCheckoutProps {
|
|
|
95
106
|
*/
|
|
96
107
|
showPayPal?: boolean;
|
|
97
108
|
/**
|
|
98
|
-
* Show
|
|
99
|
-
*
|
|
109
|
+
* Show Stripe-rendered wallets/APMs alongside the vault-hosted card surface
|
|
110
|
+
* (default: `true`). When `false`, only
|
|
100
111
|
* `DirectPayPalButton` can render. Both `showStripe=false` and
|
|
101
112
|
* `showPayPal=false` (with no PayPal gateway configured) triggers a
|
|
102
113
|
* bootstrap-time validation error.
|
|
@@ -122,9 +133,9 @@ interface FloPayCheckoutProps {
|
|
|
122
133
|
/** Layout mode: 'default' (all visible) or 'buttons' (PayPal/wallets + expandable card form). */
|
|
123
134
|
layout?: 'default' | 'buttons';
|
|
124
135
|
/**
|
|
125
|
-
* High-level theme bundle that styles
|
|
126
|
-
*
|
|
127
|
-
* look, no bundle applied), `'modern-light'`, `'modern-dark'`,
|
|
136
|
+
* High-level theme bundle that styles non-card Stripe Elements, the FloPay
|
|
137
|
+
* wrapper / AVS inputs, and the hosted vault widget. One of: `'classic'`
|
|
138
|
+
* (historic FloPay look, no bundle applied), `'modern-light'`, `'modern-dark'`,
|
|
128
139
|
* `'bold-light'`, `'bold-dark'`, `'glass-light'`, `'glass-dark'`. Explicit
|
|
129
140
|
* `appearance` / `buttonsStyles` props still override their respective
|
|
130
141
|
* halves when supplied.
|
|
@@ -177,15 +188,13 @@ interface FloPayCheckoutProps {
|
|
|
177
188
|
*/
|
|
178
189
|
cardFieldOrder?: _flopay_shared.VaultCardFieldKey[];
|
|
179
190
|
/**
|
|
180
|
-
* Content rendered directly above the card
|
|
181
|
-
*
|
|
191
|
+
* Content rendered directly above the hosted vault card widget (below the
|
|
192
|
+
* "or pay with card" divider). Used by the demo playground to surface a
|
|
182
193
|
* test-cards helper; harmless to omit in a normal integration.
|
|
183
194
|
*/
|
|
184
195
|
cardPreFormSlot?: React.ReactNode;
|
|
185
196
|
/** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
|
|
186
197
|
avsLayout?: 'row' | 'column';
|
|
187
|
-
/** Label for the submit button. */
|
|
188
|
-
submitLabel?: string;
|
|
189
198
|
/** Additional CSS class for the wrapper. */
|
|
190
199
|
className?: string;
|
|
191
200
|
/** Seed an initial checkout error message for the rendered payment form. */
|
|
@@ -223,7 +232,7 @@ interface FloPayCheckoutProps {
|
|
|
223
232
|
* payment provider, and renders the appropriate UI based on checkout mode.
|
|
224
233
|
*
|
|
225
234
|
* **Modes:**
|
|
226
|
-
* - `full` (default) — renders
|
|
235
|
+
* - `full` (default) — renders hosted-vault card capture, wallets, APMs, and PayPal
|
|
227
236
|
* - `confirm` — renders a "Confirm Purchase" button, uses saved payment method
|
|
228
237
|
* - `auto` — auto-submits with saved PM, falls back to `full` on failure
|
|
229
238
|
*
|
|
@@ -235,7 +244,7 @@ interface FloPayCheckoutProps {
|
|
|
235
244
|
* />
|
|
236
245
|
* ```
|
|
237
246
|
*/
|
|
238
|
-
declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onDecline,
|
|
247
|
+
declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onDecline, onCountryChange, onZipChange, showPayPal, showStripe, showApplePay, showGooglePay, debug, layout, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, cardPreFormSlot, avsLayout, className, initialErrorMessage, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
239
248
|
|
|
240
249
|
/**
|
|
241
250
|
* Returns the current `FloPay` instance, or `null` if the provider
|
|
@@ -268,8 +277,7 @@ interface CheckoutState {
|
|
|
268
277
|
/**
|
|
269
278
|
* Returns the current checkout session state.
|
|
270
279
|
*
|
|
271
|
-
* Must be called within
|
|
272
|
-
* internally by `<CheckoutForm>`).
|
|
280
|
+
* Must be called within the checkout context rendered by `<FloPayCheckout>`.
|
|
273
281
|
*/
|
|
274
282
|
declare function useCheckout(): CheckoutState;
|
|
275
283
|
|
|
@@ -294,139 +302,28 @@ interface ElementComponentProps {
|
|
|
294
302
|
/** Fired when the Escape key is pressed inside the element. */
|
|
295
303
|
onEscape?: () => void;
|
|
296
304
|
}
|
|
305
|
+
/** Props for the standalone non-card Payment Element. */
|
|
306
|
+
interface PaymentElementProps extends Omit<ElementComponentProps, 'options'> {
|
|
307
|
+
/**
|
|
308
|
+
* Element options with an explicit wallet/APM allowlist. `card` is removed
|
|
309
|
+
* at runtime; an empty result is rejected before the provider is called.
|
|
310
|
+
*/
|
|
311
|
+
options: Omit<Partial<ElementOptions>, 'paymentMethodTypes'> & {
|
|
312
|
+
paymentMethodTypes: readonly string[];
|
|
313
|
+
};
|
|
314
|
+
}
|
|
297
315
|
/**
|
|
298
|
-
* Renders
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* TODO: Will render inside an iframe for PCI compliance in a future phase.
|
|
302
|
-
*/
|
|
303
|
-
declare const PaymentElement: React.FC<ElementComponentProps>;
|
|
304
|
-
/**
|
|
305
|
-
* Renders a combined card input (number + expiry + CVC).
|
|
306
|
-
*
|
|
307
|
-
* TODO: Will render inside an iframe for PCI compliance in a future phase.
|
|
308
|
-
*/
|
|
309
|
-
declare const CardElement: React.FC<ElementComponentProps>;
|
|
310
|
-
/**
|
|
311
|
-
* Renders a card number input field.
|
|
312
|
-
*
|
|
313
|
-
* TODO: Will render inside an iframe for PCI compliance in a future phase.
|
|
314
|
-
*/
|
|
315
|
-
declare const CardNumberElement: React.FC<ElementComponentProps>;
|
|
316
|
-
/**
|
|
317
|
-
* Renders a card expiry input field.
|
|
318
|
-
*
|
|
319
|
-
* TODO: Will render inside an iframe for PCI compliance in a future phase.
|
|
320
|
-
*/
|
|
321
|
-
declare const CardExpiryElement: React.FC<ElementComponentProps>;
|
|
322
|
-
/**
|
|
323
|
-
* Renders a card CVC input field.
|
|
324
|
-
*
|
|
325
|
-
* TODO: Will render inside an iframe for PCI compliance in a future phase.
|
|
316
|
+
* Renders a provider Payment Element restricted to the declared non-card
|
|
317
|
+
* wallet/APM methods. Card collection is available only through the hosted
|
|
318
|
+
* vault checkout surfaces.
|
|
326
319
|
*/
|
|
327
|
-
declare const
|
|
320
|
+
declare const PaymentElement: React.FC<PaymentElementProps>;
|
|
328
321
|
/**
|
|
329
322
|
* Renders an address input element.
|
|
330
323
|
*/
|
|
331
324
|
declare const AddressElement: React.FC<ElementComponentProps>;
|
|
332
325
|
|
|
333
|
-
/** Methods exposed via ref for external 3DS handling. */
|
|
334
|
-
interface CheckoutFormRef {
|
|
335
|
-
handleNextAction: (clientSecret: string) => Promise<void>;
|
|
336
|
-
}
|
|
337
|
-
/** Props for the drop-in `CheckoutForm` component. */
|
|
338
|
-
interface CheckoutFormProps {
|
|
339
|
-
/** The checkout session ID (UUID from billing API). */
|
|
340
|
-
sessionId: string;
|
|
341
|
-
/**
|
|
342
|
-
* Session-bound checkout token returned by session creation
|
|
343
|
-
* (`CheckoutSessionResult.nonce` or `session.clientSecret`). Forwarded as
|
|
344
|
-
* `x-checkout-session-token` on every continuation request — required by
|
|
345
|
-
* post-#640 backends (`TeamFloPay/backend#640`), which 401 the call when the
|
|
346
|
-
* header is missing or does not match the session's stored nonce.
|
|
347
|
-
* `FloPayCheckout` plumbs this prop automatically.
|
|
348
|
-
*/
|
|
349
|
-
nonce?: string;
|
|
350
|
-
/** Billing API base URL. Optional — defaults to the value from FloPayProvider or the shared constant. */
|
|
351
|
-
billingApiUrl?: string;
|
|
352
|
-
/** User's email (required for creating payment intents). */
|
|
353
|
-
email?: string;
|
|
354
|
-
/** User ID (required for processing payments). */
|
|
355
|
-
userId?: string;
|
|
356
|
-
/**
|
|
357
|
-
* Called when the full payment flow completes successfully.
|
|
358
|
-
* By default the form handles everything: tokenize → create intent →
|
|
359
|
-
* confirm → processPayment → 3DS retry. You just handle the success.
|
|
360
|
-
*/
|
|
361
|
-
onComplete?: (result: PaymentResult) => void;
|
|
362
|
-
/** Called when a payment error occurs. */
|
|
363
|
-
onError?: (error: FloPayError) => void;
|
|
364
|
-
/** Called when a payment is declined or the authentication step fails. */
|
|
365
|
-
onDecline?: (decline: DeclineEvent) => void;
|
|
366
|
-
/**
|
|
367
|
-
* **Override**: If provided, the form tokenizes the card and confirms
|
|
368
|
-
* the payment, but delegates backend submission to the caller.
|
|
369
|
-
* When omitted, the form calls `processPayment` internally.
|
|
370
|
-
*/
|
|
371
|
-
onTokenizedBody?: (tokenizedBody: TokenizedBody) => void;
|
|
372
|
-
/** Layout style for the PaymentElement. */
|
|
373
|
-
layout?: 'tabs' | 'accordion' | 'auto';
|
|
374
|
-
/** Label for the submit button. */
|
|
375
|
-
submitLabel?: string;
|
|
376
|
-
/** Whether to show an address element. */
|
|
377
|
-
showAddress?: boolean | 'billing' | 'shipping';
|
|
378
|
-
/** Additional CSS class for the form wrapper. */
|
|
379
|
-
className?: string;
|
|
380
|
-
/** Custom children (e.g. a custom submit button). Overrides the default button. */
|
|
381
|
-
children?: React.ReactNode;
|
|
382
|
-
/** First name for billing. */
|
|
383
|
-
firstName?: string;
|
|
384
|
-
/** Last name for billing. */
|
|
385
|
-
lastName?: string;
|
|
386
|
-
/** Checkout version for A/B tracking. */
|
|
387
|
-
chv?: string;
|
|
388
|
-
/** External processing state (used when onTokenizedBody is provided). */
|
|
389
|
-
isProcessing?: boolean;
|
|
390
|
-
/** External error message (used when onTokenizedBody is provided). */
|
|
391
|
-
error?: string | null;
|
|
392
|
-
/** Called when internal error state changes. */
|
|
393
|
-
onErrorChange?: (error: string | null) => void;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Drop-in checkout form that handles the full payment lifecycle by default.
|
|
397
|
-
*
|
|
398
|
-
* **Default (self-contained) mode** — just provide config + onComplete:
|
|
399
|
-
* ```tsx
|
|
400
|
-
* <CheckoutForm
|
|
401
|
-
* sessionId="uuid"
|
|
402
|
-
* billingApiUrl="https://api.example.com"
|
|
403
|
-
* email="user@example.com"
|
|
404
|
-
* userId="user_1"
|
|
405
|
-
* onComplete={(result) => router.push('/success')}
|
|
406
|
-
* />
|
|
407
|
-
* ```
|
|
408
|
-
*
|
|
409
|
-
* The form handles internally:
|
|
410
|
-
* 1. Validate → tokenize card → create PaymentIntent → confirm (3DS)
|
|
411
|
-
* 2. Submit token to `POST /v1/checkouts/sessions/process`
|
|
412
|
-
* 3. If backend returns `3ds_required` → re-confirm with new client secret
|
|
413
|
-
* 4. Wallet resume after redirect (PayPal, etc.)
|
|
414
|
-
*
|
|
415
|
-
* **Override mode** — provide `onTokenizedBody` to handle backend submission yourself:
|
|
416
|
-
* ```tsx
|
|
417
|
-
* <CheckoutForm
|
|
418
|
-
* ...
|
|
419
|
-
* onTokenizedBody={(body) => myCustomProcessPayment(body)}
|
|
420
|
-
* />
|
|
421
|
-
* ```
|
|
422
|
-
*/
|
|
423
|
-
declare const CheckoutForm: React.ForwardRefExoticComponent<CheckoutFormProps & React.RefAttributes<CheckoutFormRef>>;
|
|
424
|
-
|
|
425
326
|
type MaybePromise<T> = T | Promise<T>;
|
|
426
|
-
/** Methods exposed via ref for external 3DS handling. */
|
|
427
|
-
interface SplitCardFormRef {
|
|
428
|
-
handleNextAction: (clientSecret: string) => Promise<void>;
|
|
429
|
-
}
|
|
430
327
|
/** Props for the `SplitCardForm` component. */
|
|
431
328
|
interface SplitCardFormProps {
|
|
432
329
|
/** The checkout session ID (UUID from billing API). */
|
|
@@ -461,26 +358,16 @@ interface SplitCardFormProps {
|
|
|
461
358
|
lastName?: string;
|
|
462
359
|
/** Checkout version for A/B tracking. */
|
|
463
360
|
chv?: string;
|
|
464
|
-
/** Label for the submit button. */
|
|
465
|
-
submitLabel?: string;
|
|
466
361
|
/** Additional CSS class for the form wrapper. */
|
|
467
362
|
className?: string;
|
|
468
|
-
/** Custom children (overrides default submit button). */
|
|
469
|
-
children?: React.ReactNode;
|
|
470
363
|
/** External processing state. */
|
|
471
364
|
isProcessing?: boolean;
|
|
472
365
|
/** External error message. */
|
|
473
366
|
error?: string | null;
|
|
474
367
|
/** Called when internal error state changes. */
|
|
475
368
|
onErrorChange?: (error: string | null) => void;
|
|
476
|
-
/**
|
|
477
|
-
|
|
478
|
-
/** Callback when first name changes (from the name input). */
|
|
479
|
-
onFirstNameChange?: (value: string) => void;
|
|
480
|
-
/** Callback when last name changes (from the name input). */
|
|
481
|
-
onLastNameChange?: (value: string) => void;
|
|
482
|
-
/**
|
|
483
|
-
* Show the PayPal payment surface above card fields. Defaults to `true`.
|
|
369
|
+
/**
|
|
370
|
+
* Show the PayPal payment surface above the hosted vault card surface. Defaults to `true`.
|
|
484
371
|
* The renderer is chosen from `session.gateways.paypal`: when that gateway
|
|
485
372
|
* is configured, `DirectPayPalButton` (PayPal JS SDK) takes over and Stripe
|
|
486
373
|
* drops `paypal` from its express row to avoid double-rendering; otherwise
|
|
@@ -490,7 +377,7 @@ interface SplitCardFormProps {
|
|
|
490
377
|
*/
|
|
491
378
|
showPayPal?: boolean;
|
|
492
379
|
/**
|
|
493
|
-
* Show
|
|
380
|
+
* Show Stripe-rendered wallets and APMs (ExpressCheckoutElement +
|
|
494
381
|
* PaymentElement). Defaults to `true`. When `false`, every Stripe surface
|
|
495
382
|
* is hidden — only `DirectPayPalButton` can render. Setting both
|
|
496
383
|
* `showStripe={false}` and `showPayPal={false}` (with no PayPal gateway
|
|
@@ -536,8 +423,8 @@ interface SplitCardFormProps {
|
|
|
536
423
|
*/
|
|
537
424
|
layout?: 'default' | 'buttons';
|
|
538
425
|
/**
|
|
539
|
-
* High-level theme bundle that styles
|
|
540
|
-
*
|
|
426
|
+
* High-level theme bundle that styles non-card Stripe Elements, the FloPay
|
|
427
|
+
* wrapper / AVS inputs, and the hosted vault widget. One of:
|
|
541
428
|
* `'classic'` (historic FloPay look, no bundle applied), `'modern-light'`,
|
|
542
429
|
* `'modern-dark'`, `'bold-light'`, `'bold-dark'`, `'glass-light'`,
|
|
543
430
|
* `'glass-dark'`. Explicit `appearance` / `buttonsStyles` props still
|
|
@@ -555,10 +442,10 @@ interface SplitCardFormProps {
|
|
|
555
442
|
buttonsStyles?: _flopay_shared.ButtonsLayoutStyles;
|
|
556
443
|
/**
|
|
557
444
|
* Appearance from `FloPayProvider` / `FloPayCheckout`. Threaded through so
|
|
558
|
-
* the React-rendered wrapper,
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
445
|
+
* the React-rendered wrapper, AVS inputs, title, and hosted vault widget can
|
|
446
|
+
* derive colors from `appearance.variables` when no explicit `buttonsStyles`
|
|
447
|
+
* is supplied. Bundle consumers (`THEMES[id]`) get a coherent look without
|
|
448
|
+
* having to forward both halves manually.
|
|
562
449
|
*/
|
|
563
450
|
appearance?: _flopay_shared.FloPayAppearance;
|
|
564
451
|
/** Custom React content rendered inside the card button when `layout="buttons"`. */
|
|
@@ -598,7 +485,7 @@ interface SplitCardFormProps {
|
|
|
598
485
|
* Only applies on the vault card path.
|
|
599
486
|
*/
|
|
600
487
|
cardFieldOrder?: _flopay_shared.VaultCardFieldKey[];
|
|
601
|
-
/** Content rendered above the card
|
|
488
|
+
/** Content rendered above the hosted vault card widget (below the wallet divider). */
|
|
602
489
|
cardPreFormSlot?: React.ReactNode;
|
|
603
490
|
/** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
|
|
604
491
|
avsLayout?: 'row' | 'column';
|
|
@@ -652,13 +539,13 @@ interface SplitCardFormProps {
|
|
|
652
539
|
debug?: boolean;
|
|
653
540
|
}
|
|
654
541
|
/**
|
|
655
|
-
*
|
|
656
|
-
* PayPal
|
|
542
|
+
* Checkout surface combining hosted vault card capture with wallets, APMs,
|
|
543
|
+
* and PayPal. Card entry is hosted-vault-only.
|
|
657
544
|
*
|
|
658
|
-
* PayPal uses its own
|
|
659
|
-
*
|
|
545
|
+
* Stripe-hosted PayPal uses its own Elements instance; direct PayPal uses the
|
|
546
|
+
* official PayPal SDK when the session advertises that gateway.
|
|
660
547
|
*/
|
|
661
|
-
declare
|
|
548
|
+
declare function SplitCardForm(props: SplitCardFormProps): React.JSX.Element;
|
|
662
549
|
|
|
663
550
|
/** Props for {@link VaultCardFields}. */
|
|
664
551
|
interface VaultCardFieldsProps {
|
|
@@ -711,8 +598,8 @@ interface VaultCardFieldsProps {
|
|
|
711
598
|
onValidation?: (message: string | null) => void;
|
|
712
599
|
}
|
|
713
600
|
/**
|
|
714
|
-
* Renders the backend-served vault PCI card widget
|
|
715
|
-
* (
|
|
601
|
+
* Renders the backend-served vault PCI card widget
|
|
602
|
+
* (TeamFloPay/backend#823, Model A). The hosted widget
|
|
716
603
|
* is a self-contained form: PAN / CVC, the submit button, the charge, and 3DS
|
|
717
604
|
* all live inside it. This component only injects the widget HTML through the
|
|
718
605
|
* {@link CardCaptureAdapter} and bridges its `ready` / `error` lifecycle events
|
|
@@ -724,7 +611,7 @@ declare function VaultCardFields({ capture, html, messageToken, expectedOrigin,
|
|
|
724
611
|
* Props for the `PayPalButton` component.
|
|
725
612
|
*
|
|
726
613
|
* Must be rendered inside its own `FloPayProvider` with `paymentMethodCreation: undefined`
|
|
727
|
-
* (not 'manual')
|
|
614
|
+
* (not 'manual') because this PayPal flow needs automatic payment-method creation.
|
|
728
615
|
*/
|
|
729
616
|
interface PayPalButtonProps {
|
|
730
617
|
/** The checkout session ID (UUID from billing API). */
|
|
@@ -762,13 +649,12 @@ interface PayPalButtonProps {
|
|
|
762
649
|
/**
|
|
763
650
|
* PayPal button that handles the full PayPal payment flow.
|
|
764
651
|
*
|
|
765
|
-
* **Important**: PayPal requires its own `FloPayProvider`
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
* which renders PayPal in a separate `<Elements>` wrapper.
|
|
652
|
+
* **Important**: PayPal requires its own `FloPayProvider` with automatic
|
|
653
|
+
* payment-method creation. Keep it separate from manually created wallet/APM
|
|
654
|
+
* Elements groups.
|
|
769
655
|
*
|
|
770
656
|
* ```tsx
|
|
771
|
-
* {/*
|
|
657
|
+
* {/* Main checkout provider *\/}
|
|
772
658
|
* <FloPayProvider flopay={flopay} options={{ amount, currency }}>
|
|
773
659
|
* <SplitCardForm ... />
|
|
774
660
|
* </FloPayProvider>
|
|
@@ -812,6 +698,7 @@ interface DirectPayPalBeforeButtonClickResult {
|
|
|
812
698
|
* them abort the click entirely by returning `proceed: false`.
|
|
813
699
|
*/
|
|
814
700
|
type DirectPayPalRunBeforeButtonClick = (method: CheckoutButtonMethod) => Promise<DirectPayPalBeforeButtonClickResult>;
|
|
701
|
+
type DirectPayPalInitializationState = 'loading' | 'retrying' | 'ready' | 'exhausted';
|
|
815
702
|
type DirectPayPalTechnicalFailureHandler = (method: 'paypal', err: unknown, options?: {
|
|
816
703
|
code?: string;
|
|
817
704
|
popupBlocked?: boolean;
|
|
@@ -854,6 +741,10 @@ interface DirectPayPalButtonProps {
|
|
|
854
741
|
isProcessing?: boolean;
|
|
855
742
|
/** Notify the parent of the loading state for placeholder swapping. */
|
|
856
743
|
onLoadStateChange?: (ready: boolean) => void;
|
|
744
|
+
/** Notify a PayPal-only wrapper about pre-render recovery state. */
|
|
745
|
+
onInitializationStateChange?: (state: DirectPayPalInitializationState) => void;
|
|
746
|
+
/** Disable the automatic retry for a buyer-initiated single manual attempt. */
|
|
747
|
+
allowAutomaticRetry?: boolean;
|
|
857
748
|
/** Tracks button-click for analytics. */
|
|
858
749
|
onButtonClick?: (method: CheckoutButtonMethod) => void;
|
|
859
750
|
/**
|
|
@@ -868,7 +759,7 @@ interface DirectPayPalButtonProps {
|
|
|
868
759
|
/**
|
|
869
760
|
* Pre-existing PayPal Order id (or Subscription id when `isSubscription` is
|
|
870
761
|
* true) to bind the button to. When set, the button skips its usual
|
|
871
|
-
*
|
|
762
|
+
* session-scoped create-intent round-trip on click and feeds this
|
|
872
763
|
* id straight into PayPal's create-order / create-subscription callback.
|
|
873
764
|
*
|
|
874
765
|
* Used by `SplitCardForm`'s `paypal_direct_required` retry path: backend
|
|
@@ -973,4 +864,4 @@ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttribu
|
|
|
973
864
|
}
|
|
974
865
|
declare function FloPayAutomaticPaymentButton({ sessionId, nonce, createSession, paymentMethodId: _deprecatedPaymentMethodId, checkoutMethod: _deprecatedCheckoutMethod, clientId, products, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, theme, appearance, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): React.JSX.Element;
|
|
975
866
|
|
|
976
|
-
export { AddressElement,
|
|
867
|
+
export { AddressElement, type CheckoutState, DirectPayPalButton, type DirectPayPalButtonProps, type DirectPayPalInitializationState, type ElementComponentProps, FloPayAutomaticPaymentButton, type FloPayAutomaticPaymentButtonProps, type FloPayAutomaticPaymentSuccessEvent, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, PayPalButton, type PayPalButtonProps, PaymentElement, type PaymentElementProps, SplitCardForm, type SplitCardFormProps, VaultCardFields, type VaultCardFieldsProps, useCheckout, useElements, useFloPay, usePayPalFloPay };
|