@openfin/workspace-platform 5.3.0 → 5.3.1
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/README.md +31 -4
- package/client-api/src/shapes.d.ts +5 -4
- package/client-api-platform/src/api/app-directory.d.ts +2 -2
- package/client-api-platform/src/api/browser/browser-module.d.ts +2 -2
- package/client-api-platform/src/api/browser/index.d.ts +4 -4
- package/client-api-platform/src/api/pages/helper.d.ts +1 -1
- package/client-api-platform/src/api/pages/index.d.ts +6 -6
- package/client-api-platform/src/api/protocol.d.ts +5 -4
- package/client-api-platform/src/api/storage.d.ts +1 -1
- package/client-api-platform/src/api/theming.d.ts +5 -0
- package/client-api-platform/src/api/workspace-module.d.ts +1 -1
- package/client-api-platform/src/index.d.ts +36 -1
- package/client-api-platform/src/init/override-callback.d.ts +1 -1
- package/client-api-platform/src/init/theming.d.ts +9 -0
- package/client-api-platform/src/init/utils.d.ts +7 -2
- package/client-api-platform/src/shapes.d.ts +516 -19
- package/common/src/api/pages/idb.d.ts +2 -2
- package/common/src/api/pages/index.d.ts +7 -1
- package/common/src/api/pages/legacy.d.ts +1 -1
- package/common/src/api/protocol.d.ts +2 -1
- package/common/src/api/theming.d.ts +62 -0
- package/common/src/utils/theming.d.ts +57 -0
- package/common/src/utils/window.d.ts +1 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/search-api/src/client/internal.d.ts +1 -1
|
@@ -1,59 +1,237 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
2
|
import type { InteropBroker } from 'openfin-adapter/src/api/interop';
|
|
3
|
-
import type { App } from '../../client-api/src/shapes';
|
|
4
3
|
import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
|
|
4
|
+
import type { CustomThemes } from '../../common/src/api/theming';
|
|
5
|
+
import type { App } from '../../client-api/src/shapes';
|
|
6
|
+
export type { CustomThemes } from '../../common/src/api/theming';
|
|
5
7
|
export type { App, Image, AppIntent } from '../../client-api/src/shapes';
|
|
6
8
|
export { AppManifestType } from '../../client-api/src/shapes';
|
|
9
|
+
export type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
|
|
10
|
+
/**
|
|
11
|
+
* Request for creating a saved page in persistent storage.
|
|
12
|
+
*/
|
|
7
13
|
export interface CreateSavedPageRequest {
|
|
14
|
+
/** The page to create. */
|
|
8
15
|
page: Page;
|
|
9
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Request for updating a saved page in persistent storage.
|
|
19
|
+
*/
|
|
10
20
|
export interface UpdateSavedPageRequest {
|
|
11
21
|
/** The ID of the page to update. */
|
|
12
22
|
pageId: string;
|
|
13
23
|
/** The updated page. */
|
|
14
24
|
page: Page;
|
|
15
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Request for reordering the pages attached to a window.
|
|
28
|
+
*/
|
|
16
29
|
export interface ReorderPagesRequest {
|
|
17
|
-
/**
|
|
30
|
+
/** An array of page ids that specify the order of the pages attached to the window. */
|
|
18
31
|
pageIds: string[];
|
|
19
32
|
}
|
|
20
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Request to update the attributes of a page in which is attached to a running browser window.
|
|
35
|
+
*/
|
|
36
|
+
export interface UpdateAttachedPageRequest {
|
|
21
37
|
/** The ID of the page to update. */
|
|
22
38
|
pageId: string;
|
|
23
39
|
/** The updated page. */
|
|
24
40
|
page: Partial<PageWithUpdatableRuntimeAttribs>;
|
|
25
41
|
}
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Request for creating a browser window.
|
|
44
|
+
*/
|
|
28
45
|
export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform'> {
|
|
46
|
+
/** WorkspacePlatform specific window options. These options will not work unless a workspace platform has been initialized. */
|
|
29
47
|
workspacePlatform: {
|
|
48
|
+
/** The initial set of pages to add to the created browser window. */
|
|
30
49
|
pages: Page[];
|
|
50
|
+
/** The favicon to display on the top left of the created browser window. */
|
|
31
51
|
favicon?: string;
|
|
52
|
+
/** A UI friendly title for the created browser window. */
|
|
32
53
|
title?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Landing page that shows up when you add a new tab from the plus button that exists in the tabstrip.
|
|
56
|
+
* If you do not provide a newTabUrl, then the plus button in the tabstrip will not be shown and users cannot create a new empty tab.
|
|
57
|
+
*/
|
|
33
58
|
newTabUrl?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Landing page that shows up when you add a new page from the plus button that exists in the window frame where the page selector is shown.
|
|
61
|
+
* If you do not provide a newPageUrl, then the new Page plus button will not be shown and you cannot create a new empty Page or Window.
|
|
62
|
+
*/
|
|
34
63
|
newPageUrl?: string;
|
|
35
64
|
};
|
|
36
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* A window that is part of a browser snapshot.
|
|
68
|
+
*/
|
|
69
|
+
export declare type BrowserSnapshotWindow = OpenFin.WindowCreationOptions & BrowserCreateWindowRequest;
|
|
70
|
+
/**
|
|
71
|
+
* A browser snapshot.
|
|
72
|
+
*/
|
|
73
|
+
export interface BrowserSnapshot {
|
|
74
|
+
/** The state of the windows that were running at the time the snapshot was taken. */
|
|
75
|
+
windows: BrowserSnapshotWindow[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Controller for interacting with a browser window.
|
|
79
|
+
*/
|
|
37
80
|
export interface BrowserWindowModule {
|
|
81
|
+
/** The identity of the browser window. */
|
|
38
82
|
identity: OpenFin.Identity;
|
|
83
|
+
/** Underlying OpenFin window Controller. */
|
|
39
84
|
openfinWindow: OpenFin.Window;
|
|
85
|
+
/**
|
|
86
|
+
* Get a page that is attached to the browser window.
|
|
87
|
+
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
90
|
+
*
|
|
91
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
92
|
+
* // assume a browser window already exists
|
|
93
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
94
|
+
* const page = await windows[0].getPage('MyPageId');
|
|
95
|
+
* ```
|
|
96
|
+
* @param id the id of the page to get.
|
|
97
|
+
*/
|
|
40
98
|
getPage(id: string): Promise<AttachedPage>;
|
|
41
99
|
/**
|
|
42
100
|
* Return all the pages that are attached to a browser window.
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
104
|
+
*
|
|
105
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
106
|
+
* // assume a browser window already exists
|
|
107
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
108
|
+
* const pages = await windows[0].getPages();
|
|
109
|
+
* ```
|
|
43
110
|
*/
|
|
44
111
|
getPages(): Promise<AttachedPage[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Set the active page for the browser window.
|
|
114
|
+
*
|
|
115
|
+
* ```ts
|
|
116
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
117
|
+
*
|
|
118
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
119
|
+
* // assume a browser window already exists
|
|
120
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
121
|
+
* await windows[0].setActivePage('MyPageId');
|
|
122
|
+
* ```
|
|
123
|
+
* @param id the id of the attached page to set as active.
|
|
124
|
+
*/
|
|
45
125
|
setActivePage(id: string): Promise<void>;
|
|
46
126
|
/**
|
|
47
127
|
* Attach a page to a browser window.
|
|
48
128
|
* If a page with same id or title is attached to an existing browser window, an error will be thrown.
|
|
49
129
|
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
132
|
+
*
|
|
133
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
134
|
+
* const layout = {
|
|
135
|
+
* content: [
|
|
136
|
+
* {
|
|
137
|
+
* type: 'stack',
|
|
138
|
+
* content: [
|
|
139
|
+
* {
|
|
140
|
+
* type: 'component',
|
|
141
|
+
* componentName: 'view',
|
|
142
|
+
* componentState: {
|
|
143
|
+
* name: 'myViewName',
|
|
144
|
+
* url: 'http://google.com'
|
|
145
|
+
* }
|
|
146
|
+
* }
|
|
147
|
+
* ]
|
|
148
|
+
* }
|
|
149
|
+
* ]
|
|
150
|
+
* };
|
|
151
|
+
* const page = {
|
|
152
|
+
* title: 'myPageTitle',
|
|
153
|
+
* pageId: 'myPageId',
|
|
154
|
+
* layout
|
|
155
|
+
* };
|
|
156
|
+
* // assume a browser window already exists
|
|
157
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
158
|
+
* await windows[0].addPage(page);
|
|
159
|
+
* ```
|
|
50
160
|
* @param page the attach page to a browser window.
|
|
51
161
|
*/
|
|
52
162
|
addPage(page: PageWithUpdatableRuntimeAttribs): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Remove an attached page from the browser window.
|
|
165
|
+
*
|
|
166
|
+
* ```ts
|
|
167
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
168
|
+
*
|
|
169
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
170
|
+
* // assume a browser window already exists
|
|
171
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
172
|
+
* await windows[0].removePage('myPageId');
|
|
173
|
+
* ```
|
|
174
|
+
* @param id the id of the attached page to remove from the browser window.
|
|
175
|
+
*/
|
|
53
176
|
removePage(id: string): Promise<void>;
|
|
54
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Update a page in which is attached to the browser window.
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
182
|
+
*
|
|
183
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
184
|
+
* const layout = {
|
|
185
|
+
* content: [
|
|
186
|
+
* {
|
|
187
|
+
* type: 'stack',
|
|
188
|
+
* content: [
|
|
189
|
+
* {
|
|
190
|
+
* type: 'component',
|
|
191
|
+
* componentName: 'view',
|
|
192
|
+
* componentState: {
|
|
193
|
+
* name: 'myViewName',
|
|
194
|
+
* url: 'http://google.com'
|
|
195
|
+
* }
|
|
196
|
+
* }
|
|
197
|
+
* ]
|
|
198
|
+
* }
|
|
199
|
+
* ]
|
|
200
|
+
* };
|
|
201
|
+
* const page = {
|
|
202
|
+
* title: 'myPageTitle',
|
|
203
|
+
* pageId: 'myPageId',
|
|
204
|
+
* layout
|
|
205
|
+
* };
|
|
206
|
+
* // assume a browser window already exists
|
|
207
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
208
|
+
* const req = {
|
|
209
|
+
* pageId: 'myPageId',
|
|
210
|
+
* page
|
|
211
|
+
* };
|
|
212
|
+
* await windows[0].updatePage(req);
|
|
213
|
+
* ```
|
|
214
|
+
* @param req the update request.
|
|
215
|
+
*/
|
|
216
|
+
updatePage(req: UpdateAttachedPageRequest): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Reorder pages attached to the browser window.
|
|
219
|
+
*
|
|
220
|
+
* ```ts
|
|
221
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
222
|
+
*
|
|
223
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
224
|
+
* // assume a browser window already exists and has three pages in it
|
|
225
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
226
|
+
* await windows[0].reorderPages(['myPageId2', 'myPageId1', 'myPageId3']);
|
|
227
|
+
* ```
|
|
228
|
+
* @param req the reorder pages request.
|
|
229
|
+
*/
|
|
55
230
|
reorderPages(req: ReorderPagesRequest): Promise<void>;
|
|
56
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Factory for wrapping browser windows and global operations.
|
|
234
|
+
*/
|
|
57
235
|
export interface BrowserWindowFactory {
|
|
58
236
|
/**
|
|
59
237
|
* Synchronously returns a Browser Window object that represents an existing window
|
|
@@ -62,42 +240,259 @@ export interface BrowserWindowFactory {
|
|
|
62
240
|
*/
|
|
63
241
|
wrapSync: (identity: OpenFin.Identity) => BrowserWindowModule;
|
|
64
242
|
/**
|
|
65
|
-
* Get a list of pages that are
|
|
243
|
+
* Get a list of all pages that are attached to any running browser window.
|
|
244
|
+
*
|
|
245
|
+
* ```ts
|
|
246
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
247
|
+
*
|
|
248
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
249
|
+
* const attachedPages = await workspacePlatform.Browser.getAllAttachedPages();
|
|
250
|
+
* ```
|
|
66
251
|
*/
|
|
67
|
-
|
|
252
|
+
getAllAttachedPages(): Promise<AttachedPage[]>;
|
|
68
253
|
/**
|
|
69
|
-
* Get all the Browser Windows that are
|
|
254
|
+
* Get all the Browser Windows that are running in the Workspace Platform.
|
|
255
|
+
*
|
|
256
|
+
* ```ts
|
|
257
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
70
258
|
*
|
|
259
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
260
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
261
|
+
* ```
|
|
71
262
|
*/
|
|
72
263
|
getAllWindows(): Promise<BrowserWindowModule[]>;
|
|
73
264
|
/**
|
|
74
265
|
* Create a new browser window.
|
|
75
266
|
*
|
|
267
|
+
* ```ts
|
|
268
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
269
|
+
*
|
|
270
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
271
|
+
* const layout = {
|
|
272
|
+
* content: [
|
|
273
|
+
* {
|
|
274
|
+
* type: 'stack',
|
|
275
|
+
* content: [
|
|
276
|
+
* {
|
|
277
|
+
* type: 'component',
|
|
278
|
+
* componentName: 'view',
|
|
279
|
+
* componentState: {
|
|
280
|
+
* name: 'myViewName',
|
|
281
|
+
* url: 'http://google.com'
|
|
282
|
+
* }
|
|
283
|
+
* }
|
|
284
|
+
* ]
|
|
285
|
+
* }
|
|
286
|
+
* ]
|
|
287
|
+
* };
|
|
288
|
+
* const page = {
|
|
289
|
+
* title: 'myPageTitle',
|
|
290
|
+
* pageId: 'myPageId',
|
|
291
|
+
* layout
|
|
292
|
+
* };
|
|
293
|
+
* const options: BrowserCreateWindowRequest = {
|
|
294
|
+
* workspacePlatform {
|
|
295
|
+
* pages: [page],
|
|
296
|
+
* title: 'My Window Title',
|
|
297
|
+
* favicon: 'https://google.com/favicon.ico'
|
|
298
|
+
* }
|
|
299
|
+
* };
|
|
300
|
+
* const window = await workspacePlatform.Browser.createWindow(options);
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
76
303
|
* @param options the browser window creation options
|
|
77
304
|
*/
|
|
78
|
-
createWindow
|
|
305
|
+
createWindow(options: BrowserCreateWindowRequest): Promise<BrowserWindowModule>;
|
|
79
306
|
/**
|
|
80
307
|
* Get a unique title for a page.
|
|
308
|
+
*
|
|
309
|
+
* ```ts
|
|
310
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
311
|
+
*
|
|
312
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
313
|
+
* const uniqueTitle = await workspacePlatform.Browser.getUniquePageTitle('myTitle');
|
|
314
|
+
* ```
|
|
81
315
|
* @param title a prefix for the title.
|
|
82
316
|
*/
|
|
83
317
|
getUniquePageTitle(title?: string): Promise<string>;
|
|
84
318
|
/**
|
|
85
319
|
* Get the identity of the last focused Browser window.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
323
|
+
*
|
|
324
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
325
|
+
* const windowIdentity = await workspacePlatform.Browser.getLastFocusedWindow();
|
|
326
|
+
* ```
|
|
86
327
|
*/
|
|
87
328
|
getLastFocusedWindow(): Promise<OpenFin.Identity>;
|
|
88
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* API for interacting with persistent storage.
|
|
332
|
+
*/
|
|
89
333
|
export interface WorkspacePlatformStorage {
|
|
334
|
+
/**
|
|
335
|
+
* Get all pages that are saved in persistent storage.
|
|
336
|
+
*
|
|
337
|
+
* ```ts
|
|
338
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
339
|
+
*
|
|
340
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
341
|
+
* const pages = await workspacePlatform.Storage.getPages();
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
90
344
|
getPages(): Promise<Page[]>;
|
|
345
|
+
/**
|
|
346
|
+
* Get a specific page in persistent storage.
|
|
347
|
+
*
|
|
348
|
+
* ```ts
|
|
349
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
350
|
+
*
|
|
351
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
352
|
+
* const myPage = await workspacePlatform.Storage.getPage('myPageId');
|
|
353
|
+
* ```
|
|
354
|
+
* @param id the id of the page to get.
|
|
355
|
+
*/
|
|
91
356
|
getPage(id: string): Promise<Page>;
|
|
357
|
+
/**
|
|
358
|
+
* Create a page in persistent storage.
|
|
359
|
+
*
|
|
360
|
+
* ```ts
|
|
361
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
362
|
+
*
|
|
363
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
364
|
+
* const layout = {
|
|
365
|
+
* content: [
|
|
366
|
+
* {
|
|
367
|
+
* type: 'stack',
|
|
368
|
+
* content: [
|
|
369
|
+
* {
|
|
370
|
+
* type: 'component',
|
|
371
|
+
* componentName: 'view',
|
|
372
|
+
* componentState: {
|
|
373
|
+
* name: 'myViewName',
|
|
374
|
+
* url: 'http://google.com'
|
|
375
|
+
* }
|
|
376
|
+
* }
|
|
377
|
+
* ]
|
|
378
|
+
* }
|
|
379
|
+
* ]
|
|
380
|
+
* };
|
|
381
|
+
* const page = {
|
|
382
|
+
* title: 'myPageTitle',
|
|
383
|
+
* pageId: 'myPageId',
|
|
384
|
+
* layout
|
|
385
|
+
* };
|
|
386
|
+
* await workspacePlatform.Storage.createPage({page});
|
|
387
|
+
* ```
|
|
388
|
+
* @param page the page to create in persistent storage.
|
|
389
|
+
*/
|
|
92
390
|
createPage(page: CreateSavedPageRequest): Promise<void>;
|
|
391
|
+
/**
|
|
392
|
+
* Update a page in persistent storage.
|
|
393
|
+
*
|
|
394
|
+
* ```ts
|
|
395
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
396
|
+
*
|
|
397
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
398
|
+
* const layout = {
|
|
399
|
+
* content: [
|
|
400
|
+
* {
|
|
401
|
+
* type: 'stack',
|
|
402
|
+
* content: [
|
|
403
|
+
* {
|
|
404
|
+
* type: 'component',
|
|
405
|
+
* componentName: 'view',
|
|
406
|
+
* componentState: {
|
|
407
|
+
* name: 'myViewName',
|
|
408
|
+
* url: 'http://google.com'
|
|
409
|
+
* }
|
|
410
|
+
* }
|
|
411
|
+
* ]
|
|
412
|
+
* }
|
|
413
|
+
* ]
|
|
414
|
+
* };
|
|
415
|
+
* const page = {
|
|
416
|
+
* title: 'myPageTitle',
|
|
417
|
+
* pageId: 'myPageId',
|
|
418
|
+
* layout
|
|
419
|
+
* };
|
|
420
|
+
* const req = {
|
|
421
|
+
* pageId: 'myPageId',
|
|
422
|
+
* page
|
|
423
|
+
* };
|
|
424
|
+
* await workspacePlatform.Storage.updatePage(req);
|
|
425
|
+
* ```
|
|
426
|
+
* @param req the update saved page request.
|
|
427
|
+
*/
|
|
93
428
|
updatePage(req: UpdateSavedPageRequest): Promise<void>;
|
|
429
|
+
/**
|
|
430
|
+
* Delete a page from persistent storage.
|
|
431
|
+
*
|
|
432
|
+
* ```ts
|
|
433
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
434
|
+
*
|
|
435
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
436
|
+
* await workspacePlatform.Storage.deletePage('myPageId');
|
|
437
|
+
* ```
|
|
438
|
+
* @param id the id of the page to delete.
|
|
439
|
+
*/
|
|
94
440
|
deletePage(id: string): Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Save a page in persistent storage.
|
|
443
|
+
*
|
|
444
|
+
* This is a helper function that will call `getPage` to determine if a page is already in storage.
|
|
445
|
+
* If the page is already in storage, it will call `updatePage`.
|
|
446
|
+
* If it does not exist in storage, the function will call `createPage` instead.
|
|
447
|
+
*
|
|
448
|
+
* ```ts
|
|
449
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
450
|
+
*
|
|
451
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
452
|
+
* const layout = {
|
|
453
|
+
* content: [
|
|
454
|
+
* {
|
|
455
|
+
* type: 'stack',
|
|
456
|
+
* content: [
|
|
457
|
+
* {
|
|
458
|
+
* type: 'component',
|
|
459
|
+
* componentName: 'view',
|
|
460
|
+
* componentState: {
|
|
461
|
+
* name: 'myViewName',
|
|
462
|
+
* url: 'http://google.com'
|
|
463
|
+
* }
|
|
464
|
+
* }
|
|
465
|
+
* ]
|
|
466
|
+
* }
|
|
467
|
+
* ]
|
|
468
|
+
* };
|
|
469
|
+
* const page = {
|
|
470
|
+
* title: 'myPageTitle',
|
|
471
|
+
* pageId: 'myPageId',
|
|
472
|
+
* layout
|
|
473
|
+
* };
|
|
474
|
+
* await workspacePlatform.Storage.savePage(page);
|
|
475
|
+
* ```
|
|
476
|
+
* @param page the page to save.
|
|
477
|
+
*/
|
|
95
478
|
savePage(page: Page): Promise<void>;
|
|
96
479
|
}
|
|
97
|
-
|
|
480
|
+
/**
|
|
481
|
+
* Request for launching an application.
|
|
482
|
+
*/
|
|
483
|
+
export interface LaunchAppRequest {
|
|
98
484
|
target?: OpenFin.EntityInfo;
|
|
99
485
|
app: App;
|
|
100
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Get Themes from API
|
|
489
|
+
*/
|
|
490
|
+
export interface ThemeApi {
|
|
491
|
+
getThemes(): Promise<CustomThemes>;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Controller for a Workspace Platform.
|
|
495
|
+
*/
|
|
101
496
|
export interface WorkspacePlatformModule extends OpenFin.Platform {
|
|
102
497
|
/**
|
|
103
498
|
* Launch a browser snapshot that contains windows with pages.
|
|
@@ -105,29 +500,131 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
|
|
|
105
500
|
* @param snapshot the browser snapshot to launch or a url or filepath to retrieve a JSON snapshot.
|
|
106
501
|
*/
|
|
107
502
|
applySnapshot(snapshot: BrowserSnapshot | string): Promise<OpenFin.Platform>;
|
|
503
|
+
/**
|
|
504
|
+
* Get a snapshot that contains browser windows with pages.
|
|
505
|
+
*/
|
|
108
506
|
getSnapshot(): Promise<BrowserSnapshot>;
|
|
109
|
-
|
|
507
|
+
/**
|
|
508
|
+
* Launch an application.
|
|
509
|
+
* ```ts
|
|
510
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
511
|
+
*
|
|
512
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
513
|
+
* const req = {
|
|
514
|
+
* app: {
|
|
515
|
+
* appId: 'myAppId',
|
|
516
|
+
* title: 'appTitle',
|
|
517
|
+
* manifest: 'http://localhost/app.json',
|
|
518
|
+
* manifestType: AppManifestType.Manifest,
|
|
519
|
+
* icons:[
|
|
520
|
+
* {
|
|
521
|
+
* icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
522
|
+
* src: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
523
|
+
* type: "ico",
|
|
524
|
+
* },
|
|
525
|
+
* ]
|
|
526
|
+
* }
|
|
527
|
+
* }
|
|
528
|
+
* workspacePlatform.launchApp(req);
|
|
529
|
+
*
|
|
530
|
+
* ```
|
|
531
|
+
* @param req the launch app request.
|
|
532
|
+
*/
|
|
533
|
+
launchApp(req: LaunchAppRequest): Promise<void>;
|
|
534
|
+
/**
|
|
535
|
+
* The browser window factory for the Workspace Platform.
|
|
536
|
+
*/
|
|
110
537
|
Browser: BrowserWindowFactory;
|
|
538
|
+
/**
|
|
539
|
+
* The storage API for the Workspace Platform.
|
|
540
|
+
*/
|
|
111
541
|
Storage: WorkspacePlatformStorage;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Theme API for the Workspace Platform.
|
|
544
|
+
*/
|
|
545
|
+
Theme: ThemeApi;
|
|
115
546
|
}
|
|
116
547
|
export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
|
|
548
|
+
/**
|
|
549
|
+
* Implementation for getting a list of saved pages from persistent storage.
|
|
550
|
+
* @param query an optional query.
|
|
551
|
+
*/
|
|
117
552
|
getSavedPages(query?: string): Promise<Page[]>;
|
|
553
|
+
/**
|
|
554
|
+
* Implementation for getting a single page in persistent storage.
|
|
555
|
+
* @param id
|
|
556
|
+
*/
|
|
118
557
|
getSavedPage(id: string): Promise<Page>;
|
|
558
|
+
/**
|
|
559
|
+
* Implementation for creating a saved page in persistent storage.
|
|
560
|
+
* @param req the create saved page request.
|
|
561
|
+
*/
|
|
119
562
|
createSavedPage(req: CreateSavedPageRequest): Promise<void>;
|
|
563
|
+
/**
|
|
564
|
+
* Implementation for updating a saved page in persistent storage.
|
|
565
|
+
* @param req the update saved page request.
|
|
566
|
+
*/
|
|
120
567
|
updateSavedPage(req: UpdateSavedPageRequest): Promise<void>;
|
|
568
|
+
/**
|
|
569
|
+
* Implementation for deleting a saved page in persistent storage.
|
|
570
|
+
* @param id of the id of the page to delete.
|
|
571
|
+
*/
|
|
121
572
|
deleteSavedPage(id: string): Promise<void>;
|
|
122
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Configuration for initializing a Workspace platform.
|
|
576
|
+
*/
|
|
123
577
|
export interface WorkspacePlatformInitConfig {
|
|
124
|
-
browser
|
|
125
|
-
|
|
126
|
-
|
|
578
|
+
/** Config for overriding browser options and behavior. */
|
|
579
|
+
browser?: BrowserInitConfig;
|
|
580
|
+
/** Custom Themes object */
|
|
581
|
+
theme?: CustomThemes;
|
|
127
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* Extend or replace default functionality in order to customize behavior of a Workspace Platform Provider.
|
|
585
|
+
*
|
|
586
|
+
* To implement your own handlers for Workspace Platform behavior, extend the provided class and override any methods you'd like to alter.
|
|
587
|
+
*
|
|
588
|
+
* ```ts
|
|
589
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
590
|
+
* import { UpdateSavedPageRequest } from '../../client-api-platform/src/shapes';
|
|
591
|
+
*
|
|
592
|
+
* const overrideCallback: WorkspacePlatform.BrowserOverrideCallback = async (
|
|
593
|
+
* WorkspacePlatformProvider
|
|
594
|
+
* ) => {
|
|
595
|
+
* class Override extends WorkspacePlatformProvider {
|
|
596
|
+
* updateSavedPage = async (req: UpdateSavedPageRequest): Promise<void> => {
|
|
597
|
+
* console.log(`saving page ${req.page.pageId}`);
|
|
598
|
+
* // calling custom function to the save page here
|
|
599
|
+
* };
|
|
600
|
+
* }
|
|
601
|
+
* return new Override();
|
|
602
|
+
* };
|
|
603
|
+
*
|
|
604
|
+
* await WorkspacePlatform.init({
|
|
605
|
+
* browser: { overrideCallback },
|
|
606
|
+
* });
|
|
607
|
+
*/
|
|
608
|
+
export declare type BrowserOverrideCallback = OpenFin.OverrideCallback<WorkspacePlatformProvider>;
|
|
609
|
+
/**
|
|
610
|
+
* Configuration for initializing a Browser.
|
|
611
|
+
*/
|
|
128
612
|
export interface BrowserInitConfig {
|
|
613
|
+
/**
|
|
614
|
+
* Default options for creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createWindow(options) call will default to the value provided in this field.
|
|
615
|
+
*/
|
|
129
616
|
defaultWindowOptions?: BrowserCreateWindowRequest;
|
|
617
|
+
/**
|
|
618
|
+
* The default options when creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createView(options) call will default to the value provided in this field.
|
|
619
|
+
*/
|
|
130
620
|
defaultViewOptions?: OpenFin.ViewOptions;
|
|
131
|
-
|
|
621
|
+
/**
|
|
622
|
+
* Override workspace platform behavior
|
|
623
|
+
*/
|
|
624
|
+
overrideCallback?: BrowserOverrideCallback;
|
|
625
|
+
/**
|
|
626
|
+
* Override workspace platform interop behavior
|
|
627
|
+
* https://cdn.openfin.co/docs/javascript/stable/InteropBroker.html
|
|
628
|
+
*/
|
|
132
629
|
interopOverride?: OpenFin.OverrideCallback<InteropBroker, InteropBroker>;
|
|
133
630
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Page } from '
|
|
1
|
+
import type { Page } from '../../../../common/src/api/pages/shapes';
|
|
2
2
|
export declare const store: import("idb-keyval").UseStore;
|
|
3
3
|
export declare function getPage(id: string): Promise<Page>;
|
|
4
4
|
export declare function getPageList(filter?: string): Promise<Page[]>;
|
|
@@ -9,4 +9,4 @@ export declare function deletePage(id: string): Promise<void>;
|
|
|
9
9
|
export declare function updatePage({ pageId, page }: {
|
|
10
10
|
pageId: any;
|
|
11
11
|
page: any;
|
|
12
|
-
}): Promise<
|
|
12
|
+
}): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LayoutExtended } from '
|
|
1
|
+
import { LayoutExtended } from '../../../../common/src/utils/layout';
|
|
2
2
|
import type { AttachedPage, Page, PageLayout, PageWithUpdatableRuntimeAttribs } from './shapes';
|
|
3
3
|
export declare function getLegacyPages(): Promise<Page[]>;
|
|
4
4
|
export declare function cleanPage(page: AttachedPage): Page;
|
|
@@ -14,3 +14,9 @@ export declare const getPageLayout: (layout: any) => Promise<PageLayout>;
|
|
|
14
14
|
* @param layout the layout for the page.
|
|
15
15
|
*/
|
|
16
16
|
export declare const makePage: (title: string, layout: LayoutExtended) => Promise<PageWithUpdatableRuntimeAttribs>;
|
|
17
|
+
/**
|
|
18
|
+
* Clone a page.
|
|
19
|
+
* @param page the page to clone.
|
|
20
|
+
* @returns a clone of the given page.
|
|
21
|
+
*/
|
|
22
|
+
export declare const clonePage: (page: Page) => Promise<PageWithUpdatableRuntimeAttribs>;
|
|
@@ -26,7 +26,8 @@ export declare enum ChannelAction {
|
|
|
26
26
|
HideHome = "hide-home",
|
|
27
27
|
AssignHomeSearchContext = "assign-home-search-context",
|
|
28
28
|
GetLegacyPages = "get-legacy-pages",
|
|
29
|
-
GetLegacyWorkspaces = "get-legacy-workspaces"
|
|
29
|
+
GetLegacyWorkspaces = "get-legacy-workspaces",
|
|
30
|
+
GetComputedPlatformTheme = "get-computed-platform-theme"
|
|
30
31
|
}
|
|
31
32
|
export interface ChannelClient extends OpenFin.ChannelClient {
|
|
32
33
|
dispatch: (action: ChannelAction, payload: any) => Promise<any>;
|