@interopio/browser 3.4.5 → 3.4.7

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.
@@ -2033,7 +2033,7 @@
2033
2033
  const nonNegativeNumberDecoder = number$1().where((num) => num >= 0, "Expected a non-negative number");
2034
2034
  const optionalNonEmptyStringDecoder = optional$1(nonEmptyStringDecoder);
2035
2035
  const libDomainDecoder = oneOf$1(constant$1("system"), constant$1("windows"), constant$1("appManager"), constant$1("layouts"), constant$1("intents"), constant$1("notifications"), constant$1("channels"), constant$1("extension"), constant$1("themes"), constant$1("prefs"));
2036
- const windowOperationTypesDecoder = oneOf$1(constant$1("openWindow"), constant$1("windowHello"), constant$1("windowAdded"), constant$1("windowRemoved"), constant$1("getBounds"), constant$1("getFrameBounds"), constant$1("getUrl"), constant$1("moveResize"), constant$1("focus"), constant$1("close"), constant$1("getTitle"), constant$1("setTitle"), constant$1("focusChange"), constant$1("getChannel"));
2036
+ const windowOperationTypesDecoder = oneOf$1(constant$1("openWindow"), constant$1("windowHello"), constant$1("windowAdded"), constant$1("windowRemoved"), constant$1("getBounds"), constant$1("getFrameBounds"), constant$1("getUrl"), constant$1("moveResize"), constant$1("focus"), constant$1("close"), constant$1("getTitle"), constant$1("setTitle"), constant$1("focusChange"), constant$1("getChannel"), constant$1("notifyChannelsChanged"));
2037
2037
  const appManagerOperationTypesDecoder = oneOf$1(constant$1("appHello"), constant$1("appDirectoryStateChange"), constant$1("instanceStarted"), constant$1("instanceStopped"), constant$1("applicationStart"), constant$1("instanceStop"), constant$1("clear"));
2038
2038
  const layoutsOperationTypesDecoder = oneOf$1(constant$1("layoutAdded"), constant$1("layoutChanged"), constant$1("layoutRemoved"), constant$1("layoutRenamed"), constant$1("get"), constant$1("getAll"), constant$1("export"), constant$1("import"), constant$1("remove"), constant$1("rename"), constant$1("clientSaveRequest"), constant$1("getGlobalPermissionState"), constant$1("checkGlobalActivated"), constant$1("requestGlobalPermission"), constant$1("getDefaultGlobal"), constant$1("setDefaultGlobal"), constant$1("clearDefaultGlobal"), constant$1("updateMetadata"));
2039
2039
  const notificationsOperationTypesDecoder = oneOf$1(constant$1("raiseNotification"), constant$1("requestPermission"), constant$1("notificationShow"), constant$1("notificationClick"), constant$1("getPermission"), constant$1("list"), constant$1("notificationRaised"), constant$1("notificationClosed"), constant$1("click"), constant$1("clear"), constant$1("clearAll"), constant$1("configure"), constant$1("getConfiguration"), constant$1("configurationChanged"), constant$1("setState"), constant$1("clearOld"), constant$1("activeCountChange"), constant$1("stateChange"));
@@ -2123,12 +2123,28 @@
2123
2123
  id: nonEmptyStringDecoder,
2124
2124
  applicationName: nonEmptyStringDecoder
2125
2125
  });
2126
+ const iframePermissionsPolicyConfigDecoder = object$1({
2127
+ flags: string$1()
2128
+ });
2129
+ const workspacesSandboxDecoder = object$1({
2130
+ flags: string$1()
2131
+ });
2132
+ const requestChannelSelectorConfigDecoder = object$1({
2133
+ windowId: nonEmptyStringDecoder,
2134
+ channelsNames: array$1(nonEmptyStringDecoder)
2135
+ });
2136
+ const channelSelectorDecoder = object$1({
2137
+ enabled: boolean$1(),
2138
+ });
2126
2139
  const applicationDetailsDecoder = object$1({
2127
2140
  url: nonEmptyStringDecoder,
2128
2141
  top: optional$1(number$1()),
2129
2142
  left: optional$1(number$1()),
2130
2143
  width: optional$1(nonNegativeNumberDecoder),
2131
- height: optional$1(nonNegativeNumberDecoder)
2144
+ height: optional$1(nonNegativeNumberDecoder),
2145
+ workspacesSandbox: optional$1(workspacesSandboxDecoder),
2146
+ channelSelector: optional$1(channelSelectorDecoder),
2147
+ iframePermissionsPolicy: optional$1(iframePermissionsPolicyConfigDecoder)
2132
2148
  });
