@flopay/react 1.14.14 → 1.15.0

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,10 @@
1
+ /**
2
+ * Stands in for the payment methods while the billing API resolves their
3
+ * order, in the look of the express-checkout placeholders, so no method
4
+ * renders in a place it then leaves. One row per group that will show. Uses
5
+ * the `flopay-pulse` keyframes `FloPayKeyframes` mounts.
6
+ */
7
+ export declare function PaymentMethodLayoutPlaceholder({ rows, borderRadius, }: {
8
+ rows: number;
9
+ borderRadius?: string | number;
10
+ }): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { AVSFieldConfig, BeforeButtonClickEvent, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayPaymentCancelEvent, GatewayEnvironment, InlineSessionPatch, PaymentResult, PayPalProviderObjectType, TokenizedBody, WalletPresentation } from '@flopay/shared';
1
+ import type { AVSFieldConfig, BeforeButtonClickEvent, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayPaymentCancelEvent, GatewayEnvironment, InlineSessionPatch, PaymentMethodLayoutRules, PaymentResult, PayPalProviderObjectType, TokenizedBody, WalletPresentation } from '@flopay/shared';
2
2
  import { FloPayError } from '@flopay/shared';
3
3
  import React from 'react';
4
4
  import { type MaybePromise } from './buyer-identity-fallback.js';
@@ -158,6 +158,23 @@ export interface SplitCardFormProps {
158
158
  * button expands the card form with a back button to return to the button view
159
159
  */
160
160
  layout?: 'default' | 'buttons';
161
+ /**
162
+ * The merchant's rules for the order of the payment method groups: `'card'`,
163
+ * `'paypal'`, `'wallets'` (Apple Pay / Google Pay) and `'apms'` (Stripe's
164
+ * alternative payment methods), with optional per-country rules. The billing
165
+ * API applies them to each buyer (the session's country, else the buyer's IP
166
+ * country) and the form shows the order it resolves. Without the prop the
167
+ * order is PayPal, wallets, APMs, then card, with no request. While the
168
+ * first answer is pending the methods show placeholders; if the billing API
169
+ * is slow or unavailable, the default `order` applies. On the default
170
+ * layout, Card first puts the card form above the buttons; anywhere else it
171
+ * stays below "or pay with card". The rules can change after mount: a group
172
+ * whose place changes is mounted again, so set them before the buyer starts
173
+ * paying. Hiding a group stays the job of `showPayPal` / `showStripe` /
174
+ * `enabledPaymentMethods`. Billing API warnings about invalid rules are
175
+ * logged to the console.
176
+ */
177
+ paymentMethodLayout?: PaymentMethodLayoutRules;
161
178
  /**
162
179
  * High-level theme bundle that styles non-card Stripe Elements, the FloPay
163
180
  * wrapper / AVS inputs, and the hosted vault widget. One of:
@@ -0,0 +1,21 @@
1
+ import { type PaymentMethodGroup, type PaymentMethodLayoutRules } from '@flopay/shared';
2
+ /**
3
+ * How long the checkout waits for the billing API's layout before it shows
4
+ * the merchant's default order instead. A later answer is then ignored, so
5
+ * nothing moves once it is on screen.
6
+ */
7
+ export declare const PAYMENT_METHOD_LAYOUT_TIMEOUT_MS = 1500;
8
+ /**
9
+ * The order to render the payment method groups in. Without rules it is the
10
+ * default order, straight away and without a request. With rules, the billing
11
+ * API resolves it for this buyer, and `null` means the first answer is still
12
+ * pending: render placeholders, not methods that might move. A slow, failed
13
+ * or older billing API gives the merchant's default order. When the rules
14
+ * change, the previous order stays until the new one is known.
15
+ */
16
+ export declare function usePaymentMethodLayout({ rules, sessionId, nonce, billingApiUrl, }: {
17
+ rules: PaymentMethodLayoutRules | undefined;
18
+ sessionId: string;
19
+ nonce: string | undefined;
20
+ billingApiUrl: string | undefined;
21
+ }): readonly PaymentMethodGroup[] | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/react",
3
- "version": "1.14.14",
3
+ "version": "1.15.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -36,8 +36,8 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@flopay/js": "1.14.14",
40
- "@flopay/shared": "1.14.14",
39
+ "@flopay/js": "1.15.0",
40
+ "@flopay/shared": "1.15.0",
41
41
  "@paypal/paypal-js": "^11.3.0",
42
42
  "@stripe/react-stripe-js": "^7.0.1",
43
43
  "@stripe/stripe-js": "^10.3.0"