import { ChromeExtensionRecordingModes } from '@loomhq/sdk-store'; export { CHROME_EXTENSION_RECORDING_MODES, ChromeExtensionRecordingModes } from '@loomhq/sdk-store'; declare enum SDKUnsupportedReasons { IncompatibleBrowser = "incompatible-browser", ThirdPartyCookiesDisabled = "third-party-cookies-disabled", NoMediaStreamsSupport = "no-media-streams-support" } declare enum Environment { Development = "development", Testbench = "testbench", Staging = "staging", Production = "production" } declare enum RecordingType { ScreenAndCamera = "screen_cam", ScreenOnly = "screen", CameraOnly = "cam" } interface SDKStyles { /** * Font family to be used instead of loom defaults. This is 1:1 with `font-family`. */ fontFamily: string; /** * Base font unit size used to calculate the font size for the text. */ fontUnitSize: string; /** * Collection of record button color options */ recordButtonColor: string; recordButtonHoverColor: string; recordButtonActiveColor: string; /** * Collection of primary color overrides */ primaryColor: string; primaryHoverColor: string; primaryActiveColor: string; } type ExperimentalFeatures = { teamType?: string; jiraIssueType?: string; }; interface WholeConfig { allowedRecordingTypes: [RecordingType, ...RecordingType[]]; bubbleResizable: boolean; /** * The default selection for recording type. If `allowedRecordingTypes` is specified, should * include this default type in the list. If unspecified, defaults to Screen and Camera */ defaultRecordingType: RecordingType; /** Whether to disable the desktop cascading recorders option on Firefox * We only really want to do this on loom.com on Firefox * where the SDK is available */ disableDesktopOnFirefox?: boolean; disablePreviewModal: boolean; enableOnboardingTutorial: boolean; enablePictureInPicture: boolean; insertButtonText: string; /** * From which product the SDK is firing from (ex: Confluence, Jira) */ productName?: string; /** * The entrypoint within the product from which the SDK fires */ entryPointName?: string; /** * Collection of styles that can be applied to the loom components. */ styles: Partial; experimentalFeatures?: ExperimentalFeatures; } type SDKConfig = Partial; declare enum SDKState { Closed = "closed", PreRecording = "pre-recording", ActiveRecording = "active-recording", PostRecording = "post-recording", Cascaded = "cascaded" } declare enum IntelligenceAvailableStatusType { Auto = "AUTO", Invalid = "INVALID", Pending = "PENDING", Unknown = "UNKNOWN", User = "USER", Failed = "FAILED" } declare enum AutoChapterStatusesType { Failure = "failure", InProgress = "in_progress", NotStarted = "not_started", Success = "success", Unsupported = "unsupported" } interface LoomVideo { id: string; title: string; height: number; width: number; sharedUrl: string; embedUrl: string; thumbnailHeight?: number; thumbnailWidth?: number; thumbnailUrl?: string; duration?: number; providerUrl: string; autoTitleStatus?: IntelligenceAvailableStatusType; autoDescriptionStatus?: IntelligenceAvailableStatusType; description?: string; autoChaptersStatus?: AutoChapterStatusesType; autoChaptersCount?: number; } /** * Types pull eventemitter3 to avoid bundling types from that package. */ type ValidEventTypes = string | symbol | any; type EventNames = T extends string | symbol ? T : keyof T; type ArgumentMap = { [K in keyof T]: T[K] extends (...args: any[]) => void ? Parameters : T[K] extends any[] ? T[K] : any[]; }; type EventListener> = T extends string | symbol ? (...args: any[]) => void : (...args: ArgumentMap>[Extract]) => void; 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; } 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 { 'bubble-drag-end': (pos: Position) => void; 'bubble-drag-start': (pos: Position) => void; 'bubble-move': (pos: Position) => void; cancel: () => void; complete: () => void; 'insert-click': (video: LoomVideo) => void; 'lifecycle-update': (state: SDKState) => void; 'recording-complete': (video: LoomVideo) => void; 'recording-start': () => void; start: () => void; 'upload-complete': (video: LoomVideo) => void; } /** * Options for opening the pre-record panel. */ interface OpenPreRecordPanelOptions { /** * The recording mode to attempt to open the chrome extension in. * @example 'BUG_REPORT' */ chromeExtensionRecordingMode?: ChromeExtensionRecordingModes; } /** * Public definition for the SDK Button. */ interface SDKButtonInterface extends EventEmitter { /** * Opens the recording panel to start a user's record flow. * @param options Optional configuration for opening the panel */ openPreRecordPanel: (options?: OpenPreRecordPanelOptions) => 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; } interface StandardSDK { mode: 'standard'; publicAppId: string; environment?: Environment; config?: SDKConfig; } interface CustomSDK { mode: 'custom'; jws: string; environment?: Environment; config?: SDKConfig; } interface FirstPartyMode { config?: SDKConfig; environment?: Environment; jws: string; mode: 'first-party'; publicAppId: string; siteId: string; } type ButtonFn = (a?: { element?: HTMLElement; hooks?: Hooks; }) => SDKButtonInterface; type SDKResult = { teardown: () => void; configureButton: ButtonFn; updateConfig: ({ config }: { config: SDKConfig; }) => void; status: () => { state: SDKState | undefined; success: boolean; }; }; type SetupArgs = StandardSDK | CustomSDK | FirstPartyMode; type SetupFunction = (a: SetupArgs) => Promise; interface LegacySetupArgs { publicAppId?: string; jws?: string; environment?: Environment; config?: SDKConfig; } type LegacySetup = (a: LegacySetupArgs) => Promise; declare const setup: LegacySetup; declare const createInstance: SetupFunction; export { Environment, RecordingType, SDKState, SDKUnsupportedReasons, createInstance, setup }; export type { Hooks, LegacySetup, LegacySetupArgs, LoomVideo, OpenPreRecordPanelOptions, SDKButtonInterface, SDKConfig, SDKResult, SetupArgs, SetupFunction };