@flopay/react 1.14.15 → 1.16.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,19 @@
1
+ import { type ReactNode } from 'react';
2
+ /** The link's wording when the merchant sets no `moreOptionsLabel`. */
3
+ export declare const DEFAULT_MORE_OPTIONS_LABEL = "More payment options";
4
+ /**
5
+ * The closed "More payment options" link and the payment method groups
6
+ * behind it. Opening reveals the groups in place for good: the link goes and
7
+ * focus moves to the revealed section, which is labelled with the link's
8
+ * text. Without `showLink` (nothing behind it is available) the groups stay
9
+ * mounted and hidden, and there is no link.
10
+ */
11
+ export declare function MorePaymentOptions({ label, open, showLink, onOpen, color, fontFamily, children, }: {
12
+ label: string;
13
+ open: boolean;
14
+ showLink: boolean;
15
+ onOpen: () => void;
16
+ color: string;
17
+ fontFamily?: string;
18
+ children: ReactNode;
19
+ }): import("react").JSX.Element;
@@ -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,38 @@ 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
+ * `moreOptions` (default and per country) puts groups behind a closed
178
+ * "More payment options" link: under the buttons on the buttons layout,
179
+ * and under the buttons, above "or pay with card", on the default layout,
180
+ * where the card form always stays in view. Opening it reveals them in the
181
+ * resolved order for good and emits `more_options_opened` on
182
+ * `onInstrument`. When nothing available would stay in view every group
183
+ * shows without a link, and when nothing behind it is available there is
184
+ * no link.
185
+ */
186
+ paymentMethodLayout?: PaymentMethodLayoutRules;
187
+ /**
188
+ * The text of the "More payment options" link that `paymentMethodLayout`'s
189
+ * `moreOptions` adds. Pass final, already-localized plain text; omit it for
190
+ * the default, "More payment options".
191
+ */
192
+ moreOptionsLabel?: string;
161
193
  /**
162
194
  * High-level theme bundle that styles non-card Stripe Elements, the FloPay
163
195
  * wrapper / AVS inputs, and the hosted vault widget. One of:
@@ -0,0 +1,27 @@
1
+ import { type PaymentMethodGroupLayout, 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, and the groups behind
10
+ * "More payment options". Without rules it is the default order with no
11
+ * link, straight away and without a request. With rules, the billing API
12
+ * resolves it for this buyer, and `null` means the first answer is still
13
+ * pending: render placeholders, not methods that might move. A slow, failed
14
+ * or older billing API gives the merchant's default rule. When the rules
15
+ * change, the previous layout stays until the new one is known.
16
+ *
17
+ * `waitForSession` holds the request while an inline session's details are
18
+ * still being attached (the background claim): the buyer's country arrives
19
+ * with them, so asking earlier would pick the rule without it.
20
+ */
21
+ export declare function usePaymentMethodLayout({ rules, sessionId, nonce, billingApiUrl, waitForSession, }: {
22
+ rules: PaymentMethodLayoutRules | undefined;
23
+ sessionId: string;
24
+ nonce: string | undefined;
25
+ billingApiUrl: string | undefined;
26
+ waitForSession: boolean;
27
+ }): PaymentMethodGroupLayout | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/react",
3
- "version": "1.14.15",
3
+ "version": "1.16.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.15",
40
- "@flopay/shared": "1.14.15",
39
+ "@flopay/js": "1.16.0",
40
+ "@flopay/shared": "1.16.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"