inboxsdk types

This commit is contained in:
amiram
2018-06-12 01:25:43 +03:00
parent 5928f4fb18
commit 8300a571e0
3 changed files with 126 additions and 151 deletions

View File

@@ -1,19 +1,18 @@
import * as InboxSDK from 'inboxsdk';
import {Common, Compose, Conversations, InboxSDKInstance, Lists, NavMenu, Router} from 'inboxsdk';
import ComposeView = Compose.ComposeView;
import Contact = Common.Contact;
import ThreadRowView = Lists.ThreadRowView;
import ThreadView = Conversations.ThreadView;
import SimpleElementView = Common.SimpleElementView;
import ContentPanelView = Conversations.ContentPanelView;
import MessageView = Conversations.MessageView;
import AttachmentCardView = Conversations.AttachmentCardView;
import AttachmentCardClickEvent = Conversations.AttachmentCardClickEvent;
import MessageViewLinkDescriptor = Conversations.MessageViewLinkDescriptor;
import SectionDescriptor = Router.SectionDescriptor;
import NavItemDescriptor = NavMenu.NavItemDescriptor;
import ComposeView = InboxSDK.Compose.ComposeView;
import Contact = InboxSDK.Common.Contact;
import ThreadRowView = InboxSDK.Lists.ThreadRowView;
import ThreadView = InboxSDK.Conversations.ThreadView;
import SimpleElementView = InboxSDK.Common.SimpleElementView;
import ContentPanelView = InboxSDK.Conversations.ContentPanelView;
import MessageView = InboxSDK.Conversations.MessageView;
import AttachmentCardView = InboxSDK.Conversations.AttachmentCardView;
import AttachmentCardClickEvent = InboxSDK.Conversations.AttachmentCardClickEvent;
import MessageViewLinkDescriptor = InboxSDK.Conversations.MessageViewLinkDescriptor;
import SectionDescriptor = InboxSDK.Router.SectionDescriptor;
import NavItemDescriptor = InboxSDK.NavMenu.NavItemDescriptor;
InboxSDK.load(1, '1234').then((_sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((_sdk: InboxSDK.InboxSDKInstance) => {
_sdk.ButterBar.hideGmailMessage();
});
@@ -28,7 +27,7 @@ InboxSDK.loadScript('https://google.com').then(() => console.log('done'));
InboxSDK.loadScript('https://google.com', {}).then(() => console.log('done'));
InboxSDK.loadScript('https://google.com', {nowrap: true}).then(() => console.log('done'));
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
sdk.ButterBar.showMessage({
text: 'text',
});
@@ -87,9 +86,8 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
sdk.ButterBar.hideGmailMessage();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Compose.registerComposeViewHandler((composeView: ComposeView) => {
composeView.addButton({
title: 'button title',
onClick: e => {
@@ -131,8 +129,8 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
composeView.send({sendAndArchive: true});
const element: HTMLElement = composeView.getBodyElement();
const msgId: String = composeView.getInitialMessageID();
const threadId: String = composeView.getThreadID();
const msgId: string = composeView.getInitialMessageID();
const threadId: string = composeView.getThreadID();
composeView.getDraftID().then(draftId => {
const id: string = draftId.toLowerCase();
});
@@ -142,11 +140,11 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
}
});
const html: String = composeView.getHTMLContent();
const bodyHtml: String = composeView.getSelectedBodyHTML();
const bodyText: String = composeView.getSelectedBodyText();
const subject: String = composeView.getSubject();
const textContent: String = composeView.getTextContent();
const html: string = composeView.getHTMLContent();
const bodyHtml: string = composeView.getSelectedBodyHTML();
const bodyText: string = composeView.getSelectedBodyText();
const subject: string = composeView.getSubject();
const textContent: string = composeView.getTextContent();
const contacts: Contact[] = composeView.getToRecipients();
const contactsCC: Contact[] = composeView.getCcRecipients();
const contactsBCC: Contact[] = composeView.getBccRecipients();
@@ -174,8 +172,8 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
composeView.setCcRecipients(['a@a.com', 'b@b.com']);
composeView.setBccRecipients(['a@a.com', 'b@b.com']);
const fromContact: Common.Contact = composeView.getFromContact();
const fromContacts: Common.Contact[] = composeView.getFromContactChoices();
const fromContact: InboxSDK.Common.Contact = composeView.getFromContact();
const fromContacts: InboxSDK.Common.Contact[] = composeView.getFromContactChoices();
composeView.setFromEmail('a@a.com');
composeView.setSubject('subject');
@@ -194,35 +192,35 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
});
composeView.on('fromContactChanged', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('toContactAdded', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('toContactRemoved', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('ccContactAdded', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('ccContactRemoved', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('bccContactAdded', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('bccContactRemoved', event => {
const c: Common.Contact = event.contact;
const c: InboxSDK.Common.Contact = event.contact;
});
composeView.on('recipientsChanged', event => {
let c: Common.Contact;
let c: InboxSDK.Common.Contact;
c = event.to.added[0];
c = event.to.removed[0];
c = event.cc.added[0];
@@ -265,7 +263,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Lists.registerThreadRowViewHandler((threadRowView: ThreadRowView) => {
threadRowView.addLabel({
title: 'title',
@@ -359,7 +357,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
const count1: number = threadRowView.getVisibleDraftCount();
const count2: number = threadRowView.getVisibleMessageCount();
const contacts: Common.Contact[] = threadRowView.getContacts();
const contacts: InboxSDK.Common.Contact[] = threadRowView.getContacts();
threadRowView.on('destroyed', () => console.log());
@@ -369,7 +367,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Conversations.registerThreadViewHandler((threadView: ThreadView) => {
const noticeBar: SimpleElementView = threadView.addNoticeBar();
noticeBar.destroy();
@@ -415,7 +413,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Conversations.registerMessageViewHandler((messageView: MessageView) => {
const attachmentCardView: AttachmentCardView = messageView.addAttachmentCardView({
title: 'title',
@@ -485,7 +483,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
links[0].text.toLowerCase();
links[0].element.click();
links[0].html.toLowerCase();
links[0].isInQuotedArea === true;
const isInQuotedArea: boolean = links[0].isInQuotedArea;
links[0].href.toLowerCase();
const contact: Contact = messageView.getSender();
@@ -525,7 +523,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Conversations.registerMessageViewHandlerAll((messageView: MessageView) => {
const isLoaded: boolean = messageView.isLoaded();
});
@@ -533,7 +531,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Conversations.registerFileAttachmentCardViewHandler((attachmentCardView: AttachmentCardView) => {
const messageView: MessageView | null = attachmentCardView.getMessageView();
});
@@ -541,7 +539,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const unregister = sdk.Toolbars.registerThreadButton({
hasDropdown: true,
hideFor: (routeView => routeView.getParams()),
@@ -571,7 +569,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
});
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
sdk.Router.createLink('1234', {p1: 1, 0: 1}).toLowerCase();
sdk.Router.goto('1234', {p1: 1, 0: 1});
@@ -595,7 +593,6 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister2();
const unregister3 = sdk.Router.handleListRoute('ALL_MAIL', listRouteView => {
const sectionDescriptor: SectionDescriptor = {
contentElement: new HTMLElement(),
footerLinkText: 'text',
@@ -655,10 +652,9 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
unregister4();
sdk.Router.getCurrentRouteView().getRouteID().toLowerCase();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const navItemDescriptor: NavItemDescriptor = {
accessory: {
type: 'CREATE',
@@ -690,7 +686,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
const destroyed: boolean = navItem.destroyed;
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const modalView = sdk.Widgets.showModalView({
buttons: [{
color: 'red',
@@ -711,7 +707,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
modalView.close();
modalView.on('destroyed', () => {
});
modalView.destroyed === true;
const destroyed: boolean = modalView.destroyed;
const moleView = sdk.Widgets.showMoleView({
chrome: true,
@@ -749,7 +745,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
drawerView.close();
drawerView.disassociateComposeView();
drawerView.destroyed === true;
const destroyed1: boolean = drawerView.destroyed;
drawerView.on('destroyed', () => {
});
drawerView.on('slideAnimationDone', () => {
@@ -758,7 +754,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
});
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const searchResults = [{
iconUrl: 'http://url.com',
onClick: () => {
@@ -793,15 +789,15 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
});
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
sdk.User.getEmailAddress().toLowerCase();
sdk.User.isConversationViewDisabled() === true;
sdk.User.isUsingGmailMaterialUI() === true;
const isConversationViewDisabled: boolean = sdk.User.isConversationViewDisabled();
const isUsingGmailMaterialUI: boolean = sdk.User.isUsingGmailMaterialUI();
sdk.User.getLanguage().toLowerCase();
sdk.User.getAccountSwitcherContactList()[0].name.toLowerCase();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const panel = sdk.Global.addSidebarContentPanel({
el: new HTMLElement(),
title: 'title',
@@ -810,7 +806,7 @@ InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
panel.remove();
});
InboxSDK.load(1, '1234').then((sdk: InboxSDKInstance) => {
InboxSDK.load(1, '1234').then((sdk: InboxSDK.InboxSDKInstance) => {
const handler = sdk.Keyboard.createShortcutHandle({
chord: 'a',
description: 'b'

View File

@@ -1,8 +1,9 @@
// Type definitions for InboxSDK
// Type definitions for InboxSDK 2.0
// Project: https://www.inboxsdk.com/
// Definitions by: Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
// Definitions by: Raphaël Doursenaud <https://github.com/rdoursenaud>
// Amiram Korach <https://github.com/amiram>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/*
* Copyright (c) 2016 GPC.solutions
@@ -20,13 +21,13 @@ export function loadScript(url: string, options?: LoadScriptOptions): Promise<vo
// event: () => any;
// };
interface LoadOptions {
export interface LoadOptions {
appName?: string;
appIconUrl?: string;
suppressAddonTitle?: string;
}
interface LoadScriptOptions {
export interface LoadScriptOptions {
nowrap?: boolean;
}
@@ -45,13 +46,13 @@ export interface InboxSDKInstance {
Global: Global.Global;
}
declare namespace Common {
export interface Contact {
export namespace Common {
interface Contact {
name: string;
emailAddress: string;
}
export interface DropdownView {
interface DropdownView {
setPlacementOptions(options: PositionOptions): void;
close(): void;
@@ -61,19 +62,19 @@ declare namespace Common {
el: HTMLElement;
destroyed: boolean;
on(name: 'destroy', cb: () => void): void
on(name: 'destroy', cb: () => void): void;
on(name: 'preautoclose', cb: (event: PreAutoCloseEvent) => void): void
on(name: 'preautoclose', cb: (event: PreAutoCloseEvent) => void): void;
}
export interface PreAutoCloseEvent {
type: 'outsideInteraction' | 'escape',
cause: Event,
interface PreAutoCloseEvent {
type: 'outsideInteraction' | 'escape';
cause: Event;
cancel(): void;
}
export interface PositionOptions {
interface PositionOptions {
position?: string;
forcePosition?: boolean;
hAlign?: string;
@@ -87,24 +88,24 @@ declare namespace Common {
rightBuffer?: number;
}
export interface SimpleElementView {
interface SimpleElementView {
destroy(): void;
el: HTMLElement;
destroyed: boolean;
on(name: 'destroy', cb: () => void): void
on(name: 'destroy', cb: () => void): void;
}
}
declare namespace Compose {
export interface ComposeInstance {
export namespace Compose {
interface ComposeInstance {
registerComposeViewHandler(handler: (composeView: ComposeView) => void): () => void;
openNewComposeView(): Promise<ComposeView>;
}
export interface ComposeView {
interface ComposeView {
addButton(buttonDescriptor: ComposeButtonDescriptor): void;
addStatusBar(statusBarDescriptor: StatusBarDescriptor): StatusBarView;
@@ -205,17 +206,17 @@ declare namespace Compose {
interface RecipientsChangedEvent {
to: {
added: Common.Contact[],
removed: Common.Contact[]
},
added: Common.Contact[];
removed: Common.Contact[];
};
cc: {
added: Common.Contact[],
removed: Common.Contact[]
},
added: Common.Contact[];
removed: Common.Contact[];
};
bcc: {
added: Common.Contact[],
removed: Common.Contact[]
}
added: Common.Contact[];
removed: Common.Contact[];
};
}
interface ComposeButtonDescriptor {
@@ -248,7 +249,7 @@ declare namespace Compose {
}
}
declare namespace Lists {
export namespace Lists {
interface Lists {
registerThreadRowViewHandler(handler: (threadRowView: ThreadRowView) => any): () => void;
}
@@ -256,31 +257,31 @@ declare namespace Lists {
interface ThreadRowView {
addLabel(labelDescriptor: LabelDescriptor): void;
//addLabel(labelDescriptor: Stream<LabelDescriptor>): void;
// addLabel(labelDescriptor: Stream<LabelDescriptor>): void;
addImage(imageDescriptor: ImageDescriptor): void;
//addImage(imageDescriptor: Stream<ImageDescriptor>): void;
// addImage(imageDescriptor: Stream<ImageDescriptor>): void;
addButton(buttonDescriptor: ThreadRowButtonDescriptor): void;
//addButton(buttonDescriptor: Stream<ThreadRowButtonDescriptor>): void;
// addButton(buttonDescriptor: Stream<ThreadRowButtonDescriptor>): void;
addActionButton(buttonDescriptor: ThreadRowActionButtonDescriptor): void;
//addActionButton(buttonDescriptor: Stream<ThreadRowActionButtonDescriptor>): void;
// addActionButton(buttonDescriptor: Stream<ThreadRowActionButtonDescriptor>): void;
addAttachmentIcon(threadRowAttachmentIconDescriptor: ThreadRowAttachmentIconDescriptor): void
addAttachmentIcon(threadRowAttachmentIconDescriptor: ThreadRowAttachmentIconDescriptor): void;
//addAttachmentIcon(threadRowAttachmentIconDescriptor: stream<ThreadRowAttachmentIconDescriptor>): void
// addAttachmentIcon(threadRowAttachmentIconDescriptor: stream<ThreadRowAttachmentIconDescriptor>): void
replaceDate(threadRowDateDescriptor: ThreadRowDateDescriptor): void;
//replaceDate(threadRowDateDescriptor: Stream<ThreadRowDateDescriptor>): void;
// replaceDate(threadRowDateDescriptor: Stream<ThreadRowDateDescriptor>): void;
replaceDraftLabel(draftLabelDescriptor: ThreadRowDraftLabelDescriptor): void;
//replaceDraftLabel(draftLabelDescriptor: Stream<ThreadRowDraftLabelDescriptor>): void;
// replaceDraftLabel(draftLabelDescriptor: Stream<ThreadRowDraftLabelDescriptor>): void;
getSubject(): string;
@@ -320,14 +321,10 @@ declare namespace Lists {
type: 'LINK';
title: string;
className?: string;
onClick?: (event: ThreadRowActionButtonClickEvent) => void;
onClick?: (event: any) => void;
url: string;
}
interface ThreadRowActionButtonClickEvent {
// FIXME: testme, undocummented
}
interface LabelDescriptor {
title: string;
foregroundColor?: string;
@@ -362,7 +359,7 @@ declare namespace Lists {
}
}
declare namespace Conversations {
export namespace Conversations {
interface Conversations {
registerThreadViewHandler(handler: (threadView: ThreadView) => void): () => void;
@@ -386,9 +383,9 @@ declare namespace Conversations {
getThreadIDAsync(): Promise<string>;
on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void
on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void;
on(name: 'destroy', cb: () => void): void
on(name: 'destroy', cb: () => void): void;
destroyed: boolean;
}
@@ -431,7 +428,7 @@ declare namespace Conversations {
addAttachmentIcon(iconDescriptor: MessageAttachmentIconDescriptor): void;
//addAttachmentIcon(iconDescriptor: Stream<MessageAttachmentIconDescriptor>): void;
// addAttachmentIcon(iconDescriptor: Stream<MessageAttachmentIconDescriptor>): void;
getViewState(): MessageViewViewStates;
@@ -439,9 +436,7 @@ declare namespace Conversations {
on(name: 'contactHover', cb: (event: ContactHoverEvent) => void): void;
on(name: 'load', cb: () => void): void;
on(name: 'destroy', cb: () => void): void;
on(name: 'destroy' | 'load', cb: () => void): void;
destroyed: boolean;
}
@@ -451,11 +446,7 @@ declare namespace Conversations {
interface ContentPanelView {
remove(): void;
on(name: 'activate', cb: () => void): void;
on(name: 'deactivate', cb: () => void): void;
on(name: 'destroy', cb: () => void): void;
on(name: 'destroy' | 'activate' | 'deactivate', cb: () => void): void;
destroyed: boolean;
}
@@ -489,7 +480,7 @@ declare namespace Conversations {
failoverPreviewIconUrl: string;
previewOnClick: (event: PreviewClickEvent) => void;
fileIconImageUrl: string;
buttons: (DownloadButtonDescriptor | CustomButtonDescriptor)[];
buttons: Array<DownloadButtonDescriptor | CustomButtonDescriptor>;
foldColor?: string;
mimeType?: string;
}
@@ -501,7 +492,7 @@ declare namespace Conversations {
iconThumbnailUrl: string;
previewOnClick: (event: PreviewClickEvent) => void;
fileIconImageUrl: string;
buttons: (DownloadButtonDescriptor | CustomButtonDescriptor)[];
buttons: Array<DownloadButtonDescriptor | CustomButtonDescriptor>;
foldColor?: string;
}
@@ -525,14 +516,10 @@ declare namespace Conversations {
interface DownloadButtonDescriptor {
downloadUrl: string;
downloadFilename?: string;
onClick: (event: DownloadButtonClickEvent) => void;
onClick: (event: any) => void;
openInNewTab?: boolean;
}
interface DownloadButtonClickEvent {
// FIXME: testme, undocumented
}
interface CustomButtonDescriptor {
iconUrl: string;
tooltip: string;
@@ -578,7 +565,7 @@ declare namespace Conversations {
}
}
declare namespace Toolbars {
export namespace Toolbars {
interface Toolbars {
registerThreadButton(toolbarButtonDescriptor: ToolbarButtonDescriptor): () => void;
@@ -602,7 +589,7 @@ declare namespace Toolbars {
onClick: (event: ToolbarButtonEvent) => void;
iconUrl?: string;
iconClass?: string;
positions: ToolbarButtonPosition[]
positions: ToolbarButtonPosition[];
threadSection?: SectionNames;
listSection?: SectionNames;
hasDropdown?: boolean;
@@ -636,7 +623,7 @@ declare namespace Toolbars {
remove(): void;
//TODO: Events
on(name: 'destroy', cb: () => void): void;
destroyed: boolean;
}
@@ -648,7 +635,7 @@ declare namespace Toolbars {
type SectionNames = 'INBOX_STATE' | 'METADATA_STATE' | 'OTHER';
}
declare namespace Router {
export namespace Router {
interface Router {
createLink(routeID: string | NativeRouteIDs, params: RouteParams): string;
@@ -666,7 +653,7 @@ declare namespace Router {
}
interface CustomListDescriptor {
threads: (ThreadDescriptor | string)[];
threads: Array<ThreadDescriptor | string>;
total?: number;
hasMore?: boolean;
}
@@ -705,11 +692,11 @@ declare namespace Router {
interface ListRouteView extends RouteView {
addCollapsibleSection(options: SectionDescriptor): CollapsibleSectionView;
//addCollapsibleSection(options: Stream<SectionDescriptor>): CollapsibleSectionView;
// addCollapsibleSection(options: Stream<SectionDescriptor>): CollapsibleSectionView;
addSection(options: SectionDescriptor): SectionView;
//addSection(options: Stream<SectionDescriptor>): SectionView;
// addSection(options: Stream<SectionDescriptor>): SectionView;
refresh(): void;
}
@@ -717,7 +704,7 @@ declare namespace Router {
interface SectionView {
remove(): void;
// TODO: Events
on(name: 'destroy', cb: () => void): void;
destroyed: boolean;
}
@@ -725,9 +712,9 @@ declare namespace Router {
interface CollapsibleSectionView extends SectionView {
setCollapsed(value: boolean): void;
remove(): void
remove(): void;
// TODO: Events
on(name: 'destroy' | 'expanded' | 'collapsed', cb: () => void): void;
}
interface SectionDescriptor {
@@ -740,17 +727,13 @@ declare namespace Router {
tableRows?: RowDescriptor[];
contentElement?: HTMLElement;
footerLinkText?: string;
onFooterLinkClick?: (event: SectionFooterLinkClickEvent) => void;
onFooterLinkClick?: (event: any) => void;
}
interface SectionDropdownClickEvent {
dropdown: Common.DropdownView;
}
interface SectionFooterLinkClickEvent {
// FIXME: testme, undocumented
}
interface RowDescriptor {
title: string;
body: string;
@@ -803,7 +786,7 @@ declare namespace Router {
| 'ANY_LIST';
}
declare namespace NavMenu {
export namespace NavMenu {
interface NavMenu {
addNavItem(navItemDescriptor: NavItemDescriptor): NavItemView;
}
@@ -825,7 +808,7 @@ declare namespace NavMenu {
interface NavItemDescriptor {
name: string;
routeID?: string;
routeParams?: Object;
routeParams?: object;
onClick?: (event: { preventDefault(): void }) => void;
@@ -861,15 +844,10 @@ declare namespace NavMenu {
dropdown: Common.DropdownView;
}
// Undocumented
type NavItemTypes = 'MANAGE' | 'NAVIGATION';
// Undocumented
var SENT_MAIL: Object;
}
declare namespace Widgets {
export namespace Widgets {
interface WidgetsInstance {
showModalView(options: ModalOptions): ModalView;
@@ -956,17 +934,17 @@ declare namespace Widgets {
}
}
declare namespace ButterBar {
export namespace ButterBar {
interface ButterBar {
showMessage(options: MessageDescriptor): Object;
showMessage(options: MessageDescriptor): object;
showLoading(): Object;
showLoading(): object;
showError(options: MessageDescriptor): Object;
showError(options: MessageDescriptor): object;
showSaving(options: SavingMessageDescriptor): Object;
showSaving(options: SavingMessageDescriptor): object;
hideMessage(messageKey: Object): void;
hideMessage(messageKey: object | string): void;
hideGmailMessage(): void;
}
@@ -977,7 +955,7 @@ declare namespace ButterBar {
time?: number;
hideOnViewChanged?: boolean;
persistent?: boolean;
messageKey?: Object;
messageKey?: object | string;
}
interface MessageDescriptorText extends MessageDescriptorBase {
@@ -1018,7 +996,7 @@ declare namespace ButterBar {
| SavingMessageDescriptorHtmlElement;
}
declare namespace Search {
export namespace Search {
interface Search {
registerSearchSuggestionsProvider(handler: (query: string) => AutocompleteSearchResult[] | Promise<AutocompleteSearchResult[]>): void;
@@ -1028,7 +1006,7 @@ declare namespace Search {
interface AutocompleteSearchResultBase {
iconUrl?: string;
routeName?: string;
routeParams?: string[]
routeParams?: string[];
externalURL?: string;
onClick?: () => void;
}
@@ -1051,7 +1029,7 @@ declare namespace Search {
}
}
declare namespace User {
export namespace User {
interface User {
getEmailAddress(): string;
@@ -1065,7 +1043,7 @@ declare namespace User {
}
}
declare namespace Keyboard {
export namespace Keyboard {
interface Keyboard {
createShortcutHandle(keyboardShortcutDescriptor: KeyboardShortcutDescriptor): KeyboardShortcutHandle;
}
@@ -1080,8 +1058,8 @@ declare namespace Keyboard {
}
}
declare namespace Global {
export namespace Global {
interface Global {
addSidebarContentPanel(contentPanelDescriptor: Conversations.ContentPanelDescriptor): Conversations.ContentPanelView;
}
}
}

View File

@@ -8,6 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"