@openfin/core 34.78.5 → 34.78.6

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/out/mock.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var require$$0 = require('events');
5
6
  var require$$3 = require('lodash');
6
7
 
7
8
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -10,489 +11,253 @@ var mock = {};
10
11
 
11
12
  var OpenFin$1 = {};
12
13
 
13
- Object.defineProperty(OpenFin$1, "__esModule", { value: true });
14
+ var events = {};
14
15
 
15
- var fin = {};
16
-
17
- var eventsExports = {};
18
- var events = {
19
- get exports(){ return eventsExports; },
20
- set exports(v){ eventsExports = v; },
21
- };
22
-
23
- var R = typeof Reflect === 'object' ? Reflect : null;
24
- var ReflectApply = R && typeof R.apply === 'function'
25
- ? R.apply
26
- : function ReflectApply(target, receiver, args) {
27
- return Function.prototype.apply.call(target, receiver, args);
28
- };
29
-
30
- var ReflectOwnKeys;
31
- if (R && typeof R.ownKeys === 'function') {
32
- ReflectOwnKeys = R.ownKeys;
33
- } else if (Object.getOwnPropertySymbols) {
34
- ReflectOwnKeys = function ReflectOwnKeys(target) {
35
- return Object.getOwnPropertyNames(target)
36
- .concat(Object.getOwnPropertySymbols(target));
37
- };
38
- } else {
39
- ReflectOwnKeys = function ReflectOwnKeys(target) {
40
- return Object.getOwnPropertyNames(target);
41
- };
42
- }
43
-
44
- function ProcessEmitWarning(warning) {
45
- if (console && console.warn) console.warn(warning);
46
- }
47
-
48
- var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
49
- return value !== value;
50
- };
51
-
52
- function EventEmitter() {
53
- EventEmitter.init.call(this);
54
- }
55
- events.exports = EventEmitter;
56
- eventsExports.once = once;
57
-
58
- // Backwards-compat with node 0.10.x
59
- EventEmitter.EventEmitter = EventEmitter;
60
-
61
- EventEmitter.prototype._events = undefined;
62
- EventEmitter.prototype._eventsCount = 0;
63
- EventEmitter.prototype._maxListeners = undefined;
64
-
65
- // By default EventEmitters will print a warning if more than 10 listeners are
66
- // added to it. This is a useful default which helps finding memory leaks.
67
- var defaultMaxListeners = 10;
68
-
69
- function checkListener(listener) {
70
- if (typeof listener !== 'function') {
71
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
72
- }
73
- }
74
-
75
- Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
76
- enumerable: true,
77
- get: function() {
78
- return defaultMaxListeners;
79
- },
80
- set: function(arg) {
81
- if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
82
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
83
- }
84
- defaultMaxListeners = arg;
85
- }
86
- });
87
-
88
- EventEmitter.init = function() {
89
-
90
- if (this._events === undefined ||
91
- this._events === Object.getPrototypeOf(this)._events) {
92
- this._events = Object.create(null);
93
- this._eventsCount = 0;
94
- }
95
-
96
- this._maxListeners = this._maxListeners || undefined;
97
- };
98
-
99
- // Obviously not all Emitters should be limited to 10. This function allows
100
- // that to be increased. Set to zero for unlimited.
101
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
102
- if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
103
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
104
- }
105
- this._maxListeners = n;
106
- return this;
107
- };
108
-
109
- function _getMaxListeners(that) {
110
- if (that._maxListeners === undefined)
111
- return EventEmitter.defaultMaxListeners;
112
- return that._maxListeners;
113
- }
114
-
115
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
116
- return _getMaxListeners(this);
117
- };
118
-
119
- EventEmitter.prototype.emit = function emit(type) {
120
- var args = [];
121
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
122
- var doError = (type === 'error');
123
-
124
- var events = this._events;
125
- if (events !== undefined)
126
- doError = (doError && events.error === undefined);
127
- else if (!doError)
128
- return false;
129
-
130
- // If there is no 'error' event listener then throw.
131
- if (doError) {
132
- var er;
133
- if (args.length > 0)
134
- er = args[0];
135
- if (er instanceof Error) {
136
- // Note: The comments on the `throw` lines are intentional, they show
137
- // up in Node's output if this results in an unhandled exception.
138
- throw er; // Unhandled 'error' event
139
- }
140
- // At least give some kind of context to the user
141
- var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
142
- err.context = er;
143
- throw err; // Unhandled 'error' event
144
- }
145
-
146
- var handler = events[type];
147
-
148
- if (handler === undefined)
149
- return false;
150
-
151
- if (typeof handler === 'function') {
152
- ReflectApply(handler, this, args);
153
- } else {
154
- var len = handler.length;
155
- var listeners = arrayClone(handler, len);
156
- for (var i = 0; i < len; ++i)
157
- ReflectApply(listeners[i], this, args);
158
- }
159
-
160
- return true;
161
- };
162
-
163
- function _addListener(target, type, listener, prepend) {
164
- var m;
165
- var events;
166
- var existing;
167
-
168
- checkListener(listener);
169
-
170
- events = target._events;
171
- if (events === undefined) {
172
- events = target._events = Object.create(null);
173
- target._eventsCount = 0;
174
- } else {
175
- // To avoid recursion in the case that type === "newListener"! Before
176
- // adding it to the listeners, first emit "newListener".
177
- if (events.newListener !== undefined) {
178
- target.emit('newListener', type,
179
- listener.listener ? listener.listener : listener);
180
-
181
- // Re-assign `events` because a newListener handler could have caused the
182
- // this._events to be assigned to a new object
183
- events = target._events;
184
- }
185
- existing = events[type];
186
- }
187
-
188
- if (existing === undefined) {
189
- // Optimize the case of one listener. Don't need the extra array object.
190
- existing = events[type] = listener;
191
- ++target._eventsCount;
192
- } else {
193
- if (typeof existing === 'function') {
194
- // Adding the second element, need to change to array.
195
- existing = events[type] =
196
- prepend ? [listener, existing] : [existing, listener];
197
- // If we've already got an array, just append.
198
- } else if (prepend) {
199
- existing.unshift(listener);
200
- } else {
201
- existing.push(listener);
202
- }
203
-
204
- // Check for listener leak
205
- m = _getMaxListeners(target);
206
- if (m > 0 && existing.length > m && !existing.warned) {
207
- existing.warned = true;
208
- // No error code for this since it is a Warning
209
- // eslint-disable-next-line no-restricted-syntax
210
- var w = new Error('Possible EventEmitter memory leak detected. ' +
211
- existing.length + ' ' + String(type) + ' listeners ' +
212
- 'added. Use emitter.setMaxListeners() to ' +
213
- 'increase limit');
214
- w.name = 'MaxListenersExceededWarning';
215
- w.emitter = target;
216
- w.type = type;
217
- w.count = existing.length;
218
- ProcessEmitWarning(w);
219
- }
220
- }
221
-
222
- return target;
223
- }
224
-
225
- EventEmitter.prototype.addListener = function addListener(type, listener) {
226
- return _addListener(this, type, listener, false);
227
- };
228
-
229
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
230
-
231
- EventEmitter.prototype.prependListener =
232
- function prependListener(type, listener) {
233
- return _addListener(this, type, listener, true);
234
- };
235
-
236
- function onceWrapper() {
237
- if (!this.fired) {
238
- this.target.removeListener(this.type, this.wrapFn);
239
- this.fired = true;
240
- if (arguments.length === 0)
241
- return this.listener.call(this.target);
242
- return this.listener.apply(this.target, arguments);
243
- }
244
- }
16
+ var application$1 = {};
245
17
 
246
- function _onceWrap(target, type, listener) {
247
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
248
- var wrapped = onceWrapper.bind(state);
249
- wrapped.listener = listener;
250
- state.wrapFn = wrapped;
251
- return wrapped;
252
- }
253
-
254
- EventEmitter.prototype.once = function once(type, listener) {
255
- checkListener(listener);
256
- this.on(type, _onceWrap(this, type, listener));
257
- return this;
258
- };
259
-
260
- EventEmitter.prototype.prependOnceListener =
261
- function prependOnceListener(type, listener) {
262
- checkListener(listener);
263
- this.prependListener(type, _onceWrap(this, type, listener));
264
- return this;
265
- };
266
-
267
- // Emits a 'removeListener' event if and only if the listener was removed.
268
- EventEmitter.prototype.removeListener =
269
- function removeListener(type, listener) {
270
- var list, events, position, i, originalListener;
271
-
272
- checkListener(listener);
273
-
274
- events = this._events;
275
- if (events === undefined)
276
- return this;
277
-
278
- list = events[type];
279
- if (list === undefined)
280
- return this;
281
-
282
- if (list === listener || list.listener === listener) {
283
- if (--this._eventsCount === 0)
284
- this._events = Object.create(null);
285
- else {
286
- delete events[type];
287
- if (events.removeListener)
288
- this.emit('removeListener', type, list.listener || listener);
289
- }
290
- } else if (typeof list !== 'function') {
291
- position = -1;
292
-
293
- for (i = list.length - 1; i >= 0; i--) {
294
- if (list[i] === listener || list[i].listener === listener) {
295
- originalListener = list[i].listener;
296
- position = i;
297
- break;
298
- }
299
- }
300
-
301
- if (position < 0)
302
- return this;
303
-
304
- if (position === 0)
305
- list.shift();
306
- else {
307
- spliceOne(list, position);
308
- }
309
-
310
- if (list.length === 1)
311
- events[type] = list[0];
312
-
313
- if (events.removeListener !== undefined)
314
- this.emit('removeListener', type, originalListener || listener);
315
- }
316
-
317
- return this;
318
- };
319
-
320
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
321
-
322
- EventEmitter.prototype.removeAllListeners =
323
- function removeAllListeners(type) {
324
- var listeners, events, i;
325
-
326
- events = this._events;
327
- if (events === undefined)
328
- return this;
329
-
330
- // not listening for removeListener, no need to emit
331
- if (events.removeListener === undefined) {
332
- if (arguments.length === 0) {
333
- this._events = Object.create(null);
334
- this._eventsCount = 0;
335
- } else if (events[type] !== undefined) {
336
- if (--this._eventsCount === 0)
337
- this._events = Object.create(null);
338
- else
339
- delete events[type];
340
- }
341
- return this;
342
- }
343
-
344
- // emit removeListener for all listeners on all events
345
- if (arguments.length === 0) {
346
- var keys = Object.keys(events);
347
- var key;
348
- for (i = 0; i < keys.length; ++i) {
349
- key = keys[i];
350
- if (key === 'removeListener') continue;
351
- this.removeAllListeners(key);
352
- }
353
- this.removeAllListeners('removeListener');
354
- this._events = Object.create(null);
355
- this._eventsCount = 0;
356
- return this;
357
- }
358
-
359
- listeners = events[type];
360
-
361
- if (typeof listeners === 'function') {
362
- this.removeListener(type, listeners);
363
- } else if (listeners !== undefined) {
364
- // LIFO order
365
- for (i = listeners.length - 1; i >= 0; i--) {
366
- this.removeListener(type, listeners[i]);
367
- }
368
- }
18
+ /**
19
+ * Namespace for events that can be emitted by an {@link OpenFin.Application}. Includes events
20
+ * re-propagated from the {@link OpenFin.Window} (and, transitively, {@link OpenFin.View}) level, prefixed with `window-` (and also, if applicable, `view-`).
21
+ * For example, a view's "attached" event will fire as 'window-view-attached' at the application level.
22
+ *
23
+ * Event payloads are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
24
+ *
25
+ * This namespace contains only payload shapes for events that are unique to `Application`. Events that propagate to `Application` from
26
+ * child {@link OpenFin.Window windows} and {@link OpenFin.View views} are defined in the {@link OpenFin.WindowEvents} and
27
+ * {@link OpenFin.ViewEvents} namespaces. For a list of valid string keys for *all* application events, see {@link Application.on Application.on}.
28
+ *
29
+ * {@link NativeApplicationEvent Native application events} (i.e. those that have not propagated from {@link OpenFin.ViewEvents Views}
30
+ * or {@link OpenFin.WindowEvents Windows} re-propagate to {@link OpenFin.SystemEvents System} with their type string prefixed with `application-`.
31
+ * {@link OpenFin.ApplicationEvents.ApplicationWindowEvent Application events that are tied to Windows but do not propagate from them}
32
+ * are propagated to `System` without any type string prefixing.
33
+ *
34
+ * "Requested" events (e.g. {@link RunRequestedEvent}) do not propagate.
35
+ *
36
+ * @packageDocumentation
37
+ */
38
+ Object.defineProperty(application$1, "__esModule", { value: true });
369
39
 
370
- return this;
371
- };
40
+ var base$1 = {};
372
41
 
373
- function _listeners(target, type, unwrap) {
374
- var events = target._events;
42
+ /**
43
+ * Namespace for shared event payloads and utility types common to all event emitters.
44
+ *
45
+ * @packageDocumentation
46
+ */
47
+ Object.defineProperty(base$1, "__esModule", { value: true });
375
48
 
376
- if (events === undefined)
377
- return [];
49
+ var externalApplication$1 = {};
378
50
 
379
- var evlistener = events[type];
380
- if (evlistener === undefined)
381
- return [];
51
+ /**
52
+ * Namespace for events that can be transmitted by an {@link OpenFin.ExternalApplication}.
53
+ *
54
+ * Event payloads are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
55
+ *
56
+ * For a list of valid string keys for external application events, see {@link ExternalApplication.on ExternalApplication.on}.
57
+ *
58
+ * @packageDocumentation
59
+ */
60
+ Object.defineProperty(externalApplication$1, "__esModule", { value: true });
382
61
 
383
- if (typeof evlistener === 'function')
384
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
62
+ var frame$1 = {};
385
63
 
386
- return unwrap ?
387
- unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
388
- }
64
+ Object.defineProperty(frame$1, "__esModule", { value: true });
389
65
 
390
- EventEmitter.prototype.listeners = function listeners(type) {
391
- return _listeners(this, type, true);
392
- };
66
+ var globalHotkey$1 = {};
393
67
 
394
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
395
- return _listeners(this, type, false);
396
- };
68
+ Object.defineProperty(globalHotkey$1, "__esModule", { value: true });
397
69
 
398
- EventEmitter.listenerCount = function(emitter, type) {
399
- if (typeof emitter.listenerCount === 'function') {
400
- return emitter.listenerCount(type);
401
- } else {
402
- return listenerCount.call(emitter, type);
403
- }
404
- };
70
+ var platform$1 = {};
405
71
 
406
- EventEmitter.prototype.listenerCount = listenerCount;
407
- function listenerCount(type) {
408
- var events = this._events;
72
+ /**
73
+ *
74
+ * Namespace for events that can emitted by a {@link OpenFin.Platform}.
75
+ *
76
+ * Event payloads are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
77
+ *
78
+ * The Platform `EventEmitter` is a superset of the {@link OpenFin.Application} `EventEmitter`,
79
+ * meaning it can listen to all {@link OpenFin.ApplicationEvents Application events} in addition to the
80
+ * Platform-specific events listed here. For a list of valid string keys for *all* platform events, see
81
+ * {@link Platform.on Platform.on}.
82
+ *
83
+ * @packageDocumentation
84
+ */
85
+ Object.defineProperty(platform$1, "__esModule", { value: true });
409
86
 
410
- if (events !== undefined) {
411
- var evlistener = events[type];
87
+ var system$1 = {};
412
88
 
413
- if (typeof evlistener === 'function') {
414
- return 1;
415
- } else if (evlistener !== undefined) {
416
- return evlistener.length;
417
- }
418
- }
89
+ /**
90
+ * Namespace for runtime-wide OpenFin events emitted by {@link System.System}. Includes events
91
+ * re-propagated from {@link OpenFin.Application}, {@link OpenFin.Window}, and {@link OpenFin.View} (prefixed with `application-`, `window-`, and `view-`). All
92
+ * event propagations are visible at the System level. Propagated events from WebContents (windows, views, frames) to the Application level will *not*
93
+ * transitively re-propagate to the System level, because they are already visible at the system level and contain the identity
94
+ * of the application. For example, an application's "closed" event will fire as 'application-closed' at the system level. A view's 'shown' event
95
+ * will be visible as 'view-shown' at the system level, but *not* as `application-window-view-shown`.
96
+ *
97
+ * Event payloads are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
98
+ *
99
+ * This namespace contains only payload shapes for events that are unique to `System`. Events that propagate to `System` from
100
+ * child {@link OpenFin.Application applications}, {@link OpenFin.Window windows}, and {@link OpenFin.View views} are defined in the
101
+ * {@link OpenFin.ApplicationEvents}, {@link OpenFin.WindowEvents}, and {@link OpenFin.ViewEvents} namespaces. For a list of valid string keys for *all*
102
+ * system events, see {@link System.on System.on}.
103
+ *
104
+ * @packageDocumentation
105
+ */
106
+ Object.defineProperty(system$1, "__esModule", { value: true });
419
107
 
420
- return 0;
421
- }
108
+ var view$1 = {};
422
109
 
423
- EventEmitter.prototype.eventNames = function eventNames() {
424
- return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
425
- };
110
+ /**
111
+ * Namespace for events that can be emitted by a {@link OpenFin.View}.
112
+ *
113
+ * Event payloads are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
114
+ *
115
+ * This namespace contains only payload shapes for events that are unique to `View`. Events that are shared between all `WebContents`
116
+ * (i.e. {@link OpenFin.Window}, {@link OpenFin.View}) are defined in {@link OpenFin.WebContentsEvents}. For a list
117
+ * of valid string keys for *all* View events, see {@link View.on View.on}.
118
+ *
119
+ * View events propagate to their parent {@link OpenFin.WindowEvents Window}, {@link OpenFin.ApplicationEvents Application},
120
+ * and {@link OpenFin.SystemEvents System} with an added `viewIdentity` property and their event types prefixed with `'view-'`.
121
+ *
122
+ * @packageDocumentation
123
+ */
124
+ Object.defineProperty(view$1, "__esModule", { value: true });
426
125
 