2133
2149
  const intentDefinitionDecoder = object$1({
2134
2150
  name: nonEmptyStringDecoder,
@@ -2484,10 +2500,17 @@
2484
2500
  const channelNameDecoder = (channelNames) => {
2485
2501
  return nonEmptyStringDecoder.where(s => channelNames.includes(s), "Expected a valid channel name");
2486
2502
  };
2503
+ const fdc3OptionsDecoder = object$1({
2504
+ contextType: optional$1(nonEmptyStringDecoder)
2505
+ });
2487
2506
  const publishOptionsDecoder = optional$1(oneOf$1(nonEmptyStringDecoder, object$1({
2488
2507
  name: optional$1(nonEmptyStringDecoder),
2489
2508
  fdc3: optional$1(boolean$1())
2490
2509
  })));
2510
+ const leaveChannelsConfig = object$1({
2511
+ windowId: optionalNonEmptyStringDecoder,
2512
+ channel: optionalNonEmptyStringDecoder
2513
+ });
2491
2514
  const fdc3ContextDecoder = anyJson$1().where((value) => typeof value.type === "string", "Expected a valid FDC3 Context with compulsory 'type' field");
2492
2515
  const interopActionSettingsDecoder = object$1({
2493
2516
  method: nonEmptyStringDecoder,
@@ -2546,7 +2569,8 @@
2546
2569
  id: nonEmptyStringDecoder,
2547
2570
  state: notificationStateDecoder
2548
2571
  });
2549
- const channelContextDecoder = object$1({
2572
+ object$1().where((value) => value.fdc3 ? typeof value.fdc3.type === "string" : true, "Expected a valid FDC3 Context with compulsory 'type' field");
2573
+ const channelDefinitionDecoder = object$1({
2550
2574
  name: nonEmptyStringDecoder,
2551
2575
  meta: object$1({
2552
2576
  color: nonEmptyStringDecoder
@@ -2703,7 +2727,7 @@
2703
2727
  const getWindowIdsOnChannelResultDecoder = object$1({
2704
2728
  windowIds: array$1(nonEmptyStringDecoder)
2705
2729
  });
2706
- const channelsOperationTypesDecoder = oneOf$1(constant$1("addChannel"), constant$1("getMyChannel"), constant$1("getWindowIdsOnChannel"), constant$1("getWindowIdsWithChannels"), constant$1("joinChannel"), constant$1("restrict"), constant$1("getRestrictions"), constant$1("restrictAll"));
2730
+ const channelsOperationTypesDecoder = oneOf$1(constant$1("addChannel"), constant$1("getMyChannel"), constant$1("getWindowIdsOnChannel"), constant$1("getWindowIdsWithChannels"), constant$1("joinChannel"), constant$1("restrict"), constant$1("getRestrictions"), constant$1("restrictAll"), constant$1("notifyChannelsChanged"), constant$1("leaveChannel"));
2707
2731
  const getMyChanelResultDecoder = object$1({
2708
2732
  channel: optional$1(nonEmptyStringDecoder)
2709
2733
  });
@@ -2738,6 +2762,14 @@
2738
2762
  channel: nonEmptyStringDecoder,
2739
2763
  windowId: nonEmptyStringDecoder
2740
2764
  });
2765
+ const leaveChannelDataDecoder = object$1({
2766
+ windowId: nonEmptyStringDecoder,
2767
+ channelName: optional$1(nonEmptyStringDecoder)
2768
+ });
2769
+ const channelsChangedDataDecoder = object$1({
2770
+ windowId: nonEmptyStringDecoder,
2771
+ channelNames: array$1(nonEmptyStringDecoder)
2772
+ });
2741
2773
  const windowChannelResultDecoder = object$1({
2742
2774
  channel: optional$1(nonEmptyStringDecoder),
2743
2775
  });
@@ -2788,6 +2820,7 @@
2788
2820
  setTitle: { name: "setTitle", dataDecoder: windowTitleConfigDecoder },
2789
2821
  focusChange: { name: "focusChange", dataDecoder: focusEventDataDecoder },
2790
2822
  getChannel: { name: "getChannel", dataDecoder: simpleWindowDecoder, resultDecoder: windowChannelResultDecoder },
2823
+ notifyChannelsChanged: { name: "notifyChannelsChanged", dataDecoder: channelsChangedDataDecoder }
2791
2824
  };
2792
2825
 
2793
2826
  function getDefaultExportFromCjs$1 (x) {
@@ -2943,6 +2976,9 @@
2943
2976
  this.me.isFocused = hasFocus;
2944
2977
  this.registry.execute("focus-change", this.me);
2945
2978
  }
2979
+ processChannelsChangedEvent(channelNames) {
2980
+ this.registry.execute("channels-changed", channelNames);
2981
+ }
2946
2982
  async toApi() {
2947
2983
  this.ctxUnsubscribe = await this._bridge.contextLib.subscribe(this.myCtxKey, (data) => this.registry.execute("context-updated", data));
2948
2984
  this.me = {
@@ -2964,6 +3000,7 @@
2964
3000
  onContextUpdated: this.onContextUpdated.bind(this),
2965
3001
  onFocusChanged: this.onFocusChanged.bind(this),
2966
3002
  getChannel: this.getChannel.bind(this),
3003
+ onChannelsChanged: this.onChannelsChanged.bind(this),
2967
3004
  };
2968
3005
  return this.me;
2969
3006
  }
@@ -3068,9 +3105,12 @@
3068
3105
  const result = await this._bridge.send("windows", operations$9.getChannel, { windowId: this.id }, undefined, { includeOperationCheck: true });
3069
3106
  return result.channel;
3070
3107
  }
3108
+ onChannelsChanged(callback) {
3109
+ return this.registry.add("channels-changed", callback);
3110
+ }
3071
3111
  }
3072
3112
 
3073
- const systemOperations = {
3113
+ const commonOperations = {
3074
3114
  operationCheck: { name: "operationCheck", dataDecoder: operationCheckConfigDecoder, resultDecoder: operationCheckResultDecoder },
3075
3115
  getWorkspaceWindowFrameBounds: { name: "getWorkspaceWindowFrameBounds", resultDecoder: workspaceFrameBoundsResultDecoder, dataDecoder: simpleItemIdDecoder }
3076
3116
  };
@@ -3083,7 +3123,7 @@
3083
3123
  return;
3084
3124
  }
3085
3125
  promiseActive = false;
3086
- const message = timeoutMessage || `Promise timeout hit: ${timeoutMilliseconds}`;
3126
+ const message = timeoutMessage;
3087
3127
  reject(message);
3088
3128
  }, timeoutMilliseconds);
3089
3129
  promise()
@@ -3214,6 +3254,7 @@
3214
3254
  operations$9.moveResize.execute = this.handleMoveResize.bind(this);
3215
3255
  operations$9.setTitle.execute = this.handleSetTitle.bind(this);
3216
3256
  operations$9.getChannel.execute = this.handleGetChannel.bind(this);
3257
+ operations$9.notifyChannelsChanged.execute = this.handleChannelsChanged.bind(this);
3217
3258
  }
