@openfin/core 31.74.30 → 31.75.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.
Files changed (60) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +57 -13
  3. package/src/api/application/Instance.js +23 -5
  4. package/src/api/base.d.ts +1 -2
  5. package/src/api/base.js +1 -2
  6. package/src/api/events/system.d.ts +6 -3
  7. package/src/api/fin.js +1 -2
  8. package/src/api/interappbus/channel/index.d.ts +1 -0
  9. package/src/api/interappbus/channel/index.js +47 -47
  10. package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
  11. package/src/api/interappbus/index.js +1 -1
  12. package/src/api/interop/InteropClient.d.ts +1 -1
  13. package/src/api/interop/InteropClient.js +1 -1
  14. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  15. package/src/api/interop/SessionContextGroupBroker.js +5 -4
  16. package/src/api/interop/SessionContextGroupClient.js +1 -1
  17. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  18. package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
  19. package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
  20. package/src/api/interop/fdc3/utils.js +24 -4
  21. package/src/api/platform/Factory.d.ts +2 -1
  22. package/src/api/platform/Instance.d.ts +5 -4
  23. package/src/api/platform/Instance.js +2 -1
  24. package/src/api/platform/layout/Factory.js +6 -4
  25. package/src/api/platform/layout/Instance.js +3 -0
  26. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +7 -4
  27. package/src/api/platform/layout/controllers/layout-entities-controller.js +42 -11
  28. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +2 -1
  29. package/src/api/platform/layout/entities/layout-entities.d.ts +143 -42
  30. package/src/api/platform/layout/entities/layout-entities.js +151 -43
  31. package/src/api/platform/layout/utils/layout-traversal.d.ts +1 -0
  32. package/src/api/platform/layout/utils/layout-traversal.js +11 -11
  33. package/src/api/platform/provider.d.ts +2 -1
  34. package/src/api/system/index.d.ts +9 -0
  35. package/src/api/system/index.js +78 -40
  36. package/src/api/view/Instance.d.ts +6 -3
  37. package/src/api/view/Instance.js +9 -7
  38. package/src/api/webcontents/main.d.ts +2 -22
  39. package/src/api/webcontents/main.js +2 -1
  40. package/src/api/window/Instance.d.ts +10 -0
  41. package/src/api/window/Instance.js +22 -0
  42. package/src/environment/mockEnvironment.d.ts +27 -0
  43. package/src/environment/mockEnvironment.js +61 -0
  44. package/src/mock.js +4 -83
  45. package/src/shapes/protocol.d.ts +17 -0
  46. package/src/transport/mockWire.d.ts +11 -0
  47. package/src/transport/mockWire.js +26 -0
  48. package/src/transport/transport-errors.d.ts +9 -1
  49. package/src/transport/transport-errors.js +45 -2
  50. package/src/transport/transport.d.ts +15 -5
  51. package/src/transport/transport.js +48 -20
  52. package/src/util/channel-api-relay.js +11 -1
  53. package/src/util/errors.d.ts +1 -0
  54. package/src/util/errors.js +1 -0
  55. package/src/util/lazy.d.ts +18 -0
  56. package/src/util/lazy.js +29 -1
  57. package/src/util/ref-counter.d.ts +1 -1
  58. package/src/util/ref-counter.js +3 -2
  59. package/src/transport/fin_store.d.ts +0 -4
  60. package/src/transport/fin_store.js +0 -16
@@ -4,6 +4,7 @@ const base_1 = require("../../base");
4
4
  const utils_1 = require("./utils");
5
5
  const utils_2 = require("../utils");
6
6
  const InteropClient_1 = require("../InteropClient");
