@openfin/remote-adapter 39.83.3 → 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.
Files changed (2) hide show
  1. package/out/remote-adapter.js +1312 -1225
  2. package/package.json +2 -2
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var require$$3 = require('lodash');
4
- var require$$0 = require('events');
3
+ var require$$0 = require('lodash/cloneDeep');
4
+ var require$$3 = require('lodash/isEqual');
5
+ var require$$0$1 = require('events');
5
6
  var bridge = require('./bridge-ef11968f.js');
6
7
  var crypto = require('crypto');
7
8
  var backchannel = require('./backchannel.js');
@@ -525,9 +526,32 @@ var utils$2 = {};
525
526
 
526
527
  var PrivateChannelClient$1 = {};
527
528
 
529
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
530
+ if (k2 === undefined) k2 = k;
531
+ var desc = Object.getOwnPropertyDescriptor(m, k);
532
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
533
+ desc = { enumerable: true, get: function() { return m[k]; } };
534
+ }
535
+ Object.defineProperty(o, k2, desc);
536
+ }) : (function(o, m, k, k2) {
537
+ if (k2 === undefined) k2 = k;
538
+ o[k2] = m[k];
539
+ }));
540
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
541
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
542
+ }) : function(o, v) {
543
+ o["default"] = v;
544
+ });
545
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
546
+ if (mod && mod.__esModule) return mod;
547
+ var result = {};
548
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
549
+ __setModuleDefault(result, mod);
550
+ return result;
551
+ };
528
552
  Object.defineProperty(PrivateChannelClient$1, "__esModule", { value: true });
529
553
  PrivateChannelClient$1.PrivateChannelClient = void 0;
