@flopay/react 1.14.5 → 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.
Files changed (45) hide show
  1. package/dist/automatic-payment-button.d.ts +81 -0
  2. package/dist/buyer-identity-fallback.d.ts +43 -0
  3. package/dist/card-button-content.d.ts +11 -0
  4. package/dist/card-setup-entry.d.ts +10 -104
  5. package/dist/card-setup-surface.d.ts +12 -0
  6. package/dist/card-setup-theme.d.ts +32 -0
  7. package/dist/checkout-utils.d.ts +163 -0
  8. package/dist/context.d.ts +46 -0
  9. package/dist/direct-paypal-button.d.ts +155 -0
  10. package/dist/error-banner.d.ts +21 -0
  11. package/dist/external-method-recovery.d.ts +1 -0
  12. package/dist/external-method-telemetry.d.ts +17 -0
  13. package/dist/{card-setup-entry.d.cts → flopay-card-setup.d.ts} +19 -11
  14. package/dist/flopay-checkout.d.ts +239 -0
  15. package/dist/flopay-payment-method-setup-main.d.ts +10 -0
  16. package/dist/flopay-payment-method-setup.d.ts +11 -0
  17. package/dist/hooks.d.ts +36 -0
  18. package/dist/in-app-browser.d.ts +5 -0
  19. package/dist/index.d.ts +20 -921
  20. package/dist/inline-session-cache.d.ts +1 -0
  21. package/dist/instruments.d.ts +5 -0
  22. package/dist/merchant-callback.d.ts +1 -0
  23. package/dist/payment-logos.generated.d.ts +1 -0
  24. package/dist/payment-method-setup-advertisement.d.ts +36 -0
  25. package/dist/payment-method-setup-entry.d.ts +12 -14
  26. package/dist/payment-method-setup-paypal.d.ts +25 -0
  27. package/dist/payment-method-setup-stripe.d.ts +31 -0
  28. package/dist/{payment-method-setup-surface-DWGNLM0I.d.cts → payment-method-setup-surface.d.ts} +27 -9
  29. package/dist/popup-capability.d.ts +12 -0
  30. package/dist/processing-overlay.d.ts +33 -0
  31. package/dist/provider.d.ts +40 -0
  32. package/dist/recent-completion.d.ts +1 -0
  33. package/dist/run-latest-abortable-action.d.ts +5 -0
  34. package/dist/saved-payment-flow.d.ts +124 -0
  35. package/dist/split-card-form.d.ts +319 -0
  36. package/dist/stripe-method-presentation.d.ts +115 -0
  37. package/dist/telemetry-bridge.d.ts +41 -0
  38. package/dist/use-external-attempt-reconciliation.d.ts +27 -0
  39. package/dist/use-isomorphic-layout-effect.d.ts +3 -0
  40. package/dist/vault-card-fields.d.ts +95 -0
  41. package/dist/vault-theme.d.ts +1 -0
  42. package/package.json +5 -5
  43. package/dist/index.d.cts +0 -921
  44. package/dist/payment-method-setup-entry.d.cts +0 -16
  45. package/dist/payment-method-setup-surface-B9TI-00C.d.ts +0 -72
