@openfin/core 39.83.2 → 39.83.4

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
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var require$$0 = require('events');
6
- var require$$3 = require('lodash');
6
+ var require$$0$1 = require('lodash/cloneDeep');
7
+ var require$$3 = require('lodash/isEqual');
7
8
 
8
9
  function _mergeNamespaces(n, m) {
9
10
  m.forEach(function (e) {
@@ -241,27 +242,50 @@ Object.defineProperty(window$2, "__esModule", { value: true });
241
242
  *
242
243
  * @packageDocumentation
243
244
  */
245
+ var __createBinding$1 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
246
+ if (k2 === undefined) k2 = k;
247
+ var desc = Object.getOwnPropertyDescriptor(m, k);
248
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
249
+ desc = { enumerable: true, get: function() { return m[k]; } };
250
+ }
251
+ Object.defineProperty(o, k2, desc);
252
+ }) : (function(o, m, k, k2) {
253
+ if (k2 === undefined) k2 = k;
254
+ o[k2] = m[k];
255
+ }));
256
+ var __setModuleDefault$1 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
257
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
258
+ }) : function(o, v) {
259
+ o["default"] = v;
260
+ });
261
+ var __importStar$1 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
262
+ if (mod && mod.__esModule) return mod;
263
+ var result = {};
264
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k);
265
+ __setModuleDefault$1(result, mod);
266
+ return result;
267
+ };
244
268
  Object.defineProperty(events, "__esModule", { value: true });
245
269
  events.WindowEvents = events.WebContentsEvents = events.ViewEvents = events.SystemEvents = events.PlatformEvents = events.GlobalHotkeyEvents = events.FrameEvents = events.ExternalApplicationEvents = events.BaseEvents = events.ApplicationEvents = void 0;
246
- const ApplicationEvents = application$1;
270
+ const ApplicationEvents = __importStar$1(application$1);
247
271
  events.ApplicationEvents = ApplicationEvents;
248
- const BaseEvents = base$1;
272
+ const BaseEvents = __importStar$1(base$1);
249
273
  events.BaseEvents = BaseEvents;
250
- const ExternalApplicationEvents = externalApplication$1;
274
+ const ExternalApplicationEvents = __importStar$1(externalApplication$1);
251
275
  events.ExternalApplicationEvents = ExternalApplicationEvents;
252
- const FrameEvents = frame$1;
276
+ const FrameEvents = __importStar$1(frame$1);
253
277
  events.FrameEvents = FrameEvents;
254
- const GlobalHotkeyEvents = globalHotkey$1;
278
+ const GlobalHotkeyEvents = __importStar$1(globalHotkey$1);
255
279
  events.GlobalHotkeyEvents = GlobalHotkeyEvents;
256
- const PlatformEvents = platform$1;
280
+ const PlatformEvents = __importStar$1(platform$1);
257
281
  events.PlatformEvents = PlatformEvents;
258
- const SystemEvents = system$1;
282
+ const SystemEvents = __importStar$1(system$1);
259
283
  events.SystemEvents = SystemEvents;
260
- const ViewEvents = view$1;
284
+ const ViewEvents = __importStar$1(view$1);
261
285
  events.ViewEvents = ViewEvents;
262
- const WebContentsEvents = webcontents;
286
+ const WebContentsEvents = __importStar$1(webcontents);
263
287
  events.WebContentsEvents = WebContentsEvents;
264
- const WindowEvents = window$2;
288
+ const WindowEvents = __importStar$1(window$2);
265
289
  events.WindowEvents = WindowEvents;
266
290
 
