@openfin/workspace 12.4.0 → 12.6.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.
@@ -1,4 +1,4 @@
1
- import { AnalyticsEvent } from '../../../common/src/utils/usage-register';
1
+ import { AnalyticsEventInternal } from '../../../common/src/utils/usage-register';
2
2
  import { AnalyticsConfig, WorkspacePlatformProvider } from '../../../client-api-platform/src/shapes';
3
3
  declare global {
4
4
  interface Window {
@@ -9,5 +9,5 @@ declare global {
9
9
  };
10
10
  }
11
11
  }
12
- export declare function analyticsInternal(this: WorkspacePlatformProvider, events: AnalyticsEvent[]): Promise<void>;
12
+ export declare function analyticsInternal(this: WorkspacePlatformProvider, events: AnalyticsEventInternal[]): Promise<void>;
13
13
  export declare const initPlatformAnalytics: (config?: AnalyticsConfig) => Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { AnalyticsEventInternal } from '../../../../common/src/utils/usage-register';
2
+ import { Page } from '../../../../client-api-platform/src/shapes';
3
+ export declare const addOpenPageToCache: (pageId: Page['pageId'], event: AnalyticsEventInternal) => Map<string, AnalyticsEventInternal>;
4
+ export declare const removeOpenPageFromCache: (pageId: Page['pageId']) => boolean;
5
+ export declare const raiseMissedPageCloseEvents: () => Promise<void>;
@@ -1 +1,2 @@
1
1
  export declare const handleNameCollision: (initialName: string, existingNames: string[]) => string;
2
+ export declare const listenForStoreClose: () => void;
@@ -20,7 +20,7 @@ export declare function getInitialWorkspace(): Promise<Workspace>;
20
20
  * @returns the current active workspace.
21
21
  */
22
22
  export declare function getCurrentWorkspace(): Promise<Workspace>;
23
- export declare function getLastSavedWorkspace(): Promise<Workspace>;
23
+ export declare function getLastSavedWorkspace(): Promise<Workspace | undefined>;
24
24
  export declare const createWorkspaceInStorage: (req: CreateSavedWorkspaceRequest) => Promise<any>;
25
25
  export declare const getWorkspacesInStorage: () => Promise<Workspace[]>;
26
26
  export declare const getWorkspaceInStorage: (id: string) => Promise<Workspace>;
@@ -1,6 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { IconProps } from '@openfin/ui-library';
3
- import type { AnalyticsEvent } from '../../common/src/utils/usage-register';
3
+ import type { AnalyticsEvent, AnalyticsEventInternal } from '../../common/src/utils/usage-register';
4
4
  import { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
5
5
  import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
6
6
  import type { CustomThemes } from '../../common/src/api/theming';
@@ -1183,12 +1183,32 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1183
1183
  */
1184
1184
  setActiveWorkspace(workspace: Workspace): Promise<void>;
1185
1185
  /**
1186
- * Closes content from the current workspace and applies the given workspace to the user's desktop. Makes that
1187
- * workspace the active workspace.
1186
+ * Applies the given workspace to the user's desktop. Makes that workspace the active workspace.
1187
+ *
1188
1188
  * @param workspace the workspace to apply to the desktop and set as the current active workspace.
1189
1189
  * @param options see {@link ApplyWorkspaceOptions}.
1190
1190
  *
1191
1191
  * @returns true if the workspace was applied, false if the workspace was not applied.
1192
+ *
1193
+ * @example Brief example of how to apply a workspace, currently stored in storage, to the desktop.
1194
+ *
1195
+ * ```ts
1196
+ * const workspacePlatform = getCurrentSync();
1197
+
1198
+ * // This assumes that there is at least one workspace in storage.
1199
+ * const allWorkspaces = await workspacePlatform.Storage.getWorkspaces();
1200
+ *
1201
+ * // Apply the first workspace in storage to the desktop.
1202
+ * await workspacePlatform.applyWorkspace(allWorkspaces[0], {
1203
+ * // Customize the behavior of the applyWorkspace call.
1204
+ * skipPrompt: false,
1205
+ * applySnapshotOptions: {
1206
+ * closeExistingWindows: false,
1207
+ * closeSnapshotWindows: false,
1208
+ * skipOutOfBoundsCheck: false,
1209
+ * },
1210
+ * });
1211
+ * ```
1192
1212
  */
1193
1213
  applyWorkspace(workspace: Workspace, options?: ApplyWorkspaceOptions): Promise<boolean>;
1194
1214
  /**
@@ -1203,7 +1223,7 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1203
1223
  * Theme API for the Workspace Platform.
1204
1224
  */
1205
1225
  Theme: ThemeApi;
1206
- _raiseAnalytics(events: AnalyticsEvent[]): Promise<void>;
1226
+ _raiseAnalytics(events: AnalyticsEventInternal[]): Promise<void>;
1207
1227
  }
1208
1228
  export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
1209
1229
  /**
@@ -1359,17 +1379,23 @@ export interface ApplyWorkspaceOptions {
1359
1379
  */
1360
1380
  promptContainerWindowIdentity?: OpenFin.Identity;
1361
1381
  /**
1362
- * @inheritdoc OpenFin.ApplySnapshotOptions
1382
+ * Options to apply the workspace spanshot with.
1363
1383
  */
