@flopay/js 1.4.22 → 1.4.24

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/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _flopay_shared from '@flopay/shared';
2
- import { PaymentProviderAdapter, ElementOptions, ElementType, MountedElement, FloPayError, FloPayConfig, CaptureMethod, CardCaptureAdapter, PayPalPaymentResult, ConfirmPaymentParams, PaymentResult, CheckoutSession, NormalizedCheckoutSession, FloPayThemeVariables, FloPayAppearance, CheckoutSessionMode, CheckoutGateways, VaultCaptureBlock, ProcessPaymentParams, CreateSessionIntentRequest, SessionIntent, SessionIntentDeclineRequest, InlineSessionDraft, DetachedCheckoutSession, CardCaptureProviderId, CardCaptureMountOptions, CardCaptureEventType, CardCaptureOutcomeEvent, VaultCardThemeColors, VaultCardFieldKey, CreateSessionParams, CheckoutSessionResult } from '@flopay/shared';
2
+ import { PaymentProviderAdapter, ElementOptions, ElementType, MountedElement, FloPayError, FloPayConfig, CaptureMethod, CardCaptureAdapter, PayPalPaymentResult, ConfirmPaymentParams, PaymentResult, CheckoutSession, NormalizedCheckoutSession, FloPayThemeVariables, FloPayAppearance, CreateSessionParams, CheckoutSessionResult } from '@flopay/shared';
3
3
  export { SentryEventLike, SentryStackFrameLike, dropThirdPartyOnlyError } from '@flopay/shared';
4
+ export { C as CardCaptureOperation, P as PaymentAPI, a as PciVaultCardCapture, b as PciVaultCardCaptureConfig, S as SESSION_CREATE_TELEMETRY, c as SessionDisplayCacheData, d as SessionDisplayProduct, e as cacheSessionDisplayData, f as clearSessionDisplayData, g as getSessionDisplayData } from './card-setup-B8II-Etg.cjs';
4
5
 
