@flopay/js 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.
@@ -1,55 +1,5 @@
1
- import { CheckoutSessionMode, AdvertisedPaymentMethod, CheckoutGateways, VaultCaptureBlock, NormalizedCheckoutSession, ProcessPaymentParams, CreateSessionIntentRequest, SessionIntent, SessionIntentDeclineRequest, InlineSessionDraft, DetachedCheckoutSession, TelemetryPaymentMethodCategory, CardCaptureAdapter, CardCaptureProviderId, CaptureMethod, CardCaptureMountOptions, CardCaptureEventType, CardCaptureOutcomeEvent, VaultCardThemeColors, VaultCardFieldKey } from '@flopay/shared';
2
-
3
- /**
4
- * Client-side cache for display-only checkout fields the backend no longer
5
- * persists (`overrideAmount`, `totalAmount`, `providerItemName`,
6
- * `providerPlanName`, per-line `currency`).
7
- *
8
- * The cache lives in `sessionStorage` so it survives the navigation from the
9
- * page that creates the session to the checkout page that fetches it, but
10
- * dies on tab close. An in-memory fallback keeps the SDK working in Node /
11
- * SSR contexts where `sessionStorage` is unavailable.
12
- *
13
- * Values from the server response always win — cached values fill in only
14
- * where the server returned `null` or `undefined`.
15
- */
16
- /** Display-only fields per product that can be cached and merged back later. */
17
- interface SessionDisplayProduct {
18
- /** Catalog code (match key). */
19
- code?: string;
20
- /** Whether this product is a one-time item or a recurring subscription. */
21
- type?: 'item' | 'subscription';
22
- /** Display-only name for the product. */
23
- name?: string | null;
24
- totalAmount?: number;
25
- overrideAmount?: number | null;
26
- currency?: string;
27
- }
28
- /** Display-only payload that can be stashed for later merge into a session response. */
29
- interface SessionDisplayCacheData {
30
- /** Session-level currency (falls into the response only when the server omits it). */
31
- currency?: string;
32
- products?: SessionDisplayProduct[];
33
- }
34
- /**
35
- * Stash display-only data for a session. Called client-side right after the
36
- * server returns a session ID, so the values survive the redirect to the
37
- * checkout page.
38
- */
39
- declare function cacheSessionDisplayData(sessionId: string, data: SessionDisplayCacheData, options?: {
40
- ttlMs?: number;
41
- }): void;
42
- /**
43
- * Read previously-cached display data for a session, or `null` if nothing
44
- * is cached (or the TTL has elapsed).
45
- */
46
- declare function getSessionDisplayData(sessionId: string): SessionDisplayCacheData | null;
47
- /**
48
- * Drop any cached display data for a session. Call from the success page
49
- * after the payment completes; otherwise the TTL handles cleanup.
50
- */
51
- declare function clearSessionDisplayData(sessionId: string): void;
52
-
1
+ import type { AdvertisedPaymentMethod, CheckoutGateways, CheckoutSessionMode, CreateSessionIntentRequest, DetachedCheckoutSession, InlineSessionDraft, NormalizedCheckoutSession, ProcessPaymentParams, SessionIntent, SessionIntentDeclineRequest, TelemetryPaymentMethodCategory, TelemetryRequestCategory, VaultCaptureBlock } from '@flopay/shared';
2
+ import type { SessionDisplayCacheData } from './session-display-cache.js';
53
3
  /** Raw billing API response wrapper. */
54
4
  interface BillingResponse<T> {
55
5
  data: T;
@@ -142,12 +92,30 @@ interface RawCheckoutSession {
142
92
  testEventCode?: string | null;
143
93
  };
144
94
  }
95
+ /** Test helper: forget every reported failure, so suites that reuse a session id stay independent. */
96
+ export declare function forgetReportedFailuresForTest(): void;
97
+ /** Poll once immediately when the service omits an explicit retry hint. */
98
+ export declare const DEFAULT_PROCESSING_RETRY_AFTER_MS = 0;
99
+ /**
100
+ * How long a status or session read that is already in flight when a poll budget expires may
101
+ * still land. The budget bounds how long the SDK keeps asking; it must not discard an answer the
102
+ * billing API has already produced (TeamFloPay/sdk#393). On a slow mobile connection a single
103
+ * request can take most of the budget, so the grace matches the default budget. The hard cap of
104
+ * budget plus grace keeps a stalled request from outliving the poll.
105
+ */
106
+ export declare const STATUS_READ_GRACE_MS = 15000;
145
107
  type AccountSnapshotTelemetryMode = 'blocking' | 'best_effort';
