@inboxsdk/core 0.1.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background.d.ts +1 -0
- package/background.js +16 -0
- package/inboxsdk.d.ts +802 -0
- package/inboxsdk.js +56 -59
- package/package.json +14 -4
- package/pageWorld.d.ts +1 -0
package/inboxsdk.d.ts
ADDED
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import * as Kefir from 'kefir';
|
|
3
|
+
import TypedEmitter from 'typed-emitter';
|
|
4
|
+
|
|
5
|
+
export const LOADER_VERSION: string;
|
|
6
|
+
export interface LoadScriptOptions {
|
|
7
|
+
// By default, the script is executed within a function, so that top-level
|
|
8
|
+
// variables defined in it don't become global variables. Setting nowrap to
|
|
9
|
+
// true disables this behavior.
|
|
10
|
+
nowrap?: boolean;
|
|
11
|
+
disableSourceMappingURL?: boolean;
|
|
12
|
+
XMLHttpRequest?: typeof XMLHttpRequest;
|
|
13
|
+
}
|
|
14
|
+
export function loadScript(
|
|
15
|
+
url: string,
|
|
16
|
+
opts?: LoadScriptOptions
|
|
17
|
+
): Promise<void>;
|
|
18
|
+
export function load(
|
|
19
|
+
version: number,
|
|
20
|
+
appId: string,
|
|
21
|
+
opts: any
|
|
22
|
+
): Promise<InboxSDK>;
|
|
23
|
+
|
|
24
|
+
// types
|
|
25
|
+
|
|
26
|
+
export interface InboxSDK {
|
|
27
|
+
Conversations: Conversations;
|
|
28
|
+
Compose: Compose;
|
|
29
|
+
ButterBar: ButterBar;
|
|
30
|
+
Lists: Lists;
|
|
31
|
+
Logger: {
|
|
32
|
+
event(name: string, extras: any): void;
|
|
33
|
+
error: (
|
|
34
|
+
err: Error & { details?: Record<string, any> },
|
|
35
|
+
options: Record<string, any>
|
|
36
|
+
) => void;
|
|
37
|
+
};
|
|
38
|
+
NavMenu: NavMenu;
|
|
39
|
+
Router: Router;
|
|
40
|
+
Widgets: Widgets;
|
|
41
|
+
Toolbars: Toolbars;
|
|
42
|
+
User: User;
|
|
43
|
+
Keyboard: Keyboard;
|
|
44
|
+
Search: Search;
|
|
45
|
+
Global: Global;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface Global {
|
|
49
|
+
addSidebarContentPanel(
|
|
50
|
+
contentPanelDescriptor: ContentPanelDescriptor
|
|
51
|
+
): Promise<ContentPanelView | null>;
|
|
52
|
+
addSupportItem(
|
|
53
|
+
supportItemDescriptor: SupportItemDescriptor
|
|
54
|
+
): GmailSupportItemView;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface GmailSupportItemView {
|
|
58
|
+
destroy(): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SupportItemDescriptor {
|
|
62
|
+
element: HTMLElement;
|
|
63
|
+
onClick(): void;
|
|
64
|
+
}
|
|
65
|
+
export interface Conversations {
|
|
66
|
+
registerThreadViewHandler(
|
|
67
|
+
callback: (threadView: ThreadView) => void
|
|
68
|
+
): () => void;
|
|
69
|
+
registerMessageViewHandler(
|
|
70
|
+
callback: (messageView: MessageView) => void
|
|
71
|
+
): () => void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface Compose {
|
|
75
|
+
openDraftByMessageID(messageId: string): Promise<ComposeView>;
|
|
76
|
+
openNewComposeView(): Promise<ComposeView>;
|
|
77
|
+
registerComposeViewHandler(handler: (composeView: ComposeView) => void): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ButterBar {
|
|
81
|
+
showMessage(messageDescriptor: MessageDescriptor): { destroy: () => void };
|
|
82
|
+
showLoading(
|
|
83
|
+
messageDescriptor: LoadingMessageDescriptor
|
|
84
|
+
): { destroy: () => void };
|
|
85
|
+
showError(messageDescriptor: MessageDescriptor): { destroy: () => void };
|
|
86
|
+
showSaving(
|
|
87
|
+
messageDescriptor: SavingMessageDescriptor
|
|
88
|
+
): {
|
|
89
|
+
resolve: () => void;
|
|
90
|
+
reject: () => void;
|
|
91
|
+
promise: Promise<any>;
|
|
92
|
+
};
|
|
93
|
+
hideMessage(messageKey: Record<string, any> | string): void;
|
|
94
|
+
hideGmailMessage(): void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// todo:
|
|
98
|
+
// export interface CreateAccessoryDescriptor {}
|
|
99
|
+
// export interface IconButtonAccessoryDescriptor {}
|
|
100
|
+
// export interface DropdownButtonAccessoryDescriptor {}
|
|
101
|
+
|
|
102
|
+
type NavItemTypes = {
|
|
103
|
+
GROUPER: 'GROUPER';
|
|
104
|
+
LINK: 'LINK';
|
|
105
|
+
NAVIGATION: 'NAVIGATION';
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export interface NavItemDescriptor {
|
|
109
|
+
name: string;
|
|
110
|
+
routeID?: string | null;
|
|
111
|
+
routeParams?: object | null;
|
|
112
|
+
onClick?: () => void | null;
|
|
113
|
+
orderHint?: number;
|
|
114
|
+
// todo: accessory: CreateAccessoryDescriptor | IconButtonAccessoryDescriptor | DropdownButtonAccessoryDescriptor
|
|
115
|
+
accessory?: any;
|
|
116
|
+
iconUrl?: string | null;
|
|
117
|
+
iconClass?: string | null;
|
|
118
|
+
iconElement?: HTMLElement | null;
|
|
119
|
+
backgroundColor?: string | null;
|
|
120
|
+
expanderForegroundColor?: string | null;
|
|
121
|
+
type?: keyof NavItemTypes;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface NativeNavItemView extends EventEmitter {
|
|
125
|
+
addNavItem(descriptor: NavItemDescriptor): NavItemView;
|
|
126
|
+
setCollapsed(collapseState: boolean): void;
|
|
127
|
+
isCollapsed(): boolean;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface NavMenu {
|
|
131
|
+
SENT_MAIL: NativeNavItemView;
|
|
132
|
+
NavItemTypes: NavItemTypes;
|
|
133
|
+
addNavItem(
|
|
134
|
+
descriptor: NavItemDescriptor | Kefir.Observable<NavItemDescriptor, any>
|
|
135
|
+
): NavItemView;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface Router {
|
|
139
|
+
createLink(routeID: string, params?: any): string;
|
|
140
|
+
getCurrentRouteView(): RouteView;
|
|
141
|
+
goto(routeID: string, params?: any): Promise<void>;
|
|
142
|
+
handleAllRoutes(handler: (routeView: RouteView) => void): () => void;
|
|
143
|
+
handleCustomRoute(
|
|
144
|
+
routeID: string,
|
|
145
|
+
handler: (customRouteView: CustomRouteView) => void
|
|
146
|
+
): () => void;
|
|
147
|
+
handleCustomListRoute(
|
|
148
|
+
routeID: string,
|
|
149
|
+
handler: (offset: number, max: number) => void
|
|
150
|
+
): void;
|
|
151
|
+
handleListRoute(
|
|
152
|
+
routeID: string,
|
|
153
|
+
handler: (listRouteView: ListRouteView) => void
|
|
154
|
+
): () => void;
|
|
155
|
+
NativeRouteIDs: Record<NativeRouteIdTypes, string>;
|
|
156
|
+
NativeListRouteIDs: Record<
|
|
157
|
+
| 'ALL_MAIL'
|
|
158
|
+
| 'ANY_LIST'
|
|
159
|
+
| 'DRAFTS'
|
|
160
|
+
| 'IMPORTANT'
|
|
161
|
+
| 'INBOX'
|
|
162
|
+
| 'LABEL'
|
|
163
|
+
| 'SEARCH'
|
|
164
|
+
| 'SEARCH'
|
|
165
|
+
| 'SENT'
|
|
166
|
+
| 'SPAM'
|
|
167
|
+
| 'STARRED'
|
|
168
|
+
| 'TRASH',
|
|
169
|
+
string
|
|
170
|
+
>;
|
|
171
|
+
RouteTypes: Record<RouteTypes, string>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type NativeRouteIdTypes =
|
|
175
|
+
| 'INBOX'
|
|
176
|
+
| 'ALL_MAIL'
|
|
177
|
+
| 'SENT'
|
|
178
|
+
| 'STARRED'
|
|
179
|
+
| 'DRAFTS'
|
|
180
|
+
| 'SNOOZED'
|
|
181
|
+
| 'DONE'
|
|
182
|
+
| 'REMINDERS'
|
|
183
|
+
| 'LABEL'
|
|
184
|
+
| 'TRASH'
|
|
185
|
+
| 'SPAM'
|
|
186
|
+
| 'IMPORTANT'
|
|
187
|
+
| 'SEARCH'
|
|
188
|
+
| 'THREAD'
|
|
189
|
+
| 'CHATS'
|
|
190
|
+
| 'CHAT'
|
|
191
|
+
| 'CONTACTS'
|
|
192
|
+
| 'CONTACT'
|
|
193
|
+
| 'SETTINGS'
|
|
194
|
+
| 'ANY_LIST';
|
|
195
|
+
|
|
196
|
+
type RouteTypes =
|
|
197
|
+
| 'CHAT'
|
|
198
|
+
| 'CUSTOM'
|
|
199
|
+
| 'LIST'
|
|
200
|
+
| 'SETTINGS'
|
|
201
|
+
| 'THREAD'
|
|
202
|
+
| 'UNKNOWN';
|
|
203
|
+
|
|
204
|
+
export interface Widgets {
|
|
205
|
+
showModalView(descriptor: ModalDescriptor): ModalView;
|
|
206
|
+
showMoleView(descriptor: MoleDescriptor): MoleView;
|
|
207
|
+
showDrawerView(descriptor: DrawerDescriptor): DrawerView;
|
|
208
|
+
showTopMessageBarView(opts: { el: Element }): Element;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface Toolbars {
|
|
212
|
+
addToolbarButtonForApp(
|
|
213
|
+
descriptor:
|
|
214
|
+
| AppToolbarButtonDescriptor
|
|
215
|
+
| Kefir.Stream<AppToolbarButtonDescriptor, any>
|
|
216
|
+
): AppToolbarButtonView;
|
|
217
|
+
registerThreadButton(descriptor: ToolbarButtonDescriptor): () => void;
|
|
218
|
+
registerToolbarButtonForThreadView(
|
|
219
|
+
descriptor: LegacyToolbarButtonDescriptor
|
|
220
|
+
): () => void;
|
|
221
|
+
SectionNames: {
|
|
222
|
+
INBOX_STATE: 'INBOX_STATE';
|
|
223
|
+
METADATA_STATE: 'METADATA_STATE';
|
|
224
|
+
OTHER: 'OTHER';
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface AppToolbarButtonDescriptor {
|
|
229
|
+
title: string;
|
|
230
|
+
titleClass?: string;
|
|
231
|
+
iconUrl: string;
|
|
232
|
+
iconClass?: string;
|
|
233
|
+
onClick: (e: MouseEvent) => void;
|
|
234
|
+
arrowColor?: string | null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export type AppToolbarButtonView = {
|
|
238
|
+
open(): void;
|
|
239
|
+
close(): void;
|
|
240
|
+
remove(): void;
|
|
241
|
+
} & TypedEmitter<{ destroy: () => void }>;
|
|
242
|
+
|
|
243
|
+
export interface Keyboard {
|
|
244
|
+
createShortcutHandle(
|
|
245
|
+
descriptor: KeyboardShortcutDescriptor
|
|
246
|
+
): KeyboardShortcutHandle;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface Search {
|
|
250
|
+
registerSearchSuggestionsProvider(
|
|
251
|
+
handler: (
|
|
252
|
+
query: string
|
|
253
|
+
) =>
|
|
254
|
+
| Array<AutocompleteSearchResult>
|
|
255
|
+
| Promise<Array<AutocompleteSearchResult>>
|
|
256
|
+
): void;
|
|
257
|
+
registerSearchQueryRewriter(rewriter: SearchQueryRewriter): void;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface Lists {
|
|
261
|
+
registerThreadRowViewHandler(
|
|
262
|
+
handler: (threadRowView: ThreadRowView) => void
|
|
263
|
+
): () => void;
|
|
264
|
+
getSelectedThreadRowViews(): ThreadRowView[];
|
|
265
|
+
registerThreadRowViewSelectionHandler(handler: () => void): () => void;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface User {
|
|
269
|
+
/** @deprecated */
|
|
270
|
+
getAccountSwitcherContactList(): Contact[];
|
|
271
|
+
getEmailAddress(): string;
|
|
272
|
+
getLanguage(): string;
|
|
273
|
+
isConversationViewDisabled(): Promise<boolean>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface Destroyable extends EventEmitter {
|
|
277
|
+
readonly destroyed: boolean;
|
|
278
|
+
addListener(event: 'destroy', listener: () => void): this;
|
|
279
|
+
// emit(event: "destroy"): boolean;
|
|
280
|
+
on(event: 'destroy', listener: () => void): this;
|
|
281
|
+
off(event: 'destroy', listener: () => void): this;
|
|
282
|
+
once(event: 'destroy', listener: () => void): this;
|
|
283
|
+
prependListener(event: 'destroy', listener: () => void): this;
|
|
284
|
+
prependOnceListener(event: 'destroy', listener: () => void): this;
|
|
285
|
+
removeListener(event: 'destroy', listener: () => void): this;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface ImageDescriptor {
|
|
289
|
+
imageUrl?: string;
|
|
290
|
+
imageClass?: string;
|
|
291
|
+
tooltip?: string;
|
|
292
|
+
orderHint?: number;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface ThreadRowView extends Destroyable {
|
|
296
|
+
addLabel(labelDescriptor: LabelDescriptor | any): void;
|
|
297
|
+
addAttachmentIcon(threadRowAttachmentIconDescriptor: any): void;
|
|
298
|
+
addImage(
|
|
299
|
+
imageDescriptor:
|
|
300
|
+
| ImageDescriptor
|
|
301
|
+
| Kefir.Observable<ImageDescriptor | null, any>
|
|
302
|
+
): void;
|
|
303
|
+
getElement(): HTMLElement;
|
|
304
|
+
getVisibleDraftCount(): number;
|
|
305
|
+
getThreadIDIfStable(): string | null;
|
|
306
|
+
getThreadIDIfStableAsync(): Promise<string | null>;
|
|
307
|
+
addButton(threadRowButtonDescriptor: any): void;
|
|
308
|
+
getThreadID(): string;
|
|
309
|
+
getThreadIDAsync(): Promise<string>;
|
|
310
|
+
getDraftID(): Promise<string>;
|
|
311
|
+
replaceDate(
|
|
312
|
+
threadDateDescriptor:
|
|
313
|
+
| ThreadDateDescriptor
|
|
314
|
+
| null
|
|
315
|
+
| Kefir.Observable<ThreadDateDescriptor | null, any>
|
|
316
|
+
): void;
|
|
317
|
+
getVisibleMessageCount(): number;
|
|
318
|
+
getSubject(): string;
|
|
319
|
+
getContacts(): Array<{ name: string | null; emailAddress: string }>;
|
|
320
|
+
replaceDraftLabel(
|
|
321
|
+
descriptor:
|
|
322
|
+
| DraftLabelDescriptor
|
|
323
|
+
| null
|
|
324
|
+
| Kefir.Observable<DraftLabelDescriptor | null, any>
|
|
325
|
+
): void;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface ThreadDateDescriptor {
|
|
329
|
+
text: string;
|
|
330
|
+
tooltip?: string;
|
|
331
|
+
textColor?: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface DraftLabelDescriptor {
|
|
335
|
+
text: string;
|
|
336
|
+
count?: string | number;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface LabelDescriptor {
|
|
340
|
+
title: string;
|
|
341
|
+
iconUrl: string;
|
|
342
|
+
iconClass?: string;
|
|
343
|
+
foregroundColor?: string;
|
|
344
|
+
backgroundColor?: string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface ThreadRowAttachmentIconDescriptor {
|
|
348
|
+
iconUrl?: string;
|
|
349
|
+
iconClass?: string;
|
|
350
|
+
tooltip?: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface NavItemView extends EventEmitter {
|
|
354
|
+
addNavItem(descriptor: any): NavItemView;
|
|
355
|
+
remove(): void;
|
|
356
|
+
setCollapsed(collapseState: boolean): void;
|
|
357
|
+
isCollapsed(): boolean;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface SectionView extends EventEmitter {
|
|
361
|
+
remove(): void;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface CollapsibleSectionView extends SectionView {
|
|
365
|
+
setCollapsed(value: boolean): void;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface RouteView extends EventEmitter {
|
|
369
|
+
getRouteID(): string | null;
|
|
370
|
+
getRouteType(): string;
|
|
371
|
+
getParams(): { [key: string]: string };
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface ListRouteView extends RouteView {
|
|
375
|
+
addCollapsibleSection(options: any): CollapsibleSectionView;
|
|
376
|
+
addSection(options: any): SectionView;
|
|
377
|
+
refresh(): void;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface CustomRouteView extends RouteView {
|
|
381
|
+
getElement(): HTMLElement;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface CustomListDescriptor {
|
|
385
|
+
hasMore?: boolean;
|
|
386
|
+
threads: string | Array<ThreadDescriptor>;
|
|
387
|
+
total?: number;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface ThreadDescriptor {
|
|
391
|
+
gmailThreadId?: string;
|
|
392
|
+
rfcMessageId?: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export interface ModalDescriptor {
|
|
396
|
+
el: HTMLElement;
|
|
397
|
+
chrome?: boolean;
|
|
398
|
+
constrainTitleWidth?: boolean;
|
|
399
|
+
showCloseButton?: boolean;
|
|
400
|
+
title?: string;
|
|
401
|
+
buttons?: Array<ModalButtonDescriptor>;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export interface ModalButtonDescriptor {
|
|
405
|
+
text: string;
|
|
406
|
+
title?: string;
|
|
407
|
+
onClick(event: { modalView: ModalView }): any;
|
|
408
|
+
type?: 'PRIMARY_ACTION' | 'SECONDARY_ACTION';
|
|
409
|
+
orderHint?: number;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export interface ModalView extends EventEmitter {
|
|
413
|
+
close(): void;
|
|
414
|
+
setTitle(s: string): void;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface DrawerView extends EventEmitter {
|
|
418
|
+
close(): void;
|
|
419
|
+
associateComposeView(
|
|
420
|
+
composeView: ComposeView,
|
|
421
|
+
closeWithCompose?: boolean
|
|
422
|
+
): void;
|
|
423
|
+
disassociateComposeView(): void;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface DrawerDescriptor {
|
|
427
|
+
el: HTMLElement;
|
|
428
|
+
chrome?: boolean;
|
|
429
|
+
title?: string;
|
|
430
|
+
composeView?: ComposeView;
|
|
431
|
+
closeWithCompose?: boolean;
|
|
432
|
+
matchSidebarContentPanelWidth?: boolean;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface MoleDescriptor {
|
|
436
|
+
el: HTMLElement;
|
|
437
|
+
title?: string;
|
|
438
|
+
titleEl?: HTMLElement;
|
|
439
|
+
minimizedTitleEl?: HTMLElement;
|
|
440
|
+
className?: string;
|
|
441
|
+
titleButtons?: Array<ButtonDescriptor>;
|
|
442
|
+
chrome?: boolean;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export interface ButtonDescriptor {
|
|
446
|
+
title?: string;
|
|
447
|
+
iconUrl?: string;
|
|
448
|
+
iconClass?: string;
|
|
449
|
+
hasDropdown?: boolean;
|
|
450
|
+
onClick(): void;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export interface MoleView extends EventEmitter {
|
|
454
|
+
close(): void;
|
|
455
|
+
getMinimized(): boolean;
|
|
456
|
+
setMinimized(value: boolean): void;
|
|
457
|
+
setTitle(title: string): void;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface SimpleElementView extends EventEmitter {
|
|
461
|
+
el: HTMLElement;
|
|
462
|
+
destroyed: boolean;
|
|
463
|
+
destroy(): void;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export interface ThreadView extends EventEmitter {
|
|
467
|
+
addLabel(): SimpleElementView;
|
|
468
|
+
addSidebarContentPanel(
|
|
469
|
+
contentPanelDescriptor: ContentPanelDescriptor
|
|
470
|
+
): ContentPanelView;
|
|
471
|
+
getMessageViews(): Array<MessageView>;
|
|
472
|
+
getMessageViewsAll(): Array<MessageView>;
|
|
473
|
+
getSubject(): string;
|
|
474
|
+
/**
|
|
475
|
+
* @deprecated
|
|
476
|
+
*/
|
|
477
|
+
getThreadID(): string;
|
|
478
|
+
getThreadIDAsync(): Promise<string>;
|
|
479
|
+
addNoticeBar(): SimpleElementView;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export interface UNSTABLE_ThreadView extends ThreadView {
|
|
483
|
+
//#region Undocumented methods
|
|
484
|
+
/**
|
|
485
|
+
* @internal
|
|
486
|
+
*/
|
|
487
|
+
addCustomMessage: (descriptor: {
|
|
488
|
+
collapsedEl: HTMLElement;
|
|
489
|
+
headerEl: HTMLElement;
|
|
490
|
+
bodyEl: HTMLElement;
|
|
491
|
+
iconUrl: string;
|
|
492
|
+
sortDate: Date;
|
|
493
|
+
}) => CustomMessageView;
|
|
494
|
+
/**
|
|
495
|
+
* @internal
|
|
496
|
+
*/
|
|
497
|
+
registerHiddenCustomMessageNoticeProvider: (
|
|
498
|
+
provider: (
|
|
499
|
+
numCustomHidden: number,
|
|
500
|
+
numberNativeHidden: number,
|
|
501
|
+
unmountPromise: Promise<void>
|
|
502
|
+
) => HTMLElement | null
|
|
503
|
+
) => void;
|
|
504
|
+
//#endregion
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface CustomMessageView extends EventEmitter {
|
|
508
|
+
destroy(): void;
|
|
509
|
+
expand(): void;
|
|
510
|
+
collapse(): void;
|
|
511
|
+
getElement(): HTMLElement;
|
|
512
|
+
getSortDate(): Date | null;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export interface ContentPanelView extends EventEmitter {
|
|
516
|
+
close(): void;
|
|
517
|
+
isActive(): boolean;
|
|
518
|
+
open(): void;
|
|
519
|
+
remove(): void;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export interface ContentPanelDescriptor {
|
|
523
|
+
el: HTMLElement;
|
|
524
|
+
title: string;
|
|
525
|
+
iconUrl?: string;
|
|
526
|
+
iconClass?: string;
|
|
527
|
+
orderHint?: number;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export interface MessageAttachmentIconDescriptor {
|
|
531
|
+
iconUrl: string;
|
|
532
|
+
iconClass?: string;
|
|
533
|
+
iconHtml?: string | null;
|
|
534
|
+
tooltip: string | HTMLElement;
|
|
535
|
+
onClick: () => void;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export type AttachmentIcon = TypedEmitter<{
|
|
539
|
+
tooltipHidden: () => void;
|
|
540
|
+
tooltipShown: () => void;
|
|
541
|
+
}>;
|
|
542
|
+
|
|
543
|
+
export type MessageViewToolbarSectionNames = 'MORE';
|
|
544
|
+
|
|
545
|
+
export interface MessageViewToolbarButtonDescriptor {
|
|
546
|
+
section: MessageViewToolbarSectionNames;
|
|
547
|
+
title: string;
|
|
548
|
+
iconUrl?: string;
|
|
549
|
+
iconClass?: string;
|
|
550
|
+
onClick: (e: MouseEvent) => void;
|
|
551
|
+
orderHint?: number;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface MessageView extends EventEmitter {
|
|
555
|
+
addAttachmentIcon(
|
|
556
|
+
opts:
|
|
557
|
+
| MessageAttachmentIconDescriptor
|
|
558
|
+
| Kefir.Stream<MessageAttachmentIconDescriptor, never>
|
|
559
|
+
): AttachmentIcon;
|
|
560
|
+
addToolbarButton(opts?: MessageViewToolbarButtonDescriptor): void;
|
|
561
|
+
getBodyElement(): HTMLElement;
|
|
562
|
+
isElementInQuotedArea(element: HTMLElement): boolean;
|
|
563
|
+
isLoaded(): boolean;
|
|
564
|
+
getSender(): Contact;
|
|
565
|
+
getRecipients(): Array<Contact>;
|
|
566
|
+
getRecipientsFull(): Promise<Array<Contact>>;
|
|
567
|
+
getLinksInBody(): Array<MessageViewLinkDescriptor>;
|
|
568
|
+
getThreadView(): ThreadView;
|
|
569
|
+
getMessageIDAsync(): Promise<string>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export interface Contact {
|
|
573
|
+
name: string;
|
|
574
|
+
emailAddress: string;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export interface MessageViewLinkDescriptor {
|
|
578
|
+
text: string;
|
|
579
|
+
html: string;
|
|
580
|
+
element: HTMLElement;
|
|
581
|
+
href: string;
|
|
582
|
+
isInQuotedArea: boolean;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export interface ToolbarButtonDescriptor {
|
|
586
|
+
title: string;
|
|
587
|
+
iconUrl?: string;
|
|
588
|
+
iconClass?: string;
|
|
589
|
+
positions?: Array<'THREAD' | 'ROW' | 'LIST'> | null;
|
|
590
|
+
threadSection?: string;
|
|
591
|
+
listSection?: string;
|
|
592
|
+
onClick(event: ToolbarButtonOnClickEvent): void;
|
|
593
|
+
hasDropdown: boolean;
|
|
594
|
+
hideFor?: (routeView: RouteView) => boolean;
|
|
595
|
+
keyboardShortcutHandle?: KeyboardShortcutHandle;
|
|
596
|
+
orderHint?: number;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export interface LegacyToolbarButtonDescriptor {
|
|
600
|
+
title: string;
|
|
601
|
+
iconUrl?: string;
|
|
602
|
+
iconClass?: string;
|
|
603
|
+
section: 'INBOX_STATE' | 'METADATA_STATE' | 'OTHER';
|
|
604
|
+
onClick(event: ToolbarButtonOnClickEvent): void;
|
|
605
|
+
hasDropdown?: boolean;
|
|
606
|
+
hideFor?: (routeView: RouteView) => boolean;
|
|
607
|
+
keyboardShortcutHandle?: KeyboardShortcutHandle;
|
|
608
|
+
orderHint?: number;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
export interface ToolbarButtonOnClickEvent {
|
|
612
|
+
selectedThreadViews: Array<ThreadView>;
|
|
613
|
+
selectedThreadRowViews: Array<ThreadRowView>;
|
|
614
|
+
dropdown?: DropdownView;
|
|
615
|
+
threadView?: ThreadView;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export interface KeyboardShortcutDescriptor {
|
|
619
|
+
chord: string;
|
|
620
|
+
description: string;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
export interface KeyboardShortcutHandle {
|
|
624
|
+
remove(): void;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export interface DropdownView extends EventEmitter {
|
|
628
|
+
close(): void;
|
|
629
|
+
el: HTMLElement;
|
|
630
|
+
destroyed: boolean;
|
|
631
|
+
reposition(): void;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export interface ComposeView extends EventEmitter {
|
|
635
|
+
destroyed: boolean;
|
|
636
|
+
addButton(
|
|
637
|
+
buttonOptions:
|
|
638
|
+
| ComposeButtonDescriptor
|
|
639
|
+
| Kefir.Observable<ComposeButtonDescriptor, any>
|
|
640
|
+
): void;
|
|
641
|
+
addComposeNotice(): ComposeNoticeView;
|
|
642
|
+
addRecipientRow(
|
|
643
|
+
RecipientRowOptions:
|
|
644
|
+
| RecipientRowOptions
|
|
645
|
+
| Kefir.Observable<RecipientRowOptions, any>
|
|
646
|
+
): { destroy(): void };
|
|
647
|
+
addStatusBar(statusBarDescriptor: StatusBarDescriptor): StatusBarView;
|
|
648
|
+
close(): void;
|
|
649
|
+
ensureAppButtonToolbarsAreClosed(): void;
|
|
650
|
+
ensureFormattingToolbarIsHidden(): void;
|
|
651
|
+
forceRecipientRowsOpen(): () => void;
|
|
652
|
+
getBccRecipients(): Array<Contact>;
|
|
653
|
+
getBodyElement(): HTMLElement;
|
|
654
|
+
getCcRecipients(): Array<Contact>;
|
|
655
|
+
getCurrentDraftID(): Promise<string | null>;
|
|
656
|
+
getElement(): HTMLElement;
|
|
657
|
+
getDraftID(): Promise<string | null>;
|
|
658
|
+
getMessageIDAsync(): Promise<string>;
|
|
659
|
+
getSubject(): string;
|
|
660
|
+
getSubjectInput(): HTMLInputElement | null;
|
|
661
|
+
getThreadID(): string;
|
|
662
|
+
getToRecipients(): Array<Contact>;
|
|
663
|
+
getHTMLContent(): string;
|
|
664
|
+
getTextContent(): string;
|
|
665
|
+
hideDiscardButton(): () => void;
|
|
666
|
+
hideNativeRecipientRows(): () => void;
|
|
667
|
+
isMinimized(): boolean;
|
|
668
|
+
setMinimized(minimized: boolean): void;
|
|
669
|
+
isFullScreen(): boolean;
|
|
670
|
+
insertHTMLIntoBodyAtCursor(html: string): HTMLElement;
|
|
671
|
+
isForward(): boolean;
|
|
672
|
+
isInlineReplyForm(): boolean;
|
|
673
|
+
isReply(): boolean;
|
|
674
|
+
overrideEditSubject(): void;
|
|
675
|
+
registerRequestModifier(
|
|
676
|
+
cb: (composeParams: { isPlainText?: boolean; body: string }) => void
|
|
677
|
+
): void;
|
|
678
|
+
replaceSendButton({ el }: { el: HTMLElement }): () => void;
|
|
679
|
+
setBccRecipients(emails: string[]): void;
|
|
680
|
+
setBodyHTML(html: string): void;
|
|
681
|
+
setBodyText(to: string): void;
|
|
682
|
+
setCcRecipients(emails: string[]): void;
|
|
683
|
+
setFullscreen(isFullScreen: boolean): void;
|
|
684
|
+
setSubject(subject: string): void;
|
|
685
|
+
setTitleBarColor(color: string): () => void;
|
|
686
|
+
setTitleBarText(to: string): () => void;
|
|
687
|
+
setToRecipients(recipients: string[]): void;
|
|
688
|
+
send(options?: SendOptions): void;
|
|
689
|
+
getFromContact(): Contact;
|
|
690
|
+
getFromContactChoices(): Contact[];
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export interface SendOptions {
|
|
694
|
+
sendAndArchive?: boolean;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export interface ComposeViewDestroyEvent {
|
|
698
|
+
messageID: string | null;
|
|
699
|
+
closedByInboxSDK: boolean;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export interface ComposeButtonDescriptor {
|
|
703
|
+
title: string;
|
|
704
|
+
iconUrl?: string;
|
|
705
|
+
iconClass?: string;
|
|
706
|
+
onClick(event: ComposeViewButtonOnClickEvent): void;
|
|
707
|
+
hasDropdown?: boolean;
|
|
708
|
+
type?: 'SEND_ACTION' | 'MODIFIER';
|
|
709
|
+
orderHint?: number;
|
|
710
|
+
enabled?: boolean;
|
|
711
|
+
noOverflow?: boolean;
|
|
712
|
+
tooltip?: string | null;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export interface ComposeViewButtonOnClickEvent {
|
|
716
|
+
composeView: ComposeView;
|
|
717
|
+
dropdown: DropdownView;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export interface RecipientRowOptions {
|
|
721
|
+
el?: HTMLElement;
|
|
722
|
+
labelClass?: string;
|
|
723
|
+
labelText?: string;
|
|
724
|
+
labelTextClass?: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
export interface AutocompleteSearchResult {
|
|
728
|
+
name?: null | string;
|
|
729
|
+
nameHTML?: null | string;
|
|
730
|
+
description?: null | string;
|
|
731
|
+
descriptionHTML?: null | string;
|
|
732
|
+
routeName?: null | string;
|
|
733
|
+
routeParams?: null | { [ix: string]: string | number };
|
|
734
|
+
externalURL?: null | string;
|
|
735
|
+
searchTerm?: null | string;
|
|
736
|
+
iconUrl?: null | string;
|
|
737
|
+
iconClass?: null | string;
|
|
738
|
+
iconHTML?: null | string;
|
|
739
|
+
onClick?: null | (() => void);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
export interface StatusBarDescriptor {
|
|
743
|
+
addAboveNativeStatusBar?: boolean;
|
|
744
|
+
height?: number;
|
|
745
|
+
orderHint?: number;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export interface StatusBarView extends SimpleElementView {
|
|
749
|
+
setHeight(newHeight: number): any;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
753
|
+
export interface ComposeNoticeView extends SimpleElementView {}
|
|
754
|
+
|
|
755
|
+
export interface MessageButtonDescriptor {
|
|
756
|
+
onClick(): void;
|
|
757
|
+
title: string;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export interface MessageDescriptor {
|
|
761
|
+
buttons?: Array<MessageButtonDescriptor>;
|
|
762
|
+
className?: string;
|
|
763
|
+
el?: string;
|
|
764
|
+
hideOnViewChanged?: boolean;
|
|
765
|
+
html?: string;
|
|
766
|
+
messageKey?: Record<string, any> | string;
|
|
767
|
+
persistent?: boolean;
|
|
768
|
+
priority?: number;
|
|
769
|
+
text?: string;
|
|
770
|
+
time?: number;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export interface LoadingMessageDescriptor {
|
|
774
|
+
className?: string;
|
|
775
|
+
el?: string;
|
|
776
|
+
hideOnViewChanged?: boolean;
|
|
777
|
+
html?: string;
|
|
778
|
+
messageKey?: Record<string, any>;
|
|
779
|
+
persistent?: boolean;
|
|
780
|
+
priority?: number;
|
|
781
|
+
text?: string;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
export interface SavingMessageDescriptor {
|
|
785
|
+
className?: string;
|
|
786
|
+
confirmationText?: string;
|
|
787
|
+
confirmationTime?: number;
|
|
788
|
+
el?: string;
|
|
789
|
+
hideOnViewChanged?: boolean;
|
|
790
|
+
html?: string;
|
|
791
|
+
messageKey?: Record<string, any> | string;
|
|
792
|
+
persistent?: boolean;
|
|
793
|
+
priority?: number;
|
|
794
|
+
showConfirmation?: boolean;
|
|
795
|
+
text?: string;
|
|
796
|
+
time?: number;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
export interface SearchQueryRewriter {
|
|
800
|
+
term: string;
|
|
801
|
+
termReplacer(): string | Promise<string>;
|
|
802
|
+
}
|