267
291
  (function (exports) {
@@ -793,7 +817,9 @@ function requireFactory$3 () {
793
817
  * @experimental
794
818
  */
795
819
  async wrap(identity) {
796
- this.wire.sendAction('view-wrap');
820
+ this.wire.sendAction('view-wrap').catch((e) => {
821
+ // we do not want to expose this error, just continue if this analytics-only call fails
822
+ });
797
823
  const errorMsg = (0, validate_1.validateIdentity)(identity);
798
824
  if (errorMsg) {
799
825
  throw new Error(errorMsg);
@@ -930,902 +956,238 @@ class AsyncRetryableLazy {
930
956
  }
931
957
  lazy.AsyncRetryableLazy = AsyncRetryableLazy;
932
958
 
933
- var layoutEntities = {};
934
-
935
- var apiExposer$1 = {};
936
-
937
- var apiConsumer = {};
938
-
939
- Object.defineProperty(apiConsumer, "__esModule", { value: true });
940
- apiConsumer.ApiConsumer = void 0;
941
- /**
942
- * Consumer for apis exposed with {@see ApiExposer}.
943
- *
944
- * A strategy that matches the strategy used to expose a target API must be provided.
945
- */
946
- class ApiConsumer {
947
- // eslint-disable-next-line
948
- constructor(strategy) {
949
- this.strategy = strategy;
950
- /**
951
- * Consumes an api exposed using a given transport strategy, and generates a client
952
- * for easy, type safe consumption of that client.
953
- * @param options Strategy specific consumption options.
954
- * @returns An api client matching the given type.
955
- */
956
- this.consume = async (options) => {
957
- const exposedProperties = await this.strategy.getExposedFunctions(options);
958
- return exposedProperties.reduce((client, prop) => ({
959
- ...client,
960
- [prop.key]: this.strategy.createFunction(prop, options)
961
- }), {});
962
- };
963
- }
964
- }
965
- apiConsumer.ApiConsumer = ApiConsumer;
966
-
967
- var apiExposer = {};
968
-
969
- var decorators = {};
970
-
971
- Object.defineProperty(decorators, "__esModule", { value: true });
972
- decorators.expose = decorators.getExposedProperties = void 0;
973
- const exposedProperties = Symbol('exposedProperties');
974
- const getExposedProperties = (target) => {
975
- return target[exposedProperties] || target.prototype[exposedProperties] || [];
976
- };
977
- decorators.getExposedProperties = getExposedProperties;
978
- /**
979
- * Indicates that a class member function can be exposed using {@link ApiExposer}.
980
- * @param options Options specific to the strategy used in {@link ApiExposer}
981
- */
982
- // Returns any as decorator typing is weird.
983
- const expose = (options) => (target, key, descriptor) => {
984
- target[exposedProperties] = target[exposedProperties] || [];
985
- target[exposedProperties].push({ key, descriptor, options });
986
- };
987
- decorators.expose = expose;
959
+ var main = {};
988
960
 
989
- Object.defineProperty(apiExposer, "__esModule", { value: true });
990
- apiExposer.ApiExposer = void 0;
991
- const decorators_1 = decorators;
992
- /**
993
- * Exposes api services on the transport of choice.
994
- */
995
- class ApiExposer {
961
+ Object.defineProperty(main, "__esModule", { value: true });
962
+ main.WebContents = void 0;
963
+ const base_1$j = base;
964
+ class WebContents extends base_1$j.EmitterBase {
996
965
  /**
997
- * @param strategy The expose strategy to use to expose instances.
966
+ * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
967
+ * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
998
968
  */
999
- // eslint-disable-next-line
1000
- constructor(strategy) {
1001
- this.strategy = strategy;
1002
- /**
1003
- * Exposes an instance of a given api on
1004
- * @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
1005
- * @param instanceOptions Transport strategy specific options to use when exposing.
1006
- */
1007
- this.exposeInstance = async (instance, instanceOptions) => {
1008
- const exposableProps = (0, decorators_1.getExposedProperties)(instance);
1009
- const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
1010
- const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
1011
- key,
1012
- options,
1013
- meta: instanceOptions
1014
- });
1015
- return {
1016
- key,
1017
- options: customConsumptionOptions
1018
- };
1019
- }));
1020
- await this.strategy.exposeMeta(instanceOptions, exposedProps);
1021
- };
969
+ constructor(wire, identity, entityType) {
970
+ super(wire, entityType, identity.uuid, identity.name);
971
+ this.identity = identity;
972
+ this.entityType = entityType;
1022
973
  }
1023
- ;
1024
- }
1025
- apiExposer.ApiExposer = ApiExposer;
1026
-
1027
- var strategies = {};
1028
-
1029
- var openfinChannels = {};
1030
-
1031
- var channelsConsumer = {};
1032
-
1033
- Object.defineProperty(channelsConsumer, "__esModule", { value: true });
1034
- channelsConsumer.ChannelsConsumer = void 0;
1035
- class ChannelsConsumer {
1036
- // eslint-disable-next-line
1037
- constructor(channel) {
1038
- this.channel = channel;
1039
- this.getExposedFunctions = async (options) => {
1040
- const { id } = options;
1041
- const { props } = await this.channel.dispatch(`api-meta:${id}`);
1042
- return props;
1043
- };
1044
- this.createFunction = (prop) => (...args) => {
1045
- const { action } = prop.options;
1046
- return this.channel.dispatch(action, { args });
1047
- };
974
+ /**
975
+ * Gets a base64 encoded image of all or part of the WebContents.
976
+ * @param options Options for the capturePage call.
977
+ *
978
+ * @example
979
+ *
980
+ * View:
981
+ * ```js
982
+ * const view = fin.View.getCurrentSync();
983
+ *
984
+ * // PNG image of a full visible View
985
+ * console.log(await view.capturePage());
986
+ *
987
+ * // Low-quality JPEG image of a defined visible area of the view
988
+ * const options = {
989
+ * area: {
990
+ * height: 100,
991
+ * width: 100,
992
+ * x: 10,
993
+ * y: 10,
994
+ * },
995
+ * format: 'jpg',
996
+ * quality: 20
997
+ * }
998
+ * console.log(await view.capturePage(options));
999
+ * ```
1000
+ *
1001
+ * Window:
1002
+ * ```js
1003
+ * const wnd = await fin.Window.getCurrent();
1004
+ *
1005
+ * // PNG image of a full visible window
1006
+ * console.log(await wnd.capturePage());
1007
+ *
1008
+ * // Low-quality JPEG image of a defined visible area of the window
1009
+ * const options = {
1010
+ * area: {
1011
+ * height: 100,
1012
+ * width: 100,
1013
+ * x: 10,
1014
+ * y: 10,
1015
+ * },
1016
+ * format: 'jpg',
1017
+ * quality: 20
1018
+ * }
1019
+ * console.log(await wnd.capturePage(options));
1020
+ * ```
1021
+ *
1022
+ * @remarks
1023
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1024
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1025
+ * {@link OpenFin.WebContentsEvents event namespace}.
1026
+ */
1027
+ capturePage(options) {
1028
+ return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
1048
1029
  }
1049
- ;
1050
- }
1051
- channelsConsumer.ChannelsConsumer = ChannelsConsumer;
1052
-
1053
- var channelsExposer = {};
1054
-
1055
- Object.defineProperty(channelsExposer, "__esModule", { value: true });
1056
- channelsExposer.ChannelsExposer = void 0;
1057
- class ChannelsExposer {
1058
- // eslint-disable-next-line
1059
- constructor(channelProviderOrClient) {
1060
- this.channelProviderOrClient = channelProviderOrClient;
1061
- this.exposeFunction = async (target, config) => {
1062
- const { key, options, meta } = config;
1063
- const { id } = meta;
1064
- const action = `${id}.${options?.action || key}`;
1065
- await this.channelProviderOrClient.register(action, async ({ args }) => {
1066
- return target(...args);
1067
- });
1068
- return { action };
1069
- };
1070
- this.exposeMeta = async ({ id }, props) => {
1071
- const action = `api-meta:${id}`;
1072
- await this.channelProviderOrClient.register(action, () => ({ props }));
1073
- };
1030
+ /**
1031
+ * Executes Javascript on the WebContents, restricted to contents you own or contents owned by
1032
+ * applications you have created.
1033
+ * @param code JavaScript code to be executed on the view.
1034
+ *
1035
+ * @example
1036
+ * View:
1037
+ * ```js
1038
+ * async function executeJavaScript(code) {
1039
+ * const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
1040
+ * return await view.executeJavaScript(code);
1041
+ * }
1042
+ *
1043
+ * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
1044
+ * ```
1045
+ *
1046
+ * Window:
1047
+ * ```js
1048
+ * async function executeJavaScript(code) {
1049
+ * const app = await fin.Application.start({
1050
+ * name: 'myApp',
1051
+ * uuid: 'app-1',
1052
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
1053
+ * autoShow: true
1054
+ * });
1055
+ * const win = await app.getWindow();
1056
+ * return await win.executeJavaScript(code);
1057
+ * }
1058
+ *
1059
+ * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
1060
+ * ```
1061
+ * @remarks
1062
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1063
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1064
+ * {@link OpenFin.WebContentsEvents event namespace}.
1065
+ */
1066
+ executeJavaScript(code) {
1067
+ return this.wire
1068
+ .sendAction('execute-javascript-in-window', { ...this.identity, code })
1069
+ .then(({ payload }) => payload.data);
1074
1070
  }
1075
- }
1076
- channelsExposer.ChannelsExposer = ChannelsExposer;
1077
-
1078
- (function (exports) {
1079
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1080
- if (k2 === undefined) k2 = k;
1081
- var desc = Object.getOwnPropertyDescriptor(m, k);
1082
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1083
- desc = { enumerable: true, get: function() { return m[k]; } };
1084
- }
1085
- Object.defineProperty(o, k2, desc);
1086
- }) : (function(o, m, k, k2) {
1087
- if (k2 === undefined) k2 = k;
1088
- o[k2] = m[k];
1089
- }));
1090
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
1091
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1092
- };
1093
- Object.defineProperty(exports, "__esModule", { value: true });
1094
- __exportStar(channelsConsumer, exports);
1095
- __exportStar(channelsExposer, exports);
1096
- } (openfinChannels));
1097
-
1098
- (function (exports) {
1099
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1100
- if (k2 === undefined) k2 = k;
1101
- var desc = Object.getOwnPropertyDescriptor(m, k);
1102
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1103
- desc = { enumerable: true, get: function() { return m[k]; } };
1104
- }
1105
- Object.defineProperty(o, k2, desc);
1106
- }) : (function(o, m, k, k2) {
1107
- if (k2 === undefined) k2 = k;
1108
- o[k2] = m[k];
1109
- }));
1110
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
1111
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1112
- };
1113
- Object.defineProperty(exports, "__esModule", { value: true });
1114
- __exportStar(openfinChannels, exports);
1115
- } (strategies));
1116
-
1117
- (function (exports) {
1118
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1119
- if (k2 === undefined) k2 = k;
1120
- var desc = Object.getOwnPropertyDescriptor(m, k);
1121
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1122
- desc = { enumerable: true, get: function() { return m[k]; } };
1123
- }
1124
- Object.defineProperty(o, k2, desc);
1125
- }) : (function(o, m, k, k2) {
1126
- if (k2 === undefined) k2 = k;
1127
- o[k2] = m[k];
1128
- }));
1129
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
1130
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1131
- };
1132
- Object.defineProperty(exports, "__esModule", { value: true });
1133
- __exportStar(apiConsumer, exports);
1134
- __exportStar(apiExposer, exports);
1135
- __exportStar(strategies, exports);
1136
- __exportStar(decorators, exports);
1137
- } (apiExposer$1));
1138
-
1139
- var channelApiRelay = {};
1140
-
1141
- Object.defineProperty(channelApiRelay, "__esModule", { value: true });
1142
- channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
1143
- const EXPECTED_ERRORS = [
1144
- 'no longer connected',
1145
- 'RTCDataChannel closed unexpectedly',
1146
- 'The client you are trying to dispatch from is disconnected from the target provider',
1147
- ];
1148
- // Checks possible error messages that we want to trap, client error message can originate
1149
- // from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
1150
- const isDisconnectedError = (errorMsg) => {
1151
- return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
1152
- };
1153
- /**
1154
- * @internal
1155
- * Create a channel relay for a given channel exposition, allowing a single provider to route
1156
- * actions to the designated clients.
1157
- *
1158
- * Designed to be used in conjunction with @expose
1159
- *
1160
- * @param channelProvider The channel provider to relay the actions on.
1161
- * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
1162
- */
1163
- const relayChannelClientApi = async (channelProvider, relayId) => {
1164
- channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
1165
- return channelProvider.dispatch(target, action, payload);
1166
- });
1167
- await Promise.resolve();
1168
- };
1169
- channelApiRelay.relayChannelClientApi = relayChannelClientApi;
1170
- const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
1171
- try {
1172
- return await client.dispatch(`relay:${relayId}`, {
1173
- action,
1174
- payload,
1175
- target
1176
- });
1071
+ /**
1072
+ * Returns the zoom level of the WebContents.
1073
+ *
1074
+ * @example
1075
+ * View:
1076
+ * ```js
1077
+ * async function getZoomLevel() {
1078
+ * const view = await fin.View.getCurrent();
1079
+ * return await view.getZoomLevel();
1080
+ * }
1081
+ *
1082
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
1083
+ * ```
1084
+ *
1085
+ * Window:
1086
+ * ```js
1087
+ * async function createWin() {
1088
+ * const app = await fin.Application.start({
1089
+ * name: 'myApp',
1090
+ * uuid: 'app-1',
1091
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html',
1092
+ * autoShow: true
1093
+ * });
1094
+ * return await app.getWindow();
1095
+ * }
1096
+ *
1097
+ * async function getZoomLevel() {
1098
+ * const win = await createWin();
1099
+ * return await win.getZoomLevel();
1100
+ * }
1101
+ *
1102
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
1103
+ * ```
1104
+ * @remarks
1105
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1106
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1107
+ * {@link OpenFin.WebContentsEvents event namespace}.
1108
+ */
1109
+ getZoomLevel() {
1110
+ return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
1177
1111
  }
1178
- catch (e) {
1179
- if (isDisconnectedError(e.message) && relayErrorMsg) {
1180
- throw new Error(relayErrorMsg);
1181
- }
1182
- throw e;
1112
+ /**
1113
+ * Sets the zoom level of the WebContents.
1114
+ * @param level The zoom level
1115
+ *
1116
+ * @example
1117
+ * View:
1118
+ * ```js
1119
+ * async function setZoomLevel(number) {
1120
+ * const view = await fin.View.getCurrent();
1121
+ * return await view.setZoomLevel(number);
1122
+ * }
1123
+ *
1124
+ * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
1125
+ * ```
1126
+ *
1127
+ * Window:
1128
+ * ```js
1129
+ * async function createWin() {
1130
+ * const app = await fin.Application.start({
1131
+ * name: 'myApp',
1132
+ * uuid: 'app-1',
1133
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html',
1134
+ * autoShow: true
1135
+ * });
1136
+ * return await app.getWindow();
1137
+ * }
1138
+ *
1139
+ * async function setZoomLevel(number) {
1140
+ * const win = await createWin();
1141
+ * return await win.setZoomLevel(number);
1142
+ * }
1143
+ *
1144
+ * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
1145
+ * ```
1146
+ * @remarks
1147
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1148
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1149
+ * {@link OpenFin.WebContentsEvents event namespace}.
1150
+ */
1151
+ setZoomLevel(level) {
1152
+ return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
1183
1153
  }
1184
- };
1185
- channelApiRelay.createRelayedDispatch = createRelayedDispatch;
1186
-
1187
- var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1188
- if (kind === "m") throw new TypeError("Private method is not writable");
1189
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1190
- 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");
1191
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1192
- };
1193
- var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1194
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1195
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1196
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1197
- };
1198
- var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
1199
- Object.defineProperty(layoutEntities, "__esModule", { value: true });
1200
- layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
1201
- const api_exposer_1 = apiExposer$1;
1202
- const channel_api_relay_1 = channelApiRelay;
1203
- /*
1204
- This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
1205
- intertwined, and share members via parent abstract class LayoutNode. To prevent circular
1206
- refs, we define and export all the classes here.
1207
- */
1208
- /**
1209
- * @ignore
1210
- * @internal
1211
- * Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
1212
- * for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
1213
- */
1214
- class LayoutNode {
1215
1154
  /**
1216
- * @internal
1217
- * @ignore
1218
- */
1219
- constructor(client, entityId) {
1220
- /**
1221
- * @ignore
1222
- * @internal
1223
- * ApiClient for {@link LayoutEntitiesController}
1224
- */
1225
- _LayoutNode_client.set(this, void 0);
1226
- /**
1227
- * Checks if the TabStack or ColumnOrRow is the root content item
1228
- *
1229
- * @example
1230
- * ```js
1231
- * if (!fin.me.isView) {
1232
- * throw new Error('Not running in a platform View.');
1233
- * }
1234
- *
1235
- * const stack = await fin.me.getCurrentStack();
1236
- * const isRoot = await stack.isRoot();
1237
- * // The TabStack is root: false
1238
- * console.log(`The TabStack is root: ${isRoot}`);
1239
- *
1240
- * // Retrieves the parent ColumnOrRow
1241
- * const parent = await stack.getParent();
1242
- * const parentIsRoot = await parent.isRoot();
1243
- * // The parent ColumnOrRow is root: true
1244
- * console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
1245
- * ```
1246
- */
1247
- this.isRoot = () => __classPrivateFieldGet$d(this, _LayoutNode_client, "f").isRoot(this.entityId);
1248
- /**
1249
- * Checks if the TabStack or ColumnOrRow exists
1250
- *
1251
- * @example
1252
- * ```js
1253
- * if (!fin.me.isView) {
1254
- * throw new Error('Not running in a platform View.');
1255
- * }
1256
- *
1257
- * const stack = await fin.me.getCurrentStack();
1258
- * // Retrieves the parent ColumnOrRow
1259
- * const columnOrRow = await stack.getParent();
1260
- * let exists = await stack.exists();
1261
- * // or
1262
- * let exists = await columnOrRow.exists();
1263
- * // The entity exists: true
1264
- * console.log(`The entity exists: ${exists}`);
1265
- * ```
1266
- */
1267
- this.exists = () => __classPrivateFieldGet$d(this, _LayoutNode_client, "f").exists(this.entityId);
1268
- /**
1269
- * Retrieves the parent of the TabStack or ColumnOrRow
1270
- *
1271
- * @example
1272
- * ```js
1273
- * if (!fin.me.isView) {
1274
- * throw new Error('Not running in a platform View.');
1275
- * }
1276
- *
1277
- * const stack = await fin.me.getCurrentStack();
1278
- * // Retrieves the parent ColumnOrRow
1279
- * const columnOrRow = await stack.getParent();
1280
- *
1281
- * // undefined if entity is the root item
1282
- * let parent = await columnOrRow.getParent();
1283
- * // or
1284
- * let parent = await stack.getParent();
1285
- * ```
1286
- */
1287
- this.getParent = async () => {
1288
- const parent = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").getParent(this.entityId);
1289
- if (!parent) {
1290
- return undefined;
1291
- }
1292
- return LayoutNode.getEntity(parent, __classPrivateFieldGet$d(this, _LayoutNode_client, "f"));
1293
- };
1294
- /**
1295
- * Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
1296
- *
1297
- * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
1298
- * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
1299
- * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
1300
- * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
1301
- *
1302
- * @param views The views that will populate the new TabStack.
1303
- * @param options Additional options that control new TabStack creation.
1304
- * @returns The newly-created TabStack.
1305
- *
1306
- * @example
1307
- * ```js
1308
- * if (!fin.me.isView) {
1309
- * throw new Error('Not running in a platform View.');
1310
- * }
1311
- *
1312
- * const stack = await fin.me.getCurrentStack();
1313
- * const columnOrRow = await stack.getParent();
1314
- *
1315
- * // Create view references by supplying a 'name' and 'url'
1316
- * const views = [
1317
- * // if 'name' is undefined, one will be generated
1318
- * // if 'url' is undefined, it will default the view URL to 'about:blank'
1319
- * { name: 'google-view', url: 'http://google.com/'},
1320
- * { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
1321
- * ];
1322
- *
1323
- * // Create a view beforehand to be included in the new tab stack
1324
- * const outsideView = await fin.View.create({
1325
- * name: 'outside-bloomberg-view',
1326
- * url: 'https://bloomberg.com/',
1327
- * target: fin.me.identity,
1328
- * });
1329
- *
1330
- * // Views to add can be identities, or the reference views mentioned above
1331
- * const viewsToAdd = [outsideView.identity, ...views];
1332
- *
1333
- * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
1334
- * let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
1335
- * // Or
1336
- * let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
1337
- * console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
1338
- *
1339
- * ```
1340
- * @experimental
1341
- */
1342
- this.createAdjacentStack = async (views, options) => {
1343
- const entityId = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
1344
- return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$d(this, _LayoutNode_client, "f"));
1345
- };
1346
- /**
1347
- * Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
1348
- *
1349
- * @param edge Edge whose adjacent TabStacks will be returned.
1350
- *
1351
- * @example
1352
- * ```js
1353
- * if (!fin.me.isView) {
1354
- * throw new Error('Not running in a platform View.');
1355
- * }
1356
- *
1357
- * const stack = await fin.me.getCurrentStack();
1358
- * const columnOrRow = await stack.getParent();
1359
- * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
1360
- * let rightStacks = await columnOrRow.getAdjacentStacks('right');
1361
- * let leftStacks = await columnOrRow.getAdjacentStacks('left');
1362
- * // or
1363
- * let rightStacks = await stack.getAdjacentStacks('right');
1364
- * let leftStacks = await stack.getAdjacentStacks('left');
1365
- *
1366
- * console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
1367
- *
1368
- * ```
1369
- * @experimental
1370
- */
1371
- this.getAdjacentStacks = async (edge) => {
1372
- const adjacentStacks = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").getAdjacentStacks({
1373
- targetId: this.entityId,
1374
- edge
1375
- });
1376
- return adjacentStacks.map((stack) => LayoutNode.getEntity({
1377
- type: 'stack',
1378
- entityId: stack.entityId
1379
- }, __classPrivateFieldGet$d(this, _LayoutNode_client, "f")));
1380
- };
1381
- __classPrivateFieldSet$b(this, _LayoutNode_client, client, "f");
1382
- this.entityId = entityId;
1383
- }
1384
- }
1385
- layoutEntities.LayoutNode = LayoutNode;
1386
- _LayoutNode_client = new WeakMap();
1387
- /**
1388
- * @ignore
1389
- * @internal
1390
- * Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
1391
- * @param client
1392
- * @param controllerId
1393
- * @param identity
1394
- * @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
1395
- */
1396
- LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
1397
- 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.');
1398
- const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
1399
- return consumer.consume({ id: controllerId });
1400
- };
1401
- LayoutNode.getEntity = (definition, client) => {
1402
- const { entityId, type } = definition;
1403
- switch (type) {
1404
- case 'column':
1405
- case 'row':
1406
- return new ColumnOrRow(client, entityId, type);
1407
- case 'stack':
1408
- return new TabStack(client, entityId);
1409
- default:
1410
- throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
1411
- }
1412
- };
1413
- /**
1414
- * A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
1415
- */
1416
- class TabStack extends LayoutNode {
1417
- /** @internal */
1418
- constructor(client, entityId) {
1419
- super(client, entityId);
1420
- /**
1421
- * @internal
1422
- * ApiClient for {@link LayoutEntitiesController}
1423
- */
1424
- _TabStack_client.set(this, void 0);
1425
- /**
1426
- * Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
1427
- */
1428
- this.type = 'stack';
1429
- /**
1430
- * Retrieves a list of all views belonging to this {@link TabStack}.
1431
- *
1432
- * Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
1433
- * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
1434
- * If that happens and then getViews() is called, it will return the identities in a different order than
1435
- * than the currently rendered tab order.
1436
- *
1437
- *
1438
- * @throws If the {@link TabStack} has been destroyed.
1439
- * @example
1440
- * ```js
1441
- * if (!fin.me.isView) {
1442
- * throw new Error('Not running in a platform View.');
1443
- * }
1444
- *
1445
- * const stack = await fin.me.getCurrentStack();
1446
- * // Alternatively, you can wrap any view and get the stack from there
1447
- * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
1448
- * // const stack = await viewFromSomewhere.getCurrentStack();
1449
- * const views = await stack.getViews();
1450
- * console.log(`Stack contains ${views.length} view(s)`);
1451
- * ```
1452
- * @experimental
1453
- */
1454
- this.getViews = () => __classPrivateFieldGet$d(this, _TabStack_client, "f").getStackViews(this.entityId);
1455
- /**
1456
- * Adds or creates a view in this {@link TabStack}.
1457
- *
1458
- * @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
1459
- * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
1460
- *
1461
- * @param view The identity of an existing view to add, or options to create a view.
1462
- * @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
1463
- * @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
1464
- * @throws If the view does not exist or fails to create.
1465
- * @throws If the {@link TabStack} has been destroyed.
1466
- * @example
1467
- * ```js
1468
- * if (!fin.me.isView) {
1469
- * throw new Error('Not running in a platform View.');
1470
- * }
1471
- *
1472
- * const stack = await fin.me.getCurrentStack();
1473
- * // Alternatively, you can wrap any view and get the stack from there
1474
- * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
1475
- * // const stack = await viewFromSomewhere.getCurrentStack();
1476
- * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
1477
- * console.log('Identity of the google view just added', { googleViewIdentity });
1478
- * // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
1479
- * const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
1480
- * console.log('Identity of the apple view just added', { appleViewIdentity });
1481
- * ```
1482
- * @experimental
1483
- */
1484
- this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$d(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
1485
- /**
1486
- * Removes a view from this {@link TabStack}.
1487
- *
1488
- * @remarks Throws an exception if the view identity does not exist or was already destroyed.
1489
- *
1490
- * @param view - Identity of the view to remove.
1491
- * @throws If the view does not exist or does not belong to the stack.
1492
- * @throws If the {@link TabStack} has been destroyed.
1493
- *
1494
- * @example
1495
- * ```js
1496
- * if (!fin.me.isView) {
1497
- * throw new Error('Not running in a platform View.');
1498
- * }
1499
- *
1500
- * const stack = await fin.me.getCurrentStack();
1501
- * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
1502
- *
1503
- * await stack.removeView(googleViewIdentity);
1504
- *
1505
- * try {
1506
- * await stack.removeView(googleViewIdentity);
1507
- * } catch (error) {
1508
- * // Tried to remove a view ('google-view') which does not belong to the stack.
1509
- * console.log(error);
1510
- * }
1511
- * ```
1512
- */
1513
- this.removeView = async (view) => {
1514
- await __classPrivateFieldGet$d(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
1515
- };
1516
- /**
1517
- * Sets the active view of the {@link TabStack} without focusing it.
1518
- * @param view - Identity of the view to activate.
1519
- * @returns Promise which resolves with void once the view has been activated.
1520
- * @throws If the {@link TabStack} has been destroyed.
1521
- * @throws If the view does not exist.
1522
- * @example
1523
- * Change the active tab of a known View's TabStack:
1524
- * ```js
1525
- * const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
1526
- * const stack = await targetView.getCurrentStack();
1527
- * await stack.setActiveView(targetView.identity);
1528
- * ```
1529
- *
1530
- * Set the current View as active within its TabStack:
1531
- * ```js
1532
- * const stack = await fin.me.getCurrentStack();
1533
- * await stack.setActiveView(fin.me.identity);
1534
- * ```
1535
- * @experimental
1536
- */
1537
- this.setActiveView = async (view) => {
1538
- await __classPrivateFieldGet$d(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
1539
- };
1540
- __classPrivateFieldSet$b(this, _TabStack_client, client, "f");
1541
- }
1542
- }
1543
- layoutEntities.TabStack = TabStack;
1544
- _TabStack_client = new WeakMap();
1545
- /**
1546
- * A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
1547
- */
1548
- class ColumnOrRow extends LayoutNode {
1549
- /**
1550
- * @internal
1551
- */
1552
- constructor(client, entityId, type) {
1553
- super(client, entityId);
1554
- /**
1555
- * @ignore
1556
- * @internal
1557
- * ApiClient for {@link LayoutEntitiesController}
1558
- */
1559
- _ColumnOrRow_client.set(this, void 0);
1560
- /**
1561
- * Retrieves the content array of the ColumnOrRow
1562
- *
1563
- * @example
1564
- * ```js
1565
- * if (!fin.me.isView) {
1566
- * throw new Error('Not running in a platform View.');
1567
- * }
1568
- *
1569
- * const stack = await fin.me.getCurrentStack();
1570
- * // Retrieves the parent ColumnOrRow
1571
- * const columnOrRow = await stack.getParent();
1572
- *
1573
- * // returns [TabStack]
1574
- * const contentArray = await columnOrRow.getContent();
1575
- * console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
1576
- * ```
1577
- */
1578
- this.getContent = async () => {
1579
- const contentItemEntities = await __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f").getContent(this.entityId);
1580
- return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f")));
1581
- };
1582
- __classPrivateFieldSet$b(this, _ColumnOrRow_client, client, "f");
1583
- this.type = type;
1584
- }
1585
- }
1586
- layoutEntities.ColumnOrRow = ColumnOrRow;
1587
- _ColumnOrRow_client = new WeakMap();
1588
-
1589
- var layout_constants = {};
1590
-
1591
- Object.defineProperty(layout_constants, "__esModule", { value: true });
1592
- layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
1593
- layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
1594
- // TODO: eventually export this somehow
1595
- layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
1596
-
1597
- var main = {};
1598
-
1599
- Object.defineProperty(main, "__esModule", { value: true });
1600
- main.WebContents = void 0;
1601
- const base_1$j = base;
1602
- class WebContents extends base_1$j.EmitterBase {
1603
- /**
1604
- * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
1605
- * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
1606
- */
1607
- constructor(wire, identity, entityType) {
1608
- super(wire, entityType, identity.uuid, identity.name);
1609
- this.identity = identity;
1610
- this.entityType = entityType;
1611
- }
1612
- /**
1613
- * Gets a base64 encoded image of all or part of the WebContents.
1614
- * @param options Options for the capturePage call.
1615
- *
1616
- * @example
1617
- *
1618
- * View:
1619
- * ```js
1620
- * const view = fin.View.getCurrentSync();
1621
- *
1622
- * // PNG image of a full visible View
1623
- * console.log(await view.capturePage());
1624
- *
1625
- * // Low-quality JPEG image of a defined visible area of the view
1626
- * const options = {
1627
- * area: {
1628
- * height: 100,
1629
- * width: 100,
1630
- * x: 10,
1631
- * y: 10,
1632
- * },
1633
- * format: 'jpg',
1634
- * quality: 20
1635
- * }
1636
- * console.log(await view.capturePage(options));
1637
- * ```
1638
- *
1639
- * Window:
1640
- * ```js
1641
- * const wnd = await fin.Window.getCurrent();
1642
- *
1643
- * // PNG image of a full visible window
1644
- * console.log(await wnd.capturePage());
1645
- *
1646
- * // Low-quality JPEG image of a defined visible area of the window
1647
- * const options = {
1648
- * area: {
1649
- * height: 100,
1650
- * width: 100,
1651
- * x: 10,
1652
- * y: 10,
1653
- * },
1654
- * format: 'jpg',
1655
- * quality: 20
1656
- * }
1657
- * console.log(await wnd.capturePage(options));
1658
- * ```
1659
- *
1660
- * @remarks
1661
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1662
- * We do not expose an explicit superclass for this functionality, but it does have its own
1663
- * {@link OpenFin.WebContentsEvents event namespace}.
1664
- */
1665
- capturePage(options) {
1666
- return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
1667
- }
1668
- /**
1669
- * Executes Javascript on the WebContents, restricted to contents you own or contents owned by
1670
- * applications you have created.
1671
- * @param code JavaScript code to be executed on the view.
1672
- *
1673
- * @example
1674
- * View:
1675
- * ```js
1676
- * async function executeJavaScript(code) {
1677
- * const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
1678
- * return await view.executeJavaScript(code);
1679
- * }
1680
- *
1681
- * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
1682
- * ```
1683
- *
1684
- * Window:
1685
- * ```js
1686
- * async function executeJavaScript(code) {
1687
- * const app = await fin.Application.start({
1688
- * name: 'myApp',
1689
- * uuid: 'app-1',
1690
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
1691
- * autoShow: true
1692
- * });
1693
- * const win = await app.getWindow();
1694
- * return await win.executeJavaScript(code);
1695
- * }
1696
- *
1697
- * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
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}.
1703
- */
1704
- executeJavaScript(code) {
1705
- return this.wire
1706
- .sendAction('execute-javascript-in-window', { ...this.identity, code })
1707
- .then(({ payload }) => payload.data);
1708
- }
1709
- /**
1710
- * Returns the zoom level of the WebContents.
1711
- *
1712
- * @example
1713
- * View:
1714
- * ```js
1715
- * async function getZoomLevel() {
1716
- * const view = await fin.View.getCurrent();
1717
- * return await view.getZoomLevel();
1718
- * }
1719
- *
1720
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
1721
- * ```
1722
- *
1723
- * Window:
1724
- * ```js
1725
- * async function createWin() {
1726
- * const app = await fin.Application.start({
1727
- * name: 'myApp',
1728
- * uuid: 'app-1',
1729
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html',
1730
- * autoShow: true
1731
- * });
1732
- * return await app.getWindow();
1733
- * }
1734
- *
1735
- * async function getZoomLevel() {
1736
- * const win = await createWin();
1737
- * return await win.getZoomLevel();
1738
- * }
1739
- *
1740
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
1741
- * ```
1742
- * @remarks
1743
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1744
- * We do not expose an explicit superclass for this functionality, but it does have its own
1745
- * {@link OpenFin.WebContentsEvents event namespace}.
1746
- */
1747
- getZoomLevel() {
1748
- return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
1749
- }
1750
- /**
1751
- * Sets the zoom level of the WebContents.
1752
- * @param level The zoom level
1753
- *
1754
- * @example
1755
- * View:
1756
- * ```js
1757
- * async function setZoomLevel(number) {
1758
- * const view = await fin.View.getCurrent();
1759
- * return await view.setZoomLevel(number);
1760
- * }
1761
- *
1762
- * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
1763
- * ```
1764
- *
1765
- * Window:
1766
- * ```js
1767
- * async function createWin() {
1768
- * const app = await fin.Application.start({
1769
- * name: 'myApp',
1770
- * uuid: 'app-1',
1771
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html',
1772
- * autoShow: true
1773
- * });
1774
- * return await app.getWindow();
1775
- * }
1776
- *
1777
- * async function setZoomLevel(number) {
1778
- * const win = await createWin();
1779
- * return await win.setZoomLevel(number);
1780
- * }
1781
- *
1782
- * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
1783
- * ```
1784
- * @remarks
1785
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1786
- * We do not expose an explicit superclass for this functionality, but it does have its own
1787
- * {@link OpenFin.WebContentsEvents event namespace}.
1788
- */
1789
- setZoomLevel(level) {
1790
- return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
1791
- }
1792
- /**
1793
- * Navigates the WebContents to a specified URL.
1794
- *
1795
- * Note: The url must contain the protocol prefix such as http:// or https://.
1796
- * @param url - The URL to navigate the WebContents to.
1797
- *
1798
- * @example
1799
- * View:
1800
- * ```js
1801
- * async function createView() {
1802
- * const me = await fin.Window.getCurrent();
1803
- * return fin.View.create({
1804
- * name: 'viewName',
1805
- * target: me.identity,
1806
- * bounds: {top: 10, left: 10, width: 200, height: 200}
1807
- * });
1808
- * }
1809
- *
1810
- * createView()
1811
- * .then(view => view.navigate('https://example.com'))
1812
- * .then(() => console.log('navigation complete'))
1813
- * .catch(err => console.log(err));
1814
- * ```
1815
- *
1816
- * Window:
1817
- * ```js
1818
- * async function navigate() {
1819
- * const win = await fin.Window.getCurrent();
1820
- * return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html');
1821
- * }
1822
- * navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
1823
- * ```
1824
- * @experimental
1825
- * @remarks
1826
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1827
- * We do not expose an explicit superclass for this functionality, but it does have its own
1828
- * {@link OpenFin.WebContentsEvents event namespace}.
1155
+ * Navigates the WebContents to a specified URL.
1156
+ *
1157
+ * Note: The url must contain the protocol prefix such as http:// or https://.
1158
+ * @param url - The URL to navigate the WebContents to.
1159
+ *
1160
+ * @example
1161
+ * View:
1162
+ * ```js
1163
+ * async function createView() {
1164
+ * const me = await fin.Window.getCurrent();
1165
+ * return fin.View.create({
1166
+ * name: 'viewName',
1167
+ * target: me.identity,
1168
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
1169
+ * });
1170
+ * }
1171
+ *
1172
+ * createView()
1173
+ * .then(view => view.navigate('https://example.com'))
1174
+ * .then(() => console.log('navigation complete'))
1175
+ * .catch(err => console.log(err));
1176
+ * ```
1177
+ *
1178
+ * Window:
1179
+ * ```js
1180
+ * async function navigate() {
1181
+ * const win = await fin.Window.getCurrent();
1182
+ * return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html');
1183
+ * }
1184
+ * navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
1185
+ * ```
1186
+ * @experimental
1187
+ * @remarks
1188
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
1189
+ * We do not expose an explicit superclass for this functionality, but it does have its own
1190
+ * {@link OpenFin.WebContentsEvents event namespace}.
1829
1191
  */
1830
1192
  navigate(url) {
1831
1193
  return this.wire.sendAction('navigate-window', { ...this.identity, url }).then(() => undefined);
@@ -2670,18 +2032,11 @@ var hasRequiredInstance$2;
2670
2032
  function requireInstance$2 () {
2671
2033
  if (hasRequiredInstance$2) return Instance$5;
2672
2034
  hasRequiredInstance$2 = 1;
2673
- var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2674
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2675
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2676
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2677
- };
2678
2035
  var _View_providerChannelClient;
2679
2036
  Object.defineProperty(Instance$5, "__esModule", { value: true });
2680
2037
  Instance$5.View = void 0;
2681
2038
  const transport_errors_1 = transportErrors;
2682
2039
  const lazy_1 = lazy;
2683
- const layout_entities_1 = layoutEntities;
2684
- const layout_constants_1 = layout_constants;
2685
2040
  const main_1 = main;
2686
2041
  const window_1 = requireWindow();
2687
2042
  /**
@@ -2999,7 +2354,7 @@ function requireInstance$2 () {
2999
2354
  return ack.payload.data;
3000
2355
  };
3001
2356
  /**
3002
- * Retrieves the layout for the window the view is attached to.
2357
+ * Retrieves the OpenFin.Layout instance for the Window the View is attached to.
3003
2358
  *
3004
2359
  * @example
3005
2360
  * ```js
@@ -3015,24 +2370,7 @@ function requireInstance$2 () {
3015
2370
  this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
3016
2371
  // don't expose
3017
2372
  });
3018
- const layoutWindow = await this.getCurrentWindow();
3019
- try {
3020
- const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
3021
- const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
3022
- const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
3023
- return this.fin.Platform.Layout.wrap(layoutIdentity);
3024
- }
3025
- catch (e) {
3026
- const allowedErrors = [
3027
- 'No action registered at target for',
3028
- 'getLayoutIdentityForViewOrThrow is not a function'
3029
- ];
3030
- if (!allowedErrors.some((m) => e.message.includes(m))) {
3031
- throw e;
3032
- }
3033
- // fallback logic for missing endpoint
3034
- return this.fin.Platform.Layout.wrap(layoutWindow.identity);
3035
- }
2373
+ return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
3036
2374
  };
3037
2375
  /**
3038
2376
  * Gets the View's options.
@@ -3148,11 +2486,8 @@ function requireInstance$2 () {
3148
2486
  // don't expose
3149
2487
  });
3150
2488
  try {
3151
- const layoutWindow = await this.getCurrentWindow();
3152
- const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
3153
- const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
3154
- const stackDefinition = (await client.getStackByView(this.identity));
3155
- return layout_entities_1.LayoutNode.getEntity(stackDefinition, client);
2489
+ const layout = await this.getParentLayout();
2490
+ return layout.getStackByViewIdentity(this.identity);
3156
2491
  }
3157
2492
  catch (error) {
3158
2493
  throw new transport_errors_1.RuntimeError({ reason: 'This view does not belong to a stack.', error });
@@ -8164,12 +7499,12 @@ class ChannelBase {
8164
7499
  }
8165
7500
  channel.ChannelBase = ChannelBase;
8166
7501
 
8167
- var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7502
+ var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8168
7503
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8169
7504
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8170
7505
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8171
7506
  };
8172
- var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7507
+ var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8173
7508
  if (kind === "m") throw new TypeError("Private method is not writable");
8174
7509
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8175
7510
  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");
@@ -8211,7 +7546,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
8211
7546
  static closeChannelByEndpointId(id) {
8212
7547
  const channel = channelClientsByEndpointId.get(id);
8213
7548
  if (channel) {
8214
- __classPrivateFieldGet$c(channel, _ChannelClient_close, "f").call(channel);
7549
+ __classPrivateFieldGet$d(channel, _ChannelClient_close, "f").call(channel);
8215
7550
  }
8216
7551
  }
8217
7552
  /**
@@ -8222,7 +7557,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
8222
7557
  for (const channelClient of channelClientsByEndpointId.values()) {
8223
7558
  if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
8224
7559
  channelClient.disconnectListener(eventPayload);
8225
- __classPrivateFieldGet$c(channelClient, _ChannelClient_close, "f").call(channelClient);
7560
+ __classPrivateFieldGet$d(channelClient, _ChannelClient_close, "f").call(channelClient);
8226
7561
  }
8227
7562
  }
8228
7563
  }
@@ -8237,12 +7572,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
8237
7572
  this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
8238
7573
  _ChannelClient_close.set(this, () => {
8239
7574
  channelClientsByEndpointId.delete(this.endpointId);
8240
- __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").close();
7575
+ __classPrivateFieldGet$d(this, _ChannelClient_strategy, "f").close();
8241
7576
  });
8242
- __classPrivateFieldSet$a(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
7577
+ __classPrivateFieldSet$b(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
8243
7578
  this.disconnectListener = () => undefined;
8244
7579
  this.endpointId = routingInfo.endpointId;
8245
- __classPrivateFieldSet$a(this, _ChannelClient_strategy, strategy, "f");
7580
+ __classPrivateFieldSet$b(this, _ChannelClient_strategy, strategy, "f");
8246
7581
  channelClientsByEndpointId.set(this.endpointId, this);
8247
7582
  strategy.receive(this.processAction);
8248
7583
  }
@@ -8250,7 +7585,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
8250
7585
  * a read-only provider identity
8251
7586
  */
8252
7587
  get providerIdentity() {
8253
- const protectedObj = __classPrivateFieldGet$c(this, _ChannelClient_protectedObj, "f");
7588
+ const protectedObj = __classPrivateFieldGet$d(this, _ChannelClient_protectedObj, "f");
8254
7589
  return protectedObj.providerIdentity;
8255
7590
  }
8256
7591
  /**
@@ -8279,8 +7614,8 @@ class ChannelClient extends channel_1$1.ChannelBase {
8279
7614
  * ```
8280
7615
  */
8281
7616
  async dispatch(action, payload) {
8282
- if (__classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
8283
- return __classPrivateFieldGet$c(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
7617
+ if (__classPrivateFieldGet$d(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
7618
+ return __classPrivateFieldGet$d(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
8284
7619
  }
8285
7620
  throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
8286
7621
  }
@@ -8330,10 +7665,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
8330
7665
  */
8331
7666
  async disconnect() {
8332
7667
  await this.sendDisconnectAction();
8333
- __classPrivateFieldGet$c(this, _ChannelClient_close, "f").call(this);
7668
+ __classPrivateFieldGet$d(this, _ChannelClient_close, "f").call(this);
8334
7669
  }
8335
7670
  async sendDisconnectAction() {
8336
- const protectedObj = __classPrivateFieldGet$c(this, _ChannelClient_protectedObj, "f");
7671
+ const protectedObj = __classPrivateFieldGet$d(this, _ChannelClient_protectedObj, "f");
8337
7672
  await protectedObj.close();
8338
7673
  }
8339
7674
  /**
@@ -8366,13 +7701,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
8366
7701
 
8367
7702
  var strategy$3 = {};
8368
7703
 
8369
- var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7704
+ var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8370
7705
  if (kind === "m") throw new TypeError("Private method is not writable");
8371
7706
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8372
7707
  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");
8373
7708
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8374
7709
  };
8375
- var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7710
+ var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8376
7711
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8377
7712
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8378
7713
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -8397,7 +7732,7 @@ class ClassicStrategy {
8397
7732
  // connection problems occur
8398
7733
  _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
8399
7734
  this.send = async (endpointId, action, payload) => {
8400
- const to = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
7735
+ const to = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
8401
7736
  if (!to) {
8402
7737
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
8403
7738
  }
@@ -8409,28 +7744,28 @@ class ClassicStrategy {
8409
7744
  }
8410
7745
  delete cleanId.isLocalEndpointId;
8411
7746
  // grab the promise before awaiting it to save in our pending messages map
8412
- const p = __classPrivateFieldGet$b(this, _ClassicStrategy_wire, "f")
7747
+ const p = __classPrivateFieldGet$c(this, _ClassicStrategy_wire, "f")
8413
7748
  .sendAction('send-channel-message', {
8414
7749
  ...cleanId,
8415
7750
  providerIdentity: this.providerIdentity,
8416
7751
  action,
8417
7752
  payload
8418
7753
  });
8419
- __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
7754
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
8420
7755
  const raw = await p.catch((error) => {
8421
7756
  throw new Error(error.message);
8422
7757
  }).finally(() => {
8423
7758
  // clean up the pending promise
8424
- __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
7759
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
8425
7760
  });
8426
7761
  return raw.payload.data.result;
8427
7762
  };
8428
7763
  this.close = async () => {
8429
7764
  this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
8430
- [...__classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
8431
- __classPrivateFieldSet$9(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
7765
+ [...__classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
7766
+ __classPrivateFieldSet$a(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
8432
7767
  };
8433
- __classPrivateFieldSet$9(this, _ClassicStrategy_wire, wire, "f");
7768
+ __classPrivateFieldSet$a(this, _ClassicStrategy_wire, wire, "f");
8434
7769
  }
8435
7770
  onEndpointDisconnect(endpointId, listener) {
8436
7771
  // Never fires for 'classic'.
@@ -8439,20 +7774,20 @@ class ClassicStrategy {
8439
7774
  this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
8440
7775
  }
8441
7776
  async closeEndpoint(endpointId) {
8442
- const id = __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
8443
- __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
8444
- const pendingSet = __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
7777
+ const id = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
7778
+ __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
7779
+ const pendingSet = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
8445
7780
  pendingSet?.forEach((p) => {
8446
7781
  const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
8447
7782
  p.cancel(new Error(errorMsg));
8448
7783
  });
8449
7784
  }
8450
7785
  isEndpointConnected(endpointId) {
8451
- return __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
7786
+ return __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
8452
7787
  }
8453
7788
  addEndpoint(endpointId, payload) {
8454
- __classPrivateFieldGet$b(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
8455
- __classPrivateFieldGet$b(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
7789
+ __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
7790
+ __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
8456
7791
  }
8457
7792
  isValidEndpointPayload(payload) {
8458
7793
  return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
@@ -8483,12 +7818,12 @@ function errorToPOJO(error) {
8483
7818
  }
8484
7819
  errors.errorToPOJO = errorToPOJO;
8485
7820
 
8486
- var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7821
+ var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8487
7822
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8488
7823
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8489
7824
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8490
7825
  };
8491
- var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7826
+ var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8492
7827
  if (kind === "m") throw new TypeError("Private method is not writable");
8493
7828
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8494
7829
  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");
@@ -8523,8 +7858,8 @@ class RTCEndpoint {
8523
7858
  if (this.rtc.rtcClient.connectionState !== 'connected') {
8524
7859
  this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
8525
7860
  this.close();
8526
- if (__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
8527
- __classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f").call(this);
7861
+ if (__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f")) {
7862
+ __classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f").call(this);
8528
7863
  }
8529
7864
  }
8530
7865
  };
@@ -8572,9 +7907,9 @@ class RTCEndpoint {
8572
7907
  data = new TextDecoder().decode(e.data);
8573
7908
  }
8574
7909
  const { messageId, action, payload } = JSON.parse(data);
8575
- if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
7910
+ if (__classPrivateFieldGet$b(this, _RTCEndpoint_processAction, "f")) {
8576
7911
  try {
8577
- const res = await __classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
7912
+ const res = await __classPrivateFieldGet$b(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
8578
7913
  this.rtc.channels.response.send(JSON.stringify({
8579
7914
  messageId,
8580
7915
  payload: res,
@@ -8608,25 +7943,25 @@ class RTCEndpoint {
8608
7943
  datachannel.onclose = (e) => {
8609
7944
  [...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
8610
7945
  this.close();
8611
- if (__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
8612
- __classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f").call(this);
7946
+ if (__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f")) {
7947
+ __classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f").call(this);
8613
7948
  }
8614
7949
  };
8615
7950
  });
8616
7951
  }
8617
7952
  onDisconnect(listener) {
8618
- if (!__classPrivateFieldGet$a(this, _RTCEndpoint_disconnectListener, "f")) {
8619
- __classPrivateFieldSet$8(this, _RTCEndpoint_disconnectListener, listener, "f");
7953
+ if (!__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f")) {
7954
+ __classPrivateFieldSet$9(this, _RTCEndpoint_disconnectListener, listener, "f");
8620
7955
  }
8621
7956
  else {
8622
7957
  throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
8623
7958
  }
8624
7959
  }
8625
7960
  receive(listener) {
8626
- if (__classPrivateFieldGet$a(this, _RTCEndpoint_processAction, "f")) {
7961
+ if (__classPrivateFieldGet$b(this, _RTCEndpoint_processAction, "f")) {
8627
7962
  throw new Error('You have already set a listener for this RTC Endpoint.');
8628
7963
  }
8629
- __classPrivateFieldSet$8(this, _RTCEndpoint_processAction, listener, "f");
7964
+ __classPrivateFieldSet$9(this, _RTCEndpoint_processAction, listener, "f");
8630
7965
  }
8631
7966
  get connected() {
8632
7967
  return this.rtc.rtcClient.connectionState === 'connected';
@@ -8637,12 +7972,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
8637
7972
 
8638
7973
  var strategy$1 = {};
8639
7974
 
8640
- var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7975
+ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8641
7976
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8642
7977
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8643
7978
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8644
7979
  };
8645
- var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7980
+ var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8646
7981
  if (kind === "m") throw new TypeError("Private method is not writable");
8647
7982
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8648
7983
  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");
@@ -8663,11 +7998,11 @@ class EndpointStrategy {
8663
7998
  return this.getEndpointById(endpointId).send(action, payload);
8664
7999
  };
8665
8000
  this.close = async () => {
8666
- if (__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
8667
- __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
8668
- __classPrivateFieldSet$7(this, _EndpointStrategy_endpointMap, new Map(), "f");
8001
+ if (__classPrivateFieldGet$a(this, _EndpointStrategy_connected, "f")) {
8002
+ __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
8003
+ __classPrivateFieldSet$8(this, _EndpointStrategy_endpointMap, new Map(), "f");
8669
8004
  }
8670
- __classPrivateFieldSet$7(this, _EndpointStrategy_connected, false, "f");
8005
+ __classPrivateFieldSet$8(this, _EndpointStrategy_connected, false, "f");
8671
8006
  };
8672
8007
  this.isValidEndpointPayload = validateEndpoint;
8673
8008
  }
@@ -8675,39 +8010,39 @@ class EndpointStrategy {
8675
8010
  this.getEndpointById(endpointId).onDisconnect(listener);
8676
8011
  }
8677
8012
  receive(listener) {
8678
- if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
8013
+ if (__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f")) {
8679
8014
  throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
8680
8015
  }
8681
- __classPrivateFieldSet$7(this, _EndpointStrategy_processAction, listener, "f");
8016
+ __classPrivateFieldSet$8(this, _EndpointStrategy_processAction, listener, "f");
8682
8017
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
8683
- __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")));
8018
+ __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f")));
8684
8019
  }
8685
8020
  getEndpointById(endpointId) {
8686
- const endpoint = __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
8021
+ const endpoint = __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
8687
8022
  if (!endpoint) {
8688
8023
  throw new Error(`Client with endpoint id ${endpointId} is not connected`);
8689
8024
  }
8690
8025
  return endpoint;
8691
8026
  }
8692
8027
  get connected() {
8693
- return __classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f");
8028
+ return __classPrivateFieldGet$a(this, _EndpointStrategy_connected, "f");
8694
8029
  }
8695
8030
  isEndpointConnected(endpointId) {
8696
- return __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
8031
+ return __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
8697
8032
  }
8698
8033
  addEndpoint(endpointId, payload) {
8699
- if (!__classPrivateFieldGet$9(this, _EndpointStrategy_connected, "f")) {
8034
+ if (!__classPrivateFieldGet$a(this, _EndpointStrategy_connected, "f")) {
8700
8035
  console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
8701
8036
  return;
8702
8037
  }
8703
8038
  const clientStrat = new this.EndpointType(payload);
8704
- if (__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f")) {
8705
- clientStrat.receive(__classPrivateFieldGet$9(this, _EndpointStrategy_processAction, "f"));
8039
+ if (__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f")) {
8040
+ clientStrat.receive(__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f"));
8706
8041
  }
8707
- __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
8042
+ __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
8708
8043
  }
8709
8044
  async closeEndpoint(endpointId) {
8710
- __classPrivateFieldGet$9(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
8045
+ __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
8711
8046
  }
8712
8047
  }
8713
8048
  strategy$1.EndpointStrategy = EndpointStrategy;
@@ -8889,12 +8224,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
8889
8224
  }
8890
8225
  runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
8891
8226
 
8892
- var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8227
+ var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8893
8228
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8894
8229
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8895
8230
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8896
8231
  };
8897
- var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8232
+ var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8898
8233
  if (kind === "m") throw new TypeError("Private method is not writable");
8899
8234
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
8900
8235
  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");
@@ -8936,18 +8271,18 @@ class ChannelProvider extends channel_1.ChannelBase {
8936
8271
  * a read-only array containing all the identities of connecting clients.
8937
8272
  */
8938
8273
  get connections() {
8939
- return [...__classPrivateFieldGet$8(this, _ChannelProvider_connections, "f")];
8274
+ return [...__classPrivateFieldGet$9(this, _ChannelProvider_connections, "f")];
8940
8275
  }
8941
8276
  static handleClientDisconnection(channel, payload) {
8942
8277
  const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
8943
8278
  if (removeById) {
8944
- __classPrivateFieldGet$8(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
8279
+ __classPrivateFieldGet$9(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
8945
8280
  }
8946
8281
  else {
8947
8282
  const multipleRemoves = channel.connections.filter((identity) => {
8948
8283
  return identity.uuid === payload.uuid && identity.name === payload.name;
8949
8284
  });
8950
- multipleRemoves.forEach(__classPrivateFieldGet$8(channel, _ChannelProvider_removeEndpoint, "f"));
8285
+ multipleRemoves.forEach(__classPrivateFieldGet$9(channel, _ChannelProvider_removeEndpoint, "f"));
8951
8286
  }
8952
8287
  channel.disconnectListener(payload);
8953
8288
  }
@@ -8964,8 +8299,8 @@ class ChannelProvider extends channel_1.ChannelBase {
8964
8299
  _ChannelProvider_strategy.set(this, void 0);
8965
8300
  _ChannelProvider_removeEndpoint.set(this, (identity) => {
8966
8301
  const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
8967
- __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
8968
- __classPrivateFieldSet$6(this, _ChannelProvider_connections, remainingConnections, "f");
8302
+ __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
8303
+ __classPrivateFieldSet$7(this, _ChannelProvider_connections, remainingConnections, "f");
8969
8304
  });
8970
8305
  // Must be bound.
8971
8306
  this.processAction = async (action, payload, senderIdentity) => {
@@ -8979,17 +8314,17 @@ class ChannelProvider extends channel_1.ChannelBase {
8979
8314
  return super.processAction(action, payload, senderIdentity);
8980
8315
  };
8981
8316
  _ChannelProvider_close.set(this, () => {
8982
- __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").close();
8317
+ __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").close();
8983
8318
  const remove = ChannelProvider.removalMap.get(this);
8984
8319
  if (remove) {
8985
8320
  remove();
8986
8321
  }
8987
8322
  });
8988
- __classPrivateFieldSet$6(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
8323
+ __classPrivateFieldSet$7(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
8989
8324
  this.connectListener = () => undefined;
8990
8325
  this.disconnectListener = () => undefined;
8991
- __classPrivateFieldSet$6(this, _ChannelProvider_connections, [], "f");
8992
- __classPrivateFieldSet$6(this, _ChannelProvider_strategy, strategy, "f");
8326
+ __classPrivateFieldSet$7(this, _ChannelProvider_connections, [], "f");
8327
+ __classPrivateFieldSet$7(this, _ChannelProvider_strategy, strategy, "f");
8993
8328
  strategy.receive(this.processAction);
8994
8329
  }
8995
8330
  /**
@@ -9020,13 +8355,13 @@ class ChannelProvider extends channel_1.ChannelBase {
9020
8355
  */
9021
8356
  dispatch(to, action, payload) {
9022
8357
  const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
9023
- if (endpointId && __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
9024
- return __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
8358
+ if (endpointId && __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
8359
+ return __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
9025
8360
  }
9026
8361
  return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
9027
8362
  }
9028
8363
  async processConnection(senderId, payload) {
9029
- __classPrivateFieldGet$8(this, _ChannelProvider_connections, "f").push(senderId);
8364
+ __classPrivateFieldGet$9(this, _ChannelProvider_connections, "f").push(senderId);
9030
8365
  return this.connectListener(senderId, payload);
9031
8366
  }
9032
8367
  /**
@@ -9049,7 +8384,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9049
8384
  * ```
9050
8385
  */
9051
8386
  publish(action, payload) {
9052
- return this.connections.map((to) => __classPrivateFieldGet$8(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
8387
+ return this.connections.map((to) => __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
9053
8388
  }
9054
8389
  /**
9055
8390
  * Register a listener that is called on every new client connection.
@@ -9123,11 +8458,11 @@ class ChannelProvider extends channel_1.ChannelBase {
9123
8458
  * ```
9124
8459
  */
9125
8460
  async destroy() {
9126
- const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
8461
+ const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
9127
8462
  protectedObj.providerIdentity;
9128
- __classPrivateFieldSet$6(this, _ChannelProvider_connections, [], "f");
8463
+ __classPrivateFieldSet$7(this, _ChannelProvider_connections, [], "f");
9129
8464
  await protectedObj.close();
9130
- __classPrivateFieldGet$8(this, _ChannelProvider_close, "f").call(this);
8465
+ __classPrivateFieldGet$9(this, _ChannelProvider_close, "f").call(this);
9131
8466
  }
9132
8467
  /**
9133
8468
  * Returns an array with info on every Client connected to the Provider
@@ -9197,7 +8532,7 @@ class ChannelProvider extends channel_1.ChannelBase {
9197
8532
  getEndpointIdForOpenFinId(clientIdentity, action) {
9198
8533
  const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
9199
8534
  if (matchingConnections.length >= 2) {
9200
- const protectedObj = __classPrivateFieldGet$8(this, _ChannelProvider_protectedObj, "f");
8535
+ const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
9201
8536
  const { uuid, name } = clientIdentity;
9202
8537
  const providerUuid = protectedObj?.providerIdentity.uuid;
9203
8538
  const providerName = protectedObj?.providerIdentity.name;
@@ -9406,17 +8741,20 @@ class CombinedStrategy {
9406
8741
  }
9407
8742
  strategy.default = CombinedStrategy;
9408
8743
 
9409
- var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8744
+ var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9410
8745
  if (kind === "m") throw new TypeError("Private method is not writable");
9411
8746
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9412
8747
  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");
9413
8748
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
9414
8749
  };
9415
- var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8750
+ var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9416
8751
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9417
8752
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9418
8753
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9419
8754
  };
8755
+ var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
8756
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8757
+ };
9420
8758
  var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
9421
8759
  Object.defineProperty(connectionManager, "__esModule", { value: true });
9422
8760
  connectionManager.ConnectionManager = void 0;
@@ -9428,7 +8766,7 @@ const ice_manager_1 = iceManager;
9428
8766
  const provider_1$1 = provider;
9429
8767
  const message_receiver_1 = messageReceiver;
9430
8768
  const protocol_manager_1 = protocolManager;
9431
- const strategy_3 = strategy;
8769
+ const strategy_3 = __importDefault$1(strategy);
9432
8770
  class ConnectionManager extends base_1$f.Base {
9433
8771
  static getProtocolOptionsFromStrings(protocols) {
9434
8772
  return protocols.map((protocol) => {
@@ -9458,8 +8796,8 @@ class ConnectionManager extends base_1$f.Base {
9458
8796
  };
9459
8797
  this.providerMap = new Map();
9460
8798
  this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
9461
- __classPrivateFieldSet$5(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
9462
- __classPrivateFieldSet$5(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
8799
+ __classPrivateFieldSet$6(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
8800
+ __classPrivateFieldSet$6(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
9463
8801
  wire.registerMessageHandler(this.onmessage.bind(this));
9464
8802
  }
9465
8803
  createProvider(options, providerIdentity) {
@@ -9470,7 +8808,7 @@ class ConnectionManager extends base_1$f.Base {
9470
8808
  case 'rtc':
9471
8809
  return new strategy_2.RTCStrategy();
9472
8810
  case 'classic':
9473
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f"),
8811
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f"),
9474
8812
  // Providers do not have an endpointId, use channelId as endpointId in the strategy.
9475
8813
  providerIdentity.channelId, providerIdentity);
9476
8814
  default:
@@ -9506,7 +8844,7 @@ class ConnectionManager extends base_1$f.Base {
9506
8844
  const supportedProtocols = await Promise.all(protocols.map(async (type) => {
9507
8845
  switch (type) {
9508
8846
  case 'rtc': {
9509
- const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
8847
+ const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$8(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
9510
8848
  rtcPacket = { rtcClient, channels, channelsOpened };
9511
8849
  return {
9512
8850
  type: 'rtc',
@@ -9533,18 +8871,18 @@ class ConnectionManager extends base_1$f.Base {
9533
8871
  routingInfo.endpointId = this.wire.environment.getNextMessageId();
9534
8872
  // For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
9535
8873
  // clients that are in the same context as the newly-connected client.
9536
- __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
8874
+ __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
9537
8875
  }
9538
8876
  const answer = routingInfo.answer ?? {
9539
8877
  supportedProtocols: [{ type: 'classic', version: 1 }]
9540
8878
  };
9541
8879
  const createStrategyFromAnswer = async (protocol) => {
9542
8880
  if (protocol.type === 'rtc' && rtcPacket) {
9543
- await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
8881
+ await __classPrivateFieldGet$8(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
9544
8882
  return new strategy_2.RTCStrategy();
9545
8883
  }
9546
8884
  if (protocol.type === 'classic') {
9547
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$7(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
8885
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
9548
8886
  }
9549
8887
  return null;
9550
8888
  };
@@ -9612,7 +8950,7 @@ class ConnectionManager extends base_1$f.Base {
9612
8950
  clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
9613
8951
  const answer = await accumP;
9614
8952
  if (protocolToUse.type === 'rtc') {
9615
- const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$7(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
8953
+ const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$8(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
9616
8954
  answer.supportedProtocols.push({
9617
8955
  type: 'rtc',
9618
8956
  version: strategy_2.RTCInfo.version,
@@ -9660,13 +8998,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
9660
8998
  *
9661
8999
  * @packageDocumentation
9662
9000
  */
9663
- var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9001
+ var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9664
9002
  if (kind === "m") throw new TypeError("Private method is not writable");
9665
9003
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9666
9004
  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");
9667
9005
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
9668
9006
  };
9669
- var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9007
+ var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9670
9008
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9671
9009
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9672
9010
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -9723,11 +9061,11 @@ class Channel extends base_1$e.EmitterBase {
9723
9061
  client_1.ChannelClient.handleProviderDisconnect(eventPayload);
9724
9062
  }),
9725
9063
  this.on('connected', (...args) => {
9726
- __classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").emit('connected', ...args);
9064
+ __classPrivateFieldGet$7(this, _Channel_internalEmitter, "f").emit('connected', ...args);
9727
9065
  })
9728
9066
  ]).catch(() => new Error('error setting up channel connection listeners'));
9729
9067
  }));
9730
- __classPrivateFieldSet$4(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
9068
+ __classPrivateFieldSet$5(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
9731
9069
  }
9732
9070
  /**
9733
9071
  *
@@ -9802,7 +9140,7 @@ class Channel extends base_1$e.EmitterBase {
9802
9140
  resolve(true);
9803
9141
  }
9804
9142
  };
9805
- __classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
9143
+ __classPrivateFieldGet$7(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
9806
9144
  });
9807
9145
  try {
9808
9146
  if (retryInfo.count > 0) {
@@ -9834,7 +9172,7 @@ class Channel extends base_1$e.EmitterBase {
9834
9172
  finally {
9835
9173
  retryInfo.count += 1;
9836
9174
  // in case of other errors, remove our listener
9837
- __classPrivateFieldGet$6(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
9175
+ __classPrivateFieldGet$7(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
9838
9176
  }
9839
9177
  } while (shouldWait); // If we're waiting we retry the above loop
9840
9178
  // Should wait was false, no channel was found.
@@ -9893,12 +9231,12 @@ class Channel extends base_1$e.EmitterBase {
9893
9231
  async connect(channelName, options = {}) {
9894
9232
  // Make sure we don't connect before listeners are set up
9895
9233
  // This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
9896
- await __classPrivateFieldGet$6(this, _Channel_readyToConnect, "f").getValue();
9234
+ await __classPrivateFieldGet$7(this, _Channel_readyToConnect, "f").getValue();
9897
9235
  if (!channelName || typeof channelName !== 'string') {
9898
9236
  throw new Error('Please provide a channelName string to connect to a channel.');
9899
9237
  }
9900
9238
  const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
9901
- const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createClientOffer(opts);
9239
+ const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$7(this, _Channel_connectionManager, "f").createClientOffer(opts);
9902
9240
  let connectionUrl;
9903
9241
  if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
9904
9242
  connectionUrl = (await this.fin.me.getInfo()).url;
@@ -9910,7 +9248,7 @@ class Channel extends base_1$e.EmitterBase {
9910
9248
  connectionUrl
9911
9249
  };
9912
9250
  const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
9913
- const strategy = await __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
9251
+ const strategy = await __classPrivateFieldGet$7(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
9914
9252
  const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
9915
9253
  // It is the client's responsibility to handle endpoint disconnection to the provider.
9916
9254
  // If the endpoint dies, the client will force a disconnection through the core.
@@ -9979,7 +9317,7 @@ class Channel extends base_1$e.EmitterBase {
9979
9317
  throw new Error('Please provide a channelName to create a channel');
9980
9318
  }
9981
9319
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
9982
- const channel = __classPrivateFieldGet$6(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9320
+ const channel = __classPrivateFieldGet$7(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9983
9321
  // TODO: fix typing (internal)
9984
9322
  // @ts-expect-error
9985
9323
  this.on('client-disconnected', (eventPayload) => {
@@ -10870,7 +10208,7 @@ var Factory$3 = {};
10870
10208
 
10871
10209
  var Instance$2 = {};
10872
10210
 
10873
- var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10211
+ var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10874
10212
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10875
10213
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10876
10214
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10903,7 +10241,7 @@ class Platform extends base_1$6.EmitterBase {
10903
10241
  const target = identity || this.identity;
10904
10242
  const { uuid } = target;
10905
10243
  if (!clientMap.has(uuid)) {
10906
- const clientPromise = __classPrivateFieldGet$5(this, _Platform_connectToProvider, "f").call(this, uuid);
10244
+ const clientPromise = __classPrivateFieldGet$6(this, _Platform_connectToProvider, "f").call(this, uuid);
10907
10245
  clientMap.set(uuid, clientPromise);
10908
10246
  }
10909
10247
  // we set it above
@@ -11424,309 +10762,973 @@ class Platform extends base_1$6.EmitterBase {
11424
10762
  * });
11425
10763
  * }
11426
10764
  *
11427
- * const win = await createWindowWithTwoViews();
11428
- * // ... you will now see a new window with two views in it
10765
+ * const win = await createWindowWithTwoViews();
10766
+ * // ... you will now see a new window with two views in it
10767
+ *
10768
+ * // we take a snapshot of the current state of the app, before changing it
10769
+ * const snapshotOfInitialAppState = await platform.getSnapshot();
10770
+ *
10771
+ * // now let's change the state of the app:
10772
+ * await addViewToWindow(win.identity);
10773
+ * // ... the window now has three views in it
10774
+ *
10775
+ * await platform.applySnapshot(snapshotOfInitialAppState, { closeExistingWindows: true });
10776
+ * // ... the window will revert to previous state, with just two views
10777
+ *
10778
+ * ```
10779
+ */
10780
+ async applySnapshot(requestedSnapshot, options) {
10781
+ this.wire.sendAction('platform-apply-snapshot', this.identity).catch((e) => {
10782
+ // don't expose
10783
+ });
10784
+ const errMsg = 'Requested snapshot must be a valid Snapshot object, or a url or filepath to such an object.';
10785
+ let snapshot;
10786
+ if (typeof requestedSnapshot === 'string') {
10787
+ // Fetch and parse snapshot
10788
+ try {
10789
+ const response = await this._channel.wire.sendAction('get-application-manifest', {
10790
+ manifestUrl: requestedSnapshot
10791
+ });
10792
+ snapshot = response.payload.data;
10793
+ }
10794
+ catch (err) {
10795
+ throw new Error(`${errMsg}: ${err}`);
10796
+ }
10797
+ }
10798
+ else {
10799
+ snapshot = requestedSnapshot;
10800
+ }
10801
+ if (!snapshot.windows) {
10802
+ throw new Error(errMsg);
10803
+ }
10804
+ const client = await this.getClient();
10805
+ await client.dispatch('apply-snapshot', {
10806
+ snapshot,
10807
+ options
10808
+ });
10809
+ return this;
10810
+ }
10811
+ /**
10812
+ * Fetches a JSON manifest using the browser process and returns a Javascript object.
10813
+ * Can be overwritten using {@link Platform.PlatformModule.init Platform.init}.
10814
+ * @param manifestUrl The URL of the manifest to fetch.
10815
+ *
10816
+ * @remarks Can be overwritten using {@link Platform#init Platform.init}.
10817
+ *
10818
+ * @example
10819
+ *
10820
+ * ```js
10821
+ * const platform = fin.Platform.getCurrentSync();
10822
+ * const manifest = await platform.fetchManifest('https://www.path-to-manifest.com/app.json');
10823
+ * console.log(manifest);
10824
+ * ```
10825
+ */
10826
+ async fetchManifest(manifestUrl) {
10827
+ const client = await this.getClient();
10828
+ return client.dispatch('platform-fetch-manifest', { manifestUrl });
10829
+ }
10830
+ /**
10831
+ * Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that
10832
+ * resolves to the wrapped Platform.
10833
+ * @param manifestUrl - The URL of the manifest that will be launched into the platform. If this app manifest
10834
+ * contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options
10835
+ * will be launched into the platform. The applicable startup_app options will become {@link OpenFin.ViewCreationOptions View Options}.
10836
+ *
10837
+ * @remarks If the app manifest contains a snapshot, that will be launched into the platform. If not, the
10838
+ * application described in startup_app options will be launched into the platform as a window with a single view.
10839
+ * The applicable startup_app options will become View Options.
10840
+ *
10841
+ * @example
10842
+ * ```js
10843
+ * try {
10844
+ * const platform = fin.Platform.getCurrentSync();
10845
+ * await platform.launchContentManifest('http://localhost:5555/app.json');
10846
+ * console.log(`content launched successfully into platform`);
10847
+ * } catch(e) {
10848
+ * console.error(e);
10849
+ * }
10850
+ * // For a local manifest file:
10851
+ * try {
10852
+ * const platform = fin.Platform.getCurrentSync();
10853
+ * platform.launchContentManifest('file:///C:/somefolder/app.json');
10854
+ * console.log(`content launched successfully into platform`);
10855
+ * } catch(e) {
10856
+ * console.error(e);
10857
+ * }
10858
+ * ```
10859
+ * @experimental
10860
+ */
10861
+ async launchContentManifest(manifestUrl) {
10862
+ this.wire.sendAction('platform-launch-content-manifest', this.identity).catch(() => {
10863
+ // don't expose
10864
+ });
10865
+ const client = await this.getClient();
10866
+ const manifest = await this.fetchManifest(manifestUrl);
10867
+ client.dispatch('launch-into-platform', { manifest, manifestUrl });
10868
+ return this;
10869
+ }
10870
+ /**
10871
+ * Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots.
10872
+ * It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
10873
+ * @param context - A field where serializable context data can be stored to be saved in platform snapshots.
10874
+ * @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
10875
+ * to the current window (if called from a Window) or the current host window (if called from a View).
10876
+ *
10877
+ * @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
10878
+ * platform.
10879
+ * This method can be called from the window itself, or from any child view. Context data is shared by all
10880
+ * entities within a window.
10881
+ *
10882
+ * @example
10883
+ * Setting own context:
10884
+ * ```js
10885
+ * const platform = fin.Platform.getCurrentSync();
10886
+ * const contextData = {
10887
+ * security: 'STOCK',
10888
+ * currentView: 'detailed'
10889
+ * }
10890
+ *
10891
+ * await platform.setWindowContext(contextData);
10892
+ * // Context of current window is now set to `contextData`
10893
+ * ```
10894
+ *
10895
+ * Setting the context of another window or view:
10896
+ * ```js
10897
+ * const platform = fin.Platform.getCurrentSync();
10898
+ * const contextData = {
10899
+ * security: 'STOCK',
10900
+ * currentView: 'detailed'
10901
+ * }
10902
+ *
10903
+ * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
10904
+ * await platform.setWindowContext(contextData, windowOrViewIdentity);
10905
+ * // Context of the target window or view is now set to `contextData`
10906
+ * ```
10907
+ *
10908
+ * A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
10909
+ * This event will fire when a host window's context is updated or when the view is reparented to a new window:
10910
+ *
10911
+ * ```js
10912
+ * // From a view
10913
+ * const contextChangeHandler = ({ context }) => {
10914
+ * console.log('Host window\'s context has changed. New context data:', context);
10915
+ * // react to new context data here
10916
+ * }
10917
+ * await fin.me.on('host-context-changed', contextChangeHandler);
10918
+ *
10919
+ * const platform = await fin.Platform.getCurrentSync();
10920
+ * const contextData = {
10921
+ * security: 'STOCK',
10922
+ * currentView: 'detailed'
10923
+ * }
10924
+ * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
10925
+ * ```
10926
+ *
10927
+ * To listen to a window's context updates, use the `context-changed` event:
10928
+ * ```js
10929
+ * // From a window
10930
+ * const contextChangeHandler = ({ context }) => {
10931
+ * console.log('This window\'s context has changed. New context data:', context);
10932
+ * // react to new context data here
10933
+ * }
10934
+ * await fin.me.on('context-changed', contextChangeHandler);
10935
+ *
10936
+ * const platform = await fin.Platform.getCurrentSync();
10937
+ * const contextData = {
10938
+ * security: 'STOCK',
10939
+ * currentView: 'detailed'
10940
+ * }
10941
+ * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
10942
+ * ```
10943
+ * @experimental
10944
+ */
10945
+ async setWindowContext(context = {}, target) {
10946
+ this.wire.sendAction('platform-set-window-context', this.identity).catch((e) => {
10947
+ // don't expose
10948
+ });
10949
+ if (!context) {
10950
+ throw new Error('Please provide a serializable object or string to set the context.');
10951
+ }
10952
+ const client = await this.getClient();
10953
+ const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
10954
+ await client.dispatch('set-window-context', {
10955
+ context,
10956
+ entityType,
10957
+ target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }
10958
+ });
10959
+ }
10960
+ /**
10961
+ * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
10962
+ * The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
10963
+ * @param target - A target window or view may optionally be provided. If no target is provided, target will be
10964
+ * the current window (if called from a Window) or the current host window (if called from a View).
10965
+ *
10966
+ * @remarks This method can be called from the window itself, or from any child view. Context data is shared
10967
+ * by all entities within a window.
10968
+ *
10969
+ * @example
11429
10970
  *
11430
- * // we take a snapshot of the current state of the app, before changing it
11431
- * const snapshotOfInitialAppState = await platform.getSnapshot();
10971
+ * Retrieving context from current window:
10972
+ * ```js
10973
+ * const platform = fin.Platform.getCurrentSync();
10974
+ * const customContext = { answer: 42 };
10975
+ * await platform.setWindowContext(customContext);
11432
10976
  *
11433
- * // now let's change the state of the app:
11434
- * await addViewToWindow(win.identity);
11435
- * // ... the window now has three views in it
10977
+ * const myContext = await platform.getWindowContext();
10978
+ * console.log(myContext); // { answer: 42 }
10979
+ * ```
11436
10980
  *
11437
- * await platform.applySnapshot(snapshotOfInitialAppState, { closeExistingWindows: true });
11438
- * // ... the window will revert to previous state, with just two views
10981
+ * Retrieving the context of another window or view:
10982
+ * ```js
10983
+ * const platform = fin.Platform.getCurrentSync();
10984
+ *
10985
+ * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
11439
10986
  *
10987
+ * const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
10988
+ * console.log(targetWindowContext); // context of target window
11440
10989
  * ```
10990
+ * @experimental
11441
10991
  */
11442
- async applySnapshot(requestedSnapshot, options) {
11443
- this.wire.sendAction('platform-apply-snapshot', this.identity).catch((e) => {
10992
+ async getWindowContext(target) {
10993
+ this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
11444
10994
  // don't expose
11445
10995
  });
11446
- const errMsg = 'Requested snapshot must be a valid Snapshot object, or a url or filepath to such an object.';
11447
- let snapshot;
11448
- if (typeof requestedSnapshot === 'string') {
11449
- // Fetch and parse snapshot
11450
- try {
11451
- const response = await this._channel.wire.sendAction('get-application-manifest', {
11452
- manifestUrl: requestedSnapshot
11453
- });
11454
- snapshot = response.payload.data;
11455
- }
11456
- catch (err) {
11457
- throw new Error(`${errMsg}: ${err}`);
11458
- }
11459
- }
11460
- else {
11461
- snapshot = requestedSnapshot;
11462
- }
11463
- if (!snapshot.windows) {
11464
- throw new Error(errMsg);
11465
- }
11466
10996
  const client = await this.getClient();
11467
- await client.dispatch('apply-snapshot', {
11468
- snapshot,
11469
- options
10997
+ const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
10998
+ return client.dispatch('get-window-context', {
10999
+ target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name },
11000
+ entityType
11470
11001
  });
11471
- return this;
11472
11002
  }
11473
11003
  /**
11474
- * Fetches a JSON manifest using the browser process and returns a Javascript object.
11475
- * Can be overwritten using {@link Platform.PlatformModule.init Platform.init}.
11476
- * @param manifestUrl The URL of the manifest to fetch.
11004
+ * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
11005
+ * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
11006
+ * @param winId
11007
+ * @param options
11477
11008
  *
11478
- * @remarks Can be overwritten using {@link Platform#init Platform.init}.
11009
+ * @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
11010
+ * it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
11479
11011
  *
11480
11012
  * @example
11481
11013
  *
11482
11014
  * ```js
11483
- * const platform = fin.Platform.getCurrentSync();
11484
- * const manifest = await platform.fetchManifest('https://www.path-to-manifest.com/app.json');
11485
- * console.log(manifest);
11015
+ * // Close the current Window inside a Window context
11016
+ * const platform = await fin.Platform.getCurrent();
11017
+ * platform.closeWindow(fin.me.identity);
11018
+ *
11019
+ * // Close the Window from inside a View context
11020
+ * const platform = await fin.Platform.getCurrent();
11021
+ * const parentWindow = await fin.me.getCurrentWindow();
11022
+ * platform.closeWindow(parentWindow.identity);
11023
+ *
11024
+ * // Close the Window and do not fire the before unload handler on Views
11025
+ * const platform = await fin.Platform.getCurrent();
11026
+ * platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
11486
11027
  * ```
11028
+ * @experimental
11487
11029
  */
11488
- async fetchManifest(manifestUrl) {
11030
+ async closeWindow(windowId, options = { skipBeforeUnload: false }) {
11031
+ this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
11032
+ // don't expose
11033
+ });
11489
11034
  const client = await this.getClient();
11490
- return client.dispatch('platform-fetch-manifest', { manifestUrl });
11035
+ return client.dispatch('close-window', { windowId, options });
11036
+ }
11037
+ }
11038
+ Instance$2.Platform = Platform;
11039
+ _Platform_connectToProvider = new WeakMap();
11040
+
11041
+ var layout = {};
11042
+
11043
+ var Factory$2 = {};
11044
+
11045
+ var Instance$1 = {};
11046
+
11047
+ var commonUtils = {};
11048
+
11049
+ Object.defineProperty(commonUtils, "__esModule", { value: true });
11050
+ commonUtils.overrideFromComposables = commonUtils.isValidPresetType = void 0;
11051
+ function isValidPresetType(type) {
11052
+ switch (type) {
11053
+ case 'columns':
11054
+ case 'grid':
11055
+ case 'rows':
11056
+ case 'tabs':
11057
+ return true;
11058
+ default:
11059
+ return false;
11060
+ }
11061
+ }
11062
+ commonUtils.isValidPresetType = isValidPresetType;
11063
+ function overrideFromComposables(...overrides) {
11064
+ return (base) => overrides.reduceRight((p, c) => (b) => c(p(b)), (x) => x)(base);
11065
+ }
11066
+ commonUtils.overrideFromComposables = overrideFromComposables;
11067
+ commonUtils.default = { isValidPresetType };
11068
+
11069
+ var layoutEntities = {};
11070
+
11071
+ var apiExposer$1 = {};
11072
+
11073
+ var apiConsumer = {};
11074
+
11075
+ Object.defineProperty(apiConsumer, "__esModule", { value: true });
11076
+ apiConsumer.ApiConsumer = void 0;
11077
+ /**
11078
+ * Consumer for apis exposed with {@see ApiExposer}.
11079
+ *
11080
+ * A strategy that matches the strategy used to expose a target API must be provided.
11081
+ */
11082
+ class ApiConsumer {
11083
+ // eslint-disable-next-line
11084
+ constructor(strategy) {
11085
+ this.strategy = strategy;
11086
+ /**
11087
+ * Consumes an api exposed using a given transport strategy, and generates a client
11088
+ * for easy, type safe consumption of that client.
11089
+ * @param options Strategy specific consumption options.
11090
+ * @returns An api client matching the given type.
11091
+ */
11092
+ this.consume = async (options) => {
11093
+ const exposedProperties = await this.strategy.getExposedFunctions(options);
11094
+ return exposedProperties.reduce((client, prop) => ({
11095
+ ...client,
11096
+ [prop.key]: this.strategy.createFunction(prop, options)
11097
+ }), {});
11098
+ };
11099
+ }
11100
+ }
11101
+ apiConsumer.ApiConsumer = ApiConsumer;
11102
+
11103
+ var apiExposer = {};
11104
+
11105
+ var decorators = {};
11106
+
11107
+ Object.defineProperty(decorators, "__esModule", { value: true });
11108
+ decorators.expose = decorators.getExposedProperties = void 0;
11109
+ const exposedProperties = Symbol('exposedProperties');
11110
+ const getExposedProperties = (target) => {
11111
+ return target[exposedProperties] || target.prototype[exposedProperties] || [];
11112
+ };
11113
+ decorators.getExposedProperties = getExposedProperties;
11114
+ /**
11115
+ * Indicates that a class member function can be exposed using {@link ApiExposer}.
11116
+ * @param options Options specific to the strategy used in {@link ApiExposer}
11117
+ */
11118
+ // Returns any as decorator typing is weird.
11119
+ const expose = (options) => (target, key, descriptor) => {
11120
+ target[exposedProperties] = target[exposedProperties] || [];
11121
+ target[exposedProperties].push({ key, descriptor, options });
11122
+ };
11123
+ decorators.expose = expose;
11124
+
11125
+ Object.defineProperty(apiExposer, "__esModule", { value: true });
11126
+ apiExposer.ApiExposer = void 0;
11127
+ const decorators_1 = decorators;
11128
+ /**
11129
+ * Exposes api services on the transport of choice.
11130
+ */
11131
+ class ApiExposer {
11132
+ /**
11133
+ * @param strategy The expose strategy to use to expose instances.
11134
+ */
11135
+ // eslint-disable-next-line
11136
+ constructor(strategy) {
11137
+ this.strategy = strategy;
11138
+ /**
11139
+ * Exposes an instance of a given api on
11140
+ * @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
11141
+ * @param instanceOptions Transport strategy specific options to use when exposing.
11142
+ */
11143
+ this.exposeInstance = async (instance, instanceOptions) => {
11144
+ const exposableProps = (0, decorators_1.getExposedProperties)(instance);
11145
+ const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
11146
+ const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
11147
+ key,
11148
+ options,
11149
+ meta: instanceOptions
11150
+ });
11151
+ return {
11152
+ key,
11153
+ options: customConsumptionOptions
11154
+ };
11155
+ }));
11156
+ await this.strategy.exposeMeta(instanceOptions, exposedProps);
11157
+ };
11158
+ }
11159
+ ;
11160
+ }
11161
+ apiExposer.ApiExposer = ApiExposer;
11162
+
11163
+ var strategies = {};
11164
+
11165
+ var openfinChannels = {};
11166
+
11167
+ var channelsConsumer = {};
11168
+
11169
+ Object.defineProperty(channelsConsumer, "__esModule", { value: true });
11170
+ channelsConsumer.ChannelsConsumer = void 0;
11171
+ class ChannelsConsumer {
11172
+ // eslint-disable-next-line
11173
+ constructor(channel) {
11174
+ this.channel = channel;
11175
+ this.getExposedFunctions = async (options) => {
11176
+ const { id } = options;
11177
+ const { props } = await this.channel.dispatch(`api-meta:${id}`);
11178
+ return props;
11179
+ };
11180
+ this.createFunction = (prop) => (...args) => {
11181
+ const { action } = prop.options;
11182
+ return this.channel.dispatch(action, { args });
11183
+ };
11184
+ }
11185
+ ;
11186
+ }
11187
+ channelsConsumer.ChannelsConsumer = ChannelsConsumer;
11188
+
11189
+ var channelsExposer = {};
11190
+
11191
+ Object.defineProperty(channelsExposer, "__esModule", { value: true });
11192
+ channelsExposer.ChannelsExposer = void 0;
11193
+ class ChannelsExposer {
11194
+ // eslint-disable-next-line
11195
+ constructor(channelProviderOrClient) {
11196
+ this.channelProviderOrClient = channelProviderOrClient;
11197
+ this.exposeFunction = async (target, config) => {
11198
+ const { key, options, meta } = config;
11199
+ const { id } = meta;
11200
+ const action = `${id}.${options?.action || key}`;
11201
+ await this.channelProviderOrClient.register(action, async ({ args }) => {
11202
+ return target(...args);
11203
+ });
11204
+ return { action };
11205
+ };
11206
+ this.exposeMeta = async ({ id }, props) => {
11207
+ const action = `api-meta:${id}`;
11208
+ await this.channelProviderOrClient.register(action, () => ({ props }));
11209
+ };
11491
11210
  }
11492
- /**
11493
- * Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that
11494
- * resolves to the wrapped Platform.
11495
- * @param manifestUrl - The URL of the manifest that will be launched into the platform. If this app manifest
11496
- * contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options
11497
- * will be launched into the platform. The applicable startup_app options will become {@link OpenFin.ViewCreationOptions View Options}.
11498
- *
11499
- * @remarks If the app manifest contains a snapshot, that will be launched into the platform. If not, the
11500
- * application described in startup_app options will be launched into the platform as a window with a single view.
11501
- * The applicable startup_app options will become View Options.
11502
- *
11503
- * @example
11504
- * ```js
11505
- * try {
11506
- * const platform = fin.Platform.getCurrentSync();
11507
- * await platform.launchContentManifest('http://localhost:5555/app.json');
11508
- * console.log(`content launched successfully into platform`);
11509
- * } catch(e) {
11510
- * console.error(e);
11511
- * }
11512
- * // For a local manifest file:
11513
- * try {
11514
- * const platform = fin.Platform.getCurrentSync();
11515
- * platform.launchContentManifest('file:///C:/somefolder/app.json');
11516
- * console.log(`content launched successfully into platform`);
11517
- * } catch(e) {
11518
- * console.error(e);
11519
- * }
11520
- * ```
11521
- * @experimental
11522
- */
11523
- async launchContentManifest(manifestUrl) {
11524
- this.wire.sendAction('platform-launch-content-manifest', this.identity).catch(() => {
11525
- // don't expose
11211
+ }
11212
+ channelsExposer.ChannelsExposer = ChannelsExposer;
11213
+
11214
+ (function (exports) {
11215
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11216
+ if (k2 === undefined) k2 = k;
11217
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11218
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11219
+ desc = { enumerable: true, get: function() { return m[k]; } };
11220
+ }
11221
+ Object.defineProperty(o, k2, desc);
11222
+ }) : (function(o, m, k, k2) {
11223
+ if (k2 === undefined) k2 = k;
11224
+ o[k2] = m[k];
11225
+ }));
11226
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
11227
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11228
+ };
11229
+ Object.defineProperty(exports, "__esModule", { value: true });
11230
+ __exportStar(channelsConsumer, exports);
11231
+ __exportStar(channelsExposer, exports);
11232
+ } (openfinChannels));
11233
+
11234
+ (function (exports) {
11235
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11236
+ if (k2 === undefined) k2 = k;
11237
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11238
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11239
+ desc = { enumerable: true, get: function() { return m[k]; } };
11240
+ }
11241
+ Object.defineProperty(o, k2, desc);
11242
+ }) : (function(o, m, k, k2) {
11243
+ if (k2 === undefined) k2 = k;
11244
+ o[k2] = m[k];
11245
+ }));
11246
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
11247
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11248
+ };
11249
+ Object.defineProperty(exports, "__esModule", { value: true });
11250
+ __exportStar(openfinChannels, exports);
11251
+ } (strategies));
11252
+
11253
+ (function (exports) {
11254
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11255
+ if (k2 === undefined) k2 = k;
11256
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11257
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11258
+ desc = { enumerable: true, get: function() { return m[k]; } };
11259
+ }
11260
+ Object.defineProperty(o, k2, desc);
11261
+ }) : (function(o, m, k, k2) {
11262
+ if (k2 === undefined) k2 = k;
11263
+ o[k2] = m[k];
11264
+ }));
11265
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
11266
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11267
+ };
11268
+ Object.defineProperty(exports, "__esModule", { value: true });
11269
+ __exportStar(apiConsumer, exports);
11270
+ __exportStar(apiExposer, exports);
11271
+ __exportStar(strategies, exports);
11272
+ __exportStar(decorators, exports);
11273
+ } (apiExposer$1));
11274
+
11275
+ var channelApiRelay = {};
11276
+
11277
+ Object.defineProperty(channelApiRelay, "__esModule", { value: true });
11278
+ channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
11279
+ const EXPECTED_ERRORS = [
11280
+ 'no longer connected',
11281
+ 'RTCDataChannel closed unexpectedly',
11282
+ 'The client you are trying to dispatch from is disconnected from the target provider',
11283
+ ];
11284
+ // Checks possible error messages that we want to trap, client error message can originate
11285
+ // from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
11286
+ const isDisconnectedError = (errorMsg) => {
11287
+ return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
11288
+ };
11289
+ /**
11290
+ * @internal
11291
+ * Create a channel relay for a given channel exposition, allowing a single provider to route
11292
+ * actions to the designated clients.
11293
+ *
11294
+ * Designed to be used in conjunction with @expose
11295
+ *
11296
+ * @param channelProvider The channel provider to relay the actions on.
11297
+ * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
11298
+ */
11299
+ const relayChannelClientApi = async (channelProvider, relayId) => {
11300
+ channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
11301
+ return channelProvider.dispatch(target, action, payload);
11302
+ });
11303
+ await Promise.resolve();
11304
+ };
11305
+ channelApiRelay.relayChannelClientApi = relayChannelClientApi;
11306
+ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
11307
+ try {
11308
+ return await client.dispatch(`relay:${relayId}`, {
11309
+ action,
11310
+ payload,
11311
+ target
11526
11312
  });
11527
- const client = await this.getClient();
11528
- const manifest = await this.fetchManifest(manifestUrl);
11529
- client.dispatch('launch-into-platform', { manifest, manifestUrl });
11530
- return this;
11531
11313
  }