530
- const utils$1 = utils$3;
554
+ const utils$1 = __importStar(utils$3);
531
555
  class PrivateChannelClient {
532
556
  constructor(client, id) {
533
557
  this.id = id;
@@ -616,11 +640,14 @@ class PrivateChannelClient {
616
640
  PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
617
641
 
618
642
  (function (exports) {
643
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
644
+ return (mod && mod.__esModule) ? mod : { "default": mod };
645
+ };
619
646
  Object.defineProperty(exports, "__esModule", { value: true });
620
647
  exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
621
648
  const utils_1 = utils$3;
622
649
  const PrivateChannelClient_1 = PrivateChannelClient$1;
623
- const lodash_1 = require$$3;
650
+ const isEqual_1 = __importDefault(require$$3);
624
651
  const getUnsupportedChannelApis = (channelType) => {
625
652
  return {
626
653
  addContextListener: () => {
@@ -748,7 +775,7 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
748
775
  const wrappedHandler = (context, contextMetadata) => {
749
776
  if (first) {
750
777
  first = false;
751
- if ((0, lodash_1.isEqual)(currentContext, context)) {
778
+ if ((0, isEqual_1.default)(currentContext, context)) {
752
779
  return;
753
780
  }
754
781
  }
@@ -870,13 +897,16 @@ function requireFdc3Common () {
870
897
  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");
871
898
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
872
899
  };
900
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
901
+ return (mod && mod.__esModule) ? mod : { "default": mod };
902
+ };
873
903
  var _FDC3ModuleBase_producer;
874
904
  Object.defineProperty(fdc3Common, "__esModule", { value: true });
875
905
  fdc3Common.FDC3ModuleBase = void 0;
876
906
  const utils_1 = utils$2;
877
907
  const utils_2 = utils$3;
878
908
  const InteropClient_1 = requireInteropClient();
879
- const lodash_1 = require$$3;
909
+ const isEqual_1 = __importDefault(require$$3);
880
910
  class FDC3ModuleBase {
881
911
  get client() {
882
912
  return __classPrivateFieldGet(this, _FDC3ModuleBase_producer, "f").call(this);
@@ -1065,7 +1095,7 @@ function requireFdc3Common () {
1065
1095
  const wrappedHandler = (context, contextMetadata) => {
1066
1096
  if (first) {
1067
1097
  first = false;
1068
- if ((0, lodash_1.isEqual)(currentContext, context)) {
1098
+ if ((0, isEqual_1.default)(currentContext, context)) {
1069
1099
  return;
1070
1100
  }
1071
1101
  }
@@ -1678,11 +1708,14 @@ function requireInteropClient () {
1678
1708
  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");
1679
1709
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1680
1710
  };
1711
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1712
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1713
+ };
1681
1714
  var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
1682
1715
  Object.defineProperty(InteropClient, "__esModule", { value: true });
1683
1716
  InteropClient.InteropClient = void 0;
1684
1717
  const base_1 = base;
1685
- const SessionContextGroupClient_1 = SessionContextGroupClient$1;
1718
+ const SessionContextGroupClient_1 = __importDefault(SessionContextGroupClient$1);
1686
1719
  const fdc3_1_2_1 = requireFdc31_2();
1687
1720
  const fdc3_2_0_1 = requireFdc32_0();
1688
1721
  const utils_1 = utils$3;
@@ -2300,9 +2333,12 @@ var hasRequiredFactory$3;
2300
2333
  function requireFactory$3 () {
2301
2334
  if (hasRequiredFactory$3) return Factory$8;
2302
2335
  hasRequiredFactory$3 = 1;
2336
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
2337
+ return (mod && mod.__esModule) ? mod : { "default": mod };
2338
+ };
2303
2339
  Object.defineProperty(Factory$8, "__esModule", { value: true });
2304
2340
  Factory$8.InteropModule = void 0;
2305
- const lodash_1 = require$$3;
2341
+ const cloneDeep_1 = __importDefault(require$$0);
2306
2342
  const inaccessibleObject_1 = inaccessibleObject;
2307
2343
  const base_1 = base;
2308
2344
  const InteropBroker_1 = requireInteropBroker();
@@ -2339,7 +2375,7 @@ function requireFactory$3 () {
2339
2375
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
2340
2376
  const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
2341
2377
  const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
2342
- const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(options));
2378
+ const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, cloneDeep_1.default)(options));
2343
2379
  const getProvider = () => {
2344
2380
  return this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
2345
2381
  };
@@ -2905,13 +2941,16 @@ function requireInteropBroker () {
2905
2941
  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");
2906
2942
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2907
2943
  };
2944
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
2945
+ return (mod && mod.__esModule) ? mod : { "default": mod };
2946
+ };
2908
2947
  var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
2909
2948
  Object.defineProperty(InteropBroker, "__esModule", { value: true });
2910
2949
  InteropBroker.InteropBroker = void 0;
2911
2950
  const base_1 = base;
2912
- const SessionContextGroupBroker_1 = requireSessionContextGroupBroker();
2951
+ const SessionContextGroupBroker_1 = __importDefault(requireSessionContextGroupBroker());
2913
2952
  const utils_1 = utils$3;
2914
- const lodash_1 = require$$3;
2953
+ const isEqual_1 = __importDefault(require$$3);
2915
2954
  const PrivateChannelProvider_1 = requirePrivateChannelProvider();
2916
2955
  const lazy_1 = lazy;
2917
2956
  const defaultContextGroups = [
@@ -3109,7 +3148,7 @@ function requireInteropBroker () {
3109
3148
  constructor(...unused) {
3110
3149
  if (unused.length) {
3111
3150
  const [_ignore1, ignore2, opts] = unused;
3112
- if (opts && typeof opts === 'object' && !(0, lodash_1.isEqual)(opts, args[2])) {
3151
+ if (opts && typeof opts === 'object' && !(0, isEqual_1.default)(opts, args[2])) {
3113
3152
  // eslint-disable-next-line no-console
3114
3153
  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.');
3115
3154
  super(args[0], args[1], opts);
@@ -4234,6 +4273,10 @@ Object.defineProperty(baseEnv, "__esModule", { value: true });
4234
4273
  baseEnv.BaseEnvironment = void 0;
4235
4274
  const overrideCheck_1 = requireOverrideCheck();
4236
4275
  class BaseEnvironment {
4276
+ async getViewWindowIdentity(fin, viewIdentity) {
4277
+ const { identity } = await fin.View.wrapSync(viewIdentity).getCurrentWindow();
4278
+ return identity;
4279
+ }
4237
4280
  async getInteropInfo(fin) {
4238
4281
  const appInfo = await fin.Application.getCurrentSync()
4239
4282
  .getInfo()
@@ -4464,7 +4507,7 @@ var emitterMap = {};
4464
4507
 
4465
4508
  Object.defineProperty(emitterMap, "__esModule", { value: true });
4466
4509
  emitterMap.EmitterMap = void 0;
4467
- const events_1$6 = require$$0;
4510
+ const events_1$6 = require$$0$1;
4468
4511
  class EmitterMap {
4469
4512
  constructor() {
4470
4513
  this.storage = new Map();
@@ -4641,7 +4684,9 @@ function requireFactory$2 () {
4641
4684
  * @experimental
4642
4685
  */
4643
4686
  async wrap(identity) {
4644
- this.wire.sendAction('view-wrap');
4687
+ this.wire.sendAction('view-wrap').catch((e) => {
4688
+ // we do not want to expose this error, just continue if this analytics-only call fails
4689
+ });
4645
4690
  const errorMsg = (0, validate_1.validateIdentity)(identity);
4646
4691
  if (errorMsg) {
4647
4692
  throw new Error(errorMsg);
@@ -4722,902 +4767,238 @@ function requireFactory$2 () {
4722
4767
 
4723
4768
  var Instance$7 = {};
4724
4769
 
4725
- var layoutEntities = {};
4726
-
4727
- var apiExposer$1 = {};
4728
-
4729
- var apiConsumer = {};
4730
-
4731
- Object.defineProperty(apiConsumer, "__esModule", { value: true });
4732
- apiConsumer.ApiConsumer = void 0;
4733
- /**
4734
- * Consumer for apis exposed with {@see ApiExposer}.
4735
- *
4736
- * A strategy that matches the strategy used to expose a target API must be provided.
4737
- */
4738
- class ApiConsumer {
4739
- // eslint-disable-next-line
4740
- constructor(strategy) {
4741
- this.strategy = strategy;
4742
- /**
4743
- * Consumes an api exposed using a given transport strategy, and generates a client
4744
- * for easy, type safe consumption of that client.
4745
- * @param options Strategy specific consumption options.
4746
- * @returns An api client matching the given type.
4747
- */
4748
- this.consume = async (options) => {
4749
- const exposedProperties = await this.strategy.getExposedFunctions(options);
4750
- return exposedProperties.reduce((client, prop) => ({
4751
- ...client,
4752
- [prop.key]: this.strategy.createFunction(prop, options)
4753
- }), {});
4754
- };
4755
- }
4756
- }
4757
- apiConsumer.ApiConsumer = ApiConsumer;
4758
-
4759
- var apiExposer = {};
4760
-
4761
- var decorators = {};
4762
-
4763
- Object.defineProperty(decorators, "__esModule", { value: true });
4764
- decorators.expose = decorators.getExposedProperties = void 0;
4765
- const exposedProperties = Symbol('exposedProperties');
4766
- const getExposedProperties = (target) => {
4767
- return target[exposedProperties] || target.prototype[exposedProperties] || [];
4768
- };
4769
- decorators.getExposedProperties = getExposedProperties;
4770
- /**
4771
- * Indicates that a class member function can be exposed using {@link ApiExposer}.
4772
- * @param options Options specific to the strategy used in {@link ApiExposer}
4773
- */
4774
- // Returns any as decorator typing is weird.
4775
- const expose = (options) => (target, key, descriptor) => {
4776
- target[exposedProperties] = target[exposedProperties] || [];
4777
- target[exposedProperties].push({ key, descriptor, options });
4778
- };
4779
- decorators.expose = expose;
4770
+ var main = {};
4780
4771
 
4781
- Object.defineProperty(apiExposer, "__esModule", { value: true });
4782
- apiExposer.ApiExposer = void 0;
4783
- const decorators_1 = decorators;
4784
- /**
4785
- * Exposes api services on the transport of choice.
4786
- */
4787
- class ApiExposer {
4772
+ Object.defineProperty(main, "__esModule", { value: true });
4773
+ main.WebContents = void 0;
4774
+ const base_1$i = base;
4775
+ class WebContents extends base_1$i.EmitterBase {
4788
4776
  /**
4789
- * @param strategy The expose strategy to use to expose instances.
4777
+ * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
4778
+ * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
4790
4779
  */
4791
- // eslint-disable-next-line
4792
- constructor(strategy) {
4793
- this.strategy = strategy;
4794
- /**
4795
- * Exposes an instance of a given api on
4796
- * @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
4797
- * @param instanceOptions Transport strategy specific options to use when exposing.
4798
- */
4799
- this.exposeInstance = async (instance, instanceOptions) => {
4800
- const exposableProps = (0, decorators_1.getExposedProperties)(instance);
4801
- const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
4802
- const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
4803
- key,
4804
- options,
4805
- meta: instanceOptions
4806
- });
4807
- return {
4808
- key,
4809
- options: customConsumptionOptions
4810
- };
4811
- }));
4812
- await this.strategy.exposeMeta(instanceOptions, exposedProps);
4813
- };
4780
+ constructor(wire, identity, entityType) {
4781
+ super(wire, entityType, identity.uuid, identity.name);
4782
+ this.identity = identity;
4783
+ this.entityType = entityType;
4814
4784
  }
4815
- ;
4816
- }
4817
- apiExposer.ApiExposer = ApiExposer;
4818
-
4819
- var strategies = {};
4820
-
4821
- var openfinChannels = {};
4822
-
4823
- var channelsConsumer = {};
4824
-
4825
- Object.defineProperty(channelsConsumer, "__esModule", { value: true });
4826
- channelsConsumer.ChannelsConsumer = void 0;
4827
- class ChannelsConsumer {
4828
- // eslint-disable-next-line
4829
- constructor(channel) {
4830
- this.channel = channel;
4831
- this.getExposedFunctions = async (options) => {
4832
- const { id } = options;
4833
- const { props } = await this.channel.dispatch(`api-meta:${id}`);
4834
- return props;
4835
- };
4836
- this.createFunction = (prop) => (...args) => {
4837
- const { action } = prop.options;
4838
- return this.channel.dispatch(action, { args });
4839
- };
4785
+ /**
4786
+ * Gets a base64 encoded image of all or part of the WebContents.
4787
+ * @param options Options for the capturePage call.
4788
+ *
4789
+ * @example
4790
+ *
4791
+ * View:
4792
+ * ```js
4793
+ * const view = fin.View.getCurrentSync();
4794
+ *
4795
+ * // PNG image of a full visible View
4796
+ * console.log(await view.capturePage());
4797
+ *
4798
+ * // Low-quality JPEG image of a defined visible area of the view
4799
+ * const options = {
4800
+ * area: {
4801
+ * height: 100,
4802
+ * width: 100,
4803
+ * x: 10,
4804
+ * y: 10,
4805
+ * },
4806
+ * format: 'jpg',
4807
+ * quality: 20
4808
+ * }
4809
+ * console.log(await view.capturePage(options));
4810
+ * ```
4811
+ *
4812
+ * Window:
4813
+ * ```js
4814
+ * const wnd = await fin.Window.getCurrent();
4815
+ *
4816
+ * // PNG image of a full visible window
4817
+ * console.log(await wnd.capturePage());
4818
+ *
4819
+ * // Low-quality JPEG image of a defined visible area of the window
4820
+ * const options = {
4821
+ * area: {
4822
+ * height: 100,
4823
+ * width: 100,
4824
+ * x: 10,
4825
+ * y: 10,
4826
+ * },
4827
+ * format: 'jpg',
4828
+ * quality: 20
4829
+ * }
4830
+ * console.log(await wnd.capturePage(options));
4831
+ * ```
4832
+ *
4833
+ * @remarks
4834
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
4835
+ * We do not expose an explicit superclass for this functionality, but it does have its own
4836
+ * {@link OpenFin.WebContentsEvents event namespace}.
4837
+ */
4838
+ capturePage(options) {
4839
+ return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
4840
4840
  }
4841
- ;
4842
- }
4843
- channelsConsumer.ChannelsConsumer = ChannelsConsumer;
4844
-
4845
- var channelsExposer = {};
4846
-
4847
- Object.defineProperty(channelsExposer, "__esModule", { value: true });
4848
- channelsExposer.ChannelsExposer = void 0;
4849
- class ChannelsExposer {
4850
- // eslint-disable-next-line
4851
- constructor(channelProviderOrClient) {
4852
- this.channelProviderOrClient = channelProviderOrClient;
4853
- this.exposeFunction = async (target, config) => {
4854
- const { key, options, meta } = config;
4855
- const { id } = meta;
4856
- const action = `${id}.${options?.action || key}`;
4857
- await this.channelProviderOrClient.register(action, async ({ args }) => {
4858
- return target(...args);
4859
- });
4860
- return { action };
4861
- };
4862
- this.exposeMeta = async ({ id }, props) => {
4863
- const action = `api-meta:${id}`;
4864
- await this.channelProviderOrClient.register(action, () => ({ props }));
4865
- };
4841
+ /**
4842
+ * Executes Javascript on the WebContents, restricted to contents you own or contents owned by
4843
+ * applications you have created.
4844
+ * @param code JavaScript code to be executed on the view.
4845
+ *
4846
+ * @example
4847
+ * View:
4848
+ * ```js
4849
+ * async function executeJavaScript(code) {
4850
+ * const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
4851
+ * return await view.executeJavaScript(code);
4852
+ * }
4853
+ *
4854
+ * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
4855
+ * ```
4856
+ *
4857
+ * Window:
4858
+ * ```js
4859
+ * async function executeJavaScript(code) {
4860
+ * const app = await fin.Application.start({
4861
+ * name: 'myApp',
4862
+ * uuid: 'app-1',
4863
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
4864
+ * autoShow: true
4865
+ * });
4866
+ * const win = await app.getWindow();
4867
+ * return await win.executeJavaScript(code);
4868
+ * }
4869
+ *
4870
+ * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
4871
+ * ```
4872
+ * @remarks
4873
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
4874
+ * We do not expose an explicit superclass for this functionality, but it does have its own
4875
+ * {@link OpenFin.WebContentsEvents event namespace}.
4876
+ */
4877
+ executeJavaScript(code) {
4878
+ return this.wire
4879
+ .sendAction('execute-javascript-in-window', { ...this.identity, code })
4880
+ .then(({ payload }) => payload.data);
4866
4881
  }
4867
- }
4868
- channelsExposer.ChannelsExposer = ChannelsExposer;
4869
-
4870
- (function (exports) {
4871
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4872
- if (k2 === undefined) k2 = k;
4873
- var desc = Object.getOwnPropertyDescriptor(m, k);
4874
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4875
- desc = { enumerable: true, get: function() { return m[k]; } };
4876
- }
4877
- Object.defineProperty(o, k2, desc);
4878
- }) : (function(o, m, k, k2) {
4879
- if (k2 === undefined) k2 = k;
4880
- o[k2] = m[k];
4881
- }));
4882
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4883
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4884
- };
4885
- Object.defineProperty(exports, "__esModule", { value: true });
4886
- __exportStar(channelsConsumer, exports);
4887
- __exportStar(channelsExposer, exports);
4888
- } (openfinChannels));
4889
-
4890
- (function (exports) {
4891
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4892
- if (k2 === undefined) k2 = k;
4893
- var desc = Object.getOwnPropertyDescriptor(m, k);
4894
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4895
- desc = { enumerable: true, get: function() { return m[k]; } };
4896
- }
4897
- Object.defineProperty(o, k2, desc);
4898
- }) : (function(o, m, k, k2) {
4899
- if (k2 === undefined) k2 = k;
4900
- o[k2] = m[k];
4901
- }));
4902
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4903
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4904
- };
4905
- Object.defineProperty(exports, "__esModule", { value: true });
4906
- __exportStar(openfinChannels, exports);
4907
- } (strategies));
4908
-
4909
- (function (exports) {
4910
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4911
- if (k2 === undefined) k2 = k;
4912
- var desc = Object.getOwnPropertyDescriptor(m, k);
4913
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4914
- desc = { enumerable: true, get: function() { return m[k]; } };
4915
- }
4916
- Object.defineProperty(o, k2, desc);
4917
- }) : (function(o, m, k, k2) {
4918
- if (k2 === undefined) k2 = k;
4919
- o[k2] = m[k];
4920
- }));
4921
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4922
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4923
- };
4924
- Object.defineProperty(exports, "__esModule", { value: true });
4925
- __exportStar(apiConsumer, exports);
4926
- __exportStar(apiExposer, exports);
4927
- __exportStar(strategies, exports);
4928
- __exportStar(decorators, exports);
4929
- } (apiExposer$1));
4930
-
4931
- var channelApiRelay = {};
4932
-
4933
- Object.defineProperty(channelApiRelay, "__esModule", { value: true });
4934
- channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
4935
- const EXPECTED_ERRORS = [
4936
- 'no longer connected',
4937
- 'RTCDataChannel closed unexpectedly',
4938
- 'The client you are trying to dispatch from is disconnected from the target provider',
4939
- ];
4940
- // Checks possible error messages that we want to trap, client error message can originate
4941
- // from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
4942
- const isDisconnectedError = (errorMsg) => {
4943
- return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
4944
- };
4945
- /**
4946
- * @internal
4947
- * Create a channel relay for a given channel exposition, allowing a single provider to route
4948
- * actions to the designated clients.
4949
- *
4950
- * Designed to be used in conjunction with @expose
4951
- *
4952
- * @param channelProvider The channel provider to relay the actions on.
4953
- * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
4954
- */
4955
- const relayChannelClientApi = async (channelProvider, relayId) => {
4956
- channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
4957
- return channelProvider.dispatch(target, action, payload);
4958
- });
4959
- await Promise.resolve();
4960
- };
4961
- channelApiRelay.relayChannelClientApi = relayChannelClientApi;
4962
- const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
4963
- try {
4964
- return await client.dispatch(`relay:${relayId}`, {
4965
- action,
4966
- payload,
4967
- target
4968
- });
4882
+ /**
4883
+ * Returns the zoom level of the WebContents.
4884
+ *
4885
+ * @example
4886
+ * View:
4887
+ * ```js
4888
+ * async function getZoomLevel() {
4889
+ * const view = await fin.View.getCurrent();
4890
+ * return await view.getZoomLevel();
4891
+ * }
4892
+ *
4893
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
4894
+ * ```
4895
+ *
4896
+ * Window:
4897
+ * ```js
4898
+ * async function createWin() {
4899
+ * const app = await fin.Application.start({
4900
+ * name: 'myApp',
4901
+ * uuid: 'app-1',
4902
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html',
4903
+ * autoShow: true
4904
+ * });
4905
+ * return await app.getWindow();
4906
+ * }
4907
+ *
4908
+ * async function getZoomLevel() {
4909
+ * const win = await createWin();
4910
+ * return await win.getZoomLevel();
4911
+ * }
4912
+ *
4913
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
4914
+ * ```
4915
+ * @remarks
4916
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
4917
+ * We do not expose an explicit superclass for this functionality, but it does have its own
4918
+ * {@link OpenFin.WebContentsEvents event namespace}.
4919
+ */
4920
+ getZoomLevel() {
4921
+ return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
4969
4922
  }
4970
- catch (e) {
4971
- if (isDisconnectedError(e.message) && relayErrorMsg) {
4972
- throw new Error(relayErrorMsg);
4973
- }
4974
- throw e;
4923
+ /**
4924
+ * Sets the zoom level of the WebContents.
4925
+ * @param level The zoom level
4926
+ *
4927
+ * @example
4928
+ * View:
4929
+ * ```js
4930
+ * async function setZoomLevel(number) {
4931
+ * const view = await fin.View.getCurrent();
4932
+ * return await view.setZoomLevel(number);
4933
+ * }
4934
+ *
4935
+ * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
4936
+ * ```
4937
+ *
4938
+ * Window:
4939
+ * ```js
4940
+ * async function createWin() {
4941
+ * const app = await fin.Application.start({
4942
+ * name: 'myApp',
4943
+ * uuid: 'app-1',
4944
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html',
4945
+ * autoShow: true
4946
+ * });
4947
+ * return await app.getWindow();
4948
+ * }
4949
+ *
4950
+ * async function setZoomLevel(number) {
4951
+ * const win = await createWin();
4952
+ * return await win.setZoomLevel(number);
4953
+ * }
4954
+ *
4955
+ * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
4956
+ * ```
4957
+ * @remarks
4958
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
4959
+ * We do not expose an explicit superclass for this functionality, but it does have its own
4960
+ * {@link OpenFin.WebContentsEvents event namespace}.
4961
+ */
4962
+ setZoomLevel(level) {
4963
+ return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
4975
4964
  }
4976
- };
4977
- channelApiRelay.createRelayedDispatch = createRelayedDispatch;
4978
-
4979
- var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4980
- if (kind === "m") throw new TypeError("Private method is not writable");
4981
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4982
- 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");
4983
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4984
- };
4985
- var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4986
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4987
- 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");
4988
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4989
- };
4990
- var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
4991
- Object.defineProperty(layoutEntities, "__esModule", { value: true });
4992
- layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
4993
- const api_exposer_1 = apiExposer$1;
4994
- const channel_api_relay_1 = channelApiRelay;
4995
- /*
4996
- This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
4997
- intertwined, and share members via parent abstract class LayoutNode. To prevent circular
4998
- refs, we define and export all the classes here.
4999
- */
5000
- /**
5001
- * @ignore
5002
- * @internal
5003
- * Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
5004
- * for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
5005
- */
5006
- class LayoutNode {
5007
4965
  /**
5008
- * @internal
5009
- * @ignore
5010
- */
5011
- constructor(client, entityId) {
5012
- /**
5013
- * @ignore
5014
- * @internal
5015
- * ApiClient for {@link LayoutEntitiesController}
5016
- */
5017
- _LayoutNode_client.set(this, void 0);
5018
- /**
5019
- * Checks if the TabStack or ColumnOrRow is the root content item
5020
- *
5021
- * @example
5022
- * ```js
5023
- * if (!fin.me.isView) {
5024
- * throw new Error('Not running in a platform View.');
5025
- * }
5026
- *
5027
- * const stack = await fin.me.getCurrentStack();
5028
- * const isRoot = await stack.isRoot();
5029
- * // The TabStack is root: false
5030
- * console.log(`The TabStack is root: ${isRoot}`);
5031
- *
5032
- * // Retrieves the parent ColumnOrRow
5033
- * const parent = await stack.getParent();
5034
- * const parentIsRoot = await parent.isRoot();
5035
- * // The parent ColumnOrRow is root: true
5036
- * console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
5037
- * ```
5038
- */
5039
- this.isRoot = () => __classPrivateFieldGet$c(this, _LayoutNode_client, "f").isRoot(this.entityId);
5040
- /**
5041
- * Checks if the TabStack or ColumnOrRow exists
5042
- *
5043
- * @example
5044
- * ```js
5045
- * if (!fin.me.isView) {
5046
- * throw new Error('Not running in a platform View.');
5047
- * }
5048
- *
5049
- * const stack = await fin.me.getCurrentStack();
5050
- * // Retrieves the parent ColumnOrRow
5051
- * const columnOrRow = await stack.getParent();
5052
- * let exists = await stack.exists();
5053
- * // or
5054
- * let exists = await columnOrRow.exists();
5055
- * // The entity exists: true
5056
- * console.log(`The entity exists: ${exists}`);
5057
- * ```
5058
- */
5059
- this.exists = () => __classPrivateFieldGet$c(this, _LayoutNode_client, "f").exists(this.entityId);
5060
- /**
5061
- * Retrieves the parent of the TabStack or ColumnOrRow
5062
- *
5063
- * @example
5064
- * ```js
5065
- * if (!fin.me.isView) {
5066
- * throw new Error('Not running in a platform View.');
5067
- * }
5068
- *
5069
- * const stack = await fin.me.getCurrentStack();
5070
- * // Retrieves the parent ColumnOrRow
5071
- * const columnOrRow = await stack.getParent();
5072
- *
5073
- * // undefined if entity is the root item
5074
- * let parent = await columnOrRow.getParent();
5075
- * // or
5076
- * let parent = await stack.getParent();
5077
- * ```
5078
- */
5079
- this.getParent = async () => {
5080
- const parent = await __classPrivateFieldGet$c(this, _LayoutNode_client, "f").getParent(this.entityId);
5081
- if (!parent) {
5082
- return undefined;
5083
- }
5084
- return LayoutNode.getEntity(parent, __classPrivateFieldGet$c(this, _LayoutNode_client, "f"));
5085
- };
5086
- /**
5087
- * Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
5088
- *
5089
- * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
5090
- * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
5091
- * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
5092
- * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
5093
- *
5094
- * @param views The views that will populate the new TabStack.
5095
- * @param options Additional options that control new TabStack creation.
5096
- * @returns The newly-created TabStack.
5097
- *
5098
- * @example
5099
- * ```js
5100
- * if (!fin.me.isView) {
5101
- * throw new Error('Not running in a platform View.');
5102
- * }
5103
- *
5104
- * const stack = await fin.me.getCurrentStack();
5105
- * const columnOrRow = await stack.getParent();
5106
- *
5107
- * // Create view references by supplying a 'name' and 'url'
5108
- * const views = [
5109
- * // if 'name' is undefined, one will be generated
5110
- * // if 'url' is undefined, it will default the view URL to 'about:blank'
5111
- * { name: 'google-view', url: 'http://google.com/'},
5112
- * { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
5113
- * ];
5114
- *
5115
- * // Create a view beforehand to be included in the new tab stack
5116
- * const outsideView = await fin.View.create({
5117
- * name: 'outside-bloomberg-view',
5118
- * url: 'https://bloomberg.com/',
5119
- * target: fin.me.identity,
5120
- * });
5121
- *
5122
- * // Views to add can be identities, or the reference views mentioned above
5123
- * const viewsToAdd = [outsideView.identity, ...views];
5124
- *
5125
- * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
5126
- * let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
5127
- * // Or
5128
- * let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
5129
- * console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
5130
- *
5131
- * ```
5132
- * @experimental
5133
- */
5134
- this.createAdjacentStack = async (views, options) => {
5135
- const entityId = await __classPrivateFieldGet$c(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
5136
- return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$c(this, _LayoutNode_client, "f"));
5137
- };
5138
- /**
5139
- * Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
5140
- *
5141
- * @param edge Edge whose adjacent TabStacks will be returned.
5142
- *
5143
- * @example
5144
- * ```js
5145
- * if (!fin.me.isView) {
5146
- * throw new Error('Not running in a platform View.');
5147
- * }
5148
- *
5149
- * const stack = await fin.me.getCurrentStack();
5150
- * const columnOrRow = await stack.getParent();
5151
- * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
5152
- * let rightStacks = await columnOrRow.getAdjacentStacks('right');
5153
- * let leftStacks = await columnOrRow.getAdjacentStacks('left');
5154
- * // or
5155
- * let rightStacks = await stack.getAdjacentStacks('right');
5156
- * let leftStacks = await stack.getAdjacentStacks('left');
5157
- *
5158
- * console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
5159
- *
5160
- * ```
5161
- * @experimental
5162
- */
5163
- this.getAdjacentStacks = async (edge) => {
5164
- const adjacentStacks = await __classPrivateFieldGet$c(this, _LayoutNode_client, "f").getAdjacentStacks({
5165
- targetId: this.entityId,
5166
- edge
5167
- });
5168
- return adjacentStacks.map((stack) => LayoutNode.getEntity({
5169
- type: 'stack',
5170
- entityId: stack.entityId
5171
- }, __classPrivateFieldGet$c(this, _LayoutNode_client, "f")));
5172
- };
5173
- __classPrivateFieldSet$a(this, _LayoutNode_client, client, "f");
5174
- this.entityId = entityId;
5175
- }
5176
- }
5177
- layoutEntities.LayoutNode = LayoutNode;
5178
- _LayoutNode_client = new WeakMap();
5179
- /**
5180
- * @ignore
5181
- * @internal
5182
- * Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
5183
- * @param client
5184
- * @param controllerId
5185
- * @param identity
5186
- * @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
5187
- */
5188
- LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
5189
- 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.');
5190
- const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
5191
- return consumer.consume({ id: controllerId });
5192
- };
5193
- LayoutNode.getEntity = (definition, client) => {
5194
- const { entityId, type } = definition;
5195
- switch (type) {
5196
- case 'column':
5197
- case 'row':
5198
- return new ColumnOrRow(client, entityId, type);
5199
- case 'stack':
5200
- return new TabStack(client, entityId);
5201
- default:
5202
- throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
5203
- }
5204
- };
5205
- /**
5206
- * A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
5207
- */
5208
- class TabStack extends LayoutNode {
5209
- /** @internal */
5210
- constructor(client, entityId) {
5211
- super(client, entityId);
5212
- /**
5213
- * @internal
5214
- * ApiClient for {@link LayoutEntitiesController}
5215
- */
5216
- _TabStack_client.set(this, void 0);
5217
- /**
5218
- * Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
5219
- */
5220
- this.type = 'stack';
5221
- /**
5222
- * Retrieves a list of all views belonging to this {@link TabStack}.
5223
- *
5224
- * Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
5225
- * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
5226
- * If that happens and then getViews() is called, it will return the identities in a different order than
5227
- * than the currently rendered tab order.
5228
- *
5229
- *
5230
- * @throws If the {@link TabStack} has been destroyed.
5231
- * @example
5232
- * ```js
5233
- * if (!fin.me.isView) {
5234
- * throw new Error('Not running in a platform View.');
5235
- * }
5236
- *
5237
- * const stack = await fin.me.getCurrentStack();
5238
- * // Alternatively, you can wrap any view and get the stack from there
5239
- * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
5240
- * // const stack = await viewFromSomewhere.getCurrentStack();
5241
- * const views = await stack.getViews();
5242
- * console.log(`Stack contains ${views.length} view(s)`);
5243
- * ```
5244
- * @experimental
5245
- */
5246
- this.getViews = () => __classPrivateFieldGet$c(this, _TabStack_client, "f").getStackViews(this.entityId);
5247
- /**
5248
- * Adds or creates a view in this {@link TabStack}.
5249
- *
5250
- * @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
5251
- * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
5252
- *
5253
- * @param view The identity of an existing view to add, or options to create a view.
5254
- * @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)
5255
- * @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
5256
- * @throws If the view does not exist or fails to create.
5257
- * @throws If the {@link TabStack} has been destroyed.
5258
- * @example
5259
- * ```js
5260
- * if (!fin.me.isView) {
5261
- * throw new Error('Not running in a platform View.');
5262
- * }
5263
- *
5264
- * const stack = await fin.me.getCurrentStack();
5265
- * // Alternatively, you can wrap any view and get the stack from there
5266
- * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
5267
- * // const stack = await viewFromSomewhere.getCurrentStack();
5268
- * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
5269
- * console.log('Identity of the google view just added', { googleViewIdentity });
5270
- * // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
5271
- * const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
5272
- * console.log('Identity of the apple view just added', { appleViewIdentity });
5273
- * ```
5274
- * @experimental
5275
- */
5276
- this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$c(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
5277
- /**
5278
- * Removes a view from this {@link TabStack}.
5279
- *
5280
- * @remarks Throws an exception if the view identity does not exist or was already destroyed.
5281
- *
5282
- * @param view - Identity of the view to remove.
5283
- * @throws If the view does not exist or does not belong to the stack.
5284
- * @throws If the {@link TabStack} has been destroyed.
5285
- *
5286
- * @example
5287
- * ```js
5288
- * if (!fin.me.isView) {
5289
- * throw new Error('Not running in a platform View.');
5290
- * }
5291
- *
5292
- * const stack = await fin.me.getCurrentStack();
5293
- * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
5294
- *
5295
- * await stack.removeView(googleViewIdentity);
5296
- *
5297
- * try {
5298
- * await stack.removeView(googleViewIdentity);
5299
- * } catch (error) {
5300
- * // Tried to remove a view ('google-view') which does not belong to the stack.
5301
- * console.log(error);
5302
- * }
5303
- * ```
5304
- */
5305
- this.removeView = async (view) => {
5306
- await __classPrivateFieldGet$c(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
5307
- };
5308
- /**
5309
- * Sets the active view of the {@link TabStack} without focusing it.
5310
- * @param view - Identity of the view to activate.
5311
- * @returns Promise which resolves with void once the view has been activated.
5312
- * @throws If the {@link TabStack} has been destroyed.
5313
- * @throws If the view does not exist.
5314
- * @example
5315
- * Change the active tab of a known View's TabStack:
5316
- * ```js
5317
- * const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
5318
- * const stack = await targetView.getCurrentStack();
5319
- * await stack.setActiveView(targetView.identity);
5320
- * ```
5321
- *
5322
- * Set the current View as active within its TabStack:
5323
- * ```js
5324
- * const stack = await fin.me.getCurrentStack();
5325
- * await stack.setActiveView(fin.me.identity);
5326
- * ```
5327
- * @experimental
5328
- */
5329
- this.setActiveView = async (view) => {
5330
- await __classPrivateFieldGet$c(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
5331
- };
5332
- __classPrivateFieldSet$a(this, _TabStack_client, client, "f");
5333
- }
5334
- }
5335
- layoutEntities.TabStack = TabStack;
5336
- _TabStack_client = new WeakMap();
5337
- /**
5338
- * A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
5339
- */
5340
- class ColumnOrRow extends LayoutNode {
5341
- /**
5342
- * @internal
5343
- */
5344
- constructor(client, entityId, type) {
5345
- super(client, entityId);
5346
- /**
5347
- * @ignore
5348
- * @internal
5349
- * ApiClient for {@link LayoutEntitiesController}
5350
- */
5351
- _ColumnOrRow_client.set(this, void 0);
5352
- /**
5353
- * Retrieves the content array of the ColumnOrRow
5354
- *
5355
- * @example
5356
- * ```js
5357
- * if (!fin.me.isView) {
5358
- * throw new Error('Not running in a platform View.');
5359
- * }
5360
- *
5361
- * const stack = await fin.me.getCurrentStack();
5362
- * // Retrieves the parent ColumnOrRow
5363
- * const columnOrRow = await stack.getParent();
5364
- *
5365
- * // returns [TabStack]
5366
- * const contentArray = await columnOrRow.getContent();
5367
- * console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
5368
- * ```
5369
- */
5370
- this.getContent = async () => {
5371
- const contentItemEntities = await __classPrivateFieldGet$c(this, _ColumnOrRow_client, "f").getContent(this.entityId);
5372
- return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$c(this, _ColumnOrRow_client, "f")));
5373
- };
5374
- __classPrivateFieldSet$a(this, _ColumnOrRow_client, client, "f");
5375
- this.type = type;
5376
- }
5377
- }
5378
- layoutEntities.ColumnOrRow = ColumnOrRow;
5379
- _ColumnOrRow_client = new WeakMap();
5380
-
5381
- var layout_constants = {};
5382
-
5383
- Object.defineProperty(layout_constants, "__esModule", { value: true });
5384
- layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
5385
- layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
5386
- // TODO: eventually export this somehow
5387
- layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
5388
-
5389
- var main = {};
5390
-
5391
- Object.defineProperty(main, "__esModule", { value: true });
5392
- main.WebContents = void 0;
5393
- const base_1$i = base;
5394
- class WebContents extends base_1$i.EmitterBase {
5395
- /**
5396
- * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
5397
- * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
5398
- */
5399
- constructor(wire, identity, entityType) {
5400
- super(wire, entityType, identity.uuid, identity.name);
5401
- this.identity = identity;
5402
- this.entityType = entityType;
5403
- }
5404
- /**
5405
- * Gets a base64 encoded image of all or part of the WebContents.
5406
- * @param options Options for the capturePage call.
5407
- *
5408
- * @example
5409
- *
5410
- * View:
5411
- * ```js
5412
- * const view = fin.View.getCurrentSync();
5413
- *
5414
- * // PNG image of a full visible View
5415
- * console.log(await view.capturePage());
5416
- *
5417
- * // Low-quality JPEG image of a defined visible area of the view
5418
- * const options = {
5419
- * area: {
5420
- * height: 100,
5421
- * width: 100,
5422
- * x: 10,
5423
- * y: 10,
5424
- * },
5425
- * format: 'jpg',
5426
- * quality: 20
5427
- * }
5428
- * console.log(await view.capturePage(options));
5429
- * ```
5430
- *
5431
- * Window:
5432
- * ```js
5433
- * const wnd = await fin.Window.getCurrent();
5434
- *
5435
- * // PNG image of a full visible window
5436
- * console.log(await wnd.capturePage());
5437
- *
5438
- * // Low-quality JPEG image of a defined visible area of the window
5439
- * const options = {
5440
- * area: {
5441
- * height: 100,
5442
- * width: 100,
5443
- * x: 10,
5444
- * y: 10,
5445
- * },
5446
- * format: 'jpg',
5447
- * quality: 20
5448
- * }
5449
- * console.log(await wnd.capturePage(options));
5450
- * ```
5451
- *
5452
- * @remarks
5453
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
5454
- * We do not expose an explicit superclass for this functionality, but it does have its own
5455
- * {@link OpenFin.WebContentsEvents event namespace}.
5456
- */
5457
- capturePage(options) {
5458
- return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
5459
- }
5460
- /**
5461
- * Executes Javascript on the WebContents, restricted to contents you own or contents owned by
5462
- * applications you have created.
5463
- * @param code JavaScript code to be executed on the view.
5464
- *
5465
- * @example
5466
- * View:
5467
- * ```js
5468
- * async function executeJavaScript(code) {
5469
- * const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
5470
- * return await view.executeJavaScript(code);
5471
- * }
5472
- *
5473
- * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
5474
- * ```
5475
- *
5476
- * Window:
5477
- * ```js
5478
- * async function executeJavaScript(code) {
5479
- * const app = await fin.Application.start({
5480
- * name: 'myApp',
5481
- * uuid: 'app-1',
5482
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
5483
- * autoShow: true
5484
- * });
5485
- * const win = await app.getWindow();
5486
- * return await win.executeJavaScript(code);
5487
- * }
5488
- *
5489
- * executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
5490
- * ```
5491
- * @remarks
5492
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
5493
- * We do not expose an explicit superclass for this functionality, but it does have its own
5494
- * {@link OpenFin.WebContentsEvents event namespace}.
5495
- */
5496
- executeJavaScript(code) {
5497
- return this.wire
5498
- .sendAction('execute-javascript-in-window', { ...this.identity, code })
5499
- .then(({ payload }) => payload.data);
5500
- }
5501
- /**
5502
- * Returns the zoom level of the WebContents.
5503
- *
5504
- * @example
5505
- * View:
5506
- * ```js
5507
- * async function getZoomLevel() {
5508
- * const view = await fin.View.getCurrent();
5509
- * return await view.getZoomLevel();
5510
- * }
5511
- *
5512
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
5513
- * ```
5514
- *
5515
- * Window:
5516
- * ```js
5517
- * async function createWin() {
5518
- * const app = await fin.Application.start({
5519
- * name: 'myApp',
5520
- * uuid: 'app-1',
5521
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.getZoomLevel.html',
5522
- * autoShow: true
5523
- * });
5524
- * return await app.getWindow();
5525
- * }
5526
- *
5527
- * async function getZoomLevel() {
5528
- * const win = await createWin();
5529
- * return await win.getZoomLevel();
5530
- * }
5531
- *
5532
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
5533
- * ```
5534
- * @remarks
5535
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
5536
- * We do not expose an explicit superclass for this functionality, but it does have its own
5537
- * {@link OpenFin.WebContentsEvents event namespace}.
5538
- */
5539
- getZoomLevel() {
5540
- return this.wire.sendAction('get-zoom-level', this.identity).then(({ payload }) => payload.data);
5541
- }
5542
- /**
5543
- * Sets the zoom level of the WebContents.
5544
- * @param level The zoom level
5545
- *
5546
- * @example
5547
- * View:
5548
- * ```js
5549
- * async function setZoomLevel(number) {
5550
- * const view = await fin.View.getCurrent();
5551
- * return await view.setZoomLevel(number);
5552
- * }
5553
- *
5554
- * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
5555
- * ```
5556
- *
5557
- * Window:
5558
- * ```js
5559
- * async function createWin() {
5560
- * const app = await fin.Application.start({
5561
- * name: 'myApp',
5562
- * uuid: 'app-1',
5563
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.setZoomLevel.html',
5564
- * autoShow: true
5565
- * });
5566
- * return await app.getWindow();
5567
- * }
5568
- *
5569
- * async function setZoomLevel(number) {
5570
- * const win = await createWin();
5571
- * return await win.setZoomLevel(number);
5572
- * }
5573
- *
5574
- * setZoomLevel(4).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
5575
- * ```
5576
- * @remarks
5577
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
5578
- * We do not expose an explicit superclass for this functionality, but it does have its own
5579
- * {@link OpenFin.WebContentsEvents event namespace}.
5580
- */
5581
- setZoomLevel(level) {
5582
- return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
5583
- }
5584
- /**
5585
- * Navigates the WebContents to a specified URL.
5586
- *
5587
- * Note: The url must contain the protocol prefix such as http:// or https://.
5588
- * @param url - The URL to navigate the WebContents to.
5589
- *
5590
- * @example
5591
- * View:
5592
- * ```js
5593
- * async function createView() {
5594
- * const me = await fin.Window.getCurrent();
5595
- * return fin.View.create({
5596
- * name: 'viewName',
5597
- * target: me.identity,
5598
- * bounds: {top: 10, left: 10, width: 200, height: 200}
5599
- * });
5600
- * }
5601
- *
5602
- * createView()
5603
- * .then(view => view.navigate('https://example.com'))
5604
- * .then(() => console.log('navigation complete'))
5605
- * .catch(err => console.log(err));
5606
- * ```
5607
- *
5608
- * Window:
5609
- * ```js
5610
- * async function navigate() {
5611
- * const win = await fin.Window.getCurrent();
5612
- * return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html');
5613
- * }
5614
- * navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
5615
- * ```
5616
- * @experimental
5617
- * @remarks
5618
- * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
5619
- * We do not expose an explicit superclass for this functionality, but it does have its own
5620
- * {@link OpenFin.WebContentsEvents event namespace}.
4966
+ * Navigates the WebContents to a specified URL.
4967
+ *
4968
+ * Note: The url must contain the protocol prefix such as http:// or https://.
4969
+ * @param url - The URL to navigate the WebContents to.
4970
+ *
4971
+ * @example
4972
+ * View:
4973
+ * ```js
4974
+ * async function createView() {
4975
+ * const me = await fin.Window.getCurrent();
4976
+ * return fin.View.create({
4977
+ * name: 'viewName',
4978
+ * target: me.identity,
4979
+ * bounds: {top: 10, left: 10, width: 200, height: 200}
4980
+ * });
4981
+ * }
4982
+ *
4983
+ * createView()
4984
+ * .then(view => view.navigate('https://example.com'))
4985
+ * .then(() => console.log('navigation complete'))
4986
+ * .catch(err => console.log(err));
4987
+ * ```
4988
+ *
4989
+ * Window:
4990
+ * ```js
4991
+ * async function navigate() {
4992
+ * const win = await fin.Window.getCurrent();
4993
+ * return await win.navigate('https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.navigate.html');
4994
+ * }
4995
+ * navigate().then(() => console.log('Navigate to tutorial')).catch(err => console.log(err));
4996
+ * ```
4997
+ * @experimental
4998
+ * @remarks
4999
+ * `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
5000
+ * We do not expose an explicit superclass for this functionality, but it does have its own
5001
+ * {@link OpenFin.WebContentsEvents event namespace}.
5621
5002
  */
5622
5003
  navigate(url) {
5623
5004
  return this.wire.sendAction('navigate-window', { ...this.identity, url }).then(() => undefined);
@@ -9089,18 +8470,11 @@ var hasRequiredInstance;
9089
8470
  function requireInstance () {
9090
8471
  if (hasRequiredInstance) return Instance$7;
9091
8472
  hasRequiredInstance = 1;
9092
- var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9093
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9094
- 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");
9095
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9096
- };
9097
8473
  var _View_providerChannelClient;
9098
8474
  Object.defineProperty(Instance$7, "__esModule", { value: true });
9099
8475
  Instance$7.View = void 0;
9100
8476
  const transport_errors_1 = transportErrors;
9101
8477
  const lazy_1 = lazy;
9102
- const layout_entities_1 = layoutEntities;
9103
- const layout_constants_1 = layout_constants;
9104
8478
  const main_1 = main;
9105
8479
  const window_1 = requireWindow();
9106
8480
  /**
@@ -9418,7 +8792,7 @@ function requireInstance () {
9418
8792
  return ack.payload.data;
9419
8793
  };
9420
8794
  /**
9421
- * Retrieves the layout for the window the view is attached to.
8795
+ * Retrieves the OpenFin.Layout instance for the Window the View is attached to.
9422
8796
  *
9423
8797
  * @example
9424
8798
  * ```js
@@ -9434,29 +8808,7 @@ function requireInstance () {
9434
8808
  this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
9435
8809
  // don't expose
9436
8810
  });
9437
- const layoutWindow = await this.getCurrentWindow();
9438
- let layoutWindowIdentity = layoutWindow.identity;
9439
- // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
9440
- if (layoutWindowIdentity.identity) {
9441
- layoutWindowIdentity = layoutWindowIdentity.identity;
9442
- }
9443
- try {
9444
- const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
9445
- const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindowIdentity);
9446
- const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
9447
- return this.fin.Platform.Layout.wrap(layoutIdentity);
9448
- }
9449
- catch (e) {
9450
- const allowedErrors = [
9451
- 'No action registered at target for',
9452
- 'getLayoutIdentityForViewOrThrow is not a function'
9453
- ];
9454
- if (!allowedErrors.some((m) => e.message.includes(m))) {
9455
- throw e;
9456
- }
9457
- // fallback logic for missing endpoint
9458
- return this.fin.Platform.Layout.wrap(layoutWindowIdentity);
9459
- }
8811
+ return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
9460
8812
  };
9461
8813
  /**
9462
8814
  * Gets the View's options.
@@ -9572,11 +8924,8 @@ function requireInstance () {
9572
8924
  // don't expose
9573
8925
  });
9574
8926
  try {
9575
- const layoutWindow = await this.getCurrentWindow();
9576
- const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
9577
- const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
9578
- const stackDefinition = (await client.getStackByView(this.identity));
9579
- return layout_entities_1.LayoutNode.getEntity(stackDefinition, client);
8927
+ const layout = await this.getParentLayout();
8928
+ return layout.getStackByViewIdentity(this.identity);
9580
8929
  }
9581
8930
  catch (error) {
9582
8931
  throw new transport_errors_1.RuntimeError({ reason: 'This view does not belong to a stack.', error });
@@ -10182,24 +9531,27 @@ function errorToPOJO(error) {
10182
9531
  }
10183
9532
  errors.errorToPOJO = errorToPOJO;
10184
9533
 
10185
- var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9534
+ var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10186
9535
  if (kind === "m") throw new TypeError("Private method is not writable");
10187
9536
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10188
9537
  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");
10189
9538
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10190
9539
  };
10191
- var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9540
+ var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10192
9541
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10193
9542
  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");
10194
9543
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10195
9544
  };
9545
+ var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
9546
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9547
+ };
10196
9548
  var _Transport_wire, _Transport_fin;
10197
9549
  Object.defineProperty(transport, "__esModule", { value: true });
10198
9550
  var Transport_1 = transport.Transport = void 0;
10199
- const events_1$5 = require$$0;
9551
+ const events_1$5 = require$$0$1;
10200
9552
  const wire_1 = wire;
10201
9553
  const transport_errors_1$2 = transportErrors;
10202
- const eventAggregator_1 = eventAggregator;
9554
+ const eventAggregator_1 = __importDefault$2(eventAggregator);
10203
9555
  const me_1$1 = me;
10204
9556
  const errors_1$1 = errors;
10205
9557
  class Transport extends events_1$5.EventEmitter {
@@ -10213,19 +9565,19 @@ class Transport extends events_1$5.EventEmitter {
10213
9565
  // Typing as unknown to avoid circular dependency, should not be used directly.
10214
9566
  _Transport_fin.set(this, void 0);
10215
9567
  this.connectSync = () => {
10216
- const wire = __classPrivateFieldGet$b(this, _Transport_wire, "f");
9568
+ const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
10217
9569
  wire.connectSync();
10218
9570
  };
10219
9571
  // This function is only used in our tests.
10220
9572
  this.getPort = () => {
10221
- const wire = __classPrivateFieldGet$b(this, _Transport_wire, "f");
9573
+ const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
10222
9574
  return wire.getPort();
10223
9575
  };
10224
- __classPrivateFieldSet$9(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
9576
+ __classPrivateFieldSet$a(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
10225
9577
  this.environment = environment;
10226
- this.sendRaw = __classPrivateFieldGet$b(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$b(this, _Transport_wire, "f"));
9578
+ this.sendRaw = __classPrivateFieldGet$c(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$c(this, _Transport_wire, "f"));
10227
9579
  this.registerMessageHandler(this.handleMessage.bind(this));
10228
- __classPrivateFieldGet$b(this, _Transport_wire, "f").on('disconnected', () => {
9580
+ __classPrivateFieldGet$c(this, _Transport_wire, "f").on('disconnected', () => {
10229
9581
  for (const [, { handleNack }] of this.wireListeners) {
10230
9582
  handleNack({ reason: 'Remote connection has closed' });
10231
9583
  }
@@ -10237,24 +9589,24 @@ class Transport extends events_1$5.EventEmitter {
10237
9589
  this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
10238
9590
  }
10239
9591
  getFin() {
10240
- if (!__classPrivateFieldGet$b(this, _Transport_fin, "f")) {
9592
+ if (!__classPrivateFieldGet$c(this, _Transport_fin, "f")) {
10241
9593
  throw new Error('No Fin object registered for this transport');
10242
9594
  }
10243
- return __classPrivateFieldGet$b(this, _Transport_fin, "f");
9595
+ return __classPrivateFieldGet$c(this, _Transport_fin, "f");
10244
9596
  }
10245
9597
  registerFin(_fin) {
10246
- if (__classPrivateFieldGet$b(this, _Transport_fin, "f")) {
9598
+ if (__classPrivateFieldGet$c(this, _Transport_fin, "f")) {
10247
9599
  throw new Error('Fin object has already been registered for this transport');
10248
9600
  }
10249
- __classPrivateFieldSet$9(this, _Transport_fin, _fin, "f");
9601
+ __classPrivateFieldSet$a(this, _Transport_fin, _fin, "f");
10250
9602
  }
10251
9603
  shutdown() {
10252
- const wire = __classPrivateFieldGet$b(this, _Transport_wire, "f");
9604
+ const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
10253
9605
  return wire.shutdown();
10254
9606
  }
10255
9607
  async connect(config) {
10256
9608
  if ((0, wire_1.isConfigWithReceiver)(config)) {
10257
- await __classPrivateFieldGet$b(this, _Transport_wire, "f").connect(config.receiver);
9609
+ await __classPrivateFieldGet$c(this, _Transport_wire, "f").connect(config.receiver);
10258
9610
  return this.authorize(config);
10259
9611
  }
10260
9612
  if ((0, wire_1.isRemoteConfig)(config)) {
@@ -10270,13 +9622,13 @@ class Transport extends events_1$5.EventEmitter {
10270
9622
  return undefined;
10271
9623
  }
10272
9624
  async connectRemote(config) {
10273
- await __classPrivateFieldGet$b(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
9625
+ await __classPrivateFieldGet$c(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
10274
9626
  return this.authorize(config);
10275
9627
  }
10276
9628
  async connectByPort(config) {
10277
9629
  const { address, uuid } = config;
10278
9630
  const reqAuthPayload = { ...config, type: 'file-token' };
10279
- const wire = __classPrivateFieldGet$b(this, _Transport_wire, "f");
9631
+ const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
10280
9632
  await wire.connect(new (this.environment.getWsConstructor())(config.address));
10281
9633
  const requestExtAuthRet = await this.sendAction('request-external-authorization', {
10282
9634
  uuid,
@@ -10312,7 +9664,7 @@ class Transport extends events_1$5.EventEmitter {
10312
9664
  payload,
10313
9665
  messageId
10314
9666
  };
10315
- const wire = __classPrivateFieldGet$b(this, _Transport_wire, "f");
9667
+ const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
10316
9668
  this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
10317
9669
  return wire.send(msg).catch(reject);
10318
9670
  });
@@ -10334,7 +9686,7 @@ class Transport extends events_1$5.EventEmitter {
10334
9686
  const resolver = (data) => {
10335
9687
  resolve(data.payload);
10336
9688
  };
10337
- const wire = __classPrivateFieldGet$b(this, _Transport_wire, "f");
9689
+ const wire = __classPrivateFieldGet$c(this, _Transport_wire, "f");
10338
9690
  return wire
10339
9691
  .send(origData)
10340
9692
  .then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
@@ -10413,7 +9765,7 @@ _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
10413
9765
  var websocket = {};
10414
9766
 
10415
9767
  Object.defineProperty(websocket, "__esModule", { value: true });
10416
- const events_1$4 = require$$0;
9768
+ const events_1$4 = require$$0$1;
10417
9769
  const transport_errors_1$1 = transportErrors;
10418
9770
  const messageReceiver_1 = bridge.messageReceiver;
10419
9771
  /* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
@@ -10490,7 +9842,7 @@ system.System = void 0;
10490
9842
  const base_1$d = base;
10491
9843
  const transport_errors_1 = transportErrors;
10492
9844
  const window_1 = requireWindow();
10493
- const events_1$3 = require$$0;
9845
+ const events_1$3 = require$$0$1;
10494
9846
  /**
10495
9847
  * An object representing the core of OpenFin Runtime. Allows the developer
10496
9848
  * to perform system-level actions, such as accessing logs, viewing processes,
@@ -12745,12 +12097,12 @@ class ChannelBase {
12745
12097
  }
12746
12098
  channel.ChannelBase = ChannelBase;
12747
12099
 
12748
- var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12100
+ var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12749
12101
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
12750
12102
  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");
12751
12103
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12752
12104
  };
12753
- var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12105
+ var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12754
12106
  if (kind === "m") throw new TypeError("Private method is not writable");
12755
12107
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
12756
12108
  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");
@@ -12792,7 +12144,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
12792
12144
  static closeChannelByEndpointId(id) {
12793
12145
  const channel = channelClientsByEndpointId.get(id);
12794
12146
  if (channel) {
12795
- __classPrivateFieldGet$a(channel, _ChannelClient_close, "f").call(channel);
12147
+ __classPrivateFieldGet$b(channel, _ChannelClient_close, "f").call(channel);
12796
12148
  }
12797
12149
  }
12798
12150
  /**
@@ -12803,7 +12155,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
12803
12155
  for (const channelClient of channelClientsByEndpointId.values()) {
12804
12156
  if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
12805
12157
  channelClient.disconnectListener(eventPayload);
12806
- __classPrivateFieldGet$a(channelClient, _ChannelClient_close, "f").call(channelClient);
12158
+ __classPrivateFieldGet$b(channelClient, _ChannelClient_close, "f").call(channelClient);
12807
12159
  }
12808
12160
  }
12809
12161
  }
@@ -12818,12 +12170,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
12818
12170
  this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
12819
12171
  _ChannelClient_close.set(this, () => {
12820
12172
  channelClientsByEndpointId.delete(this.endpointId);
12821
- __classPrivateFieldGet$a(this, _ChannelClient_strategy, "f").close();
12173
+ __classPrivateFieldGet$b(this, _ChannelClient_strategy, "f").close();
12822
12174
  });
12823
- __classPrivateFieldSet$8(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
12175
+ __classPrivateFieldSet$9(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
12824
12176
  this.disconnectListener = () => undefined;
12825
12177
  this.endpointId = routingInfo.endpointId;
12826
- __classPrivateFieldSet$8(this, _ChannelClient_strategy, strategy, "f");
12178
+ __classPrivateFieldSet$9(this, _ChannelClient_strategy, strategy, "f");
12827
12179
  channelClientsByEndpointId.set(this.endpointId, this);
12828
12180
  strategy.receive(this.processAction);
12829
12181
  }
@@ -12831,7 +12183,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
12831
12183
  * a read-only provider identity
12832
12184
  */
12833
12185
  get providerIdentity() {
12834
- const protectedObj = __classPrivateFieldGet$a(this, _ChannelClient_protectedObj, "f");
12186
+ const protectedObj = __classPrivateFieldGet$b(this, _ChannelClient_protectedObj, "f");
12835
12187
  return protectedObj.providerIdentity;
12836
12188
  }
12837
12189
  /**
@@ -12860,8 +12212,8 @@ class ChannelClient extends channel_1$1.ChannelBase {
12860
12212
  * ```
12861
12213
  */
12862
12214
  async dispatch(action, payload) {
12863
- if (__classPrivateFieldGet$a(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
12864
- return __classPrivateFieldGet$a(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
12215
+ if (__classPrivateFieldGet$b(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
12216
+ return __classPrivateFieldGet$b(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload);
12865
12217
  }
12866
12218
  throw new Error('The client you are trying to dispatch from is disconnected from the target provider.');
12867
12219
  }
@@ -12911,10 +12263,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
12911
12263
  */
12912
12264
  async disconnect() {
12913
12265
  await this.sendDisconnectAction();
12914
- __classPrivateFieldGet$a(this, _ChannelClient_close, "f").call(this);
12266
+ __classPrivateFieldGet$b(this, _ChannelClient_close, "f").call(this);
12915
12267
  }
12916
12268
  async sendDisconnectAction() {
12917
- const protectedObj = __classPrivateFieldGet$a(this, _ChannelClient_protectedObj, "f");
12269
+ const protectedObj = __classPrivateFieldGet$b(this, _ChannelClient_protectedObj, "f");
12918
12270
  await protectedObj.close();
12919
12271
  }
12920
12272
  /**
@@ -12947,13 +12299,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
12947
12299
 
12948
12300
  var strategy$3 = {};
12949
12301
 
12950
- var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12302
+ var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12951
12303
  if (kind === "m") throw new TypeError("Private method is not writable");
12952
12304
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
12953
12305
  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");
12954
12306
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12955
12307
  };
12956
- var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12308
+ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12957
12309
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
12958
12310
  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");
12959
12311
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -12978,7 +12330,7 @@ class ClassicStrategy {
12978
12330
  // connection problems occur
12979
12331
  _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
12980
12332
  this.send = async (endpointId, action, payload) => {
12981
- const to = __classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
12333
+ const to = __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
12982
12334
  if (!to) {
12983
12335
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
12984
12336
  }
@@ -12990,28 +12342,28 @@ class ClassicStrategy {
12990
12342
  }
12991
12343
  delete cleanId.isLocalEndpointId;
12992
12344
  // grab the promise before awaiting it to save in our pending messages map
12993
- const p = __classPrivateFieldGet$9(this, _ClassicStrategy_wire, "f")
12345
+ const p = __classPrivateFieldGet$a(this, _ClassicStrategy_wire, "f")
12994
12346
  .sendAction('send-channel-message', {
12995
12347
  ...cleanId,
12996
12348
  providerIdentity: this.providerIdentity,
12997
12349
  action,
12998
12350
  payload
12999
12351
  });
13000
- __classPrivateFieldGet$9(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
12352
+ __classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
13001
12353
  const raw = await p.catch((error) => {
13002
12354
  throw new Error(error.message);
13003
12355
  }).finally(() => {
13004
12356
  // clean up the pending promise
13005
- __classPrivateFieldGet$9(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
12357
+ __classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
13006
12358
  });
13007
12359
  return raw.payload.data.result;
13008
12360
  };
13009
12361
  this.close = async () => {
13010
12362
  this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
13011
- [...__classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
13012
- __classPrivateFieldSet$7(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
12363
+ [...__classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
12364
+ __classPrivateFieldSet$8(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
13013
12365
  };
13014
- __classPrivateFieldSet$7(this, _ClassicStrategy_wire, wire, "f");
12366
+ __classPrivateFieldSet$8(this, _ClassicStrategy_wire, wire, "f");
13015
12367
  }
13016
12368
  onEndpointDisconnect(endpointId, listener) {
13017
12369
  // Never fires for 'classic'.
@@ -13020,20 +12372,20 @@ class ClassicStrategy {
13020
12372
  this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
13021
12373
  }
13022
12374
  async closeEndpoint(endpointId) {
13023
- const id = __classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
13024
- __classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
13025
- const pendingSet = __classPrivateFieldGet$9(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
12375
+ const id = __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
12376
+ __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
12377
+ const pendingSet = __classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
13026
12378
  pendingSet?.forEach((p) => {
13027
12379
  const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
13028
12380
  p.cancel(new Error(errorMsg));
13029
12381
  });
13030
12382
  }
13031
12383
  isEndpointConnected(endpointId) {
13032
- return __classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
12384
+ return __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
13033
12385
  }
13034
12386
  addEndpoint(endpointId, payload) {
13035
- __classPrivateFieldGet$9(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
13036
- __classPrivateFieldGet$9(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
12387
+ __classPrivateFieldGet$a(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
12388
+ __classPrivateFieldGet$a(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
13037
12389
  }
13038
12390
  isValidEndpointPayload(payload) {
13039
12391
  return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
@@ -13049,12 +12401,12 @@ var strategy$2 = {};
13049
12401
 
13050
12402
  var endpoint = {};
13051
12403
 
13052
- var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12404
+ var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13053
12405
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13054
12406
  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");
13055
12407
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13056
12408
  };
13057
- var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12409
+ var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13058
12410
  if (kind === "m") throw new TypeError("Private method is not writable");
13059
12411
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13060
12412
  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");
@@ -13089,8 +12441,8 @@ class RTCEndpoint {
13089
12441
  if (this.rtc.rtcClient.connectionState !== 'connected') {
13090
12442
  this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
13091
12443
  this.close();
13092
- if (__classPrivateFieldGet$8(this, _RTCEndpoint_disconnectListener, "f")) {
13093
- __classPrivateFieldGet$8(this, _RTCEndpoint_disconnectListener, "f").call(this);
12444
+ if (__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f")) {
12445
+ __classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f").call(this);
13094
12446
  }
13095
12447
  }
13096
12448
  };
@@ -13138,9 +12490,9 @@ class RTCEndpoint {
13138
12490
  data = new TextDecoder().decode(e.data);
13139
12491
  }
13140
12492
  const { messageId, action, payload } = JSON.parse(data);
13141
- if (__classPrivateFieldGet$8(this, _RTCEndpoint_processAction, "f")) {
12493
+ if (__classPrivateFieldGet$9(this, _RTCEndpoint_processAction, "f")) {
13142
12494
  try {
13143
- const res = await __classPrivateFieldGet$8(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
12495
+ const res = await __classPrivateFieldGet$9(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
13144
12496
  this.rtc.channels.response.send(JSON.stringify({
13145
12497
  messageId,
13146
12498
  payload: res,
@@ -13174,25 +12526,25 @@ class RTCEndpoint {
13174
12526
  datachannel.onclose = (e) => {
13175
12527
  [...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.')));
13176
12528
  this.close();
13177
- if (__classPrivateFieldGet$8(this, _RTCEndpoint_disconnectListener, "f")) {
13178
- __classPrivateFieldGet$8(this, _RTCEndpoint_disconnectListener, "f").call(this);
12529
+ if (__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f")) {
12530
+ __classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f").call(this);
13179
12531
  }
13180
12532
  };
13181
12533
  });
13182
12534
  }
13183
12535
  onDisconnect(listener) {
13184
- if (!__classPrivateFieldGet$8(this, _RTCEndpoint_disconnectListener, "f")) {
13185
- __classPrivateFieldSet$6(this, _RTCEndpoint_disconnectListener, listener, "f");
12536
+ if (!__classPrivateFieldGet$9(this, _RTCEndpoint_disconnectListener, "f")) {
12537
+ __classPrivateFieldSet$7(this, _RTCEndpoint_disconnectListener, listener, "f");
13186
12538
  }
13187
12539
  else {
13188
12540
  throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
13189
12541
  }
13190
12542
  }
13191
12543
  receive(listener) {
13192
- if (__classPrivateFieldGet$8(this, _RTCEndpoint_processAction, "f")) {
12544
+ if (__classPrivateFieldGet$9(this, _RTCEndpoint_processAction, "f")) {
13193
12545
  throw new Error('You have already set a listener for this RTC Endpoint.');
13194
12546
  }
13195
- __classPrivateFieldSet$6(this, _RTCEndpoint_processAction, listener, "f");
12547
+ __classPrivateFieldSet$7(this, _RTCEndpoint_processAction, listener, "f");
13196
12548
  }
13197
12549
  get connected() {
13198
12550
  return this.rtc.rtcClient.connectionState === 'connected';
@@ -13203,12 +12555,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
13203
12555
 
13204
12556
  var strategy$1 = {};
13205
12557
 
13206
- var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12558
+ var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13207
12559
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13208
12560
  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");
13209
12561
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13210
12562
  };
13211
- var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12563
+ var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13212
12564
  if (kind === "m") throw new TypeError("Private method is not writable");
13213
12565
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13214
12566
  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");
@@ -13229,11 +12581,11 @@ class EndpointStrategy {
13229
12581
  return this.getEndpointById(endpointId).send(action, payload);
13230
12582
  };
13231
12583
  this.close = async () => {
13232
- if (__classPrivateFieldGet$7(this, _EndpointStrategy_connected, "f")) {
13233
- __classPrivateFieldGet$7(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
13234
- __classPrivateFieldSet$5(this, _EndpointStrategy_endpointMap, new Map(), "f");
12584
+ if (__classPrivateFieldGet$8(this, _EndpointStrategy_connected, "f")) {
12585
+ __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
12586
+ __classPrivateFieldSet$6(this, _EndpointStrategy_endpointMap, new Map(), "f");
13235
12587
  }
13236
- __classPrivateFieldSet$5(this, _EndpointStrategy_connected, false, "f");
12588
+ __classPrivateFieldSet$6(this, _EndpointStrategy_connected, false, "f");
13237
12589
  };
13238
12590
  this.isValidEndpointPayload = validateEndpoint;
13239
12591
  }
@@ -13241,39 +12593,39 @@ class EndpointStrategy {
13241
12593
  this.getEndpointById(endpointId).onDisconnect(listener);
13242
12594
  }
13243
12595
  receive(listener) {
13244
- if (__classPrivateFieldGet$7(this, _EndpointStrategy_processAction, "f")) {
12596
+ if (__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f")) {
13245
12597
  throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
13246
12598
  }
13247
- __classPrivateFieldSet$5(this, _EndpointStrategy_processAction, listener, "f");
12599
+ __classPrivateFieldSet$6(this, _EndpointStrategy_processAction, listener, "f");
13248
12600
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13249
- __classPrivateFieldGet$7(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$7(this, _EndpointStrategy_processAction, "f")));
12601
+ __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f")));
13250
12602
  }
13251
12603
  getEndpointById(endpointId) {
13252
- const endpoint = __classPrivateFieldGet$7(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
12604
+ const endpoint = __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
13253
12605
  if (!endpoint) {
13254
12606
  throw new Error(`Client with endpoint id ${endpointId} is not connected`);
13255
12607
  }
13256
12608
  return endpoint;
13257
12609
  }
13258
12610
  get connected() {
13259
- return __classPrivateFieldGet$7(this, _EndpointStrategy_connected, "f");
12611
+ return __classPrivateFieldGet$8(this, _EndpointStrategy_connected, "f");
13260
12612
  }
13261
12613
  isEndpointConnected(endpointId) {
13262
- return __classPrivateFieldGet$7(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
12614
+ return __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
13263
12615
  }
13264
12616
  addEndpoint(endpointId, payload) {
13265
- if (!__classPrivateFieldGet$7(this, _EndpointStrategy_connected, "f")) {
12617
+ if (!__classPrivateFieldGet$8(this, _EndpointStrategy_connected, "f")) {
13266
12618
  console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
13267
12619
  return;
13268
12620
  }
13269
12621
  const clientStrat = new this.EndpointType(payload);
13270
- if (__classPrivateFieldGet$7(this, _EndpointStrategy_processAction, "f")) {
13271
- clientStrat.receive(__classPrivateFieldGet$7(this, _EndpointStrategy_processAction, "f"));
12622
+ if (__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f")) {
12623
+ clientStrat.receive(__classPrivateFieldGet$8(this, _EndpointStrategy_processAction, "f"));
13272
12624
  }
13273
- __classPrivateFieldGet$7(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
12625
+ __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
13274
12626
  }
13275
12627
  async closeEndpoint(endpointId) {
13276
- __classPrivateFieldGet$7(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
12628
+ __classPrivateFieldGet$8(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
13277
12629
  }
13278
12630
  }
13279
12631
  strategy$1.EndpointStrategy = EndpointStrategy;
@@ -13455,12 +12807,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
13455
12807
  }
13456
12808
  runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
13457
12809
 
13458
- var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12810
+ var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13459
12811
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13460
12812
  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");
13461
12813
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13462
12814
  };
13463
- var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12815
+ var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13464
12816
  if (kind === "m") throw new TypeError("Private method is not writable");
13465
12817
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13466
12818
  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");
@@ -13502,18 +12854,18 @@ class ChannelProvider extends channel_1.ChannelBase {
13502
12854
  * a read-only array containing all the identities of connecting clients.
13503
12855
  */
13504
12856
  get connections() {
13505
- return [...__classPrivateFieldGet$6(this, _ChannelProvider_connections, "f")];
12857
+ return [...__classPrivateFieldGet$7(this, _ChannelProvider_connections, "f")];
13506
12858
  }
13507
12859
  static handleClientDisconnection(channel, payload) {
13508
12860
  const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
13509
12861
  if (removeById) {
13510
- __classPrivateFieldGet$6(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
12862
+ __classPrivateFieldGet$7(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
13511
12863
  }
13512
12864
  else {
13513
12865
  const multipleRemoves = channel.connections.filter((identity) => {
13514
12866
  return identity.uuid === payload.uuid && identity.name === payload.name;
13515
12867
  });
13516
- multipleRemoves.forEach(__classPrivateFieldGet$6(channel, _ChannelProvider_removeEndpoint, "f"));
12868
+ multipleRemoves.forEach(__classPrivateFieldGet$7(channel, _ChannelProvider_removeEndpoint, "f"));
13517
12869
  }
13518
12870
  channel.disconnectListener(payload);
13519
12871
  }
@@ -13530,8 +12882,8 @@ class ChannelProvider extends channel_1.ChannelBase {
13530
12882
  _ChannelProvider_strategy.set(this, void 0);
13531
12883
  _ChannelProvider_removeEndpoint.set(this, (identity) => {
13532
12884
  const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
13533
- __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
13534
- __classPrivateFieldSet$4(this, _ChannelProvider_connections, remainingConnections, "f");
12885
+ __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
12886
+ __classPrivateFieldSet$5(this, _ChannelProvider_connections, remainingConnections, "f");
13535
12887
  });
13536
12888
  // Must be bound.
13537
12889
  this.processAction = async (action, payload, senderIdentity) => {
@@ -13545,17 +12897,17 @@ class ChannelProvider extends channel_1.ChannelBase {
13545
12897
  return super.processAction(action, payload, senderIdentity);
13546
12898
  };
13547
12899
  _ChannelProvider_close.set(this, () => {
13548
- __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").close();
12900
+ __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").close();
13549
12901
  const remove = ChannelProvider.removalMap.get(this);
13550
12902
  if (remove) {
13551
12903
  remove();
13552
12904
  }
13553
12905
  });
13554
- __classPrivateFieldSet$4(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
12906
+ __classPrivateFieldSet$5(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
13555
12907
  this.connectListener = () => undefined;
13556
12908
  this.disconnectListener = () => undefined;
13557
- __classPrivateFieldSet$4(this, _ChannelProvider_connections, [], "f");
13558
- __classPrivateFieldSet$4(this, _ChannelProvider_strategy, strategy, "f");
12909
+ __classPrivateFieldSet$5(this, _ChannelProvider_connections, [], "f");
12910
+ __classPrivateFieldSet$5(this, _ChannelProvider_strategy, strategy, "f");
13559
12911
  strategy.receive(this.processAction);
13560
12912
  }
13561
12913
  /**
@@ -13586,13 +12938,13 @@ class ChannelProvider extends channel_1.ChannelBase {
13586
12938
  */
13587
12939
  dispatch(to, action, payload) {
13588
12940
  const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
13589
- if (endpointId && __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
13590
- return __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
12941
+ if (endpointId && __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
12942
+ return __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
13591
12943
  }
13592
12944
  return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
13593
12945
  }
13594
12946
  async processConnection(senderId, payload) {
13595
- __classPrivateFieldGet$6(this, _ChannelProvider_connections, "f").push(senderId);
12947
+ __classPrivateFieldGet$7(this, _ChannelProvider_connections, "f").push(senderId);
13596
12948
  return this.connectListener(senderId, payload);
13597
12949
  }
13598
12950
  /**
@@ -13615,7 +12967,7 @@ class ChannelProvider extends channel_1.ChannelBase {
13615
12967
  * ```
13616
12968
  */
13617
12969
  publish(action, payload) {
13618
- return this.connections.map((to) => __classPrivateFieldGet$6(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
12970
+ return this.connections.map((to) => __classPrivateFieldGet$7(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
13619
12971
  }
13620
12972
  /**
13621
12973
  * Register a listener that is called on every new client connection.
@@ -13689,11 +13041,11 @@ class ChannelProvider extends channel_1.ChannelBase {
13689
13041
  * ```
13690
13042
  */
13691
13043
  async destroy() {
13692
- const protectedObj = __classPrivateFieldGet$6(this, _ChannelProvider_protectedObj, "f");
13044
+ const protectedObj = __classPrivateFieldGet$7(this, _ChannelProvider_protectedObj, "f");
13693
13045
  protectedObj.providerIdentity;
13694
- __classPrivateFieldSet$4(this, _ChannelProvider_connections, [], "f");
13046
+ __classPrivateFieldSet$5(this, _ChannelProvider_connections, [], "f");
13695
13047
  await protectedObj.close();
13696
- __classPrivateFieldGet$6(this, _ChannelProvider_close, "f").call(this);
13048
+ __classPrivateFieldGet$7(this, _ChannelProvider_close, "f").call(this);
13697
13049
  }
13698
13050
  /**
13699
13051
  * Returns an array with info on every Client connected to the Provider
@@ -13763,7 +13115,7 @@ class ChannelProvider extends channel_1.ChannelBase {
13763
13115
  getEndpointIdForOpenFinId(clientIdentity, action) {
13764
13116
  const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
13765
13117
  if (matchingConnections.length >= 2) {
13766
- const protectedObj = __classPrivateFieldGet$6(this, _ChannelProvider_protectedObj, "f");
13118
+ const protectedObj = __classPrivateFieldGet$7(this, _ChannelProvider_protectedObj, "f");
13767
13119
  const { uuid, name } = clientIdentity;
13768
13120
  const providerUuid = protectedObj?.providerIdentity.uuid;
13769
13121
  const providerName = protectedObj?.providerIdentity.name;
@@ -13972,17 +13324,20 @@ class CombinedStrategy {
13972
13324
  }
13973
13325
  strategy.default = CombinedStrategy;
13974
13326
 
13975
- var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13327
+ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13976
13328
  if (kind === "m") throw new TypeError("Private method is not writable");
13977
13329
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13978
13330
  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");
13979
13331
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13980
13332
  };
13981
- var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13333
+ var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13982
13334
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13983
13335
  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");
13984
13336
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13985
13337
  };
13338
+ var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
13339
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13340
+ };
13986
13341
  var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
13987
13342
  Object.defineProperty(connectionManager, "__esModule", { value: true });
13988
13343
  connectionManager.ConnectionManager = void 0;
@@ -13994,7 +13349,7 @@ const ice_manager_1 = iceManager;
13994
13349
  const provider_1$1 = provider;
13995
13350
  const message_receiver_1 = messageReceiver;
13996
13351
  const protocol_manager_1 = protocolManager;
13997
- const strategy_3 = strategy;
13352
+ const strategy_3 = __importDefault$1(strategy);
13998
13353
  class ConnectionManager extends base_1$a.Base {
13999
13354
  static getProtocolOptionsFromStrings(protocols) {
14000
13355
  return protocols.map((protocol) => {
@@ -14024,8 +13379,8 @@ class ConnectionManager extends base_1$a.Base {
14024
13379
  };
14025
13380
  this.providerMap = new Map();
14026
13381
  this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
14027
- __classPrivateFieldSet$3(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
14028
- __classPrivateFieldSet$3(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
13382
+ __classPrivateFieldSet$4(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
13383
+ __classPrivateFieldSet$4(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
14029
13384
  wire.registerMessageHandler(this.onmessage.bind(this));
14030
13385
  }
14031
13386
  createProvider(options, providerIdentity) {
@@ -14036,7 +13391,7 @@ class ConnectionManager extends base_1$a.Base {
14036
13391
  case 'rtc':
14037
13392
  return new strategy_2.RTCStrategy();
14038
13393
  case 'classic':
14039
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$5(this, _ConnectionManager_messageReceiver, "f"),
13394
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$6(this, _ConnectionManager_messageReceiver, "f"),
14040
13395
  // Providers do not have an endpointId, use channelId as endpointId in the strategy.
14041
13396
  providerIdentity.channelId, providerIdentity);
14042
13397
  default:
@@ -14072,7 +13427,7 @@ class ConnectionManager extends base_1$a.Base {
14072
13427
  const supportedProtocols = await Promise.all(protocols.map(async (type) => {
14073
13428
  switch (type) {
14074
13429
  case 'rtc': {
14075
- const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$5(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
13430
+ const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$6(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
14076
13431
  rtcPacket = { rtcClient, channels, channelsOpened };
14077
13432
  return {
14078
13433
  type: 'rtc',
@@ -14099,18 +13454,18 @@ class ConnectionManager extends base_1$a.Base {
14099
13454
  routingInfo.endpointId = this.wire.environment.getNextMessageId();
14100
13455
  // For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
14101
13456
  // clients that are in the same context as the newly-connected client.
14102
- __classPrivateFieldGet$5(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
13457
+ __classPrivateFieldGet$6(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
14103
13458
  }
14104
13459
  const answer = routingInfo.answer ?? {
14105
13460
  supportedProtocols: [{ type: 'classic', version: 1 }]
14106
13461
  };
14107
13462
  const createStrategyFromAnswer = async (protocol) => {
14108
13463
  if (protocol.type === 'rtc' && rtcPacket) {
14109
- await __classPrivateFieldGet$5(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
13464
+ await __classPrivateFieldGet$6(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
14110
13465
  return new strategy_2.RTCStrategy();
14111
13466
  }
14112
13467
  if (protocol.type === 'classic') {
14113
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$5(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
13468
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$6(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
14114
13469
  }
14115
13470
  return null;
14116
13471
  };
@@ -14178,7 +13533,7 @@ class ConnectionManager extends base_1$a.Base {
14178
13533
  clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
14179
13534
  const answer = await accumP;
14180
13535
  if (protocolToUse.type === 'rtc') {
14181
- const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$5(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
13536
+ const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$6(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
14182
13537
  answer.supportedProtocols.push({
14183
13538
  type: 'rtc',
14184
13539
  version: strategy_2.RTCInfo.version,
@@ -14226,13 +13581,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
14226
13581
  *
14227
13582
  * @packageDocumentation
14228
13583
  */
14229
- var __classPrivateFieldSet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13584
+ var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
14230
13585
  if (kind === "m") throw new TypeError("Private method is not writable");
14231
13586
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14232
13587
  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");
14233
13588
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
14234
13589
  };
14235
- var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13590
+ var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14236
13591
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
14237
13592
  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");
14238
13593
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -14241,7 +13596,7 @@ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnec
14241
13596
  Object.defineProperty(channel$1, "__esModule", { value: true });
14242
13597
  channel$1.Channel = void 0;
14243
13598
  /* eslint-disable no-console */
14244
- const events_1$2 = require$$0;
13599
+ const events_1$2 = require$$0$1;
14245
13600
  const lazy_1$1 = lazy;
14246
13601
  const base_1$9 = base;
14247
13602
  const client_1 = client;
@@ -14289,11 +13644,11 @@ class Channel extends base_1$9.EmitterBase {
14289
13644
  client_1.ChannelClient.handleProviderDisconnect(eventPayload);
14290
13645
  }),
14291
13646
  this.on('connected', (...args) => {
14292
- __classPrivateFieldGet$4(this, _Channel_internalEmitter, "f").emit('connected', ...args);
13647
+ __classPrivateFieldGet$5(this, _Channel_internalEmitter, "f").emit('connected', ...args);
14293
13648
  })
14294
13649
  ]).catch(() => new Error('error setting up channel connection listeners'));
14295
13650
  }));
14296
- __classPrivateFieldSet$2(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
13651
+ __classPrivateFieldSet$3(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
14297
13652
  }
14298
13653
  /**
14299
13654
  *
@@ -14368,7 +13723,7 @@ class Channel extends base_1$9.EmitterBase {
14368
13723
  resolve(true);
14369
13724
  }
14370
13725
  };
14371
- __classPrivateFieldGet$4(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
13726
+ __classPrivateFieldGet$5(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
14372
13727
  });
14373
13728
  try {
14374
13729
  if (retryInfo.count > 0) {
@@ -14400,7 +13755,7 @@ class Channel extends base_1$9.EmitterBase {
14400
13755
  finally {
14401
13756
  retryInfo.count += 1;
14402
13757
  // in case of other errors, remove our listener
14403
- __classPrivateFieldGet$4(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
13758
+ __classPrivateFieldGet$5(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
14404
13759
  }
14405
13760
  } while (shouldWait); // If we're waiting we retry the above loop
14406
13761
  // Should wait was false, no channel was found.
@@ -14459,12 +13814,12 @@ class Channel extends base_1$9.EmitterBase {
14459
13814
  async connect(channelName, options = {}) {
14460
13815
  // Make sure we don't connect before listeners are set up
14461
13816
  // This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
14462
- await __classPrivateFieldGet$4(this, _Channel_readyToConnect, "f").getValue();
13817
+ await __classPrivateFieldGet$5(this, _Channel_readyToConnect, "f").getValue();
14463
13818
  if (!channelName || typeof channelName !== 'string') {
14464
13819
  throw new Error('Please provide a channelName string to connect to a channel.');
14465
13820
  }
14466
13821
  const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
14467
- const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$4(this, _Channel_connectionManager, "f").createClientOffer(opts);
13822
+ const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$5(this, _Channel_connectionManager, "f").createClientOffer(opts);
14468
13823
  let connectionUrl;
14469
13824
  if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
14470
13825
  connectionUrl = (await this.fin.me.getInfo()).url;
@@ -14476,7 +13831,7 @@ class Channel extends base_1$9.EmitterBase {
14476
13831
  connectionUrl
14477
13832
  };
14478
13833
  const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
14479
- const strategy = await __classPrivateFieldGet$4(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
13834
+ const strategy = await __classPrivateFieldGet$5(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
14480
13835
  const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
14481
13836
  // It is the client's responsibility to handle endpoint disconnection to the provider.
14482
13837
  // If the endpoint dies, the client will force a disconnection through the core.
@@ -14545,7 +13900,7 @@ class Channel extends base_1$9.EmitterBase {
14545
13900
  throw new Error('Please provide a channelName to create a channel');
14546
13901
  }
14547
13902
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
14548
- const channel = __classPrivateFieldGet$4(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
13903
+ const channel = __classPrivateFieldGet$5(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
14549
13904
  // TODO: fix typing (internal)
14550
13905
  // @ts-expect-error
14551
13906
  this.on('client-disconnected', (eventPayload) => {
@@ -14568,7 +13923,7 @@ interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
14568
13923
  *
14569
13924
  * @packageDocumentation
14570
13925
  */
14571
- const events_1$1 = require$$0;
13926
+ const events_1$1 = require$$0$1;
14572
13927
  const base_1$8 = base;
14573
13928
  const ref_counter_1 = refCounter;
14574
13929
  const index_1$2 = channel$1;
@@ -15111,7 +14466,7 @@ var Factory$2 = {};
15111
14466
 
15112
14467
  var Instance$2 = {};
15113
14468
 
15114
- var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14469
+ var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15115
14470
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15116
14471
  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");
15117
14472
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -15144,7 +14499,7 @@ class Platform extends base_1$5.EmitterBase {
15144
14499
  const target = identity || this.identity;
15145
14500
  const { uuid } = target;
15146
14501
  if (!clientMap.has(uuid)) {
15147
- const clientPromise = __classPrivateFieldGet$3(this, _Platform_connectToProvider, "f").call(this, uuid);
14502
+ const clientPromise = __classPrivateFieldGet$4(this, _Platform_connectToProvider, "f").call(this, uuid);
15148
14503
  clientMap.set(uuid, clientPromise);
15149
14504
  }
15150
14505
  // we set it above
@@ -15771,181 +15126,845 @@ class Platform extends base_1$5.EmitterBase {
15771
15126
  return this;
15772
15127
  }
15773
15128
  /**
15774
- * 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.
15775
- * It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
15776
- * @param context - A field where serializable context data can be stored to be saved in platform snapshots.
15777
- * @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
15778
- * to the current window (if called from a Window) or the current host window (if called from a View).
15779
- *
15780
- * @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
15781
- * platform.
15782
- * This method can be called from the window itself, or from any child view. Context data is shared by all
15783
- * entities within a window.
15784
- *
15785
- * @example
15786
- * Setting own context:
15787
- * ```js
15788
- * const platform = fin.Platform.getCurrentSync();
15789
- * const contextData = {
15790
- * security: 'STOCK',
15791
- * currentView: 'detailed'
15792
- * }
15793
- *
15794
- * await platform.setWindowContext(contextData);
15795
- * // Context of current window is now set to `contextData`
15796
- * ```
15797
- *
15798
- * Setting the context of another window or view:
15799
- * ```js
15800
- * const platform = fin.Platform.getCurrentSync();
15801
- * const contextData = {
15802
- * security: 'STOCK',
15803
- * currentView: 'detailed'
15804
- * }
15805
- *
15806
- * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
15807
- * await platform.setWindowContext(contextData, windowOrViewIdentity);
15808
- * // Context of the target window or view is now set to `contextData`
15809
- * ```
15810
- *
15811
- * A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
15812
- * This event will fire when a host window's context is updated or when the view is reparented to a new window:
15813
- *
15814
- * ```js
15815
- * // From a view
15816
- * const contextChangeHandler = ({ context }) => {
15817
- * console.log('Host window\'s context has changed. New context data:', context);
15818
- * // react to new context data here
15819
- * }
15820
- * await fin.me.on('host-context-changed', contextChangeHandler);
15821
- *
15822
- * const platform = await fin.Platform.getCurrentSync();
15823
- * const contextData = {
15824
- * security: 'STOCK',
15825
- * currentView: 'detailed'
15826
- * }
15827
- * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
15828
- * ```
15829
- *
15830
- * To listen to a window's context updates, use the `context-changed` event:
15831
- * ```js
15832
- * // From a window
15833
- * const contextChangeHandler = ({ context }) => {
15834
- * console.log('This window\'s context has changed. New context data:', context);
15835
- * // react to new context data here
15836
- * }
15837
- * await fin.me.on('context-changed', contextChangeHandler);
15838
- *
15839
- * const platform = await fin.Platform.getCurrentSync();
15840
- * const contextData = {
15841
- * security: 'STOCK',
15842
- * currentView: 'detailed'
15843
- * }
15844
- * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
15845
- * ```
15846
- * @experimental
15129
+ * 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.
15130
+ * It can be retrieved using {@link Platform#getWindowContext getWindowContext}.
15131
+ * @param context - A field where serializable context data can be stored to be saved in platform snapshots.
15132
+ * @param target - A target window or view may optionally be provided. If no target is provided, the update will be applied
15133
+ * to the current window (if called from a Window) or the current host window (if called from a View).
15134
+ *
15135
+ * @remarks The context data must be serializable. This can only be called from a window or view that has been launched into a
15136
+ * platform.
15137
+ * This method can be called from the window itself, or from any child view. Context data is shared by all
15138
+ * entities within a window.
15139
+ *
15140
+ * @example
15141
+ * Setting own context:
15142
+ * ```js
15143
+ * const platform = fin.Platform.getCurrentSync();
15144
+ * const contextData = {
15145
+ * security: 'STOCK',
15146
+ * currentView: 'detailed'
15147
+ * }
15148
+ *
15149
+ * await platform.setWindowContext(contextData);
15150
+ * // Context of current window is now set to `contextData`
15151
+ * ```
15152
+ *
15153
+ * Setting the context of another window or view:
15154
+ * ```js
15155
+ * const platform = fin.Platform.getCurrentSync();
15156
+ * const contextData = {
15157
+ * security: 'STOCK',
15158
+ * currentView: 'detailed'
15159
+ * }
15160
+ *
15161
+ * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
15162
+ * await platform.setWindowContext(contextData, windowOrViewIdentity);
15163
+ * // Context of the target window or view is now set to `contextData`
15164
+ * ```
15165
+ *
15166
+ * A view can listen to changes to its host window's context by listening to the `host-context-changed` event.
15167
+ * This event will fire when a host window's context is updated or when the view is reparented to a new window:
15168
+ *
15169
+ * ```js
15170
+ * // From a view
15171
+ * const contextChangeHandler = ({ context }) => {
15172
+ * console.log('Host window\'s context has changed. New context data:', context);
15173
+ * // react to new context data here
15174
+ * }
15175
+ * await fin.me.on('host-context-changed', contextChangeHandler);
15176
+ *
15177
+ * const platform = await fin.Platform.getCurrentSync();
15178
+ * const contextData = {
15179
+ * security: 'STOCK',
15180
+ * currentView: 'detailed'
15181
+ * }
15182
+ * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
15183
+ * ```
15184
+ *
15185
+ * To listen to a window's context updates, use the `context-changed` event:
15186
+ * ```js
15187
+ * // From a window
15188
+ * const contextChangeHandler = ({ context }) => {
15189
+ * console.log('This window\'s context has changed. New context data:', context);
15190
+ * // react to new context data here
15191
+ * }
15192
+ * await fin.me.on('context-changed', contextChangeHandler);
15193
+ *
15194
+ * const platform = await fin.Platform.getCurrentSync();
15195
+ * const contextData = {
15196
+ * security: 'STOCK',
15197
+ * currentView: 'detailed'
15198
+ * }
15199
+ * platform.setWindowContext(contextData) // contextChangeHandler will log the new context
15200
+ * ```
15201
+ * @experimental
15202
+ */
15203
+ async setWindowContext(context = {}, target) {
15204
+ this.wire.sendAction('platform-set-window-context', this.identity).catch((e) => {
15205
+ // don't expose
15206
+ });
15207
+ if (!context) {
15208
+ throw new Error('Please provide a serializable object or string to set the context.');
15209
+ }
15210
+ const client = await this.getClient();
15211
+ const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
15212
+ await client.dispatch('set-window-context', {
15213
+ context,
15214
+ entityType,
15215
+ target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }
15216
+ });
15217
+ }
15218
+ /**
15219
+ * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
15220
+ * The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
15221
+ * @param target - A target window or view may optionally be provided. If no target is provided, target will be
15222
+ * the current window (if called from a Window) or the current host window (if called from a View).
15223
+ *
15224
+ * @remarks This method can be called from the window itself, or from any child view. Context data is shared
15225
+ * by all entities within a window.
15226
+ *
15227
+ * @example
15228
+ *
15229
+ * Retrieving context from current window:
15230
+ * ```js
15231
+ * const platform = fin.Platform.getCurrentSync();
15232
+ * const customContext = { answer: 42 };
15233
+ * await platform.setWindowContext(customContext);
15234
+ *
15235
+ * const myContext = await platform.getWindowContext();
15236
+ * console.log(myContext); // { answer: 42 }
15237
+ * ```
15238
+ *
15239
+ * Retrieving the context of another window or view:
15240
+ * ```js
15241
+ * const platform = fin.Platform.getCurrentSync();
15242
+ *
15243
+ * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
15244
+ *
15245
+ * const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
15246
+ * console.log(targetWindowContext); // context of target window
15247
+ * ```
15248
+ * @experimental
15249
+ */
15250
+ async getWindowContext(target) {
15251
+ this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
15252
+ // don't expose
15253
+ });
15254
+ const client = await this.getClient();
15255
+ const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
15256
+ return client.dispatch('get-window-context', {
15257
+ target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name },
15258
+ entityType
15259
+ });
15260
+ }
15261
+ /**
15262
+ * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
15263
+ * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
15264
+ * @param winId
15265
+ * @param options
15266
+ *
15267
+ * @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,
15268
+ * it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
15269
+ *
15270
+ * @example
15271
+ *
15272
+ * ```js
15273
+ * // Close the current Window inside a Window context
15274
+ * const platform = await fin.Platform.getCurrent();
15275
+ * platform.closeWindow(fin.me.identity);
15276
+ *
15277
+ * // Close the Window from inside a View context
15278
+ * const platform = await fin.Platform.getCurrent();
15279
+ * const parentWindow = await fin.me.getCurrentWindow();
15280
+ * platform.closeWindow(parentWindow.identity);
15281
+ *
15282
+ * // Close the Window and do not fire the before unload handler on Views
15283
+ * const platform = await fin.Platform.getCurrent();
15284
+ * platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
15285
+ * ```
15286
+ * @experimental
15287
+ */
15288
+ async closeWindow(windowId, options = { skipBeforeUnload: false }) {
15289
+ this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
15290
+ // don't expose
15291
+ });
15292
+ const client = await this.getClient();
15293
+ return client.dispatch('close-window', { windowId, options });
15294
+ }
15295
+ }
15296
+ Instance$2.Platform = Platform;
15297
+ _Platform_connectToProvider = new WeakMap();
15298
+
15299
+ var layout = {};
15300
+
15301
+ var Factory$1 = {};
15302
+
15303
+ var Instance$1 = {};
15304
+
15305
+ var layoutEntities = {};
15306
+
15307
+ var apiExposer$1 = {};
15308
+
15309
+ var apiConsumer = {};
15310
+
15311
+ Object.defineProperty(apiConsumer, "__esModule", { value: true });
15312
+ apiConsumer.ApiConsumer = void 0;
15313
+ /**
15314
+ * Consumer for apis exposed with {@see ApiExposer}.
15315
+ *
15316
+ * A strategy that matches the strategy used to expose a target API must be provided.
15317
+ */
15318
+ class ApiConsumer {
15319
+ // eslint-disable-next-line
15320
+ constructor(strategy) {
15321
+ this.strategy = strategy;
15322
+ /**
15323
+ * Consumes an api exposed using a given transport strategy, and generates a client
15324
+ * for easy, type safe consumption of that client.
15325
+ * @param options Strategy specific consumption options.
15326
+ * @returns An api client matching the given type.
15327
+ */
15328
+ this.consume = async (options) => {
15329
+ const exposedProperties = await this.strategy.getExposedFunctions(options);
15330
+ return exposedProperties.reduce((client, prop) => ({
15331
+ ...client,
15332
+ [prop.key]: this.strategy.createFunction(prop, options)
15333
+ }), {});
15334
+ };
15335
+ }
15336
+ }
15337
+ apiConsumer.ApiConsumer = ApiConsumer;
15338
+
15339
+ var apiExposer = {};
15340
+
15341
+ var decorators = {};
15342
+
15343
+ Object.defineProperty(decorators, "__esModule", { value: true });
15344
+ decorators.expose = decorators.getExposedProperties = void 0;
15345
+ const exposedProperties = Symbol('exposedProperties');
15346
+ const getExposedProperties = (target) => {
15347
+ return target[exposedProperties] || target.prototype[exposedProperties] || [];
15348
+ };
15349
+ decorators.getExposedProperties = getExposedProperties;
15350
+ /**
15351
+ * Indicates that a class member function can be exposed using {@link ApiExposer}.
15352
+ * @param options Options specific to the strategy used in {@link ApiExposer}
15353
+ */
15354
+ // Returns any as decorator typing is weird.
15355
+ const expose = (options) => (target, key, descriptor) => {
15356
+ target[exposedProperties] = target[exposedProperties] || [];
15357
+ target[exposedProperties].push({ key, descriptor, options });
15358
+ };
15359
+ decorators.expose = expose;
15360
+
15361
+ Object.defineProperty(apiExposer, "__esModule", { value: true });
15362
+ apiExposer.ApiExposer = void 0;
15363
+ const decorators_1 = decorators;
15364
+ /**
15365
+ * Exposes api services on the transport of choice.
15366
+ */
15367
+ class ApiExposer {
15368
+ /**
15369
+ * @param strategy The expose strategy to use to expose instances.
15847
15370
  */
15848
- async setWindowContext(context = {}, target) {
15849
- this.wire.sendAction('platform-set-window-context', this.identity).catch((e) => {
15850
- // don't expose
15371
+ // eslint-disable-next-line
15372
+ constructor(strategy) {
15373
+ this.strategy = strategy;
15374
+ /**
15375
+ * Exposes an instance of a given api on
15376
+ * @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
15377
+ * @param instanceOptions Transport strategy specific options to use when exposing.
15378
+ */
15379
+ this.exposeInstance = async (instance, instanceOptions) => {
15380
+ const exposableProps = (0, decorators_1.getExposedProperties)(instance);
15381
+ const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
15382
+ const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
15383
+ key,
15384
+ options,
15385
+ meta: instanceOptions
15386
+ });
15387
+ return {
15388
+ key,
15389
+ options: customConsumptionOptions
15390
+ };
15391
+ }));
15392
+ await this.strategy.exposeMeta(instanceOptions, exposedProps);
15393
+ };
15394
+ }
15395
+ ;
15396
+ }
15397
+ apiExposer.ApiExposer = ApiExposer;
15398
+
15399
+ var strategies = {};
15400
+
15401
+ var openfinChannels = {};
15402
+
15403
+ var channelsConsumer = {};
15404
+
15405
+ Object.defineProperty(channelsConsumer, "__esModule", { value: true });
15406
+ channelsConsumer.ChannelsConsumer = void 0;
15407
+ class ChannelsConsumer {
15408
+ // eslint-disable-next-line
15409
+ constructor(channel) {
15410
+ this.channel = channel;
15411
+ this.getExposedFunctions = async (options) => {
15412
+ const { id } = options;
15413
+ const { props } = await this.channel.dispatch(`api-meta:${id}`);
15414
+ return props;
15415
+ };
15416
+ this.createFunction = (prop) => (...args) => {
15417
+ const { action } = prop.options;
15418
+ return this.channel.dispatch(action, { args });
15419
+ };
15420
+ }
15421
+ ;
15422
+ }
15423
+ channelsConsumer.ChannelsConsumer = ChannelsConsumer;
15424
+
15425
+ var channelsExposer = {};
15426
+
15427
+ Object.defineProperty(channelsExposer, "__esModule", { value: true });
15428
+ channelsExposer.ChannelsExposer = void 0;
15429
+ class ChannelsExposer {
15430
+ // eslint-disable-next-line
15431
+ constructor(channelProviderOrClient) {
15432
+ this.channelProviderOrClient = channelProviderOrClient;
15433
+ this.exposeFunction = async (target, config) => {
15434
+ const { key, options, meta } = config;
15435
+ const { id } = meta;
15436
+ const action = `${id}.${options?.action || key}`;
15437
+ await this.channelProviderOrClient.register(action, async ({ args }) => {
15438
+ return target(...args);
15439
+ });
15440
+ return { action };
15441
+ };
15442
+ this.exposeMeta = async ({ id }, props) => {
15443
+ const action = `api-meta:${id}`;
15444
+ await this.channelProviderOrClient.register(action, () => ({ props }));
15445
+ };
15446
+ }
15447
+ }
15448
+ channelsExposer.ChannelsExposer = ChannelsExposer;
15449
+
15450
+ (function (exports) {
15451
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15452
+ if (k2 === undefined) k2 = k;
15453
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15454
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15455
+ desc = { enumerable: true, get: function() { return m[k]; } };
15456
+ }
15457
+ Object.defineProperty(o, k2, desc);
15458
+ }) : (function(o, m, k, k2) {
15459
+ if (k2 === undefined) k2 = k;
15460
+ o[k2] = m[k];
15461
+ }));
15462
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
15463
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15464
+ };
15465
+ Object.defineProperty(exports, "__esModule", { value: true });
15466
+ __exportStar(channelsConsumer, exports);
15467
+ __exportStar(channelsExposer, exports);
15468
+ } (openfinChannels));
15469
+
15470
+ (function (exports) {
15471
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15472
+ if (k2 === undefined) k2 = k;
15473
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15474
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15475
+ desc = { enumerable: true, get: function() { return m[k]; } };
15476
+ }
15477
+ Object.defineProperty(o, k2, desc);
15478
+ }) : (function(o, m, k, k2) {
15479
+ if (k2 === undefined) k2 = k;
15480
+ o[k2] = m[k];
15481
+ }));
15482
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
15483
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15484
+ };
15485
+ Object.defineProperty(exports, "__esModule", { value: true });
15486
+ __exportStar(openfinChannels, exports);
15487
+ } (strategies));
15488
+
15489
+ (function (exports) {
15490
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15491
+ if (k2 === undefined) k2 = k;
15492
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15493
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15494
+ desc = { enumerable: true, get: function() { return m[k]; } };
15495
+ }
15496
+ Object.defineProperty(o, k2, desc);
15497
+ }) : (function(o, m, k, k2) {
15498
+ if (k2 === undefined) k2 = k;
15499
+ o[k2] = m[k];
15500
+ }));
15501
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
15502
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15503
+ };
15504
+ Object.defineProperty(exports, "__esModule", { value: true });
15505
+ __exportStar(apiConsumer, exports);
15506
+ __exportStar(apiExposer, exports);
15507
+ __exportStar(strategies, exports);
15508
+ __exportStar(decorators, exports);
15509
+ } (apiExposer$1));
15510
+
15511
+ var channelApiRelay = {};
15512
+
15513
+ Object.defineProperty(channelApiRelay, "__esModule", { value: true });
15514
+ channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
15515
+ const EXPECTED_ERRORS = [
15516
+ 'no longer connected',
15517
+ 'RTCDataChannel closed unexpectedly',
15518
+ 'The client you are trying to dispatch from is disconnected from the target provider',
15519
+ ];
15520
+ // Checks possible error messages that we want to trap, client error message can originate
15521
+ // from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
15522
+ const isDisconnectedError = (errorMsg) => {
15523
+ return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
15524
+ };
15525
+ /**
15526
+ * @internal
15527
+ * Create a channel relay for a given channel exposition, allowing a single provider to route
15528
+ * actions to the designated clients.
15529
+ *
15530
+ * Designed to be used in conjunction with @expose
15531
+ *
15532
+ * @param channelProvider The channel provider to relay the actions on.
15533
+ * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
15534
+ */
15535
+ const relayChannelClientApi = async (channelProvider, relayId) => {
15536
+ channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
15537
+ return channelProvider.dispatch(target, action, payload);
15538
+ });
15539
+ await Promise.resolve();
15540
+ };
15541
+ channelApiRelay.relayChannelClientApi = relayChannelClientApi;
15542
+ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
15543
+ try {
15544
+ return await client.dispatch(`relay:${relayId}`, {
15545
+ action,
15546
+ payload,
15547
+ target
15851
15548
  });
15852
- if (!context) {
15853
- throw new Error('Please provide a serializable object or string to set the context.');
15549
+ }
15550
+ catch (e) {
15551
+ if (isDisconnectedError(e.message) && relayErrorMsg) {
15552
+ throw new Error(relayErrorMsg);
15854
15553
  }
15855
- const client = await this.getClient();
15856
- const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
15857
- await client.dispatch('set-window-context', {
15858
- context,
15859
- entityType,
15860
- target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name }
15861
- });
15554
+ throw e;
15862
15555
  }
