diff --git a/types/inboxsdk/inboxsdk-tests.ts b/types/inboxsdk/inboxsdk-tests.ts index c1b48a1f7f..a763674c73 100644 --- a/types/inboxsdk/inboxsdk-tests.ts +++ b/types/inboxsdk/inboxsdk-tests.ts @@ -1,4 +1,3 @@ -import * as InboxSDK from 'inboxsdk'; import ComposeView = InboxSDK.Compose.ComposeView; import Contact = InboxSDK.Common.Contact; import ThreadRowView = InboxSDK.Lists.ThreadRowView; diff --git a/types/inboxsdk/index.d.ts b/types/inboxsdk/index.d.ts index bfb6cc3738..4fdd6a86f2 100644 --- a/types/inboxsdk/index.d.ts +++ b/types/inboxsdk/index.d.ts @@ -8,9 +8,15 @@ /* * Copyright (c) 2016 GPC.solutions */ -export function load(version: number, appId?: string, opts?: LoadOptions): Promise; -export function loadScript(url: string, options?: LoadScriptOptions): Promise; +// tslint:disable-next-line:export-just-namespace +export = InboxSDK; +export as namespace InboxSDK; + +declare namespace InboxSDK { + function load(version: number, appId?: string, opts?: LoadOptions): Promise; + + function loadScript(url: string, options?: LoadScriptOptions): Promise; // // Undocummented // var IMPL_VERSION: string; @@ -21,1045 +27,1046 @@ export function loadScript(url: string, options?: LoadScriptOptions): Promise any; // }; -export interface LoadOptions { - appName?: string; - appIconUrl?: string; - suppressAddonTitle?: string; -} - -export interface LoadScriptOptions { - nowrap?: boolean; -} - -export interface InboxSDKInstance { - Compose: Compose.ComposeInstance; - Lists: Lists.Lists; - Conversations: Conversations.Conversations; - Toolbars: Toolbars.Toolbars; - Router: Router.Router; - NavMenu: NavMenu.NavMenu; - Widgets: Widgets.WidgetsInstance; - ButterBar: ButterBar.ButterBar; - Search: Search.Search; - User: User.User; - Keyboard: Keyboard.Keyboard; - Global: Global.Global; -} - -export namespace Common { - interface Contact { - name: string; - emailAddress: string; - } - - interface DropdownView { - setPlacementOptions(options: PositionOptions): void; - - close(): void; - - reposition(): void; - - el: HTMLElement; - destroyed: boolean; - - on(name: 'destroy', cb: () => void): void; - - on(name: 'preautoclose', cb: (event: PreAutoCloseEvent) => void): void; - } - - interface PreAutoCloseEvent { - type: 'outsideInteraction' | 'escape'; - cause: Event; - - cancel(): void; - } - - interface PositionOptions { - position?: string; - forcePosition?: boolean; - hAlign?: string; - forceHAlign?: boolean; - vAlign?: string; - forceVAlign?: boolean; - buffer?: number; - topBuffer?: number; - bottomBuffer?: number; - leftBuffer?: number; - rightBuffer?: number; - } - - interface SimpleElementView { - destroy(): void; - - el: HTMLElement; - destroyed: boolean; - - on(name: 'destroy', cb: () => void): void; - } -} - -export namespace Compose { - interface ComposeInstance { - registerComposeViewHandler(handler: (composeView: ComposeView) => void): () => void; - - openNewComposeView(): Promise; - } - - interface ComposeView { - addButton(buttonDescriptor: ComposeButtonDescriptor): void; - - addStatusBar(statusBarDescriptor: StatusBarDescriptor): StatusBarView; - - close(): void; - - send(options?: SendOptions): void; - - getBodyElement(): HTMLElement; - - getInitialMessageID(): string; - - getThreadID(): string; - - getDraftID(): Promise; - - getCurrentDraftID(): Promise; - - getHTMLContent(): string; - - getSelectedBodyHTML(): string; - - getSelectedBodyText(): string; - - getSubject(): string; - - getTextContent(): string; - - getToRecipients(): Common.Contact[]; - - getCcRecipients(): Common.Contact[]; - - getBccRecipients(): Common.Contact[]; - - insertTextIntoBodyAtCursor(text: string): void; - - insertHTMLIntoBodyAtCursor(html: string | HTMLElement): HTMLElement; - - insertLinkChipIntoBodyAtCursor(text: string, url: string, iconUrl: string): HTMLElement; - - insertLinkIntoBodyAtCursor(text: string, url: string): HTMLElement; - - isInlineReplyForm(): boolean; - - isFullscreen(): boolean; - - setFullscreen(minimized: boolean): void; - - isMinimized(): boolean; - - setMinimized(minimized: boolean): void; - - popOut(): Promise; - - setTitleBarColor(color: string): () => void; - - isReply(): boolean; - - setToRecipients(emails: string[]): void; - - setCcRecipients(emails: string[]): void; - - setBccRecipients(emails: string[]): void; - - getFromContact(): Common.Contact; - - getFromContactChoices(): Common.Contact[]; - - setFromEmail(email: string): void; - - setSubject(text: string): void; - - setBodyHTML(html: string): void; - - setBodyText(text: string): void; - - attachFiles(files: Blob[]): Promise; - - attachInlineFiles(Files: Blob[]): Promise; - - on(name: 'destroy', cb: (event: { messageID: string, closedByInboxSDK: boolean }) => void): void; - - on(name: 'fullscreenChanged', cb: (event: { fullscreen: boolean }) => void): void; - - on(name: 'fromContactChanged' | 'toContactAdded' | 'toContactRemoved' | 'ccContactAdded' | 'ccContactRemoved' | 'bccContactAdded' | 'bccContactRemoved', - cb: (event: { contact: Common.Contact }) => void): void; - - on(name: 'recipientsChanged', cb: (event: RecipientsChangedEvent) => void): void; - - on(name: 'presending', cb: (event: { cancel: () => void }) => void): void; - - on(name: 'sent', cb: (event: { getThreadID: () => Promise, getMessageID: () => Promise }) => void): void; - - on(name: 'discard' | 'sendCanceled' | 'sending' | 'bodyChanged' | 'minimized' | 'restored', cb: () => void): void; - - destroyed: boolean; - } - - interface RecipientsChangedEvent { - to: { - added: Common.Contact[]; - removed: Common.Contact[]; - }; - cc: { - added: Common.Contact[]; - removed: Common.Contact[]; - }; - bcc: { - added: Common.Contact[]; - removed: Common.Contact[]; - }; - } - - interface ComposeButtonDescriptor { - title: string; - iconUrl?: string; - iconClass?: string; - onClick: (event: ComposeButtonClickEvent) => void; - hasDropdown?: boolean; - type?: 'MODIFIER' | 'SEND_ACTION'; - orderHint?: number; - enabled?: boolean; - } - - interface ComposeButtonClickEvent { - composeView: ComposeView; - dropdown: Common.DropdownView; - } - - interface StatusBarDescriptor { - height?: number; - orderHint?: number; - } - - interface StatusBarView extends Common.SimpleElementView { - setHeight(height: number): void; - } - - interface SendOptions { - sendAndArchive?: boolean; - } -} - -export namespace Lists { - interface Lists { - registerThreadRowViewHandler(handler: (threadRowView: ThreadRowView) => any): () => void; - } - - interface ThreadRowView { - addLabel(labelDescriptor: LabelDescriptor): void; - - // addLabel(labelDescriptor: Stream): void; - - addImage(imageDescriptor: ImageDescriptor): void; - - // addImage(imageDescriptor: Stream): void; - - addButton(buttonDescriptor: ThreadRowButtonDescriptor): void; - - // addButton(buttonDescriptor: Stream): void; - - addActionButton(buttonDescriptor: ThreadRowActionButtonDescriptor): void; - - // addActionButton(buttonDescriptor: Stream): void; - - addAttachmentIcon(threadRowAttachmentIconDescriptor: ThreadRowAttachmentIconDescriptor): void; - - // addAttachmentIcon(threadRowAttachmentIconDescriptor: stream): void - - replaceDate(threadRowDateDescriptor: ThreadRowDateDescriptor): void; - - // replaceDate(threadRowDateDescriptor: Stream): void; - - replaceDraftLabel(draftLabelDescriptor: ThreadRowDraftLabelDescriptor): void; - - // replaceDraftLabel(draftLabelDescriptor: Stream): void; - - getSubject(): string; - - getDateString(): string; - - getThreadIDAsync(): Promise; - - getThreadIDIfStableAsync(): Promise; - - getDraftID(): Promise; - - getVisibleDraftCount(): number; - - getVisibleMessageCount(): number; - - getContacts(): Common.Contact[]; - - on(name: 'destroyed', cb: () => void): void; - - destroyed: boolean; - } - - interface ThreadRowButtonDescriptor { - title: string; - iconUrl: string; - iconClass?: string; - onClick: (event: ThreadRowButtonClickEvent) => void; - hasDropdown?: boolean; - } - - interface ThreadRowButtonClickEvent { - threadRowView: ThreadRowView; - dropdown?: Common.DropdownView; - } - - interface ThreadRowActionButtonDescriptor { - type: 'LINK'; - title: string; - className?: string; - onClick?: (event: any) => void; - url: string; - } - - interface LabelDescriptor { - title: string; - foregroundColor?: string; - backgroundColor?: string; - iconUrl: string; - iconClass?: string; - iconBackgroundColor?: string; - } - - interface ImageDescriptor { - imageUrl: string; - imageClass?: string; - tooltip?: string; - orderHint?: number; - } - - interface ThreadRowDateDescriptor { - text: string; - textColor?: string; - tooltip?: string; - } - - interface ThreadRowAttachmentIconDescriptor { - iconUrl?: string; - iconClass?: string; - tooltip?: string; - } - - interface ThreadRowDraftLabelDescriptor { - text: string; - count?: string; - } -} - -export namespace Conversations { - interface Conversations { - registerThreadViewHandler(handler: (threadView: ThreadView) => void): () => void; - - registerMessageViewHandler(handler: (messageView: MessageView) => void): () => void; - - registerMessageViewHandlerAll(handler: (messageView: MessageView) => void): () => void; - - registerFileAttachmentCardViewHandler(handler: (attachmentCardView: AttachmentCardView) => void): () => void; - } - - interface ThreadView { - addNoticeBar(): Common.SimpleElementView; - - addSidebarContentPanel(contentPanelDescriptor: ContentPanelDescriptor): ContentPanelView; - - getMessageViews(): MessageView[]; - - getMessageViewsAll(): MessageView[]; - - getSubject(): string; - - getThreadIDAsync(): Promise; - - on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void; - - on(name: 'destroy', cb: () => void): void; - - destroyed: boolean; - } - - interface ContactHoverEvent { - contact: Common.Contact; - contactType: 'sender' | 'recipient'; - messageView: MessageView; - threadView: ThreadView; - } - - interface MessageView { - addAttachmentCardView(cardOptions: AttachmentCardOptions | AttachmentCardNoPreviewOptions): AttachmentCardView; - - addAttachmentsToolbarButton(buttonOptions: AttachmentsToolbarButtonDescriptor): void; - - addToolbarButton(options: MessageViewToolbarButtonDescriptor): void; - - getBodyElement(): HTMLElement; - - getMessageIDAsync(): Promise; - - getFileAttachmentCardViews(): AttachmentCardView[]; - - isElementInQuotedArea(): boolean; - - isLoaded(): boolean; - - getLinksInBody(): MessageViewLinkDescriptor[]; - - getSender(): Common.Contact; - - getRecipientEmailAddresses(): string[]; - - getRecipientsFull(): Promise; - - getThreadView(): ThreadView; - - getDateString(): string; - - addAttachmentIcon(iconDescriptor: MessageAttachmentIconDescriptor): void; - - // addAttachmentIcon(iconDescriptor: Stream): void; - - getViewState(): MessageViewViewStates; - - on(name: 'viewStateChange', cb: (event: { newViewState: MessageViewViewStates, oldViewState: MessageViewViewStates, messageView: MessageView }) => void): void; - - on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void; - - on(name: 'destroy' | 'load', cb: () => void): void; - - destroyed: boolean; - } - - type MessageViewViewStates = 'HIDDEN' | 'COLLAPSED' | 'EXPANDED'; - - interface ContentPanelView { - remove(): void; - - on(name: 'destroy' | 'activate' | 'deactivate', cb: () => void): void; - - destroyed: boolean; - } - - interface AttachmentCardView { - getAttachmentType(): string; - - addButton(buttonDescriptor: CustomButtonDescriptor): void; - - getTitle(): string; - - /** - * @deprecated. Use AttachmentCardClickEvent.getDownloadURL() instead - */ - getDownloadURL(): Promise; - - getMessageView(): MessageView | null; - - on(name: 'destroy', cb: () => void): void; - - destroyed: boolean; - } - - // ConversationsDescriptors - - interface AttachmentCardOptions { - title: string; - description: string; - previewUrl: string; - previewThumbnailUrl: string; - failoverPreviewIconUrl: string; - previewOnClick: (event: PreviewClickEvent) => void; - fileIconImageUrl: string; - buttons: Array; - foldColor?: string; - mimeType?: string; - } - - interface AttachmentCardNoPreviewOptions { - title: string; - description: string; - previewUrl: string; - iconThumbnailUrl: string; - previewOnClick: (event: PreviewClickEvent) => void; - fileIconImageUrl: string; - buttons: Array; - foldColor?: string; - } - - interface PreviewClickEvent { - attachmentCardView: AttachmentCardView; - - preventDefault(): void; - } - - interface ContentPanelDescriptor { - el: HTMLElement; - title: string; - iconUrl: string; + interface LoadOptions { appName?: string; appIconUrl?: string; - id?: string; - hideTitleBar?: boolean; - orderHint?: number; + suppressAddonTitle?: string; } - interface DownloadButtonDescriptor { - downloadUrl: string; - downloadFilename?: string; - onClick: (event: any) => void; - openInNewTab?: boolean; + interface LoadScriptOptions { + nowrap?: boolean; } - interface CustomButtonDescriptor { - iconUrl: string; - tooltip: string; - onClick: (event: AttachmentCardClickEvent) => void; + interface InboxSDKInstance { + Compose: Compose.ComposeInstance; + Lists: Lists.Lists; + Conversations: Conversations.Conversations; + Toolbars: Toolbars.Toolbars; + Router: Router.Router; + NavMenu: NavMenu.NavMenu; + Widgets: Widgets.WidgetsInstance; + ButterBar: ButterBar.ButterBar; + Search: Search.Search; + User: User.User; + Keyboard: Keyboard.Keyboard; + Global: Global.Global; } - interface AttachmentCardClickEvent { - getDownloadURL(): Promise; + namespace Common { + interface Contact { + name: string; + emailAddress: string; + } + + interface DropdownView { + setPlacementOptions(options: PositionOptions): void; + + close(): void; + + reposition(): void; + + el: HTMLElement; + destroyed: boolean; + + on(name: 'destroy', cb: () => void): void; + + on(name: 'preautoclose', cb: (event: PreAutoCloseEvent) => void): void; + } + + interface PreAutoCloseEvent { + type: 'outsideInteraction' | 'escape'; + cause: Event; + + cancel(): void; + } + + interface PositionOptions { + position?: string; + forcePosition?: boolean; + hAlign?: string; + forceHAlign?: boolean; + vAlign?: string; + forceVAlign?: boolean; + buffer?: number; + topBuffer?: number; + bottomBuffer?: number; + leftBuffer?: number; + rightBuffer?: number; + } + + interface SimpleElementView { + destroy(): void; + + el: HTMLElement; + destroyed: boolean; + + on(name: 'destroy', cb: () => void): void; + } } - interface AttachmentsToolbarButtonDescriptor { - tooltip: string; - iconUrl: string; - onClick: (event: AttachmentsToolbarButtonEvent) => void; + export namespace Compose { + interface ComposeInstance { + registerComposeViewHandler(handler: (composeView: ComposeView) => void): () => void; + + openNewComposeView(): Promise; + } + + interface ComposeView { + addButton(buttonDescriptor: ComposeButtonDescriptor): void; + + addStatusBar(statusBarDescriptor: StatusBarDescriptor): StatusBarView; + + close(): void; + + send(options?: SendOptions): void; + + getBodyElement(): HTMLElement; + + getInitialMessageID(): string; + + getThreadID(): string; + + getDraftID(): Promise; + + getCurrentDraftID(): Promise; + + getHTMLContent(): string; + + getSelectedBodyHTML(): string; + + getSelectedBodyText(): string; + + getSubject(): string; + + getTextContent(): string; + + getToRecipients(): Common.Contact[]; + + getCcRecipients(): Common.Contact[]; + + getBccRecipients(): Common.Contact[]; + + insertTextIntoBodyAtCursor(text: string): void; + + insertHTMLIntoBodyAtCursor(html: string | HTMLElement): HTMLElement; + + insertLinkChipIntoBodyAtCursor(text: string, url: string, iconUrl: string): HTMLElement; + + insertLinkIntoBodyAtCursor(text: string, url: string): HTMLElement; + + isInlineReplyForm(): boolean; + + isFullscreen(): boolean; + + setFullscreen(minimized: boolean): void; + + isMinimized(): boolean; + + setMinimized(minimized: boolean): void; + + popOut(): Promise; + + setTitleBarColor(color: string): () => void; + + isReply(): boolean; + + setToRecipients(emails: string[]): void; + + setCcRecipients(emails: string[]): void; + + setBccRecipients(emails: string[]): void; + + getFromContact(): Common.Contact; + + getFromContactChoices(): Common.Contact[]; + + setFromEmail(email: string): void; + + setSubject(text: string): void; + + setBodyHTML(html: string): void; + + setBodyText(text: string): void; + + attachFiles(files: Blob[]): Promise; + + attachInlineFiles(Files: Blob[]): Promise; + + on(name: 'destroy', cb: (event: { messageID: string, closedByInboxSDK: boolean }) => void): void; + + on(name: 'fullscreenChanged', cb: (event: { fullscreen: boolean }) => void): void; + + on(name: 'fromContactChanged' | 'toContactAdded' | 'toContactRemoved' | 'ccContactAdded' | 'ccContactRemoved' | 'bccContactAdded' | 'bccContactRemoved', + cb: (event: { contact: Common.Contact }) => void): void; + + on(name: 'recipientsChanged', cb: (event: RecipientsChangedEvent) => void): void; + + on(name: 'presending', cb: (event: { cancel: () => void }) => void): void; + + on(name: 'sent', cb: (event: { getThreadID: () => Promise, getMessageID: () => Promise }) => void): void; + + on(name: 'discard' | 'sendCanceled' | 'sending' | 'bodyChanged' | 'minimized' | 'restored', cb: () => void): void; + + destroyed: boolean; + } + + interface RecipientsChangedEvent { + to: { + added: Common.Contact[]; + removed: Common.Contact[]; + }; + cc: { + added: Common.Contact[]; + removed: Common.Contact[]; + }; + bcc: { + added: Common.Contact[]; + removed: Common.Contact[]; + }; + } + + interface ComposeButtonDescriptor { + title: string; + iconUrl?: string; + iconClass?: string; + onClick: (event: ComposeButtonClickEvent) => void; + hasDropdown?: boolean; + type?: 'MODIFIER' | 'SEND_ACTION'; + orderHint?: number; + enabled?: boolean; + } + + interface ComposeButtonClickEvent { + composeView: ComposeView; + dropdown: Common.DropdownView; + } + + interface StatusBarDescriptor { + height?: number; + orderHint?: number; + } + + interface StatusBarView extends Common.SimpleElementView { + setHeight(height: number): void; + } + + interface SendOptions { + sendAndArchive?: boolean; + } } - interface AttachmentsToolbarButtonEvent { - attachmentCardViews: AttachmentCardView[]; + export namespace Lists { + interface Lists { + registerThreadRowViewHandler(handler: (threadRowView: ThreadRowView) => any): () => void; + } + + interface ThreadRowView { + addLabel(labelDescriptor: LabelDescriptor): void; + + // addLabel(labelDescriptor: Stream): void; + + addImage(imageDescriptor: ImageDescriptor): void; + + // addImage(imageDescriptor: Stream): void; + + addButton(buttonDescriptor: ThreadRowButtonDescriptor): void; + + // addButton(buttonDescriptor: Stream): void; + + addActionButton(buttonDescriptor: ThreadRowActionButtonDescriptor): void; + + // addActionButton(buttonDescriptor: Stream): void; + + addAttachmentIcon(threadRowAttachmentIconDescriptor: ThreadRowAttachmentIconDescriptor): void; + + // addAttachmentIcon(threadRowAttachmentIconDescriptor: stream): void + + replaceDate(threadRowDateDescriptor: ThreadRowDateDescriptor): void; + + // replaceDate(threadRowDateDescriptor: Stream): void; + + replaceDraftLabel(draftLabelDescriptor: ThreadRowDraftLabelDescriptor): void; + + // replaceDraftLabel(draftLabelDescriptor: Stream): void; + + getSubject(): string; + + getDateString(): string; + + getThreadIDAsync(): Promise; + + getThreadIDIfStableAsync(): Promise; + + getDraftID(): Promise; + + getVisibleDraftCount(): number; + + getVisibleMessageCount(): number; + + getContacts(): Common.Contact[]; + + on(name: 'destroyed', cb: () => void): void; + + destroyed: boolean; + } + + interface ThreadRowButtonDescriptor { + title: string; + iconUrl: string; + iconClass?: string; + onClick: (event: ThreadRowButtonClickEvent) => void; + hasDropdown?: boolean; + } + + interface ThreadRowButtonClickEvent { + threadRowView: ThreadRowView; + dropdown?: Common.DropdownView; + } + + interface ThreadRowActionButtonDescriptor { + type: 'LINK'; + title: string; + className?: string; + onClick?: (event: any) => void; + url: string; + } + + interface LabelDescriptor { + title: string; + foregroundColor?: string; + backgroundColor?: string; + iconUrl: string; + iconClass?: string; + iconBackgroundColor?: string; + } + + interface ImageDescriptor { + imageUrl: string; + imageClass?: string; + tooltip?: string; + orderHint?: number; + } + + interface ThreadRowDateDescriptor { + text: string; + textColor?: string; + tooltip?: string; + } + + interface ThreadRowAttachmentIconDescriptor { + iconUrl?: string; + iconClass?: string; + tooltip?: string; + } + + interface ThreadRowDraftLabelDescriptor { + text: string; + count?: string; + } } - interface MessageViewLinkDescriptor { - text: string; - html: string; - element: HTMLElement; - href: string; - isInQuotedArea: boolean; + export namespace Conversations { + interface Conversations { + registerThreadViewHandler(handler: (threadView: ThreadView) => void): () => void; + + registerMessageViewHandler(handler: (messageView: MessageView) => void): () => void; + + registerMessageViewHandlerAll(handler: (messageView: MessageView) => void): () => void; + + registerFileAttachmentCardViewHandler(handler: (attachmentCardView: AttachmentCardView) => void): () => void; + } + + interface ThreadView { + addNoticeBar(): Common.SimpleElementView; + + addSidebarContentPanel(contentPanelDescriptor: ContentPanelDescriptor): ContentPanelView; + + getMessageViews(): MessageView[]; + + getMessageViewsAll(): MessageView[]; + + getSubject(): string; + + getThreadIDAsync(): Promise; + + on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void; + + on(name: 'destroy', cb: () => void): void; + + destroyed: boolean; + } + + interface ContactHoverEvent { + contact: Common.Contact; + contactType: 'sender' | 'recipient'; + messageView: MessageView; + threadView: ThreadView; + } + + interface MessageView { + addAttachmentCardView(cardOptions: AttachmentCardOptions | AttachmentCardNoPreviewOptions): AttachmentCardView; + + addAttachmentsToolbarButton(buttonOptions: AttachmentsToolbarButtonDescriptor): void; + + addToolbarButton(options: MessageViewToolbarButtonDescriptor): void; + + getBodyElement(): HTMLElement; + + getMessageIDAsync(): Promise; + + getFileAttachmentCardViews(): AttachmentCardView[]; + + isElementInQuotedArea(): boolean; + + isLoaded(): boolean; + + getLinksInBody(): MessageViewLinkDescriptor[]; + + getSender(): Common.Contact; + + getRecipientEmailAddresses(): string[]; + + getRecipientsFull(): Promise; + + getThreadView(): ThreadView; + + getDateString(): string; + + addAttachmentIcon(iconDescriptor: MessageAttachmentIconDescriptor): void; + + // addAttachmentIcon(iconDescriptor: Stream): void; + + getViewState(): MessageViewViewStates; + + on(name: 'viewStateChange', cb: (event: { newViewState: MessageViewViewStates, oldViewState: MessageViewViewStates, messageView: MessageView }) => void): void; + + on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void; + + on(name: 'destroy' | 'load', cb: () => void): void; + + destroyed: boolean; + } + + type MessageViewViewStates = 'HIDDEN' | 'COLLAPSED' | 'EXPANDED'; + + interface ContentPanelView { + remove(): void; + + on(name: 'destroy' | 'activate' | 'deactivate', cb: () => void): void; + + destroyed: boolean; + } + + interface AttachmentCardView { + getAttachmentType(): string; + + addButton(buttonDescriptor: CustomButtonDescriptor): void; + + getTitle(): string; + + /** + * @deprecated. Use AttachmentCardClickEvent.getDownloadURL() instead + */ + getDownloadURL(): Promise; + + getMessageView(): MessageView | null; + + on(name: 'destroy', cb: () => void): void; + + destroyed: boolean; + } + + // ConversationsDescriptors + + interface AttachmentCardOptions { + title: string; + description: string; + previewUrl: string; + previewThumbnailUrl: string; + failoverPreviewIconUrl: string; + previewOnClick: (event: PreviewClickEvent) => void; + fileIconImageUrl: string; + buttons: Array; + foldColor?: string; + mimeType?: string; + } + + interface AttachmentCardNoPreviewOptions { + title: string; + description: string; + previewUrl: string; + iconThumbnailUrl: string; + previewOnClick: (event: PreviewClickEvent) => void; + fileIconImageUrl: string; + buttons: Array; + foldColor?: string; + } + + interface PreviewClickEvent { + attachmentCardView: AttachmentCardView; + + preventDefault(): void; + } + + interface ContentPanelDescriptor { + el: HTMLElement; + title: string; + iconUrl: string; + appName?: string; + appIconUrl?: string; + id?: string; + hideTitleBar?: boolean; + orderHint?: number; + } + + interface DownloadButtonDescriptor { + downloadUrl: string; + downloadFilename?: string; + onClick: (event: any) => void; + openInNewTab?: boolean; + } + + interface CustomButtonDescriptor { + iconUrl: string; + tooltip: string; + onClick: (event: AttachmentCardClickEvent) => void; + } + + interface AttachmentCardClickEvent { + getDownloadURL(): Promise; + } + + interface AttachmentsToolbarButtonDescriptor { + tooltip: string; + iconUrl: string; + onClick: (event: AttachmentsToolbarButtonEvent) => void; + } + + interface AttachmentsToolbarButtonEvent { + attachmentCardViews: AttachmentCardView[]; + } + + interface MessageViewLinkDescriptor { + text: string; + html: string; + element: HTMLElement; + href: string; + isInQuotedArea: boolean; + } + + interface MessageAttachmentIconDescriptor { + iconUrl: string; + iconClass?: string; + tooltip: string; + onClick?: () => void; + } + + interface MessageViewToolbarButtonDescriptor { + section: 'MORE'; + title: string; + iconUrl: string; + onClick: () => void; + iconClass?: string; + orderHint: number; + } } - interface MessageAttachmentIconDescriptor { - iconUrl: string; - iconClass?: string; - tooltip: string; - onClick?: () => void; + export namespace Toolbars { + interface Toolbars { + registerThreadButton(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void; + + /** + * @deprecated. use registerThreadButton + * @param toolbarButtonDescriptor + */ + registerToolbarButtonForList(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void; + + /** + * @deprecated. use registerThreadButton + * @param toolbarButtonDescriptor + */ + registerToolbarButtonForThreadView(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void; + + addToolbarButtonForApp(appToolbarButtonDescriptor: AppToolbarButtonDescriptor): AppToolbarButtonView; + } + + interface ToolbarButtonDescriptor { + title: string; + onClick: (event: ToolbarButtonEvent) => void; + iconUrl?: string; + iconClass?: string; + positions?: ToolbarButtonPosition[]; + threadSection?: SectionNames; + listSection?: SectionNames; + hasDropdown?: boolean; + hideFor?: (routeView: Router.RouteView) => void; + orderHint?: number; + keyboardShortcutHandle?: Keyboard.KeyboardShortcutHandle; + } + + type ToolbarButtonPosition = 'THREAD' | 'ROW' | 'LIST'; + + interface ToolbarButtonEvent { + position: ToolbarButtonPosition; + selectedThreadRowViews: Lists.ThreadRowView[]; + selectedThreadViews: Conversations.ThreadView[]; + dropdown?: Common.DropdownView; + } + + interface AppToolbarButtonDescriptor { + title: string; + titleClass?: string; + iconUrl: string; + iconClass?: string; + onClick: (event: AppToolbarButtonEvent) => void; + arrowColor?: string; + } + + interface AppToolbarButtonView { + open(): void; + + close(): void; + + remove(): void; + + on(name: 'destroy', cb: () => void): void; + + destroyed: boolean; + } + + interface AppToolbarButtonEvent { + dropdown: Common.DropdownView; + } + + type SectionNames = 'INBOX_STATE' | 'METADATA_STATE' | 'OTHER'; } - interface MessageViewToolbarButtonDescriptor { - section: 'MORE'; - title: string; - iconUrl: string; - onClick: () => void; - iconClass?: string; - orderHint: number; - } -} - -export namespace Toolbars { - interface Toolbars { - registerThreadButton(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void; - - /** - * @deprecated. use registerThreadButton - * @param toolbarButtonDescriptor - */ - registerToolbarButtonForList(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void; - - /** - * @deprecated. use registerThreadButton - * @param toolbarButtonDescriptor - */ - registerToolbarButtonForThreadView(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void; - - addToolbarButtonForApp(appToolbarButtonDescriptor: AppToolbarButtonDescriptor): AppToolbarButtonView; - } - - interface ToolbarButtonDescriptor { - title: string; - onClick: (event: ToolbarButtonEvent) => void; - iconUrl?: string; - iconClass?: string; - positions?: ToolbarButtonPosition[]; - threadSection?: SectionNames; - listSection?: SectionNames; - hasDropdown?: boolean; - hideFor?: (routeView: Router.RouteView) => void; - orderHint?: number; - keyboardShortcutHandle?: Keyboard.KeyboardShortcutHandle; - } - - type ToolbarButtonPosition = 'THREAD' | 'ROW' | 'LIST'; - - interface ToolbarButtonEvent { - position: ToolbarButtonPosition; - selectedThreadRowViews: Lists.ThreadRowView[]; - selectedThreadViews: Conversations.ThreadView[]; - dropdown?: Common.DropdownView; - } - - interface AppToolbarButtonDescriptor { - title: string; - titleClass?: string; - iconUrl: string; - iconClass?: string; - onClick: (event: AppToolbarButtonEvent) => void; - arrowColor?: string; - } - - interface AppToolbarButtonView { - open(): void; - - close(): void; - - remove(): void; - - on(name: 'destroy', cb: () => void): void; - - destroyed: boolean; - } - - interface AppToolbarButtonEvent { - dropdown: Common.DropdownView; - } - - type SectionNames = 'INBOX_STATE' | 'METADATA_STATE' | 'OTHER'; -} - -export namespace Router { - interface Router { - createLink(routeID: string | NativeRouteIDs, params: RouteParams): string; - - goto(routeID: string | NativeRouteIDs, params: RouteParams): void; - - handleCustomRoute(routeID: string, handler: (customRouteView: CustomRouteView) => void): () => void; - - handleAllRoutes(handler: (routeView: RouteView) => void): () => void; - - handleListRoute(routeID: NativeListRouteIDs, handler: (listRouteView: ListRouteView) => void): () => void; - - handleCustomListRoute(routeID: string, handler: (offset: number, max: number) => CustomListDescriptor | Promise): () => void; - - getCurrentRouteView(): RouteView; - } - - interface CustomListDescriptor { - threads: Array; - total?: number; - hasMore?: boolean; - } - - interface ThreadDescriptor { - rfcMessageId?: string; - gmailThreadId?: string; - } - - interface RouteParams { - [key: number]: string | number; - - [key: string]: string | number; - } - - interface RouteView { - getRouteID(): string; - - getRouteType(): RouteTypes; - - getParams(): RouteParams; - - on(name: 'destroy', cb: () => void): void; - - destroyed: boolean; - } - - type RouteTypes = 'LIST' | 'THREAD' | 'SETTINGS' | 'CHAT' | 'CUSTOM' | 'UNKNOWN'; - - interface CustomRouteView extends RouteView { - getElement(): HTMLElement; - - setFullWidth(fullWidth: boolean): void; - } + export namespace Router { + interface Router { + createLink(routeID: string | NativeRouteIDs, params: RouteParams): string; - interface ListRouteView extends RouteView { - addCollapsibleSection(options: SectionDescriptor): CollapsibleSectionView; + goto(routeID: string | NativeRouteIDs, params: RouteParams): void; - // addCollapsibleSection(options: Stream): CollapsibleSectionView; + handleCustomRoute(routeID: string, handler: (customRouteView: CustomRouteView) => void): () => void; - addSection(options: SectionDescriptor): SectionView; + handleAllRoutes(handler: (routeView: RouteView) => void): () => void; - // addSection(options: Stream): SectionView; + handleListRoute(routeID: NativeListRouteIDs, handler: (listRouteView: ListRouteView) => void): () => void; - refresh(): void; - } - - interface SectionView { - remove(): void; + handleCustomListRoute(routeID: string, handler: (offset: number, max: number) => CustomListDescriptor | Promise): () => void; - on(name: 'destroy', cb: () => void): void; + getCurrentRouteView(): RouteView; + } - destroyed: boolean; - } + interface CustomListDescriptor { + threads: Array; + total?: number; + hasMore?: boolean; + } - interface CollapsibleSectionView extends SectionView { - setCollapsed(value: boolean): void; + interface ThreadDescriptor { + rfcMessageId?: string; + gmailThreadId?: string; + } - remove(): void; + interface RouteParams { + [key: number]: string | number; - on(name: 'destroy' | 'expanded' | 'collapsed', cb: () => void): void; - } + [key: string]: string | number; + } - interface SectionDescriptor { - title: string; - subtitle?: string; - titleLinkText?: string; - onTitleLinkClick?: () => void; - hasDropdown?: boolean; - onDropdownClick?: (event: SectionDropdownClickEvent) => void; - tableRows?: RowDescriptor[]; - contentElement?: HTMLElement; - footerLinkText?: string; - onFooterLinkClick?: (event: any) => void; - } + interface RouteView { + getRouteID(): string; - interface SectionDropdownClickEvent { - dropdown: Common.DropdownView; - } + getRouteType(): RouteTypes; - interface RowDescriptor { - title: string; - body: string; - shortDetailText: string; - isRead: string; - labels: Lists.LabelDescriptor[]; - iconUrl?: string; - iconClass?: string; - routeID?: string; - routeParams?: string[]; - onClick?: () => void; - } + getParams(): RouteParams; + + on(name: 'destroy', cb: () => void): void; + + destroyed: boolean; + } + + type RouteTypes = 'LIST' | 'THREAD' | 'SETTINGS' | 'CHAT' | 'CUSTOM' | 'UNKNOWN'; + + interface CustomRouteView extends RouteView { + getElement(): HTMLElement; + + setFullWidth(fullWidth: boolean): void; + } + + interface ListRouteView extends RouteView { + addCollapsibleSection(options: SectionDescriptor): CollapsibleSectionView; + + // addCollapsibleSection(options: Stream): CollapsibleSectionView; + + addSection(options: SectionDescriptor): SectionView; + + // addSection(options: Stream): SectionView; - type NativeRouteIDs = - 'INBOX' | - 'ALL_MAIL' | - 'SENT' | - 'STARRED' | - 'DRAFTS' | - 'SNOOZED' | - 'DONE' | - 'REMINDERS' | - 'LABEL' | - 'TRASH' | - 'SPAM' | - 'IMPORTANT' | - 'SEARCH' | - 'THREAD' | - 'CHATS' | - 'CHAT' | - 'CONTACTS' | - 'CONTACT' | - 'SETTINGS' | - 'ANY_LIST'; - - type NativeListRouteIDs = - 'INBOX' - | 'ALL_MAIL' - | 'SENT' - | 'STARRED' - | 'DRAFTS' - | 'SNOOZED' - | 'DONE' - | 'REMINDERS' - | 'LABEL' - | 'TRASH' - | 'SPAM' - | 'IMPORTANT' - | 'SEARCH' - | 'ANY_LIST'; -} - -export namespace NavMenu { - interface NavMenu { - addNavItem(navItemDescriptor: NavItemDescriptor): NavItemView; - } + refresh(): void; + } - interface NavItemView { - addNavItem(navItemDescriptor: NavItemDescriptor): NavItemView; + interface SectionView { + remove(): void; - remove(): void; + on(name: 'destroy', cb: () => void): void; - isCollapsed(): boolean; + destroyed: boolean; + } - setCollapsed(collapseValue: boolean): void; + interface CollapsibleSectionView extends SectionView { + setCollapsed(value: boolean): void; - on(name: 'destroy', cb: () => void): void; + remove(): void; - destroyed: boolean; - } + on(name: 'destroy' | 'expanded' | 'collapsed', cb: () => void): void; + } - interface NavItemDescriptor { - name: string; - routeID?: string; - routeParams?: object; + interface SectionDescriptor { + title: string; + subtitle?: string; + titleLinkText?: string; + onTitleLinkClick?: () => void; + hasDropdown?: boolean; + onDropdownClick?: (event: SectionDropdownClickEvent) => void; + tableRows?: RowDescriptor[]; + contentElement?: HTMLElement; + footerLinkText?: string; + onFooterLinkClick?: (event: any) => void; + } + + interface SectionDropdownClickEvent { + dropdown: Common.DropdownView; + } + + interface RowDescriptor { + title: string; + body: string; + shortDetailText: string; + isRead: string; + labels: Lists.LabelDescriptor[]; + iconUrl?: string; + iconClass?: string; + routeID?: string; + routeParams?: string[]; + onClick?: () => void; + } + + type NativeRouteIDs = + 'INBOX' | + 'ALL_MAIL' | + 'SENT' | + 'STARRED' | + 'DRAFTS' | + 'SNOOZED' | + 'DONE' | + 'REMINDERS' | + 'LABEL' | + 'TRASH' | + 'SPAM' | + 'IMPORTANT' | + 'SEARCH' | + 'THREAD' | + 'CHATS' | + 'CHAT' | + 'CONTACTS' | + 'CONTACT' | + 'SETTINGS' | + 'ANY_LIST'; + + type NativeListRouteIDs = + 'INBOX' + | 'ALL_MAIL' + | 'SENT' + | 'STARRED' + | 'DRAFTS' + | 'SNOOZED' + | 'DONE' + | 'REMINDERS' + | 'LABEL' + | 'TRASH' + | 'SPAM' + | 'IMPORTANT' + | 'SEARCH' + | 'ANY_LIST'; + } + + export namespace NavMenu { + interface NavMenu { + addNavItem(navItemDescriptor: NavItemDescriptor): NavItemView; + } + + interface NavItemView { + addNavItem(navItemDescriptor: NavItemDescriptor): NavItemView; + + remove(): void; + + isCollapsed(): boolean; + + setCollapsed(collapseValue: boolean): void; + + on(name: 'destroy', cb: () => void): void; + + destroyed: boolean; + } + + interface NavItemDescriptor { + name: string; + routeID?: string; + routeParams?: object; + + onClick?: (event: { preventDefault(): void }) => void; + + orderHint?: number; + accessory?: CreateAccessoryDescriptor | IconButtonAccessoryDescriptor | DropdownButtonAccessoryDescriptor; + iconUrl?: string; + iconClass?: string; + backgroundColor?: string; + expanderForegroundColor?: string; + type?: NavItemTypes; + } + + interface CreateAccessoryDescriptor { + type: 'CREATE'; + onClick: () => void; + } + + interface IconButtonAccessoryDescriptor { + type: 'ICON_BUTTON'; + onClick: () => void; + iconUrl: string; + iconClass?: string; + } + + interface DropdownButtonAccessoryDescriptor { + type: 'DROPDOWN_BUTTON'; + buttonBackgroundColor: string; + buttonForegroundColor: string; + onClick: (event: DropdownButtonClickEvent) => void; + } + + interface DropdownButtonClickEvent { + dropdown: Common.DropdownView; + } + + type NavItemTypes = 'MANAGE' | 'NAVIGATION'; + } + + export namespace Widgets { + interface WidgetsInstance { + showModalView(options: ModalOptions): ModalView; + + showMoleView(options: MoleOptions): MoleView; + + showDrawerView(options: DrawerOptions): DrawerView; + } + + interface ModalOptions { + el: HTMLElement; + chrome?: boolean; + constrainTitleWidth?: boolean; + showCloseButton?: boolean; + title?: string; + buttons?: ModalButtonDescriptor[]; + } - onClick?: (event: { preventDefault(): void }) => void; + interface ModalButtonDescriptor { + text: string; + title: string; + onClick: () => void; + type?: 'PRIMARY_ACTION' | 'SECONDARY_ACTION'; + color?: string; + orderHint?: number; + } - orderHint?: number; - accessory?: CreateAccessoryDescriptor | IconButtonAccessoryDescriptor | DropdownButtonAccessoryDescriptor; - iconUrl?: string; - iconClass?: string; - backgroundColor?: string; - expanderForegroundColor?: string; - type?: NavItemTypes; - } + interface MoleOptions { + el: HTMLElement; + title?: string; + titleEl?: HTMLElement; + minimizedTitleEl?: HTMLElement; + className?: string; + titleButtons?: MoleButtonDescriptor[]; + chrome?: boolean; + } - interface CreateAccessoryDescriptor { - type: 'CREATE'; - onClick: () => void; - } + interface MoleButtonDescriptor { + title: string; + iconUrl: string; + iconClass?: string; + onClick: () => void; + } - interface IconButtonAccessoryDescriptor { - type: 'ICON_BUTTON'; - onClick: () => void; - iconUrl: string; - iconClass?: string; - } + interface DrawerOptions { + el: HTMLElement; + chrome?: boolean; + title?: string; + composeView?: Compose.ComposeView; + closeWithCompose?: boolean; + } - interface DropdownButtonAccessoryDescriptor { - type: 'DROPDOWN_BUTTON'; - buttonBackgroundColor: string; - buttonForegroundColor: string; - onClick: (event: DropdownButtonClickEvent) => void; - } + interface ModalView { + close(): void; - interface DropdownButtonClickEvent { - dropdown: Common.DropdownView; - } + on(name: 'destroyed', cb: () => void): void; - type NavItemTypes = 'MANAGE' | 'NAVIGATION'; -} + destroyed: boolean; + } -export namespace Widgets { - interface WidgetsInstance { - showModalView(options: ModalOptions): ModalView; + interface MoleView { + close(): void; - showMoleView(options: MoleOptions): MoleView; + setTitle(text: string): void; - showDrawerView(options: DrawerOptions): DrawerView; - } + setMinimized(minimized: boolean): void; - interface ModalOptions { - el: HTMLElement; - chrome?: boolean; - constrainTitleWidth?: boolean; - showCloseButton?: boolean; - title?: string; - buttons?: ModalButtonDescriptor[]; - } + getMinimized(): boolean; - interface ModalButtonDescriptor { - text: string; - title: string; - onClick: () => void; - type?: 'PRIMARY_ACTION' | 'SECONDARY_ACTION'; - color?: string; - orderHint?: number; - } + on(name: 'destroyed' | 'minimize' | 'restore', cb: () => void): void; - interface MoleOptions { - el: HTMLElement; - title?: string; - titleEl?: HTMLElement; - minimizedTitleEl?: HTMLElement; - className?: string; - titleButtons?: MoleButtonDescriptor[]; - chrome?: boolean; - } + destroyed: boolean; + } - interface MoleButtonDescriptor { - title: string; - iconUrl: string; - iconClass?: string; - onClick: () => void; - } + interface DrawerView { + close(): void; - interface DrawerOptions { - el: HTMLElement; - chrome?: boolean; - title?: string; - composeView?: Compose.ComposeView; - closeWithCompose?: boolean; - } + associateComposeView(composeView: Compose.ComposeView, closeWithCompose: boolean): void; - interface ModalView { - close(): void; + disassociateComposeView(): void; - on(name: 'destroyed', cb: () => void): void; + on(name: 'destroyed' | 'slideAnimationDone' | 'closing', cb: () => void): void; - destroyed: boolean; + destroyed: boolean; + } } - - interface MoleView { - close(): void; - setTitle(text: string): void; + export namespace ButterBar { + interface ButterBar { + showMessage(options: MessageDescriptor): object; - setMinimized(minimized: boolean): void; + showLoading(): object; - getMinimized(): boolean; + showError(options: MessageDescriptor): object; - on(name: 'destroyed' | 'minimize' | 'restore', cb: () => void): void; + showSaving(options: SavingMessageDescriptor): object; - destroyed: boolean; - } + hideMessage(messageKey: object | string): void; - interface DrawerView { - close(): void; + hideGmailMessage(): void; + } - associateComposeView(composeView: Compose.ComposeView, closeWithCompose: boolean): void; + interface MessageDescriptorBase { + className?: string; + priority?: number; + time?: number; + hideOnViewChanged?: boolean; + persistent?: boolean; + messageKey?: object | string; + } - disassociateComposeView(): void; + interface MessageDescriptorText extends MessageDescriptorBase { + text: string; + } - on(name: 'destroyed' | 'slideAnimationDone' | 'closing', cb: () => void): void; + interface MessageDescriptorHtml extends MessageDescriptorBase { + html: string; + } - destroyed: boolean; - } -} + interface MessageDescriptorHtmlElement extends MessageDescriptorBase { + el: HTMLElement; + } -export namespace ButterBar { - interface ButterBar { - showMessage(options: MessageDescriptor): object; + type MessageDescriptor = MessageDescriptorText | MessageDescriptorHtml | MessageDescriptorHtmlElement; - showLoading(): object; + interface SavingMessageDescriptorBase extends MessageDescriptorBase { + confirmationText?: string; + confirmationTime?: number; + showConfirmation?: boolean; + } - showError(options: MessageDescriptor): object; + interface SavingMessageDescriptorText extends SavingMessageDescriptorBase { + text: string; + } - showSaving(options: SavingMessageDescriptor): object; + interface SavingMessageDescriptorHtml extends SavingMessageDescriptorBase { + html: string; + } - hideMessage(messageKey: object | string): void; + interface SavingMessageDescriptorHtmlElement extends SavingMessageDescriptorBase { + el: HTMLElement; + } - hideGmailMessage(): void; + type SavingMessageDescriptor = + SavingMessageDescriptorText + | SavingMessageDescriptorHtml + | SavingMessageDescriptorHtmlElement; } - interface MessageDescriptorBase { - className?: string; - priority?: number; - time?: number; - hideOnViewChanged?: boolean; - persistent?: boolean; - messageKey?: object | string; - } + export namespace Search { + interface Search { + registerSearchSuggestionsProvider(handler: (query: string) => AutocompleteSearchResult[] | Promise): void; - interface MessageDescriptorText extends MessageDescriptorBase { - text: string; - } - - interface MessageDescriptorHtml extends MessageDescriptorBase { - html: string; - } + registerSearchQueryRewriter(rewriter: SearchQueryRewriter): void; + } - interface MessageDescriptorHtmlElement extends MessageDescriptorBase { - el: HTMLElement; - } - - type MessageDescriptor = MessageDescriptorText | MessageDescriptorHtml | MessageDescriptorHtmlElement; + interface AutocompleteSearchResultBase { + iconUrl?: string; + routeName?: string; + routeParams?: string[]; + externalURL?: string; + onClick?: () => void; + } - interface SavingMessageDescriptorBase extends MessageDescriptorBase { - confirmationText?: string; - confirmationTime?: number; - showConfirmation?: boolean; - } + interface AutocompleteSearchResultText extends AutocompleteSearchResultBase { + name: string; + description: string; + } - interface SavingMessageDescriptorText extends SavingMessageDescriptorBase { - text: string; - } + interface AutocompleteSearchResultHtml extends AutocompleteSearchResultBase { + nameHTML: string; + descriptionHTML: string; + } - interface SavingMessageDescriptorHtml extends SavingMessageDescriptorBase { - html: string; - } + type AutocompleteSearchResult = AutocompleteSearchResultText | AutocompleteSearchResultHtml; - interface SavingMessageDescriptorHtmlElement extends SavingMessageDescriptorBase { - el: HTMLElement; + interface SearchQueryRewriter { + term: string; + termReplacer: () => string | Promise; + } } - - type SavingMessageDescriptor = - SavingMessageDescriptorText - | SavingMessageDescriptorHtml - | SavingMessageDescriptorHtmlElement; -} -export namespace Search { - interface Search { - registerSearchSuggestionsProvider(handler: (query: string) => AutocompleteSearchResult[] | Promise): void; + export namespace User { + interface User { + getEmailAddress(): string; - registerSearchQueryRewriter(rewriter: SearchQueryRewriter): void; - } + isUsingGmailMaterialUI(): boolean; - interface AutocompleteSearchResultBase { - iconUrl?: string; - routeName?: string; - routeParams?: string[]; - externalURL?: string; - onClick?: () => void; - } + isConversationViewDisabled(): boolean; - interface AutocompleteSearchResultText extends AutocompleteSearchResultBase { - name: string; - description: string; - } + getLanguage(): string; - interface AutocompleteSearchResultHtml extends AutocompleteSearchResultBase { - nameHTML: string; - descriptionHTML: string; + getAccountSwitcherContactList(): Common.Contact[]; + } } - type AutocompleteSearchResult = AutocompleteSearchResultText | AutocompleteSearchResultHtml; + export namespace Keyboard { + interface Keyboard { + createShortcutHandle(keyboardShortcutDescriptor: KeyboardShortcutDescriptor): KeyboardShortcutHandle; + } - interface SearchQueryRewriter { - term: string; - termReplacer: () => string | Promise; - } -} - -export namespace User { - interface User { - getEmailAddress(): string; - - isUsingGmailMaterialUI(): boolean; - - isConversationViewDisabled(): boolean; - - getLanguage(): string; - - getAccountSwitcherContactList(): Common.Contact[]; - } -} - -export namespace Keyboard { - interface Keyboard { - createShortcutHandle(keyboardShortcutDescriptor: KeyboardShortcutDescriptor): KeyboardShortcutHandle; - } - - interface KeyboardShortcutHandle { - remove(): void; - } + interface KeyboardShortcutHandle { + remove(): void; + } - interface KeyboardShortcutDescriptor { - chord: string; - description: string; + interface KeyboardShortcutDescriptor { + chord: string; + description: string; + } } -} -export namespace Global { - interface Global { - addSidebarContentPanel(contentPanelDescriptor: Conversations.ContentPanelDescriptor): Conversations.ContentPanelView; + export namespace Global { + interface Global { + addSidebarContentPanel(contentPanelDescriptor: Conversations.ContentPanelDescriptor): Conversations.ContentPanelView; + } } } diff --git a/types/inboxsdk/tslint.json b/types/inboxsdk/tslint.json index 3db14f85ea..99ea174f67 100644 --- a/types/inboxsdk/tslint.json +++ b/types/inboxsdk/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false + } +}