7
+ const lodash_1 = require("lodash");
7
8
  /**
8
9
  * @typedef { object } Listener
9
10
  * @summary Listener object returned by addContextListener and addIntentListener
@@ -393,7 +394,39 @@ class Fdc3Module extends base_1.Base {
393
394
  return {
394
395
  ...currentContextGroupInfo,
395
396
  type: 'system',
396
- addContextListener: this.addContextListener.bind(this),
397
+ addContextListener: (contextType, handler) => {
398
+ let realHandler;
399
+ let realType;
400
+ if (typeof contextType === 'function') {
401
+ console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
402
+ realHandler = contextType;
403
+ }
404
+ else {
405
+ realHandler = handler;
406
+ if (typeof contextType === 'string') {
407
+ realType = contextType;
408
+ }
409
+ }
410
+ const listener = (async () => {
411
+ let first = true;
412
+ const currentContext = await this.fin.me.interop.getCurrentContext(realType);
413
+ const wrappedHandler = (context, contextMetadata) => {
414
+ if (first) {
415
+ first = false;
416
+ if ((0, lodash_1.isEqual)(currentContext, context)) {
417
+ return;
418
+ }
419
+ }
420
+ // eslint-disable-next-line consistent-return
421
+ return realHandler(context, contextMetadata);
422
+ };
423
+ return this.fin.me.interop.addContextHandler(wrappedHandler, realType);
424
+ })();
425
+ return {
426
+ ...listener,
427
+ unsubscribe: () => listener.then((l) => l.unsubscribe())
428
+ };
429
+ },
397
430
  broadcast: this.broadcast.bind(this),
398
431
  getCurrentContext: async (contextType) => {
399
432
  const context = await this.fin.me.interop.getCurrentContext(contextType);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  const PrivateChannelClient_1 = require("./PrivateChannelClient");
6
+ const lodash_1 = require("lodash");
6
7
  const getUnsupportedChannelApis = (channelType) => {
7
8
  return {
8
9
  addContextListener: () => {
@@ -111,14 +112,33 @@ const buildAppChannelObject = (sessionContextGroup) => {
111
112
  return context === undefined ? null : context;
112
113
  },
113
114
  addContextListener: (contextType, handler) => {
114
- let listener;
115
+ let realHandler;
116
+ let realType;
115
117
  if (typeof contextType === 'function') {
116
118
  console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
117
- listener = sessionContextGroup.addContextHandler(contextType);
119
+ realHandler = contextType;
118
120
  }
119
121
  else {
120
- listener = sessionContextGroup.addContextHandler(handler, contextType === null ? undefined : contextType);
122
+ realHandler = handler;
123
+ if (typeof contextType === 'string') {
124
+ realType = contextType;
125
+ }
121
126
  }
127
+ const listener = (async () => {
128
+ let first = true;
129
+ const currentContext = await sessionContextGroup.getCurrentContext(realType);
130
+ const wrappedHandler = (context, contextMetadata) => {
131
+ if (first) {
132
+ first = false;
133
+ if ((0, lodash_1.isEqual)(currentContext, context)) {
134
+ return;
135
+ }
136
+ }
137
+ // eslint-disable-next-line consistent-return
138
+ return realHandler(context, contextMetadata);
139
+ };
140
+ return sessionContextGroup.addContextHandler(wrappedHandler, realType);
141
+ })();
122
142
  return {
123
143
  ...listener,
124
144
  unsubscribe: () => listener.then((l) => l.unsubscribe())
@@ -149,7 +169,7 @@ exports.isContext = isContext;
149
169
  const isChannel = (channel) => {
150
170
  if (channel && typeof channel === 'object' && 'type' in channel && 'id' in channel) {
151
171
  const { type, id } = channel;
152
- return (typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private'));
172
+ return typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private');
153
173
  }
154
174
  return false;
155
175
  };
@@ -1,8 +1,8 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import { Base } from '../base';
3
- import { Channel } from '../interappbus/channel/index';
4
3
  import { Transport } from '../../transport/transport';
5
4
  import { LayoutModule } from './layout/index';
5
+ type Channel = OpenFin.Fin['InterApplicationBus']['Channel'];
6
6
  /**
7
7
  * @PORTED
8
8
  * InitPlatformOptions interface
@@ -113,3 +113,4 @@ export default class PlatformModule extends Base {
113
113
  */
114
114
  startFromManifest(manifestUrl: string, opts?: OpenFin.RvmLaunchOptions): Promise<OpenFin.Platform>;
115
115
  }
116
+ export {};
@@ -1,9 +1,9 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
- import { View } from '../view';
3
2
  import { EmitterBase } from '../base';