5
6
  /**
6
7
  * Manages the creation and lifecycle of payment elements.
@@ -211,592 +212,6 @@ declare class StripeAdapter implements PaymentProviderAdapter {
211
212
  destroy(): void;
212
213
  }
213
214
 
214
- /**
215
- * Client-side cache for display-only checkout fields the backend no longer
216
- * persists (`overrideAmount`, `totalAmount`, `providerItemName`,
217
- * `providerPlanName`, per-line `currency`).
218
- *
219
- * The cache lives in `sessionStorage` so it survives the navigation from the
220
- * page that creates the session to the checkout page that fetches it, but
221
- * dies on tab close. An in-memory fallback keeps the SDK working in Node /
222
- * SSR contexts where `sessionStorage` is unavailable.
223
- *
224
- * Values from the server response always win — cached values fill in only
225
- * where the server returned `null` or `undefined`.
226
- */
227
- /** Display-only fields per product that can be cached and merged back later. */
228
- interface SessionDisplayProduct {
229
- /** Catalog code (match key). */
230
- code?: string;
231
- /** Whether this product is a one-time item or a recurring subscription. */
232
- type?: 'item' | 'subscription';
233
- /** Display-only name for the product. */
234
- name?: string | null;
235
- totalAmount?: number;
236
- overrideAmount?: number | null;
237
- currency?: string;
238
- }
239
- /** Display-only payload that can be stashed for later merge into a session response. */
240
- interface SessionDisplayCacheData {
241
- /** Session-level currency (falls into the response only when the server omits it). */
242
- currency?: string;
243
- products?: SessionDisplayProduct[];
244
- }
245
- /**
246
- * Stash display-only data for a session. Called client-side right after the
247
- * server returns a session ID, so the values survive the redirect to the
248
- * checkout page.
249
- */
250
- declare function cacheSessionDisplayData(sessionId: string, data: SessionDisplayCacheData, options?: {
251
- ttlMs?: number;
252
- }): void;
253
- /**
254
- * Read previously-cached display data for a session, or `null` if nothing
255
- * is cached (or the TTL has elapsed).
256
- */
257
- declare function getSessionDisplayData(sessionId: string): SessionDisplayCacheData | null;
258
- /**
259
- * Drop any cached display data for a session. Call from the success page
260
- * after the payment completes; otherwise the TTL handles cleanup.
261
- */
262
- declare function clearSessionDisplayData(sessionId: string): void;
263
-
264
- /** Raw billing API response wrapper. */
265
- interface BillingResponse<T> {
266
- data: T;
267
- }
268
- /** Raw checkout session from the billing API. */
269
- interface RawCheckoutSession {
270
- uuid: string;
271
- nonce: string;
272
- status: 'pending' | 'authorized' | 'completed' | 'expired';
273
- successUrl: string;
274
- cancelUrl: string;
275
- /** Session-level currency. */
276
- currency?: string;
277
- createdAt?: string;
278
- checkoutUrl?: string;
279
- /** Unified products list returned by the billing API (post-#760). */
280
- products?: Array<{
281
- uuid: string;
282
- checkoutSessionId: string;
283
- /** 'item' or 'subscription'. */
284
- type: 'item' | 'subscription';
285
- code?: string;
286
- name?: string | null;
287
- description?: string | null;
288
- quantity: number;
289
- totalAmount?: number;
290
- overrideAmount?: number | null;
291
- currency?: string;
292
- metadata?: Record<string, unknown> | null;
293
- }>;
294
- coupons?: string[];
295
- /**
296
- * Pre-discount total in cart-currency major units. Populated by billing
297
- * API ≥ v1.1.2; absent on older backends.
298
- */
299
- subtotalAmount?: number;
300
- /** Total reduction from applied coupons (cart-currency major units). */
301
- discountAmount?: number;
302
- /** Final charge amount after coupon discount (cart-currency major units). */
303
- totalAmount?: number;
304
- checkoutMode?: CheckoutSessionMode;
305
- captureMethod?: 'automatic' | 'manual';
306
- paymentId?: string;
307
- authorizationExpiresAt?: string;
308
- /** Backend authorization/capture lifecycle reason, normalized before exposure. */
309
- failureReason?: string;
310
- outcome?: string;
311
- gateways?: CheckoutGateways;
312
- /**
313
- * Generic downstream card-method id for a card already on file
314
- * (TeamFloPay/backend#823) — present for returning customers so the SDK can
315
- * skip the vault widget. Absent for first-time buyers.
316
- */
317
- providerPaymentMethodId?: string | null;
318
- accountData: {
319
- userId: string;
320
- firstName: string;
321
- lastName: string;
322
- email: string;
323
- gender?: string | null;
324
- city?: string | null;
325
- state?: string | null;
326
- country?: string | null;
327
- zip?: string | null;
328
- addressLine1?: string | null;
329
- addressLine2?: string | null;
330
- };
331
- tagsData: {
332
- googleContainerId?: string | null;
333
- sessionId?: string | null;
334
- testEventCode?: string | null;
335
- };
336
- }
337
- type AccountSnapshotTelemetryMode = 'blocking' | 'best_effort';
338
- interface PaymentAPIOptions {
339
- /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
340
- telemetry?: boolean;
341
- }
342
- declare const SESSION_CREATE_TELEMETRY: unique symbol;
343
- /**
344
- * Client-side payment API service.
345
- *
346
- * Mirrors the `PaymentAPI` class from the checkout project's
347
- * `src/service/api.ts`. All methods call the billing API endpoints
348
- * that the checkout backend exposes.
349
- */
350
- declare class PaymentAPI {
351
- private static readonly activeVaultCaptureRequests;
352
- private readonly baseUrl;
353
- private readonly directTelemetry?;
354
- private readonly telemetryHooks?;
355
- private directTelemetryCheckoutId?;
356
- constructor(billingApiUrl: string, options?: PaymentAPIOptions);
357
- /** Dispose the reporter owned by direct public usage. Internal hooks are never disposed here. */
358
- destroy(): void;
359
- private reportDirectFailure;
360
- /**
361
- * A hosted-vault snapshot timeout is an observed fallback, not a checkout
362
- * failure: the widget charge is already proceeding with the session baseline.
363
- * Every other snapshot failure and every default/direct timeout remains an
364
- * alert-level technical error.
365
- */
366
- private reportAccountSnapshotFailure;
367
- private telemetryTimestamp;
368
- private beginDirectTelemetryCheckout;
369
- private beginDirectTelemetryOperation;
370
- private adoptDirectTelemetryCheckout;
371
- /**
372
- * Fetch a raw checkout session by ID.
373
- *
374
- * `nonce` is the session-bound checkout token returned when the session
375
- * was created. When supplied it is sent as the `x-checkout-session-token`
376
- * header that post-#640 backends match against `checkout_session.nonce`
377
- * before returning the row — the UUID alone is no longer sufficient.
378
- * Backends that don't yet enforce it ignore the extra header.
379
- */
380
- getCheckoutSession(checkoutSessionId: string, nonce?: string): Promise<BillingResponse<RawCheckoutSession>>;
381
- /**
382
- * Stash display-only data for a session so subsequent fetches can fill in
383
- * fields the backend no longer persists (`overrideAmount`, `totalAmount`,
384
- * `providerItemName`, `providerPlanName`).
385
- *
386
- * Backed by `sessionStorage` in the browser, with an in-memory fallback in
387
- * Node/SSR contexts. Default TTL: 1 hour.
388
- *
389
- * Server-returned values always win — cached values fill in only where the
390
- * server returned `null` / `undefined`.
391
- *
392
- * @example
393
- * ```ts
394
- * paymentAPI.cacheSessionDisplayData(sessionId, {
395
- * currency: 'USD',
396
- * items: [{ code: 'pro_plan', overrideAmount: 24.99, providerItemName: 'Pro' }],
397
- * });
398
- * ```
399
- */
400
- cacheSessionDisplayData(sessionId: string, data: SessionDisplayCacheData, options?: {
401
- ttlMs?: number;
402
- }): void;
403
- /**
404
- * Drop any cached display data for a session. Call after the payment
405
- * completes; otherwise the TTL handles cleanup.
406
- */
407
- clearSessionDisplayData(sessionId: string): void;
408
- /**
409
- * Fetch (re-mint) the hosted vault capture widget for a session
410
- * (TeamFloPay/backend#823).
411
- *
412
- * `POST /v1/checkouts/sessions/{id}/vault/capture` returns the SDK-ready
413
- * {@link VaultCaptureBlock} (`html` + `url`, plus `messageToken` /
414
- * `expectedOrigin` once the backend mints them). The SDK injects `html` as
415
- * the card-capture widget. This is the lazy path for explicitly card-capable
416
- * sessions that do not receive an embedded `vault` block; the endpoint is
417
- * idempotent and reuses session-cached creds when available.
418
- *
419
- * Because the endpoint is idempotent, transient network failures receive a
420
- * bounded retry and a stalled request aborts after ten seconds. Concurrent
421
- * callers for the same base URL, session, and nonce share the active promise,
422
- * preventing React renders/remounts from racing competing recovery POSTs.
423
- *
424
- * The PCIVault submit *secret* the backend may include in the response is
425
- * intentionally **not** read or surfaced — it is server-only and never enters
426
- * the SDK runtime.
427
- *
428
- * `nonce` is forwarded as `x-checkout-session-token` (required by post-#640
429
- * backends, matched against the session's stored nonce).
430
- */
431
- getVaultCapture(checkoutSessionId: string, nonce?: string): Promise<VaultCaptureBlock>;
432
- private requestVaultCapture;
433
- /**
434
- * Fetch and normalize a checkout session.
435
- *
436
- * Reads the backend's `gateways` map to enumerate provider-specific data,
437
- * then wraps the session in a `NormalizedCheckoutSession` for provider-
438
- * agnostic consumption.
439
- */
440
- getUnifiedCheckoutSession(checkoutSessionId: string, nonce?: string): Promise<NormalizedCheckoutSession>;
441
- /**
442
- * Submit a tokenized payment to the billing backend.
443
- *
444
- * The backend will either succeed, return `type: '3ds_required'`
445
- * (with a `threeDSecureToken`), or return `type: 'paypal_redirect_required'`.
446
- *
447
- * Hits the session-scoped route `POST /v1/checkouts/sessions/:id/process`
448
- * and forwards `data.nonce` as `x-checkout-session-token`. Backend
449
- * `TeamFloPay/backend#640` rejects callers without a matching nonce with a
450
- * 401 — this method throws synchronously when `data.nonce` is missing so the
451
- * problem surfaces before the network round trip.
452
- *
453
- * @param userId Vestigial — backend's GatewayInterceptor routes via session,
454
- * not headers, so this value is no longer sent on the wire. Kept in the
455
- * signature for back-compat with existing callers; will be removed in a
456
- * future major version.
457
- */
458
- processPayment(_userId: string, data: ProcessPaymentParams, options?: {
459
- pollTimeoutMs?: number;
460
- }): Promise<Response>;
461
- /**
462
- * Patch the buyer's account snapshot (email, name, billing address, AVS
463
- * intent) onto a checkout session via
464
- * `PATCH /v1/checkouts/sessions/{id}/account` (TeamFloPay/backend#823).
465
- *
466
- * The vault path's hosted form owns the charge end-to-end so the SDK
467
- * never calls `/process` on this path; the buyer-typed AVS / billing
468
- * address would otherwise be lost. The SDK calls this just before
469
- * submitting the vault widget so the downstream listener mints the
470
- * Stripe PaymentMethod with the right `billing_details.address` and the
471
- * per-attempt + per-PM address snapshots are populated.
472
- *
473
- * Body shape mirrors the relevant subset of `/process`'s
474
- * `ProcessCheckoutBodyDto` — same keys, same validators. The endpoint
475
- * is idempotent: empty/undefined fields are not written, addresses are
476
- * last-writer-wins, AVS analytics are first-writer-wins.
477
- *
478
- * Wrapped in `fetchWithNetworkRetry` because a transient blip on this
479
- * pre-pay PATCH would silently leave AVS unsent and cause an
480
- * AVS-protected charge to decline downstream.
481
- */
482
- patchAccountSnapshot(sessionId: string, nonce: string, body: {
483
- accountData: {
484
- userId: string;
485
- email: string;
486
- firstName?: string | null;
487
- lastName?: string | null;
488
- addressLine1?: string | null;
489
- addressLine2?: string | null;
490
- city?: string | null;
491
- state?: string | null;
492
- zip?: string | null;
493
- country?: string | null;
494
- gender?: string | null;
495
- };
496
- avsCheck?: boolean;
497
- avsConfig?: Record<string, unknown>;
498
- }, options?: {
499
- signal?: AbortSignal;
500
- timeoutMs?: number;
501
- /**
502
- * Downgrade only a timeout to `operation.fallback` when the caller can
503
- * continue safely. The promise still rejects and all other failures stay
504
- * technical errors. Defaults to `blocking`.
505
- */
506
- telemetryMode?: AccountSnapshotTelemetryMode;
507
- }): Promise<void>;
508
- /** Create a wallet/APM/PayPal intent through the session-scoped contract. */
509
- createSessionIntent(sessionId: string, nonce: string, request: CreateSessionIntentRequest, options?: {
510
- signal?: AbortSignal;
511
- idempotencyKey?: string;
512
- }): Promise<SessionIntent>;
513
- /** Record a provider-neutral non-card decline without sensitive identifiers. */
514
- reportSessionIntentDecline(sessionId: string, nonce: string, request: SessionIntentDeclineRequest, options?: {
515
- signal?: AbortSignal;
516
- }): Promise<void>;
517
- /**
518
- * Fetch user's prior payments by email.
519
- * Used to determine if saved card UX should be shown.
520
- */
521
- getPaymentsByEmail(email: string, options?: {
522
- signal?: AbortSignal;
523
- page?: number;
524
- limit?: number;
525
- }): Promise<{
526
- data: Array<{
527
- id: string;
528
- }>;
529
- total: number;
530
- page: number;
531
- limit: number;
532
- }>;
533
- /**
534
- * Create a checkout session AND return the full session data in one call.
535
- * Uses `?expand=true` so the backend returns the complete session
536
- * instead of just a UUID — eliminating the need for a second GET.
537
- *
538
- * Falls back to create + GET if the backend doesn't support `expand`.
539
- *
540
- * Eligible sessions are created through the **detached** shell + claim flow
541
- * (see {@link PaymentAPI.createDetachedSession}) and this method awaits the
542
- * claim, so its resolved value is unchanged — callers still receive one
543
- * fully-populated session. The win here is server-side: the create no longer
544
- * contends on buyer-identity advisory locks. Callers that want to render from
545
- * the shell *before* the claim lands — mounting the card form early — should
546
- * call {@link PaymentAPI.createDetachedSession} directly. Pass
547
- * `deferDataAttachment: false` to force the original one-shot create.
548
- */
549
- createAndFetchSession(params: InlineSessionDraft): Promise<NormalizedCheckoutSession>;
550
- private createAndFetchSessionRequest;
551
- /**
552
- * `POST /v1/checkouts/sessions` with the SDK's bounded retry budget.
553
- *
554
- * Network failures and the backend's documented in-progress replay share one
555
- * attempt budget and one operation-wide abort signal, so the two retry modes
556
- * cannot multiply into nine POSTs during an outage. The idempotency key is
557
- * resolved once, before the loop — an invalid merchant-supplied key throws
558
- * before any request, and every attempt of this logical create replays the
559
- * same key so a timeout cannot mint a second session
560
- * (TeamFloPay/backend#972).
561
- */
562
- private postCheckoutSessionCreate;
563
- /**
564
- * Create a checkout session **detached** from its buyer and catalog data
565
- * (TeamFloPay/backend#1099).
566
- *
567
- * Resolves as soon as the lightweight *shell* exists. That create runs no
568
- * catalog validation and takes none of the buyer-identity advisory locks that
569
- * serialise concurrent checkouts for the same customer, and the backend routes
570
- * a gateway for it from `currency` + the buyer's country — so the shell
571
- * already carries the session id, nonce, `gateways` and the hosted `vault`
572
- * block. The card form can mount from it immediately.
573
- *
574
- * Buyer identity, address, products and coupons are attached by the returned
575
- * {@link DetachedCheckoutSession.claimed} promise, which is already in flight
576
- * when this resolves. **Nothing may be charged until it settles** — the
577
- * billing API rejects process / intent / decline calls on an unclaimed
578
- * session with `409 checkout_session_data_attachment_required`, and holds an
579
- * unclaimed vault charge with a retryable `503`.
580
- *
581
- * Requires a billing API with `PATCH /v1/checkouts/sessions/{id}/claim`; there
582
- * is no fallback to the one-shot create. Callers that want the original
583
- * single-request behaviour should pass `deferDataAttachment: false` and use
584
- * {@link PaymentAPI.createAndFetchSession}.
585
- */
586
- createDetachedSession(params: InlineSessionDraft): Promise<DetachedCheckoutSession>;
587
- /**
588
- * `PATCH /v1/checkouts/sessions/{id}/claim` — attach buyer identity, address,
589
- * products and coupons to a detached session shell.
590
- *
591
- * The backend fingerprints the payload, so a transport retry replaying the
592
- * identical body returns the same claimed session rather than conflicting; a
593
- * *materially different* claim for an already-claimed session returns `409`,
594
- * which is surfaced without retrying. Invalid catalog data surfaces here as
595
- * the same `422` the one-shot create would have returned — later in the flow,
596
- * but with identical semantics.
597
- */
598
- claimCheckoutSession(checkoutSessionId: string, nonce: string, payload: Record<string, unknown>, internal?: {
599
- params: InlineSessionDraft;
600
- startedAt: number;
601
- deadline: {
602
- signal: AbortSignal;
603
- clear(): void;
604
- };
605
- /**
606
- * Attempts the shell create needed. The `session_create` rollup below
607
- * reports this rather than the claim's own attempt count, so an
608
- * end-to-end span keeps meaning "attempts to create this session".
609
- */
610
- createAttempt: number;
611
- }): Promise<NormalizedCheckoutSession>;
612
- /** Shared create/claim failure reporting so both phases classify identically. */
613
- private reportSessionCreateFailure;
614
- waitForCheckoutSessionCompletion(checkoutSessionId: string, options?: {
615
- initialDelayMs?: number;
616
- timeoutMs?: number;
617
- /**
618
- * Session-bound checkout token; forwarded on the poll's
619
- * `GET /v1/checkouts/sessions/:id`. Required by post-#640 backends.
620
- */
621
- nonce?: string;
622
- }): Promise<NormalizedCheckoutSession>;
623
- /** Normalize a raw session into a provider-agnostic shape. */
624
- private normalizeRawSession;
625
- /** Convert raw session to the SDK CheckoutSession shape. */
626
- private toCheckoutSession;
627
- /**
628
- * Coerce a raw vault block into a typed {@link VaultCaptureBlock}. The
629
- * server-only PCIVault submit `secret` is deliberately dropped so it never
630
- * lands on the public session surface (logs / telemetry / client inspection).
631
- */
632
- private toVaultBlock;
633
- private toCheckoutSessionStatus;
634
- private resolveProcessResponse;
635
- private toCheckoutProcessingPending;
636
- private clampRetryAfterMs;
637
- /**
638
- * Stash the display-only fields the consumer passed into a create-session
639
- * call. Runs after the backend assigns a UUID so a later GET on the same
640
- * session (typically after a redirect) can fill in fields the backend no
641
- * longer persists — `overrideAmount`, `totalAmount`, `name`, etc.
642
- *
643
- * No-op when no UUID is available.
644
- */
645
- private autoCacheDisplayData;
646
- /**
647
- * Merge cached display-only fields (set by {@link cacheSessionDisplayData})
648
- * into a raw session response. Server values always win — cache fills in
649
- * only where the server returned `null` / `undefined`.
650
- */
651
- private mergeCachedDisplayData;
652
- }
653
-
654
- /** Browser operation hosted by the PCIVault card-capture adapter. */
655
- type CardCaptureOperation = 'checkout' | 'card_setup';
656
- /** Configuration for a {@link PciVaultCardCapture} instance. */
657
- interface PciVaultCardCaptureConfig {
658
- /** Checkout session id bound to the capture (for outcome correlation + trust). */
659
- sessionId?: string;
660
- /** Capture behavior of the checkout session, used to classify legacy outcomes safely. */
661
- captureMethod?: CaptureMethod;
662
- /** Distinguishes no-charge card verification telemetry from checkout payment telemetry. */
663
- operation?: CardCaptureOperation;
664
- /**
665
- * Default strict origin for vault `postMessage` outcomes. Overridden by
666
- * {@link CardCaptureMountOptions.expectedOrigin} when that is supplied at
667
- * mount. When neither is set the origin gate is skipped (the widget posts
668
- * same-window in the Model-A flow).
669
- */
670
- expectedOrigin?: string;
671
- /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
672
- telemetry?: boolean;
673
- }
674
- /**
675
- * {@link CardCaptureAdapter} backed by the backend-rendered PCIVault hosted
676
- * widget.
677
- *
678
- * `mount()` injects the server-supplied widget HTML (re-executing its bundled
679
- * `<script>` so the form bootstraps) and subscribes to the widget's
680
- * `postMessage` outcome. The backend owns everything else; this adapter never
681
- * touches the card data, a payment intent, or 3DS.
682
- */
683
- declare class PciVaultCardCapture implements CardCaptureAdapter {
684
- readonly provider: CardCaptureProviderId;
685
- private readonly config;
686
- private telemetryReporter?;
687
- /** Reporter already initialized for this adapter's setup operation. */
688
- private setupTelemetryReporter?;
689
- private readonly ownsTelemetryReporter;
690
- private container;
691
- private messageHandler;
692
- /**
693
- * Parent-page-level overlay rendering the provider's verification challenge
694
- * (3DS-2 iframe) on `action_required`. Owned by the adapter — not the
695
- * widget — so it can sit above the host SDK's processing backdrop, which
696
- * would otherwise visually cover an in-widget challenge iframe.
697
- */
698
- private actionOverlay;
699
- /**
700
- * Listener that catches the `flopay-vault-3ds-return` postMessage from the
701
- * provider's challenge return page. When the SDK owns the challenge iframe
702
- * the return page lives inside *that* iframe (not the widget's), so
703
- * `window.parent` is the host page — the widget's existing message
704
- * listener can't see it. The SDK forwards completion into the widget via
705
- * `action_completed` so the widget kicks `/3ds/complete` immediately
706
- * instead of waiting on the eventual provider webhook.
707
- */
708
- private threeDsReturnHandler;
709
- /** Per-session integrity token to require on outcomes (from mount options). */
710
- private messageToken;
711
- /** Strict origin to require on outcomes, when configured. */
712
- private expectedOrigin;
713
- /** Latest merchant theme to push into the (cross-origin) widget. */
714
- private theme;
715
- /** Latest host submit-gate state to push into the widget (block its submit). */
716
- private submitGateBlocked;
717
- /** Latest card-field order + autofocus directive to push into the widget. */
718
- private cardFieldOrder;
719
- private cardAutoFocus;
720
- /** Monotonic start of the current widget mount-to-ready machine interval. */
721
- private mountStartedAt;
722
- private vaultReadyReported;
723
- private submissionStarted;
724
- private submissionStartedAt;
725
- private readonly listeners;
726
- constructor(config?: PciVaultCardCaptureConfig);
727
- mount(container: HTMLElement, options: CardCaptureMountOptions): Promise<void>;
728
- private reportVaultLoadFailure;
729
- on(event: CardCaptureEventType, handler: (event: CardCaptureOutcomeEvent) => void): () => void;
730
- unmount(): void;
731
- /**
732
- * Inject the server-rendered widget HTML. `innerHTML` does not execute
733
- * embedded `<script>` tags, so each script node is replaced with a freshly
734
- * created element that the browser will load and run (this is what boots the
735
- * PCIVault form bundle against the `data-flopay-config` container).
736
- */
737
- private injectWidget;
738
- private attachMessageListener;
739
- private reportOutcome;
740
- /**
741
- * Push merchant theme colors into the hosted widget (live). The host calls
742
- * this on a runtime theme switch; the widget applies them to its CSS variables
743
- * without a remount. Stores the latest theme so `ready` can re-push it.
744
- */
745
- applyTheme(theme: VaultCardThemeColors): void;
746
- /** postMessage the current theme to the widget's (cross-origin) document. */
747
- private postTheme;
748
- /**
749
- * Gate the widget's submit from the host. When `blocked`, the widget cancels
750
- * its next submit and emits `'blocked'` instead of `'submitting'` so the host
751
- * can validate merchant-DOM fields (AVS) first. Stored so `ready` re-pushes it.
752
- */
753
- setSubmitGate(blocked: boolean): void;
754
- /** postMessage the current submit-gate state to the widget's document. */
755
- private postSubmitGate;
756
- /**
757
- * Push the card-field order + autofocus directive into the widget (live). The
758
- * widget re-sequences its rows (DOM order, so tab order follows) and focuses
759
- * its first field unless `autoFocus` is false. Stored so `ready` re-pushes it.
760
- */
761
- setCardFieldOrder(order: VaultCardFieldKey[] | null, autoFocus: boolean): void;
762
- /** postMessage the current field order + autofocus to the widget's document. */
763
- private postCardFieldOrder;
764
- private emit;
765
- /**
766
- * Render the provider-hosted verification challenge (e.g. Stripe 3DS-2) in a
767
- * full-page overlay at the PARENT page level. The widget's inline-iframe
768
- * approach is unusable because the SDK's processing backdrop sits above the
769
- * vault iframe, hiding any challenge mounted inside it — by lifting the
770
- * iframe to the host page the adapter can give it a z-index that wins.
771
- *
772
- * The overlay tears down on the next terminal outcome
773
- * (`complete`/`decline`/`error`) or when the buyer closes it via the backdrop
774
- * close button. Closing manually is a soft abandon — the next `/status` poll
775
- * either reveals a real outcome (the challenge completed via the issuer's
776
- * own redirect to `/vault/3ds/return`, which posts back into the widget) or
777
- * surfaces `requires_action` again so the host can decide what to do.
778
- */
779
- private showActionRequiredOverlay;
780
- /**
781
- * Tell the vault widget that the buyer has completed (or abandoned) the
782
- * challenge. The widget responds by POSTing `/3ds/complete` — its
783
- * sub-300ms sync resolver writes the follow-up attempt row immediately,
784
- * so the next `/status` poll resolves to a terminal outcome instead of
785
- * waiting for the eventual provider webhook.
786
- */
787
- private postActionCompleted;
788
- private abandonActionRequiredOverlay;
789
- private hideActionRequiredOverlay;
790
- /**
791
- * Size the hosted-widget iframe to the height reported by the form inside it.
792
- * Cross-origin iframes don't auto-size to their content, so the widget posts
793
- * its measured height and we apply it here (clamped to a sane range). This is
794
- * what lets the card form shrink/grow to fit instead of sitting at a fixed
795
- * height.
796
- */
797
- private applyHeight;
798
- }
799
-
800
215
  declare function createCheckoutSession(options: CreateSessionParams): Promise<CheckoutSessionResult>;
801
216
  /**
802
217
  * Creates a checkout session with automatic retry on transient transport,
@@ -816,4 +231,4 @@ declare function createCheckoutSessionWithRetries(options: CreateSessionParams &
816
231
  maxRetries?: number;
817
232
  }): Promise<CheckoutSessionResult>;
818
233
 
819
- export { type CardCaptureOperation, FloPay, FloPayElements, PaymentAPI, PciVaultCardCapture, type PciVaultCardCaptureConfig, SESSION_CREATE_TELEMETRY, type SessionDisplayCacheData, type SessionDisplayProduct, StripeAdapter, type StripeSafeAppearance, cacheSessionDisplayData, clearSessionDisplayData, createCheckoutSession, createCheckoutSessionWithRetries, getSessionDisplayData, loadFloPay, toStripeAppearance, toStripeAppearanceTheme };
234
+ export { FloPay, FloPayElements, StripeAdapter, type StripeSafeAppearance, createCheckoutSession, createCheckoutSessionWithRetries, loadFloPay, toStripeAppearance, toStripeAppearanceTheme };