import type { ApiClient } from '../api/client.js'; import type { ConsoleErrorCollector } from '../context/console.js'; import type { BreadcrumbCollector } from '../context/breadcrumbs.js'; import type { ShadowContainer } from './shadow.js'; import type { RecordingResult } from './recording-manager.js'; import type { WidgetBrandColors } from './brand-colors.js'; import type { getMessages } from '../i18n/index.js'; import type { MakeThisBetterConfig, Annotation, SubmissionSessionResponse, FeedbackResponse } from '../types.js'; export declare const IDLE_CAPTURE_MS = 900; export declare const SCREENSHOT_WAIT_MS = 5000; /** * Mode/UI transitions the lifecycle needs from its owner. The controller owns * mode and the launcher tab; the lifecycle only reports when a submission * outcome forces a transition, so "which UI is on screen" stays decided in one * place. */ export interface SubmissionLifecycleHost { /** True once the conversation has transitioned to its final receipt state. */ isBackground(): boolean; /** Replace the current conversation receipt with its retryable failure state. */ onFinalizeFailure(onRetry?: () => void): void; /** Return to the background-finalizing state ahead of a retry. */ onReenterBackground(): void; /** A finalize completed: hand off the feedback and show success. */ onFinalized(feedback: FeedbackResponse, submission: SubmissionSessionResponse): void; } /** * Everything the submission pipeline reads from the widget. Getters where the * value can change after construction (locale swaps messages; shadow only * exists once startup succeeded). */ export interface SubmissionLifecycleDeps { apiClient: ApiClient; consoleCollector: ConsoleErrorCollector; breadcrumbCollector: BreadcrumbCollector; brandColors: WidgetBrandColors | undefined; shadow: () => ShadowContainer; messages: () => ReturnType; user: () => MakeThisBetterConfig['user']; } /** * The submission concurrency state machine: attempt versioning, stale-request * abandonment, the foreground/background finalize dual path, and the failure * card's retry loop. Extracted so the controller's mode/UI orchestration and * this bookkeeping cannot silently interleave. */ export declare class SubmissionLifecycle { private deps; private host; private activeSubmission; private pendingSubmissionRequest; private submissionAttempt; private pendingScreenshotTask; private screenshotAbortController; private pendingBaseCapture; private idleCaptureTimer; private screenshotSession; private screenshotSessionReady; private resolveScreenshotSessionReady; private screenshotEnabled; constructor(deps: SubmissionLifecycleDeps, host: SubmissionLifecycleHost); /** * What the note surface must render. Reading it back rather than assuming * the default is what keeps the checkbox from claiming a screenshot is * attached while this object has already been told otherwise — the popup is * remounted mid-session (record mode returns through it), so "freshly opened" * does not imply "freshly consented". */ isScreenshotEnabled(): boolean; /** * Back to the default for a fresh report. Unlike setScreenshotEnabled(true) * this starts no capture: the widget is idle at both call sites, and * rasterizing a page nobody is annotating would be work done for a report * that may never be written. */ resetScreenshotConsent(): void; /** * Consent, as reported by the note surface's checkbox. * * Turning it off prevents capture at submit. Turning it back on warms the * lazy screenshot dependency while the reporter is still composing. */ setScreenshotEnabled(enabled: boolean): void; warmScreenshotDeps(): void; beginBaseCapture(): void; private clearIdleCaptureTimer; private ensureScreenshotSessionReady; start(description: string, annotation: Annotation | null, recording: RecordingResult | undefined): Promise; private createSubmission; finalize(): Promise; private waitForScreenshot; private showFinalizeFailure; private retryBackgroundFinalization; /** * Invalidate every in-flight attempt and abandon what already reached the * server. Both exit and destroy route through here. */ abandon(): void; } //# sourceMappingURL=submission-lifecycle.d.ts.map