11532
- /**
11533
- * Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots.
11534
- * It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
11535
- * @param context - A field where serializable context data can be stored to be saved in platform snapshots.
11536
- * @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
11537
- * to the current window (if called from a Window) or the current host window (if called from a View).
11538
- *
11539
- * @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
11540
- * platform.
11541
- * This method can be called from the window itself, or from any child view. Context data is shared by all
11542
- * entities within a window.
11543
- *
11544
- * @example
11545
- * Setting own context:
11546
- * ```js
11547
- * const platform = fin.Platform.getCurrentSync();
11548
- * const contextData = {
11549
- * security: 'STOCK',
11550
- * currentView: 'detailed'
11551
- * }
11552
- *
11553
- * await platform.setWindowContext(contextData);
11554
- * // Context of current window is now set to `contextData`
11555
- * ```
11556
- *
11557
- * Setting the context of another window or view:
11558
- * ```js
11559
- * const platform = fin.Platform.getCurrentSync();
11560
- * const contextData = {
11561
- * security: 'STOCK',
11562
- * currentView: 'detailed'
11563
- * }
11564
- *
11565
- * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
11566
- * await platform.setWindowContext(contextData, windowOrViewIdentity);
11567
- * // Context of the target window or view is now set to `contextData`
11568
- * ```
11569
- *
11570
- * A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
11571
- * This event will fire when a host window's context is updated or when the view is reparented to a new window:
11572
- *
11573
- * ```js
11574
- * // From a view
11575
- * const contextChangeHandler = ({ context }) => {
11576
- * console.log('Host window\'s context has changed. New context data:', context);
11577
- * // react to new context data here
11578
- * }
11579
- * await fin.me.on('host-context-changed', contextChangeHandler);
11580
- *
11581
- * const platform = await fin.Platform.getCurrentSync();
11582
- * const contextData = {
11583
- * security: 'STOCK',
11584
- * currentView: 'detailed'
11585
- * }
11586
- * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
11587
- * ```
11588
- *
11589
- * To listen to a window's context updates, use the `context-changed` event:
11590
- * ```js
11591
- * // From a window
11592
- * const contextChangeHandler = ({ context }) => {
11593
- * console.log('This window\'s context has changed. New context data:', context);
11594
- * // react to new context data here
11595
- * }
11596
- * await fin.me.on('context-changed', contextChangeHandler);
11597
- *
11598
- * const platform = await fin.Platform.getCurrentSync();
11599
- * const contextData = {
11600
- * security: 'STOCK',
11601
- * currentView: 'detailed'
11602
- * }
11603
- * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
11604
- * ```
11605
- * @experimental
11606
- */
11607
- async setWindowContext(context = {}, target) {
11608
- this.wire.sendAction('platform-set-window-context', this.identity).catch((e) => {
11609
- // don't expose
11610
- });
11611
- if (!context) {
11612
- throw new Error('Please provide a serializable object or string to set the context.');
11314
+ catch (e) {
11315
+ if (isDisconnectedError(e.message) && relayErrorMsg) {
11316
+ throw new Error(relayErrorMsg);
11613
11317
  }
11614
- const client = await this.getClient();
11615
- const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
11616
- await client.dispatch('set-window-context', {
11617
- context,
11618
- entityType,
11619
- target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }
11620
- });
11318
+ throw e;
11621
11319
  }
11320
+ };
11321
+ channelApiRelay.createRelayedDispatch = createRelayedDispatch;
11322
+
11323
+ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11324
+ if (kind === "m") throw new TypeError("Private method is not writable");
11325
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11326
+ 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");
11327
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11328
+ };
11329
+ var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11330
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11331
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11332
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11333
+ };
11334
+ var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
11335
+ Object.defineProperty(layoutEntities, "__esModule", { value: true });
11336
+ layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
11337
+ const api_exposer_1 = apiExposer$1;
11338
+ const channel_api_relay_1 = channelApiRelay;
11339
+ /*
11340
+ This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
11341
+ intertwined, and share members via parent abstract class LayoutNode. To prevent circular
11342
+ refs, we define and export all the classes here.
11343
+ */
11344
+ /**
11345
+ * @ignore
11346
+ * @internal
11347
+ * Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
11348
+ * for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
11349
+ */
11350
+ class LayoutNode {
11622
11351
  /**
11623
- * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
11624
- * The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
11625
- * @param target - A target window or view may optionally be provided. If no target is provided, target will be
11626
- * the current window (if called from a Window) or the current host window (if called from a View).
11627
- *
11628
- * @remarks This method can be called from the window itself, or from any child view. Context data is shared
11629
- * by all entities within a window.
11630
- *
11631
- * @example
11632
- *
11633
- * Retrieving context from current window:
11634
- * ```js
11635
- * const platform = fin.Platform.getCurrentSync();
11636
- * const customContext = { answer: 42 };
11637
- * await platform.setWindowContext(customContext);
11638
- *
11639
- * const myContext = await platform.getWindowContext();
11640
- * console.log(myContext); // { answer: 42 }
11641
- * ```
11642
- *
11643
- * Retrieving the context of another window or view:
11644
- * ```js
11645
- * const platform = fin.Platform.getCurrentSync();
11646
- *
11647
- * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
11648
- *
11649
- * const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
11650
- * console.log(targetWindowContext); // context of target window
11651
- * ```
11652
- * @experimental
11352
+ * @internal
11353
+ * @ignore
11653
11354
  */
11654
- async getWindowContext(target) {
11655
- this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
11656
- // don't expose
11657
- });
11658
- const client = await this.getClient();
11659
- const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
11660
- return client.dispatch('get-window-context', {
11661
- target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name },
11662
- entityType
11663
- });
11355
+ constructor(client, entityId) {
11356
+ /**
11357
+ * @ignore
11358
+ * @internal
11359
+ * ApiClient for {@link LayoutEntitiesController}
11360
+ */
11361
+ _LayoutNode_client.set(this, void 0);
11362
+ /**
11363
+ * Checks if the TabStack or ColumnOrRow is the root content item
11364
+ *
11365
+ * @example
11366
+ * ```js
11367
+ * if (!fin.me.isView) {
11368
+ * throw new Error('Not running in a platform View.');
11369
+ * }
11370
+ *
11371
+ * const stack = await fin.me.getCurrentStack();
11372
+ * const isRoot = await stack.isRoot();
11373
+ * // The TabStack is root: false
11374
+ * console.log(`The TabStack is root: ${isRoot}`);
11375
+ *
11376
+ * // Retrieves the parent ColumnOrRow
11377
+ * const parent = await stack.getParent();
11378
+ * const parentIsRoot = await parent.isRoot();
11379
+ * // The parent ColumnOrRow is root: true
11380
+ * console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
11381
+ * ```
11382
+ */
11383
+ this.isRoot = () => __classPrivateFieldGet$5(this, _LayoutNode_client, "f").isRoot(this.entityId);
11384
+ /**
11385
+ * Checks if the TabStack or ColumnOrRow exists
11386
+ *
11387
+ * @example
11388
+ * ```js
11389
+ * if (!fin.me.isView) {
11390
+ * throw new Error('Not running in a platform View.');
11391
+ * }
11392
+ *
11393
+ * const stack = await fin.me.getCurrentStack();
11394
+ * // Retrieves the parent ColumnOrRow
11395
+ * const columnOrRow = await stack.getParent();
11396
+ * let exists = await stack.exists();
11397
+ * // or
11398
+ * let exists = await columnOrRow.exists();
11399
+ * // The entity exists: true
11400
+ * console.log(`The entity exists: ${exists}`);
11401
+ * ```
11402
+ */
11403
+ this.exists = () => __classPrivateFieldGet$5(this, _LayoutNode_client, "f").exists(this.entityId);
11404
+ /**
11405
+ * Retrieves the parent of the TabStack or ColumnOrRow
11406
+ *
11407
+ * @example
11408
+ * ```js
11409
+ * if (!fin.me.isView) {
11410
+ * throw new Error('Not running in a platform View.');
11411
+ * }
11412
+ *
11413
+ * const stack = await fin.me.getCurrentStack();
11414
+ * // Retrieves the parent ColumnOrRow
11415
+ * const columnOrRow = await stack.getParent();
11416
+ *
11417
+ * // undefined if entity is the root item
11418
+ * let parent = await columnOrRow.getParent();
11419
+ * // or
11420
+ * let parent = await stack.getParent();
11421
+ * ```
11422
+ */
11423
+ this.getParent = async () => {
11424
+ const parent = await __classPrivateFieldGet$5(this, _LayoutNode_client, "f").getParent(this.entityId);
11425
+ if (!parent) {
11426
+ return undefined;
11427
+ }
11428
+ return LayoutNode.getEntity(parent, __classPrivateFieldGet$5(this, _LayoutNode_client, "f"));
11429
+ };
11430
+ /**
11431
+ * Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
11432
+ *
11433
+ * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
11434
+ * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
11435
+ * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
11436
+ * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
11437
+ *
11438
+ * @param views The views that will populate the new TabStack.
11439
+ * @param options Additional options that control new TabStack creation.
11440
+ * @returns The newly-created TabStack.
11441
+ *
11442
+ * @example
11443
+ * ```js
11444
+ * if (!fin.me.isView) {
11445
+ * throw new Error('Not running in a platform View.');
11446
+ * }
11447
+ *
11448
+ * const stack = await fin.me.getCurrentStack();
11449
+ * const columnOrRow = await stack.getParent();
11450
+ *
11451
+ * // Create view references by supplying a 'name' and 'url'
11452
+ * const views = [
11453
+ * // if 'name' is undefined, one will be generated
11454
+ * // if 'url' is undefined, it will default the view URL to 'about:blank'
11455
+ * { name: 'google-view', url: 'http://google.com/'},
11456
+ * { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
11457
+ * ];
11458
+ *
11459
+ * // Create a view beforehand to be included in the new tab stack
11460
+ * const outsideView = await fin.View.create({
11461
+ * name: 'outside-bloomberg-view',
11462
+ * url: 'https://bloomberg.com/',
11463
+ * target: fin.me.identity,
11464
+ * });
11465
+ *
11466
+ * // Views to add can be identities, or the reference views mentioned above
11467
+ * const viewsToAdd = [outsideView.identity, ...views];
11468
+ *
11469
+ * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
11470
+ * let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
11471
+ * // Or
11472
+ * let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
11473
+ * console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
11474
+ *
11475
+ * ```
11476
+ * @experimental
11477
+ */
11478
+ this.createAdjacentStack = async (views, options) => {
11479
+ const entityId = await __classPrivateFieldGet$5(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
11480
+ return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$5(this, _LayoutNode_client, "f"));
11481
+ };
11482
+ /**
11483
+ * Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
11484
+ *
11485
+ * @param edge Edge whose adjacent TabStacks will be returned.
11486
+ *
11487
+ * @example
11488
+ * ```js
11489
+ * if (!fin.me.isView) {
11490
+ * throw new Error('Not running in a platform View.');
11491
+ * }
11492
+ *
11493
+ * const stack = await fin.me.getCurrentStack();
11494
+ * const columnOrRow = await stack.getParent();
11495
+ * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
11496
+ * let rightStacks = await columnOrRow.getAdjacentStacks('right');
11497
+ * let leftStacks = await columnOrRow.getAdjacentStacks('left');
11498
+ * // or
11499
+ * let rightStacks = await stack.getAdjacentStacks('right');
11500
+ * let leftStacks = await stack.getAdjacentStacks('left');
11501
+ *
11502
+ * console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
11503
+ *
11504
+ * ```
11505
+ * @experimental
11506
+ */
11507
+ this.getAdjacentStacks = async (edge) => {
11508
+ const adjacentStacks = await __classPrivateFieldGet$5(this, _LayoutNode_client, "f").getAdjacentStacks({
11509
+ targetId: this.entityId,
11510
+ edge
11511
+ });
11512
+ return adjacentStacks.map((stack) => LayoutNode.getEntity({
11513
+ type: 'stack',
11514
+ entityId: stack.entityId
11515
+ }, __classPrivateFieldGet$5(this, _LayoutNode_client, "f")));
11516
+ };
11517
+ __classPrivateFieldSet$4(this, _LayoutNode_client, client, "f");
11518
+ this.entityId = entityId;
11519
+ }
11520
+ }
11521
+ layoutEntities.LayoutNode = LayoutNode;
11522
+ _LayoutNode_client = new WeakMap();
11523
+ /**
11524
+ * @ignore
11525
+ * @internal
11526
+ * Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
11527
+ * @param client
11528
+ * @param controllerId
11529
+ * @param identity
11530
+ * @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
11531
+ */
11532
+ LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
11533
+ 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.');
11534
+ const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
11535
+ return consumer.consume({ id: controllerId });
11536
+ };
11537
+ LayoutNode.getEntity = (definition, client) => {
11538
+ const { entityId, type } = definition;
11539
+ switch (type) {
11540
+ case 'column':
11541
+ case 'row':
11542
+ return new ColumnOrRow(client, entityId, type);
11543
+ case 'stack':
11544
+ return new TabStack(client, entityId);
11545
+ default:
11546
+ throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
11547
+ }
11548
+ };
11549
+ /**
11550
+ * A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
11551
+ */
11552
+ class TabStack extends LayoutNode {
11553
+ /** @internal */
11554
+ constructor(client, entityId) {
11555
+ super(client, entityId);
11556
+ /**
11557
+ * @internal
11558
+ * ApiClient for {@link LayoutEntitiesController}
11559
+ */
11560
+ _TabStack_client.set(this, void 0);
11561
+ /**
11562
+ * Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
11563
+ */
11564
+ this.type = 'stack';
11565
+ /**
11566
+ * Retrieves a list of all views belonging to this {@link TabStack}.
11567
+ *
11568
+ * Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
11569
+ * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
11570
+ * If that happens and then getViews() is called, it will return the identities in a different order than
11571
+ * than the currently rendered tab order.
11572
+ *
11573
+ *
11574
+ * @throws If the {@link TabStack} has been destroyed.
11575
+ * @example
11576
+ * ```js
11577
+ * if (!fin.me.isView) {
11578
+ * throw new Error('Not running in a platform View.');
11579
+ * }
11580
+ *
11581
+ * const stack = await fin.me.getCurrentStack();
11582
+ * // Alternatively, you can wrap any view and get the stack from there
11583
+ * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
11584
+ * // const stack = await viewFromSomewhere.getCurrentStack();
11585
+ * const views = await stack.getViews();
11586
+ * console.log(`Stack contains ${views.length} view(s)`);
11587
+ * ```
11588
+ * @experimental
11589
+ */
11590
+ this.getViews = () => __classPrivateFieldGet$5(this, _TabStack_client, "f").getStackViews(this.entityId);
11591
+ /**
11592
+ * Adds or creates a view in this {@link TabStack}.
11593
+ *
11594
+ * @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
11595
+ * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
11596
+ *
11597
+ * @param view The identity of an existing view to add, or options to create a view.
11598
+ * @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
11599
+ * @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
11600
+ * @throws If the view does not exist or fails to create.
11601
+ * @throws If the {@link TabStack} has been destroyed.
11602
+ * @example
11603
+ * ```js
11604
+ * if (!fin.me.isView) {
11605
+ * throw new Error('Not running in a platform View.');
11606
+ * }
11607
+ *
11608
+ * const stack = await fin.me.getCurrentStack();
11609
+ * // Alternatively, you can wrap any view and get the stack from there
11610
+ * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
11611
+ * // const stack = await viewFromSomewhere.getCurrentStack();
11612
+ * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
11613
+ * console.log('Identity of the google view just added', { googleViewIdentity });
11614
+ * // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
11615
+ * const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
11616
+ * console.log('Identity of the apple view just added', { appleViewIdentity });
11617
+ * ```
11618
+ * @experimental
11619
+ */
11620
+ this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$5(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
11621
+ /**
11622
+ * Removes a view from this {@link TabStack}.
11623
+ *
11624
+ * @remarks Throws an exception if the view identity does not exist or was already destroyed.
11625
+ *
11626
+ * @param view - Identity of the view to remove.
11627
+ * @throws If the view does not exist or does not belong to the stack.
11628
+ * @throws If the {@link TabStack} has been destroyed.
11629
+ *
11630
+ * @example
11631
+ * ```js
11632
+ * if (!fin.me.isView) {
11633
+ * throw new Error('Not running in a platform View.');
11634
+ * }
11635
+ *
11636
+ * const stack = await fin.me.getCurrentStack();
11637
+ * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
11638
+ *
11639
+ * await stack.removeView(googleViewIdentity);
11640
+ *
11641
+ * try {
11642
+ * await stack.removeView(googleViewIdentity);
11643
+ * } catch (error) {
11644
+ * // Tried to remove a view ('google-view') which does not belong to the stack.
11645
+ * console.log(error);
11646
+ * }
11647
+ * ```
11648
+ */
11649
+ this.removeView = async (view) => {
11650
+ await __classPrivateFieldGet$5(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
11651
+ };
11652
+ /**
11653
+ * Sets the active view of the {@link TabStack} without focusing it.
11654
+ * @param view - Identity of the view to activate.
11655
+ * @returns Promise which resolves with void once the view has been activated.
11656
+ * @throws If the {@link TabStack} has been destroyed.
11657
+ * @throws If the view does not exist.
11658
+ * @example
11659
+ * Change the active tab of a known View's TabStack:
11660
+ * ```js
11661
+ * const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
11662
+ * const stack = await targetView.getCurrentStack();
11663
+ * await stack.setActiveView(targetView.identity);
11664
+ * ```
11665
+ *
11666
+ * Set the current View as active within its TabStack:
11667
+ * ```js
11668
+ * const stack = await fin.me.getCurrentStack();
11669
+ * await stack.setActiveView(fin.me.identity);
11670
+ * ```
11671
+ * @experimental
11672
+ */
11673
+ this.setActiveView = async (view) => {
11674
+ await __classPrivateFieldGet$5(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
11675
+ };
11676
+ __classPrivateFieldSet$4(this, _TabStack_client, client, "f");
11664
11677
  }
11678
+ }
11679
+ layoutEntities.TabStack = TabStack;
11680
+ _TabStack_client = new WeakMap();
11681
+ /**
11682
+ * A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
11683
+ */
11684
+ class ColumnOrRow extends LayoutNode {
11665
11685
  /**
11666
- * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
11667
- * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
11668
- * @param winId
11669
- * @param options
11670
- *
11671
- * @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
11672
- * it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
11673
- *
11674
- * @example
11675
- *
11676
- * ```js
11677
- * // Close the current Window inside a Window context
11678
- * const platform = await fin.Platform.getCurrent();
11679
- * platform.closeWindow(fin.me.identity);
11680
- *
11681
- * // Close the Window from inside a View context
11682
- * const platform = await fin.Platform.getCurrent();
11683
- * const parentWindow = await fin.me.getCurrentWindow();
11684
- * platform.closeWindow(parentWindow.identity);
11685
- *
11686
- * // Close the Window and do not fire the before unload handler on Views
11687
- * const platform = await fin.Platform.getCurrent();
11688
- * platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
11689
- * ```
11690
- * @experimental
11686
+ * @internal
11691
11687
  */
11692
- async closeWindow(windowId, options = { skipBeforeUnload: false }) {
11693
- this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
11694
- // don't expose
11695
- });
11696
- const client = await this.getClient();
11697
- return client.dispatch('close-window', { windowId, options });
11688
+ constructor(client, entityId, type) {
11689
+ super(client, entityId);
11690
+ /**
11691
+ * @ignore
11692
+ * @internal
11693
+ * ApiClient for {@link LayoutEntitiesController}
11694
+ */
11695
+ _ColumnOrRow_client.set(this, void 0);
11696
+ /**
11697
+ * Retrieves the content array of the ColumnOrRow
11698
+ *
11699
+ * @example
11700
+ * ```js
11701
+ * if (!fin.me.isView) {
11702
+ * throw new Error('Not running in a platform View.');
11703
+ * }
11704
+ *
11705
+ * const stack = await fin.me.getCurrentStack();
11706
+ * // Retrieves the parent ColumnOrRow
11707
+ * const columnOrRow = await stack.getParent();
11708
+ *
11709
+ * // returns [TabStack]
11710
+ * const contentArray = await columnOrRow.getContent();
11711
+ * console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
11712
+ * ```
11713
+ */
11714
+ this.getContent = async () => {
11715
+ const contentItemEntities = await __classPrivateFieldGet$5(this, _ColumnOrRow_client, "f").getContent(this.entityId);
11716
+ return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$5(this, _ColumnOrRow_client, "f")));
11717
+ };
11718
+ __classPrivateFieldSet$4(this, _ColumnOrRow_client, client, "f");
11719
+ this.type = type;
11698
11720
  }
11699
11721
  }
