import { t as CardErrorCode } from "./connect-card-CZhzK_Tp.mjs"; import { t as TunnelXIFrameConnection } from "./connect-tunnel-x-BKtMfoGh.mjs"; //#region src/analytics/checkout-timing.d.ts /** * Tracks timing metrics throughout the checkout flow. * * Create one instance per checkout session and call the track methods * at appropriate points in the checkout flow. * * Usage: * const requestId = getOrCreateCheckoutRequestId(environment); * const tracker = new CheckoutTimingTracker(secureToken, requestId); * tracker.trackPageReady(); * // ... iframe loads ... * tracker.trackInputReady(); * // ... user submits ... * tracker.trackSubmit(); * // ... API response ... * tracker.trackSuccess(attemptId); */ declare class CheckoutTimingTracker { private static pageReadyTracked; private startTime; private checkoutSessionId; private requestId; private inputReadyTracked; constructor(checkoutSessionId: string, requestId: string); /** * Track when SDK is initialized and ready. * Call immediately after PaymentKit() initialization. * Only tracks once per page load (subsequent calls are no-ops). */ trackPageReady(): void; /** * Track when card input iframe is loaded and ready for input. * Should only be called once (for first iframe, typically card_pan). * Subsequent calls are no-ops. */ trackInputReady(): void; /** * Track when user clicks submit button. */ trackSubmit(): void; /** * Track successful checkout. * * @param checkoutAttemptId - The checkout attempt ID */ trackSuccess(checkoutAttemptId: string): void; /** * Track failed checkout. * * @param checkoutAttemptId - The checkout attempt ID (may be null if failed early) * @param errorCode - The error code from the checkout response * @param errorMessage - The customer-facing error message */ trackFail(checkoutAttemptId: string | null, errorCode: string | null, errorMessage: string | null): void; /** * Get elapsed time in milliseconds since tracker creation. */ private getElapsedMs; } //#endregion //#region src/types.d.ts type PaymentKitEnvironment = "local" | "tunnel" | "sandbox" | "staging" | "production"; type FormFieldNames = "customer_name" | "customer_email" | "customer_country" | "customer_zip_code" | "customer_business_name" | "customer_address_line1" | "customer_address_line2" | "customer_city" | "customer_state" | "customer_tax_ids" | "shipping_address_line1" | "shipping_address_line2" | "shipping_city" | "shipping_state" | "shipping_zip_code" | "shipping_country"; type FormErrorCodes = "required" | "invalid"; type TInternalFuncs = { submitPayment: (fields: Partial, options?: unknown) => Promise<{ data: { [key: string]: unknown; }; errors?: never; } | { data?: never; errors: PaymentKitErrors; }>; cleanup?: () => void; }; type PaymentKit = []>(options: { environment?: PaymentKitEnvironment; secureToken: string; paymentMethods: T; /** Card tokenization mode from checkout session */ cardTokenizationMode?: "direct" | "vgs"; /** VGS vault ID from checkout session */ vgsVaultId?: string; /** VGS environment from checkout session */ vgsEnvironment?: string; /** @internal Enable analytics test mode for e2e testing */ __enableAnalyticsTestMode?: boolean; }) => ExternalFuncsMapByPm & { submit: PaymentKitSubmitHandler; cleanup: () => void; }; type PaymentKitSubmitHandler[]> = >(options: { fields: Partial; paymentMethod: N; options?: unknown; onError: (error: PaymentKitErrors) => void; onSuccess: (data: { [key: string]: unknown; }) => void; }) => void; type PaymentKitStates = { baseUrl: string; apiBaseUrl: string; secureToken: string; environment: PaymentKitEnvironment; tunnelXConnection: TunnelXIFrameConnection; timingTracker: CheckoutTimingTracker; /** Checkout request ID for correlating all API calls and analytics events */ checkoutRequestId: string; /** Card tokenization mode: 'direct' (KMS) or 'vgs' (VGS Collect + proxy) */ cardTokenizationMode?: "direct" | "vgs"; /** VGS vault ID (only when cardTokenizationMode is 'vgs') */ vgsVaultId?: string; /** VGS environment: 'sandbox' or 'live' (only when cardTokenizationMode is 'vgs') */ vgsEnvironment?: string; /** @internal Promise that resolves when session config (incl. VGS mode) is auto-detected */ _sessionConfigReady?: Promise; }; type PaymentKitErrors = { root?: string; card_pan?: CardErrorCode; card_exp?: CardErrorCode; card_cvc?: CardErrorCode; paypal?: string; google_pay?: string; apple_pay?: string; processor_id?: string; amount?: string; currency?: string; country?: string; } & { [key in FormFieldNames]?: FormErrorCodes | string }; type PaymentKitFields = { [key in FormFieldNames]: string }; type PaymentMethod = (paymentKitStates: PaymentKitStates) => { name: TName; externalFuncs: TExternalFuncs; internalFuncs: TInternalFuncs; }; type ExternalFuncsMapByPm[]> = { [K in T[number] as ReturnType["name"]]: ReturnType["externalFuncs"] }; //#endregion export { PaymentMethod as i, PaymentKitEnvironment as n, PaymentKitFields as r, PaymentKit as t }; //# sourceMappingURL=types-Cjcc3xak.d.mts.map