@flopay/react 1.20.15 → 2.0.1

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 (67) hide show
  1. package/README.md +107 -390
  2. package/dist/card-setup-entry.cjs +1 -6
  3. package/dist/card-setup-entry.d.ts +4 -10
  4. package/dist/card-setup-entry.mjs +1 -1
  5. package/dist/chunk-KPRDVWZP.mjs +1 -0
  6. package/dist/chunk-XRYDC367.mjs +1 -0
  7. package/dist/flopay-runtime-card-setup.d.ts +4 -5
  8. package/dist/flopay-runtime-checkout.d.ts +2 -0
  9. package/dist/hosted-runtime-components.d.ts +75 -0
  10. package/dist/index.cjs +1 -47
  11. package/dist/index.d.ts +3 -21
  12. package/dist/index.mjs +1 -21
  13. package/dist/payment-method-setup-entry.cjs +1 -27
  14. package/dist/payment-method-setup-entry.d.ts +5 -12
  15. package/dist/payment-method-setup-entry.mjs +1 -1
  16. package/dist/runtime-context.d.ts +10 -0
  17. package/package.json +3 -6
  18. package/dist/account-bound-elements.d.ts +0 -31
  19. package/dist/automatic-payment-button.d.ts +0 -88
  20. package/dist/buyer-identity-fallback.d.ts +0 -43
  21. package/dist/card-button-content.d.ts +0 -11
  22. package/dist/card-setup-surface.d.ts +0 -12
  23. package/dist/card-setup-theme.d.ts +0 -32
  24. package/dist/checkout-utils.d.ts +0 -172
  25. package/dist/chunk-BU7THP6H.mjs +0 -1
  26. package/dist/chunk-FGCZOMML.mjs +0 -22
  27. package/dist/chunk-ITRFSHZP.mjs +0 -6
  28. package/dist/chunk-PCIHQY3X.mjs +0 -1
  29. package/dist/chunk-VK67324N.mjs +0 -1
  30. package/dist/context.d.ts +0 -46
  31. package/dist/direct-paypal-button.d.ts +0 -155
  32. package/dist/error-banner.d.ts +0 -21
  33. package/dist/external-method-recovery.d.ts +0 -1
  34. package/dist/external-method-telemetry.d.ts +0 -17
  35. package/dist/flopay-card-setup.d.ts +0 -114
  36. package/dist/flopay-checkout.d.ts +0 -292
  37. package/dist/flopay-payment-method-setup-main.d.ts +0 -10
  38. package/dist/flopay-payment-method-setup.d.ts +0 -11
  39. package/dist/hooks.d.ts +0 -36
  40. package/dist/in-app-browser.d.ts +0 -5
  41. package/dist/inline-session-cache.d.ts +0 -1
  42. package/dist/instruments.d.ts +0 -5
  43. package/dist/more-payment-options.d.ts +0 -19
  44. package/dist/one-click-warnings.d.ts +0 -12
  45. package/dist/payment-logos.generated.d.ts +0 -1
  46. package/dist/payment-method-layout-placeholder.d.ts +0 -10
  47. package/dist/payment-method-setup-advertisement.d.ts +0 -36
  48. package/dist/payment-method-setup-paypal-CLV7JDJH.mjs +0 -1
  49. package/dist/payment-method-setup-paypal.d.ts +0 -25
  50. package/dist/payment-method-setup-stripe-526L4P5X.mjs +0 -1
  51. package/dist/payment-method-setup-stripe.d.ts +0 -31
  52. package/dist/payment-method-setup-surface.d.ts +0 -90
  53. package/dist/popup-capability.d.ts +0 -12
  54. package/dist/processing-overlay.d.ts +0 -33
  55. package/dist/provider-callback-ignored.d.ts +0 -8
  56. package/dist/provider.d.ts +0 -40
  57. package/dist/recent-completion.d.ts +0 -1
  58. package/dist/run-latest-abortable-action.d.ts +0 -5
  59. package/dist/saved-payment-flow.d.ts +0 -140
  60. package/dist/split-card-form.d.ts +0 -393
  61. package/dist/stripe-method-presentation.d.ts +0 -115
  62. package/dist/telemetry-bridge.d.ts +0 -41
  63. package/dist/use-external-attempt-reconciliation.d.ts +0 -27
  64. package/dist/use-isomorphic-layout-effect.d.ts +0 -3
  65. package/dist/use-payment-method-layout.d.ts +0 -27
  66. package/dist/vault-card-fields.d.ts +0 -97
  67. package/dist/vault-theme.d.ts +0 -1