15556
+ };
15557
+ channelApiRelay.createRelayedDispatch = createRelayedDispatch;
15558
+
15559
+ var __classPrivateFieldSet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15560
+ if (kind === "m") throw new TypeError("Private method is not writable");
15561
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15562
+ 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");
15563
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15564
+ };
15565
+ var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15566
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15567
+ 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");
15568
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15569
+ };
15570
+ var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
15571
+ Object.defineProperty(layoutEntities, "__esModule", { value: true });
15572
+ layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
15573
+ const api_exposer_1 = apiExposer$1;
15574
+ const channel_api_relay_1 = channelApiRelay;
15575
+ /*
15576
+ This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
15577
+ intertwined, and share members via parent abstract class LayoutNode. To prevent circular
15578
+ refs, we define and export all the classes here.
15579
+ */
15580
+ /**
15581
+ * @ignore
15582
+ * @internal
15583
+ * Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
15584
+ * for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
15585
+ */
15586
+ class LayoutNode {
15863
15587
  /**
15864
- * Get the context context of a host window that was previously set using {@link Platform#setWindowContext setWindowContext}.
15865
- * The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
15866
- * @param target - A target window or view may optionally be provided. If no target is provided, target will be
15867
- * the current window (if called from a Window) or the current host window (if called from a View).
15868
- *
15869
- * @remarks This method can be called from the window itself, or from any child view. Context data is shared
15870
- * by all entities within a window.
15871
- *
15872
- * @example
15873
- *
15874
- * Retrieving context from current window:
15875
- * ```js
15876
- * const platform = fin.Platform.getCurrentSync();
15877
- * const customContext = { answer: 42 };
15878
- * await platform.setWindowContext(customContext);
15879
- *
15880
- * const myContext = await platform.getWindowContext();
15881
- * console.log(myContext); // { answer: 42 }
15882
- * ```
15883
- *
15884
- * Retrieving the context of another window or view:
15885
- * ```js
15886
- * const platform = fin.Platform.getCurrentSync();
15887
- *
15888
- * const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
15889
- *
15890
- * const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
15891
- * console.log(targetWindowContext); // context of target window
15892
- * ```
15893
- * @experimental
15588
+ * @internal
15589
+ * @ignore
15894
15590
  */
15895
- async getWindowContext(target) {
15896
- this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
15897
- // don't expose
15898
- });
15899
- const client = await this.getClient();
15900
- const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
15901
- return client.dispatch('get-window-context', {
15902
- target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name },
15903
- entityType
15904
- });
15591
+ constructor(client, entityId) {
15592
+ /**
15593
+ * @ignore
15594
+ * @internal
15595
+ * ApiClient for {@link LayoutEntitiesController}
15596
+ */
15597
+ _LayoutNode_client.set(this, void 0);
15598
+ /**
15599
+ * Checks if the TabStack or ColumnOrRow is the root content item
15600
+ *
15601
+ * @example
15602
+ * ```js
15603
+ * if (!fin.me.isView) {
15604
+ * throw new Error('Not running in a platform View.');
15605
+ * }
15606
+ *
15607
+ * const stack = await fin.me.getCurrentStack();
15608
+ * const isRoot = await stack.isRoot();
15609
+ * // The TabStack is root: false
15610
+ * console.log(`The TabStack is root: ${isRoot}`);
15611
+ *
15612
+ * // Retrieves the parent ColumnOrRow
15613
+ * const parent = await stack.getParent();
15614
+ * const parentIsRoot = await parent.isRoot();
15615
+ * // The parent ColumnOrRow is root: true
15616
+ * console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
15617
+ * ```
15618
+ */
15619
+ this.isRoot = () => __classPrivateFieldGet$3(this, _LayoutNode_client, "f").isRoot(this.entityId);
15620
+ /**
15621
+ * Checks if the TabStack or ColumnOrRow exists
15622
+ *
15623
+ * @example
15624
+ * ```js
15625
+ * if (!fin.me.isView) {
15626
+ * throw new Error('Not running in a platform View.');
15627
+ * }
15628
+ *
15629
+ * const stack = await fin.me.getCurrentStack();
15630
+ * // Retrieves the parent ColumnOrRow
15631
+ * const columnOrRow = await stack.getParent();
15632
+ * let exists = await stack.exists();
15633
+ * // or
15634
+ * let exists = await columnOrRow.exists();
15635
+ * // The entity exists: true
15636
+ * console.log(`The entity exists: ${exists}`);
15637
+ * ```
15638
+ */
15639
+ this.exists = () => __classPrivateFieldGet$3(this, _LayoutNode_client, "f").exists(this.entityId);
15640
+ /**
15641
+ * Retrieves the parent of the TabStack or ColumnOrRow
15642
+ *
15643
+ * @example
15644
+ * ```js
15645
+ * if (!fin.me.isView) {
15646
+ * throw new Error('Not running in a platform View.');
15647
+ * }
15648
+ *
15649
+ * const stack = await fin.me.getCurrentStack();
15650
+ * // Retrieves the parent ColumnOrRow
15651
+ * const columnOrRow = await stack.getParent();
15652
+ *
15653
+ * // undefined if entity is the root item
15654
+ * let parent = await columnOrRow.getParent();
15655
+ * // or
15656
+ * let parent = await stack.getParent();
15657
+ * ```
15658
+ */
15659
+ this.getParent = async () => {
15660
+ const parent = await __classPrivateFieldGet$3(this, _LayoutNode_client, "f").getParent(this.entityId);
15661
+ if (!parent) {
15662
+ return undefined;
15663
+ }
15664
+ return LayoutNode.getEntity(parent, __classPrivateFieldGet$3(this, _LayoutNode_client, "f"));
15665
+ };
15666
+ /**
15667
+ * Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
15668
+ *
15669
+ * Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
15670
+ * during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
15671
+ * This means the views you pass to createAdjacentStack() may not render in the order given by the array.
15672
+ * Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
15673
+ *
15674
+ * @param views The views that will populate the new TabStack.
15675
+ * @param options Additional options that control new TabStack creation.
15676
+ * @returns The newly-created TabStack.
15677
+ *
15678
+ * @example
15679
+ * ```js
15680
+ * if (!fin.me.isView) {
15681
+ * throw new Error('Not running in a platform View.');
15682
+ * }
15683
+ *
15684
+ * const stack = await fin.me.getCurrentStack();
15685
+ * const columnOrRow = await stack.getParent();
15686
+ *
15687
+ * // Create view references by supplying a 'name' and 'url'
15688
+ * const views = [
15689
+ * // if 'name' is undefined, one will be generated
15690
+ * // if 'url' is undefined, it will default the view URL to 'about:blank'
15691
+ * { name: 'google-view', url: 'http://google.com/'},
15692
+ * { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
15693
+ * ];
15694
+ *
15695
+ * // Create a view beforehand to be included in the new tab stack
15696
+ * const outsideView = await fin.View.create({
15697
+ * name: 'outside-bloomberg-view',
15698
+ * url: 'https://bloomberg.com/',
15699
+ * target: fin.me.identity,
15700
+ * });
15701
+ *
15702
+ * // Views to add can be identities, or the reference views mentioned above
15703
+ * const viewsToAdd = [outsideView.identity, ...views];
15704
+ *
15705
+ * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
15706
+ * let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
15707
+ * // Or
15708
+ * let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
15709
+ * console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
15710
+ *
15711
+ * ```
15712
+ * @experimental
15713
+ */
15714
+ this.createAdjacentStack = async (views, options) => {
15715
+ const entityId = await __classPrivateFieldGet$3(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
15716
+ return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$3(this, _LayoutNode_client, "f"));
15717
+ };
15718
+ /**
15719
+ * Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
15720
+ *
15721
+ * @param edge Edge whose adjacent TabStacks will be returned.
15722
+ *
15723
+ * @example
15724
+ * ```js
15725
+ * if (!fin.me.isView) {
15726
+ * throw new Error('Not running in a platform View.');
15727
+ * }
15728
+ *
15729
+ * const stack = await fin.me.getCurrentStack();
15730
+ * const columnOrRow = await stack.getParent();
15731
+ * // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
15732
+ * let rightStacks = await columnOrRow.getAdjacentStacks('right');
15733
+ * let leftStacks = await columnOrRow.getAdjacentStacks('left');
15734
+ * // or
15735
+ * let rightStacks = await stack.getAdjacentStacks('right');
15736
+ * let leftStacks = await stack.getAdjacentStacks('left');
15737
+ *
15738
+ * console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
15739
+ *
15740
+ * ```
15741
+ * @experimental
15742
+ */
15743
+ this.getAdjacentStacks = async (edge) => {
15744
+ const adjacentStacks = await __classPrivateFieldGet$3(this, _LayoutNode_client, "f").getAdjacentStacks({
15745
+ targetId: this.entityId,
15746
+ edge
15747
+ });
15748
+ return adjacentStacks.map((stack) => LayoutNode.getEntity({
15749
+ type: 'stack',
15750
+ entityId: stack.entityId
15751
+ }, __classPrivateFieldGet$3(this, _LayoutNode_client, "f")));
15752
+ };
15753
+ __classPrivateFieldSet$2(this, _LayoutNode_client, client, "f");
15754
+ this.entityId = entityId;
15755
+ }
15756
+ }
15757
+ layoutEntities.LayoutNode = LayoutNode;
15758
+ _LayoutNode_client = new WeakMap();
15759
+ /**
15760
+ * @ignore
15761
+ * @internal
15762
+ * Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
15763
+ * @param client
15764
+ * @param controllerId
15765
+ * @param identity
15766
+ * @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
15767
+ */
15768
+ LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
15769
+ 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.');
15770
+ const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
15771
+ return consumer.consume({ id: controllerId });
15772
+ };
15773
+ LayoutNode.getEntity = (definition, client) => {
15774
+ const { entityId, type } = definition;
15775
+ switch (type) {
15776
+ case 'column':
15777
+ case 'row':
15778
+ return new ColumnOrRow(client, entityId, type);
15779
+ case 'stack':
15780
+ return new TabStack(client, entityId);
15781
+ default:
15782
+ throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
15783
+ }
15784
+ };
15785
+ /**
15786
+ * A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
15787
+ */
15788
+ class TabStack extends LayoutNode {
15789
+ /** @internal */
15790
+ constructor(client, entityId) {
15791
+ super(client, entityId);
15792
+ /**
15793
+ * @internal
15794
+ * ApiClient for {@link LayoutEntitiesController}
15795
+ */
15796
+ _TabStack_client.set(this, void 0);
15797
+ /**
15798
+ * Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
15799
+ */
15800
+ this.type = 'stack';
15801
+ /**
15802
+ * Retrieves a list of all views belonging to this {@link TabStack}.
15803
+ *
15804
+ * Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
15805
+ * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
15806
+ * If that happens and then getViews() is called, it will return the identities in a different order than
15807
+ * than the currently rendered tab order.
15808
+ *
15809
+ *
15810
+ * @throws If the {@link TabStack} has been destroyed.
15811
+ * @example
15812
+ * ```js
15813
+ * if (!fin.me.isView) {
15814
+ * throw new Error('Not running in a platform View.');
15815
+ * }
15816
+ *
15817
+ * const stack = await fin.me.getCurrentStack();
15818
+ * // Alternatively, you can wrap any view and get the stack from there
15819
+ * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
15820
+ * // const stack = await viewFromSomewhere.getCurrentStack();
15821
+ * const views = await stack.getViews();
15822
+ * console.log(`Stack contains ${views.length} view(s)`);
15823
+ * ```
15824
+ * @experimental
15825
+ */
15826
+ this.getViews = () => __classPrivateFieldGet$3(this, _TabStack_client, "f").getStackViews(this.entityId);
15827
+ /**
15828
+ * Adds or creates a view in this {@link TabStack}.
15829
+ *
15830
+ * @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
15831
+ * and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
15832
+ *
15833
+ * @param view The identity of an existing view to add, or options to create a view.
15834
+ * @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)
15835
+ * @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
15836
+ * @throws If the view does not exist or fails to create.
15837
+ * @throws If the {@link TabStack} has been destroyed.
15838
+ * @example
15839
+ * ```js
15840
+ * if (!fin.me.isView) {
15841
+ * throw new Error('Not running in a platform View.');
15842
+ * }
15843
+ *
15844
+ * const stack = await fin.me.getCurrentStack();
15845
+ * // Alternatively, you can wrap any view and get the stack from there
15846
+ * // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
15847
+ * // const stack = await viewFromSomewhere.getCurrentStack();
15848
+ * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
15849
+ * console.log('Identity of the google view just added', { googleViewIdentity });
15850
+ * // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
15851
+ * const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
15852
+ * console.log('Identity of the apple view just added', { appleViewIdentity });
15853
+ * ```
15854
+ * @experimental
15855
+ */
15856
+ this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$3(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
15857
+ /**
15858
+ * Removes a view from this {@link TabStack}.
15859
+ *
15860
+ * @remarks Throws an exception if the view identity does not exist or was already destroyed.
15861
+ *
15862
+ * @param view - Identity of the view to remove.
15863
+ * @throws If the view does not exist or does not belong to the stack.
15864
+ * @throws If the {@link TabStack} has been destroyed.
15865
+ *
15866
+ * @example
15867
+ * ```js
15868
+ * if (!fin.me.isView) {
15869
+ * throw new Error('Not running in a platform View.');
15870
+ * }
15871
+ *
15872
+ * const stack = await fin.me.getCurrentStack();
15873
+ * const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
15874
+ *
15875
+ * await stack.removeView(googleViewIdentity);
15876
+ *
15877
+ * try {
15878
+ * await stack.removeView(googleViewIdentity);
15879
+ * } catch (error) {
15880
+ * // Tried to remove a view ('google-view') which does not belong to the stack.
15881
+ * console.log(error);
15882
+ * }
15883
+ * ```
15884
+ */
15885
+ this.removeView = async (view) => {
15886
+ await __classPrivateFieldGet$3(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
15887
+ };
15888
+ /**
15889
+ * Sets the active view of the {@link TabStack} without focusing it.
15890
+ * @param view - Identity of the view to activate.
15891
+ * @returns Promise which resolves with void once the view has been activated.
15892
+ * @throws If the {@link TabStack} has been destroyed.
15893
+ * @throws If the view does not exist.
15894
+ * @example
15895
+ * Change the active tab of a known View's TabStack:
15896
+ * ```js
15897
+ * const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
15898
+ * const stack = await targetView.getCurrentStack();
15899
+ * await stack.setActiveView(targetView.identity);
15900
+ * ```
15901
+ *
15902
+ * Set the current View as active within its TabStack:
15903
+ * ```js
15904
+ * const stack = await fin.me.getCurrentStack();
15905
+ * await stack.setActiveView(fin.me.identity);
15906
+ * ```
15907
+ * @experimental
15908
+ */
15909
+ this.setActiveView = async (view) => {
15910
+ await __classPrivateFieldGet$3(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
15911
+ };
15912
+ __classPrivateFieldSet$2(this, _TabStack_client, client, "f");
15905
15913
  }
15914
+ }
15915
+ layoutEntities.TabStack = TabStack;
15916
+ _TabStack_client = new WeakMap();
15917
+ /**
15918
+ * A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
15919
+ */
15920
+ class ColumnOrRow extends LayoutNode {
15906
15921
  /**
15907
- * Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
15908
- * This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
15909
- * @param winId
15910
- * @param options
15911
- *
15912
- * @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,
15913
- * it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
15914
- *
15915
- * @example
15916
- *
15917
- * ```js
15918
- * // Close the current Window inside a Window context
15919
- * const platform = await fin.Platform.getCurrent();
15920
- * platform.closeWindow(fin.me.identity);
15921
- *
15922
- * // Close the Window from inside a View context
15923
- * const platform = await fin.Platform.getCurrent();
15924
- * const parentWindow = await fin.me.getCurrentWindow();
15925
- * platform.closeWindow(parentWindow.identity);
15926
- *
15927
- * // Close the Window and do not fire the before unload handler on Views
15928
- * const platform = await fin.Platform.getCurrent();
15929
- * platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
15930
- * ```
15931
- * @experimental
15922
+ * @internal
15932
15923
  */
15933
- async closeWindow(windowId, options = { skipBeforeUnload: false }) {
15934
- this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
15935
- // don't expose
15936
- });
15937
- const client = await this.getClient();
15938
- return client.dispatch('close-window', { windowId, options });
15924
+ constructor(client, entityId, type) {
15925
+ super(client, entityId);
15926
+ /**
15927
+ * @ignore
15928
+ * @internal
15929
+ * ApiClient for {@link LayoutEntitiesController}
15930
+ */
15931
+ _ColumnOrRow_client.set(this, void 0);
15932
+ /**
15933
+ * Retrieves the content array of the ColumnOrRow
15934
+ *
15935
+ * @example
15936
+ * ```js
15937
+ * if (!fin.me.isView) {
15938
+ * throw new Error('Not running in a platform View.');
15939
+ * }
15940
+ *
15941
+ * const stack = await fin.me.getCurrentStack();
15942
+ * // Retrieves the parent ColumnOrRow
15943
+ * const columnOrRow = await stack.getParent();
15944
+ *
15945
+ * // returns [TabStack]
15946
+ * const contentArray = await columnOrRow.getContent();
15947
+ * console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
15948
+ * ```
15949
+ */
15950
+ this.getContent = async () => {
15951
+ const contentItemEntities = await __classPrivateFieldGet$3(this, _ColumnOrRow_client, "f").getContent(this.entityId);
15952
+ return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$3(this, _ColumnOrRow_client, "f")));
15953
+ };
15954
+ __classPrivateFieldSet$2(this, _ColumnOrRow_client, client, "f");
15955
+ this.type = type;
15939
15956
  }
15940
15957
  }
