@flopay/react 1.14.12 → 1.14.14
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 +17 -0
- package/dist/flopay-checkout.d.ts +7 -1
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +7 -7
- package/dist/payment-method-setup-entry.cjs +1 -1
- package/dist/split-card-form.d.ts +6 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -113,6 +113,21 @@ In full checkout, the button that pays by card lives inside the hosted card form
|
|
|
113
113
|
- **Custom layouts.** `FloPayCheckout` injects `submitLabel`, like `sessionId` and `nonce`, into its direct custom-layout children; a child's own `submitLabel` wins.
|
|
114
114
|
- **Compatibility.** Custom labels need billing API v1.9.35 or newer, whose card form carries the `messageToken` and `expectedOrigin` that authenticate the label; the SDK sends it only to that exact origin. Older billing APIs keep the default wording.
|
|
115
115
|
|
|
116
|
+
#### Initial card focus
|
|
117
|
+
|
|
118
|
+
By default, when the hosted card form becomes ready the checkout moves the cursor into it: to the first card field, or, when the checkout renders identity (email and name) or AVS fields above the card, to the first of those instead. A browser scrolls whatever it focuses into view, so inside a sheet or modal this can scroll your price, discount, or other content above the checkout out of sight as soon as it opens.
|
|
119
|
+
|
|
120
|
+
Set `cardAutoFocus={false}` on `FloPayCheckout` or `SplitCardForm` to turn that initial focus off:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<FloPayCheckout sessionId={sessionId} nonce={sessionNonce} cardAutoFocus={false} />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- **Scope.** `false` turns off only the automatic focus when the checkout opens: the hosted card form's own first-field focus and the identity/AVS field focus above it, including when the form becomes ready again after a remount or session change. Nothing is focused until the buyer chooses a field.
|
|
127
|
+
- **Buyer interaction is unchanged.** A tap or click into any field, keyboard Tab navigation, and the focus the checkout moves to a field that needs correcting (for example a missing email) all work as before. The SDK adds no timer, blur, or scroll handling of its own.
|
|
128
|
+
- **Default.** Omitted or `true` keeps the existing behaviour. `true` does not make the card form take focus over identity or AVS fields rendered above it.
|
|
129
|
+
- **Custom layouts.** `FloPayCheckout` forwards the prop to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own `cardAutoFocus`.
|
|
130
|
+
|
|
116
131
|
#### Wallets and alternative payment methods
|
|
117
132
|
|
|
118
133
|
The payment-method list is gateway-driven: the billing API sends `gateways.stripe.enabledPaymentMethods` for each session, derived from the payment methods enabled on the merchant's Stripe account. Apple Pay, Google Pay, PayPal, Link, Amazon Pay, and Klarna render as express buttons; every other enabled method (for example Cash App Pay, Affirm, iDEAL, Bancontact, SEPA Debit) renders in an accordion. Enabling a new method in Stripe needs no SDK or application change. Wallets render only on supported devices.
|
|
@@ -604,6 +619,7 @@ export function ComposedCheckout({ session, nonce }: { session: CheckoutSession;
|
|
|
604
619
|
| `enableAVS` | `boolean \| AVSFieldConfig` | Collect and validate the billing address |
|
|
605
620
|
| `avsLayout` | `'row' \| 'column'` | AVS field layout |
|
|
606
621
|
| `cardFieldOrder` | `VaultCardFieldKey[]?` | Order of the hosted card rows |
|
|
622
|
+
| `cardAutoFocus` | `boolean?` | Set `false` to stop the checkout focusing the card form (or the identity/AVS field above it) when it opens; omitted or `true` keeps the default |
|
|
607
623
|
| `cardPreFormSlot` | `ReactNode?` | Content rendered above the hosted card form |
|
|
608
624
|
| `cardButtonContent` | `ReactNode?` | Card tile content in `layout="buttons"` |
|
|
609
625
|
| `cardBackButtonContent` | `ReactNode?` | Back-button label in `layout="buttons"` |
|
|
@@ -710,6 +726,7 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
|
|
|
710
726
|
| `enabledPaymentMethods` | `string[]?` | Stripe method identifiers; `card` advertises the hosted card form |
|
|
711
727
|
| `enableAVS` | `boolean \| AVSFieldConfig` | Collect and validate the billing address |
|
|
712
728
|
| `cardFieldOrder` | `VaultCardFieldKey[]?` | Order of the hosted card rows |
|
|
729
|
+
| `cardAutoFocus` | `boolean?` | Set `false` to stop the form focusing the hosted card (or the identity/AVS field above it) when it opens; omitted or `true` keeps the default |
|
|
713
730
|
| `onBuyerIdentityReady` | `(identity) => MaybePromise<void>` | Attach a buyer identity collected by the form; `FloPayCheckout` wires its late-buyer claim here |
|
|
714
731
|
| `onTokenizedBody` | `(body: TokenizedBody) => void` | Take over non-card backend submission yourself |
|
|
715
732
|
| `onComplete` / `onDecline` / `onError` | callbacks | Checkout outcomes |
|
|
@@ -159,6 +159,12 @@ export interface FloPayCheckoutProps {
|
|
|
159
159
|
* (`name`, `number`, `expiry`). Vault card path only.
|
|
160
160
|
*/
|
|
161
161
|
cardFieldOrder?: import('@flopay/shared').VaultCardFieldKey[];
|
|
162
|
+
/**
|
|
163
|
+
* Opt out of the hosted card widget's automatic initial focus (and the host-side
|
|
164
|
+
* initial identity/AVS field focus). `false` disables it; omitted or `true` keeps
|
|
165
|
+
* the default, which never focuses the card over fields rendered above it.
|
|
166
|
+
*/
|
|
167
|
+
cardAutoFocus?: boolean;
|
|
162
168
|
/**
|
|
163
169
|
* Content rendered directly above the hosted vault card widget (below the
|
|
164
170
|
* "or pay with card" divider). Used by the demo playground to surface a
|
|
@@ -236,4 +242,4 @@ export interface FloPayCheckoutProps {
|
|
|
236
242
|
* />
|
|
237
243
|
* ```
|
|
238
244
|
*/
|
|
239
|
-
export declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onInstrument, onDecline, onCancel, onCountryChange, onZipChange, showPayPal, showStripe, walletPresentation, enabledPaymentMethods: enabledPaymentMethodsProp, showApplePay, showGooglePay, debug, layout, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
245
|
+
export declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onInstrument, onDecline, onCancel, onCountryChange, onZipChange, showPayPal, showStripe, walletPresentation, enabledPaymentMethods: enabledPaymentMethodsProp, showApplePay, showGooglePay, debug, layout, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, cardAutoFocus, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|