@@ -1,292 +0,0 @@
1
- import type { BeforeButtonClickEvent, CardFieldLabels, CardFieldsFailedEvent, CardFieldsReadyEvent, CheckoutButtonMethod, CheckoutMode, DeclineEvent, FloInstrumentEvent, FloPayAppearance, FloPayPaymentCancelEvent, InlineSessionDraft, InlineSessionPatch, PaymentMethodLayoutRules, 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
- /** Called once per card form when the hosted card fields are interactive. */
44
- onCardFieldsReady?: (event: CardFieldsReadyEvent) => void;
45
- /** Called when the hosted card fields fail to load or are not ready within the timeout. */
46
- onCardFieldsFailed?: (event: CardFieldsFailedEvent) => void;
47
- /** Milliseconds the card fields may take to become ready before a `timeout` failure. */
48
- cardFieldsTimeoutMs?: number;
49
- /**
50
- * Called once when the buyer closes or leaves the direct PayPal button's
51
- * PayPal window without approving. Never called for an approval, a decline
52
- * or a technical failure, nor for Stripe-rendered PayPal.
53
- */
54
- onCancel?: (event: FloPayPaymentCancelEvent) => void;
55
- /** Called when the AVS country dropdown changes. */
56
- onCountryChange?: (country: string) => void;
57
- /** Called when the AVS ZIP/postcode input changes. */
58
- onZipChange?: (zip: string) => void;
59
- /**
60
- * Show the PayPal payment surface (default: `true`). Renderer is chosen
61
- * from `gateways.paypal` on the session — DirectPayPalButton when present,
62
- * Stripe-rendered PayPal otherwise.
63
- */
64
- showPayPal?: boolean;
65
- /**
66
- * Show Stripe-rendered wallets/APMs alongside the vault-hosted card surface
67
- * (default: `true`). When `false`, only
68
- * `DirectPayPalButton` can render. Both `showStripe=false` and
69
- * `showPayPal=false` (with no PayPal gateway configured) triggers a
70
- * bootstrap-time validation error.
71
- */
72
- showStripe?: boolean;
73
- /**
74
- * Preferred approval presentation for supported wallets. Defaults to
75
- * `'auto'`. Safety signals and provider capability remain authoritative.
76
- */
77
- walletPresentation?: WalletPresentation;
78
- /**
79
- * Override the wallet/APM list the session advertises via
80
- * `gateways.stripe.enabledPaymentMethods`. Omit (the default) and the
81
- * backend's per-session list is used, which is what a normal integration
82
- * wants.
83
- *
84
- * Pass an explicit list to narrow it, or `[]` to render the hosted card form
85
- * on its own — the empty array means "no methods enabled", not "fall back to
86
- * the backend list". This is the supported way to get a card-only checkout:
87
- * `showStripe={false}` also gates the vault, so it takes the card form down
88
- * with the wallets.
89
- *
90
- * Narrowing only. Naming a method the backend hasn't enabled for the session
91
- * will not turn it on.
92
- */
93
- enabledPaymentMethods?: string[];
94
- /**
95
- * @deprecated Apple Pay availability is now driven by
96
- * `gateways.stripe.enabledPaymentMethods` on the per-session response from
97
- * the billing API. Setting this prop emits a one-time deprecation warning
98
- * and is otherwise ignored once the backend ships the list.
99
- */
100
- showApplePay?: boolean;
101
- /**
102
- * @deprecated See {@link FloPayCheckoutProps.showApplePay}.
103
- */
104
- showGooglePay?: boolean;
105
- /**
106
- * Enables on-screen diagnostic panels (PayPal gate decision, DirectPayPalButton
107
- * lifecycle). Intended for debugging in-app browsers (Facebook, Instagram, etc.)
108
- * where remote console access is impractical. Off by default.
109
- */
110
- debug?: boolean;
111
- /** Layout mode: 'default' (all visible) or 'buttons' (PayPal/wallets + expandable card form). */
112
- layout?: 'default' | 'buttons';
113
- /**
114
- * The merchant's rules for the order of `'card'`, `'paypal'`, `'wallets'`
115
- * and `'apms'`, with optional per-country rules. The billing API applies
116
- * them to each buyer and the checkout shows the order it resolves. Without
117
- * the prop the order is PayPal, wallets, APMs, then card. Can change after
118
- * mount; a group whose place changes is mounted again. `moreOptions` puts
119
- * groups behind a closed "More payment options" link. Injected into
120
- * custom-layout children that set none. See
121
- * `SplitCardFormProps.paymentMethodLayout`.
122
- */
123
- paymentMethodLayout?: PaymentMethodLayoutRules;
124
- /**
125
- * The text of the "More payment options" link, as final, already-localized
126
- * plain text. Injected into custom-layout children that set none. See
127
- * `SplitCardFormProps.moreOptionsLabel`.
128
- */
129
- moreOptionsLabel?: string;
130
- /**
131
- * High-level theme bundle that styles non-card Stripe Elements, the FloPay
132
- * wrapper / AVS inputs, and the hosted vault widget. One of: `'classic'`
133
- * (historic FloPay look, no bundle applied), `'modern-light'`, `'modern-dark'`,
134
- * `'bold-light'`, `'bold-dark'`, `'glass-light'`, `'glass-dark'`. Explicit
135
- * `appearance` / `buttonsStyles` props still override their respective
136
- * halves when supplied.
137
- */
138
- theme?: import('@flopay/shared').ThemeId;
139
- /**
140
- * @deprecated Use `theme` instead. Legacy buttons-layout preset
141
- * (`'default' | 'minimal' | 'rounded' | 'dark'`). Still honored for
142
- * back-compat.
143
- */
144
- buttonsTheme?: import('@flopay/shared').ButtonsLayoutTheme;
145
- /** Style overrides merged on top of the resolved theme bundle / buttonsTheme preset. */
146
- buttonsStyles?: import('@flopay/shared').ButtonsLayoutStyles;
147
- /** Custom React content rendered inside the card button when `layout="buttons"`. */
148
- cardButtonContent?: React.ReactNode;
149
- /** Custom React content rendered for the buttons-layout card back button label. */
150
- cardBackButtonContent?: React.ReactNode;
151
- /** Custom React content rendered for the card-form title. */
152
- cardTitleContent?: React.ReactNode;
153
- /**
154
- * @deprecated No longer rendered — the default-layout security footer was
155
- * removed alongside the theme-bundle refactor. Retained as an optional
156
- * prop so existing integrations type-check without changes.
157
- */
158
- showSecurityFooter?: boolean;
159
- /**
160
- * Called when a payment method button is clicked.
161
- * `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
162
- */
163
- onButtonClick?: (method: CheckoutButtonMethod) => void;
164
- /**
165
- * Called before a payment button continues in `layout="buttons"`.
166
- * Runs for card, PayPal, Apple Pay, and Google Pay.
167
- * In `layout="buttons"` with `createSession`, the returned patch is merged
168
- * into the inline session params before the selected flow continues.
169
- */
170
- onBeforeButtonClick?: (event: BeforeButtonClickEvent) => undefined | false | Promise<undefined | false | InlineSessionPatch> | InlineSessionPatch;
171
- /**
172
- * Enable AVS (Address Verification).
173
- * - `true` — show country + postal code (backward compatible default)
174
- * - `AVSFieldConfig` — granular per-field control, optionally scoped to country codes
175
- * - `false` / omitted — AVS disabled
176
- */
177
- enableAVS?: boolean | import('@flopay/shared').AVSFieldConfig;
178
- /**
179
- * Per-merchant order of the hosted vault card rows — a permutation of
180
- * `['name','number','expiry']` (`'expiry'` = the expiry+CVV row; submit stays
181
- * last). Sets both the visual and tab order. Omit for the default
182
- * (`name`, `number`, `expiry`). Vault card path only.
183
- */
184
- cardFieldOrder?: import('@flopay/shared').VaultCardFieldKey[];
185
- /**
186
- * Show the Visa, Mastercard, Amex and Discover icons in the hosted card number
187
- * field. Only `true` turns them on; omitted or `false` keeps the field as it is.
188
- * Vault card path only; an older hosted form ignores it.
189
- */
190
- showCardBrandIcons?: boolean;
191
- /**
192
- * Show the visible labels above the hosted card fields. Omitted sends nothing,
193
- * so the form looks as it does today. Vault card path only.
194
- */
195
- showCardFieldLabels?: boolean;
196
- /**
197
- * Replace the text of the labels (`number`, `expiry`, `cvv`, `name`). Only the
198
- * fields you set are sent. Vault card path only.
199
- */
200
- cardFieldLabels?: CardFieldLabels;
201
- /**
202
- * Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
203
- * `name`), each optional. Only the fields given are sent; the rest keep the
204
- * hosted form's wording, and `''` shows no placeholder. A change updates the
205
- * mounted form live, without a remount. Omitted sends nothing. Vault card
206
- * path only.
207
- */
208
- cardFieldPlaceholders?: import('@flopay/shared').CardFieldPlaceholders;
209
- /**
210
- * Opt out of the hosted card widget's automatic initial focus (and the host-side
211
- * initial identity/AVS field focus). `false` disables it; omitted or `true` keeps
212
- * the default, which never focuses the card over fields rendered above it.
213
- */
214
- cardAutoFocus?: boolean;
215
- /**
216
- * Content rendered directly above the hosted vault card widget (below the
217
- * "or pay with card" divider). Used by the demo playground to surface a
218
- * test-cards helper; harmless to omit in a normal integration.
219
- */
220
- cardPreFormSlot?: React.ReactNode;
221
- /** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
222
- avsLayout?: 'row' | 'column';
223
- /**
224
- * Final wording for the hosted card form's submit button in full checkout
225
- * (billing API v1.9.35+), e.g. `'Pay $10'`. Pass final, already-localized
226
- * plain text from your own order summary — the SDK does not format amounts
227
- * or translate. Updates apply live without remounting the card form or
228
- * clearing entered card details; omitting or clearing it (or passing `null`
229
- * or blank text) shows the hosted default, `CONFIRM PAYMENT`. Direct
230
- * custom-layout children receive it unless they set their own `submitLabel`.
231
- *
232
- * Only the hosted card submit button changes: `confirmLabel` still owns the
233
- * saved-payment confirm button, `cardButtonContent` the buttons-layout card
234
- * tile, and wallet, PayPal, processing, and retry wording is unchanged.
235
- */
236
- submitLabel?: string | null;
237
- /** Additional CSS class for the wrapper. */
238
- className?: string;
239
- /** Seed an initial checkout error message for the rendered payment form. */
240
- initialErrorMessage?: string | null;
241
- /** Resume a backend-created PayPal Order/Subscription instead of creating another one. */
242
- initialPayPalOrderId?: string;
243
- /**
244
- * Override the default `SplitCardForm`. When provided, children are rendered
245
- * inside the initialized `FloPayProvider` with session props auto-injected.
246
- */
247
- children?: React.ReactNode;
248
- /**
249
- * Override the session's checkoutMode.
250
- * - `'full'` — show payment form (default)
251
- * - `'confirm'` — show confirm button, uses saved payment method
252
- * - `'auto'` — auto-submit with saved PM, falls back to `'full'` on failure
253
- */
254
- checkoutMode?: CheckoutMode;
255
- /**
256
- * Label for the saved-payment confirm button in `confirm` mode. Default:
257
- * `'Confirm Purchase'`. Full checkout's hosted card button uses
258
- * {@link FloPayCheckoutProps.submitLabel} instead.
259
- */
260
- confirmLabel?: string;
261
- /** Custom confirm button renderer for `confirm` mode. */
262
- renderConfirmButton?: (props: {
263
- onConfirm: () => void;
264
- isProcessing: boolean;
265
- }) => React.ReactNode;
266
- /** Called when the session has already been completed. Receives the successUrl. */
267
- onSessionCompleted?: (successUrl: string) => void;
268
- /**
269
- * @deprecated No longer used. The Stripe publishable key is sourced exclusively
270
- * from the checkout session's `gateways.stripe.publishableKey`. Accepted only
271
- * for backward compatibility with older consumer code — the value is ignored.
272
- */
273
- fallbackPublishableKey?: string;
274
- }
275
- /**
276
- * All-in-one checkout component. Fetches the session, initializes the
277
- * payment provider, and renders the appropriate UI based on checkout mode.
278
- *
279
- * **Modes:**
280
- * - `full` (default) — renders hosted-vault card capture, wallets, APMs, and PayPal
281
- * - `confirm` — renders a "Confirm Purchase" button, uses saved payment method
282
- * - `auto` — auto-submits with saved PM, falls back to `full` on failure
283
- *
284
- * ```tsx
285
- * <FloPayCheckout
286
- * sessionId="sess_abc123"
287
- * onComplete={(result) => router.push('/success')}
288
- * onError={(err) => console.error(err)}
289
- * />
290
- * ```
291
- */
292
- 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, paymentMethodLayout, moreOptionsLabel, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, showCardBrandIcons, showCardFieldLabels, cardFieldLabels, cardFieldPlaceholders, cardAutoFocus, onCardFieldsReady, onCardFieldsFailed, cardFieldsTimeoutMs, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
@@ -1,10 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
package/dist/hooks.d.ts DELETED
@@ -1,36 +0,0 @@
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;
@@ -1,5 +0,0 @@
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';
@@ -1 +0,0 @@
1
- export { clearCachedInlineCheckout, clearCachedInlineSession, hashCreateParams, legacyCachedSessionMatchesDraft, persistCachedInlineIdempotencyKey, persistCachedInlineSession, readCachedInlineIdempotencyKey, readCachedInlineSession, serializeCreateParams, } from '@flopay/shared';
@@ -1,5 +0,0 @@
1
- import type { FloInstrumentEvent, FloInstrumentSource } from '@flopay/shared';
2
- export { FLO_INSTRUMENT_ONCE_NAMES as INSTRUMENT_ONCE_NAMES } from '@flopay/shared';
3
- export type EmitFloInstrument = (source: FloInstrumentSource) => void;
4
- /** Dispatch instruments without letting merchant code alter checkout behavior. */
5
- export declare function useFloInstrumentEmitter(onInstrument: ((event: FloInstrumentEvent) => void) | undefined, deduplicationKey?: string): EmitFloInstrument;
@@ -1,19 +0,0 @@
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;
@@ -1,12 +0,0 @@
1
- /**
2
- * One-time, development-only warnings that steer integrators from keyless
3
- * Auto/Confirm session creation to server-minted one-click sessions
4
- * (`@flopay/node` `checkout.sessions.createOneClick` + the button's `getSession`).
5
- *
6
- * Each warning fires at most once per page load and never when
7
- * `process.env.NODE_ENV` is `'production'`.
8
- */
9
- /** The automatic payment button was given inline create-session props. */
10
- export declare function warnInlineAutomaticPaymentCreate(): void;
11
- /** `FloPayCheckout` was given `createSession` with a confirm or auto checkout mode. */
12
- export declare function warnKeylessCheckoutCreate(): void;
@@ -1 +0,0 @@
1
- export declare const PAYMENT_METHOD_LOGO_URLS: Record<string, string>;
@@ -1,10 +0,0 @@
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,36 +0,0 @@
1
- export { clearSetupRedirectParams, readSetupRedirectReturn } from '@flopay/js/card-setup';
2
- export type { PaymentMethodSetupAdvertisement, SetupOverlayWording } from '@flopay/shared';
3
- export { advertisedMethodKeys, advertisesAnyMethod, readSetupAdvertisement, setupOverlayLabels, stripeMethodCategory, } from '@flopay/shared';
4
- /**
5
- * Callbacks a lazily loaded wallet/APM/PayPal branch reports through. The
6
- * surface owns every merchant-facing outcome: a branch never reports success
7
- * itself, only that the provider accepted the method (`onConfirmed`), after
8
- * which the surface waits for the backend to verify it.
9
- */
10
- export interface SetupBranchCallbacks {
11
- /** The buyer started saving the method. */
12
- onSubmitting: () => void;
13
- /** The provider accepted the method; the surface now waits for the backend. */
14
- onConfirmed: () => void;
15
- /** The provider terminally declined the method. */
16
- onDeclined: (event: {
17
- reason?: string;
18
- message?: string;
19
- }) => void;
20
- /** A technical failure; `retryable` says whether trying again can help. */
21
- onFailed: (error: unknown, options: {
22
- code: string;
23
- retryable: boolean;
24
- }) => void;
25
- /** Live validation message, or `null` when it clears. */
26
- onValidation: (message: string | null) => void;
27
- /** The buyer left the provider flow without an outcome (not a cancel). */
28
- onAbandoned: () => void;
29
- /**
30
- * The provider cannot offer this method here: a wallet this device does not
31
- * have, or a method the session's currency does not support. Not a failure.
32
- * The surface stops offering the method and says nothing, unless it was the
33
- * last usable one.
34
- */
35
- onUnavailable: () => void;
36
- }
@@ -1 +0,0 @@
1
- import{a}from"./chunk-BU7THP6H.mjs";import"./chunk-VK67324N.mjs";export{a as PayPalSetupMethod};
@@ -1,25 +0,0 @@
1
- import type React from 'react';
2
- import type { SetupBranchCallbacks } from './payment-method-setup-advertisement.js';
3
- /** Props for the advertised PayPal vault flow (save PayPal without a purchase). */
4
- export interface PayPalSetupMethodProps extends SetupBranchCallbacks {
5
- clientId: string;
6
- environment?: string;
7
- /** The setup session's own currency, when the read carries one. A vault flow needs none. */
8
- currency?: string;
9
- sessionId: string;
10
- nonce: string;
11
- billingApiUrl: string;
12
- telemetry?: boolean;
13
- /** The setup session's customer, forwarded as checkout forwards it. */
14
- customer: {
15
- userId: string;
16
- email: string;
17
- };
18
- }
19
- /**
20
- * Renders PayPal's button in vault mode. The click mints a PayPal vault setup
21
- * token through the session-scoped intents contract (`paypal_vaulted`,
22
- * `intentKind: 'setup'`); the approval hands the token to the billing API the
23
- * same way checkout does. The surface then waits for backend verification.
24
- */
25
- export declare function PayPalSetupMethod({ clientId, environment, currency, sessionId, nonce, billingApiUrl, telemetry, customer: { userId, email }, onSubmitting, onConfirmed, onFailed, onAbandoned, }: PayPalSetupMethodProps): React.ReactElement;
@@ -1 +0,0 @@
1
- import{k as a}from"./chunk-FGCZOMML.mjs";import"./chunk-VK67324N.mjs";export{a as StripeSetupMethod};
@@ -1,31 +0,0 @@
1
- import type { ButtonsLayoutStyles, CardSetupFutureUse, FloPayAppearance, FutureUseUnsupportedMethod, ThemeId } from '@flopay/shared';
2
- import type React from 'react';
3
- import type { SetupBranchCallbacks } from './payment-method-setup-advertisement.js';
4
- /** Props for one advertised Stripe wallet/APM in setup mode. */
5
- export interface StripeSetupMethodProps extends SetupBranchCallbacks {
6
- method: string;
7
- category: 'wallet' | 'apm';
8
- publishableKey: string;
9
- currency: string;
10
- /**
11
- * The usage the billing API set the session up for, from the session read's
12
- * `futureUse`. Declared to Stripe as `setupFutureUsage` (through
13
- * `resolveSetupFutureUsage`) so Elements collect for what the SetupIntent is
14
- * configured for. Absent when the read does not carry it: nothing is
15
- * declared then, and the SDK never picks a usage.
16
- */
17
- futureUse?: CardSetupFutureUse | null;
18
- /** The read's `futureUseUnsupported`: a listed method declares no usage. */
19
- futureUseUnsupported?: FutureUseUnsupportedMethod[];
20
- sessionId: string;
21
- nonce: string;
22
- billingApiUrl: string;
23
- telemetry?: boolean;
24
- appearance?: FloPayAppearance;
25
- /** The surface's theme id, for the method tile's brand variant. */
26
- themeId?: ThemeId | null;
27
- /** The theme bundle's wrapper styles, for the tile and the save button. */
28
- buttonsLayout?: ButtonsLayoutStyles;
29
- }
30
- /** Renders one advertised Stripe wallet/APM and saves it without a charge. */
31
- export declare function StripeSetupMethod(props: StripeSetupMethodProps): React.ReactElement;
@@ -1,90 +0,0 @@
1
- import type { ButtonsLayoutStyles, FloPayAppearance, ThemeId, VaultCardThemeColors } from '@flopay/shared';
2
- import React from 'react';
3
- import { type FloPayCardSetupCancelEvent, type FloPayCardSetupCompleteEvent, type FloPayCardSetupDeclineEvent, type FloPayCardSetupError } from './flopay-card-setup.js';
4
- import type { PayPalSetupMethodProps } from './payment-method-setup-paypal.js';
5
- import type { StripeSetupMethodProps } from './payment-method-setup-stripe.js';
6
- /**
7
- * The Stripe wallet/APM and PayPal branch components the surface renders. Either
8
- * the modules' own exports or `React.lazy` wrappers around them: the surface
9
- * renders both inside a `Suspense` and a load-failure boundary.
10
- */
11
- export interface PaymentMethodSetupBranches {
12
- StripeSetupMethod: React.ComponentType<StripeSetupMethodProps>;
13
- PayPalSetupMethod: React.ComponentType<PayPalSetupMethodProps>;
14
- }
15
- /** Verified terminal result from a no-charge payment-method setup. */
16
- export type FloPayPaymentMethodSetupCompleteEvent = FloPayCardSetupCompleteEvent;
17
- /** Provider-neutral terminal decline from payment-method verification. */
18
- export type FloPayPaymentMethodSetupDeclineEvent = FloPayCardSetupDeclineEvent;
19
- /** Abandoned setup result emitted when the surface unmounts pre-terminally. */
20
- export type FloPayPaymentMethodSetupCancelEvent = FloPayCardSetupCancelEvent;
21
- /** Props for the browser-only payment-method setup surface. */
22
- export interface FloPayPaymentMethodSetupProps {
23
- /** Opaque id returned by the merchant-authenticated setup-session endpoint. */
24
- sessionId: string;
25
- /** Session-bound token returned alongside {@link FloPayPaymentMethodSetupProps.sessionId}. */
26
- nonce: string;
27
- /** Billing API base URL. Defaults to the configured FloPay environment URL. */
28
- billingApiUrl?: string;
29
- /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
30
- telemetry?: boolean;
31
- /**
32
- * The same {@link ThemeId} bundle `FloPayCheckout` and `FloPayCardSetup`
33
- * resolve, or raw {@link VaultCardThemeColors} for the hosted card widget.
34
- * A preset also themes the Stripe wallets, APM tiles and the outcome
35
- * overlay. Defaults to `'modern-light'`, which an unrecognized preset id
36
- * also falls back to; pass `'classic'` for the historic FloPay look.
37
- */
38
- theme?: ThemeId | VaultCardThemeColors;
39
- /**
40
- * Inline styles for the hosted card-widget container, with the same
41
- * precedence over the preset's pane surface (and a stored
42
- * `buttonsStyles.cardFormContainer`) as `FloPayCardSetup`.
43
- */
44
- containerStyle?: React.CSSProperties;
45
- /**
46
- * Appearance override, the same prop and type as `FloPayCheckout`'s and
47
- * `FloPayCardSetup`'s (for example a client's saved embed theme
48
- * `appearance`). It replaces the preset's appearance outright, as checkout
49
- * does: its variables drive the hosted card fields and submit button, the
50
- * Stripe Elements of every wallet and APM (`appearance`), the method tiles'
51
- * radius, their save buttons, and the outcome overlay. Ignored with raw
52
- * {@link VaultCardThemeColors}; an empty `{}` is the same as omitting it.
53
- */
54
- appearance?: FloPayAppearance;
55
- /**
56
- * Buttons-layout style overrides, the same prop and type as
57
- * `FloPayCheckout`'s and `FloPayCardSetup`'s (for example a client's saved
58
- * embed theme `buttonsStyles`), merged over the preset's buttons layout the
59
- * way checkout merges them. `submitButton` and the `cardInput*` members style
60
- * the hosted card form; `cardButton`, `cardInputBorder` and `submitButton`
61
- * the APM tiles and their save buttons; `cardFormContainer` the pane around
62
- * the card form and the outcome overlay's panel. Ignored with raw
63
- * {@link VaultCardThemeColors}; an empty `{}` is the same as omitting it.
64
- */
65
- buttonsStyles?: ButtonsLayoutStyles;
66
- /** Optional content shown while the session and methods are loading. */
67
- loading?: React.ReactNode;
68
- /** Fired once the hosted card widget has mounted and can accept card input. */
69
- onReady?: () => void;
70
- /** Fired only after the backend reports that the method is verified and usable. */
71
- onComplete?: (event: FloPayPaymentMethodSetupCompleteEvent) => void;
72
- /** Fired when verification terminally declines; never paired with `onComplete`. */
73
- onDecline?: (event: FloPayPaymentMethodSetupDeclineEvent) => void;
74
- /** Fired exactly once if the surface unmounts before a terminal outcome. */
75
- onCancel?: (event: FloPayPaymentMethodSetupCancelEvent) => void;
76
- /** Live validation message, or `null` when validation clears. */
77
- onValidation?: (message: string | null) => void;
78
- /** Fired for session validation, transport, provider or widget failures. */
79
- onError?: (error: FloPayCardSetupError) => void;
80
- }
81
- /**
82
- * Renders every payment method a setup session advertises — the hosted card
83
- * widget, Stripe wallets/APMs in setup mode, and the PayPal vault flow — and
84
- * saves the buyer's choice without a purchase. The advertisement is the single
85
- * source of truth. `FloPayPaymentMethodSetup` is this surface with its branch
86
- * components bound; see the module header for which entry binds which.
87
- */
88
- export declare function PaymentMethodSetupSurface({ branches: { StripeSetupMethod, PayPalSetupMethod }, sessionId, nonce, billingApiUrl, telemetry, theme, containerStyle, appearance, buttonsStyles, loading, onReady, onComplete, onDecline, onCancel, onValidation, onError, }: FloPayPaymentMethodSetupProps & {
89
- branches: PaymentMethodSetupBranches;
90
- }): React.ReactElement;
@@ -1,12 +0,0 @@
1
- import type { TelemetryPopupCapability } from '@flopay/shared';
2
- export interface PopupCapabilityOwner {
3
- current(): TelemetryPopupCapability;
4
- /** Returns true only when this observation changed the current capability. */
5
- markAvailable(): boolean;
6
- /** Returns true only when this observation changed the current capability. */
7
- markBlocked(): boolean;
8
- }
9
- /** Internal checkout-mount owner shared with nested external-method surfaces. */
10
- export declare const PopupCapabilityContext: import("react").Context<PopupCapabilityOwner | null>;
11
- /** Creates the monotonic capability state owned by one checkout mount. */
12
- export declare function createPopupCapabilityOwner(): PopupCapabilityOwner;