427
- function arrayClone(arr, n) {
428
- var copy = new Array(n);
429
- for (var i = 0; i < n; ++i)
430
- copy[i] = arr[i];
431
- return copy;
432
- }
126
+ var webcontents = {};
433
127
 
434
- function spliceOne(list, index) {
435
- for (; index + 1 < list.length; index++)
436
- list[index] = list[index + 1];
437
- list.pop();
438
- }
128
+ /**
129
+ * Namespace for events shared by all OpenFin WebContents elements (i.e. {@link OpenFin.Window},
130
+ * {@link OpenFin.View}).
131
+ *
132
+ * WebContents events are divided into two groups: {@link WillPropagateWebContentsEvent} and {@link NonPropagatedWebContentsEvent}. Propagating events
133
+ * will re-emit on parent entities - e.g., a propagating event in a view will also be emitted on the view's
134
+ * parent window, and propagating events in a window will also be emitted on the window's parent {@link OpenFin.Application}.
135
+ *
136
+ * Non-propagating events will not re-emit on parent entities.
137
+ *
138
+ * @packageDocumentation
139
+ */
140
+ Object.defineProperty(webcontents, "__esModule", { value: true });
439
141
 
440
- function unwrapListeners(arr) {
441
- var ret = new Array(arr.length);
442
- for (var i = 0; i < ret.length; ++i) {
443
- ret[i] = arr[i].listener || arr[i];
444
- }
445
- return ret;
446
- }
142
+ var window$2 = {};
447
143
 
448
- function once(emitter, name) {
449
- return new Promise(function (resolve, reject) {
450
- function errorListener(err) {
451
- emitter.removeListener(name, resolver);
452
- reject(err);
453
- }
144
+ /**
145
+ * Namespace for events that can be emitted by a {@link OpenFin.Window}.
146
+ *
147
+ * Event payloads are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
148
+ *
149
+ * This namespace contains only payload shapes for events that are unique to `Window`. Events that are shared between all `WebContents`
150
+ * (i.e. {@link OpenFin.Window}, {@link OpenFin.View}) are defined in {@link OpenFin.WebContentsEvents}. Events that
151
+ * propagate from `View` are defined in {@link OpenFin.ViewEvents}. For a list of valid string keys for *all* Window events, see
152
+ * {@link Window.on Window.on}
153
+ *
154
+ * {@link OpenFin.WindowEvents.NativeWindowEvent Native window events} (i.e. those that are not propagated from a
155
+ * {@link OpenFin.ViewEvents View}) propagate to their parent {@link OpenFin.ApplicationEvents Application} and
156
+ * {@link OpenFin.SystemEvents System} with their event types prefixed with `'window-'`).
157
+ *
158
+ * "Requested" events (e.g. {@link AuthRequestedEvent}) do not propagate to `System. The {@link OpenFin.WindowEvents.WindowCloseRequestedEvent}
159
+ * does not propagate at all.
160
+ *
161
+ * @packageDocumentation
162
+ */
163
+ Object.defineProperty(window$2, "__esModule", { value: true });
454
164
 
455
- function resolver() {
456
- if (typeof emitter.removeListener === 'function') {
457
- emitter.removeListener('error', errorListener);
458
- }
459
- resolve([].slice.call(arguments));
460
- }
461
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
462
- if (name !== 'error') {
463
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
464
- }
465
- });
466
- }
165
+ /**
166
+ * Namespace for OpenFin event types. Each entity that emits OpenFin events has its own sub-namespace. Event payloads
167
+ * themselves are documented as interfaces, while algebraic helper types and derived types are documented as type aliases.
168
+ *
169
+ * #### Event emitters
170
+ *
171
+ * The following entities emit OpenFin events, and have corresponding sub-namespaces:
172
+ *
173
+ * * {@link OpenFin.Application}: {@link OpenFin.ApplicationEvents}
174
+ * * {@link OpenFin.ExternalApplication}: {@link OpenFin.ExternalApplicationEvents}
175
+ * * {@link OpenFin.Frame}: {@link OpenFin.FrameEvents}
176
+ * * {@link OpenFin.GlobalHotkey}: {@link OpenFin.GlobalHotkeyEvents}
177
+ * * {@link OpenFin.Platform}: {@link OpenFin.PlatformEvents}
178
+ * * {@link OpenFin.System}: {@link OpenFin.SystemEvents}
179
+ * * {@link OpenFin.View}: {@link OpenFin.ViewEvents}
180
+ * * {@link OpenFin.Window}: {@link OpenFin.WindowEvents}
181
+ *
182
+ * These `EventEmitter` entities share a common set of methods for interacting with the OpenFin event bus, which can be
183
+ * seen on the individual documentation pages for each entity type.
184
+ *
185
+ * Registering event handlers is an asynchronous operation. It is important to ensure that the returned Promises are awaited to reduce the
186
+ * risk of race conditions.
187
+ *
188
+ * When the `EventEmitter` receives an event from the browser process and emits on the renderer, all of the functions attached to that
189
+ * specific event are called synchronously. Any values returned by the called listeners are ignored and will be discarded. If the window document
190
+ * is destroyed by page navigation or reload, its registered event listeners will be removed.
191
+ *
192
+ * We recommend using Arrow Functions for event listeners to ensure the this scope is consistent with the original function context.
193
+ *
194
+ * Events re-propagate from smaller/more-local scopes to larger/more-global scopes. For example, an event emitted on a specific
195
+ * view will propagate to the window in which the view is embedded, and then to the application in which the window is running, and
196
+ * finally to the OpenFin runtime itself at the "system" level. For details on propagation semantics, see the namespace for
197
+ * the propagating (or propagated-to) entity.
198
+ *
199
+ * If you need the payload type for a specific type of event (especially propagated events), use the emitting topic's `EventPayload`
200
+ * (e.g. {@link WindowEvents.WindowEventPayload}) generic with the event's `type` string. For example, the payload of
201
+ * a {@link ViewEvents.CreatedEvent} after it has propagated to its parent {@link WindowEvents Window} can be found with
202
+ * `WindowEventPayload<'view-created'>`.
203
+ *
204
+ * @packageDocumentation
205
+ */
206
+ Object.defineProperty(events, "__esModule", { value: true });
207
+ events.WindowEvents = events.WebContentsEvents = events.ViewEvents = events.SystemEvents = events.PlatformEvents = events.GlobalHotkeyEvents = events.FrameEvents = events.ExternalApplicationEvents = events.BaseEvents = events.ApplicationEvents = void 0;
208
+ const ApplicationEvents = application$1;
209
+ events.ApplicationEvents = ApplicationEvents;
210
+ const BaseEvents = base$1;
211
+ events.BaseEvents = BaseEvents;
212
+ const ExternalApplicationEvents = externalApplication$1;
213
+ events.ExternalApplicationEvents = ExternalApplicationEvents;
214
+ const FrameEvents = frame$1;
215
+ events.FrameEvents = FrameEvents;
216
+ const GlobalHotkeyEvents = globalHotkey$1;
217
+ events.GlobalHotkeyEvents = GlobalHotkeyEvents;
218
+ const PlatformEvents = platform$1;
219
+ events.PlatformEvents = PlatformEvents;
220
+ const SystemEvents = system$1;
221
+ events.SystemEvents = SystemEvents;
222
+ const ViewEvents = view$1;
223
+ events.ViewEvents = ViewEvents;
224
+ const WebContentsEvents = webcontents;
225
+ events.WebContentsEvents = WebContentsEvents;
226
+ const WindowEvents = window$2;
227
+ events.WindowEvents = WindowEvents;
467
228
 
468
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
469
- if (typeof emitter.on === 'function') {
470
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
471
- }
472
- }
229
+ (function (exports) {
230
+ /**
231
+ * Top-level namespace for types referenced by the OpenFin API. Contains:
232
+ *
233
+ * * The type of the global `fin` entry point ({@link FinApi})
234
+ * * Classes that act as static namespaces returned from the `fin` global (e.g. {@link ApplicationModule}, accessible via `fin.Application`)
235
+ * * Instance classes that are returned from API calls (e.g. {@link Application}, accessible via `fin.Application.getCurrentSync()`)
236
+ * * Parameter shapes for API methods (e.g. {@link ApplicationOptions}, used in `fin.Application.start()`)
237
+ * * Event namespaces and payload union types (e.g. {@link ApplicationEvents} and {@link ApplicationEvent})
238
+ *
239
+ * @packageDocumentation
240
+ */
241
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
242
+ if (k2 === undefined) k2 = k;
243
+ var desc = Object.getOwnPropertyDescriptor(m, k);
244
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
245
+ desc = { enumerable: true, get: function() { return m[k]; } };
246
+ }
247
+ Object.defineProperty(o, k2, desc);
248
+ }) : (function(o, m, k, k2) {
249
+ if (k2 === undefined) k2 = k;
250
+ o[k2] = m[k];
251
+ }));
252
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
253
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
254
+ };
255
+ Object.defineProperty(exports, "__esModule", { value: true });
256
+ // Deprecated shim to preserve v30 namespace names
257
+ __exportStar(events, exports);
258
+ } (OpenFin$1));
473
259
 
474
- function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
475
- if (typeof emitter.on === 'function') {
476
- if (flags.once) {
477
- emitter.once(name, listener);
478
- } else {
479
- emitter.on(name, listener);
480
- }
481
- } else if (typeof emitter.addEventListener === 'function') {
482
- // EventTarget does not have `error` event semantics like Node
483
- // EventEmitters, we do not listen for `error` events here.
484
- emitter.addEventListener(name, function wrapListener(arg) {
485
- // IE does not have builtin `{ once: true }` support so we
486
- // have to do it manually.
487
- if (flags.once) {
488
- emitter.removeEventListener(name, wrapListener);
489
- }
490
- listener(arg);
491
- });
492
- } else {
493
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
494
- }
495
- }
260
+ var fin = {};
496
261
 
497
262
  var system = {};
498
263
 