146
- interface PaymentAPIOptions {
108
+ export interface PaymentAPIOptions {
147
109
  /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
148
110
  telemetry?: boolean;
149
111
  }
150
- declare const SESSION_CREATE_TELEMETRY: unique symbol;
112
+ interface PaymentApiTelemetryHooks {
113
+ now?: () => number;
114
+ onFirstByte?: (durationMs: number, attempt: number) => void;
115
+ onSessionCreateFailure?: (error: unknown) => void;
116
+ onRetry?: (requestCategory: TelemetryRequestCategory, attempt: number) => void;
117
+ }
118
+ export declare const SESSION_CREATE_TELEMETRY: unique symbol;
151
119
  /**
152
120
  * Client-side payment API service.
153
121
  *
@@ -155,7 +123,7 @@ declare const SESSION_CREATE_TELEMETRY: unique symbol;
155
123
  * `src/service/api.ts`. All methods call the billing API endpoints
156
124
  * that the checkout backend exposes.
157
125
  */
158
- declare class PaymentAPI {
126
+ export declare class PaymentAPI {
159
127
  private static readonly activeVaultCaptureRequests;
160
128
  private readonly baseUrl;
161
129
  private readonly directTelemetry?;
@@ -500,233 +468,6 @@ declare class PaymentAPI {
500
468
  */
501
469
  private mergeCachedDisplayData;
502
470
  }
503
-
504
- /** Browser operation hosted by the PCIVault card-capture adapter. */
505
- type CardCaptureOperation = 'checkout' | 'card_setup';
506
- /** Configuration for a {@link PciVaultCardCapture} instance. */
507
- interface PciVaultCardCaptureConfig {
508
- /** Checkout session id bound to the capture (for outcome correlation + trust). */
509
- sessionId?: string;
510
- /** Capture behavior of the checkout session, used to classify legacy outcomes safely. */
511
- captureMethod?: CaptureMethod;
512
- /** Distinguishes no-charge card verification telemetry from checkout payment telemetry. */
513
- operation?: CardCaptureOperation;
514
- /**
515
- * Default strict origin for vault `postMessage` outcomes. Overridden by
516
- * {@link CardCaptureMountOptions.expectedOrigin} when that is supplied at
517
- * mount. When neither is set the origin gate is skipped (the widget posts
518
- * same-window in the Model-A flow).
519
- */
520
- expectedOrigin?: string;
521
- /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
522
- telemetry?: boolean;
523
- /** Billing API base URL used by the standalone telemetry reporter. */
524
- billingApiUrl?: string;
525
- }
526
- /**
527
- * {@link CardCaptureAdapter} backed by the backend-rendered PCIVault hosted
528
- * widget.
529
- *
530
- * `mount()` injects the server-supplied widget HTML (re-executing its bundled
531
- * `<script>` so the form bootstraps) and subscribes to the widget's
532
- * `postMessage` outcome. The backend owns everything else; this adapter never
533
- * touches the card data, a payment intent, or 3DS.
534
- */
535
- declare class PciVaultCardCapture implements CardCaptureAdapter {
536
- readonly provider: CardCaptureProviderId;
537
- private readonly config;
538
- private telemetryReporter?;
539
- /** Reporter already initialized for this adapter's setup operation. */
540
- private setupTelemetryReporter?;
541
- private readonly ownsTelemetryReporter;
542
- private container;
543
- private messageHandler;
544
- /**
545
- * Parent-page-level overlay rendering the provider's verification challenge
546
- * (3DS-2 iframe) on `action_required`. Owned by the adapter — not the
547
- * widget — so it can sit above the host SDK's processing backdrop, which
548
- * would otherwise visually cover an in-widget challenge iframe.
549
- */
550
- private actionOverlay;
551
- /**
552
- * Listener that catches the `flopay-vault-3ds-return` postMessage from the
553
- * challenge return page. It is an overlay-dismissal accelerator only: the
554
- * terminal outcome is resolved server-side on `/vault/3ds/return` and
555
- * reaches the SDK through the widget's own `/status` poll. There is
556
- * deliberately no client-side completion bridge back into the widget
557
- * (TeamFloPay/backend#1674).
558
- */
559
- private threeDsReturnHandler;
560
- /**
561
- * Element that held focus when the challenge overlay opened, restored on
562
- * teardown. A keyboard or screen-reader buyer would otherwise be stranded on
563
- * the obscured page behind the modal once the challenge is gone.
564
- */
565
- private actionOverlayPreviousFocus;
566
- /** Bound on how long the challenge overlay may stay up (see above). */
567
- private actionOverlayTimer;
568
- /** Per-session integrity token to require on outcomes (from mount options). */
569
- private messageToken;
570
- /** Strict origin to require on outcomes, when configured. */
571
- private expectedOrigin;
572
- /**
573
- * Latest theme directive to push into the (cross-origin) widget: a theme
574
- * object, `null` for the explicit classic reset (the hosted asset restores
575
- * every historical neutral value), or `undefined` when the host has never
576
- * expressed one — nothing is posted then, so a freshly injected widget keeps
577
- * its own defaults.
578
- */
579
- private theme;
580
- /** Latest host submit-gate state to push into the widget (block its submit). */
581
- private submitGateBlocked;
582
- /** Latest card-field order + autofocus directive to push into the widget. */
583
- private cardFieldOrder;
584
- private cardAutoFocus;
585
- /**
586
- * Latest merchant submit wording: a label, `null` for the explicit reset to
587
- * the hosted session default, or `undefined` when the host has never set
588
- * one — nothing is posted then, so the widget keeps its own default.
589
- */
590
- private submitLabel;
591
- /** Monotonic start of the current widget mount-to-ready machine interval. */
592
- private mountStartedAt;
593
- private vaultReadyReported;
594
- /**
595
- * The mounted form sits behind the backend's production human check, so a
596
- * pre-submit `error` is the check's own state, not a vault load failure.
597
- */
598
- private verificationRequired;
599
- private submissionStarted;
600
- private submissionStartedAt;
601
- private readonly listeners;
602
- constructor(config?: PciVaultCardCaptureConfig);
603
- mount(container: HTMLElement, options: CardCaptureMountOptions): Promise<void>;
604
- private reportVaultLoadFailure;
605
- on(event: CardCaptureEventType, handler: (event: CardCaptureOutcomeEvent) => void): () => void;
606
- unmount(): void;
607
- /**
608
- * Inject the server-rendered widget HTML. `innerHTML` does not execute
609
- * embedded `<script>` tags, so each script node is replaced with a freshly
610
- * created element that the browser will load and run (this is what boots the
611
- * PCIVault form bundle against the `data-flopay-config` container).
612
- */
613
- private injectWidget;
614
- private attachMessageListener;
615
- /**
616
- * A pre-submit `error` from a form mounted behind the production human check
617
- * whose cause is the check's own buyer-facing state (see
618
- * {@link isVerificationStateCause}).
619
- */
620
- private isVerificationStateError;
621
- private reportOutcome;
622
- /**
623
- * Push merchant theme colors into the hosted widget (live). The host calls
624
- * this on a runtime theme switch; the widget applies them to its CSS variables
625
- * without a remount. Stores the latest theme so `ready` can re-push it.
626
- */
627
- applyTheme(theme: VaultCardThemeColors | null): void;
628
- /**
629
- * postMessage the current theme directive to the widget's (cross-origin)
630
- * document. `null` travels as-is: it is the merged hosted contract's explicit
631
- * reset, retained so a widget that (re)becomes ready replays it.
632
- */
633
- private postTheme;
634
- /**
635
- * Gate the widget's submit from the host. When `blocked`, the widget cancels
636
- * its next submit and emits `'blocked'` instead of `'submitting'` so the host
637
- * can validate merchant-DOM fields (AVS) first. Stored so `ready` re-pushes it.
638
- */
639
- setSubmitGate(blocked: boolean): void;
640
- /**
641
- * postMessage the current submit-gate state to the widget's document. If it
642
- * cannot be delivered, the host still validates and surfaces errors on its side.
643
- */
644
- private postSubmitGate;
645
- /**
646
- * Push the card-field order + autofocus directive into the widget (live). The
647
- * widget re-sequences its rows (DOM order, so tab order follows) and focuses
648
- * its first field unless `autoFocus` is false. Stored so `ready` re-pushes it.
649
- */
650
- setCardFieldOrder(order: VaultCardFieldKey[] | null, autoFocus: boolean): void;
651
- /** postMessage the current field order + autofocus to the widget's document. */
652
- private postCardFieldOrder;
653
- /**
654
- * Replace the hosted form's final submit wording (live, no remount). The
655
- * text is forwarded verbatim — the hosted form owns normalization and falls
656
- * back to its session default for blank or invalid text; `null` is the
657
- * explicit reset. Stored so `ready` re-pushes it.
658
- */
659
- setSubmitLabel(label: string | null): void;
660
- /**
661
- * postMessage the current submit-label directive to the widget's document.
662
- * Unlike the other host directives it carries merchant text, so it is sent
663
- * only with the session + message-token binding the hosted form checks, and
664
- * only to the vault block's exact origin — never to `'*'`.
665
- */
666
- private postSubmitLabel;
667
- /** The mounted widget's (cross-origin) document window, once its iframe exists. */
668
- private hostedWindow;
669
- /** postMessage a host directive to the widget's document once its iframe exists. */
670
- private postToHostedWindow;
671
- /**
672
- * `postMessage` target for the cosmetic host directives: the vault block's
673
- * exact origin when known. A widget mounted without `expectedOrigin` (e.g. an
674
- * opaque `srcdoc` form, which no origin can target) falls back to `'*'`.
675
- */
676
- private directiveTargetOrigin;
677
- private emit;
678
- /**
679
- * Render the provider-hosted verification challenge (e.g. Stripe 3DS-2) in a
680
- * full-page overlay at the PARENT page level. The widget's inline-iframe
681
- * approach is unusable because the SDK's processing backdrop sits above the
682
- * vault iframe, hiding any challenge mounted inside it — by lifting the
683
- * iframe to the host page the adapter can give it a z-index that wins.
684
- *
685
- * The overlay tears down on the next terminal outcome
686
- * (`complete`/`decline`/`error`) or when the buyer closes it via the backdrop
687
- * close button. Closing manually is a soft abandon — it emits the
688
- * non-terminal `challenge_dismissed` so the host can drop its processing
689
- * backdrop, while the widget keeps polling `/status` and still owns the
690
- * eventual outcome (an out-of-band approval can land after the challenge is
691
- * gone).
692
- */
693
- private showActionRequiredOverlay;
694
- /**
695
- * (Re)start the overlay bound. Deliberately longer than the widget's own
696
- * `/status` poll window so the widget's deterministic timeout lands first;
697
- * this only fires when nothing at all came back.
698
- */
699
- private armActionRequiredTimeout;
700
- /**
701
- * Report a challenge the buyer never finished. Both ways out of a challenge
702
- * without an outcome — closing the overlay, or never coming back at all —
703
- * are the same `customer_abandoned` terminal event.
704
- */
705
- private reportChallengeAbandoned;
706
- /**
707
- * Tear the challenge down and give the buyer a terminal, provider-neutral
708
- * error. Unlike a manual close, nothing is left to come back to, so this also
709
- * ends the attempt for the host.
710
- */
711
- private timeOutActionRequiredOverlay;
712
- /**
713
- * The buyer closed the challenge. Report it as abandoned and tell the host —
714
- * `challenge_dismissed` is deliberately NON-terminal: the widget is still
715
- * polling `/status` and a late `complete`/`decline`/`error` must still be
716
- * delivered. Without it the host's processing backdrop (raised on
717
- * `submitting`) would hold the buyer behind a modal for the rest of the
718
- * widget's authentication window.
719
- */
720
- private abandonActionRequiredOverlay;
721
- private hideActionRequiredOverlay;
722
- /**
723
- * Size the hosted-widget iframe to the height reported by the form inside it.
724
- * Cross-origin iframes don't auto-size to their content, so the widget posts
725
- * its measured height and we apply it here (clamped to a sane range). This is
726
- * what lets the card form shrink/grow to fit instead of sitting at a fixed
727
- * height.
728
- */
729
- private applyHeight;
730
- }
731
-
732
- export { type CardCaptureOperation as C, PaymentAPI as P, SESSION_CREATE_TELEMETRY as S, PciVaultCardCapture as a, type PciVaultCardCaptureConfig as b, type SessionDisplayCacheData as c, type SessionDisplayProduct as d, cacheSessionDisplayData as e, clearSessionDisplayData as f, getSessionDisplayData as g };
471
+ /** Create an internally observed API client without publishing hook options. */
472
+ export declare function createInstrumentedPaymentAPI(billingApiUrl: string, hooks: PaymentApiTelemetryHooks): PaymentAPI;
473
+ export {};
@@ -0,0 +1,231 @@
1
+ import type { CaptureMethod, CardCaptureAdapter, CardCaptureEventType, CardCaptureMountOptions, CardCaptureOutcomeEvent, CardCaptureProviderId, VaultCardFieldKey, VaultCardThemeColors } from '@flopay/shared';
2
+ import { TelemetryReporter } from './telemetry-reporter.js';
3
+ /** Browser operation hosted by the PCIVault card-capture adapter. */
4
+ export type CardCaptureOperation = 'checkout' | 'card_setup';
5
+ /** Configuration for a {@link PciVaultCardCapture} instance. */
6
+ export interface PciVaultCardCaptureConfig {
7
+ /** Checkout session id bound to the capture (for outcome correlation + trust). */
8
+ sessionId?: string;
9
+ /** Capture behavior of the checkout session, used to classify legacy outcomes safely. */
10
+ captureMethod?: CaptureMethod;
11
+ /** Distinguishes no-charge card verification telemetry from checkout payment telemetry. */
12
+ operation?: CardCaptureOperation;
13
+ /**
14
+ * Default strict origin for vault `postMessage` outcomes. Overridden by
15
+ * {@link CardCaptureMountOptions.expectedOrigin} when that is supplied at
16
+ * mount. When neither is set the origin gate is skipped (the widget posts
17
+ * same-window in the Model-A flow).
18
+ */
19
+ expectedOrigin?: string;
20
+ /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
21
+ telemetry?: boolean;
22
+ /** Billing API base URL used by the standalone telemetry reporter. */
23
+ billingApiUrl?: string;
24
+ }
25
+ /**
26
+ * {@link CardCaptureAdapter} backed by the backend-rendered PCIVault hosted
27
+ * widget.
28
+ *
29
+ * `mount()` injects the server-supplied widget HTML (re-executing its bundled
30
+ * `<script>` so the form bootstraps) and subscribes to the widget's
31
+ * `postMessage` outcome. The backend owns everything else; this adapter never
32
+ * touches the card data, a payment intent, or 3DS.
33
+ */
34
+ export declare class PciVaultCardCapture implements CardCaptureAdapter {
35
+ readonly provider: CardCaptureProviderId;
36
+ private readonly config;
37
+ private telemetryReporter?;
38
+ /** Reporter already initialized for this adapter's setup operation. */
39
+ private setupTelemetryReporter?;
40
+ private readonly ownsTelemetryReporter;
41
+ private container;
42
+ private messageHandler;
43
+ /**
44
+ * Parent-page-level overlay rendering the provider's verification challenge
45
+ * (3DS-2 iframe) on `action_required`. Owned by the adapter — not the
46
+ * widget — so it can sit above the host SDK's processing backdrop, which
47
+ * would otherwise visually cover an in-widget challenge iframe.
48
+ */
49
+ private actionOverlay;
50
+ /**
51
+ * Listener that catches the `flopay-vault-3ds-return` postMessage from the
52
+ * challenge return page. It is an overlay-dismissal accelerator only: the
53
+ * terminal outcome is resolved server-side on `/vault/3ds/return` and
54
+ * reaches the SDK through the widget's own `/status` poll. There is
55
+ * deliberately no client-side completion bridge back into the widget
56
+ * (TeamFloPay/backend#1674).
57
+ */
58
+ private threeDsReturnHandler;
59
+ /**
60
+ * Element that held focus when the challenge overlay opened, restored on
61
+ * teardown. A keyboard or screen-reader buyer would otherwise be stranded on
62
+ * the obscured page behind the modal once the challenge is gone.
63
+ */
64
+ private actionOverlayPreviousFocus;
65
+ /** Bound on how long the challenge overlay may stay up (see above). */
66
+ private actionOverlayTimer;
67
+ /** Per-session integrity token to require on outcomes (from mount options). */
68
+ private messageToken;
69
+ /** Strict origin to require on outcomes, when configured. */
70
+ private expectedOrigin;
71
+ /**
72
+ * Latest theme directive to push into the (cross-origin) widget: a theme
73
+ * object, `null` for the explicit classic reset (the hosted asset restores
74
+ * every historical neutral value), or `undefined` when the host has never
75
+ * expressed one — nothing is posted then, so a freshly injected widget keeps
76
+ * its own defaults.
77
+ */
78
+ private theme;
79
+ /** Latest host submit-gate state to push into the widget (block its submit). */
80
+ private submitGateBlocked;
81
+ /** Latest card-field order + autofocus directive to push into the widget. */
82
+ private cardFieldOrder;
83
+ private cardAutoFocus;
84
+ /**
85
+ * Latest merchant submit wording: a label, `null` for the explicit reset to
86
+ * the hosted session default, or `undefined` when the host has never set
87
+ * one — nothing is posted then, so the widget keeps its own default.
88
+ */
89
+ private submitLabel;
90
+ /** Monotonic start of the current widget mount-to-ready machine interval. */
91
+ private mountStartedAt;
92
+ private vaultReadyReported;
93
+ /**
94
+ * The mounted form sits behind the backend's production human check, so a
95
+ * pre-submit `error` is the check's own state, not a vault load failure.
96
+ */
97
+ private verificationRequired;
98
+ private submissionStarted;
99
+ private submissionStartedAt;
100
+ private readonly listeners;
101
+ constructor(config?: PciVaultCardCaptureConfig);
102
+ mount(container: HTMLElement, options: CardCaptureMountOptions): Promise<void>;
103
+ private reportVaultLoadFailure;
104
+ on(event: CardCaptureEventType, handler: (event: CardCaptureOutcomeEvent) => void): () => void;
105
+ unmount(): void;
106
+ /**
107
+ * Inject the server-rendered widget HTML. `innerHTML` does not execute
108
+ * embedded `<script>` tags, so each script node is replaced with a freshly
109
+ * created element that the browser will load and run (this is what boots the
110
+ * PCIVault form bundle against the `data-flopay-config` container).
111
+ */
112
+ private injectWidget;
113
+ private attachMessageListener;
114
+ /**
115
+ * A pre-submit `error` from a form mounted behind the production human check
116
+ * whose cause is the check's own buyer-facing state (see
117
+ * {@link isVerificationStateCause}).
118
+ */
119
+ private isVerificationStateError;
120
+ private reportOutcome;
121
+ /**
122
+ * Push merchant theme colors into the hosted widget (live). The host calls
123
+ * this on a runtime theme switch; the widget applies them to its CSS variables
124
+ * without a remount. Stores the latest theme so `ready` can re-push it.
125
+ */
126
+ applyTheme(theme: VaultCardThemeColors | null): void;
127
+ /**
128
+ * postMessage the current theme directive to the widget's (cross-origin)
129
+ * document. `null` travels as-is: it is the merged hosted contract's explicit
130
+ * reset, retained so a widget that (re)becomes ready replays it.
131
+ */
132
+ private postTheme;
133
+ /**
134
+ * Gate the widget's submit from the host. When `blocked`, the widget cancels
135
+ * its next submit and emits `'blocked'` instead of `'submitting'` so the host
136
+ * can validate merchant-DOM fields (AVS) first. Stored so `ready` re-pushes it.
137
+ */
138
+ setSubmitGate(blocked: boolean): void;
139
+ /**
140
+ * postMessage the current submit-gate state to the widget's document. If it
141
+ * cannot be delivered, the host still validates and surfaces errors on its side.
142
+ */
143
+ private postSubmitGate;
144
+ /**
145
+ * Push the card-field order + autofocus directive into the widget (live). The
146
+ * widget re-sequences its rows (DOM order, so tab order follows) and focuses
147
+ * its first field unless `autoFocus` is false. Stored so `ready` re-pushes it.
148
+ */
149
+ setCardFieldOrder(order: VaultCardFieldKey[] | null, autoFocus: boolean): void;
150
+ /** postMessage the current field order + autofocus to the widget's document. */
151
+ private postCardFieldOrder;
152
+ /**
153
+ * Replace the hosted form's final submit wording (live, no remount). The
154
+ * text is forwarded verbatim — the hosted form owns normalization and falls
155
+ * back to its session default for blank or invalid text; `null` is the
156
+ * explicit reset. Stored so `ready` re-pushes it.
157
+ */
158
+ setSubmitLabel(label: string | null): void;
159
+ /**
160
+ * postMessage the current submit-label directive to the widget's document.
161
+ * Unlike the other host directives it carries merchant text, so it is sent
162
+ * only with the session + message-token binding the hosted form checks, and
163
+ * only to the vault block's exact origin — never to `'*'`.
164
+ */
165
+ private postSubmitLabel;
166
+ /** The mounted widget's (cross-origin) document window, once its iframe exists. */
167
+ private hostedWindow;
168
+ /** postMessage a host directive to the widget's document once its iframe exists. */
169
+ private postToHostedWindow;
170
+ /**
171
+ * `postMessage` target for the cosmetic host directives: the vault block's
172
+ * exact origin when known. A widget mounted without `expectedOrigin` (e.g. an
173
+ * opaque `srcdoc` form, which no origin can target) falls back to `'*'`.
174
+ */
175
+ private directiveTargetOrigin;
176
+ private emit;
177
+ /**
178
+ * Render the provider-hosted verification challenge (e.g. Stripe 3DS-2) in a
179
+ * full-page overlay at the PARENT page level. The widget's inline-iframe
180
+ * approach is unusable because the SDK's processing backdrop sits above the
181
+ * vault iframe, hiding any challenge mounted inside it — by lifting the
182
+ * iframe to the host page the adapter can give it a z-index that wins.
183
+ *
184
+ * The overlay tears down on the next terminal outcome
185
+ * (`complete`/`decline`/`error`) or when the buyer closes it via the backdrop
186
+ * close button. Closing manually is a soft abandon — it emits the
187
+ * non-terminal `challenge_dismissed` so the host can drop its processing
188
+ * backdrop, while the widget keeps polling `/status` and still owns the
189
+ * eventual outcome (an out-of-band approval can land after the challenge is
190
+ * gone).
191
+ */
192
+ private showActionRequiredOverlay;
193
+ /**
194
+ * (Re)start the overlay bound. Deliberately longer than the widget's own
195
+ * `/status` poll window so the widget's deterministic timeout lands first;
196
+ * this only fires when nothing at all came back.
197
+ */
198
+ private armActionRequiredTimeout;
199
+ /**
200
+ * Report a challenge the buyer never finished. Both ways out of a challenge
201
+ * without an outcome — closing the overlay, or never coming back at all —
202
+ * are the same `customer_abandoned` terminal event.
203
+ */
204
+ private reportChallengeAbandoned;
205
+ /**
206
+ * Tear the challenge down and give the buyer a terminal, provider-neutral
207
+ * error. Unlike a manual close, nothing is left to come back to, so this also
208
+ * ends the attempt for the host.
209
+ */
210
+ private timeOutActionRequiredOverlay;
211
+ /**
212
+ * The buyer closed the challenge. Report it as abandoned and tell the host —
213
+ * `challenge_dismissed` is deliberately NON-terminal: the widget is still
214
+ * polling `/status` and a late `complete`/`decline`/`error` must still be
215
+ * delivered. Without it the host's processing backdrop (raised on
216
+ * `submitting`) would hold the buyer behind a modal for the rest of the
217
+ * widget's authentication window.
218
+ */
219
+ private abandonActionRequiredOverlay;
220
+ private hideActionRequiredOverlay;
221
+ /**
222
+ * Size the hosted-widget iframe to the height reported by the form inside it.
223
+ * Cross-origin iframes don't auto-size to their content, so the widget posts
224
+ * its measured height and we apply it here (clamped to a sane range). This is
225
+ * what lets the card form shrink/grow to fit instead of sitting at a fixed
226
+ * height.
227
+ */
228
+ private applyHeight;
229
+ }
230
+ /** Build the adapter with the existing SDK reporter without publishing injection. */
231
+ export declare function createInstrumentedPciVaultCardCapture(config: PciVaultCardCaptureConfig, reporter: TelemetryReporter): PciVaultCardCapture;