3218
3259
  my() {
3219
3260
  return Object.assign({}, this.me);
@@ -3347,7 +3388,7 @@
3347
3388
  return;
3348
3389
  }
3349
3390
  try {
3350
- await this.bridge.send("windows", systemOperations.operationCheck, { operation: "focusChange" });
3391
+ await this.bridge.send("windows", commonOperations.operationCheck, { operation: "focusChange" });
3351
3392
  }
3352
3393
  catch (error) {
3353
3394
  this.logger.warn("The platform of this client is outdated and does not support focus tracking, disabling focus events for this client.");
@@ -3403,6 +3444,10 @@
3403
3444
  ...(channel ? { channel } : {}),
3404
3445
  };
3405
3446
  }
3447
+ async handleChannelsChanged(data) {
3448
+ const windowProjection = this.allWindowProjections.find((projection) => projection.id === data.windowId);
3449
+ windowProjection?.model.processChannelsChangedEvent(data.channelNames);
3450
+ }
3406
3451
  }
3407
3452
 
3408
3453
  const GlueWebPlatformControlName = "T42.Web.Platform.Control";
@@ -3495,7 +3540,7 @@
3495
3540
  }
3496
3541
  async checkOperationSupported(domain, operation) {
3497
3542
  try {
3498
- const result = await this.send(domain, systemOperations.operationCheck, { operation: operation.name });
3543
+ const result = await this.send(domain, commonOperations.operationCheck, { operation: operation.name });
3499
3544
  return result;
3500
3545
  }
3501
3546
  catch (error) {
@@ -4543,7 +4588,7 @@
4543
4588
  }
4544
4589
  async isRaiseOperationSupported() {
4545
4590
  try {
4546
- const { isSupported } = await this.bridge.send("intents", systemOperations.operationCheck, { operation: "raise" });
4591
+ const { isSupported } = await this.bridge.send("intents", commonOperations.operationCheck, { operation: "raise" });
4547
4592
  return {
4548
4593
  supported: isSupported,
4549
4594
  reason: isSupported ? "" : "The platform of this client is outdated and does not support \"raise\" operation"
@@ -4736,6 +4781,9 @@
4736
4781
  return prefsForIntent?.handler;
4737
4782
  }
4738
4783
  async checkHandleRaiseWithRememberedHandler(intentRequest) {
4784
+ if (intentRequest.target) {
4785
+ return;
4786
+ }
4739
4787
  const rememberedHandler = await this.checkForRememberedHandler(intentRequest);
4740
4788
  if (!rememberedHandler) {
4741
4789
  return;
@@ -4766,7 +4814,7 @@
4766
4814
  }
4767
4815
 
4768
4816
  const operations$4 = {
4769
- addChannel: { name: "addChannel", dataDecoder: channelContextDecoder },
4817
+ addChannel: { name: "addChannel", dataDecoder: channelDefinitionDecoder },
4770
4818
  removeChannel: { name: "removeChannel", dataDecoder: removeChannelDataDecoder },
4771
4819
  getMyChannel: { name: "getMyChannel", resultDecoder: getMyChanelResultDecoder },
4772
4820
  getWindowIdsOnChannel: { name: "getWindowIdsOnChannel", dataDecoder: getWindowIdsOnChannelDataDecoder, resultDecoder: getWindowIdsOnChannelResultDecoder },
@@ -4774,7 +4822,10 @@
4774
4822
  joinChannel: { name: "joinChannel", dataDecoder: joinChannelDataDecoder },
4775
4823
  restrict: { name: "restrict", dataDecoder: restrictionConfigDataDecoder },
4776
4824
  getRestrictions: { name: "getRestrictions", dataDecoder: getRestrictionsDataDecoder, resultDecoder: restrictionsDecoder },
4777
- restrictAll: { name: "restrictAll", dataDecoder: restrictAllDataDecoder }
4825
+ restrictAll: { name: "restrictAll", dataDecoder: restrictAllDataDecoder },
4826
+ notifyChannelsChanged: { name: "notifyChannelsChanged", dataDecoder: channelsChangedDataDecoder },
4827
+ leaveChannel: { name: "leaveChannel", dataDecoder: leaveChannelDataDecoder },
4828
+ requestChannelSelector: { name: "requestChannelSelector", dataDecoder: requestChannelSelectorConfigDecoder }
4778
4829
  };
4779
4830
 
4780
4831
  class ChannelsController {
@@ -4795,6 +4846,7 @@
4795
4846
  addOperationsExecutors() {
4796
4847
  operations$4.getMyChannel.execute = this.handleGetMyChannel.bind(this);
4797
4848
  operations$4.joinChannel.execute = this.handleJoinChannel.bind(this);
4849
+ operations$4.leaveChannel.execute = this.handleLeaveChannel.bind(this);
4798
4850
  operations$4.restrict.execute = ({ config }) => this.restrict(config);
4799
4851
  operations$4.getRestrictions.execute = ({ windowId }) => this.getRestrictions(windowId);
4800
4852
  operations$4.restrictAll.execute = ({ restrictions }) => this.restrictAll(restrictions);
@@ -4811,6 +4863,14 @@
4811
4863
  const api = this.toApi();
4812
4864
  coreGlue.channels = api;
4813
4865
  }
4866
+ async postStart(io, ioc) {
4867
+ try {
4868
+ await this.requestChannelSelector(io.appManager.myInstance);
4869
+ }
4870
+ catch (error) {
4871
+ this.logger.warn(`Failed to display channel selector: ${extractErrorMsg(error)}`);
4872
+ }
4873
+ }
4814
4874
  async handleBridgeMessage(args) {
4815
4875
  const operationName = runDecoderWithIOError(channelsOperationTypesDecoder, args.operation);
4816
4876
  const operation = operations$4[operationName];
@@ -4852,8 +4912,17 @@
4852
4912
  onChanged(callback) {
4853
4913
  return this.changed(callback);
4854
4914
  }
4855
- async leave() {
4856
- await this.switchToChannel();
4915
+ async leave(config = {}) {
4916
+ runDecoderWithIOError(leaveChannelsConfig, config);
4917
+ if (!config.windowId || config.windowId === this.windowsController.my().id) {
4918
+ await this.switchToChannel();
4919
+ return;
4920
+ }
4921
+ const leaveData = { windowId: config.windowId, channelName: config.channel };
4922
+ await this.bridge.send("channels", operations$4.leaveChannel, leaveData, undefined, { includeOperationCheck: true });
4923
+ }
4924
+ handleLeaveChannel(data) {
4925
+ return this.leave({ channel: data.channelName });
4857
4926
  }
4858
4927
  toApi() {
4859
4928
  const api = {
@@ -4906,6 +4975,17 @@
4906
4975
  }
4907
4976
  this.registry.execute(this.ChangedKey, name);
4908
4977
  this.sessionController.setWindowData({ currentName: name }, "channels");
4978
+ const windowId = this.windowsController.my().id;
4979
+ if (!windowId) {
4980
+ return;
4981
+ }
4982
+ const channelNames = this.currentChannelName ? [this.currentChannelName] : [];
4983
+ try {
4984
+ await this.bridge.send("channels", operations$4.notifyChannelsChanged, { channelNames: channelNames, windowId }, undefined, { includeOperationCheck: true });
4985
+ }
4986
+ catch (error) {
4987
+ this.logger.warn(`Failed to notify channel changed: ${extractErrorMsg(error)}`);
4988
+ }
4909
4989
  }
4910
4990
  async updateData(name, data) {
4911
4991
  const contextName = this.createContextName(name);
@@ -4939,25 +5019,35 @@
4939
5019
  }
4940
5020
  return fdc3PropsArr[0].split("_").slice(1).join("_");
4941
5021
  }
4942
- subscribe(callback) {
5022
+ subscribe(callback, options) {
4943
5023
  if (typeof callback !== "function") {
4944
5024
  return ioError.raiseError("Cannot subscribe to channels, because the provided callback is not a function!");
4945
5025
  }
5026
+ if (options) {
5027
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5028
+ }
4946
5029
  const currentChannel = this.current();
4947
- const wrappedCallback = this.getWrappedSubscribeCallback(callback);
5030
+ const wrappedCallback = options?.contextType
5031
+ ? this.getWrappedSubscribeCallbackWithFdc3Type(callback, options.contextType)
5032
+ : this.getWrappedSubscribeCallback(callback);
4948
5033
  if (currentChannel) {
4949
5034
  this.replaySubscribe(wrappedCallback, currentChannel);
4950
5035
  }
4951
5036
  return this.registry.add(this.SubsKey, wrappedCallback);
4952
5037
  }
4953
- async subscribeFor(name, callback) {
5038
+ async subscribeFor(name, callback, options) {
4954
5039
  const channelNames = this.getAllChannelNames();
4955
5040
  runDecoderWithIOError(channelNameDecoder(channelNames), name);
4956
5041
  if (typeof callback !== "function") {
4957
5042
  return ioError.raiseError(`Cannot subscribe to channel ${name}, because the provided callback is not a function!`);
4958
5043
  }
5044
+ if (options) {
5045
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5046
+ }
4959
5047
  const contextName = this.createContextName(name);
4960
- const wrappedCallback = this.getWrappedSubscribeCallback(callback);
5048
+ const wrappedCallback = options?.contextType
5049
+ ? this.getWrappedSubscribeCallbackWithFdc3Type(callback, options.contextType)
5050
+ : this.getWrappedSubscribeCallback(callback);
4961
5051
  return this.contexts.subscribe(contextName, (context, _, __, ___, extraData) => {
4962
5052
  wrappedCallback(context.data, context, extraData?.updaterId);
4963
5053
  });
@@ -4988,16 +5078,38 @@
4988
5078
  const channelNames = this.getAllChannelNames();
4989
5079
  return channelNames;
4990
5080
  }
4991
- async get(name) {
5081
+ async get(name, options) {
4992
5082
  const channelNames = this.getAllChannelNames();
4993
5083
  runDecoderWithIOError(channelNameDecoder(channelNames), name);
5084
+ if (options) {
5085
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5086
+ }
4994
5087
  const contextName = this.createContextName(name);
4995
5088
  const channelContext = await this.contexts.get(contextName);
5089
+ if (options?.contextType) {
5090
+ return this.getContextForFdc3Type(channelContext, options.contextType);
5091
+ }
4996
5092
  if (channelContext.latest_fdc3_type) {
4997
5093
  return this.getContextWithFdc3Data(channelContext);
4998
5094
  }
4999
5095
  return channelContext;
5000
5096
  }
5097
+ getContextForFdc3Type(channelContext, searchedType) {
5098
+ const encodedType = `fdc3_${searchedType.split(".").join("&")}`;
5099
+ if (!channelContext.data[encodedType]) {
5100
+ return {
5101
+ name: channelContext.name,
5102
+ meta: channelContext.meta,
5103
+ data: {}
5104
+ };
5105
+ }
5106
+ const fdc3Context = { type: searchedType, ...channelContext.data[encodedType] };
5107
+ return {
5108
+ name: channelContext.name,
5109
+ meta: channelContext.meta,
5110
+ data: { fdc3: fdc3Context }
5111
+ };
5112
+ }
5001
5113
  getContextWithFdc3Data(channelContext) {
5002
5114
  const { latest_fdc3_type, ...rest } = channelContext;
5003
5115
  const parsedType = latest_fdc3_type.split("&").join(".");
@@ -5023,13 +5135,17 @@
5023
5135
  return this.registry.add(this.ChangedKey, callback);
5024
5136
  }
5025
5137
  async add(info) {
5026
- const channelContext = runDecoderWithIOError(channelContextDecoder, info);
5138
+ const channelContext = runDecoderWithIOError(channelDefinitionDecoder, info);
5027
5139
  const channelWithSuchNameExists = this.getAllChannelNames().includes(channelContext.name);
5028
5140
  if (channelWithSuchNameExists) {
5029
5141
  return ioError.raiseError("There's an already existing channel with such name");
5030
5142
  }
5031
5143
  await this.bridge.send("channels", operations$4.addChannel, channelContext);
5032
- return channelContext;
5144
+ return {
5145
+ name: channelContext.name,
5146
+ meta: channelContext.meta,
5147
+ data: channelContext.data || {}
5148
+ };
5033
5149
  }
5034
5150
  async remove(name) {
5035
5151
  runDecoderWithIOError(nonEmptyStringDecoder, name);
@@ -5057,11 +5173,14 @@
5057
5173
  })
5058
5174
  .catch(err => this.logger.trace(err));
5059
5175
  };
5060
- async getMy() {
5176
+ async getMy(options) {
5061
5177
  if (!this.currentChannelName) {
5062
5178
  return;
5063
5179
  }
5064
- return this.get(this.currentChannelName);
5180
+ if (options) {
5181
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5182
+ }
5183
+ return this.get(this.currentChannelName, options);
5065
5184
  }
5066
5185
  async getWindowsOnChannel(channel) {
5067
5186
  const channelNames = this.getAllChannelNames();
@@ -5205,6 +5324,55 @@
5205
5324
  };
5206
5325
  return wrappedCallback;
5207
5326
  }
5327
+ getWrappedSubscribeCallbackWithFdc3Type(callback, fdc3Type) {
5328
+ const didReplay = { replayed: false };
5329
+ const wrappedCallback = (_, context, updaterId) => {
5330
+ const canRead = this.isAllowedByRestrictions(context.name, "read");
5331
+ if (!canRead) {
5332
+ return;
5333
+ }
5334
+ const { data, latest_fdc3_type } = context;
5335
+ const searchedType = `fdc3_${fdc3Type.split(".").join("&")}`;
5336
+ if (!data[searchedType]) {
5337
+ return;
5338
+ }
5339
+ if (didReplay.replayed) {
5340
+ return this.parseDataAndInvokeSubscribeCallback({ latestFdc3TypeEncoded: latest_fdc3_type, searchedType: fdc3Type, callback, context, updaterId });
5341
+ }
5342
+ const fdc3Data = { type: fdc3Type, ...data[searchedType] };
5343
+ callback({ fdc3: fdc3Data }, context, updaterId);
5344
+ didReplay.replayed = true;
5345
+ };
5346
+ return wrappedCallback;
5347
+ }
5348
+ parseDataAndInvokeSubscribeCallback(args) {
5349
+ const { latestFdc3TypeEncoded, searchedType, callback, context, updaterId } = args;
5350
+ const latestPublishedType = latestFdc3TypeEncoded.split("&").join(".");
5351
+ if (latestPublishedType !== searchedType) {
5352
+ return;
5353
+ }
5354
+ const fdc3Data = { type: searchedType, ...context.data[`fdc3_${latestFdc3TypeEncoded}`] };
5355
+ callback({ fdc3: fdc3Data }, context, updaterId);
5356
+ }
5357
+ async requestChannelSelector(myInstance) {
5358
+ if (!myInstance) {
5359
+ return;
5360
+ }
5361
+ const myApplicationData = myInstance.application;
5362
+ const myAppDetails = myApplicationData.userProperties?.details;
5363
+ if (!myAppDetails) {
5364
+ return;
5365
+ }
5366
+ if (!myAppDetails?.channelSelector?.enabled) {
5367
+ return;
5368
+ }
5369
+ const { channels: channelsStorageData } = this.sessionController.getWindowData();
5370
+ const channelName = channelsStorageData?.currentName;
5371
+ const windowId = myInstance.id;
5372
+ const channelsNames = channelName ? [channelName] : [];
5373
+ const requestChannelSelectorConfig = { windowId, channelsNames };
5374
+ await this.bridge.send("channels", operations$4.requestChannelSelector, requestChannelSelectorConfig, undefined, { includeOperationCheck: true });
5375
+ }
5208
5376
  }
5209
5377
 
5210
5378
  const operations$3 = {
@@ -5799,8 +5967,8 @@
5799
5967
  }
5800
5968
  async tryGetWorkspaceBasedBounds() {
5801
5969
  try {
5802
- await this.bridge.send("workspaces", systemOperations.operationCheck, { operation: "getWorkspaceWindowFrameBounds" });
5803
- const bridgeResponse = await this.bridge.send("workspaces", systemOperations.getWorkspaceWindowFrameBounds, { itemId: this.windowsController.my().id });
5970
+ await this.bridge.send("workspaces", commonOperations.operationCheck, { operation: "getWorkspaceWindowFrameBounds" });
5971
+ const bridgeResponse = await this.bridge.send("workspaces", commonOperations.getWorkspaceWindowFrameBounds, { itemId: this.windowsController.my().id });
5804
5972
  const myWorkspaceBounds = bridgeResponse.bounds;
5805
5973
  this.logger.trace(`Opening the resolver UI relative to my workspace frame window bounds: ${JSON.stringify(myWorkspaceBounds)}`);
5806
5974
  return myWorkspaceBounds;
@@ -6302,16 +6470,12 @@
6302
6470
  }
6303
6471
  }
6304
6472
 
6305
- var version$1 = "3.4.5";
6473
+ var version$1 = "3.4.7";
6306
6474
 
6307
6475
  const createFactoryFunction = (coreFactoryFunction) => {
6308
- return async (userConfig) => {
6309
- if (window.glue42gd || window.iodesktop) {
6310
- return enterprise(userConfig);
6311
- }
6476
+ let cachedApiPromise;
6477
+ const initAPI = async (config) => {
6312
6478
  const ioc = new IoC();
6313
- const config = parseConfig(userConfig);
6314
- checkSingleton();
6315
6479
  const glue = await PromiseWrap(() => coreFactoryFunction(config, { version: version$1 }), 30000, "Glue Web initialization timed out, because core didn't resolve");
6316
6480
  const logger = glue.logger.subLogger("web.main.controller");
6317
6481
  ioc.defineGlue(glue);
@@ -6327,12 +6491,29 @@
6327
6491
  logger.trace("all libraries were started");
6328
6492
  ioc.eventsDispatcher.start(glue);
6329
6493
  logger.trace("start event dispatched, glue is ready, returning it");
6494
+ await Promise.all(Object.values(ioc.controllers).map((controller) => controller.postStart ? controller.postStart(glue, ioc) : Promise.resolve()));
6330
6495
  return glue;
6331
6496
  }
6332
6497
  catch (error) {
6333
6498
  return ioError.raiseError(error, true);
6334
6499
  }
6335
6500
  };
6501
+ const factory = (userConfig) => {
6502
+ if (window.glue42gd || window.iodesktop) {
6503
+ return enterprise(userConfig);
6504
+ }
6505
+ const config = parseConfig(userConfig);
6506
+ try {
6507
+ checkSingleton();
6508
+ }
6509
+ catch (error) {
6510
+ return typeof cachedApiPromise === "undefined" ? Promise.reject(new Error(error)) : cachedApiPromise;
6511
+ }
6512
+ const apiPromise = initAPI(config);
6513
+ cachedApiPromise = userConfig?.memoizeAPI ? apiPromise : undefined;
6514
+ return apiPromise;
6515
+ };
6516
+ return factory;
6336
6517
  };
6337
6518
 
6338
6519
  var MetricTypes = {
@@ -9673,10 +9854,6 @@
9673
9854
  function arrayReduce(array, iteratee, accumulator, initAccum) {
9674
9855
  var index = -1,
9675
9856
  length = array ? array.length : 0;
9676
-
9677
- if (initAccum && length) {
9678
- accumulator = array[++index];
9679
- }
9680
9857
  while (++index < length) {
9681
9858
  accumulator = iteratee(accumulator, array[index], index, array);
9682
9859
  }
@@ -10262,7 +10439,7 @@
10262
10439
  skipIndexes = !!length;
10263
10440
 
10264
10441
  for (var key in value) {
10265
- if ((inherited || hasOwnProperty.call(value, key)) &&
10442
+ if ((hasOwnProperty.call(value, key)) &&
10266
10443
  !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
10267
10444
  result.push(key);
10268
10445
  }
@@ -10615,9 +10792,7 @@
10615
10792
  while (++index < length) {
10616
10793
  var key = props[index];
10617
10794
 
10618
- var newValue = customizer
10619
- ? customizer(object[key], source[key], key, object, source)
10620
- : undefined;
10795
+ var newValue = undefined;
10621
10796
 
10622
10797
  assignValue(object, key, newValue === undefined ? source[key] : newValue);
10623
10798
  }