UNPKG

matrix-react-sdk

Version:
102 lines (101 loc) 3.5 kB
import React, { ContextType, CSSProperties, MutableRefObject, ReactNode } from "react"; import { IWidget } from "matrix-widget-api"; import { Room } from "matrix-js-sdk/src/matrix"; import { IApp } from "../../../stores/WidgetStore"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; interface IProps { app: IWidget | IApp; room?: Room; threadId?: string | null; fullWidth?: boolean; miniMode?: boolean; userId: string; creatorUserId: string; waitForIframeLoad: boolean; showMenubar?: boolean; onEditClick?: () => void; onDeleteClick?: () => void; showTitle?: boolean; handleMinimisePointerEvents?: boolean; showPopout?: boolean; userWidget: boolean; pointerEvents?: CSSProperties["pointerEvents"]; widgetPageTitle?: string; showLayoutButtons?: boolean; movePersistedElement?: MutableRefObject<(() => void) | undefined>; overlay?: ReactNode; stickyPromise?: () => Promise<void>; } interface IState { initialising: boolean; loading: boolean; hasPermissionToLoad: boolean; isUserProfileReady: boolean; error: Error | null; menuDisplayed: boolean; requiresClient: boolean; hasContextMenuOptions: boolean; } export default class AppTile extends React.Component<IProps, IState> { static contextType: React.Context<import("matrix-js-sdk/src/client.ts").MatrixClient>; context: ContextType<typeof MatrixClientContext>; static defaultProps: Partial<IProps>; private contextMenuButton; private iframe?; private allowedWidgetsWatchRef?; private persistKey; private sgWidget; private dispatcherRef?; private unmounted; constructor(props: IProps, context: ContextType<typeof MatrixClientContext>); private watchUserReady; private onUserReady; private hasPermissionToLoad; private onUserLeftRoom; private onMyMembership; private determineInitialRequiresClientState; /** * Set initial component state when the App wUrl (widget URL) is being updated. * Component props *must* be passed (rather than relying on this.props). * @param {Object} newProps The new properties of the component * @return {Object} Updated component state to be set with setState */ private getNewState; private onAllowedWidgetsChange; private isMixedContent; componentDidMount(): void; componentWillUnmount(): void; private setupSgListeners; private stopSgListeners; private resetWidget; private startWidget; private startMessaging; private iframeRefChange; componentDidUpdate(prevProps: IProps): void; /** * Ends all widget interaction, such as cancelling calls and disabling webcams. * @private * @returns {Promise<*>} Resolves when the widget is terminated, or timeout passed. */ private endWidgetActions; private onWidgetReady; private updateRequiresClient; private onAction; private grantWidgetPermission; private formatAppTileName; /** * Whether we're using a local version of the widget rather than loading the * actual widget URL * @returns {bool} true If using a local version of the widget */ private usingLocalWidget; private getTileTitle; private reload; private onPopoutWidgetClick; private onToggleMaximisedClick; private onMinimiseClicked; private onContextMenuClick; private closeContextMenu; render(): React.ReactNode; } export {};