11700
- Instance$2.Platform = Platform;
11701
- _Platform_connectToProvider = new WeakMap();
11702
-
11703
- var layout = {};
11704
-
11705
- var Factory$2 = {};
11706
-
11707
- var Instance$1 = {};
11722
+ layoutEntities.ColumnOrRow = ColumnOrRow;
11723
+ _ColumnOrRow_client = new WeakMap();
11708
11724
 
11709
- var commonUtils = {};
11725
+ var layout_constants = {};
11710
11726
 
11711
- Object.defineProperty(commonUtils, "__esModule", { value: true });
11712
- commonUtils.overrideFromComposables = commonUtils.isValidPresetType = void 0;
11713
- function isValidPresetType(type) {
11714
- switch (type) {
11715
- case 'columns':
11716
- case 'grid':
11717
- case 'rows':
11718
- case 'tabs':
11719
- return true;
11720
- default:
11721
- return false;
11722
- }
11723
- }
11724
- commonUtils.isValidPresetType = isValidPresetType;
11725
- function overrideFromComposables(...overrides) {
11726
- return (base) => overrides.reduceRight((p, c) => (b) => c(p(b)), (x) => x)(base);
11727
- }
11728
- commonUtils.overrideFromComposables = overrideFromComposables;
11729
- commonUtils.default = { isValidPresetType };
11727
+ Object.defineProperty(layout_constants, "__esModule", { value: true });
11728
+ layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
11729
+ layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
11730
+ // TODO: eventually export this somehow
11731
+ layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
11730
11732
 
