import { PrimitiveState } from '../utils/PrimitiveState'; import { ApiCaller } from '../api/api-caller'; import { WidgetConfig } from '../types/widget-config'; import { Dto } from '../api/client'; import { StorageCtx } from './storage.ctx'; type ContactState = { contact: { token: string; externalId: string | undefined; } | null; extraCollectedData: Record | undefined; isCreatingUnverifiedContact: boolean; isErrorCreatingUnverifiedContact: boolean; }; export declare class ContactCtx { private config; private storageCtx?; private api; state: PrimitiveState; constructor({ config, api, storageCtx, }: { api: ApiCaller; config: WidgetConfig; storageCtx?: StorageCtx; }); shouldCollectData: () => boolean; private autoCreateUnverifiedUserIfNotExists; createUnverifiedContact: (payload: Dto["CreateUnverifiedContactDto"], extraCollectedData?: Record) => Promise; /** * A persisted contact token can go stale — it no longer resolves to a * contact and the backend answers 401 "Invalid token". Drop the dead token, * clear auth, and mint a fresh anonymous contact so the widget self-heals * instead of getting stuck on create-session. No-op for a config-provided * verified token (authoritative — re-minting it is not ours to do). * Returns true if a fresh contact token was obtained. */ recoverFromStaleToken: () => Promise; setUnverifiedContact: (token: string) => Promise; } export {}; //# sourceMappingURL=contact.ctx.d.ts.map