declare type IsSupportedFunction = () => Promise<{ supported: boolean; error: SDKUnsupportedReasons | undefined; }>; declare enum SDKUnsupportedReasons { IncompatibleBrowser = "incompatible-browser", ThirdPartyCookiesDisabled = "third-party-cookies-disabled", NoMediaStreamsSupport = "no-media-streams-support" } /** * Check if the client being initialized is compatible with loom features. * @returns Support information */ declare const isSupported: IsSupportedFunction; declare enum Environment { Development = "development", Testbench = "testbench", Staging = "staging", Production = "production" } interface SDKConfig { bubbleResizable: boolean; insertButtonText: string; disablePreviewModal?: boolean; enableOnboardingTutorial?: boolean; } declare enum SDKState { Closed = "closed", PreRecording = "pre-recording", ActiveRecording = "active-recording", PostRecording = "post-recording" } interface LoomVideo { id: string; title: string; height: number; width: number; sharedUrl: string; embedUrl: string; thumbnailHeight?: number; thumbnailWidth?: number; thumbnailUrl?: string; duration?: number; providerUrl: string; } /** * Types pull eventemitter3 to avoid bundling types from that package. */ declare type ValidEventTypes = string | symbol | any; declare type EventNames = T extends string | symbol ? T : keyof T; declare type ArgumentMap = { [K in keyof T]: T[K] extends (...args: any[]) => void ? Parameters : T[K] extends any[] ? T[K] : any[]; }; declare type EventListener> = T extends string | symbol ? (...args: any[]) => void : (...args: ArgumentMap>[Extract]) => void; declare type EventArgs> = Parameters>; interface EventEmitter { eventNames(): Array>; listeners>(event: T): Array>; listenerCount(event: EventNames): number; emit>(event: T, ...args: EventArgs): boolean; on>(event: T, fn: EventListener, context?: Context): this; addListener>(event: T, fn: EventListener, context?: Context): this; once>(event: T, fn: EventListener, context?: Context): this; removeListener>(event: T, fn?: EventListener, context?: Context, once?: boolean): this; off>(event: T, fn?: EventListener, context?: Context, once?: boolean): this; removeAllListeners(event?: EventNames): this; } declare type HookFn = (a: T) => void; interface Hooks { onInsertClicked: HookFn; onStart?: HookFn; onRecordingStarted?: HookFn; onCancel?: HookFn; onComplete?: HookFn; onAnalyticsEvent?: HookFn; onLifecycleUpdate?: HookFn; onRecordingComplete: HookFn; onUploadComplete: HookFn; } interface Position { x: number; y: number; } interface ButtonEmitterEvents { 'insert-click': (video: LoomVideo) => void; start: () => void; 'recording-start': () => void; cancel: () => void; complete: () => void; 'recording-complete': (video: LoomVideo) => void; 'upload-complete': (video: LoomVideo) => void; 'lifecycle-update': (state: SDKState) => void; 'bubble-move': (pos: Position) => void; 'bubble-drag-start': (pos: Position) => void; 'bubble-drag-end': (pos: Position) => void; } /** * Public definition for the SDK Button. */ interface SDKButtonInterface extends EventEmitter { /** * Opens the recording panel to start a user's record flow. */ openPreRecordPanel: () => void; /** * Closes the recording panel. */ closePreRecordPanel: () => void; /** * Move the recording bubble. * @param pos New position where the bubble will be moved to. This value is pixels relative * to the bubble's iframe container. */ moveBubble: (p: Position) => void; /** * End a recording in progress */ endRecording: () => void; } declare type ButtonFn = (a?: { element?: HTMLElement; hooks?: Hooks; }) => SDKButtonInterface; declare type SDKResult = { teardown: () => void; configureButton: ButtonFn; status: () => { state: SDKState | undefined; success: boolean; }; }; declare type SetupFunction = (a: { /** * @deprecated `apiKey` has been renamed to `publicAppId`, please use that instead */ apiKey?: string; publicAppId?: string; environment?: Environment; config?: Partial; jws?: string; }) => Promise; declare const setup: SetupFunction; export { Hooks, LoomVideo, SDKButtonInterface, SDKResult, SDKState, SDKUnsupportedReasons, SetupFunction, isSupported, setup };