@@ -0,0 +1,155 @@
1
+ import type { CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloInstrumentEvent, FloPayPaymentCancelEvent, GatewayEnvironment, InlineSessionPatch, PaymentResult, PayPalApprovalPresentation, PayPalProviderObjectType, TelemetryPresentationMode, TelemetryTerminalReason, TokenizedBody } from '@flopay/shared';
2
+ import type React from 'react';
3
+ import type { TelemetryCheckoutContext } from './telemetry-bridge.js';
4
+ /**
5
+ * Overrides that `SplitCardForm`'s tokenized-body dispatcher uses to apply a
6
+ * `runBeforeButtonClick` patch to the in-flight processPayment call. Kept in
7
+ * sync structurally with `TokenizedBodyOverrides` in `split-card-form.tsx`.
8
+ */
9
+ interface DirectPayPalTokenizedOverrides {
10
+ accountPatch?: InlineSessionPatch['account'];
11
+ sessionId?: string;
12
+ nonce?: string;
13
+ }
14
+ /**
15
+ * Internal handler signature aligned with `SplitCardForm`'s tokenized-body
16
+ * dispatcher. Direct PayPal completes via the backend's process endpoint and
17
+ * never produces a Stripe PaymentIntent, so we still forward a synthetic
18
+ * `TokenizedBody` describing the captured order, optionally with the
19
+ * session/account patch captured at click-time.
20
+ */
21
+ type DirectPayPalTokenizedHandler = (body: TokenizedBody, overrides?: DirectPayPalTokenizedOverrides) => void;
22
+ /** Click-time `runBeforeButtonClick` result, structurally compatible with `SplitCardForm`. */
23
+ interface DirectPayPalBeforeButtonClickResult {
24
+ proceed: boolean;
25
+ accountPatch?: InlineSessionPatch['account'];
26
+ sessionId?: string;
27
+ nonce?: string;
28
+ }
29
+ /**
30
+ * Click-time gate. Mirrors `RunBeforeButtonClick` in `SplitCardForm`: lets the
31
+ * consumer patch the session/account before PayPal creates the order, and lets
32
+ * them abort the click entirely by returning `proceed: false`.
33
+ */
34
+ type DirectPayPalRunBeforeButtonClick = (method: CheckoutButtonMethod) => Promise<DirectPayPalBeforeButtonClickResult>;
35
+ export type DirectPayPalInitializationState = 'loading' | 'retrying' | 'ready' | 'exhausted';
36
+ interface DirectPayPalTechnicalFailureOptions {
37
+ code?: string;
38
+ popupBlocked?: boolean;
39
+ telemetryReported?: boolean;
40
+ provider?: 'paypal';
41
+ paymentMethodCategory?: 'paypal';
42
+ presentationMode?: TelemetryPresentationMode;
43
+ terminalReason?: TelemetryTerminalReason;
44
+ }
45
+ type DirectPayPalTechnicalFailureHandler = (method: 'paypal', err: unknown, options?: DirectPayPalTechnicalFailureOptions) => void;
46
+ export interface DirectPayPalButtonProps {
47
+ /** Checkout session ID. */
48
+ sessionId: string;
49
+ /**
50
+ * Session-bound checkout token returned by session creation. Forwarded as
51
+ * `x-checkout-session-token` on every continuation request — required by
52
+ * post-#640 backends. `FloPayCheckout` plumbs this prop automatically.
53
+ */
54
+ nonce?: string;
55
+ /** Billing API base URL. */
56
+ billingApiUrl: string;
57
+ /** Buyer email. */
58
+ email?: string;
59
+ /** Buyer name already attached to the checkout, when available. */
60
+ billingName?: string;
61
+ /** Attaches buyer identity collected from PayPal before checkout continues. */
62
+ onBuyerIdentityReady?: (identity: NonNullable<InlineSessionPatch['account']>) => void | Promise<void>;
63
+ /** PayPal client identifier (`gateways.paypal.publishableKey`). */
64
+ clientId: string;
65
+ /** Gateway environment, drives the sandbox/live SDK script. */
66
+ environment?: GatewayEnvironment;
67
+ /** ISO 4217 currency code. */
68
+ currency: string;
69
+ /** Whether the session is a subscription (drives intent + flow selection). */
70
+ isSubscription: boolean;
71
+ /**
72
+ * @deprecated Pass the backing {@link DirectPayPalButtonProps.session}; its
73
+ * `gateways.paypal.providerObjectType` advertisement is authoritative. This
74
+ * prop remains as a fallback for integrations that have not yet forwarded
75
+ * the session. When neither source advertises a provider object, legacy
76
+ * sessions continue to derive the flow from `isSubscription`.
77
+ */
78
+ providerObjectType?: PayPalProviderObjectType;
79
+ /**
80
+ * Backend-advertised approval presentation. The backing session value is
81
+ * authoritative when both are supplied. No return URL can be provided here.
82
+ */
83
+ approvalPresentation?: PayPalApprovalPresentation;
84
+ /**
85
+ * If provided, called with the tokenized body once PayPal capture
86
+ * completes. When omitted, the component processes payment internally.
87
+ */
88
+ onTokenizedBody?: DirectPayPalTokenizedHandler;
89
+ /** Called when the full self-contained payment flow succeeds. */
90
+ onComplete?: (result: PaymentResult) => void;
91
+ /** Called when an error occurs. */
92
+ onErrorChange?: (error: string | null) => void;
93
+ /** Decline emitter (mirrors SplitCardForm semantics). */
94
+ onDecline?: (decline: DeclineEvent) => void;
95
+ /**
96
+ * Called once when the buyer closes or leaves PayPal without approving (pop-up
97
+ * or app switch). Never called for an approval, a decline or a technical failure.
98
+ */
99
+ onCancel?: (event: FloPayPaymentCancelEvent) => void;
100
+ /** Called for post-click technical failures before PayPal authorization completes. */
101
+ onTechnicalFailure?: DirectPayPalTechnicalFailureHandler;
102
+ /** External processing state. */
103
+ isProcessing?: boolean;
104
+ /** Notify the parent of the loading state for placeholder swapping. */
105
+ onLoadStateChange?: (ready: boolean) => void;
106
+ /** Notify a PayPal-only wrapper about pre-render recovery state. */
107
+ onInitializationStateChange?: (state: DirectPayPalInitializationState) => void;
108
+ /** Disable the automatic retry for a buyer-initiated single manual attempt. */
109
+ allowAutomaticRetry?: boolean;
110
+ /** Tracks button-click for analytics. */
111
+ onButtonClick?: (method: CheckoutButtonMethod) => void;
112
+ /**
113
+ * Click-time gate (runs before PayPal creates the order). When provided, the
114
+ * returned patch is applied to the in-flight create-intent and tokenized
115
+ * dispatch so callers using `onBeforeButtonClick` see the same session/email
116
+ * the Stripe-rendered PayPal flow does.
117
+ */
118
+ runBeforeButtonClick?: DirectPayPalRunBeforeButtonClick;
119
+ /** Backing session — used for self-contained accountData population. */
120
+ session?: CheckoutSession | null;
121
+ /**
122
+ * Pre-existing PayPal Order id (or Subscription id when `isSubscription` is
123
+ * true) to bind the button to. When set, the button skips its usual
124
+ * session-scoped create-intent round-trip on click and feeds this
125
+ * id straight into PayPal's create-order / create-subscription callback.
126
+ *
127
+ * Used by `SplitCardForm`'s `paypal_direct_required` retry path: backend
128
+ * creates a fresh PayPal order after a stalled process attempt and returns
129
+ * its id; the SDK re-renders this button bound to that id so the buyer can
130
+ * confirm with one more click without the backend re-creating the order on
131
+ * each retry.
132
+ *
133
+ * Changing this value remounts the PayPal SDK so the new createOrder
134
+ * binding takes effect (PayPal's render() options aren't live-updatable).
135
+ */
136
+ existingOrderId?: string;
137
+ /** Flo-owned privacy-safe telemetry is enabled by default; set `false` to opt out. */
138
+ telemetry?: boolean;
139
+ /**
140
+ * When true, renders an on-screen lifecycle tracer panel above the button
141
+ * (mount, loadScript, eligibility, render, errors). Intended for debugging
142
+ * in-app browsers (Facebook IAB, etc.) where remote console access is
143
+ * impractical. Off by default — leave disabled in production.
144
+ */
145
+ debug?: boolean;
146
+ }
147
+ interface InstrumentedDirectPayPalButtonProps extends DirectPayPalButtonProps {
148
+ telemetryContext?: TelemetryCheckoutContext;
149
+ onInstrument?: (event: FloInstrumentEvent) => void;
150
+ }
151
+ /** Public direct-PayPal surface: telemetry accepts only the boolean opt-out. */
152
+ export declare function DirectPayPalButton(props: DirectPayPalButtonProps): React.ReactElement | null;
153
+ /** Internal FloPayCheckout bridge for closed SDK-owned dimensions. */
154
+ export declare function InstrumentedDirectPayPalButton(props: InstrumentedDirectPayPalButtonProps): React.ReactElement | null;
155
+ export {};
@@ -0,0 +1,21 @@
1
+ import type React from 'react';
2
+ /**
3
+ * The shared red error banner rendered across the checkout surfaces
4
+ * (`role="alert"`, `data-testid="flopay-error"`). Consolidates what were four
5
+ * copy-pasted inline blocks so the colours, warning icon, and a11y attributes
6
+ * live in one place.
7
+ *
8
+ * - `margin` — per-call spacing (the call sites use `0.75rem 0 0`, `0.75rem 0`,
9
+ * `0.25rem 0`, or none), passed straight to the container.
10
+ * - `icon` — the warning glyph + flex layout. Card-form banners show it; the
11
+ * simpler PayPal-only mode banner does not, so it opts out with `icon={false}`
12
+ * to preserve its original icon-less, non-flex appearance.
13
+ * - `styleOverride` — theme-driven overrides (`bStyles.errorBanner`), applied
14
+ * last so they win, exactly as the inline versions did.
15
+ */
16
+ export declare function ErrorBanner({ children, margin, icon, styleOverride, }: {
17
+ children: React.ReactNode;
18
+ margin?: string | number;
19
+ icon?: boolean;
20
+ styleOverride?: React.CSSProperties;
21
+ }): React.ReactElement;
@@ -0,0 +1 @@
1
+ export { buildExternalMethodRecoveryMessage, classifyExternalMethodFailure, EXTERNAL_METHOD_CALLBACK_GRACE_MS, getProviderDeclineCode, getProviderErrorCode, isPayPalAcknowledgementDeadWindow, isPopupBlockedError, isProviderDecline, sanitizeExternalFailureCode, } from '@flopay/shared';
@@ -0,0 +1,17 @@
1
+ import type { TelemetryPresentationMode } from '@flopay/shared';
2
+ import type { PayPalBrowserEnvironment } from './in-app-browser.js';
3
+ import type { PopupCapabilityOwner } from './popup-capability.js';
4
+ import type { TelemetryBridge } from './telemetry-bridge.js';
5
+ export interface ExternalMethodTelemetryContext {
6
+ browser: PayPalBrowserEnvironment;
7
+ capability: PopupCapabilityOwner;
8
+ presentationMode: TelemetryPresentationMode;
9
+ }
10
+ export declare function decorateExternalMethodTelemetry<T extends object>(context: ExternalMethodTelemetryContext, input: T): T & {
11
+ inAppBrowser: boolean;
12
+ appFamily: PayPalBrowserEnvironment['appFamily'];
13
+ popupCapability: ReturnType<PopupCapabilityOwner['current']>;
14
+ presentationMode: TelemetryPresentationMode;
15
+ };
16
+ /** Delegates to a telemetry bridge while adding current external-surface dimensions. */
17
+ export declare function decorateExternalMethodTelemetryBridge(telemetry: TelemetryBridge | undefined, context: ExternalMethodTelemetryContext): TelemetryBridge | undefined;
@@ -1,27 +1,27 @@
1
- import { ThemeId, VaultCardThemeColors, FloPayAppearance, ButtonsLayoutStyles, SavedCardDisplay, FloPayError, FloPayErrorType } from '@flopay/shared';
2
- import React from 'react';
3
-
1
+ import type { ButtonsLayoutStyles, FloPayAppearance, FloPayErrorType, SavedCardDisplay, ThemeId, VaultCardThemeColors } from '@flopay/shared';
2
+ import { FloPayError } from '@flopay/shared';
3
+ import type React from 'react';
4
4
  /** Verified terminal result from a no-charge card setup. */
