// Host-facing type definitions for the EXTRA SAFE Chat widget. // Ship this alongside widget.js for TypeScript hosts: // /// export type WidgetTheme = 'light' | 'dark' | 'auto'; export interface HostBrand { name: string; logoUrl?: string; accentColor?: string; theme?: WidgetTheme; } export interface MemberKyc { status: 'verified' | 'pending' | 'none'; label: string; } export interface Member { platformUserId: string; displayName: string; esid?: string; address?: string; avatarUrl?: string; kyc?: MemberKyc; } export interface TransferEvent { txHash: string; amount: string; token: string; network: string; from: string; to: string; reason: string; timestamp: number; counterpartyPlatformUserId?: string; /** Opaque host reference passed into startTransferTo({ reference }); echoed * back verbatim. Never shown to the user or written into the chat message. */ reference?: string; /** True when the transfer was simulated (sandbox wallet), not on-chain. */ sandbox?: boolean; } export interface HostUser { platformUserId: string; displayName?: string; } export interface ActivationInfo { platformUserId?: string; esid: string; address?: string; } export interface ConsentState { shareWithCounterparties: boolean; shareTransfersToLedger: boolean; } export interface WidgetState { mounted: boolean; activated: boolean; locked: boolean; open: boolean; address?: string; esid?: string; unread: number; consent: ConsentState; mode: 'demo' | 'live'; wallet: 'live' | 'sandbox'; version: string; } export interface TransferPrefill { amount?: string; token?: string; network?: string; reason?: string; reference?: string; } export interface IdentityProof { address: string; message: string; signature: string; } export interface Endpoints { serverUrl: string; grpcChatUrl: string; walletApiUrl: string; assetsApiUrl: string; } export interface HostConfig { host: string; brand: HostBrand; /** The signed-in host user; binds the wallet (key-store namespacing) and * pre-fills the activation nickname. */ user?: HostUser; members?: Member[]; onTransfer?: (e: TransferEvent) => void; onReady?: () => void; onActivate?: (id: ActivationInfo) => void; onError?: (err: Error) => void; mode?: 'demo' | 'live'; /** 'live' settles on-chain transfers; 'sandbox' simulates them. Defaults to * 'live' in live mode, 'sandbox' in demo mode. */ wallet?: 'live' | 'sandbox'; endpoints?: Partial; position?: 'bottom-right' | 'bottom-left'; /** Show the floating launcher button. Default true. Ignored with `container`. */ launcher?: boolean; /** Inline mount target: the panel fills this element (no launcher, no fixed * positioning); open()/close() become no-ops. */ container?: string | HTMLElement; /** CSP nonce applied to the injected