15941
- Instance$2.Platform = Platform;
15942
- _Platform_connectToProvider = new WeakMap();
15943
-
15944
- var layout = {};
15958
+ layoutEntities.ColumnOrRow = ColumnOrRow;
15959
+ _ColumnOrRow_client = new WeakMap();
15945
15960
 
15946
- var Factory$1 = {};
15961
+ var layout_constants = {};
15947
15962
 
15948
- var Instance$1 = {};
15963
+ Object.defineProperty(layout_constants, "__esModule", { value: true });
15964
+ layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
15965
+ layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
15966
+ // TODO: eventually export this somehow
15967
+ layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
15949
15968
 
15950
15969
  var __classPrivateFieldGet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15951
15970
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
@@ -16094,6 +16113,12 @@ const layout_constants_1$1 = layout_constants;
16094
16113
  * ```
16095
16114
  */
16096
16115
  class Layout extends base_1$4.Base {
16116
+ /**
16117
+ * @internal
16118
+ */
16119
+ static getClient(layout) {
16120
+ return __classPrivateFieldGet$2(layout, _Layout_layoutClient, "f").getValue();
16121
+ }
16097
16122
  /**
16098
16123
  * @internal
16099
16124
  */
@@ -16318,6 +16343,27 @@ class Layout extends base_1$4.Base {
16318
16343
  const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
16319
16344
  return layout_entities_1.LayoutNode.getEntity(root, client);
16320
16345
  }
16346
+ /**
16347
+ * Retrieves the OpenFin.TabStack instance which the View belongs to.
16348
+ *
16349
+ * @example
16350
+ * ```js
16351
+ * const viewIdentity = { uuid: 'uuid', name: 'view-name' };
16352
+ * const stack = await fin.View.wrapSync(viewIdentity).getStackByViewIdentity(viewIdentity);
16353
+ * console.log(await stack.getViews());
16354
+ * ```
16355
+ */
16356
+ async getStackByViewIdentity(identity) {
16357
+ this.wire.sendAction('layout-get-stack-by-view').catch(() => {
16358
+ // don't expose
16359
+ });
16360
+ const client = await __classPrivateFieldGet$2(this, _Layout_layoutClient, "f").getValue();
16361
+ const stack = await client.getStackByView(identity);
16362
+ if (!stack) {
16363
+ throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
16364
+ }
16365
+ return layout_entities_1.LayoutNode.getEntity(stack, client);
16366
+ }
16321
16367
  }
16322
16368
  Instance$1.Layout = Layout;
16323
16369
  _Layout_layoutClient = new WeakMap();
@@ -16511,7 +16557,7 @@ class LayoutModule extends base_1$3.Base {
16511
16557
  this.wire.sendAction('layout-get-current').catch((e) => {
16512
16558
  // don't expose
16513
16559
  });
16514
- if (!this.fin.me.isWindow) {
16560
+ if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
16515
16561
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
16516
16562
  }
16517
16563
  const { uuid, name } = this.fin.me;
@@ -16534,12 +16580,50 @@ class LayoutModule extends base_1$3.Base {
16534
16580
  this.wire.sendAction('layout-get-current-sync').catch((e) => {
16535
16581
  // don't expose
16536
16582
  });
16537
- if (!this.fin.me.isWindow) {
16583
+ if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
16538
16584
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
16539
16585
  }
16540
16586
  const { uuid, name } = this.fin.me;
16541
16587
  return this.wrapSync({ uuid, name });
16542
16588
  }
16589
+ /**
16590
+ * Retrieves the OpenFin.Layout instance for the Window the View is attached to.
16591
+ *
16592
+ * @example
16593
+ * ```js
16594
+ * const viewIdentity = { uuid: 'uuid', name: 'view-name' };
16595
+ * const layout = await fin.Platform.Layout.getLayoutByViewIdentity(viewIdentity);
16596
+ * console.log(await layout.getCurrentViews());
16597
+ * ```
16598
+ */
16599
+ async getLayoutByViewIdentity(viewIdentity) {
16600
+ this.wire.sendAction('layout-get-by-view-identity').catch(() => {
16601
+ // don't expose
16602
+ });
16603
+ const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
16604
+ let layoutWindowIdentity = winIdentity;
16605
+ // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
16606
+ if (layoutWindowIdentity.identity) {
16607
+ layoutWindowIdentity = layoutWindowIdentity.identity;
16608
+ }
16609
+ try {
16610
+ const layoutWindow = this.wrapSync(layoutWindowIdentity);
16611
+ const client = await Instance_1$2.Layout.getClient(layoutWindow);
16612
+ const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(viewIdentity);
16613
+ return this.wrapSync(layoutIdentity);
16614
+ }
16615
+ catch (e) {
16616
+ const allowedErrors = [
16617
+ 'No action registered at target for',
16618
+ 'getLayoutIdentityForViewOrThrow is not a function'
16619
+ ];
16620
+ if (!allowedErrors.some((m) => e.message.includes(m))) {
16621
+ throw e;
16622
+ }
16623
+ // fallback logic for missing endpoint in older runtimes
16624
+ return this.wrapSync(layoutWindowIdentity);
16625
+ }
16626
+ }
16543
16627
  }
16544
16628
  Factory$1.LayoutModule = LayoutModule;
16545
16629
  _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
@@ -17135,7 +17219,7 @@ Factory.SnapshotSourceModule = SnapshotSourceModule;
17135
17219
 
17136
17220
  Object.defineProperty(fin$1, "__esModule", { value: true });
17137
17221
  var Fin_1 = fin$1.Fin = void 0;
17138
- const events_1 = require$$0;
17222
+ const events_1 = require$$0$1;
17139
17223
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17140
17224
  const index_1 = system;
17141
17225
  const index_2 = requireWindow();
@@ -17184,12 +17268,15 @@ Fin_1 = fin$1.Fin = Fin;
17184
17268
 
17185
17269
  var browser = {};
17186
17270
 
17271
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
17272
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17273
+ };
17187
17274
  Object.defineProperty(browser, "__esModule", { value: true });
17188
17275
  browser.remoteConnectInterop = browser.remoteConnect = getRemoteConnectionPayload_1 = browser.getRemoteConnectionPayload = void 0;
17189
17276
  const fin_1 = fin$1;
17190
17277
  const browser_1 = browser$1;
17191
17278
  const transport_1 = transport;
17192
- const websocket_1 = websocket;
17279
+ const websocket_1 = __importDefault(websocket);
17193
17280
  async function getRemoteConnectionPayload(fin, uuid = `browser-connection-${Math.random().toString().slice(2)}`, interopProviderId = fin.me.uuid) {
17194
17281
  const { token } = await fin.System.registerExternalConnection(uuid);
17195
17282
  const { port } = await fin.System.getRuntimeInfo();