@openfin/workspace-platform 12.4.0 → 12.6.0

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';
@@ -1131,12 +1131,32 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1131
1131
  */
1132
1132
  setActiveWorkspace(workspace: Workspace): Promise<void>;
1133
1133
  /**
1134
- * Closes content from the current workspace and applies the given workspace to the user's desktop. Makes that
1135
- * workspace the active workspace.
1134
+ * Applies the given workspace to the user's desktop. Makes that workspace the active workspace.
1135
+ *
1136
1136
  * @param workspace the workspace to apply to the desktop and set as the current active workspace.
1137
1137
  * @param options see {@link ApplyWorkspaceOptions}.
1138
1138
  *
1139
1139
  * @returns true if the workspace was applied, false if the workspace was not applied.
1140
+ *
1141
+ * @example Brief example of how to apply a workspace, currently stored in storage, to the desktop.
1142
+ *
1143
+ * ```ts
1144
+ * const workspacePlatform = getCurrentSync();
1145
+
1146
+ * // This assumes that there is at least one workspace in storage.
1147
+ * const allWorkspaces = await workspacePlatform.Storage.getWorkspaces();
1148
+ *
1149
+ * // Apply the first workspace in storage to the desktop.
1150
+ * await workspacePlatform.applyWorkspace(allWorkspaces[0], {
1151
+ * // Customize the behavior of the applyWorkspace call.
1152
+ * skipPrompt: false,
1153
+ * applySnapshotOptions: {
1154
+ * closeExistingWindows: false,
1155
+ * closeSnapshotWindows: false,
1156
+ * skipOutOfBoundsCheck: false,
1157
+ * },
1158
+ * });
1159
+ * ```
1140
1160
  */
1141
1161
  applyWorkspace(workspace: Workspace, options?: ApplyWorkspaceOptions): Promise<boolean>;
1142
1162
  /**
@@ -1151,7 +1171,7 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1151
1171
  * Theme API for the Workspace Platform.
1152
1172
  */
1153
1173
  Theme: ThemeApi;
1154
- _raiseAnalytics(events: AnalyticsEvent[]): Promise<void>;
1174
+ _raiseAnalytics(events: AnalyticsEventInternal[]): Promise<void>;
1155
1175
  }
1156
1176
  export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
1157
1177
  /**
@@ -1289,17 +1309,23 @@ export interface ApplyWorkspaceOptions {
1289
1309
  */
1290
1310
  promptContainerWindowIdentity?: OpenFin.Identity;
1291
1311
  /**
1292
- * @inheritdoc OpenFin.ApplySnapshotOptions
1312
+ * Options to apply the workspace spanshot with.
1293
1313
  */
1294
- applySnapshotOptions?: OpenFin.ApplySnapshotOptions & {
1295
- /**
1296
- * When true, applyWorkspace will close all existing windows,
1297
- * replacing current Platform state with the given snapshot.
1298
- *
1299
- * @default true
1300
- */
1301
- closeExistingWindows?: boolean;
1302
- };
1314
+ applySnapshotOptions?: ApplySnapshotOptions;
1315
+ }
1316
+ /**
1317
+ * Options used within the {@link WorkspacePlatformModule.applyWorkspace applyWorkspace} method.
1318
+ *
1319
+ * @inheritdoc OpenFin.ApplySnapshotOptions
1320
+ */
1321
+ export interface ApplySnapshotOptions extends OpenFin.ApplySnapshotOptions {
1322
+ /**
1323
+ * When true, applyWorkspace will close all existing windows,
1324
+ * replacing current Platform state with the given snapshot.
1325
+ *
1326
+ * @default true
1327
+ */
1328
+ closeExistingWindows?: boolean;
1303
1329
  }
1304
1330
  /**
1305
1331
  * 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>;