import * as iframePhone from 'iframe-phone'; interface IEventListener { type: string; listener: (evt: Event) => void; } declare type IEventListeners = IEventListener | IEventListener[]; interface IPortalClaims { class_hash: string; offering_id: number; platform_id: string; platform_user_id: number; user_id: string; user_type: "learner" | "teacher"; } interface IJwtClaims { alg: string; aud: string; class_info_url: string; domain: string; domain_uid: number; exp: number; externalId: number; iat: number; iss: string; logging: boolean; returnUrl: string; sub: string; uid: string; claims: IPortalClaims; } interface IJwtResponse { token: string; claims: IJwtClaims; } interface IAttachmentInfo { contentType?: string; } declare type AttachmentInfoMap = Record; interface IInteractiveStateProps { interactiveState: InteractiveState | null; hasLinkedInteractive?: boolean; linkedState?: object; allLinkedStates?: IInteractiveStateProps[]; createdAt?: string; updatedAt?: string; interactiveStateUrl?: string; interactive: { id?: string; name?: string; }; pageNumber?: number; pageName?: string; activityName?: string; externalReportUrl?: string; attachments?: AttachmentInfoMap; } interface IHostFeatureSupport extends Record { version: string; } interface IHostModalSupport extends IHostFeatureSupport { dialog?: boolean; lightbox?: boolean; alert?: boolean; } interface IHostFeatures extends Record { modal?: IHostModalSupport; getFirebaseJwt?: IHostFeatureSupport; domain?: string; } interface IAccessibilitySettings { fontSize: string; fontSizeInPx: number; fontType: string; fontFamilyForType: string; } interface IRuntimeInitInteractive extends IInteractiveStateProps { version: 1; error: any; mode: "runtime"; hostFeatures: IHostFeatures; authoredState: AuthoredState | null; globalInteractiveState: GlobalInteractiveState | null; interactiveStateUrl: string; runRemoteEndpoint?: string; collaboratorUrls: string[] | null; classInfoUrl: string; interactive: { id: string; name: string; }; authInfo: { provider: string; loggedIn: boolean; email: string; }; linkedInteractives: ILinkedInteractive[]; themeInfo: IThemeInfo; attachments?: AttachmentInfoMap; accessibility: IAccessibilitySettings; mediaLibrary: IMediaLibrary; objectStorageConfig: IOpaqueObjectStorageConfig; } interface IThemeInfo { colors: { colorA: string; colorB: string; }; } declare type InteractiveItemId = string; interface ILinkedInteractive { id: InteractiveItemId; label: string; } interface IAuthoringInitInteractive { version: 1; error: null; mode: "authoring"; hostFeatures: IHostFeatures; authoredState: AuthoredState | null; themeInfo: IThemeInfo; interactiveItemId: string; linkedInteractives?: ILinkedInteractive[]; } interface IReportInitInteractive { version: 1; mode: "report"; view?: "standalone"; hostFeatures: IHostFeatures; authoredState: AuthoredState; interactiveState: InteractiveState; themeInfo: IThemeInfo; attachments?: AttachmentInfoMap; linkedInteractives: ILinkedInteractive[]; objectStorageConfig: IOpaqueObjectStorageConfig; } interface IReportItemInitInteractive { version: 1; mode: "reportItem"; hostFeatures: IHostFeatures; interactiveItemId: string; view: "singleAnswer" | "multipleAnswer" | "hidden"; users: Record; attachments?: AttachmentInfoMap; objectStorageConfig: IOpaqueObjectStorageConfig; } declare type IInitInteractive = IRuntimeInitInteractive | IAuthoringInitInteractive | IReportInitInteractive | IReportItemInitInteractive; declare type InitInteractiveMode = "runtime" | "authoring" | "report" | "reportItem"; interface ICustomReportFieldsAuthoredStateField { key: string; columnHeader: string; } interface ICustomReportFieldsAuthoredState { customReportFields: { version: 1; fields: ICustomReportFieldsAuthoredStateField[]; }; } interface ICustomReportFieldsInteractiveState { customReportFields: { version: 1; values: { [key: string]: any; }; }; } declare type IRuntimeClientMessage = "interactiveState" | "height" | "hint" | "getAttachmentUrl" | "getAuthInfo" | "supportedFeatures" | "navigation" | "getFirebaseJWT" | "authoredState" | "authoringCustomReportFields" | "runtimeCustomReportValues" | "showModal" | "closeModal" | "getLibraryInteractiveList" | "getInteractiveSnapshot" | "addLinkedInteractiveStateListener" | "removeLinkedInteractiveStateListener" | "decoratedContentEvent" | "setDirtyState" | "customMessage" | "createChannel" | "publish" | "subscribe" | "unsubscribe" | "createJob" | "cancelJob" | "focusExit"; declare type IRuntimeServerMessage = "attachmentUrl" | "authInfo" | "getInteractiveState" | "initInteractive" | "firebaseJWT" | "closedModal" | "customMessage" | "libraryInteractiveList" | "interactiveSnapshot" | "contextMembership" | "linkedInteractiveState" | "decorateContent" | "pubSubMessage" | "pubSubChannelInfo" | "jobCreated" | "jobInfo" | "focusEnter"; declare type IAuthoringClientMessage = "getInteractiveList" | "setLinkedInteractives" | "getFirebaseJWT"; declare type IAuthoringServerMessage = "interactiveList" | "firebaseJWT"; declare type IReportItemClientMessage = "reportItemAnswer" | "reportItemClientReady"; declare type IReportItemServerMessage = "getReportItemAnswer"; declare type GlobalIFrameSaverClientMessage = "interactiveStateGlobal"; declare type GlobalIFrameSaverServerMessage = "loadInteractiveGlobal"; declare type LoggerClientMessage = "log"; declare type IframePhoneServerMessage = "hello"; declare type DeprecatedRuntimeClientMessage = "setLearnerUrl"; declare type DeprecatedRuntimeServerMessage = "getLearnerUrl" | "loadInteractive"; declare type ClientMessage = DeprecatedRuntimeClientMessage | IRuntimeClientMessage | IAuthoringClientMessage | GlobalIFrameSaverClientMessage | LoggerClientMessage | IReportItemClientMessage; declare type ServerMessage = IframePhoneServerMessage | DeprecatedRuntimeServerMessage | IRuntimeServerMessage | IAuthoringServerMessage | GlobalIFrameSaverServerMessage | IReportItemServerMessage; interface IContextMember { userId: string; firstName: string; lastName: string; } interface IContextMembership { members: IContextMember[]; } declare type ICustomMessageOptions = Record; declare type ICustomMessagesHandledMap = Record; declare type FocusEnterMode = "forward" | "reverse" | "restore"; declare type FocusExitMode = "forward" | "reverse" | "escape"; interface IFocusEnterMessage { mode: FocusEnterMode; } interface IFocusExitMessage { mode: FocusExitMode; } interface ISupportedFeatures { aspectRatio?: number; authoredState?: boolean; interactiveState?: boolean; customMessages?: { handles?: ICustomMessagesHandledMap; }; focusProtocol?: boolean; } interface ISupportedFeaturesRequest { apiVersion: 1; features: ISupportedFeatures; } interface INavigationOptions { enableForwardNav?: boolean; message?: string; } interface IHintRequest { text: string | null; } interface IAuthoringCustomReportField { id: string; columnHeading: string; } interface IAuthoringCustomReportFields { fields: IAuthoringCustomReportField[]; } interface IRuntimeCustomReportValues { values: { [key: string]: any; }; } interface IBaseShowModal { uuid?: string; } declare type ModalType = "alert" | "lightbox" | "dialog"; interface IShowAlert extends IBaseShowModal { type: "alert"; style: "correct" | "incorrect" | "info"; title?: string; text?: string; } interface IShowLightbox extends IBaseShowModal { type: "lightbox"; url: string; title?: string; isImage?: boolean; size?: { width: number; height: number; }; allowUpscale?: boolean; } interface IShowDialog extends IBaseShowModal { type: "dialog"; url: string; notCloseable?: boolean; } declare type IShowModal = IShowAlert | IShowLightbox | IShowDialog; interface ICloseModal { uuid?: string; } interface IDecoratedContentEvent { type: string; text: string; bounds?: DOMRect; } interface ITextDecorationBaseInfo { words: string[]; replace: string; wordClass: string; } interface ITextDecorationInfo extends ITextDecorationBaseInfo { listenerTypes: Array<{ type: string; }>; } interface ITextDecorationHandlerInfo extends ITextDecorationBaseInfo { eventListeners: IEventListeners; } declare type ITextDecorationHandler = (message: ITextDecorationHandlerInfo) => void; interface ICustomMessage { type: string; content: Record; } declare type ICustomMessageHandler = (message: ICustomMessage) => void; interface ISetLinkedInteractives { linkedInteractives?: ILinkedInteractive[]; linkedState?: InteractiveItemId; } interface ISetDirtyStateRequest { isDirty: boolean; } interface IBaseRequestResponse { requestId: number; } interface IAuthInfo { provider: string; loggedIn: boolean; email?: string; } interface IAttachmentUrlRequest extends IBaseRequestResponse { name: string; operation: "read" | "write"; interactiveId?: string; contentType?: string; expiresIn?: number; platformUserId?: string; } interface IWriteAttachmentRequest extends IAttachmentUrlRequest { content: any; options?: RequestInit; } interface IAttachmentUrlResponse extends IBaseRequestResponse { url?: string; error?: string; } declare type ReadAttachmentParams = Omit; declare type WriteAttachmentParams = Omit; declare type GetAttachmentUrlParams = Omit; interface IGetAuthInfoRequest extends IBaseRequestResponse { } interface IGetAuthInfoResponse extends IBaseRequestResponse, IAuthInfo { } interface IGetFirebaseJwtRequest extends IBaseRequestResponse { firebase_app: string; } interface IGetFirebaseJwtResponse extends IBaseRequestResponse { response_type?: "ERROR"; message?: string; token?: string; } interface IGetInteractiveListOptions { scope: "page"; supportsSnapshots?: boolean; } interface IGetInteractiveListRequest extends IBaseRequestResponse, IGetInteractiveListOptions { } interface IInteractiveListResponseItem { id: InteractiveItemId; pageId: number; name: string; section: "header_block" | "assessment_block" | "interactive_box"; url: string; thumbnailUrl: string | null; supportsSnapshots: boolean; } interface IGetInteractiveListResponse extends IBaseRequestResponse { interactives: IInteractiveListResponseItem[]; } interface IGetLibraryInteractiveListOptions { } interface IGetLibraryInteractiveListRequest extends IBaseRequestResponse, IGetLibraryInteractiveListOptions { } interface ILibraryInteractiveListResponseItem { id: string; name: string; description: string; thumbnailUrl: string; } interface IGetLibraryInteractiveListResponse extends IBaseRequestResponse { libraryInteractives: ILibraryInteractiveListResponseItem[]; } interface IGetInteractiveSnapshotOptions { interactiveItemId: InteractiveItemId; } interface IGetInteractiveSnapshotRequest extends IBaseRequestResponse, IGetInteractiveSnapshotOptions { } interface IGetInteractiveSnapshotResponse extends IBaseRequestResponse { success: boolean; snapshotUrl?: string; } interface IAddLinkedInteractiveStateListenerOptions { interactiveItemId: InteractiveItemId; } interface IAddLinkedInteractiveStateListenerRequest extends IAddLinkedInteractiveStateListenerOptions { listenerId: string; } interface IRemoveLinkedInteractiveStateListenerRequest { listenerId: string; } interface ILinkedInteractiveStateResponse { listenerId: string; interactiveState: LinkedInteractiveState | undefined; } declare type ReportItemsType = "fullAnswer" | "compactAnswer"; interface IGetReportItemAnswer extends IBaseRequestResponse { version: "2.1.0"; platformUserId: string; interactiveState: InteractiveState; authoredState: AuthoredState; itemsType: ReportItemsType; } interface IReportItemAnswerItemAttachment { type: "attachment"; name: string; label?: string; } interface IReportItemAnswerItemAnswerText { type: "answerText"; } interface IReportItemAnswerItemHtml { type: "html"; html: string; } interface IReportItemAnswerItemLinks { type: "links"; hideViewInline?: boolean; hideViewInNewTab?: boolean; } interface IReportItemAnswerItemScore { type: "score"; score: number; maxScore: number; } declare type IReportItemAnswerItem = IReportItemAnswerItemAttachment | IReportItemAnswerItemAnswerText | IReportItemAnswerItemHtml | IReportItemAnswerItemLinks | IReportItemAnswerItemScore; interface IReportItemAnswer extends IBaseRequestResponse { version: "2.1.0"; platformUserId: string; items: IReportItemAnswerItem[]; /** * When not provided, host should assume that itemsType is equal to "fullAnswer" (to maintain backward compatibility * with version 2.0.0). */ itemsType?: ReportItemsType; } declare type IGetReportItemAnswerHandler = (message: IGetReportItemAnswer) => void; interface IReportItemHandlerMetadata { /** * When compactAnswerReportItems is present and equal to true, report will try to get report items related to compact * answer (small icons visible in the dashboard grid view). An example of compact answer report item is "score" * used by ScoreBOT question. */ compactAnswerReportItemsAvailable?: boolean; } /** * Interface that can be used by interactives to export and consume datasets. For example: * - Vortex interactive is exporting its dataset in the interactive state * - Graph interactive (part of the question-interactives) can observe Vortex interactive state * (via linked interactive state observing API) and render dataset columns as bar graphs. */ interface IDataset { type: "dataset"; version: 1; properties: string[]; rows: Array>; xAxisProp?: string; } /** * Dataset should be saved as a part of the interactive state. Example: * Vortex interactive state implements this interface, graph interactive uses it to make assumptions about Vortex * interactive state. */ interface IInteractiveStateWithDataset { dataset?: IDataset | null; } interface IGetInteractiveState { unloading?: boolean; } declare type OnUnloadFunction = (options: IGetInteractiveState) => Promise; /** * Type of the exported media library items found in the activity or sequence. Initially this will just * be "image" but could be extended in the future to "video" or "audio". The exact mime type would be * preferable but that is not always detectable from the exported media library urls. */ declare type IMediaLibraryItemType = "image"; /** * Interface for the exported media library items found in the activity or sequence. */ interface IMediaLibraryItem { url: string; type: IMediaLibraryItemType; caption?: string; } /** * Interface for the media library. */ interface IMediaLibrary { enabled: boolean; items: IMediaLibraryItem[]; } /** * Configuration for object store - this is "opaque" as it is not intended to be inspected or modified by the consumer * but instead passed through to the object store implementation defined in @concord-consortium/object-storage. * * The QI demo system returns a demo configuration which is uses to store objects in memory only for the duration of * the session. * * AP returns a configuration which allows storage and retrieval of objects via Firebase. * The @concord-consortium/object-storage package implements both the in-memory and Firebase backends. */ declare type IOpaqueObjectStorageConfig = Record; interface IPubSubCreateChannel { channelId: string; channelInfo: any; timestamp: number; } interface IPubSubPublish { channelId: string; message: any; timestamp: number; } interface IPubSubSubscribe { channelId: string; subscriptionId: string; } interface IPubSubUnsubscribe { channelId: string; subscriptionId: string; } interface IPubSubMessage { channelId: string; message: any; publisherId: string; timestamp: number; } interface IPubSubChannelInfo { channelId: string; channelInfo: any; timestamp: number; } declare type PubSubMessageHandler = (message: any, publisherId: string) => void; declare type PubSubChannelInfoHandler = (channelInfo: any) => void; interface IJobInfo { version: 1; id: string; status: "queued" | "running" | "success" | "failure" | "cancelled"; request: { task: string; } & Record; result?: { message: string; processingMessage?: string; } & Record; createdAt: number; updatedAt?: number; startedAt?: number; completedAt?: number; } interface ICreateJobRequest extends IBaseRequestResponse { request: { task: string; } & Record; } interface ICreateJobResponse extends IBaseRequestResponse { job: IJobInfo; } interface ICancelJobRequest { jobId: string; } interface IJobInfoMessage { job: IJobInfo; } interface IJobExecutor { createJob(request: { task: string; } & Record, context?: Record): Promise; cancelJob(jobId: string): Promise; getJobs(context?: Record): Promise; onJobUpdate(callback: (job: IJobInfo) => void): void; } declare type ChoiceId = string; interface IAuthoringMetadataBase { questionType: string; /** * Interactive can optionally set questionSubType, so Teacher Report can display different icons * or categorize interactives into subcategories. */ questionSubType?: string; required?: boolean; prompt?: string; } /** * Generic interactive type. */ interface IAuthoringInteractiveMetadata extends IAuthoringMetadataBase { questionType: "iframe_interactive"; } interface IAuthoringOpenResponseMetadata extends IAuthoringMetadataBase { questionType: "open_response"; } interface IAuthoringMultipleChoiceChoiceMetadata { id: ChoiceId; content?: string; correct?: boolean; } interface IAuthoringMultipleChoiceMetadata extends IAuthoringMetadataBase { questionType: "multiple_choice"; choices: IAuthoringMultipleChoiceChoiceMetadata[]; /** * Whether the question accepts multiple simultaneous answers. When omitted, consumers should * treat it as undefined (not false) — single-answer behavior is the legacy default but is not * implied by absence. LARA surfaces this verbatim as `multiple_answers` on the report-service * structure document. */ multipleAnswers?: boolean; } interface IAuthoringImageQuestionMetadata extends IAuthoringMetadataBase { questionType: "image_question"; answerPrompt?: string; } declare type IAuthoringMetadata = IAuthoringInteractiveMetadata | IAuthoringOpenResponseMetadata | IAuthoringMultipleChoiceMetadata | IAuthoringImageQuestionMetadata; interface IRuntimeMetadataBase { answerType: string; submitted?: boolean; /** * answerText can be used by all the interactive types to display answer summary without having to load iframe * with report view. */ answerText?: string; } interface IRuntimeInteractiveMetadata extends IRuntimeMetadataBase { answerType: "interactive_state"; } interface IRuntimeOpenResponseMetadata extends IRuntimeMetadataBase { /** * answerType is different so Report and Portal can recognize this type of question. * Use answerText (defined in IRuntimeMetadataBase) to provide open response answer. */ answerType: "open_response_answer"; } interface IRuntimeMultipleChoiceMetadata extends IRuntimeMetadataBase { answerType: "multiple_choice_answer"; selectedChoiceIds: ChoiceId[]; } interface IRuntimeImageQuestionMetadata extends IRuntimeMetadataBase { answerType: "image_question_answer"; answerImageUrl?: string; } declare type IRuntimeMetadata = IRuntimeInteractiveMetadata | IRuntimeOpenResponseMetadata | IRuntimeMultipleChoiceMetadata | IRuntimeImageQuestionMetadata; declare const inIframe: () => boolean; declare type ManagedStateEvent = "interactiveStateUpdated" | "globalInteractiveStateUpdated" | "authoredStateUpdated" | "initInteractive" | "jobInfoReceived"; declare class ManagedState { interactiveStateDirty: boolean; jobs: ReadonlyArray; private _initMessage; private _interactiveState; private _authoredState; private _globalInteractiveState; private emitter; get initMessage(): any; set initMessage(value: any); get interactiveState(): any; set interactiveState(value: any); get authoredState(): any; set authoredState(value: any); get globalInteractiveState(): any; set globalInteractiveState(value: any); emit(event: ManagedStateEvent, content?: any): void; on(event: ManagedStateEvent, handler: any): void; off(event: ManagedStateEvent, handler: any): void; once(event: ManagedStateEvent, handler: any): void; upsertJob(job: IJobInfo): void; } declare const getClient: () => Client; /** * This class is intended to provide basic helpers (like `post()` or `add/removeListener`), maintain client-specific * state, and generally be as minimal as possible. Most of the client-specific helpers and logic can be implemented * in api.ts or hooks.ts (or both so the client app has choice). */ declare class Client { phone: iframePhone.IFrameEndpoint; managedState: ManagedState; customMessagesHandled: ICustomMessagesHandledMap; private listeners; private requestId; private onUnload; constructor(); getNextRequestId(): number; post(message: ClientMessage, content?: any): void; addListener(message: ServerMessage, callback: iframePhone.ListenerCallback, requestId?: number): boolean; removeListener(message: ServerMessage, requestId?: number, callback?: iframePhone.ListenerCallback): boolean; setSupportedFeatures: (request: ISupportedFeaturesRequest) => void; setOnUnload: (onUnload?: OnUnloadFunction<{}> | undefined) => void; createPubSubChannel(channelId: string, channelInfo?: any): PubSubChannel; private connect; } declare class PubSubChannel { private client; private channelId; private channelInfo; private subscriptions; private listenersRegistered; constructor(client: Client, channelId: string, channelInfo?: any); publish(message: any): void; subscribe(handler: PubSubMessageHandler, onChannelInfo?: PubSubChannelInfoHandler): () => void; dispose(): void; getChannelId(): string; getChannelInfo(): any; setChannelInfo(channelInfo: any): void; private registerListeners; private createChannel; private unsubscribe; } declare const getInitInteractiveMessage: () => Promise | null>; declare const getMode: () => Promise<"runtime" | "authoring" | "report" | "reportItem" | undefined>; declare const getInteractiveState: () => InteractiveState | null; declare const setInteractiveStateTimeout = 2000; /** * Note that state will become frozen and should never be mutated. * Each time you update state, make sure that a new object is passed. * * Good: * ``` * setInteractiveState(Object.assign({}, previousState, {someProperty: "a new value"})); * // or * setInteractiveState({...previousState, someProperty: "a new value"}); * ``` * * Bad: * ``` * previousState.someProperty = "a new value"; * setInteractiveState(previousState); * ``` */ declare const setInteractiveState: (newInteractiveState: InteractiveState | null) => void; /** * Useful in rare cases when it's not desirable to wait for the delayed state updates (at this point it only applies * to interactive state updates). Internally used by the showModal and closeModal functions, as opening modal * usually means reloading interactive. It's necessary to make sure that the state is up to date before it happens. */ declare const flushStateUpdates: () => void; declare const getAuthoredState: () => AuthoredState | null; /** * Note that state will become frozen and should never be mutated. * Each time you update state, make sure that a new object is passed. * * Good: * ``` * setAuthoredState(Object.assign({}, previousState, {someProperty: "a new value"})); * // or * setAuthoredState({...previousState, someProperty: "a new value"}); * ``` * * Bad: * ``` * previousState.someProperty = "a new value"; * setAuthoredState(previousState); * ``` */ declare const setAuthoredState: (newAuthoredState: AuthoredState | null) => void; declare const getGlobalInteractiveState: () => GlobalInteractiveState | null; /** * Note that state will become frozen and should never be mutated. * Each time you update state, make sure that a new object is passed. * * Good: * ``` * setGlobalInteractiveState(Object.assign({}, previousState, {someProperty: "a new value"})); * // or * setGlobalInteractiveState({...previousState, someProperty: "a new value"}); * ``` * * Bad: * ``` * previousState.someProperty = "a new value"; * setGlobalInteractiveState(previousState); * ``` */ declare const setGlobalInteractiveState: (newGlobalState: GlobalInteractiveState | null) => void; declare const addCustomMessageListener: (callback: ICustomMessageHandler, handles?: ICustomMessagesHandledMap | undefined) => void; declare const removeCustomMessageListener: () => boolean; declare const addFocusEnterListener: (callback: (mode: IFocusEnterMessage["mode"]) => void) => void; declare const removeFocusEnterListener: () => boolean; declare const sendFocusExit: (mode: FocusExitMode) => void; declare const addDecorateContentListener: (callback: ITextDecorationHandler) => void; declare const removeDecorateContentListener: () => void; declare const addGetReportItemAnswerListener: (callback: IGetReportItemAnswerHandler) => void; declare const removeGetReportItemAnswerListener: () => void; declare const notifyReportItemClientReady: (metadata?: IReportItemHandlerMetadata | undefined) => void; declare const setSupportedFeatures: (features: ISupportedFeatures) => void; declare const setHeight: (height: number | string) => void; declare const postDecoratedContentEvent: (msg: IDecoratedContentEvent) => void; /** * Providing empty string or null disables hint. */ declare const setHint: (hint: string | null) => void; declare const setNavigation: (options: INavigationOptions) => void; declare const getAuthInfo: () => Promise; declare const getFirebaseJwt: (firebaseApp: string) => Promise; declare const log: (action: string, data?: object | undefined) => void; declare const addInteractiveStateListener: (listener: (interactiveState: InteractiveState) => void) => void; declare const removeInteractiveStateListener: (listener: (interactiveState: InteractiveState) => void) => void; declare const addAuthoredStateListener: (listener: (authoredState: AuthoredState) => void) => void; declare const removeAuthoredStateListener: (listener: (authoredState: AuthoredState) => void) => void; declare const addGlobalInteractiveStateListener: (listener: (globalInteractiveState: GlobalInteractiveState) => void) => void; declare const removeGlobalInteractiveStateListener: (listener: (globalInteractiveState: GlobalInteractiveState) => void) => void; /** * The listener should be called immediately after it is added with any state of the linked * interactive that the host currently knows about. This first call might not happen * synchronously it could be slightly delayed. And then the listener should be called again * whenever the state of the linked interactive changes. */ declare const addLinkedInteractiveStateListener: (listener: (linkedIntState: LinkedInteractiveState | undefined) => void, options: IAddLinkedInteractiveStateListenerOptions) => void; declare const removeLinkedInteractiveStateListener: (listener: (intState: InteractiveState | null) => void) => void; /** * "lightbox" type is used for displaying images or generic iframes (e.g. help page, but NOT dynamic interactives). * "dialog" is used for showing dynamic interactives. It'll be initialized correctly by the host environment and * all the runtime features will be supported. */ declare const showModal: (options: IShowModal) => void; declare const closeModal: (options: ICloseModal) => void; declare const getInteractiveList: (options: IGetInteractiveListOptions) => Promise; declare const setLinkedInteractives: (options: ISetLinkedInteractives) => void; declare const getInteractiveSnapshot: (options: IGetInteractiveSnapshotOptions) => Promise; /** * @todo Implement this function. */ declare const getLibraryInteractiveList: (options: IGetLibraryInteractiveListRequest) => void; declare const writeAttachment: (params: WriteAttachmentParams) => Promise; declare const readAttachment: (params: ReadAttachmentParams) => Promise; declare const getAttachmentUrl: (params: GetAttachmentUrlParams) => Promise; declare const sendReportItemAnswer: (request: Omit) => void; declare const setOnUnload: (onUnload?: OnUnloadFunction<{}> | undefined) => void; declare const sendCustomMessage: (customMessage: ICustomMessage) => void; declare const createPubSubChannel: (channelId: string, channelInfo?: any) => PubSubChannel; declare const setDirtyState: (isDirty: boolean) => void; declare const createJob: (request: { task: string; } & Record) => Promise; declare const cancelJob: (jobId: string) => void; declare const getJobs: () => IJobInfo[]; declare const addJobUpdateListener: (listener: (job: IJobInfo) => void) => void; declare const removeJobUpdateListener: (listener: (job: IJobInfo) => void) => void; declare type UpdateFunc = (prevState: S | null) => S; declare const useInteractiveState: () => { interactiveState: InteractiveState | null; setInteractiveState: (stateOrUpdateFunc: InteractiveState | UpdateFunc | null) => void; }; declare const useAuthoredState: () => { authoredState: AuthoredState | null; setAuthoredState: (stateOrUpdateFunc: AuthoredState | UpdateFunc | null) => void; }; declare const useGlobalInteractiveState: () => { globalInteractiveState: GlobalInteractiveState | null; setGlobalInteractiveState: (stateOrUpdateFunc: GlobalInteractiveState | UpdateFunc | null) => void; }; declare const useInitMessage: () => IInitInteractive | null; declare const useCustomMessages: (callback: ICustomMessageHandler, handles?: ICustomMessagesHandledMap | undefined) => void; declare const useJobs: () => { createJob: (request: { task: string; } & Record) => Promise; cancelJob: (jobId: string) => void; jobs: IJobInfo[]; latestJob: IJobInfo | undefined; }; declare const useDecorateContent: (callback: ITextDecorationHandler) => void; declare const useAutoSetHeight: () => void; interface IUseReportItemOptions { metadata: IReportItemHandlerMetadata; handler: IGetReportItemAnswerHandler; } declare const useReportItem: ({ metadata, handler }: IUseReportItemOptions) => void; declare const DefaultAccessibilitySettings: IAccessibilitySettings; interface IUseAccessibilityProps { updateHtmlFontSize?: boolean; addBodyClass?: boolean; fontFamilySelector?: string; } declare const useAccessibility: (props?: IUseAccessibilityProps | undefined) => IAccessibilitySettings; export { AttachmentInfoMap, ChoiceId, Client, ClientMessage, DefaultAccessibilitySettings, DeprecatedRuntimeClientMessage, DeprecatedRuntimeServerMessage, FocusEnterMode, FocusExitMode, GetAttachmentUrlParams, GlobalIFrameSaverClientMessage, GlobalIFrameSaverServerMessage, IAccessibilitySettings, IAddLinkedInteractiveStateListenerOptions, IAddLinkedInteractiveStateListenerRequest, IAttachmentInfo, IAttachmentUrlRequest, IAttachmentUrlResponse, IAuthInfo, IAuthoringClientMessage, IAuthoringCustomReportField, IAuthoringCustomReportFields, IAuthoringImageQuestionMetadata, IAuthoringInitInteractive, IAuthoringInteractiveMetadata, IAuthoringMetadata, IAuthoringMetadataBase, IAuthoringMultipleChoiceChoiceMetadata, IAuthoringMultipleChoiceMetadata, IAuthoringOpenResponseMetadata, IAuthoringServerMessage, IBaseShowModal, ICancelJobRequest, ICloseModal, IContextMember, IContextMembership, ICreateJobRequest, ICreateJobResponse, ICustomMessage, ICustomMessageHandler, ICustomMessageOptions, ICustomMessagesHandledMap, ICustomReportFieldsAuthoredState, ICustomReportFieldsAuthoredStateField, ICustomReportFieldsInteractiveState, IDataset, IDecoratedContentEvent, IFocusEnterMessage, IFocusExitMessage, IGetAuthInfoRequest, IGetAuthInfoResponse, IGetFirebaseJwtRequest, IGetFirebaseJwtResponse, IGetInteractiveListOptions, IGetInteractiveListRequest, IGetInteractiveListResponse, IGetInteractiveSnapshotOptions, IGetInteractiveSnapshotRequest, IGetInteractiveSnapshotResponse, IGetInteractiveState, IGetLibraryInteractiveListOptions, IGetLibraryInteractiveListRequest, IGetLibraryInteractiveListResponse, IGetReportItemAnswer, IGetReportItemAnswerHandler, IHintRequest, IHostFeatureSupport, IHostFeatures, IHostModalSupport, IInitInteractive, IInteractiveListResponseItem, IInteractiveStateProps, IInteractiveStateWithDataset, IJobExecutor, IJobInfo, IJobInfoMessage, IJwtClaims, IJwtResponse, ILibraryInteractiveListResponseItem, ILinkedInteractive, ILinkedInteractiveStateResponse, IMediaLibrary, IMediaLibraryItem, IMediaLibraryItemType, INavigationOptions, IOpaqueObjectStorageConfig, IPortalClaims, IPubSubChannelInfo, IPubSubCreateChannel, IPubSubMessage, IPubSubPublish, IPubSubSubscribe, IPubSubUnsubscribe, IRemoveLinkedInteractiveStateListenerRequest, IReportInitInteractive, IReportItemAnswer, IReportItemAnswerItem, IReportItemAnswerItemAnswerText, IReportItemAnswerItemAttachment, IReportItemAnswerItemHtml, IReportItemAnswerItemLinks, IReportItemAnswerItemScore, IReportItemClientMessage, IReportItemHandlerMetadata, IReportItemInitInteractive, IReportItemServerMessage, IRuntimeClientMessage, IRuntimeCustomReportValues, IRuntimeImageQuestionMetadata, IRuntimeInitInteractive, IRuntimeInteractiveMetadata, IRuntimeMetadata, IRuntimeMetadataBase, IRuntimeMultipleChoiceMetadata, IRuntimeOpenResponseMetadata, IRuntimeServerMessage, ISetDirtyStateRequest, ISetLinkedInteractives, IShowAlert, IShowDialog, IShowLightbox, IShowModal, ISupportedFeatures, ISupportedFeaturesRequest, ITextDecorationHandler, ITextDecorationHandlerInfo, ITextDecorationInfo, IThemeInfo, IUseAccessibilityProps, IUseReportItemOptions, IWriteAttachmentRequest, IframePhoneServerMessage, InitInteractiveMode, InteractiveItemId, LoggerClientMessage, ModalType, OnUnloadFunction, PubSubChannel, PubSubChannelInfoHandler, PubSubMessageHandler, ReadAttachmentParams, ReportItemsType, ServerMessage, WriteAttachmentParams, addAuthoredStateListener, addCustomMessageListener, addDecorateContentListener, addFocusEnterListener, addGetReportItemAnswerListener, addGlobalInteractiveStateListener, addInteractiveStateListener, addJobUpdateListener, addLinkedInteractiveStateListener, cancelJob, closeModal, createJob, createPubSubChannel, flushStateUpdates, getAttachmentUrl, getAuthInfo, getAuthoredState, getClient, getFirebaseJwt, getGlobalInteractiveState, getInitInteractiveMessage, getInteractiveList, getInteractiveSnapshot, getInteractiveState, getJobs, getLibraryInteractiveList, getMode, inIframe, log, notifyReportItemClientReady, postDecoratedContentEvent, readAttachment, removeAuthoredStateListener, removeCustomMessageListener, removeDecorateContentListener, removeFocusEnterListener, removeGetReportItemAnswerListener, removeGlobalInteractiveStateListener, removeInteractiveStateListener, removeJobUpdateListener, removeLinkedInteractiveStateListener, sendCustomMessage, sendFocusExit, sendReportItemAnswer, setAuthoredState, setDirtyState, setGlobalInteractiveState, setHeight, setHint, setInteractiveState, setInteractiveStateTimeout, setLinkedInteractives, setNavigation, setOnUnload, setSupportedFeatures, showModal, useAccessibility, useAuthoredState, useAutoSetHeight, useCustomMessages, useDecorateContent, useGlobalInteractiveState, useInitMessage, useInteractiveState, useJobs, useReportItem, writeAttachment };