4
- import { Channel } from '../interappbus/channel/index';
5
- import ChannelClient from '../interappbus/channel/client';
6
- import { LayoutModule } from './layout';
3
+ type View = OpenFin.View;
4
+ type Channel = OpenFin.Fin['InterApplicationBus']['Channel'];
5
+ type ChannelClient = OpenFin.ChannelClient;
6
+ type LayoutModule = OpenFin.Fin['Platform']['Layout'];
7
7
  /** Manages the life cycle of windows and views in the application.
8
8
  *
9
9
  * Enables taking snapshots of itself and applyi
@@ -147,3 +147,4 @@ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
147
147
  skipBeforeUnload: boolean;
148
148
  }): Promise<void>;
149
149
  }
150
+ export {};
@@ -7,6 +7,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
7
7
  var _Platform_connectToProvider;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Platform = void 0;
10
+ /* eslint-disable import/prefer-default-export, no-undef */
10
11
  const base_1 = require("../base");
11
12
  const validate_1 = require("../../util/validate");
12
13
  // Reuse clients to avoid overwriting already-registered client in provider
@@ -78,7 +79,7 @@ class Platform extends base_1.EmitterBase {
78
79
  const response = await client.dispatch('create-view', {
79
80
  target,
80
81
  opts: viewOptions,
81
- targetView,
82
+ targetView
82
83
  });
83
84
  if (!response || (0, validate_1.validateIdentity)(response.identity)) {
84
85
  throw new Error(`When overwriting the createView call, please return an object that has a valid 'identity' property: ${JSON.stringify(response)}`);
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
11
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
12
  };
13
- var _LayoutModule_layoutManager;
13
+ var _LayoutModule_layoutManager, _LayoutModule_layoutInitializationAttempted;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.LayoutModule = void 0;
16
16
  /* eslint-disable no-undef, import/prefer-default-export */
@@ -91,6 +91,7 @@ class LayoutModule extends base_1.Base {
91
91
  constructor() {
92
92
  super(...arguments);
93
93
  _LayoutModule_layoutManager.set(this, void 0);
94
+ _LayoutModule_layoutInitializationAttempted.set(this, false);
94
95
  /**
95
96
  * Initialize the window's Layout. Must be called from a custom window that has a 'layout' option set upon creation of that window.
96
97
  * If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
@@ -109,9 +110,10 @@ class LayoutModule extends base_1.Base {
109
110
  if (!this.fin.me.isWindow) {
110
111
  throw new Error('Layout.init can only be called from a Window context.');
111
112
  }
112
- else if (__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f")) {
113
+ else if (__classPrivateFieldGet(this, _LayoutModule_layoutInitializationAttempted, "f")) {
113
114
  throw new Error('Layout for this window already initialized, please use Layout.replace call to replace the layout.');
114
115
  }
116
+ __classPrivateFieldSet(this, _LayoutModule_layoutInitializationAttempted, true, "f");
115
117
  // We need to go through environment to make sure it is only imported/bundled in OpenFin.
116
118
  const ManagerConstructor = await this.wire.environment.getManagerConstructor();
117
119
  const viewOverlay = new view_overlay_1.ViewOverlay(this.wire);
@@ -136,7 +138,7 @@ class LayoutModule extends base_1.Base {
136
138
  const { client, ofWindow } = ManagerConstructor.getClientAndWindow(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"));
137
139
  // expose LayoutEntitiesController instance for API consumption
138
140
  const channelStrategy = new api_exposer_1.ChannelsExposer(client);
139
- await new api_exposer_1.ApiExposer(channelStrategy).exposeInstance(new layout_entities_controller_1.LayoutEntitiesController(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"), ofWindow.identity.uuid, contentItemCache), { id: layout_constants_1.LAYOUT_CONTROLLER_ID });
141
+ await new api_exposer_1.ApiExposer(channelStrategy).exposeInstance(new layout_entities_controller_1.LayoutEntitiesController(__classPrivateFieldGet(this, _LayoutModule_layoutManager, "f"), contentItemCache), { id: layout_constants_1.LAYOUT_CONTROLLER_ID });
140
142
  // Adding this to the returned instance undocumented/typed for Browser.
141
143
  return Object.assign(this.getCurrentSync(), { layoutManager: __classPrivateFieldGet(this, _LayoutModule_layoutManager, "f") });
142
144
  };
@@ -203,4 +205,4 @@ class LayoutModule extends base_1.Base {
203
205
  }
204
206
  }
205
207
  exports.LayoutModule = LayoutModule;
206
- _LayoutModule_layoutManager = new WeakMap();
208
+ _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_layoutInitializationAttempted = new WeakMap();
@@ -114,6 +114,9 @@ class Layout extends base_1.Base {
114
114
  * @return {Promise<TabStack | ColumnOrRow>}
115
115
  */
116
116
  async getRootItem() {
117
+ this.wire.sendAction('layout-get-root-item').catch(() => {
118
+ // don't expose
119
+ });
117
120
  const client = await __classPrivateFieldGet(this, _Layout_layoutClient, "f").getValue();
118
121
  const root = await client.getRoot();
119
122
  return layout_entities_1.LayoutNode.getEntity(root, client);
@@ -8,9 +8,10 @@ type ViewCreationOrReference = OpenFin.Identity | OpenFin.PlatformViewCreationOp
8
8
  */
9
9
  export declare class LayoutEntitiesController {
10
10
  private layoutManager;
11
- private uuid;
12
11
  private layoutContentCache;
13
- constructor(layoutManager: any, uuid: string, layoutContentCache: LayoutContentCache);
12
+ private wire;
13
+ constructor(layoutManager: any, layoutContentCache: LayoutContentCache);
14
+ private analytics;
14
15
  /**
15
16
  * @internal
16
17
  * @returns the root contentItem of the layout.
@@ -87,6 +88,7 @@ export declare class LayoutEntitiesController {
87
88
  * @throws If the view does not exist, fails to create, or the stack does not exist.
88
89
  */
89
90
  addViewToStack: (stackEntityId: string, viewCreationOrReference: ViewCreationOrReference, { index }?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
91
+ private findViewInStack;
90
92
  /**
91
93
  * @internal
92
94
  * Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
@@ -102,15 +104,16 @@ export declare class LayoutEntitiesController {
102
104
  * Creates a new adjacent 'stack' and adds the views to it at the specified position
103
105
  * @param targetId Entity id of the content item to add a stack adjacent to it
104
106
  * @param views List of identities or view creation options of the views to include in the stack
105
- * @param options Creation options, defaults to position: 'right'
107
+ * @param options Creation options, defaults to { position: 'right' }
106
108
  * @returns the Entity Id of the new stack
107
109
  */
108
- createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], options: {
110
+ createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], { position }?: {
109
111
  position?: OpenFin.LayoutPosition;
110
112
  }) => Promise<string>;
111
113
  getAdjacentStacks: ({ targetId, edge }: {
112
114
  targetId: string;
113
115
  edge: OpenFin.LayoutPosition;
114
116
  }) => Promise<Pick<OpenFin.LayoutEntityDefinition, 'entityId'>[]>;
117
+ setStackActiveView: (stackEntityId: string, viewIdentity: OpenFin.Identity) => Promise<void>;
115
118
  }
116
119
  export {};
@@ -17,15 +17,20 @@ const layout_traversal_1 = require("../utils/layout-traversal");
17
17
  class LayoutEntitiesController {
18
18
  constructor(
19
19
  // workaround to prevent importing entire GoldenLayouts, also re-written at build time to type any
20
- layoutManager, uuid, layoutContentCache) {
20
+ layoutManager, layoutContentCache) {
21
21
  this.layoutManager = layoutManager;
22
- this.uuid = uuid;
23
22
  this.layoutContentCache = layoutContentCache;
23
+ this.analytics = (topic) => {
24
+ this.wire.sendAction(`layout-controller-${topic}`).catch(() => {
25
+ // don't expose
26
+ });
27
+ };
24
28
  /**
25
29
  * @internal
26
30
  * @returns the root contentItem of the layout.
27
31
  */
28
32
  this.getRoot = () => {
33
+ this.analytics('get-root');
29
34
  const root = this.layoutManager.layout.root.contentItems[0];
30
35
  return {
31
36
  // TODO: fix typing
@@ -42,6 +47,7 @@ class LayoutEntitiesController {
42
47
  */
43
48
  this.getStackByView = async (view) => {
44
49
  var _a, _b, _c, _d;
50
+ this.analytics('get-stack-by-view');
45
51
  const viewComponent = this.layoutManager.getViewComponent(view);
46
52
  if (!viewComponent || ((_b = (_a = viewComponent.container) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent.type) !== 'stack') {
47
53
  return undefined;
@@ -64,12 +70,13 @@ class LayoutEntitiesController {
64
70
  * @throws if the content item associated with the entity id does not exist or is not a stack.
65
71
  */
66
72
  this.getStackViews = (id) => {
73
+ this.analytics('get-stack-views');
67
74
  const stack = this.layoutContentCache.getContentItemOrThrow(id, ['stack']);
68
75
  const views = stack.contentItems.map((ci) => {
69
76
  var _a;
70
77
  return ({
71
78
  name: (_a = ci.config.componentState) === null || _a === void 0 ? void 0 : _a.name,
72
- uuid: this.uuid
79
+ uuid: this.layoutManager.ofWindow.identity.uuid
73
80
  });
74
81
  });
75
82
  return views;
@@ -81,6 +88,7 @@ class LayoutEntitiesController {
81
88
  */
82
89
  this.isRoot = (id) => {
83
90
  var _a;
91
+ this.analytics('is-root');
84
92
  const ci = this.layoutContentCache.getContentItemOrThrow(id);
85
93
  return !!((_a = ci.parent) === null || _a === void 0 ? void 0 : _a.isRoot);
86
94
  };
@@ -91,6 +99,7 @@ class LayoutEntitiesController {
91
99
  * @returns True if the content item exists and belongs to the layout.
92
100
  */
93
101
  this.exists = (entityId) => {
102
+ this.analytics('exists');
94
103
  return this.layoutContentCache.hasKey(entityId);
95
104
  };
96
105
  /**
@@ -110,6 +119,7 @@ class LayoutEntitiesController {
110
119
  * @throws If the view does not exist, fails to create, or the stack does not exist.
111
120
  */
112
121
  this.addViewToStack = async (stackEntityId, viewCreationOrReference, { index } = { index: 0 }) => {
122
+ this.analytics('add-view-to-stack');
113
123
  const currentStack = this.layoutContentCache.getContentItemOrThrow(stackEntityId);
114
124
  if (index && index > currentStack.contentItems.length + 1) {
115
125
  throw new Error(`Index '${index}' out of range, please exclude the index or specify a number between 0 and ${currentStack.contentItems.length}`);
@@ -124,6 +134,9 @@ class LayoutEntitiesController {
124
134
  });
125
135
  return identity;
126
136
  };
137
+ this.findViewInStack = (stack, viewIdentity) => {
138
+ return stack.contentItems.find((ci) => { var _a, _b; return ((_b = (_a = ci.config) === null || _a === void 0 ? void 0 : _a.componentState) === null || _b === void 0 ? void 0 : _b.name) === viewIdentity.name; });
139
+ };
127
140
  /**
128
141
  * @internal
129
142
  * Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
@@ -134,9 +147,11 @@ class LayoutEntitiesController {
134
147
  * @throws If the stack does not exist or the view does not exist or belong to the stack.
135
148
  */
136
149
  this.removeViewFromStack = async (stackEntityId, view) => {
137
- const views = this.getStackViews(stackEntityId);
138
- if (!views.find((existingView) => existingView.name === view.name)) {
139
- throw new Error(`Tried to remove a view ('${view.name}') which does not exist in the stack.`);
150
+ this.analytics('remove-view-from-stack');
151
+ const stack = this.layoutContentCache.getContentItemOrThrow(stackEntityId, ['stack']);
152
+ const viewInstance = this.findViewInStack(stack, view);
153
+ if (!viewInstance) {
154
+ throw new Error(`Tried to remove a view ('${view.name}') which does not belong to the stack.`);
140
155
  }
141
156
  await this.layoutManager.platform.closeView(view);
142
157
  };
@@ -145,14 +160,14 @@ class LayoutEntitiesController {
145
160
  * Creates a new adjacent 'stack' and adds the views to it at the specified position
146
161
  * @param targetId Entity id of the content item to add a stack adjacent to it
147
162
  * @param views List of identities or view creation options of the views to include in the stack
148
- * @param options Creation options, defaults to position: 'right'
163
+ * @param options Creation options, defaults to { position: 'right' }
149
164
  * @returns the Entity Id of the new stack
150
165
  */
151
- this.createAdjacentStack = async (targetId, views, options) => {
152
- if (views.length === 0) {
153
- throw new Error('Cannot create stack with empty view array.');
166
+ this.createAdjacentStack = async (targetId, views, { position = 'right' } = {}) => {
167
+ this.analytics('create-adjacent-stack');
168
+ if (!Array.isArray(views) || views.length === 0) {
169
+ throw new Error('The parameter "views" must be an array with at least 1 element.');
154
170
  }
155
- const { position = 'right' } = options;
156
171
  if (!['top', 'bottom', 'left', 'right'].includes(position)) {
157
172
  throw new Error(`Invalid position '${position}' specified.`);
158
173
  }
@@ -177,12 +192,23 @@ class LayoutEntitiesController {
177
192
  return entityId;
178
193
  };
179
194
  this.getAdjacentStacks = async ({ targetId, edge }) => {
195
+ this.analytics('get-adjacent-stacks');
180
196
  const contentItem = this.layoutContentCache.getContentItemOrThrow(targetId);
181
197
  // call utils helper to traverse and return adjacent stacks
182
198
  return (0, layout_traversal_1.getAdjacentStacks)(contentItem, edge).map((stack) => ({
183
199
  entityId: this.layoutContentCache.getOrCreateEntityId(stack),
184
200
  }));
185
201
  };
202
+ this.setStackActiveView = async (stackEntityId, viewIdentity) => {
203
+ this.analytics('set-stack-active-view');
204
+ const stack = this.layoutContentCache.getContentItemOrThrow(stackEntityId, ['stack']);
205
+ const view = this.findViewInStack(stack, viewIdentity);
206
+ if (!view) {
207
+ throw new Error(`Tried to set a view ('${viewIdentity.name}') as active when it does not belong to the stack.`);
208
+ }
209
+ stack.setActiveContentItem(view, true);
210
+ };
211
+ this.wire = this.layoutManager.platform.wire;
186
212
  }
187
213
  /**
188
214
  * @internal
@@ -193,6 +219,7 @@ class LayoutEntitiesController {
193
219
  * @throws if the entity associated with {@link id} is not in the entity cache, does not belogn to a layout, or is not a column/row.
194
220
  */
195
221
  getContent(id) {
222
+ this.analytics('get-content');
196
223
  const ci = this.layoutContentCache.getContentItemOrThrow(id, ['column', 'row']);
197
224
  return ci.contentItems.map((item) => ({
198
225
  type: item.type,
@@ -209,6 +236,7 @@ class LayoutEntitiesController {
209
236
  * content item or has been removed from the layout entirely.
210
237
  */
211
238
  getParent(id) {
239
+ this.analytics('get-parent');
212
240
  const ci = this.layoutContentCache.getContentItemOrThrow(id);
213
241
  if (ci.parent && !ci.parent.isRoot && ci.parent.contentItems.includes(ci)) {
214
242
  return {
@@ -253,4 +281,7 @@ __decorate([
253
281
  __decorate([
254
282
  (0, decorators_1.expose)()
255
283
  ], LayoutEntitiesController.prototype, "getAdjacentStacks", void 0);
284
+ __decorate([
285
+ (0, decorators_1.expose)()
286
+ ], LayoutEntitiesController.prototype, "setStackActiveView", void 0);
256
287
  exports.LayoutEntitiesController = LayoutEntitiesController;
@@ -1,6 +1,6 @@
1
1
  import type * as OpenFin from '../../../../OpenFin';
2
2
  import { ViewOverlay } from '../utils/view-overlay';
3
- import { View } from '../../../view';
3
+ type View = OpenFin.View;
4
4
  /**
5
5
  * Set of apis used to facilitate tab drag interactions without needing to hide views.
6
6
  * @ignore
@@ -56,3 +56,4 @@ export declare class TabDragController {
56
56
  */
57
57
  observeOverlay: (dropZonePreview: HTMLElement) => Promise<void>;
58
58
  }
59
+ export {};