5
- interface FloPayCardSetupCompleteEvent {
5
+ export interface FloPayCardSetupCompleteEvent {
6
6
  status: 'succeeded';
7
7
  sessionId: string;
8
8
  /** Present when the backend terminal message includes the saved-card display DTO. */
9
9
  paymentMethod?: SavedCardDisplay;
10
10
  }
11
11
  /** Provider-neutral terminal decline from card verification. */
12
- interface FloPayCardSetupDeclineEvent {
12
+ export interface FloPayCardSetupDeclineEvent {
13
13
  status: 'declined';
14
14
  sessionId: string;
15
15
  reason?: string;
16
16
  message?: string;
17
17
  }
18
18
  /** Abandoned setup result emitted when the component unmounts pre-terminally. */
19
- interface FloPayCardSetupCancelEvent {
19
+ export interface FloPayCardSetupCancelEvent {
20
20
  status: 'cancelled';
21
21
  sessionId: string;
22
22
  }
23
23
  /** Structured technical/validation failure from the card-setup surface. */
24
- declare class FloPayCardSetupError extends FloPayError {
24
+ export declare class FloPayCardSetupError extends FloPayError {
25
25
  readonly retryable: boolean;
26
26
  constructor(message: string, type: FloPayErrorType, options: {
27
27
  code: string;
@@ -31,7 +31,7 @@ declare class FloPayCardSetupError extends FloPayError {
31
31
  });
32
32
  }
33
33
  /** Props for the browser-only secure card-setup surface. */
34
- interface FloPayCardSetupProps {
34
+ export interface FloPayCardSetupProps {
35
35
  /** Opaque id returned by the merchant-authenticated setup-session endpoint. */
36
36
  sessionId: string;
37
37
  /** Session-bound token returned alongside {@link FloPayCardSetupProps.sessionId}. */
@@ -96,11 +96,19 @@ interface FloPayCardSetupProps {
96
96
  /** Fired for setup-session validation, transport, or hosted-widget failures. */
97
97
  onError?: (error: FloPayCardSetupError) => void;
98
98
  }
99
+ /**
100
+ * Unknown failures default to retryable. FloPay errors are retryable only for
101
+ * network, rate-limit, 5xx, or vault-timeout failures unless explicitly
102
+ * overridden by the caller. Shared with `FloPayPaymentMethodSetup`, which
103
+ * reports the same structured errors for every method.
104
+ */
105
+ export declare function asCardSetupError(error: unknown, overrides?: {
106
+ code?: string;
107
+ retryable?: boolean;
108
+ }): FloPayCardSetupError;
99
109
  /**
100
110
  * Mounts FloPay's hosted card capture for a setup session created by the
101
111
  * merchant's server. It has no customer-id, list, delete, purchase, or Stripe
102
112
  * Elements surface.
103
113
  */
104
- declare function FloPayCardSetup({ sessionId, nonce, billingApiUrl, telemetry, theme, containerStyle, appearance, buttonsStyles, loading, onReady, onComplete, onDecline, onCancel, onValidation, onError, }: FloPayCardSetupProps): React.ReactElement;
105
-
106
- export { FloPayCardSetup, type FloPayCardSetupCancelEvent, type FloPayCardSetupCompleteEvent, type FloPayCardSetupDeclineEvent, FloPayCardSetupError, type FloPayCardSetupProps };
114
+ export declare function FloPayCardSetup({ sessionId, nonce, billingApiUrl, telemetry, theme, containerStyle, appearance, buttonsStyles, loading, onReady, onComplete, onDecline, onCancel, onValidation, onError, }: FloPayCardSetupProps): React.ReactElement;
@@ -0,0 +1,239 @@
1
+ import type { BeforeButtonClickEvent, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, InlineSessionPatch, PaymentResult, WalletPresentation } from '@flopay/shared';
2
+ import { FloPayError } from '@flopay/shared';
3
+ import React from 'react';
4
+ /** Props for the all-in-one `FloPayCheckout` wrapper. */
5
+ export interface FloPayCheckoutProps {
6
+ /** The checkout session ID (UUID from billing API). Required unless `createSession` is provided. */
7
+ sessionId?: string;
8
+ /**
9
+ * Session-bound checkout token (the `nonce` returned when the session was
10
+ * created). Sent as the `x-checkout-session-token` header when fetching a
11
+ * session by `sessionId`. Required by post-#640 backends, which no longer
12
+ * let the UUID alone authorize a session read; harmless on older backends.
13
+ * Only consulted in the `sessionId` flow — inline `createSession` sessions
14
+ * carry their own freshly-minted nonce server-side.
15
+ */
16
+ nonce?: string;
17
+ /**
18
+ * Create a checkout session inline — no separate API route needed.
19
+ * The component POSTs to the billing API, gets the full session back, and renders the form.
20
+ * Alternative to `sessionId` (provide one or the other).
21
+ */
22
+ createSession?: InlineSessionDraft;
23
+ /** Billing API base URL. Defaults to the shared `BILLING_API_URL` constant. */
24
+ billingApiUrl?: string;
25
+ /** Flo-owned privacy-safe telemetry is enabled by default; set `false` to opt out. */
26
+ telemetry?: boolean;
27
+ /** Visual appearance for payment elements. */
28
+ appearance?: FloPayAppearance;
29
+ /** Locale for payment elements (default: 'auto'). */
30
+ locale?: string;
31
+ /** Custom loading UI. Defaults to a simple centered spinner. */
32
+ loading?: React.ReactNode;
33
+ /** Custom error UI. Receives the error. Defaults to showing the error message. */
34
+ error?: (error: FloPayError) => React.ReactNode;
35
+ /** Called when the full payment flow completes successfully. */
36
+ onComplete?: (result: PaymentResult) => void;
37
+ /** Called when a payment error occurs. */
38
+ onError?: (error: FloPayError) => void;
39
+ /** Receives the versioned, privacy-safe checkout instrument feed. */
40
+ onInstrument?: (event: FloInstrumentEvent) => void;
41
+ /** Called when a payment is declined or the authentication step fails. */
42
+ onDecline?: (decline: DeclineEvent) => void;
43
+ /**
44
+ * Called once when the buyer closes or leaves the direct PayPal button's
45
+ * PayPal window without approving. Never called for an approval, a decline
46
+ * or a technical failure, nor for Stripe-rendered PayPal.
47
+ */
48
+ onCancel?: (event: FloPayPaymentCancelEvent) => void;
49
+ /** Called when the AVS country dropdown changes. */
50
+ onCountryChange?: (country: string) => void;
51
+ /** Called when the AVS ZIP/postcode input changes. */
52
+ onZipChange?: (zip: string) => void;
53
+ /**
54
+ * Show the PayPal payment surface (default: `true`). Renderer is chosen
55
+ * from `gateways.paypal` on the session — DirectPayPalButton when present,
56
+ * Stripe-rendered PayPal otherwise.
57
+ */
58
+ showPayPal?: boolean;
59
+ /**
60
+ * Show Stripe-rendered wallets/APMs alongside the vault-hosted card surface
61
+ * (default: `true`). When `false`, only
62
+ * `DirectPayPalButton` can render. Both `showStripe=false` and
63
+ * `showPayPal=false` (with no PayPal gateway configured) triggers a
64
+ * bootstrap-time validation error.
65
+ */
66
+ showStripe?: boolean;
67
+ /**
68
+ * Preferred approval presentation for supported wallets. Defaults to
69
+ * `'auto'`. Safety signals and provider capability remain authoritative.
70
+ */
71
+ walletPresentation?: WalletPresentation;
72
+ /**
73
+ * Override the wallet/APM list the session advertises via
74
+ * `gateways.stripe.enabledPaymentMethods`. Omit (the default) and the
75
+ * backend's per-session list is used, which is what a normal integration
76
+ * wants.
77
+ *
78
+ * Pass an explicit list to narrow it, or `[]` to render the hosted card form
79
+ * on its own — the empty array means "no methods enabled", not "fall back to
80
+ * the backend list". This is the supported way to get a card-only checkout:
81
+ * `showStripe={false}` also gates the vault, so it takes the card form down
82
+ * with the wallets.
83
+ *
84
+ * Narrowing only. Naming a method the backend hasn't enabled for the session
85
+ * will not turn it on.
86
+ */
87
+ enabledPaymentMethods?: string[];
88
+ /**
89
+ * @deprecated Apple Pay availability is now driven by
90
+ * `gateways.stripe.enabledPaymentMethods` on the per-session response from
91
+ * the billing API. Setting this prop emits a one-time deprecation warning
92
+ * and is otherwise ignored once the backend ships the list.
93
+ */
94
+ showApplePay?: boolean;
95
+ /**
96
+ * @deprecated See {@link FloPayCheckoutProps.showApplePay}.
97
+ */
98
+ showGooglePay?: boolean;
99
+ /**
100
+ * Enables on-screen diagnostic panels (PayPal gate decision, DirectPayPalButton
101
+ * lifecycle). Intended for debugging in-app browsers (Facebook, Instagram, etc.)
102
+ * where remote console access is impractical. Off by default.
103
+ */
104
+ debug?: boolean;
105
+ /** Layout mode: 'default' (all visible) or 'buttons' (PayPal/wallets + expandable card form). */
106
+ layout?: 'default' | 'buttons';
107
+ /**
108
+ * High-level theme bundle that styles non-card Stripe Elements, the FloPay
109
+ * wrapper / AVS inputs, and the hosted vault widget. One of: `'classic'`
110
+ * (historic FloPay look, no bundle applied), `'modern-light'`, `'modern-dark'`,
111
+ * `'bold-light'`, `'bold-dark'`, `'glass-light'`, `'glass-dark'`. Explicit
112
+ * `appearance` / `buttonsStyles` props still override their respective
113
+ * halves when supplied.
114
+ */
115
+ theme?: import('@flopay/shared').ThemeId;
116
+ /**
117
+ * @deprecated Use `theme` instead. Legacy buttons-layout preset
118
+ * (`'default' | 'minimal' | 'rounded' | 'dark'`). Still honored for
119
+ * back-compat.
120
+ */
121
+ buttonsTheme?: import('@flopay/shared').ButtonsLayoutTheme;
122
+ /** Style overrides merged on top of the resolved theme bundle / buttonsTheme preset. */
123
+ buttonsStyles?: import('@flopay/shared').ButtonsLayoutStyles;
124
+ /** Custom React content rendered inside the card button when `layout="buttons"`. */
125
+ cardButtonContent?: React.ReactNode;
126
+ /** Custom React content rendered for the buttons-layout card back button label. */
127
+ cardBackButtonContent?: React.ReactNode;
128
+ /** Custom React content rendered for the card-form title. */
129
+ cardTitleContent?: React.ReactNode;
130
+ /**
131
+ * @deprecated No longer rendered — the default-layout security footer was
132
+ * removed alongside the theme-bundle refactor. Retained as an optional
133
+ * prop so existing integrations type-check without changes.
134
+ */
135
+ showSecurityFooter?: boolean;
136
+ /**
137
+ * Called when a payment method button is clicked.
138
+ * `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
139
+ */
140
+ onButtonClick?: (method: CheckoutButtonMethod) => void;
141
+ /**
142
+ * Called before a payment button continues in `layout="buttons"`.
143
+ * Runs for card, PayPal, Apple Pay, and Google Pay.
144
+ * In `layout="buttons"` with `createSession`, the returned patch is merged
145
+ * into the inline session params before the selected flow continues.
146
+ */
147
+ onBeforeButtonClick?: (event: BeforeButtonClickEvent) => undefined | false | Promise<undefined | false | InlineSessionPatch> | InlineSessionPatch;
148
+ /**
149
+ * Enable AVS (Address Verification).
150
+ * - `true` — show country + postal code (backward compatible default)
151
+ * - `AVSFieldConfig` — granular per-field control, optionally scoped to country codes
152
+ * - `false` / omitted — AVS disabled
153
+ */
154
+ enableAVS?: boolean | import('@flopay/shared').AVSFieldConfig;
155
+ /**
156
+ * Per-merchant order of the hosted vault card rows — a permutation of
157
+ * `['name','number','expiry']` (`'expiry'` = the expiry+CVV row; submit stays
158
+ * last). Sets both the visual and tab order. Omit for the default
159
+ * (`name`, `number`, `expiry`). Vault card path only.
160
+ */
161
+ cardFieldOrder?: import('@flopay/shared').VaultCardFieldKey[];
162
+ /**
163
+ * Content rendered directly above the hosted vault card widget (below the
164
+ * "or pay with card" divider). Used by the demo playground to surface a
165
+ * test-cards helper; harmless to omit in a normal integration.
166
+ */
167
+ cardPreFormSlot?: React.ReactNode;
168
+ /** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
169
+ avsLayout?: 'row' | 'column';
170
+ /**
171
+ * Final wording for the hosted card form's submit button in full checkout
172
+ * (billing API v1.9.35+), e.g. `'Pay $10'`. Pass final, already-localized
173
+ * plain text from your own order summary — the SDK does not format amounts
174
+ * or translate. Updates apply live without remounting the card form or
175
+ * clearing entered card details; omitting or clearing it (or passing `null`
176
+ * or blank text) shows the hosted default, `CONFIRM PAYMENT`. Direct
177
+ * custom-layout children receive it unless they set their own `submitLabel`.
178
+ *
179
+ * Only the hosted card submit button changes: `confirmLabel` still owns the
180
+ * saved-payment confirm button, `cardButtonContent` the buttons-layout card
181
+ * tile, and wallet, PayPal, processing, and retry wording is unchanged.
182
+ */
183
+ submitLabel?: string | null;
184
+ /** Additional CSS class for the wrapper. */
185
+ className?: string;
186
+ /** Seed an initial checkout error message for the rendered payment form. */
187
+ initialErrorMessage?: string | null;
188
+ /** Resume a backend-created PayPal Order/Subscription instead of creating another one. */
189
+ initialPayPalOrderId?: string;
190
+ /**
191
+ * Override the default `SplitCardForm`. When provided, children are rendered
192
+ * inside the initialized `FloPayProvider` with session props auto-injected.
193
+ */
194
+ children?: React.ReactNode;
195
+ /**
196
+ * Override the session's checkoutMode.
197
+ * - `'full'` — show payment form (default)
198
+ * - `'confirm'` — show confirm button, uses saved payment method
199
+ * - `'auto'` — auto-submit with saved PM, falls back to `'full'` on failure
200
+ */
201
+ checkoutMode?: CheckoutMode;
202
+ /**
203
+ * Label for the saved-payment confirm button in `confirm` mode. Default:
204
+ * `'Confirm Purchase'`. Full checkout's hosted card button uses
205
+ * {@link FloPayCheckoutProps.submitLabel} instead.
206
+ */
207
+ confirmLabel?: string;
208
+ /** Custom confirm button renderer for `confirm` mode. */
209
+ renderConfirmButton?: (props: {
210
+ onConfirm: () => void;
211
+ isProcessing: boolean;
212
+ }) => React.ReactNode;
213
+ /** Called when the session has already been completed. Receives the successUrl. */
214
+ onSessionCompleted?: (successUrl: string) => void;
215
+ /**
216
+ * @deprecated No longer used. The Stripe publishable key is sourced exclusively
217
+ * from the checkout session's `gateways.stripe.publishableKey`. Accepted only
218
+ * for backward compatibility with older consumer code — the value is ignored.
219
+ */
220
+ fallbackPublishableKey?: string;
221
+ }
222
+ /**
223
+ * All-in-one checkout component. Fetches the session, initializes the
224
+ * payment provider, and renders the appropriate UI based on checkout mode.
225
+ *
226
+ * **Modes:**
227
+ * - `full` (default) — renders hosted-vault card capture, wallets, APMs, and PayPal
228
+ * - `confirm` — renders a "Confirm Purchase" button, uses saved payment method
229
+ * - `auto` — auto-submits with saved PM, falls back to `full` on failure
230
+ *
231
+ * ```tsx
232
+ * <FloPayCheckout
233
+ * sessionId="sess_abc123"
234
+ * onComplete={(result) => router.push('/success')}
235
+ * onError={(err) => console.error(err)}
236
+ * />
237
+ * ```
238
+ */
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;
@@ -0,0 +1,10 @@
1
+ import type React from 'react';
2
+ import { type FloPayPaymentMethodSetupProps } from './payment-method-setup-surface.js';
3
+ export type { FloPayPaymentMethodSetupCancelEvent, FloPayPaymentMethodSetupCompleteEvent, FloPayPaymentMethodSetupDeclineEvent, FloPayPaymentMethodSetupProps, } from './payment-method-setup-surface.js';
4
+ /**
5
+ * Renders every payment method a setup session advertises — the hosted card
6
+ * widget, Stripe wallets/APMs in setup mode, and the PayPal vault flow — and
7
+ * saves the buyer's choice without a purchase. The advertisement is the single
8
+ * source of truth.
9
+ */
10
+ export declare function FloPayPaymentMethodSetup(props: FloPayPaymentMethodSetupProps): React.ReactElement;
@@ -0,0 +1,11 @@
1
+ import type React from 'react';
2
+ import { type FloPayPaymentMethodSetupProps } from './payment-method-setup-surface.js';
3
+ export type { FloPayPaymentMethodSetupCancelEvent, FloPayPaymentMethodSetupCompleteEvent, FloPayPaymentMethodSetupDeclineEvent, FloPayPaymentMethodSetupProps, } from './payment-method-setup-surface.js';
4
+ /**
5
+ * Renders every payment method a setup session advertises — the hosted card
6
+ * widget, Stripe wallets/APMs in setup mode, and the PayPal vault flow — and
7
+ * saves the buyer's choice without a purchase. The advertisement is the single
8
+ * source of truth. A card-only session behaves exactly like `FloPayCardSetup`
9
+ * and never requests Stripe.js.
10
+ */
11
+ export declare function FloPayPaymentMethodSetup(props: FloPayPaymentMethodSetupProps): React.ReactElement;
@@ -0,0 +1,36 @@
1
+ import type { FloPay } from '@flopay/js';
2
+ import type { CheckoutSession, FloPayError } from '@flopay/shared';
3
+ /**
4
+ * Returns the current `FloPay` instance, or `null` if the provider
5
+ * is still loading (i.e. the `loadFloPay()` promise has not resolved yet).
6
+ *
7
+ * Must be called within a `<FloPayProvider>`.
8
+ */
9
+ export declare function useFloPay(): FloPay | null;
10
+ /**
11
+ * Returns the Stripe `FloPay` instance dedicated to the Stripe-rendered
12
+ * PayPal fallback, or `null` if PayPal is disabled for this session. Direct
13
+ * PayPal (`gateways.paypal`) does not use this instance.
14
+ *
15
+ * Must be called within a `<FloPayProvider>`.
16
+ */
17
+ export declare function usePayPalFloPay(): FloPay | null;
18
+ /** Checkout state exposed by `useCheckout()`. */
19
+ export interface CheckoutState {
20
+ session: CheckoutSession | null;
21
+ loading: boolean;
22
+ error: FloPayError | null;
23
+ /** True while a detached session shell is not yet safe to charge. */
24
+ claimPending?: boolean;
25
+ }
26
+ /**
27
+ * Returns the current checkout session state.
28
+ *
29
+ * Must be called within the checkout context rendered by `<FloPayCheckout>`.
30
+ */
31
+ export declare function useCheckout(): CheckoutState;
32
+ /**
33
+ * Returns the resolved billing API URL from the provider context.
34
+ * Falls back to the default `BILLING_API_URL` constant.
35
+ */
36
+ export declare function useBillingApiUrl(): string;
@@ -0,0 +1,5 @@
1
+ export type { PayPalBrowserEnvironment } from '@flopay/shared';
2
+ export { detectPayPalEnvironment } from '@flopay/shared';
3
+ /** Boolean compatibility wrapper retained for the split checkout renderer. */
4
+ export declare function isInAppBrowser(userAgent?: string): boolean;
5
+ export { resolvePayPalPresentationMode as resolvePayPalPresentation, resolveStripePayPalPresentation, } from '@flopay/shared';