@@ -561,6 +326,13 @@ class Base {
561
326
  get fin() {
562
327
  return this.wire.getFin();
563
328
  }
329
+ /**
330
+ * Provides access to the OpenFin representation of the current code context (usually a document
331
+ * such as a {@link OpenFin.View} or {@link OpenFin.Window}), as well as to the current `Interop` context.
332
+ *
333
+ * Useful for debugging in the devtools console, where this will intelligently type itself based
334
+ * on the context in which the devtools panel was opened.
335
+ */
564
336
  get me() {
565
337
  return this.wire.me;
566
338
  }
@@ -595,6 +367,9 @@ class EmitterBase extends Base {
595
367
  this.topic = topic;
596
368
  _EmitterBase_emitterAccessor.set(this, void 0);
597
369
  this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
370
+ /**
371
+ * @internal
372
+ */
598
373
  this.emit = (eventType, payload, ...args) => {
599
374
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
600
375
  };
@@ -637,16 +412,13 @@ class EmitterBase extends Base {
637
412
  // This will only be reached if unsubscribe from event that does not exist but do not want to error here
638
413
  return Promise.resolve();
639
414
  };
640
- this.addListener = this.on;
641
415
  __classPrivateFieldSet$d(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
642
416
  this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
643
417
  }
644
418
  /**
645
419
  * Adds a listener to the end of the listeners array for the specified event.
646
420
  *
647
- * @param eventType
648
- * @param listener
649
- * @param options
421
+ * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
650
422
  */
651
423
  async on(eventType, listener, options) {
652
424
  await this.registerEventListener(eventType, options, (emitter) => {
@@ -656,12 +428,16 @@ class EmitterBase extends Base {
656
428
  });
657
429
  return this;
658
430
  }
431
+ /**
432
+ * Adds a listener to the end of the listeners array for the specified event.
433
+ */
434
+ async addListener(eventType, listener, options) {
435
+ return this.on(eventType, listener, options);
436
+ }
659
437
  /**
660
438
  * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
661
439
  *
662
- * @param eventType
663
- * @param listener
664
- * @param options
440
+ * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
665
441
  */
666
442
  async once(eventType, listener, options) {
667
443
  const deregister = () => this.deregisterEventListener(eventType);
@@ -677,9 +453,7 @@ class EmitterBase extends Base {
677
453
  /**
678
454
  * Adds a listener to the beginning of the listeners array for the specified event.
679
455
  *
680
- * @param eventType
681
- * @param listener
682
- * @param options
456
+ * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
683
457
  */
684
458
  async prependListener(eventType, listener, options) {
685
459
  await this.registerEventListener(eventType, options, (emitter) => {
@@ -693,9 +467,7 @@ class EmitterBase extends Base {
693
467
  * Adds a one time listener for the event. The listener is invoked only the first time the event is fired,
694
468
  * after which it is removed. The listener is added to the beginning of the listeners array.
695
469
  *
696
- * @param eventType
697
- * @param listener
698
- * @param options
470
+ * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
699
471
  */
700
472
  async prependOnceListener(eventType, listener, options) {
701
473
  const deregister = () => this.deregisterEventListener(eventType);
@@ -712,10 +484,6 @@ class EmitterBase extends Base {
712
484
  * Remove a listener from the listener array for the specified event.
713
485
  *
714
486
  * @remarks Caution: Calling this method changes the array indices in the listener array behind the listener.
715
- *
716
- * @param eventType
717
- * @param listener
718
- * @param options
719
487
  */
720
488
  async removeListener(eventType, listener, options) {
721
489
  const emitter = await this.deregisterEventListener(eventType, options);
@@ -742,7 +510,6 @@ class EmitterBase extends Base {
742
510
  /**
743
511
  * Removes all listeners, or those of the specified event.
744
512
  *
745
- * @param eventType
746
513
  */
747
514
  async removeAllListeners(eventType) {
748
515
  const removeByEvent = async (event) => {
@@ -804,7 +571,7 @@ class InternalError extends Error {
804
571
  const { message, name, stack, ...rest } = err;
805
572
  super(message);
806
573
  this.name = name || 'Error';
807
- this.stack = stack !== null && stack !== void 0 ? stack : this.toString();
574
+ this.stack = stack ?? this.toString();
808
575
  Object.keys(rest).forEach(key => {
809
576
  this[key] = rest[key];
810
577
  });
@@ -813,7 +580,6 @@ class InternalError extends Error {
813
580
  // For documentation of the error methods being used see here: https://v8.dev/docs/stack-trace-api
814
581
  class RuntimeError extends Error {
815
582
  static getCallSite(callsToRemove = 0) {
816
- var _a, _b;
817
583
  const length = Error.stackTraceLimit;
818
584
  const realCallsToRemove = callsToRemove + 1; // remove this call;
819
585
  Error.stackTraceLimit = length + realCallsToRemove;
@@ -822,7 +588,7 @@ class RuntimeError extends Error {
822
588
  // This will be called when we access the `stack` property
823
589
  Error.prepareStackTrace = (_, stack) => stack;
824
590
  // stack is optional in non chromium contexts
825
- const stack = (_b = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.slice(realCallsToRemove)) !== null && _b !== void 0 ? _b : [];
591
+ const stack = new Error().stack?.slice(realCallsToRemove) ?? [];
826
592
  Error.prepareStackTrace = _prepareStackTrace;
827
593
  Error.stackTraceLimit = length;
828
594
  return stack;
@@ -844,7 +610,7 @@ class RuntimeError extends Error {
844
610
  const { reason, error } = payload;
845
611
  super(reason);
846
612
  this.name = 'RuntimeError';
847
- if (error === null || error === void 0 ? void 0 : error.stack) {
613
+ if (error?.stack) {
848
614
  this.cause = new InternalError(error);
849
615
  }
850
616
  if (callSites) {
@@ -883,6 +649,20 @@ var view = {};
883
649
 
884
650
  var Factory$6 = {};
885
651
 
652
+ var warnings = {};
653
+
654
+ Object.defineProperty(warnings, "__esModule", { value: true });
655
+ warnings.handleDeprecatedWarnings = void 0;
656
+ const handleDeprecatedWarnings = (options) => {
657
+ if (options.contentNavigation?.whitelist ||
658
+ options.contentNavigation?.blacklist ||
659
+ options.contentRedirect?.whitelist ||
660
+ options.contentRedirect?.blacklist) {
661
+ console.warn(`The properties 'whitelist' and 'blacklist' have been marked as deprecated and will be removed in a future version. Please use 'allowlist' and 'denylist'.`);
662
+ }
663
+ };
664
+ warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
665
+
886
666
  var hasRequiredFactory$3;
887
667
 
888
668
  function requireFactory$3 () {
@@ -893,6 +673,10 @@ function requireFactory$3 () {
893
673
  const base_1 = base;
894
674
  const validate_1 = validate;
895
675
  const index_1 = requireView();
676
+ const warnings_1 = warnings;
677
+ /**
678
+ * Static namespace for OpenFin API methods that interact with the {@link View} class, available under `fin.View`.
679
+ */
896
680
  class ViewModule extends base_1.Base {
897
681
  /**
898
682
  * Creates a new View.
@@ -927,6 +711,7 @@ function requireFactory$3 () {
927
711
  if (!options.name || typeof options.name !== 'string') {
928
712
  throw new Error('Please provide a name property as a string in order to create a View.');
929
713
  }
714
+ (0, warnings_1.handleDeprecatedWarnings)(options);
930
715
  if (this.wire.environment.childViews) {
931
716
  await this.wire.environment.createChildContent({
932
717
  entityType: 'view',
@@ -1214,7 +999,7 @@ class ChannelsExposer {
1214
999
  this.exposeFunction = async (target, config) => {
1215
1000
  const { key, options, meta } = config;
1216
1001
  const { id } = meta;
1217
- const action = `${id}.${(options === null || options === void 0 ? void 0 : options.action) || key}`;
1002
+ const action = `${id}.${options?.action || key}`;
1218
1003
  await this.channelProviderOrClient.register(action, async ({ args }) => {
1219
1004
  return target(...args);
1220
1005
  });
@@ -1245,7 +1030,7 @@ channelsExposer.ChannelsExposer = ChannelsExposer;
1245
1030
  };
1246
1031
  Object.defineProperty(exports, "__esModule", { value: true });
1247
1032
  __exportStar(channelsConsumer, exports);
1248
- __exportStar(channelsExposer, exports);
1033
+ __exportStar(channelsExposer, exports);
1249
1034
  } (openfinChannels));
1250
1035
 
1251
1036
  (function (exports) {
@@ -1264,7 +1049,7 @@ channelsExposer.ChannelsExposer = ChannelsExposer;
1264
1049
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1265
1050
  };
1266
1051
  Object.defineProperty(exports, "__esModule", { value: true });
1267
- __exportStar(openfinChannels, exports);
1052
+ __exportStar(openfinChannels, exports);
1268
1053
  } (strategies));
1269
1054
 
1270
1055
  (function (exports) {
@@ -1286,7 +1071,7 @@ channelsExposer.ChannelsExposer = ChannelsExposer;
1286
1071
  __exportStar(apiConsumer, exports);
1287
1072
  __exportStar(apiExposer, exports);
1288
1073
  __exportStar(strategies, exports);
1289
- __exportStar(decorators, exports);
1074
+ __exportStar(decorators, exports);
1290
1075
  } (apiExposer$1));
1291
1076
 
1292
1077
  var channelApiRelay = {};
@@ -1527,14 +1312,14 @@ _LayoutNode_client = new WeakMap();
1527
1312
  /**
1528
1313
  * @ignore
1529
1314
  * @internal
1530
- * Encapsulates Api consumption of {@link LayoutEntitiesController} with a relayed dispatch
1315
+ * Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
1531
1316
  * @param client
1532
1317
  * @param controllerId
1533
1318
  * @param identity
1534
1319
  * @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
1535
1320
  */
1536
1321
  LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
1537
- const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that has been destroyed.');
1322
+ const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that does not exist or has been destroyed.');
1538
1323
  const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
1539
1324
  return consumer.consume({ id: controllerId });
1540
1325
  };
@@ -1844,8 +1629,9 @@ _ColumnOrRow_client = new WeakMap();
1844
1629
  var layout_constants = {};
1845
1630
 
1846
1631
  Object.defineProperty(layout_constants, "__esModule", { value: true });
1847
- layout_constants.LAYOUT_CONTROLLER_ID = void 0;
1632
+ layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
1848
1633
  layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
1634
+ layout_constants.DEFAULT_LAYOUT_KEY = 'default';
1849
1635
 
1850
1636
  var main = {};
1851
1637
 
@@ -1853,6 +1639,10 @@ Object.defineProperty(main, "__esModule", { value: true });
1853
1639
  main.WebContents = void 0;
1854
1640
  const base_1$k = base;
1855
1641
  class WebContents extends base_1$k.EmitterBase {
1642
+ /**
1643
+ * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
1644
+ * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
1645
+ */
1856
1646
  constructor(wire, identity, entityType) {
1857
1647
  super(wire, entityType, identity.uuid, identity.name);
1858
1648
  this.identity = identity;
@@ -1905,6 +1695,11 @@ class WebContents extends base_1$k.EmitterBase {
1905
1695
  * }
1906
1696
  * console.log(await wnd.capturePage(options));
1907
1697
  * ```
1698
+ *
1699
+ * @remarks
1700
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1701
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1702
+ * {@link OpenFin.WebContentsEvents event namespace}.
1908
1703
  */
1909
1704
  capturePage(options) {
1910
1705
  return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
@@ -1940,6 +1735,10 @@ class WebContents extends base_1$k.EmitterBase {
1940
1735
  *
1941
1736
  * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
1942
1737
  * ```
1738
+ * @remarks
1739
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1740
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1741
+ * {@link OpenFin.WebContentsEvents event namespace}.
1943
1742
  */
1944
1743
  executeJavaScript(code) {
1945
1744
  return this.wire
@@ -1979,6 +1778,10 @@ class WebContents extends base_1$k.EmitterBase {
1979
1778
  *
1980
1779
  * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
1981
1780
  * ```
1781
+ * @remarks
1782
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1783
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1784
+ * {@link OpenFin.WebContentsEvents event namespace}.
1982
1785
  */
1983
1786
  getZoomLevel() {
1984
1787
  return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
@@ -2017,6 +1820,10 @@ class WebContents extends base_1$k.EmitterBase {
2017
1820
  *
2018
1821
  * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
2019
1822
  * ```
1823
+ * @remarks
1824
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1825
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1826
+ * {@link OpenFin.WebContentsEvents event namespace}.
2020
1827
  */
2021
1828
  setZoomLevel(level) {
2022
1829
  return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
@@ -2024,7 +1831,7 @@ class WebContents extends base_1$k.EmitterBase {
2024
1831
  /**
2025
1832
  * Navigates the WebContents to a specified URL.
2026
1833
  *
2027
- * @remarks The url must contain the protocol prefix such as http:// or https://.
1834
+ * Note: The url must contain the protocol prefix such as http:// or https://.
2028
1835
  * @param url - The URL to navigate the WebContents to.
2029
1836
  *
2030
1837
  * @example
@@ -2054,6 +1861,10 @@ class WebContents extends base_1$k.EmitterBase {
2054
1861
  * navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
2055
1862
  * ```
2056
1863
  * @experimental
1864
+ * @remarks
1865
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1866
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1867
+ * {@link OpenFin.WebContentsEvents event namespace}.
2057
1868
  */
2058
1869
  navigate(url) {
2059
1870
  return this.wire.sendAction('navigate-window', { ...this.identity, url }).then(() => undefined);
@@ -2081,6 +1892,10 @@ class WebContents extends base_1$k.EmitterBase {
2081
1892
  * }
2082
1893
  * navigateBack().then(() => console.log('Navigated back')).catch(err => console.log(err));
2083
1894
  * ```
1895
+ * @remarks
1896
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1897
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1898
+ * {@link OpenFin.WebContentsEvents event namespace}.
2084
1899
  */
2085
1900
  navigateBack() {
2086
1901
  return this.wire.sendAction('navigate-window-back', { ...this.identity }).then(() => undefined);
@@ -2110,6 +1925,10 @@ class WebContents extends base_1$k.EmitterBase {
2110
1925
  * }
2111
1926
  * navigateForward().then(() => console.log('Navigated forward')).catch(err => console.log(err));
2112
1927
  * ```
1928
+ * @remarks
1929
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1930
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1931
+ * {@link OpenFin.WebContentsEvents event namespace}.
2113
1932
  */
2114
1933
  async navigateForward() {
2115
1934
  await this.wire.sendAction('navigate-window-forward', { ...this.identity });
@@ -2137,6 +1956,10 @@ class WebContents extends base_1$k.EmitterBase {
2137
1956
  * }
2138
1957
  * stopNavigation().then(() => console.log('you shall not navigate')).catch(err => console.log(err));
2139
1958
  * ```
1959
+ * @remarks
1960
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1961
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1962
+ * {@link OpenFin.WebContentsEvents event namespace}.
2140
1963
  */
2141
1964
  stopNavigation() {
2142
1965
  return this.wire.sendAction('stop-window-navigation', { ...this.identity }).then(() => undefined);
@@ -2174,6 +1997,10 @@ class WebContents extends base_1$k.EmitterBase {
2174
1997
  * console.log('Reloaded window')
2175
1998
  * }).catch(err => console.log(err));
2176
1999
  * ```
2000
+ * @remarks
2001
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2002
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2003
+ * {@link OpenFin.WebContentsEvents event namespace}.
2177
2004
  */
2178
2005
  reload(ignoreCache = false) {
2179
2006
  return this.wire
@@ -2187,7 +2014,7 @@ class WebContents extends base_1$k.EmitterBase {
2187
2014
  * Prints the WebContents.
2188
2015
  * @param options Printer Options
2189
2016
  *
2190
- * @remarks When `silent` is set to `true`, the API will pick the system's default printer if deviceName
2017
+ * Note: When `silent` is set to `true`, the API will pick the system's default printer if deviceName
2191
2018
  * is empty and the default settings for printing.
2192
2019
  *
2193
2020
  * Use the CSS style `page-break-before: always;` to force print to a new page.
@@ -2200,6 +2027,10 @@ class WebContents extends base_1$k.EmitterBase {
2200
2027
  * console.log('print call has been sent to the system');
2201
2028
  * });
2202
2029
  * ```
2030
+ * @remarks
2031
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2032
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2033
+ * {@link OpenFin.WebContentsEvents event namespace}.
2203
2034
  */
2204
2035
  print(options = {}) {
2205
2036
  return this.wire.sendAction('print', { ...this.identity, options }).then(() => undefined);
@@ -2209,7 +2040,7 @@ class WebContents extends base_1$k.EmitterBase {
2209
2040
  * @param searchTerm Term to find in page
2210
2041
  * @param options Search options
2211
2042
  *
2212
- * @remarks By default, each subsequent call will highlight the next text that matches the search term.
2043
+ * Note: By default, each subsequent call will highlight the next text that matches the search term.
2213
2044
  *
2214
2045
  * Returns a promise with the results for the request. By subscribing to the
2215
2046
  * found-in-page event, you can get the results of this call as well.
@@ -2244,6 +2075,10 @@ class WebContents extends base_1$k.EmitterBase {
2244
2075
  * console.log(result)
2245
2076
  * });
2246
2077
  * ```
2078
+ * @remarks
2079
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2080
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2081
+ * {@link OpenFin.WebContentsEvents event namespace}.
2247
2082
  */
2248
2083
  findInPage(searchTerm, options) {
2249
2084
  return this.wire
@@ -2287,6 +2122,10 @@ class WebContents extends base_1$k.EmitterBase {
2287
2122
  * console.log(results);
2288
2123
  * });
2289
2124
  * ```
2125
+ * @remarks
2126
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2127
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2128
+ * {@link OpenFin.WebContentsEvents event namespace}.
2290
2129
  */
2291
2130
  stopFindInPage(action) {
2292
2131
  return this.wire.sendAction('stop-find-in-page', { ...this.identity, action }).then(() => undefined);
@@ -2329,6 +2168,10 @@ class WebContents extends base_1$k.EmitterBase {
2329
2168
  * console.log(err);
2330
2169
  * });
2331
2170
  * ```
2171
+ * @remarks
2172
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2173
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2174
+ * {@link OpenFin.WebContentsEvents event namespace}.
2332
2175
  */
2333
2176
  getPrinters() {
2334
2177
  return this.wire.sendAction('get-printers', { ...this.identity }).then(({ payload }) => payload.data);
@@ -2351,6 +2194,10 @@ class WebContents extends base_1$k.EmitterBase {
2351
2194
  *
2352
2195
  * focusWindow().then(() => console.log('Window focused')).catch(err => console.log(err));
2353
2196
  * ```
2197
+ * @remarks
2198
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2199
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2200
+ * {@link OpenFin.WebContentsEvents event namespace}.
2354
2201
  */
2355
2202
  async focus({ emitSynthFocused } = { emitSynthFocused: true }) {
2356
2203
  await this.wire.sendAction('focus-window', { emitSynthFocused, ...this.identity });
@@ -2382,6 +2229,10 @@ class WebContents extends base_1$k.EmitterBase {
2382
2229
  * .then(() => console.log('Showing dev tools'))
2383
2230
  * .catch(err => console.error(err));
2384
2231
  * ```
2232
+ * @remarks
2233
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2234
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2235
+ * {@link OpenFin.WebContentsEvents event namespace}.
2385
2236
  */
2386
2237
  async showDeveloperTools() {
2387
2238
  // Note this hits the system action map in core state for legacy reasons.
@@ -2390,7 +2241,7 @@ class WebContents extends base_1$k.EmitterBase {
2390
2241
  /**
2391
2242
  * Retrieves the process information associated with a WebContents.
2392
2243
  *
2393
- * @remarks This includes any iframes associated with the WebContents
2244
+ * Note: This includes any iframes associated with the WebContents
2394
2245
  *
2395
2246
  * @example
2396
2247
  * View:
@@ -2404,6 +2255,10 @@ class WebContents extends base_1$k.EmitterBase {
2404
2255
  * const win = await fin.Window.getCurrent();
2405
2256
  * const processInfo = await win.getProcessInfo();
2406
2257
  * ```
2258
+ * @remarks
2259
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2260
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2261
+ * {@link OpenFin.WebContentsEvents event namespace}.
2407
2262
  */
2408
2263
  async getProcessInfo() {
2409
2264
  const { payload: { data } } = await this.wire.sendAction('get-process-info', this.identity);
@@ -2439,6 +2294,10 @@ class WebContents extends base_1$k.EmitterBase {
2439
2294
  * const win = await fin.Window.create(winOption);
2440
2295
  * const sharedWorkers = await win.getSharedWorkers();
2441
2296
  * ```
2297
+ * @remarks
2298
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2299
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2300
+ * {@link OpenFin.WebContentsEvents event namespace}.
2442
2301
  */
2443
2302
  async getSharedWorkers() {
2444
2303
  return this.wire.sendAction('get-shared-workers', this.identity).then(({ payload }) => payload.data);
@@ -2473,6 +2332,10 @@ class WebContents extends base_1$k.EmitterBase {
2473
2332
  * const win = await fin.Window.create(winOption);
2474
2333
  * await win.inspectSharedWorker();
2475
2334
  * ```
2335
+ * @remarks
2336
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2337
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2338
+ * {@link OpenFin.WebContentsEvents event namespace}.
2476
2339
  */
2477
2340
  async inspectSharedWorker() {
2478
2341
  await this.wire.sendAction('inspect-shared-worker', { ...this.identity });
@@ -2510,6 +2373,10 @@ class WebContents extends base_1$k.EmitterBase {
2510
2373
  * const sharedWorkers = await win.getSharedWorkers();
2511
2374
  * await win.inspectSharedWorkerById(sharedWorkers[0].id);
2512
2375
  * ```
2376
+ * @remarks
2377
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2378
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2379
+ * {@link OpenFin.WebContentsEvents event namespace}.
2513
2380
  */
2514
2381
  async inspectSharedWorkerById(workerId) {
2515
2382
  await this.wire.sendAction('inspect-shared-worker-by-id', { ...this.identity, workerId });
@@ -2544,6 +2411,10 @@ class WebContents extends base_1$k.EmitterBase {
2544
2411
  * const win = await fin.Window.create(winOption);
2545
2412
  * await win.inspectServiceWorker();
2546
2413
  * ```
2414
+ * @remarks
2415
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2416
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2417
+ * {@link OpenFin.WebContentsEvents event namespace}.
2547
2418
  */
2548
2419
  async inspectServiceWorker() {
2549
2420
  await this.wire.sendAction('inspect-service-worker', { ...this.identity });
@@ -2551,7 +2422,7 @@ class WebContents extends base_1$k.EmitterBase {
2551
2422
  /**
2552
2423
  * Shows a popup window.
2553
2424
  *
2554
- * @remarks If this WebContents is a view and its attached window has a popup open, this will close it.
2425
+ * Note: If this WebContents is a view and its attached window has a popup open, this will close it.
2555
2426
  *
2556
2427
  * Shows a popup window. Including a `name` in `options` will attempt to show an existing window as a popup, if
2557
2428
  * that window doesn't exist or no `name` is included a window will be created. If the caller view or the caller
@@ -2559,7 +2430,7 @@ class WebContents extends base_1$k.EmitterBase {
2559
2430
  * open popup window before showing the new popup window. Also, if the caller view is destroyed or detached, the popup
2560
2431
  * will be dismissed.
2561
2432
  *
2562
- * NOTE: in the case where the window being shown as a popup needs to be created, it is a child of the caller view's parent window.
2433
+ * Note: in the case where the window being shown as a popup needs to be created, it is a child of the caller view's parent window.
2563
2434
  *
2564
2435
  * @example
2565
2436
  *
@@ -2754,12 +2625,16 @@ class WebContents extends base_1$k.EmitterBase {
2754
2625
  * onPopupReady: popupWindowCallback;
2755
2626
  * });
2756
2627
  * ```
2628
+ * @remarks
2629
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
2630
+ * We do not expose an explicit superclass for this functionality, but it does have its own
2631
+ * {@link OpenFin.WebContentsEvents event namespace}.
2757
2632
  */
2758
2633
  async showPopupWindow(options) {
2759
2634
  this.wire.sendAction(`${this.entityType}-show-popup-window`, this.identity).catch(() => {
2760
2635
  // we do not want to expose this error, just continue if this analytics-only call fails
2761
2636
  });
2762
- if (options === null || options === void 0 ? void 0 : options.onPopupReady) {
2637
+ if (options?.onPopupReady) {
2763
2638
  const readyListener = async ({ popupName }) => {
2764
2639
  try {
2765
2640
  const popupWindow = this.fin.Window.wrapSync({ uuid: this.fin.me.uuid, name: popupName });
@@ -2778,8 +2653,8 @@ class WebContents extends base_1$k.EmitterBase {
2778
2653
  ...options,
2779
2654
  // Internal use only.
2780
2655
  // @ts-expect-error
2781
- hasResultCallback: !!(options === null || options === void 0 ? void 0 : options.onPopupResult),
2782
- hasReadyCallback: !!(options === null || options === void 0 ? void 0 : options.onPopupReady)
2656
+ hasResultCallback: !!options?.onPopupResult,
2657
+ hasReadyCallback: !!options?.onPopupReady
2783
2658
  },
2784
2659
  ...this.identity
2785
2660
  });
@@ -2804,7 +2679,7 @@ class WebContents extends base_1$k.EmitterBase {
2804
2679
  }
2805
2680
  return popupResult;
2806
2681
  };
2807
- if (options === null || options === void 0 ? void 0 : options.onPopupResult) {
2682
+ if (options?.onPopupResult) {
2808
2683
  const dispatchResultListener = async (payload) => {
2809
2684
  await options.onPopupResult(normalizePopupResult(payload));
2810
2685
  };
@@ -3130,6 +3005,49 @@ function requireInstance$2 () {
3130
3005
  this.show = async () => {
3131
3006
  await this.wire.sendAction('show-view', { ...this.identity });
3132
3007
  };
3008
+ /**
3009
+ * Sets the bounds (top, left, width, height) of the view relative to its window and shows it if it is hidden.
3010
+ * This method ensures the view is both positioned and showing. It will reposition a visible view and both show and reposition a hidden view.
3011
+ *
3012
+ * @remarks View position is relative to the bounds of the window.
3013
+ * ({top: 0, left: 0} represents the top left corner of the window)
3014
+ *
3015
+ * @example
3016
+ * ```js
3017
+ * let view;
3018
+ * async function createView() {
3019
+ * const me = await fin.Window.getCurrent();
3020
+ * return fin.View.create({
3021
+ * name: 'viewNameSetBounds',
3022
+ * target: me.identity,
3023
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
3024
+ * });
3025
+ * }
3026
+ *
3027
+ * async function showViewAt() {
3028
+ * view = await createView();
3029
+ * console.log('View created.');
3030
+ *
3031
+ * await view.navigate('https://google.com');
3032
+ * console.log('View navigated to given url.');
3033
+ *
3034
+ * await view.showAt({
3035
+ * top: 100,
3036
+ * left: 100,
3037
+ * width: 300,
3038
+ * height: 300
3039
+ * });
3040
+ * }
3041
+ *
3042
+ * showViewAt()
3043
+ * .then(() => console.log('View set to new bounds and shown.'))
3044
+ * .catch(err => console.log(err));
3045
+ * ```
3046
+ * @experimental
3047
+ */
3048
+ this.showAt = async (bounds) => {
3049
+ await this.wire.sendAction('show-view-at', { bounds, ...this.identity });
3050
+ };
3133
3051
  /**
3134
3052
  * Hides the current view if it is currently visible.
3135
3053
  *
@@ -3289,8 +3207,24 @@ function requireInstance$2 () {
3289
3207
  this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
3290
3208
  // don't expose
3291
3209
  });
3292
- const currentWindow = await this.getCurrentWindow();
3293
- return currentWindow.getLayout();
3210
+ const layoutWindow = await this.getCurrentWindow();
3211
+ try {
3212
+ const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
3213
+ const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
3214
+ const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
3215
+ return this.fin.Platform.Layout.wrap(layoutIdentity);
3216
+ }
3217
+ catch (e) {
3218
+ const allowedErrors = [
3219
+ 'No action registered at target for',
3220
+ 'getLayoutIdentityForViewOrThrow is not a function'
3221
+ ];
3222
+ if (!allowedErrors.some((m) => e.message.includes(m))) {
3223
+ throw e;
3224
+ }
3225
+ // fallback logic for missing endpoint
3226
+ return this.fin.Platform.Layout.wrap(layoutWindow.identity);
3227
+ }
3294
3228
  };
3295
3229
  /**
3296
3230
  * Gets the View's options.
@@ -3524,19 +3458,19 @@ function requireView () {
3524
3458
  };
3525
3459
  Object.defineProperty(exports, "__esModule", { value: true });
3526
3460
  /**
3527
- * Entry points for the OpenFin `View` API.
3461
+ * Entry points for the OpenFin `View` API (`fin.View`).
3528
3462
  *
3529
- * In the previous version of the API documentation, both static methods involving `View` and instance properties of the
3530
- * `View` type itself were documented on the same page. These are separate code entities, and are now documented separately:
3531
- *
3532
- * * {@link ViewModule} contains static methods relating to the `View` type, accessible through `fin.View`.
3463
+ * * {@link ViewModule} contains static members of the `View` API, accessible through `fin.View`.
3533
3464
  * * {@link View} describes an instance of an OpenFin View, e.g. as returned by `fin.View.getCurrent`.
3534
3465
  *
3466
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
3467
+ * both of these were documented on the same page.
3468
+ *
3535
3469
  * @packageDocumentation
3536
3470
  */
3537
3471
  __exportStar(requireFactory$3(), exports);
3538
- __exportStar(requireInstance$2(), exports);
3539
- } (view));
3472
+ __exportStar(requireInstance$2(), exports);
3473
+ } (view));
3540
3474
  return view;
3541
3475
  }
3542
3476
 
@@ -4023,6 +3957,7 @@ function requireInstance$1 () {
4023
3957
  /**
4024
3958
  * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
4025
3959
  * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
3960
+ *
4026
3961
  * Note: If the "name" property is omitted it defaults to "tasks".
4027
3962
  * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
4028
3963
  *
@@ -4323,6 +4258,7 @@ function requireInstance$1 () {
4323
4258
  }
4324
4259
  /**
4325
4260
  * Sets file auto download location. It's only allowed in the same application.
4261
+ *
4326
4262
  * Note: This method is restricted by default and must be enabled via
4327
4263
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4328
4264
  * @param downloadLocation file auto download location
@@ -4348,6 +4284,7 @@ function requireInstance$1 () {
4348
4284
  }
4349
4285
  /**
4350
4286
  * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
4287
+ *
4351
4288
  * Note: This method is restricted by default and must be enabled via
4352
4289
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4353
4290
  *
@@ -4378,6 +4315,9 @@ function requireFactory$2 () {
4378
4315
  const base_1 = base;
4379
4316
  const validate_1 = validate;
4380
4317
  const Instance_1 = requireInstance$1();
4318
+ /**
4319
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4320
+ */
4381
4321
  class ApplicationModule extends base_1.Base {
4382
4322
  /**
4383
4323
  * Asynchronously returns an Application object that represents an existing application.
@@ -4659,19 +4599,19 @@ function requireApplication () {
4659
4599
  };
4660
4600
  Object.defineProperty(exports, "__esModule", { value: true });
4661
4601
  /**
4662
- * Entry points for the OpenFin `Application` API.
4602
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
4663
4603
  *
4664
- * In the previous version of the API documentation, both static methods involving `Application` and instance properties of the
4665
- * `Application` type itself were documented on the same page. These are separate code entities, and are now documented separately:
4666
- *
4667
- * * {@link ApplicationModule} contains static methods relating to the `Application` type, accessible through `fin.Application`.
4604
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4668
4605
  * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4669
4606
  *
4607
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
4608
+ * both of these were documented on the same page.
4609
+ *
4670
4610
  * @packageDocumentation
4671
4611
  */
4672
4612
  __exportStar(requireFactory$2(), exports);
4673
- __exportStar(requireInstance$1(), exports);
4674
- } (application));
4613
+ __exportStar(requireInstance$1(), exports);
4614
+ } (application));
4675
4615
  return application;
4676
4616
  }
4677
4617
 
@@ -4689,6 +4629,7 @@ function requireInstance () {
4689
4629
  const application_1 = requireApplication();
4690
4630
  const main_1 = main;
4691
4631
  const view_1 = requireView();
4632
+ const warnings_1 = warnings;
4692
4633
  /**
4693
4634
  * @PORTED
4694
4635
  * @typedef { object } Margins
@@ -5173,7 +5114,6 @@ function requireInstance () {
5173
5114
  */
5174
5115
  constructor(wire, identity) {
5175
5116
  super(wire, identity, 'window');
5176
- this.identity = identity;
5177
5117
  }
5178
5118
  /**
5179
5119
  * Adds a listener to the end of the listeners array for the specified event.
@@ -5299,6 +5239,7 @@ function requireInstance () {
5299
5239
  if (options.autoShow === undefined) {
5300
5240
  options.autoShow = true;
5301
5241
  }
5242
+ (0, warnings_1.handleDeprecatedWarnings)(options);
5302
5243
  const windowCreation = this.wire.environment.createChildContent({ entityType: 'window', options });
5303
5244
  Promise.all([pageResponse, windowCreation])
5304
5245
  .then((resolvedArr) => {
@@ -5715,15 +5656,15 @@ function requireInstance () {
5715
5656
  * ```
5716
5657
  * @experimental
5717
5658
  */
5718
- async getLayout() {
5659
+ async getLayout(layoutIdentity) {
5719
5660
  this.wire.sendAction('window-get-layout', this.identity).catch((e) => {
5720
5661
  // don't expose
5721
5662
  });
5722
5663
  const opts = await this.getOptions();
5723
- if (!opts.layout) {
5664
+ if (!opts.layout || !opts.layoutSnapshot) {
5724
5665
  throw new Error('Window does not have a Layout');
5725
5666
  }
5726
- return this.fin.Platform.Layout.wrap(this.identity);
5667
+ return this.fin.Platform.Layout.wrap(layoutIdentity ?? this.identity);
5727
5668
  }
5728
5669
  /**
5729
5670
  * Gets the current settings of the window.
@@ -6004,11 +5945,12 @@ function requireInstance () {
6004
5945
  * moveBy(580, 300).then(() => console.log('Moved')).catch(err => console.log(err));
6005
5946
  * ```
6006
5947
  */
6007
- moveBy(deltaLeft, deltaTop) {
5948
+ moveBy(deltaLeft, deltaTop, positioningOptions) {
6008
5949
  return this.wire
6009
5950
  .sendAction('move-window-by', {
6010
5951
  deltaLeft,
6011
5952
  deltaTop,
5953
+ positioningOptions,
6012
5954
  ...this.identity
6013
5955
  })
6014
5956
  .then(() => undefined);
@@ -6038,11 +5980,12 @@ function requireInstance () {
6038
5980
  * moveTo(580, 300).then(() => console.log('Moved')).catch(err => console.log(err))
6039
5981
  * ```
6040
5982
  */
6041
- moveTo(left, top) {
5983
+ moveTo(left, top, positioningOptions) {
6042
5984
  return this.wire
6043
5985
  .sendAction('move-window', {
6044
5986
  left,
6045
5987
  top,
5988
+ positioningOptions,
6046
5989
  ...this.identity
6047
5990
  })
6048
5991
  .then(() => undefined);
@@ -6075,12 +6018,13 @@ function requireInstance () {
6075
6018
  * resizeBy(580, 300, 'top-right').then(() => console.log('Resized')).catch(err => console.log(err));
6076
6019
  * ```
6077
6020
  */
6078
- resizeBy(deltaWidth, deltaHeight, anchor) {
6021
+ resizeBy(deltaWidth, deltaHeight, anchor, positioningOptions) {
6079
6022
  return this.wire
6080
6023
  .sendAction('resize-window-by', {
6081
6024
  deltaWidth: Math.floor(deltaWidth),
6082
6025
  deltaHeight: Math.floor(deltaHeight),
6083
6026
  anchor,
6027
+ positioningOptions,
6084
6028
  ...this.identity
6085
6029
  })
6086
6030
  .then(() => undefined);
@@ -6113,12 +6057,13 @@ function requireInstance () {
6113
6057
  * resizeTo(580, 300, 'top-left').then(() => console.log('Resized')).catch(err => console.log(err));
6114
6058
  * ```
6115
6059
  */
6116
- resizeTo(width, height, anchor) {
6060
+ resizeTo(width, height, anchor, positioningOptions) {
6117
6061
  return this.wire
6118
6062
  .sendAction('resize-window', {
6119
6063
  width: Math.floor(width),
6120
6064
  height: Math.floor(height),
6121
6065
  anchor,
6066
+ positioningOptions,
6122
6067
  ...this.identity
6123
6068
  })
6124
6069
  .then(() => undefined);
@@ -6177,7 +6122,6 @@ function requireInstance () {
6177
6122
  }
6178
6123
  /**
6179
6124
  * Sets the window's size and position.
6180
- * @property { Bounds } bounds This is a * @type {string} name - name of the window.object that holds the propertys of
6181
6125
  *
6182
6126
  * @example
6183
6127
  * ```js
@@ -6204,8 +6148,10 @@ function requireInstance () {
6204
6148
  * }).then(() => console.log('Bounds set to window')).catch(err => console.log(err));
6205
6149
  * ```
6206
6150
  */
6207
- setBounds(bounds) {
6208
- return this.wire.sendAction('set-window-bounds', { ...bounds, ...this.identity }).then(() => undefined);
6151
+ setBounds(bounds, positioningOptions) {
6152
+ return this.wire
6153
+ .sendAction('set-window-bounds', { ...bounds, ...this.identity, positioningOptions })
6154
+ .then(() => undefined);
6209
6155
  }
6210
6156
  /**
6211
6157
  * Shows the window if it is hidden.
@@ -6347,7 +6293,10 @@ function requireInstance () {
6347
6293
  * Calling this method will close previously opened menus.
6348
6294
  * @experimental
6349
6295
  * @param options
6350
- *
6296
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
6297
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
6298
+ * of all possible data shapes for the entire menu, and the click handler should process
6299
+ * these with a "reducer" pattern.
6351
6300
  * @example
6352
6301
  * This could be used to show a drop down menu over views in a platform window:
6353
6302
  * ```js
@@ -6437,6 +6386,7 @@ function requireInstance () {
6437
6386
  return this.wire.sendAction('close-popup-menu', { ...this.identity }).then(() => undefined);
6438
6387
  }
6439
6388
  /**
6389
+ * @PORTED
6440
6390
  * @typedef {object} PopupOptions
6441
6391
  * @property {string} [name] - If a window with this `name` exists, it will be shown as a popup. Otherwise, a new window with this `name` will be created. If this `name` is undefined, `initialOptions.name` will be used. If this `name` and `intialOptions.name` are both undefined, a `name` will be generated.
6442
6392
  * @property {string} [url] - Navigates to this `url` if showing an existing window as a popup, otherwise the newly created window will load this `url`.
@@ -6454,6 +6404,7 @@ function requireInstance () {
6454
6404
  * @property {boolean} [hideOnClose] - Hide the popup window instead of closing whenever `close` is called on it. Note: if this is `true` and `blurBehavior` and/or `resultDispatchBehavior` are set to `close`, the window will be hidden.
6455
6405
  */
6456
6406
  /**
6407
+ * @PORTED
6457
6408
  * @typedef {object} PopupResult
6458
6409
  * @property {Identity} identity - `name` and `uuid` of the popup window that called dispatched this result.
6459
6410
  * @property {'clicked' | 'dismissed'} result - Result of the user interaction with the popup window.
@@ -6547,6 +6498,9 @@ function requireFactory$1 () {
6547
6498
  const base_1 = base;
6548
6499
  const validate_1 = validate;
6549
6500
  const Instance_1 = requireInstance();
6501
+ /**
6502
+ * Static namespace for OpenFin API methods that interact with the {@link _Window} class, available under `fin.Window`.
6503
+ */
6550
6504
  class _WindowModule extends base_1.Base {
6551
6505
  /**
6552
6506
  * Asynchronously returns a Window object that represents an existing window.
@@ -6702,30 +6656,37 @@ function requireWindow () {
6702
6656
  };
6703
6657
  Object.defineProperty(exports, "__esModule", { value: true });
6704
6658
  /**
6705
- * Entry points for the OpenFin `Window` API.
6706
- *
6707
- * In the previous version of the API documentation, both static methods involving `Window` and instance properties of the
6708
- * `Window` type itself were documented on the same page. These are separate code entities, and are now documented separately:
6659
+ * Entry points for the OpenFin `Window` API (`fin.Window`).
6709
6660
  *
6710
- * * {@link _WindowModule} contains static methods relating to the `Window` type, accessible through `fin.Window`.
6661
+ * * {@link _WindowModule} contains static members of the `Window` API, accessible through `fin.Window`.
6711
6662
  * * {@link _Window} describes an instance of an OpenFin Window, e.g. as returned by `fin.Window.getCurrent`.
6712
6663
  *
6664
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
6665
+ * both of these were documented on the same page.
6666
+ *
6713
6667
  * Underscore prefixing of OpenFin types that alias DOM entities will be fixed in a future version.
6714
6668
  *
6715
6669
  * @packageDocumentation
6716
6670
  */
6717
6671
  __exportStar(requireFactory$1(), exports);
6718
- __exportStar(requireInstance(), exports);
6719
- } (window$1));
6672
+ __exportStar(requireInstance(), exports);
6673
+ } (window$1));
6720
6674
  return window$1;
6721
6675
  }
6722
6676
 
6677
+ /**
6678
+ * Entry point for the OpenFin `System` API (`fin.System`).
6679
+ *
6680
+ * * {@link System} contains static members of the `System` API (available under `fin.System`)
6681
+ *
6682
+ * @packageDocumentation
6683
+ */
6723
6684
  Object.defineProperty(system, "__esModule", { value: true });
6724
6685
  system.System = void 0;
6725
6686
  const base_1$j = base;
6726
6687
  const transport_errors_1$1 = transportErrors;
6727
6688
  const window_1 = requireWindow();
6728
- const events_1$6 = eventsExports;
6689
+ const events_1$6 = require$$0;
6729
6690
  /**
6730
6691
  * An object representing the core of OpenFin Runtime. Allows the developer
6731
6692
  * to perform system-level actions, such as accessing logs, viewing processes,
@@ -7727,7 +7688,8 @@ class System extends base_1$j.EmitterBase {
7727
7688
  }
7728
7689
  /**
7729
7690
  * Attempt to close an external process. The process will be terminated if it
7730
- * has not closed after the elapsed timeout in milliseconds.<br>
7691
+ * has not closed after the elapsed timeout in milliseconds.
7692
+ *
7731
7693
  * Note: This method is restricted by default and must be enabled via
7732
7694
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
7733
7695
  * @param options A object defined in the TerminateExternalRequestType interface
@@ -7763,7 +7725,8 @@ class System extends base_1$j.EmitterBase {
7763
7725
  return this.wire.sendAction('update-proxy', options).then(() => undefined);
7764
7726
  }
7765
7727
  /**
7766
- * Downloads the given application asset<br>
7728
+ * Downloads the given application asset.
7729
+ *
7767
7730
  * Note: This method is restricted by default and must be enabled via
7768
7731
  * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
7769
7732
  * @param appAsset App asset object
@@ -8657,7 +8620,7 @@ class ChannelBase {
8657
8620
  try {
8658
8621
  const mainAction = this.subscriptions.has(topic)
8659
8622
  ? this.subscriptions.get(topic)
8660
- : (currentPayload, id) => { var _a; return ((_a = this.defaultAction) !== null && _a !== void 0 ? _a : ChannelBase.defaultAction)(topic, currentPayload, id); };
8623
+ : (currentPayload, id) => (this.defaultAction ?? ChannelBase.defaultAction)(topic, currentPayload, id);
8661
8624
  const preActionProcessed = this.preAction ? await this.preAction(topic, payload, senderIdentity) : payload;
8662
8625
  const actionProcessed = await mainAction(preActionProcessed, senderIdentity);
8663
8626
  return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
@@ -8986,17 +8949,17 @@ const channelClientsByEndpointId = new Map();
8986
8949
  * provider via {@link ChannelClient#dispatch dispatch} and to listen for communication
8987
8950
  * from the provider by registering an action via {@link ChannelClient#register register}.
8988
8951
  *
8989
- * Synchronous Methods:
8952
+ * ### Synchronous Methods:
8990
8953
  * * {@link ChannelClient#onDisconnection onDisconnection(listener)}
8991
8954
  * * {@link ChannelClient#register register(action, listener)}
8992
8955
  * * {@link ChannelClient#remove remove(action)}
8993
8956
  *
8994
- * Asynchronous Methods:
8957
+ * ### Asynchronous Methods:
8995
8958
  * * {@link ChannelClient#disconnect disconnect()}
8996
8959
  * * {@link ChannelClient#dispatch dispatch(action, payload)}
8997
8960
  *
8998
- * Middleware:
8999
- * <br>Middleware functions receive the following arguments: (action, payload, senderId).
8961
+ * ### Middleware:
8962
+ * Middleware functions receive the following arguments: (action, payload, senderId).
9000
8963
  * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
9001
8964
  * unless it is undefined, in which case the original payload is used. Middleware can be used for side effects.
9002
8965
  * * {@link ChannelClient#setDefaultAction setDefaultAction(middleware)}
@@ -9190,7 +9153,6 @@ class ClassicStrategy {
9190
9153
  // connection problems occur
9191
9154
  _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
9192
9155
  this.send = async (endpointId, action, payload) => {
9193
- var _a;
9194
9156
  const to = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
9195
9157
  if (!to) {
9196
9158
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
@@ -9210,13 +9172,12 @@ class ClassicStrategy {
9210
9172
  action,
9211
9173
  payload
9212
9174
  });
9213
- (_a = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)) === null || _a === void 0 ? void 0 : _a.add(p);
9175
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
9214
9176
  const raw = await p.catch((error) => {
9215
9177
  throw new Error(error.message);
9216
9178
  }).finally(() => {
9217
- var _a;
9218
9179
  // clean up the pending promise
9219
- (_a = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)) === null || _a === void 0 ? void 0 : _a.delete(p);
9180
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
9220
9181
  });
9221
9182
  return raw.payload.data.result;
9222
9183
  };
@@ -9237,8 +9198,8 @@ class ClassicStrategy {
9237
9198
  const id = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
9238
9199
  __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
9239
9200
  const pendingSet = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
9240
- pendingSet === null || pendingSet === void 0 ? void 0 : pendingSet.forEach((p) => {
9241
- const errorMsg = `Channel connection with identity uuid: ${id === null || id === void 0 ? void 0 : id.uuid} / name: ${id === null || id === void 0 ? void 0 : id.name} / endpointId: ${endpointId} no longer connected.`;
9201
+ pendingSet?.forEach((p) => {
9202
+ const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
9242
9203
  p.cancel(new Error(errorMsg));
9243
9204
  });
9244
9205
  }
@@ -9250,9 +9211,8 @@ class ClassicStrategy {
9250
9211
  __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
9251
9212
  }
9252
9213
  isValidEndpointPayload(payload) {
9253
- var _a, _b;
9254
- return (typeof ((_a = payload === null || payload === void 0 ? void 0 : payload.endpointIdentity) === null || _a === void 0 ? void 0 : _a.endpointId) === 'string' ||
9255
- typeof ((_b = payload === null || payload === void 0 ? void 0 : payload.endpointIdentity) === null || _b === void 0 ? void 0 : _b.channelId) === 'string');
9214
+ return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
9215
+ typeof payload?.endpointIdentity?.channelId === 'string');
9256
9216
  }
9257
9217
  }
9258
9218
  strategy$2.ClassicStrategy = ClassicStrategy;
@@ -9329,13 +9289,12 @@ class RTCEndpoint {
9329
9289
  this.rtc.rtcClient.close();
9330
9290
  };
9331
9291
  this.rtc.channels.response.addEventListener('message', (e) => {
9332
- var _a;
9333
9292
  let { data } = e;
9334
9293
  if (e.data instanceof ArrayBuffer) {
9335
9294
  data = new TextDecoder().decode(e.data);
9336
9295
  }
9337
9296
  const { messageId, payload, success, error } = JSON.parse(data);
9338
- const { resolve, reject } = (_a = this.responseMap.get(messageId)) !== null && _a !== void 0 ? _a : {};
9297
+ const { resolve, reject } = this.responseMap.get(messageId) ?? {};
9339
9298
  if (resolve && reject) {
9340
9299
  this.responseMap.delete(messageId);
9341
9300
  if (success) {
@@ -9584,9 +9543,8 @@ class RTCICEManager extends base_1$i.EmitterBase {
9584
9543
  const rtcConnectionId = Math.random().toString();
9585
9544
  const rtcClient = this.createRtcPeer();
9586
9545
  rtcClient.addEventListener('icecandidate', async (e) => {
9587
- var _a;
9588
9546
  if (e.candidate) {
9589
- await this.raiseClientIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
9547
+ await this.raiseClientIce(rtcConnectionId, { candidate: e.candidate?.toJSON() });
9590
9548
  }
9591
9549
  });
9592
9550
  await this.listenForProviderIce(rtcConnectionId, async (payload) => {
@@ -9611,9 +9569,8 @@ class RTCICEManager extends base_1$i.EmitterBase {
9611
9569
  const requestChannelPromise = RTCICEManager.createDataChannelPromise('request', rtcClient);
9612
9570
  const responseChannelPromise = RTCICEManager.createDataChannelPromise('response', rtcClient);
9613
9571
  rtcClient.addEventListener('icecandidate', async (e) => {
9614
- var _a;
9615
9572
  if (e.candidate) {
9616
- await this.raiseProviderIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
9573
+ await this.raiseProviderIce(rtcConnectionId, { candidate: e.candidate?.toJSON() });
9617
9574
  }
9618
9575
  });
9619
9576
  await this.listenForClientIce(rtcConnectionId, async (payload) => {
@@ -9686,20 +9643,20 @@ const runtimeVersioning_1 = runtimeVersioning;
9686
9643
  * a single client via {@link ChannelProvider#dispatch dispatch} or all clients via {@link ChannelProvider#publish publish}
9687
9644
  * and to listen for communication from clients by registering an action via {@link ChannelProvider#register register}.
9688
9645
  *
9689
- * Synchronous Methods:
9646
+ * ### Synchronous Methods:
9690
9647
  * * {@link ChannelProvider#onConnection onConnection(listener)}
9691
9648
  * * {@link ChannelProvider#onDisconnection onDisconnection(listener)}
9692
9649
  * * {@link ChannelProvider#publish publish(action, payload)}
9693
9650
  * * {@link ChannelProvider#register register(action, listener)}
9694
9651
  * * {@link ChannelProvider#remove remove(action)}
9695
9652
  *
9696
- * Asynchronous Methods:
9653
+ * ### Asynchronous Methods:
9697
9654
  * * {@link ChannelProvider#destroy destroy()}
9698
9655
  * * {@link ChannelProvider#dispatch dispatch(to, action, payload)}
9699
9656
  * * {@link ChannelProvider#getAllClientInfo getAllClientInfo()}
9700
9657
  *
9701
- * Middleware:
9702
- * <br>Middleware functions receive the following arguments: (action, payload, senderId).
9658
+ * ### Middleware:
9659
+ * Middleware functions receive the following arguments: (action, payload, senderId).
9703
9660
  * The return value of the middleware function will be passed on as the payload from beforeAction, to the action listener, to afterAction
9704
9661
  * unless it is undefined, in which case the most recently defined payload is used. Middleware can be used for side effects.
9705
9662
  * * {@link ChannelProvider#setDefaultAction setDefaultAction(middleware)}
@@ -9795,8 +9752,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9795
9752
  * ```
9796
9753
  */
9797
9754
  dispatch(to, action, payload) {
9798
- var _a;
9799
- const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
9755
+ const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
9800
9756
  if (endpointId && __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
9801
9757
  return __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
9802
9758
  }
@@ -9972,13 +9928,12 @@ class ChannelProvider extends channel_1.ChannelBase {
9972
9928
  }
9973
9929
  }
9974
9930
  getEndpointIdForOpenFinId(clientIdentity, action) {
9975
- var _a;
9976
9931
  const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
9977
9932
  if (matchingConnections.length >= 2) {
9978
9933
  const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
9979
9934
  const { uuid, name } = clientIdentity;
9980
- const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
9981
- const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
9935
+ const providerUuid = protectedObj?.providerIdentity.uuid;
9936
+ const providerName = protectedObj?.providerIdentity.name;
9982
9937
  // eslint-disable-next-line no-console
9983
9938
  console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
9984
9939
  "endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
@@ -9986,7 +9941,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9986
9941
  ({uuid: ${providerUuid}, name: ${providerName}}) will only be processed by the most recently-created client.`);
9987
9942
  }
9988
9943
  // Pop to return the most recently created endpointId.
9989
- return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
9944
+ return matchingConnections.pop()?.endpointId;
9990
9945
  }
9991
9946
  // eslint-disable-next-line class-methods-use-this
9992
9947
  static clientIdentityIncludesEndpointId(subscriptionIdentity) {
@@ -10029,9 +9984,10 @@ class MessageReceiver extends base_1$h.Base {
10029
9984
  wire.registerMessageHandler(this.onmessage.bind(this));
10030
9985
  }
10031
9986
  async processChannelMessage(msg) {
10032
- var _a, _b;
10033
9987
  const { senderIdentity, providerIdentity, action, ackToSender, payload, intendedTargetIdentity } = msg.payload;
10034
- const key = (_b = (_a = intendedTargetIdentity.channelId) !== null && _a !== void 0 ? _a : intendedTargetIdentity.endpointId) !== null && _b !== void 0 ? _b : this.latestEndpointIdByChannelId.get(providerIdentity.channelId); // No endpointId was passed, make best attempt
9988
+ const key = intendedTargetIdentity.channelId ?? // The recipient is a provider
9989
+ intendedTargetIdentity.endpointId ?? // The recipient is a client
9990
+ this.latestEndpointIdByChannelId.get(providerIdentity.channelId); // No endpointId was passed, make best attempt
10035
9991
  const handler = this.endpointMap.get(key);
10036
9992
  if (!handler) {
10037
9993
  ackToSender.payload.success = false;
@@ -10111,12 +10067,9 @@ class ProtocolManager {
10111
10067
  return supported;
10112
10068
  };
10113
10069
  this.getCompatibleProtocols = (providerProtocols, clientOffer) => {
10114
- const supported = clientOffer.supportedProtocols.filter((clientProtocol) => providerProtocols.some((providerProtocol) => {
10115
- var _a;
10116
- return providerProtocol.type === clientProtocol.type &&
10117
- clientProtocol.version >= providerProtocol.minimumVersion &&
10118
- providerProtocol.version >= ((_a = clientProtocol.minimumVersion) !== null && _a !== void 0 ? _a : 0);
10119
- }));
10070
+ const supported = clientOffer.supportedProtocols.filter((clientProtocol) => providerProtocols.some((providerProtocol) => providerProtocol.type === clientProtocol.type &&
10071
+ clientProtocol.version >= providerProtocol.minimumVersion &&
10072
+ providerProtocol.version >= (clientProtocol.minimumVersion ?? 0)));
10120
10073
  return supported.slice(0, clientOffer.maxProtocols);
10121
10074
  };
10122
10075
  }
@@ -10241,7 +10194,7 @@ class ConnectionManager extends base_1$g.Base {
10241
10194
  }
10242
10195
  createProvider(options, providerIdentity) {
10243
10196
  const opts = Object.assign(this.wire.environment.getDefaultChannelOptions().create, options || {});
10244
- const protocols = this.protocolManager.getProviderProtocols(opts === null || opts === void 0 ? void 0 : opts.protocols);
10197
+ const protocols = this.protocolManager.getProviderProtocols(opts?.protocols);
10245
10198
  const createSingleStrategy = (stratType) => {
10246
10199
  switch (stratType) {
10247
10200
  case 'rtc':
@@ -10278,7 +10231,7 @@ class ConnectionManager extends base_1$g.Base {
10278
10231
  return channel;
10279
10232
  }
10280
10233
  async createClientOffer(options) {
10281
- const protocols = this.protocolManager.getClientProtocols(options === null || options === void 0 ? void 0 : options.protocols);
10234
+ const protocols = this.protocolManager.getClientProtocols(options?.protocols);
10282
10235
  let rtcPacket;
10283
10236
  const supportedProtocols = await Promise.all(protocols.map(async (type) => {
10284
10237
  switch (type) {
@@ -10306,14 +10259,13 @@ class ConnectionManager extends base_1$g.Base {
10306
10259
  };
10307
10260
  }
10308
10261
  async createClientStrategy(rtcPacket, routingInfo) {
10309
- var _a;
10310
10262
  if (!routingInfo.endpointId) {
10311
10263
  routingInfo.endpointId = this.wire.environment.getNextMessageId();
10312
10264
  // For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
10313
10265
  // clients that are in the same context as the newly-connected client.
10314
10266
  __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
10315
10267
  }
10316
- const answer = (_a = routingInfo.answer) !== null && _a !== void 0 ? _a : {
10268
+ const answer = routingInfo.answer ?? {
10317
10269
  supportedProtocols: [{ type: 'classic', version: 1 }]
10318
10270
  };
10319
10271
  const createStrategyFromAnswer = async (protocol) => {
@@ -10371,7 +10323,7 @@ class ConnectionManager extends base_1$g.Base {
10371
10323
  if (!(provider instanceof provider_1$1.ChannelProvider)) {
10372
10324
  throw Error('Cannot connect to a channel client');
10373
10325
  }
10374
- const offer = clientOffer !== null && clientOffer !== void 0 ? clientOffer : {
10326
+ const offer = clientOffer ?? {
10375
10327
  supportedProtocols: [{ type: 'classic', version: 1 }],
10376
10328
  maxProtocols: 1
10377
10329
  };
@@ -10429,6 +10381,15 @@ class ConnectionManager extends base_1$g.Base {
10429
10381
  connectionManager.ConnectionManager = ConnectionManager;
10430
10382
  _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnectionManager = new WeakMap();
10431
10383
 
10384
+ /**
10385
+ * Entry points for the `Channel` subset of the `InterApplicationBus` API (`fin.InterApplicationBus.Channel`).
10386
+ *
10387
+ * * {@link Channel} contains static members of the `Channel` API, accessible through `fin.InterApplicationBus.Channel`.
10388
+ * * {@link OpenFin.ChannelClient} describes a client of a channel, e.g. as returned by `fin.InterApplicationBus.Channel.connect`.
10389
+ * * {@link OpenFin.ChannelProvider} describes a provider of a channel, e.g. as returned by `fin.InterApplicationBus.Channel.create`.
10390
+ *
10391
+ * @packageDocumentation
10392
+ */
10432
10393
  var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10433
10394
  if (kind === "m") throw new TypeError("Private method is not writable");
10434
10395
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -10444,7 +10405,7 @@ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnec
10444
10405
  Object.defineProperty(channel$1, "__esModule", { value: true });
10445
10406
  channel$1.Channel = void 0;
10446
10407
  /* eslint-disable no-console */
10447
- const events_1$5 = eventsExports;
10408
+ const events_1$5 = require$$0;
10448
10409
  const lazy_1$1 = lazy;
10449
10410
  const base_1$f = base;
10450
10411
  const client_1 = client;
@@ -10764,7 +10725,14 @@ _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakM
10764
10725
 
10765
10726
  Object.defineProperty(interappbus, "__esModule", { value: true });
10766
10727
  interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
10767
- const events_1$4 = eventsExports;
10728
+ /**
10729
+ * Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
10730
+ *
10731
+ * * {@link InterApplicationBus} contains static members of the `InterApplicationBus` API, accessible through `fin.InterApplicationBus`.
10732
+ *
10733
+ * @packageDocumentation
10734
+ */
10735
+ const events_1$4 = require$$0;
10768
10736
  const base_1$e = base;
10769
10737
  const ref_counter_1 = refCounter;
10770
10738
  const index_1$2 = channel$1;
@@ -10972,6 +10940,13 @@ function createKey(...toHash) {
10972
10940
 
10973
10941
  var clipboard = {};
10974
10942
 
10943
+ /**
10944
+ * Entry point for the OpenFin `Clipboard` API (`fin.Clipboard`).
10945
+ *
10946
+ * * {@link Clipboard} contains static members of the `Clipboard` API, accessible through `fin.Clipboard`.
10947
+ *
10948
+ * @packageDocumentation
10949
+ */
10975
10950
  Object.defineProperty(clipboard, "__esModule", { value: true });
10976
10951
  clipboard.Clipboard = void 0;
10977
10952
  const base_1$d = base;
@@ -11186,7 +11161,7 @@ const base_1$c = base;
11186
11161
  /**
11187
11162
  * An ExternalApplication object representing native language adapter connections to the runtime. Allows
11188
11163
  * the developer to listen to {@link OpenFin.ExternalApplicationEvents external application events}.
11189
- * Discovery of connections is provided by <a href="tutorial-System.getAllExternalApplications.html">getAllExternalApplications.</a>
11164
+ * Discovery of connections is provided by {@link System.System.getAllExternalApplications getAllExternalApplications}.</a>
11190
11165
  *
11191
11166
  * Processes that can be wrapped as `ExternalApplication`s include the following:
11192
11167
  * - Processes which have connected to an OpenFin runtime via an adapter
@@ -11300,6 +11275,9 @@ Object.defineProperty(Factory$5, "__esModule", { value: true });
11300
11275
  Factory$5.ExternalApplicationModule = void 0;
11301
11276
  const base_1$b = base;
11302
11277
  const Instance_1$4 = Instance$4;
11278
+ /**
11279
+ * Static namespace for OpenFin API methods that interact with the {@link ExternalApplication} class, available under `fin.ExternalApplication`.
11280
+ */
11303
11281
  class ExternalApplicationModule extends base_1$b.Base {
11304
11282
  /**
11305
11283
  * Asynchronously returns an External Application object that represents an external application.
@@ -11359,18 +11337,18 @@ Factory$5.ExternalApplicationModule = ExternalApplicationModule;
11359
11337
  };
11360
11338
  Object.defineProperty(exports, "__esModule", { value: true });
11361
11339
  /**
11362
- * Entry points for the OpenFin `ExternalApplication` API.
11340
+ * Entry points for the OpenFin `ExternalApplication` API (`fin.ExternalApplication`).
11363
11341
  *
11364
- * In the previous version of the API documentation, both static methods involving `ExternalApplication` and instance properties of the
11365
- * `ExternalApplication` type itself were documented on the same page. These are separate code entities, and are now documented separately:
11366
- *
11367
- * * {@link ExternalApplicationModule} contains static methods relating to the `ExternalApplication` type, accessible through `fin.ExternalApplication`.
11342
+ * * {@link ExternalApplicationModule} contains static members of the `ExternalApplication` type, accessible through `fin.ExternalApplication`.
11368
11343
  * * {@link ExternalApplication} describes an instance of an OpenFin ExternalApplication, e.g. as returned by `fin.ExternalApplication.getCurrent`.
11369
11344
  *
11345
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
11346
+ * both of these were documented on the same page.
11347
+ *
11370
11348
  * @packageDocumentation
11371
11349
  */
11372
11350
  __exportStar(Factory$5, exports);
11373
- __exportStar(Instance$4, exports);
11351
+ __exportStar(Instance$4, exports);
11374
11352
  } (externalApplication));
11375
11353
 
11376
11354
  var frame = {};
@@ -11527,6 +11505,9 @@ Factory$4._FrameModule = void 0;
11527
11505
  const base_1$9 = base;
11528
11506
  const validate_1$2 = validate;
11529
11507
  const Instance_1$3 = Instance$3;
11508
+ /**
11509
+ * Static namespace for OpenFin API methods that interact with the {@link _Frame} class, available under `fin.Frame`.
11510
+ */
11530
11511
  class _FrameModule extends base_1$9.Base {
11531
11512
  /**
11532
11513
  * Asynchronously returns a reference to the specified frame. The frame does not have to exist
@@ -11607,14 +11588,14 @@ Factory$4._FrameModule = _FrameModule;
11607
11588
 
11608
11589
  (function (exports) {
11609
11590
  /**
11610
- * Entry points for the OpenFin `Frame` API.
11611
- *
11612
- * In the previous version of the API documentation, both static methods involving `Frame` and instance properties of the
11613
- * `Frame` type itself were documented on the same page. These are separate code entities, and are now documented separately:
11591
+ * Entry points for the OpenFin `Frame` API (`fin.Frame`).
11614
11592
  *
11615
- * * {@link _FrameModule} contains static methods relating to the `Frame` type, accessible through `fin.Frame`.
11593
+ * * {@link _FrameModule} contains static members of the `Frame` API, accessible through `fin.Frame`.
11616
11594
  * * {@link _Frame} describes an instance of an OpenFin Frame, e.g. as returned by `fin.Frame.getCurrent`.
11617
11595
  *
11596
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
11597
+ * both of these were documented on the same page.
11598
+ *
11618
11599
  * Underscore prefixing of OpenFin types that alias DOM entities will be fixed in a future version.
11619
11600
  *
11620
11601
  * @packageDocumentation
@@ -11635,7 +11616,7 @@ Factory$4._FrameModule = _FrameModule;
11635
11616
  };
11636
11617
  Object.defineProperty(exports, "__esModule", { value: true });
11637
11618
  __exportStar(Factory$4, exports);
11638
- __exportStar(Instance$3, exports);
11619
+ __exportStar(Instance$3, exports);
11639
11620
  } (frame));
11640
11621
 
11641
11622
  var globalHotkey = {};
@@ -11658,6 +11639,8 @@ class GlobalHotkey extends base_1$8.EmitterBase {
11658
11639
  * Registers a global hotkey with the operating system.
11659
11640
  * @param hotkey a hotkey string
11660
11641
  * @param listener called when the registered hotkey is pressed by the user.
11642
+ * @throws If the `hotkey` is reserved, see list below.
11643
+ * @throws if the `hotkey` is already registered by another application.
11661
11644
  *
11662
11645
  * @remarks The `hotkey` parameter expects an electron compatible [accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) and the `listener` will be called if the `hotkey` is pressed by the user.
11663
11646
  * If successfull, the hotkey will be 'claimed' by the application, meaning that this register call can be called multiple times from within the same application but will fail if another application has registered the hotkey.
@@ -11750,7 +11733,7 @@ class GlobalHotkey extends base_1$8.EmitterBase {
11750
11733
  return undefined;
11751
11734
  }
11752
11735
  /**
11753
- * Checks if a given hotkey has been registered
11736
+ * Checks if a given hotkey has been registered by an application within the current runtime.
11754
11737
  * @param hotkey a hotkey string
11755
11738
  *
11756
11739
  * @example
@@ -11794,10 +11777,8 @@ const validate_1$1 = validate;
11794
11777
  const clientMap = new Map();
11795
11778
  /** Manages the life cycle of windows and views in the application.
11796
11779
  *
11797
- * Enables taking snapshots of itself and applyi
11798
- * ng them to restore a previous configuration
11780
+ * Enables taking snapshots of itself and applying them to restore a previous configuration
11799
11781
  * as well as listen to {@link OpenFin.PlatformEvents platform events}.
11800
- *
11801
11782
  */
11802
11783
  class Platform extends base_1$7.EmitterBase {
11803
11784
  /**
@@ -12156,15 +12137,13 @@ class Platform extends base_1$7.EmitterBase {
12156
12137
  });
12157
12138
  }
12158
12139
  /**
12159
- * ***DEPRECATED - please use Platform.createView.***
12140
+ * ***DEPRECATED - please use {@link Platform.createView Platform.createView}.***
12160
12141
  * Reparents a specified view in a new target window.
12161
12142
  * @param viewIdentity View identity
12162
12143
  * @param target new owner window identity
12163
12144
  *
12164
- * @tutorial Platform.createView
12165
12145
  */
12166
12146
  async reparentView(viewIdentity, target) {
12167
- var _a;
12168
12147
  // eslint-disable-next-line no-console
12169
12148
  console.warn('Platform.reparentView has been deprecated, please use Platform.createView');
12170
12149
  this.wire.sendAction('platform-reparent-view', this.identity).catch((e) => {
@@ -12172,7 +12151,7 @@ class Platform extends base_1$7.EmitterBase {
12172
12151
  });
12173
12152
  const normalizedViewIdentity = {
12174
12153
  ...viewIdentity,
12175
- uuid: (_a = viewIdentity.uuid) !== null && _a !== void 0 ? _a : this.identity.uuid
12154
+ uuid: viewIdentity.uuid ?? this.identity.uuid
12176
12155
  };
12177
12156
  const view = await this.fin.View.wrap(normalizedViewIdentity);
12178
12157
  const viewOptions = await view.getOptions();
@@ -12655,6 +12634,138 @@ const base_1$6 = base;
12655
12634
  const common_utils_1 = commonUtils;
12656
12635
  const layout_entities_1 = layoutEntities;
12657
12636
  const layout_constants_1 = layout_constants;
12637
+ /**
12638
+ *
12639
+ * Layouts give app providers the ability to embed multiple views in a single window. The Layout namespace
12640
+ * enables the initialization and manipulation of a window's Layout. A Layout will
12641
+ * emit events locally on the DOM element representing the layout-container.
12642
+ *
12643
+ *
12644
+ * ### Layout.DOMEvents
12645
+ *
12646
+ * When a Layout is created, it emits events onto the DOM element representing the Layout container.
12647
+ * This Layout container is the DOM element referenced by containerId in {@link Layout.LayoutModule#init Layout.init}.
12648
+ * You can use the built-in event emitter to listen to these events using [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener).
12649
+ * The events are emitted synchronously and only in the process where the Layout exists.
12650
+ * Any values returned by the called listeners are ignored and will be discarded.
12651
+ * If the target DOM element is destroyed, any events that have been set up on that element will be destroyed.
12652
+ *
12653
+ * @remarks The built-in event emitter is not an OpenFin event emitter so it doesn't share propagation semantics.
12654
+ *
12655
+ * #### {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener addEventListener(type, listener [, options]);}
12656
+ * Adds a listener to the end of the listeners array for the specified event.
12657
+ * @example
12658
+ * ```js
12659
+ * const myLayoutContainer = document.getElementById('layout-container');
12660
+ *
12661
+ * myLayoutContainer.addEventListener('tab-created', function(event) {
12662
+ * const { tabSelector } = event.detail;
12663
+ * const tabElement = document.getElementById(tabSelector);
12664
+ * const existingColor = tabElement.style.backgroundColor;
12665
+ * tabElement.style.backgroundColor = "red";
12666
+ * setTimeout(() => {
12667
+ * tabElement.style.backgroundColor = existingColor;
12668
+ * }, 2000);
12669
+ * });
12670
+ * ```
12671
+ *
12672
+ * #### {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener removeEventListener(type, listener [, options]);}
12673
+ * Adds a listener to the end of the listeners array for the specified event.
12674
+ * @example
12675
+ * ```js
12676
+ * const myLayoutContainer = document.getElementById('layout-container');
12677
+ *
12678
+ * const listener = function(event) {
12679
+ * console.log(event.detail);
12680
+ * console.log('container-created event fired once, removing listener');
12681
+ * myLayoutContainer.removeEventListener('container-created', listener);
12682
+ * };
12683
+ *
12684
+ * myLayoutContainer.addEventListener('container-created', listener);
12685
+ * ```
12686
+ *
12687
+ * ### Supported event types are:
12688
+ *
12689
+ * * tab-created
12690
+ * * container-created
12691
+ * * layout-state-changed
12692
+ * * tab-closed
12693
+ * * tab-dropped
12694
+ *
12695
+ * ### Layout DOM Node Events
12696
+ *
12697
+ * #### tab-created
12698
+ * Generated when a tab is created. As a user drags and drops tabs within window, new tabs are created. A single view may have multiple tabs created and destroyed during its lifetime attached to a single window.
12699
+ * ```js
12700
+ * // The response has the following shape in event.detail:
12701
+ * {
12702
+ * containerSelector: "container-component_A",
12703
+ * name: "component_A",
12704
+ * tabSelector: "tab-component_A",
12705
+ * topic: "openfin-DOM-event",
12706
+ * type: "tab-created",
12707
+ * uuid: "OpenFin POC"
12708
+ * }
12709
+ * ```
12710
+ *
12711
+ * #### container-created
12712
+ * Generated when a container is created. A single view will have only one container during its lifetime attached to a single window and the container's lifecycle is tied to the view. To discover when the container is destroyed, please listen to view-detached event.
12713
+ * ```js
12714
+ * // The response has the following shape in event.detail:
12715
+ * {
12716
+ * containerSelector: "container-component_A",
12717
+ * name: "component_A",
12718
+ * tabSelector: "tab-component_A",
12719
+ * topic: "openfin-DOM-event",
12720
+ * type: "container-created",
12721
+ * uuid: "OpenFin POC"
12722
+ * }
12723
+ * ```
12724
+ *
12725
+ * ### layout-state-changed
12726
+ * Generated when the state of the layout changes in any way, such as a view added/removed/replaced. Note that this event can fire frequently as the underlying layout can change multiple components from all kinds of changes (resizing for example). Given this, it is recommended to debounce this event and then you can use the {@link Layout#getConfig Layout.getConfig} API to retrieve the most up-to-date state.
12727
+ * ```js
12728
+ * // The response has the following shape in event.detail
12729
+ * {
12730
+ * containerSelector: "container-component_A",
12731
+ * name: "component_A",
12732
+ * tabSelector: "tab-component_A",
12733
+ * topic: "openfin-DOM-event",
12734
+ * type: "layout-state-changed",
12735
+ * uuid: "OpenFin POC"
12736
+ * }
12737
+ * ```
12738
+ *
12739
+ * #### tab-closed
12740
+ * Generated when a tab is closed.
12741
+ * ```js
12742
+ * // The response has the following shape in event.detail:
12743
+ * {
12744
+ * containerSelector: "container-component_A",
12745
+ * name: "component_A",
12746
+ * tabSelector: "tab-component_A",
12747
+ * topic: "openfin-DOM-event",
12748
+ * type: "tab-closed",
12749
+ * uuid: "OpenFin POC",
12750
+ * url: "http://openfin.co" // The url of the view that was closed.
12751
+ * }
12752
+ * ```
12753
+ *
12754
+ * #### tab-dropped
12755
+ * Generated when a tab is dropped.
12756
+ * ```js
12757
+ * // The response has the following shape in event.detail:
12758
+ * {
12759
+ * containerSelector: "container-component_A",
12760
+ * name: "component_A",
12761
+ * tabSelector: "tab-component_A",
12762
+ * topic: "openfin-DOM-event",
12763
+ * type: "tab-dropped",
12764
+ * uuid: "OpenFin POC",
12765
+ * url: "http://openfin.co" // The url of the view linked to the dropped tab.
12766
+ * }
12767
+ * ```
12768
+ */
12658
12769
  class Layout extends base_1$6.Base {
12659
12770
  /**
12660
12771
  * @internal
@@ -12828,10 +12939,30 @@ class Layout extends base_1$6.Base {
12828
12939
  // don't expose
12829
12940
  });
12830
12941
  const client = await this.platform.getClient();
12942
+ console.log(`Layout::toConfig() called!`);
12831
12943
  return client.dispatch('get-frame-snapshot', {
12832
12944
  target: this.identity
12833
12945
  });
12834
12946
  }
12947
+ /**
12948
+ * Retrieves the attached views in current window layout.
12949
+ *
12950
+ * @example
12951
+ * ```js
12952
+ * const layout = fin.Platform.Layout.getCurrentSync();
12953
+ * const views = await layout.getCurrentViews();
12954
+ * ```
12955
+ */
12956
+ async getCurrentViews() {
12957
+ this.wire.sendAction('layout-get-views').catch((e) => {
12958
+ // don't expose
12959
+ });
12960
+ const client = await this.platform.getClient();
12961
+ const viewIdentities = await client.dispatch('get-layout-views', {
12962
+ target: this.identity
12963
+ });
12964
+ return viewIdentities.map((identity) => this.fin.View.wrapSync(identity));
12965
+ }
12835
12966
  /**
12836
12967
  * Retrieves the top level content item of the layout.
12837
12968
  *
@@ -12858,7 +12989,7 @@ class Layout extends base_1$6.Base {
12858
12989
  // don't expose
12859
12990
  });
12860
12991
  const client = await __classPrivateFieldGet$5(this, _Layout_layoutClient, "f").getValue();
12861
- const root = await client.getRoot();
12992
+ const root = await client.getRoot(this.identity);
12862
12993
  return layout_entities_1.LayoutNode.getEntity(root, client);
12863
12994
  }
12864
12995
  }
@@ -12876,16 +13007,20 @@ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
12876
13007
  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");
12877
13008
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12878
13009
  };
12879
- var _LayoutModule_layoutInitializationAttempted;
13010
+ var _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager;
12880
13011
  Object.defineProperty(Factory$2, "__esModule", { value: true });
12881
13012
  Factory$2.LayoutModule = void 0;
12882
13013
  /* eslint-disable no-undef, import/prefer-default-export */
12883
13014
  const base_1$5 = base;
12884
13015
  const Instance_1$2 = Instance$1;
13016
+ /**
13017
+ * Static namespace for OpenFin API methods that interact with the {@link Layout} class, available under `fin.Platform.Layout`.
13018
+ */
12885
13019
  class LayoutModule extends base_1$5.Base {
12886
13020
  constructor() {
12887
13021
  super(...arguments);
12888
13022
  _LayoutModule_layoutInitializationAttempted.set(this, false);
13023
+ _LayoutModule_layoutManager.set(this, null);
12889
13024
  /**
12890
13025
  * Initialize the window's Layout.
12891
13026
  *
@@ -12935,7 +13070,17 @@ class LayoutModule extends base_1$5.Base {
12935
13070
  throw new Error('Layout for this window already initialized, please use Layout.replace call to replace the layout.');
12936
13071
  }
12937
13072
  __classPrivateFieldSet$4(this, _LayoutModule_layoutInitializationAttempted, true, "f");
12938
- return this.wire.environment.initLayout(this.fin, this.wire, options);
13073
+ // TODO: remove this.wire and always use this.fin
13074
+ __classPrivateFieldSet$4(this, _LayoutModule_layoutManager, await this.wire.environment.initLayout(this.fin, this.wire, options), "f");
13075
+ // TODO: if create() wasn't called, warn!! aka, if lm.getLayouts().length === 0
13076
+ const layoutInstance = await __classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f").resolveLayout();
13077
+ const layout = this.wrapSync(layoutInstance.identity);
13078
+ // Adding this to the returned instance undocumented/typed for Browser
13079
+ // TODO: if not overridden, then return layoutManager: layoutInstance
13080
+ return Object.assign(layout, { layoutManager: layoutInstance });
13081
+ };
13082
+ this.getCurrentLayoutManagerSync = () => {
13083
+ return __classPrivateFieldGet$4(this, _LayoutModule_layoutManager, "f");
12939
13084
  };
12940
13085
  }
12941
13086
  /**
@@ -13033,143 +13178,20 @@ class LayoutModule extends base_1$5.Base {
13033
13178
  }
13034
13179
  }
13035
13180
  Factory$2.LayoutModule = LayoutModule;
13036
- _LayoutModule_layoutInitializationAttempted = new WeakMap();
13181
+ _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap();
13037
13182
 
13038
13183
  (function (exports) {
13039
13184
  /**
13040
- * Entry point for the OpenFin Layout namespace.
13041
- *
13042
- * Because TypeDoc does not currently support multiple modules with the same name, the module alias "LayoutModule" is used for
13043
- * the module containing static members of the `Layout` namespace (available under `fin.Platform.Layout`), while `Layout` documents
13044
- * instances of the OpenFin `Layout` class.
13185
+ * Entry point for the OpenFin `Layout` subset of the `Platform` API (`fin.Platform.Layout`).
13045
13186
  *
13046
- * @packageDocumentation
13187
+ * * {@link LayoutModule} contains static members of the `Layout` API, accessible through `fin.Platform.Layout`.
13188
+ * * {@link Layout} describes an instance of an OpenFin Layout, e.g. as returned by `fin.Platform.Layout.getCurrent`.
13047
13189
  *
13190
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
13191
+ * both of these were documented on the same page.
13048
13192
  *
13049
- * ### Layout.DOMEvents
13050
- *
13051
- * When a Layout is created, it emits events onto the DOM element representing the Layout container.
13052
- * This Layout container is the DOM element referenced by containerId in {@link Layout.LayoutModule#init Layout.init}.
13053
- * You can use the built-in event emitter to listen to these events using [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener).
13054
- * The events are emitted synchronously and only in the process where the Layout exists.
13055
- * Any values returned by the called listeners are ignored and will be discarded.
13056
- * If the target DOM element is destroyed, any events that have been set up on that element will be destroyed.
13057
- *
13058
- * @remarks The built-in event emitter is not an OpenFin event emitter so it doesn't share propagation semantics.
13059
- *
13060
- * #### {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener addEventListener(type, listener [, options]);}
13061
- * Adds a listener to the end of the listeners array for the specified event.
13062
- * @example
13063
- * ```js
13064
- * const myLayoutContainer = document.getElementById('layout-container');
13065
- *
13066
- * myLayoutContainer.addEventListener('tab-created', function(event) {
13067
- * const { tabSelector } = event.detail;
13068
- * const tabElement = document.getElementById(tabSelector);
13069
- * const existingColor = tabElement.style.backgroundColor;
13070
- * tabElement.style.backgroundColor = "red";
13071
- * setTimeout(() => {
13072
- * tabElement.style.backgroundColor = existingColor;
13073
- * }, 2000);
13074
- * });
13075
- * ```
13076
- *
13077
- * #### {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener removeEventListener(type, listener [, options]);}
13078
- * Adds a listener to the end of the listeners array for the specified event.
13079
- * @example
13080
- * ```js
13081
- * const myLayoutContainer = document.getElementById('layout-container');
13082
- *
13083
- * const listener = function(event) {
13084
- * console.log(event.detail);
13085
- * console.log('container-created event fired once, removing listener');
13086
- * myLayoutContainer.removeEventListener('container-created', listener);
13087
- * };
13088
- *
13089
- * myLayoutContainer.addEventListener('container-created', listener);
13090
- * ```
13091
- *
13092
- * ### Supported event types are:
13093
- *
13094
- * * tab-created
13095
- * * container-created
13096
- * * layout-state-changed
13097
- * * tab-closed
13098
- * * tab-dropped
13099
- *
13100
- * ### Layout DOM Node Events
13101
- *
13102
- * #### tab-created
13103
- * Generated when a tab is created. As a user drags and drops tabs within window, new tabs are created. A single view may have multiple tabs created and destroyed during its lifetime attached to a single window.
13104
- * ```js
13105
- * // The response has the following shape in event.detail:
13106
- * {
13107
- * containerSelector: "container-component_A",
13108
- * name: "component_A",
13109
- * tabSelector: "tab-component_A",
13110
- * topic: "openfin-DOM-event",
13111
- * type: "tab-created",
13112
- * uuid: "OpenFin POC"
13113
- * }
13114
- * ```
13115
- *
13116
- * #### container-created
13117
- * Generated when a container is created. A single view will have only one container during its lifetime attached to a single window and the container's lifecycle is tied to the view. To discover when the container is destroyed, please listen to view-detached event.
13118
- * ```js
13119
- * // The response has the following shape in event.detail:
13120
- * {
13121
- * containerSelector: "container-component_A",
13122
- * name: "component_A",
13123
- * tabSelector: "tab-component_A",
13124
- * topic: "openfin-DOM-event",
13125
- * type: "container-created",
13126
- * uuid: "OpenFin POC"
13127
- * }
13128
- * ```
13129
- *
13130
- * ### layout-state-changed
13131
- * Generated when the state of the layout changes in any way, such as a view added/removed/replaced. Note that this event can fire frequently as the underlying layout can change multiple components from all kinds of changes (resizing for example). Given this, it is recommended to debounce this event and then you can use the {@link Layout#getConfig Layout.getConfig} API to retrieve the most up-to-date state.
13132
- * ```js
13133
- * // The response has the following shape in event.detail
13134
- * {
13135
- * containerSelector: "container-component_A",
13136
- * name: "component_A",
13137
- * tabSelector: "tab-component_A",
13138
- * topic: "openfin-DOM-event",
13139
- * type: "layout-state-changed",
13140
- * uuid: "OpenFin POC"
13141
- * }
13142
- * ```
13143
- *
13144
- * #### tab-closed
13145
- * Generated when a tab is closed.
13146
- * ```js
13147
- * // The response has the following shape in event.detail:
13148
- * {
13149
- * containerSelector: "container-component_A",
13150
- * name: "component_A",
13151
- * tabSelector: "tab-component_A",
13152
- * topic: "openfin-DOM-event",
13153
- * type: "tab-closed",
13154
- * uuid: "OpenFin POC",
13155
- * url: "http://openfin.co" // The url of the view that was closed.
13156
- * }
13157
- * ```
13193
+ * @packageDocumentation
13158
13194
  *
13159
- * #### tab-dropped
13160
- * Generated when a tab is dropped.
13161
- * ```js
13162
- * // The response has the following shape in event.detail:
13163
- * {
13164
- * containerSelector: "container-component_A",
13165
- * name: "component_A",
13166
- * tabSelector: "tab-component_A",
13167
- * topic: "openfin-DOM-event",
13168
- * type: "tab-dropped",
13169
- * uuid: "OpenFin POC",
13170
- * url: "http://openfin.co" // The url of the view linked to the dropped tab.
13171
- * }
13172
- * ```
13173
13195
  */
13174
13196
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13175
13197
  if (k2 === undefined) k2 = k;
@@ -13187,7 +13209,7 @@ _LayoutModule_layoutInitializationAttempted = new WeakMap();
13187
13209
  };
13188
13210
  Object.defineProperty(exports, "__esModule", { value: true });
13189
13211
  __exportStar(Factory$2, exports);
13190
- __exportStar(Instance$1, exports);
13212
+ __exportStar(Instance$1, exports);
13191
13213
  } (layout));
13192
13214
 
13193
13215
  Object.defineProperty(Factory$3, "__esModule", { value: true });
@@ -13195,6 +13217,9 @@ Factory$3.PlatformModule = void 0;
13195
13217
  const base_1$4 = base;
13196
13218
  const Instance_1$1 = Instance$2;
13197
13219
  const index_1$1 = layout;
13220
+ /**
13221
+ * Static namespace for OpenFin API methods that interact with the {@link Platform} class, available under `fin.Platform`.
13222
+ */
13198
13223
  class PlatformModule extends base_1$4.Base {
13199
13224
  /**
13200
13225
  * @internal
@@ -13438,18 +13463,18 @@ Factory$3.PlatformModule = PlatformModule;
13438
13463
  };
13439
13464
  Object.defineProperty(exports, "__esModule", { value: true });
13440
13465
  /**
13441
- * Entry points for the OpenFin `Platform` API.
13466
+ * Entry points for the OpenFin `Platform` API (`fin.Platform`)
13442
13467
  *
13443
- * In the previous version of the API documentation, both static methods involving `Platform` and instance properties of the
13444
- * `Platform` type itself were documented on the same page. These are separate code entities, and are now documented separately:
13445
- *
13446
- * * {@link PlatformModule} contains static methods relating to the `Platform` type, accessible through `fin.Platform`.
13468
+ * * {@link PlatformModule} contains static members of the `Platform` API, accessible through `fin.Platform`.
13447
13469
  * * {@link Platform} describes an instance of an OpenFin Platform, e.g. as returned by `fin.Platform.getCurrent`.
13448
13470
  *
13471
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
13472
+ * both of these were documented on the same page.
13473
+ *
13449
13474
  * @packageDocumentation
13450
13475
  */
13451
13476
  __exportStar(Factory$3, exports);
13452
- __exportStar(Instance$2, exports);
13477
+ __exportStar(Instance$2, exports);
13453
13478
  } (platform));
13454
13479
 
13455
13480
  var me = {};
@@ -13587,7 +13612,7 @@ var me = {};
13587
13612
  };
13588
13613
  }
13589
13614
  }
13590
- exports.getMe = getMe;
13615
+ exports.getMe = getMe;
13591
13616
  } (me));
13592
13617
 
13593
13618
  var interop = {};
@@ -13690,9 +13715,8 @@ function requireSessionContextGroupBroker () {
13690
13715
  this.lastContext = context;
13691
13716
  const clientSubscriptionStates = Array.from(this.clients.values());
13692
13717
  clientSubscriptionStates.forEach((client) => {
13693
- var _a;
13694
13718
  // eslint-disable-next-line no-unused-expressions
13695
- (_a = client.contextHandlers.get(context.type)) === null || _a === void 0 ? void 0 : _a.forEach((handlerId) => {
13719
+ client.contextHandlers.get(context.type)?.forEach((handlerId) => {
13696
13720
  this.provider.dispatch(client.clientIdentity, handlerId, context);
13697
13721
  });
13698
13722
  if (client.globalHandler) {
@@ -13826,7 +13850,7 @@ var utils$1 = {};
13826
13850
  }
13827
13851
  };
13828
13852
  };
13829
- exports.wrapIntentHandler = wrapIntentHandler;
13853
+ exports.wrapIntentHandler = wrapIntentHandler;
13830
13854
  } (utils$1));
13831
13855
 
13832
13856
  var PrivateChannelProvider = {};
@@ -14299,10 +14323,10 @@ function requireInteropBroker () {
14299
14323
  this.getProvider = getProvider;
14300
14324
  this.interopClients = new Map();
14301
14325
  this.contextGroupsById = new Map();
14302
- if (options === null || options === void 0 ? void 0 : options.contextGroups) {
14326
+ if (options?.contextGroups) {
14303
14327
  contextGroups = options.contextGroups;
14304
14328
  }
14305
- if (options === null || options === void 0 ? void 0 : options.logging) {
14329
+ if (options?.logging) {
14306
14330
  this.logging = options.logging;
14307
14331
  }
14308
14332
  this.intentClientMap = new Map();
@@ -14437,18 +14461,17 @@ function requireInteropBroker () {
14437
14461
  *
14438
14462
  */
14439
14463
  getCurrentContext(getCurrentContextOptions, clientIdentity) {
14440
- var _a;
14441
14464
  this.wire.sendAction('interop-broker-get-current-context').catch((e) => {
14442
14465
  // don't expose, analytics-only call
14443
14466
  });
14444
14467
  const clientState = this.getClientState(clientIdentity);
14445
- if (!(clientState === null || clientState === void 0 ? void 0 : clientState.contextGroupId)) {
14468
+ if (!clientState?.contextGroupId) {
14446
14469
  throw new Error('You must be a member of a context group to call getCurrentContext');
14447
14470
  }
14448
14471
  const { contextGroupId } = clientState;
14449
14472
  const contextGroupState = this.contextGroupsById.get(contextGroupId);
14450
14473
  const lastContextType = this.lastContextMap.get(contextGroupId);
14451
- const contextType = (_a = getCurrentContextOptions === null || getCurrentContextOptions === void 0 ? void 0 : getCurrentContextOptions.contextType) !== null && _a !== void 0 ? _a : lastContextType;
14474
+ const contextType = getCurrentContextOptions?.contextType ?? lastContextType;
14452
14475
  return contextGroupState && contextType ? contextGroupState.get(contextType) : undefined;
14453
14476
  }
14454
14477
  /*
@@ -14696,7 +14719,8 @@ function requireInteropBroker () {
14696
14719
  * ```
14697
14720
  */
14698
14721
  // eslint-disable-next-line class-methods-use-this
14699
- async handleFiredIntent(intent, clientIdentity) {
14722
+ async handleFiredIntent(intent, clientIdentity // TODO(CORE-811): remove inline intersected type
14723
+ ) {
14700
14724
  const warning = (0, utils_1.generateOverrideWarning)('fdc3.raiseIntent', 'InteropBroker.handleFiredIntent', clientIdentity, 'interopClient.fireIntent');
14701
14725
  console.warn(warning);
14702
14726
  throw new Error(utils_1.BROKER_ERRORS.fireIntent);
@@ -14763,7 +14787,7 @@ function requireInteropBroker () {
14763
14787
  * More information on the AppIntent type can be found in the [FDC3 documentation](https://fdc3.finos.org/docs/api/ref/AppIntent).
14764
14788
  *
14765
14789
  * @param options
14766
- * @param clientIdentity Identity of the Client making the request.
14790
+ * @param clientIdentity Identity of the Client making the request.
14767
14791
  *
14768
14792
  * @example
14769
14793
  * ```js
@@ -14780,7 +14804,8 @@ function requireInteropBroker () {
14780
14804
  * ```
14781
14805
  */
14782
14806
  // eslint-disable-next-line class-methods-use-this
14783
- async handleInfoForIntent(options, clientIdentity) {
14807
+ async handleInfoForIntent(options, clientIdentity // TODO(CORE-811): remove inline intersected type
14808
+ ) {
14784
14809
  const warning = (0, utils_1.generateOverrideWarning)('fdc3.findIntent', 'InteropBroker.handleInfoForIntent', clientIdentity, 'interopClient.getInfoForIntent');
14785
14810
  console.warn(warning);
14786
14811
  throw new Error(utils_1.BROKER_ERRORS.getInfoForIntent);
@@ -14826,7 +14851,8 @@ function requireInteropBroker () {
14826
14851
  * ```
14827
14852
  */
14828
14853
  // eslint-disable-next-line class-methods-use-this
14829
- async handleInfoForIntentsByContext(context, clientIdentity) {
14854
+ async handleInfoForIntentsByContext(context, clientIdentity // TODO(CORE-811): remove inline intersected type
14855
+ ) {
14830
14856
  const warning = (0, utils_1.generateOverrideWarning)('fdc3.findIntentsByContext', 'InteropBroker.handleInfoForIntentsByContext', clientIdentity, 'interopClient.getInfoForIntentsByContext');
14831
14857
  console.warn(warning);
14832
14858
  throw new Error(utils_1.BROKER_ERRORS.getInfoForIntentsByContext);
@@ -14852,7 +14878,7 @@ function requireInteropBroker () {
14852
14878
  * More information on the IntentResolution type can be found in the [FDC3 documentation](https://fdc3.finos.org/docs/api/ref/IntentResolution).
14853
14879
  *
14854
14880
  * @param contextForIntent Data passed between entities and applications.
14855
- * @param clientIdentity Identity of the Client making the request.
14881
+ * @param clientIdentity Identity of the Client making the request.
14856
14882
  *
14857
14883
  * @example
14858
14884
  * ```js
@@ -14913,7 +14939,7 @@ function requireInteropBroker () {
14913
14939
  /**
14914
14940
  * Responsible for resolving the fdc3.findInstances call.
14915
14941
  * Must be overridden
14916
- * @param app AppIdentifier that was passed to fdc3.findInstances
14942
+ * @param app AppIdentifier that was passed to fdc3.findInstances
14917
14943
  * @param clientIdentity Identity of the Client making the request.
14918
14944
  */
14919
14945
  // eslint-disable-next-line class-methods-use-this
@@ -14948,7 +14974,7 @@ function requireInteropBroker () {
14948
14974
  * fin.Platform.init({
14949
14975
  * interopOverride: async (InteropBroker) => {
14950
14976
  * class Override extends InteropBroker {
14951
- * async invokeContextHandler(options, clientIdentity) {
14977
+ * async invokeContextHandler(clientIdentity, handlerId, context) {
14952
14978
  * return super.invokeContextHandler(clientIdentity, handlerId, {
14953
14979
  * ...context,
14954
14980
  * contextMetadata: {
@@ -14988,7 +15014,7 @@ function requireInteropBroker () {
14988
15014
  * fin.Platform.init({
14989
15015
  * interopOverride: async (InteropBroker) => {
14990
15016
  * class Override extends InteropBroker {
14991
- * async invokeIntentHandler(options, clientIdentity) {
15017
+ * async invokeIntentHandler(clientIdentity, handlerId, context) {
14992
15018
  * const { context } = intent;
14993
15019
  * return super.invokeIntentHandler(clientIdentity, handlerId, {
14994
15020
  * ...intent,
@@ -15096,10 +15122,9 @@ function requireInteropBroker () {
15096
15122
  }
15097
15123
  // Used to restore interop broker state in snapshots.
15098
15124
  applySnapshot(snapshot, options) {
15099
- var _a;
15100
- const contextGroupStates = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.interopSnapshotDetails) === null || _a === void 0 ? void 0 : _a.contextGroupStates;
15125
+ const contextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
15101
15126
  if (contextGroupStates) {
15102
- if (!(options === null || options === void 0 ? void 0 : options.closeExistingWindows)) {
15127
+ if (!options?.closeExistingWindows) {
15103
15128
  this.updateExistingClients(contextGroupStates);
15104
15129
  }
15105
15130
  this.rehydrateContextGroupStates(contextGroupStates);
@@ -15150,7 +15175,7 @@ function requireInteropBroker () {
15150
15175
  contextHandlerRegistered({ contextType, handlerId }, clientIdentity) {
15151
15176
  const handlerInfo = { contextType, handlerId };
15152
15177
  const clientState = this.getClientState(clientIdentity);
15153
- clientState === null || clientState === void 0 ? void 0 : clientState.contextHandlers.set(handlerId, handlerInfo);
15178
+ clientState?.contextHandlers.set(handlerId, handlerInfo);
15154
15179
  if (clientState && clientState.contextGroupId) {
15155
15180
  const { contextGroupId } = clientState;
15156
15181
  const contextGroupMap = this.contextGroupsById.get(contextGroupId);
@@ -15172,7 +15197,7 @@ function requireInteropBroker () {
15172
15197
  async intentHandlerRegistered(payload, clientIdentity) {
15173
15198
  const { handlerId } = payload;
15174
15199
  const clientIntentInfo = this.intentClientMap.get(clientIdentity.name);
15175
- const handlerInfo = clientIntentInfo === null || clientIntentInfo === void 0 ? void 0 : clientIntentInfo.get(handlerId);
15200
+ const handlerInfo = clientIntentInfo?.get(handlerId);
15176
15201
  if (!clientIntentInfo) {
15177
15202
  this.intentClientMap.set(clientIdentity.name, new Map());
15178
15203
  const newHandlerInfoMap = this.intentClientMap.get(clientIdentity.name);
@@ -15327,7 +15352,8 @@ function requireInteropBroker () {
15327
15352
  }
15328
15353
  // Setup Channel Connection Logic
15329
15354
  wireChannel(channel) {
15330
- channel.onConnection(async (clientIdentity, payload) => {
15355
+ channel.onConnection(async (clientIdentity, // TODO(CORE-811): remove inline intersected type
15356
+ payload) => {
15331
15357
  if (!(await this.isConnectionAuthorized(clientIdentity, payload))) {
15332
15358
  throw new Error(`Connection not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
15333
15359
  }
@@ -15340,8 +15366,8 @@ function requireInteropBroker () {
15340
15366
  clientIdentity
15341
15367
  };
15342
15368
  // Only allow the client to join a contextGroup that actually exists.
15343
- if ((payload === null || payload === void 0 ? void 0 : payload.currentContextGroup) && this.contextGroupsById.has(payload.currentContextGroup)) {
15344
- clientSubscriptionState.contextGroupId = payload === null || payload === void 0 ? void 0 : payload.currentContextGroup;
15369
+ if (payload?.currentContextGroup && this.contextGroupsById.has(payload.currentContextGroup)) {
15370
+ clientSubscriptionState.contextGroupId = payload?.currentContextGroup;
15345
15371
  }
15346
15372
  this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
15347
15373
  });
@@ -15359,17 +15385,15 @@ function requireInteropBroker () {
15359
15385
  this.clientDisconnected(clientIdentity);
15360
15386
  });
15361
15387
  channel.beforeAction(async (action, payload, clientIdentity) => {
15362
- var _a, _b;
15363
15388
  if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
15364
15389
  throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
15365
15390
  }
15366
- if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.beforeAction) === null || _b === void 0 ? void 0 : _b.enabled) {
15391
+ if (this.logging?.beforeAction?.enabled) {
15367
15392
  console.log(action, payload, clientIdentity);
15368
15393
  }
15369
15394
  });
15370
15395
  channel.afterAction((action, payload, clientIdentity) => {
15371
- var _a, _b;
15372
- if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.afterAction) === null || _b === void 0 ? void 0 : _b.enabled) {
15396
+ if (this.logging?.afterAction?.enabled) {
15373
15397
  console.log(action, payload, clientIdentity);
15374
15398
  }
15375
15399
  });
@@ -16207,39 +16231,45 @@ class InteropClient extends base_1$2.Base {
16207
16231
  InteropClient$1.InteropClient = InteropClient;
16208
16232
  _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap();
16209
16233
 
16210
- var overrideCheck$1 = {};
16234
+ var overrideCheck = {};
16211
16235
 
16212
- Object.defineProperty(overrideCheck$1, "__esModule", { value: true });
16213
- overrideCheck$1.overrideCheck = overrideCheck$1.getDefaultViewFdc3VersionFromAppInfo = void 0;
16214
- const InteropBroker_1 = requireInteropBroker();
16215
- function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
16216
- var _a, _b, _c, _d;
16217
- const setVersion = (_c = (_b = (_a = manifest.platform) === null || _a === void 0 ? void 0 : _a.defaultViewOptions) === null || _b === void 0 ? void 0 : _b.fdc3InteropApi) !== null && _c !== void 0 ? _c : (_d = initialOptions.defaultViewOptions) === null || _d === void 0 ? void 0 : _d.fdc3InteropApi;
16218
- return ['1.2', '2.0'].includes(setVersion !== null && setVersion !== void 0 ? setVersion : '') ? setVersion : undefined;
16219
- }
16220
- overrideCheck$1.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
16221
- // TODO: Unit test this
16222
- function overrideCheck(overriddenBroker, fdc3InteropApi) {
16223
- if (fdc3InteropApi && fdc3InteropApi === '2.0') {
16224
- const mustOverrideAPIs = [
16225
- 'fdc3HandleFindInstances',
16226
- 'handleInfoForIntent',
16227
- 'handleInfoForIntentsByContext',
16228
- 'fdc3HandleGetAppMetadata',
16229
- 'fdc3HandleGetInfo',
16230
- 'fdc3HandleOpen',
16231
- 'handleFiredIntent',
16232
- 'handleFiredIntentForContext'
16233
- ];
16234
- const notOverridden = mustOverrideAPIs.filter((api) => {
16235
- return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
16236
- });
16237
- if (notOverridden.length > 0) {
16238
- console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
16239
- }
16240
- }
16236
+ var hasRequiredOverrideCheck;
16237
+
16238
+ function requireOverrideCheck () {
16239
+ if (hasRequiredOverrideCheck) return overrideCheck;
16240
+ hasRequiredOverrideCheck = 1;
16241
+ Object.defineProperty(overrideCheck, "__esModule", { value: true });
16242
+ overrideCheck.overrideCheck = overrideCheck.getDefaultViewFdc3VersionFromAppInfo = void 0;
16243
+ const InteropBroker_1 = requireInteropBroker();
16244
+ function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
16245
+ const setVersion = manifest.platform?.defaultViewOptions?.fdc3InteropApi ?? initialOptions.defaultViewOptions?.fdc3InteropApi;
16246
+ return ['1.2', '2.0'].includes(setVersion ?? '') ? setVersion : undefined;
16247
+ }
16248
+ overrideCheck.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
16249
+ // TODO: Unit test this
16250
+ function overrideCheck$1(overriddenBroker, fdc3InteropApi) {
16251
+ if (fdc3InteropApi && fdc3InteropApi === '2.0') {
16252
+ const mustOverrideAPIs = [
16253
+ 'fdc3HandleFindInstances',
16254
+ 'handleInfoForIntent',
16255
+ 'handleInfoForIntentsByContext',
16256
+ 'fdc3HandleGetAppMetadata',
16257
+ 'fdc3HandleGetInfo',
16258
+ 'fdc3HandleOpen',
16259
+ 'handleFiredIntent',
16260
+ 'handleFiredIntentForContext'
16261
+ ];
16262
+ const notOverridden = mustOverrideAPIs.filter((api) => {
16263
+ return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
16264
+ });
16265
+ if (notOverridden.length > 0) {
16266
+ console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
16267
+ }
16268
+ }
16269
+ }
16270
+ overrideCheck.overrideCheck = overrideCheck$1;
16271
+ return overrideCheck;
16241
16272
  }
16242
- overrideCheck$1.overrideCheck = overrideCheck;
16243
16273
 
16244
16274
  var hasRequiredFactory;
16245
16275
 
@@ -16253,7 +16283,7 @@ function requireFactory () {
16253
16283
  const base_1 = base;
16254
16284
  const InteropBroker_1 = requireInteropBroker();
16255
16285
  const InteropClient_1 = InteropClient$1;
16256
- const overrideCheck_1 = overrideCheck$1;
16286
+ const overrideCheck_1 = requireOverrideCheck();
16257
16287
  const common_utils_1 = commonUtils;
16258
16288
  const defaultOverride = (Class) => new Class();
16259
16289
  const BrokerParamAccessError = 'You have attempted to use or modify InteropBroker parameters, which is not allowed. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.';
@@ -16286,13 +16316,12 @@ function requireFactory () {
16286
16316
  * ```
16287
16317
  */
16288
16318
  async init(name, override = defaultOverride) {
16289
- var _a;
16290
16319
  this.wire.sendAction('interop-init').catch(() => {
16291
16320
  // don't expose, analytics-only call
16292
16321
  });
16293
16322
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
16294
16323
  const options = await this.fin.Application.getCurrentSync().getInfo();
16295
- const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
16324
+ const opts = options.initialOptions.interopBrokerConfiguration ?? {};
16296
16325
  const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
16297
16326
  const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
16298
16327
  let provider;
@@ -16360,9 +16389,9 @@ function requireInterop () {
16360
16389
  hasRequiredInterop = 1;
16361
16390
  (function (exports) {
16362
16391
  /**
16363
- * Entry point for the OpenFin Interop namespace.
16392
+ * Entry point for the OpenFin `Interop` API (`fin.Interop`).
16364
16393
  *
16365
- * * {@link InteropModule} contains static members of the `Interop` namespace (available under `fin.Interop`)
16394
+ * * {@link InteropModule} contains static members of the `Interop` API (available under `fin.Interop`)
16366
16395
  * * {@link InteropClient} and {@link InteropBroker} document instances of their respective classes.
16367
16396
  *
16368
16397
  * @packageDocumentation
@@ -16384,8 +16413,8 @@ function requireInterop () {
16384
16413
  Object.defineProperty(exports, "__esModule", { value: true });
16385
16414
  __exportStar(requireFactory(), exports);
16386
16415
  __exportStar(InteropClient$1, exports);
16387
- __exportStar(requireInteropBroker(), exports);
16388
- } (interop));
16416
+ __exportStar(requireInteropBroker(), exports);
16417
+ } (interop));
16389
16418
  return interop;
16390
16419
  }
16391
16420
 
@@ -16424,6 +16453,8 @@ const connectionMap = new Map();
16424
16453
  /**
16425
16454
  * Enables configuring a SnapshotSource with custom getSnapshot and applySnapshot methods.
16426
16455
  *
16456
+ * @typeParam Snapshot Implementation-defined shape of an application snapshot. Allows
16457
+ * custom snapshot implementations for legacy applications to define their own snapshot format.
16427
16458
  */
16428
16459
  class SnapshotSource extends base_1$1.Base {
16429
16460
  /**
@@ -16562,10 +16593,16 @@ Factory.SnapshotSourceModule = void 0;
16562
16593
  const base_1 = base;
16563
16594
  const Instance_1 = Instance;
16564
16595
  const utils_1 = utils;
16596
+ /**
16597
+ * Static namespace for OpenFin API methods that interact with the {@link SnapshotSource} class, available under `fin.SnapshotSource`.
16598
+ */
16565
16599
  class SnapshotSourceModule extends base_1.Base {
16566
16600
  /**
16567
16601
  * Initializes a SnapshotSource with the getSnapshot and applySnapshot methods defined.
16568
16602
  *
16603
+ * @typeParam Snapshot Implementation-defined shape of an application snapshot. Allows
16604
+ * custom snapshot implementations for legacy applications to define their own snapshot format.
16605
+ *
16569
16606
  * @example
16570
16607
  * ```js
16571
16608
  * const snapshotProvider = {
@@ -16581,6 +16618,7 @@ class SnapshotSourceModule extends base_1.Base {
16581
16618
  *
16582
16619
  * await fin.SnapshotSource.init(snapshotProvider);
16583
16620
  * ```
16621
+ *
16584
16622
  */
16585
16623
  async init(provider) {
16586
16624
  this.wire.sendAction('snapshot-source-init').catch((e) => {
@@ -16635,13 +16673,13 @@ Factory.SnapshotSourceModule = SnapshotSourceModule;
16635
16673
 
16636
16674
  (function (exports) {
16637
16675
  /**
16638
- * Entry points for the OpenFin `SnapshotSource` API.
16676
+ * Entry points for the OpenFin `SnapshotSource` API (`fin.SnapshotSource`).
16639
16677
  *
16640
- * In the previous version of the API documentation, both static methods involving `SnapshotSource` and instance properties of the
16641
- * `SnapshotSource` type itself were documented on the same page. These are separate code entities, and are now documented separately:
16678
+ * * {@link SnapshotSourceModule} contains static members of the `SnapshotSource` API, accessible through `fin.SnapshotSource`.
16679
+ * * {@link SnapshotSource} describes an instance of an OpenFin SnapshotSource, e.g. as returned by `fin.SnapshotSource.wrap`.
16642
16680
  *
16643
- * * {@link SnapshotSourceModule} contains static methods relating to the `SnapshotSource` type, accessible through `fin.SnapshotSource`.
16644
- * * {@link SnapshotSource} describes an instance of an OpenFin SnapshotSource, e.g. as returned by `fin.SnapshotSource.getCurrent`.
16681
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/canary/index.html),
16682
+ * both of these were documented on the same page.
16645
16683
  *
16646
16684
  * @packageDocumentation
16647
16685
  */
@@ -16661,12 +16699,12 @@ Factory.SnapshotSourceModule = SnapshotSourceModule;
16661
16699
  };
16662
16700
  Object.defineProperty(exports, "__esModule", { value: true });
16663
16701
  __exportStar(Factory, exports);
16664
- __exportStar(Instance, exports);
16702
+ __exportStar(Instance, exports);
16665
16703
  } (snapshotSource));
16666
16704
 
16667
16705
  Object.defineProperty(fin, "__esModule", { value: true });
16668
16706
  fin.Fin = void 0;
16669
- const events_1$3 = eventsExports;
16707
+ const events_1$3 = require$$0;
16670
16708
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
16671
16709
  const index_1 = system;
16672
16710
  const index_2 = requireWindow();
@@ -16681,6 +16719,9 @@ const index_10 = platform;
16681
16719
  const me_1$2 = me;
16682
16720
  const interop_1 = requireInterop();
16683
16721
  const snapshot_source_1 = snapshotSource;
16722
+ /**
16723
+ * @internal
16724
+ */
16684
16725
  class Fin extends events_1$3.EventEmitter {
16685
16726
  /**
16686
16727
  * @internal
@@ -16756,7 +16797,7 @@ var emitterMap = {};
16756
16797
 
16757
16798
  Object.defineProperty(emitterMap, "__esModule", { value: true });
16758
16799
  emitterMap.EmitterMap = void 0;
16759
- const events_1$2 = eventsExports;
16800
+ const events_1$2 = require$$0;
16760
16801
  class EmitterMap {
16761
16802
  constructor() {
16762
16803
  this.storage = new Map();
@@ -16838,7 +16879,7 @@ var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFie
16838
16879
  var _Transport_wire, _Transport_fin;
16839
16880
  Object.defineProperty(transport, "__esModule", { value: true });
16840
16881
  transport.Transport = void 0;
16841
- const events_1$1 = eventsExports;
16882
+ const events_1$1 = require$$0;
16842
16883
  const wire_1 = wire;
16843
16884
  const transport_errors_1 = transportErrors;
16844
16885
  const eventAggregator_1 = eventAggregator;
@@ -17110,7 +17151,7 @@ var mockWire = {};
17110
17151
 
17111
17152
  Object.defineProperty(mockWire, "__esModule", { value: true });
17112
17153
  mockWire.MockWire = void 0;
17113
- const events_1 = eventsExports;
17154
+ const events_1 = require$$0;
17114
17155
  class MockWire extends events_1.EventEmitter {
17115
17156
  connect(address) {
17116
17157
  throw new Error('You are not running in OpenFin.');
@@ -17141,7 +17182,7 @@ const fin_1 = fin;
17141
17182
  const transport_1 = transport;
17142
17183
  const mockEnvironment_1 = mockEnvironment;
17143
17184
  const mockWire_1 = mockWire;
17144
- exports.fin = mock.fin = ((typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.fin)) ||
17185
+ exports.fin = mock.fin = ((typeof window !== 'undefined' && window?.fin) ||
17145
17186
  (() => {
17146
17187
  const environment = new mockEnvironment_1.MockEnvironment();
17147
17188
  const transport = new transport_1.Transport(mockWire_1.MockWire, environment, {