@inboxsdk/core 0.2.1 → 0.2.4
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/inboxsdk.d.ts +131 -21
- package/inboxsdk.js +37 -37
- package/package.json +3 -2
package/inboxsdk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import * as Kefir from 'kefir';
|
|
3
|
+
import TypedEmitter from 'typed-emitter';
|
|
3
4
|
|
|
4
5
|
export const LOADER_VERSION: string;
|
|
5
6
|
export interface LoadScriptOptions {
|
|
@@ -27,6 +28,13 @@ export interface InboxSDK {
|
|
|
27
28
|
Compose: Compose;
|
|
28
29
|
ButterBar: ButterBar;
|
|
29
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
|
+
};
|
|
30
38
|
NavMenu: NavMenu;
|
|
31
39
|
Router: Router;
|
|
32
40
|
Widgets: Widgets;
|
|
@@ -143,8 +151,23 @@ export interface Router {
|
|
|
143
151
|
handleListRoute(
|
|
144
152
|
routeID: string,
|
|
145
153
|
handler: (listRouteView: ListRouteView) => void
|
|
146
|
-
): void;
|
|
154
|
+
): () => void;
|
|
147
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
|
+
>;
|
|
148
171
|
RouteTypes: Record<RouteTypes, string>;
|
|
149
172
|
}
|
|
150
173
|
|
|
@@ -182,9 +205,15 @@ export interface Widgets {
|
|
|
182
205
|
showModalView(descriptor: ModalDescriptor): ModalView;
|
|
183
206
|
showMoleView(descriptor: MoleDescriptor): MoleView;
|
|
184
207
|
showDrawerView(descriptor: DrawerDescriptor): DrawerView;
|
|
208
|
+
showTopMessageBarView(opts: { el: Element }): Element;
|
|
185
209
|
}
|
|
186
210
|
|
|
187
211
|
export interface Toolbars {
|
|
212
|
+
addToolbarButtonForApp(
|
|
213
|
+
descriptor:
|
|
214
|
+
| AppToolbarButtonDescriptor
|
|
215
|
+
| Kefir.Stream<AppToolbarButtonDescriptor, any>
|
|
216
|
+
): AppToolbarButtonView;
|
|
188
217
|
registerThreadButton(descriptor: ToolbarButtonDescriptor): () => void;
|
|
189
218
|
registerToolbarButtonForThreadView(
|
|
190
219
|
descriptor: LegacyToolbarButtonDescriptor
|
|
@@ -196,6 +225,21 @@ export interface Toolbars {
|
|
|
196
225
|
};
|
|
197
226
|
}
|
|
198
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
|
+
|
|
199
243
|
export interface Keyboard {
|
|
200
244
|
createShortcutHandle(
|
|
201
245
|
descriptor: KeyboardShortcutDescriptor
|
|
@@ -222,6 +266,8 @@ export interface Lists {
|
|
|
222
266
|
}
|
|
223
267
|
|
|
224
268
|
export interface User {
|
|
269
|
+
/** @deprecated */
|
|
270
|
+
getAccountSwitcherContactList(): Contact[];
|
|
225
271
|
getEmailAddress(): string;
|
|
226
272
|
getLanguage(): string;
|
|
227
273
|
isConversationViewDisabled(): Promise<boolean>;
|
|
@@ -254,6 +300,7 @@ export interface ThreadRowView extends Destroyable {
|
|
|
254
300
|
| ImageDescriptor
|
|
255
301
|
| Kefir.Observable<ImageDescriptor | null, any>
|
|
256
302
|
): void;
|
|
303
|
+
getElement(): HTMLElement;
|
|
257
304
|
getVisibleDraftCount(): number;
|
|
258
305
|
getThreadIDIfStable(): string | null;
|
|
259
306
|
getThreadIDIfStableAsync(): Promise<string | null>;
|
|
@@ -327,6 +374,7 @@ export interface RouteView extends EventEmitter {
|
|
|
327
374
|
export interface ListRouteView extends RouteView {
|
|
328
375
|
addCollapsibleSection(options: any): CollapsibleSectionView;
|
|
329
376
|
addSection(options: any): SectionView;
|
|
377
|
+
refresh(): void;
|
|
330
378
|
}
|
|
331
379
|
|
|
332
380
|
export interface CustomRouteView extends RouteView {
|
|
@@ -363,14 +411,16 @@ export interface ModalButtonDescriptor {
|
|
|
363
411
|
|
|
364
412
|
export interface ModalView extends EventEmitter {
|
|
365
413
|
close(): void;
|
|
414
|
+
setTitle(s: string): void;
|
|
366
415
|
}
|
|
367
416
|
|
|
368
417
|
export interface DrawerView extends EventEmitter {
|
|
369
418
|
close(): void;
|
|
370
419
|
associateComposeView(
|
|
371
420
|
composeView: ComposeView,
|
|
372
|
-
closeWithCompose
|
|
421
|
+
closeWithCompose?: boolean
|
|
373
422
|
): void;
|
|
423
|
+
disassociateComposeView(): void;
|
|
374
424
|
}
|
|
375
425
|
|
|
376
426
|
export interface DrawerDescriptor {
|
|
@@ -421,24 +471,37 @@ export interface ThreadView extends EventEmitter {
|
|
|
421
471
|
getMessageViews(): Array<MessageView>;
|
|
422
472
|
getMessageViewsAll(): Array<MessageView>;
|
|
423
473
|
getSubject(): string;
|
|
474
|
+
/**
|
|
475
|
+
* @deprecated
|
|
476
|
+
*/
|
|
424
477
|
getThreadID(): string;
|
|
425
478
|
getThreadIDAsync(): Promise<string>;
|
|
426
479
|
addNoticeBar(): SimpleElementView;
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
|
442
505
|
}
|
|
443
506
|
|
|
444
507
|
export interface CustomMessageView extends EventEmitter {
|
|
@@ -464,7 +527,37 @@ export interface ContentPanelDescriptor {
|
|
|
464
527
|
orderHint?: number;
|
|
465
528
|
}
|
|
466
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
|
+
|
|
467
554
|
export interface MessageView extends EventEmitter {
|
|
555
|
+
addAttachmentIcon(
|
|
556
|
+
opts:
|
|
557
|
+
| MessageAttachmentIconDescriptor
|
|
558
|
+
| Kefir.Stream<MessageAttachmentIconDescriptor, never>
|
|
559
|
+
): AttachmentIcon;
|
|
560
|
+
addToolbarButton(opts?: MessageViewToolbarButtonDescriptor): void;
|
|
468
561
|
getBodyElement(): HTMLElement;
|
|
469
562
|
isElementInQuotedArea(element: HTMLElement): boolean;
|
|
470
563
|
isLoaded(): boolean;
|
|
@@ -512,12 +605,14 @@ export interface LegacyToolbarButtonDescriptor {
|
|
|
512
605
|
hasDropdown?: boolean;
|
|
513
606
|
hideFor?: (routeView: RouteView) => boolean;
|
|
514
607
|
keyboardShortcutHandle?: KeyboardShortcutHandle;
|
|
608
|
+
orderHint?: number;
|
|
515
609
|
}
|
|
516
610
|
|
|
517
611
|
export interface ToolbarButtonOnClickEvent {
|
|
518
612
|
selectedThreadViews: Array<ThreadView>;
|
|
519
613
|
selectedThreadRowViews: Array<ThreadRowView>;
|
|
520
614
|
dropdown?: DropdownView;
|
|
615
|
+
threadView?: ThreadView;
|
|
521
616
|
}
|
|
522
617
|
|
|
523
618
|
export interface KeyboardShortcutDescriptor {
|
|
@@ -553,34 +648,44 @@ export interface ComposeView extends EventEmitter {
|
|
|
553
648
|
close(): void;
|
|
554
649
|
ensureAppButtonToolbarsAreClosed(): void;
|
|
555
650
|
ensureFormattingToolbarIsHidden(): void;
|
|
651
|
+
forceRecipientRowsOpen(): () => void;
|
|
556
652
|
getBccRecipients(): Array<Contact>;
|
|
557
653
|
getBodyElement(): HTMLElement;
|
|
558
654
|
getCcRecipients(): Array<Contact>;
|
|
559
|
-
getCurrentDraftID(): Promise<string>;
|
|
655
|
+
getCurrentDraftID(): Promise<string | null>;
|
|
560
656
|
getElement(): HTMLElement;
|
|
561
657
|
getDraftID(): Promise<string | null>;
|
|
658
|
+
getMessageIDAsync(): Promise<string>;
|
|
562
659
|
getSubject(): string;
|
|
660
|
+
getSubjectInput(): HTMLInputElement | null;
|
|
563
661
|
getThreadID(): string;
|
|
564
662
|
getToRecipients(): Array<Contact>;
|
|
565
663
|
getHTMLContent(): string;
|
|
566
664
|
getTextContent(): string;
|
|
665
|
+
hideDiscardButton(): () => void;
|
|
666
|
+
hideNativeRecipientRows(): () => void;
|
|
567
667
|
isMinimized(): boolean;
|
|
568
668
|
setMinimized(minimized: boolean): void;
|
|
569
|
-
|
|
669
|
+
isFullscreen(): boolean;
|
|
570
670
|
insertHTMLIntoBodyAtCursor(html: string): HTMLElement;
|
|
571
671
|
isForward(): boolean;
|
|
572
672
|
isInlineReplyForm(): boolean;
|
|
573
673
|
isReply(): boolean;
|
|
574
674
|
overrideEditSubject(): void;
|
|
675
|
+
registerRequestModifier(
|
|
676
|
+
cb: (composeParams: { isPlainText?: boolean; body: string }) => void
|
|
677
|
+
): void;
|
|
575
678
|
replaceSendButton({ el }: { el: HTMLElement }): () => void;
|
|
576
679
|
setBccRecipients(emails: string[]): void;
|
|
577
680
|
setBodyHTML(html: string): void;
|
|
681
|
+
setBodyText(to: string): void;
|
|
578
682
|
setCcRecipients(emails: string[]): void;
|
|
579
|
-
setFullscreen(
|
|
683
|
+
setFullscreen(isFullscreen: boolean): void;
|
|
580
684
|
setSubject(subject: string): void;
|
|
581
685
|
setTitleBarColor(color: string): () => void;
|
|
686
|
+
setTitleBarText(to: string): () => void;
|
|
582
687
|
setToRecipients(recipients: string[]): void;
|
|
583
|
-
send(options
|
|
688
|
+
send(options?: SendOptions): void;
|
|
584
689
|
getFromContact(): Contact;
|
|
585
690
|
getFromContactChoices(): Contact[];
|
|
586
691
|
}
|
|
@@ -589,6 +694,11 @@ export interface SendOptions {
|
|
|
589
694
|
sendAndArchive?: boolean;
|
|
590
695
|
}
|
|
591
696
|
|
|
697
|
+
export interface ComposeViewDestroyEvent {
|
|
698
|
+
messageID: string | null;
|
|
699
|
+
closedByInboxSDK: boolean;
|
|
700
|
+
}
|
|
701
|
+
|
|
592
702
|
export interface ComposeButtonDescriptor {
|
|
593
703
|
title: string;
|
|
594
704
|
iconUrl?: string;
|