@inboxsdk/core 2.1.40 → 2.1.42
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.js +2335 -2340
- package/package.json +1 -1
- package/src/inboxsdk.d.ts +12 -70
- package/src/platform-implementation-js/lib/handler-registry.d.ts +1 -1
- package/src/platform-implementation-js/lib/handler-registry.d.ts.map +1 -1
- package/src/platform-implementation-js/namespaces/router.d.ts +52 -3
- package/src/platform-implementation-js/namespaces/router.d.ts.map +1 -1
package/package.json
CHANGED
package/src/inboxsdk.d.ts
CHANGED
|
@@ -31,12 +31,16 @@ import type ComposeView from './platform-implementation-js/views/compose-view';
|
|
|
31
31
|
import type Search from './platform-implementation-js/namespaces/search';
|
|
32
32
|
import type {
|
|
33
33
|
default as Toolbars,
|
|
34
|
+
LegacyToolbarButtonOnClickEvent,
|
|
34
35
|
LegacyToolbarButtonDescriptor,
|
|
35
36
|
} from './platform-implementation-js/namespaces/toolbars';
|
|
36
37
|
import type CollapsibleSectionView from './platform-implementation-js/views/collapsible-section-view';
|
|
37
38
|
import type ListRouteView from './platform-implementation-js/views/route-view/list-route-view';
|
|
38
39
|
import type SectionView from './platform-implementation-js/views/section-view';
|
|
39
|
-
import
|
|
40
|
+
import Router, {
|
|
41
|
+
type RouteParams,
|
|
42
|
+
} from './platform-implementation-js/namespaces/router';
|
|
43
|
+
import CustomRouteView from './platform-implementation-js/views/route-view/custom-route-view';
|
|
40
44
|
|
|
41
45
|
export type { User };
|
|
42
46
|
|
|
@@ -128,71 +132,7 @@ export interface NavMenu {
|
|
|
128
132
|
): NavItemView;
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
export
|
|
132
|
-
createLink(routeID: string, params?: any): string;
|
|
133
|
-
getCurrentRouteView(): RouteView;
|
|
134
|
-
goto(routeID: string, params?: any): Promise<void>;
|
|
135
|
-
handleAllRoutes(handler: (routeView: RouteView) => void): () => void;
|
|
136
|
-
handleCustomRoute(
|
|
137
|
-
routeID: string,
|
|
138
|
-
handler: (customRouteView: CustomRouteView) => void,
|
|
139
|
-
): () => void;
|
|
140
|
-
handleCustomListRoute(
|
|
141
|
-
routeID: string,
|
|
142
|
-
handler: (offset: number, max: number) => void,
|
|
143
|
-
): void;
|
|
144
|
-
handleListRoute(
|
|
145
|
-
routeID: string,
|
|
146
|
-
handler: (listRouteView: ListRouteView) => void,
|
|
147
|
-
): () => void;
|
|
148
|
-
NativeRouteIDs: Record<NativeRouteIdTypes, string>;
|
|
149
|
-
NativeListRouteIDs: Record<
|
|
150
|
-
| 'ALL_MAIL'
|
|
151
|
-
| 'ANY_LIST'
|
|
152
|
-
| 'DRAFTS'
|
|
153
|
-
| 'IMPORTANT'
|
|
154
|
-
| 'INBOX'
|
|
155
|
-
| 'LABEL'
|
|
156
|
-
| 'SEARCH'
|
|
157
|
-
| 'SEARCH'
|
|
158
|
-
| 'SENT'
|
|
159
|
-
| 'SPAM'
|
|
160
|
-
| 'STARRED'
|
|
161
|
-
| 'TRASH',
|
|
162
|
-
string
|
|
163
|
-
>;
|
|
164
|
-
RouteTypes: Record<RouteTypes, string>;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
type NativeRouteIdTypes =
|
|
168
|
-
| 'INBOX'
|
|
169
|
-
| 'ALL_MAIL'
|
|
170
|
-
| 'SENT'
|
|
171
|
-
| 'STARRED'
|
|
172
|
-
| 'DRAFTS'
|
|
173
|
-
| 'SNOOZED'
|
|
174
|
-
| 'DONE'
|
|
175
|
-
| 'REMINDERS'
|
|
176
|
-
| 'LABEL'
|
|
177
|
-
| 'TRASH'
|
|
178
|
-
| 'SPAM'
|
|
179
|
-
| 'IMPORTANT'
|
|
180
|
-
| 'SEARCH'
|
|
181
|
-
| 'THREAD'
|
|
182
|
-
| 'CHATS'
|
|
183
|
-
| 'CHAT'
|
|
184
|
-
| 'CONTACTS'
|
|
185
|
-
| 'CONTACT'
|
|
186
|
-
| 'SETTINGS'
|
|
187
|
-
| 'ANY_LIST';
|
|
188
|
-
|
|
189
|
-
type RouteTypes =
|
|
190
|
-
| 'CHAT'
|
|
191
|
-
| 'CUSTOM'
|
|
192
|
-
| 'LIST'
|
|
193
|
-
| 'SETTINGS'
|
|
194
|
-
| 'THREAD'
|
|
195
|
-
| 'UNKNOWN';
|
|
135
|
+
export { Router };
|
|
196
136
|
|
|
197
137
|
export interface Widgets {
|
|
198
138
|
/** check whether mole view has light title bar as part of gmail new view / original view */
|
|
@@ -203,7 +143,11 @@ export interface Widgets {
|
|
|
203
143
|
showTopMessageBarView(opts: { el: Element }): TopMessageBarView;
|
|
204
144
|
}
|
|
205
145
|
|
|
206
|
-
export {
|
|
146
|
+
export {
|
|
147
|
+
Toolbars,
|
|
148
|
+
LegacyToolbarButtonDescriptor,
|
|
149
|
+
LegacyToolbarButtonOnClickEvent,
|
|
150
|
+
};
|
|
207
151
|
export {
|
|
208
152
|
ToolbarButtonDescriptor,
|
|
209
153
|
ToolbarButtonOnClickEvent,
|
|
@@ -431,9 +375,7 @@ export interface SectionDescriptor {
|
|
|
431
375
|
|
|
432
376
|
export { ListRouteView };
|
|
433
377
|
|
|
434
|
-
export
|
|
435
|
-
getElement(): HTMLElement;
|
|
436
|
-
}
|
|
378
|
+
export { CustomRouteView };
|
|
437
379
|
|
|
438
380
|
export interface CustomListDescriptor {
|
|
439
381
|
hasMore?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler-registry.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/lib/handler-registry.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"handler-registry.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/lib/handler-registry.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,eAAe,CAAC,CAAC;IACpC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,SAAS,CAAyB;IAE1C,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAwBhD,SAAS,CAAC,MAAM,EAAE,CAAC;IAiBnB,YAAY,CAAC,MAAM,EAAE,CAAC;IAItB,YAAY;IAKZ,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,uBAAuB;CAMhC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import HandlerRegistry from '../lib/handler-registry';
|
|
2
1
|
import RouteView from '../views/route-view/route-view';
|
|
3
2
|
import ListRouteView from '../views/route-view/list-route-view';
|
|
4
3
|
import CustomRouteView from '../views/route-view/custom-route-view';
|
|
5
4
|
import type Membrane from '../lib/Membrane';
|
|
6
5
|
import type { Driver } from '../driver-interfaces/driver';
|
|
7
6
|
import type { Handler } from '../lib/handler-registry';
|
|
8
|
-
export type RouteParams = Record<string, string | number>;
|
|
7
|
+
export type RouteParams = Record<string, string | number | undefined | null>;
|
|
8
|
+
/**
|
|
9
|
+
* This namespace contains functionality associated with creating your own content inside Gmail. It allows you to define "Routes" which define a full page of content and an associated URL space for which they are active. You can think of routes as different pages in your application. Gmail already have a few routes built in (Inbox, Sent, Drafts, etc). This namespace allows you to define your own as well as listen in on the built in routes being navigated to.
|
|
10
|
+
|
|
11
|
+
This is typically used when you want to create content to fill the main content area of Gmail. Every route has a URL associated with it and can have optional parameters. However, you never construct these URL's manually. The SDK will take care of creating a URL that will work in Gmail for your Route. Since these URL's may change due to implementations of Gmail, you should always create new links when trying to set URL on elements or simply use the goto function which naviagtes to the created link automatically. Using the handleX family of methods, you can specify which routes your application can handle. You will be called back with and instance of a RouteView or similar when the user navigates to a route you've declared you can handle. For custom routes, you'll typically add your own content and for built in routes, you'll typically modify the existing content. Route ID's are path like strings with named parameters, for example: "myroute/:someParamMyRouteNeeds".
|
|
12
|
+
*/
|
|
9
13
|
declare class Router {
|
|
14
|
+
#private;
|
|
10
15
|
NativeRouteIDs: Readonly<{
|
|
11
16
|
INBOX: "inbox/:page";
|
|
12
17
|
ALL_MAIL: "all/:page";
|
|
@@ -62,12 +67,56 @@ declare class Router {
|
|
|
62
67
|
UNKNOWN: "UNKNOWN";
|
|
63
68
|
}>;
|
|
64
69
|
constructor(appId: string, driver: Driver, membrane: Membrane);
|
|
70
|
+
/**
|
|
71
|
+
* Get a URL that can be used to navigate to a view. You'll typically want to use this to set the href of an element or similar. Returns the encoded URL string.
|
|
72
|
+
*
|
|
73
|
+
* @param routeID A route specifying where the link should navigate the user to. This should either be a routeID registered with {@link Router#handleCustomRoute} or {@link Router#handleCustomListRoute}, or a value from {@link Router#NativeRouteIDs}.
|
|
74
|
+
* @param params an object containing the parameters that will be encoded in the link and decoded when the user subsequently visits the route. Handlers for the specified routeID will receive a copy of this object. This object must contain only simple key value pairs with no nested arrays/objects.
|
|
75
|
+
*/
|
|
65
76
|
createLink(routeID: string, params?: (RouteParams | null | undefined) | string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Change the route to be the one with the given ID and have the given parameters.
|
|
79
|
+
* @param routeID A route specifying where the link should navigate the user to. This should either be a routeID registered with {@link Router#handleCustomRoute} or {@link Router#handleCustomListRoute} a value from {@link Router#NativeRouteIDs}, or a value previously returned by {@link Router#createLink}. If it's a value previously returned by {@link Router#createLink} then the params argument must be omitted.
|
|
80
|
+
* @param params an object containing the parameters that will be encoded in the link and decoded when the user subsequently visits the route. Handlers for the specified routeID will receive a copy of this object. This object must contain only simple key value pairs with no nested arrays/objects.
|
|
81
|
+
*/
|
|
66
82
|
goto(routeID: string, params?: (RouteParams | null | undefined) | string): Promise<void>;
|
|
67
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Registers a handler (callback) to be called when the user navigates to a custom route which matches the routeID you provide. Use this to create your own routes (pages) with your own custom content. Your callback will be passed an instance of a {@link CustomRouteView} whose contents you may modify.
|
|
85
|
+
* @param routeID which route this handler is registering for
|
|
86
|
+
* @param handler The callback to call when the route changes to a custom route matching the provided routeID
|
|
87
|
+
* @returns a function which removes the handler registration.
|
|
88
|
+
*/
|
|
89
|
+
handleCustomRoute(routeID: string, handler: Handler<CustomRouteView>): () => void;
|
|
90
|
+
/**
|
|
91
|
+
* Registers a handler (callback) to be called when the user navigates to any route (both customs and built in routes). Because this can apply to any route, your callback will be given only a generic RouteView. This is typically used when you want to monitor for page changes but don't necessarily need to modify the page.
|
|
92
|
+
* @param handler The callback to call when the route changes
|
|
93
|
+
* @returns a function which removes the handler registration.
|
|
94
|
+
*/
|
|
68
95
|
handleAllRoutes(handler: Handler<any>): () => void;
|
|
96
|
+
/**
|
|
97
|
+
* Registers a handler (callback) to be called when the user navigates to a list route which matches the routeID you provide. Gmail have several built in routes which are "Lists". These include routes like Inbox, All Mail, Sent, Drafts, etc. You'll typically use this to modify Gmail's built in List routes.
|
|
98
|
+
* @param routeID which list route this handler is registering for.
|
|
99
|
+
* @param handler The callback to call when the route changes to a list route matching the routeId.
|
|
100
|
+
* @returns a function which removes the handler registration.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
*
|
|
104
|
+
* ```javascript
|
|
105
|
+
* sdk.Router.handleListRoute(sdk.Router.NativeRouteIDs.INBOX, (listRouteView) => {
|
|
106
|
+
* ```
|
|
107
|
+
});
|
|
108
|
+
*/
|
|
69
109
|
handleListRoute(routeID: string, handler: Handler<ListRouteView>): () => void;
|
|
110
|
+
/**
|
|
111
|
+
* Used to create a custom view that shows a list of threads. When the user navigates to the given routeID, the handler function will be called. The handler function will be passed the starting offset (if the user sees 50 threads per page and is on page 2, then the offset will be 50), and a maximum number of threads to return. It must return a CustomListDescriptor, or a promise which resolves to one.
|
|
112
|
+
* @param routeID Which route this handler is registering for.
|
|
113
|
+
* @param handler Passed a page offset and a maximum number of threads to return. Must return a CustomListDescriptor, or a promise which resolves to one.
|
|
114
|
+
* @returns a function which removes the handler registration.
|
|
115
|
+
*/
|
|
70
116
|
handleCustomListRoute(routeID: string, handler: (...args: Array<any>) => any): () => void;
|
|
117
|
+
/**
|
|
118
|
+
* @returns a RouteView of the current route view
|
|
119
|
+
*/
|
|
71
120
|
getCurrentRouteView(): RouteView;
|
|
72
121
|
}
|
|
73
122
|
export default Router;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/namespaces/router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/namespaces/router.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,gCAAgC,CAAC;AACvD,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAAO,eAAe,MAAM,uCAAuC,CAAC;AAEpE,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAM5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAI7E;;;;GAIG;AACH,cAAM,MAAM;;IACV,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAoB;IAClC,kBAAkB;;;;;;;;;;;;;;;OAAyB;IAC3C,UAAU;;;;;;;;;OAAe;gBAcb,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IA8B7D;;;;;OAKG;IACH,UAAU,CACR,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GACjD,MAAM;IAIT;;;;OAIG;IACH,IAAI,CACF,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GACjD,OAAO,CAAC,IAAI,CAAC;IAmBhB;;;;;OAKG;IACH,iBAAiB,CACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAChC,MAAM,IAAI;IAoBb;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI;IAIlD;;;;;;;;;;;;OAYG;IACH,eAAe,CACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAC9B,MAAM,IAAI;IAUb;;;;;OAKG;IACH,qBAAqB,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,GACpC,MAAM,IAAI;IAIb;;OAEG;IACH,mBAAmB,IAAI,SAAS;CA6EjC;AAED,eAAe,MAAM,CAAC"}
|