1364
- applySnapshotOptions?: OpenFin.ApplySnapshotOptions & {
1365
- /**
1366
- * When true, applyWorkspace will close all existing windows,
1367
- * replacing current Platform state with the given snapshot.
1368
- *
1369
- * @default true
1370
- */
1371
- closeExistingWindows?: boolean;
1372
- };
1384
+ applySnapshotOptions?: ApplySnapshotOptions;
1385
+ }
1386
+ /**
1387
+ * Options used within the {@link WorkspacePlatformModule.applyWorkspace applyWorkspace} method.
1388
+ *
1389
+ * @inheritdoc OpenFin.ApplySnapshotOptions
1390
+ */
1391
+ export interface ApplySnapshotOptions extends OpenFin.ApplySnapshotOptions {
1392
+ /**
1393
+ * When true, applyWorkspace will close all existing windows,
1394
+ * replacing current Platform state with the given snapshot.
1395
+ *
1396
+ * @default true
1397
+ */
1398
+ closeExistingWindows?: boolean;
1373
1399
  }
1374
1400
  /**
1375
1401
  * Payload received by applyWorkspace platform provider method
@@ -15,6 +15,7 @@ export interface Overrides {
15
15
  };
16
16
  disableRuntimeValidation: boolean;
17
17
  disableOpenFinAnalytics: boolean;
18
+ analyticsEndpoint: string;
18
19
  }
19
20
  export declare function getOverrides(): Promise<Partial<Overrides>>;
20
21
  export declare const useOverrides: () => Partial<Overrides>;
@@ -0,0 +1,23 @@
1
+ import { AnalyticsEventInternal } from './usage-register';
2
+ export declare const generateHash: (text: string) => Promise<string>;
3
+ interface AnalyticsBackendPayload {
4
+ d: {
5
+ app_config: string;
6
+ app_name: string;
7
+ app_uuid: string;
8
+ clientId: string;
9
+ combined_id: string;
10
+ content_url: string;
11
+ machine_id: string;
12
+ manifest_type: 'platform';
13
+ os: string;
14
+ runtime_version: string;
15
+ rvm_version: string;
16
+ type: 'workspace-analytics';
17
+ u: string;
18
+ data: AnalyticsEventInternal;
19
+ timestamp: string;
20
+ };
21
+ }
22
+ export declare const decorateAnalyticsPayload: (event: AnalyticsEventInternal) => Promise<AnalyticsBackendPayload>;
23
+ export {};
@@ -21,7 +21,8 @@ export declare enum PageRoute {
21
21
  ResponseModal = "/browser/popup-menu/response-modal/",
22
22
  Docs = "/provider/docs/",
23
23
  Storefront = "/storefront/",
24
- DeprecatedAlert = "/provider/deprecated-alert/"
24
+ DeprecatedAlert = "/provider/deprecated-alert/",
25
+ Analytics = "/provider/analytics/"
25
26
  }
26
27
  /**
27
28
  * All routes that serve assets. (icons, json, etc.)
@@ -57,6 +58,7 @@ declare const _default: {
57
58
  Docs: PageRoute.Docs;
58
59
  Storefront: PageRoute.Storefront;
59
60
  DeprecatedAlert: PageRoute.DeprecatedAlert;
61
+ Analytics: PageRoute.Analytics;
60
62
  IconOpenFinLogo: AssetRoute.IconOpenFinLogo;
61
63
  IconFilter: AssetRoute.IconFilter;
62
64
  LightStorefront: AssetRoute.LightStorefront;
@@ -43,10 +43,17 @@ export declare type AnalyticsEvent = {
43
43
  entityId?: OpenFin.Identity;
44
44
  data?: any;
45
45
  };
46
- export declare type AnalyticsEventInternal = Omit<AnalyticsEvent, 'source'>;
47
- export declare const raiseBrowserAnalytics: (payload: AnalyticsEventInternal) => Promise<void>;
46
+ export interface AnalyticsEventInternal extends AnalyticsEvent {
47
+ /**
48
+ * By default, all event values are redacted before sending to OF.
49
+ * For events not containing any identifiable information, set this to true.
50
+ */
51
+ skipValueHashing?: boolean;
52
+ }
53
+ export declare type AnalyticsEventRaise = Omit<AnalyticsEventInternal, 'source'>;
54
+ export declare const raiseBrowserAnalytics: (payload: AnalyticsEventRaise) => Promise<void>;
48
55
  export declare const raiseBrowserPageAnalytics: (pages: AttachedPage[], action: string) => Promise<void>;
49
- export declare const raiseHomeAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventInternal) => Promise<void>;
50
- export declare const raiseDockAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventInternal) => Promise<void>;
51
- export declare const raiseStorefrontAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventInternal) => Promise<void>;
52
- export declare const raiseInteropAnalytics: (payload: AnalyticsEventInternal) => Promise<void>;
56
+ export declare const raiseHomeAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventRaise) => Promise<void>;
57
+ export declare const raiseDockAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventRaise) => Promise<void>;
58
+ export declare const raiseStorefrontAnalytics: (platformIdentity: OpenFin.Identity, payload: AnalyticsEventRaise) => Promise<void>;
59
+ export declare const raiseInteropAnalytics: (payload: AnalyticsEventRaise) => Promise<void>;