11731
11733
  var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11732
11734
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
@@ -11875,6 +11877,12 @@ const layout_constants_1$1 = layout_constants;
11875
11877
  * ```
11876
11878
  */
11877
11879
  class Layout extends base_1$5.Base {
11880
+ /**
11881
+ * @internal
11882
+ */
11883
+ static getClient(layout) {
11884
+ return __classPrivateFieldGet$4(layout, _Layout_layoutClient, "f").getValue();
11885
+ }
11878
11886
  /**
11879
11887
  * @internal
11880
11888
  */
@@ -12099,6 +12107,27 @@ class Layout extends base_1$5.Base {
12099
12107
  const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
12100
12108
  return layout_entities_1.LayoutNode.getEntity(root, client);
12101
12109
  }
12110
+ /**
12111
+ * Retrieves the OpenFin.TabStack instance which the View belongs to.
12112
+ *
12113
+ * @example
12114
+ * ```js
12115
+ * const viewIdentity = { uuid: 'uuid', name: 'view-name' };
12116
+ * const stack = await fin.View.wrapSync(viewIdentity).getStackByViewIdentity(viewIdentity);
12117
+ * console.log(await stack.getViews());
12118
+ * ```
12119
+ */
12120
+ async getStackByViewIdentity(identity) {
12121
+ this.wire.sendAction('layout-get-stack-by-view').catch(() => {
12122
+ // don't expose
12123
+ });
12124
+ const client = await __classPrivateFieldGet$4(this, _Layout_layoutClient, "f").getValue();
12125
+ const stack = await client.getStackByView(identity);
12126
+ if (!stack) {
12127
+ throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
12128
+ }
12129
+ return layout_entities_1.LayoutNode.getEntity(stack, client);
12130
+ }
12102
12131
  }
12103
12132
  Instance$1.Layout = Layout;
12104
12133
  _Layout_layoutClient = new WeakMap();
@@ -12292,7 +12321,7 @@ class LayoutModule extends base_1$4.Base {
12292
12321
  this.wire.sendAction('layout-get-current').catch((e) => {
12293
12322
  // don't expose
12294
12323
  });
12295
- if (!this.fin.me.isWindow) {
12324
+ if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
12296
12325
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
12297
12326
  }
12298
12327
  const { uuid, name } = this.fin.me;
@@ -12315,12 +12344,50 @@ class LayoutModule extends base_1$4.Base {
12315
12344
  this.wire.sendAction('layout-get-current-sync').catch((e) => {
12316
12345
  // don't expose
12317
12346
  });
12318
- if (!this.fin.me.isWindow) {
12347
+ if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
12319
12348
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
12320
12349
  }
12321
12350
  const { uuid, name } = this.fin.me;
12322
12351
  return this.wrapSync({ uuid, name });
12323
12352
  }
12353
+ /**
12354
+ * Retrieves the OpenFin.Layout instance for the Window the View is attached to.
12355
+ *
12356
+ * @example
12357
+ * ```js
12358
+ * const viewIdentity = { uuid: 'uuid', name: 'view-name' };
12359
+ * const layout = await fin.Platform.Layout.getLayoutByViewIdentity(viewIdentity);
12360
+ * console.log(await layout.getCurrentViews());
12361
+ * ```
12362
+ */
12363
+ async getLayoutByViewIdentity(viewIdentity) {
12364
+ this.wire.sendAction('layout-get-by-view-identity').catch(() => {
12365
+ // don't expose
12366
+ });
12367
+ const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
12368
+ let layoutWindowIdentity = winIdentity;
12369
+ // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
12370
+ if (layoutWindowIdentity.identity) {
12371
+ layoutWindowIdentity = layoutWindowIdentity.identity;
12372
+ }
12373
+ try {
12374
+ const layoutWindow = this.wrapSync(layoutWindowIdentity);
12375
+ const client = await Instance_1$2.Layout.getClient(layoutWindow);
12376
+ const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(viewIdentity);
12377
+ return this.wrapSync(layoutIdentity);
12378
+ }
12379
+ catch (e) {
12380
+ const allowedErrors = [
12381
+ 'No action registered at target for',
12382
+ 'getLayoutIdentityForViewOrThrow is not a function'
12383
+ ];
12384
+ if (!allowedErrors.some((m) => e.message.includes(m))) {
12385
+ throw e;
12386
+ }
12387
+ // fallback logic for missing endpoint in older runtimes
12388
+ return this.wrapSync(layoutWindowIdentity);
12389
+ }
12390
+ }
12324
12391
  }
12325
12392
  Factory$2.LayoutModule = LayoutModule;
12326
12393
  _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
@@ -13307,13 +13374,16 @@ function requireInteropBroker () {
13307
13374
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13308
13375
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13309
13376
  };
13377
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
13378
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13379
+ };
13310
13380
  var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
13311
13381
  Object.defineProperty(InteropBroker, "__esModule", { value: true });
13312
13382
  InteropBroker.InteropBroker = void 0;
13313
13383
  const base_1 = base;
13314
- const SessionContextGroupBroker_1 = requireSessionContextGroupBroker();
13384
+ const SessionContextGroupBroker_1 = __importDefault(requireSessionContextGroupBroker());
13315
13385
  const utils_1 = utils$3;
13316
- const lodash_1 = require$$3;
13386
+ const isEqual_1 = __importDefault(require$$3);
13317
13387
  const PrivateChannelProvider_1 = requirePrivateChannelProvider();
13318
13388
  const lazy_1 = lazy;
13319
13389
  const defaultContextGroups = [
@@ -13511,7 +13581,7 @@ function requireInteropBroker () {
13511
13581
  constructor(...unused) {
13512
13582
  if (unused.length) {
13513
13583
  const [_ignore1, ignore2, opts] = unused;
13514
- if (opts && typeof opts === 'object' && !(0, lodash_1.isEqual)(opts, args[2])) {
13584
+ if (opts && typeof opts === 'object' && !(0, isEqual_1.default)(opts, args[2])) {
13515
13585
  // eslint-disable-next-line no-console
13516
13586
  console.warn('You have modified the parameters of the InteropOverride constructor. This behavior is deprecated and will be removed in a future version. You can modify these options in your manifest. Please consult our Interop docs for guidance on migrating to the new override scheme.');
13517
13587
  super(args[0], args[1], opts);
@@ -14688,9 +14758,32 @@ var utils$2 = {};
14688
14758
 
14689
14759
  var PrivateChannelClient$1 = {};
14690
14760
 
14761
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14762
+ if (k2 === undefined) k2 = k;
14763
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14764
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14765
+ desc = { enumerable: true, get: function() { return m[k]; } };
14766
+ }
14767
+ Object.defineProperty(o, k2, desc);
14768
+ }) : (function(o, m, k, k2) {
14769
+ if (k2 === undefined) k2 = k;
14770
+ o[k2] = m[k];
14771
+ }));
14772
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
14773
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14774
+ }) : function(o, v) {
14775
+ o["default"] = v;
14776
+ });
14777
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
14778
+ if (mod && mod.__esModule) return mod;
14779
+ var result = {};
14780
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
14781
+ __setModuleDefault(result, mod);
14782
+ return result;
14783
+ };
14691
14784
  Object.defineProperty(PrivateChannelClient$1, "__esModule", { value: true });
14692
14785
  PrivateChannelClient$1.PrivateChannelClient = void 0;
14693
- const utils$1 = utils$3;
14786
+ const utils$1 = __importStar(utils$3);
14694
14787
  class PrivateChannelClient {
14695
14788
  constructor(client, id) {
14696
14789
  this.id = id;
@@ -14779,11 +14872,14 @@ class PrivateChannelClient {
14779
14872
  PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
14780
14873
 
14781
14874
  (function (exports) {
14875
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
14876
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14877
+ };
14782
14878
  Object.defineProperty(exports, "__esModule", { value: true });
14783
14879
  exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
14784
14880
  const utils_1 = utils$3;
14785
14881
  const PrivateChannelClient_1 = PrivateChannelClient$1;
14786
- const lodash_1 = require$$3;
14882
+ const isEqual_1 = __importDefault(require$$3);
14787
14883
  const getUnsupportedChannelApis = (channelType) => {
14788
14884
  return {
14789
14885
  addContextListener: () => {
@@ -14911,7 +15007,7 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
14911
15007
  const wrappedHandler = (context, contextMetadata) => {
14912
15008
  if (first) {
14913
15009
  first = false;
14914
- if ((0, lodash_1.isEqual)(currentContext, context)) {
15010
+ if ((0, isEqual_1.default)(currentContext, context)) {
14915
15011
  return;
14916
15012
  }
14917
15013
  }
@@ -15033,13 +15129,16 @@ function requireFdc3Common () {
15033
15129
  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");
15034
15130
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15035
15131
  };
15132
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15133
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15134
+ };
15036
15135
  var _FDC3ModuleBase_producer;
15037
15136
  Object.defineProperty(fdc3Common, "__esModule", { value: true });
15038
15137
  fdc3Common.FDC3ModuleBase = void 0;
15039
15138
  const utils_1 = utils$2;
15040
15139
  const utils_2 = utils$3;
15041
15140
  const InteropClient_1 = requireInteropClient();
15042
- const lodash_1 = require$$3;
15141
+ const isEqual_1 = __importDefault(require$$3);
15043
15142
  class FDC3ModuleBase {
15044
15143
  get client() {
15045
15144
  return __classPrivateFieldGet(this, _FDC3ModuleBase_producer, "f").call(this);
@@ -15228,7 +15327,7 @@ function requireFdc3Common () {
15228
15327
  const wrappedHandler = (context, contextMetadata) => {
15229
15328
  if (first) {
15230
15329
  first = false;
15231
- if ((0, lodash_1.isEqual)(currentContext, context)) {
15330
+ if ((0, isEqual_1.default)(currentContext, context)) {
15232
15331
  return;
15233
15332
  }
15234
15333
  }
@@ -15841,11 +15940,14 @@ function requireInteropClient () {
15841
15940
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
15842
15941
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15843
15942
  };
15943
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15944
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15945
+ };
15844
15946
  var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
15845
15947
  Object.defineProperty(InteropClient, "__esModule", { value: true });
15846
15948
  InteropClient.InteropClient = void 0;
15847
15949
  const base_1 = base;
15848
- const SessionContextGroupClient_1 = SessionContextGroupClient$1;
15950
+ const SessionContextGroupClient_1 = __importDefault(SessionContextGroupClient$1);
15849
15951
  const fdc3_1_2_1 = requireFdc31_2();
15850
15952
  const fdc3_2_0_1 = requireFdc32_0();
15851
15953
  const utils_1 = utils$3;
@@ -16485,9 +16587,12 @@ var hasRequiredFactory;
16485
16587
  function requireFactory () {
16486
16588
  if (hasRequiredFactory) return Factory$1;
16487
16589
  hasRequiredFactory = 1;
16590
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
16591
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16592
+ };
16488
16593
  Object.defineProperty(Factory$1, "__esModule", { value: true });
16489
16594
  Factory$1.InteropModule = void 0;
16490
- const lodash_1 = require$$3;
16595
+ const cloneDeep_1 = __importDefault(require$$0$1);
16491
16596
  const inaccessibleObject_1 = inaccessibleObject;
16492
16597
  const base_1 = base;
16493
16598
  const InteropBroker_1 = requireInteropBroker();
@@ -16524,7 +16629,7 @@ function requireFactory () {
16524
16629
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
16525
16630
  const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
16526
16631
  const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
16527
- const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(options));
16632
+ const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, cloneDeep_1.default)(options));
16528
16633
  const getProvider = () => {
16529
16634
  return this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
16530
16635
  };
@@ -17081,13 +17186,16 @@ var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFie
17081
17186
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
17082
17187
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17083
17188
  };
17189
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
17190
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17191
+ };
17084
17192
  var _Transport_wire, _Transport_fin;
17085
17193
  Object.defineProperty(transport, "__esModule", { value: true });
17086
17194
  var Transport_1 = transport.Transport = void 0;
17087
17195
  const events_1$1 = require$$0;
17088
17196
  const wire_1 = wire;
17089
17197
  const transport_errors_1 = transportErrors;
17090
- const eventAggregator_1 = eventAggregator;
17198
+ const eventAggregator_1 = __importDefault(eventAggregator);
17091
17199
  const me_1$1 = me;
17092
17200
  const errors_1 = errors;
17093
17201
  class Transport extends events_1$1.EventEmitter {
@@ -17314,6 +17422,9 @@ class MockEnvironment {
17314
17422
  async getInteropInfo() {
17315
17423
  throw new Error(me_1.environmentUnsupportedMessage);
17316
17424
  }
17425
+ async getViewWindowIdentity() {
17426
+ throw new Error(me_1.environmentUnsupportedMessage);
17427
+ }
17317
17428
  getDefaultChannelOptions() {
17318
17429
  throw new Error(me_1.environmentUnsupportedMessage);
17319
17430
  }