@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.
@@ -2027,7 +2027,7 @@ const nonEmptyStringDecoder = string$1().where((s) => s.length > 0, "Expected a
2027
2027
  const nonNegativeNumberDecoder = number$1().where((num) => num >= 0, "Expected a non-negative number");
2028
2028
  const optionalNonEmptyStringDecoder = optional$1(nonEmptyStringDecoder);
2029
2029
  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"));
2030
- 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"));
2030
+ 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"));
2031
2031
  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"));
2032
2032
  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"));
2033
2033
  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"));
@@ -2117,12 +2117,28 @@ const instanceDataDecoder = object$1({
2117
2117
  id: nonEmptyStringDecoder,
2118
2118
  applicationName: nonEmptyStringDecoder
2119
2119
  });
2120
+ const iframePermissionsPolicyConfigDecoder = object$1({
2121
+ flags: string$1()
2122
+ });
2123
+ const workspacesSandboxDecoder = object$1({
2124
+ flags: string$1()
2125
+ });
2126
+ const requestChannelSelectorConfigDecoder = object$1({
2127
+ windowId: nonEmptyStringDecoder,
2128
+ channelsNames: array$1(nonEmptyStringDecoder)
2129
+ });
2130
+ const channelSelectorDecoder = object$1({
2131
+ enabled: boolean$1(),
2132
+ });
2120
2133
  const applicationDetailsDecoder = object$1({
2121
2134
  url: nonEmptyStringDecoder,
2122
2135
  top: optional$1(number$1()),
2123
2136
  left: optional$1(number$1()),
2124
2137
  width: optional$1(nonNegativeNumberDecoder),
2125
- height: optional$1(nonNegativeNumberDecoder)
2138
+ height: optional$1(nonNegativeNumberDecoder),
2139
+ workspacesSandbox: optional$1(workspacesSandboxDecoder),
2140
+ channelSelector: optional$1(channelSelectorDecoder),
2141
+ iframePermissionsPolicy: optional$1(iframePermissionsPolicyConfigDecoder)
2126
2142
  });
2127
2143
  const intentDefinitionDecoder = object$1({
2128
2144
  name: nonEmptyStringDecoder,
@@ -2478,10 +2494,17 @@ const getIntentsResultDecoder = object$1({
2478
2494
  const channelNameDecoder = (channelNames) => {
2479
2495
  return nonEmptyStringDecoder.where(s => channelNames.includes(s), "Expected a valid channel name");
2480
2496
  };
2497
+ const fdc3OptionsDecoder = object$1({
2498
+ contextType: optional$1(nonEmptyStringDecoder)
2499
+ });
2481
2500
  const publishOptionsDecoder = optional$1(oneOf$1(nonEmptyStringDecoder, object$1({
2482
2501
  name: optional$1(nonEmptyStringDecoder),
2483
2502
  fdc3: optional$1(boolean$1())
2484
2503
  })));
2504
+ const leaveChannelsConfig = object$1({
2505
+ windowId: optionalNonEmptyStringDecoder,
2506
+ channel: optionalNonEmptyStringDecoder
2507
+ });
2485
2508
  const fdc3ContextDecoder = anyJson$1().where((value) => typeof value.type === "string", "Expected a valid FDC3 Context with compulsory 'type' field");
2486
2509
  const interopActionSettingsDecoder = object$1({
2487
2510
  method: nonEmptyStringDecoder,
@@ -2540,7 +2563,8 @@ const notificationSetStateRequestDecoder = object$1({
2540
2563
  id: nonEmptyStringDecoder,
2541
2564
  state: notificationStateDecoder
2542
2565
  });
2543
- const channelContextDecoder = object$1({
2566
+ object$1().where((value) => value.fdc3 ? typeof value.fdc3.type === "string" : true, "Expected a valid FDC3 Context with compulsory 'type' field");
2567
+ const channelDefinitionDecoder = object$1({
2544
2568
  name: nonEmptyStringDecoder,
2545
2569
  meta: object$1({
2546
2570
  color: nonEmptyStringDecoder
@@ -2697,7 +2721,7 @@ const getWindowIdsOnChannelDataDecoder = object$1({
2697
2721
  const getWindowIdsOnChannelResultDecoder = object$1({
2698
2722
  windowIds: array$1(nonEmptyStringDecoder)
2699
2723
  });
2700
- 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"));
2724
+ 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"));
2701
2725
  const getMyChanelResultDecoder = object$1({
2702
2726
  channel: optional$1(nonEmptyStringDecoder)
2703
2727
  });
@@ -2732,6 +2756,14 @@ const joinChannelDataDecoder = object$1({
2732
2756
  channel: nonEmptyStringDecoder,
2733
2757
  windowId: nonEmptyStringDecoder
2734
2758
  });
2759
+ const leaveChannelDataDecoder = object$1({
2760
+ windowId: nonEmptyStringDecoder,
2761
+ channelName: optional$1(nonEmptyStringDecoder)
2762
+ });
2763
+ const channelsChangedDataDecoder = object$1({
2764
+ windowId: nonEmptyStringDecoder,
2765
+ channelNames: array$1(nonEmptyStringDecoder)
2766
+ });
2735
2767
  const windowChannelResultDecoder = object$1({
2736
2768
  channel: optional$1(nonEmptyStringDecoder),
2737
2769
  });
@@ -2782,6 +2814,7 @@ const operations$9 = {
2782
2814
  setTitle: { name: "setTitle", dataDecoder: windowTitleConfigDecoder },
2783
2815
  focusChange: { name: "focusChange", dataDecoder: focusEventDataDecoder },
2784
2816
  getChannel: { name: "getChannel", dataDecoder: simpleWindowDecoder, resultDecoder: windowChannelResultDecoder },
2817
+ notifyChannelsChanged: { name: "notifyChannelsChanged", dataDecoder: channelsChangedDataDecoder }
2785
2818
  };
2786
2819
 
2787
2820
  function getDefaultExportFromCjs$1 (x) {
@@ -2937,6 +2970,9 @@ class WebWindowModel {
2937
2970
  this.me.isFocused = hasFocus;
2938
2971
  this.registry.execute("focus-change", this.me);
2939
2972
  }
2973
+ processChannelsChangedEvent(channelNames) {
2974
+ this.registry.execute("channels-changed", channelNames);
2975
+ }
2940
2976
  async toApi() {
2941
2977
  this.ctxUnsubscribe = await this._bridge.contextLib.subscribe(this.myCtxKey, (data) => this.registry.execute("context-updated", data));
2942
2978
  this.me = {
@@ -2958,6 +2994,7 @@ class WebWindowModel {
2958
2994
  onContextUpdated: this.onContextUpdated.bind(this),
2959
2995
  onFocusChanged: this.onFocusChanged.bind(this),
2960
2996
  getChannel: this.getChannel.bind(this),
2997
+ onChannelsChanged: this.onChannelsChanged.bind(this),
2961
2998
  };
2962
2999
  return this.me;
2963
3000
  }
@@ -3062,9 +3099,12 @@ class WebWindowModel {
3062
3099
  const result = await this._bridge.send("windows", operations$9.getChannel, { windowId: this.id }, undefined, { includeOperationCheck: true });
3063
3100
  return result.channel;
3064
3101
  }
3102
+ onChannelsChanged(callback) {
3103
+ return this.registry.add("channels-changed", callback);
3104
+ }
3065
3105
  }
3066
3106
 
3067
- const systemOperations = {
3107
+ const commonOperations = {
3068
3108
  operationCheck: { name: "operationCheck", dataDecoder: operationCheckConfigDecoder, resultDecoder: operationCheckResultDecoder },
3069
3109
  getWorkspaceWindowFrameBounds: { name: "getWorkspaceWindowFrameBounds", resultDecoder: workspaceFrameBoundsResultDecoder, dataDecoder: simpleItemIdDecoder }
3070
3110
  };
@@ -3077,7 +3117,7 @@ const PromiseWrap = (promise, timeoutMilliseconds, timeoutMessage) => {
3077
3117
  return;
3078
3118
  }
3079
3119
  promiseActive = false;
3080
- const message = timeoutMessage || `Promise timeout hit: ${timeoutMilliseconds}`;
3120
+ const message = timeoutMessage;
3081
3121
  reject(message);
3082
3122
  }, timeoutMilliseconds);
3083
3123
  promise()
@@ -3208,6 +3248,7 @@ class WindowsController {
3208
3248
  operations$9.moveResize.execute = this.handleMoveResize.bind(this);
3209
3249
  operations$9.setTitle.execute = this.handleSetTitle.bind(this);
3210
3250
  operations$9.getChannel.execute = this.handleGetChannel.bind(this);
3251
+ operations$9.notifyChannelsChanged.execute = this.handleChannelsChanged.bind(this);
3211
3252
  }
3212
3253
  my() {
3213
3254
  return Object.assign({}, this.me);
@@ -3341,7 +3382,7 @@ class WindowsController {
3341
3382
  return;
3342
3383
  }
3343
3384
  try {
3344
- await this.bridge.send("windows", systemOperations.operationCheck, { operation: "focusChange" });
3385
+ await this.bridge.send("windows", commonOperations.operationCheck, { operation: "focusChange" });
3345
3386
  }
3346
3387
  catch (error) {
3347
3388
  this.logger.warn("The platform of this client is outdated and does not support focus tracking, disabling focus events for this client.");
@@ -3397,6 +3438,10 @@ class WindowsController {
3397
3438
  ...(channel ? { channel } : {}),
3398
3439
  };
3399
3440
  }
3441
+ async handleChannelsChanged(data) {
3442
+ const windowProjection = this.allWindowProjections.find((projection) => projection.id === data.windowId);
3443
+ windowProjection?.model.processChannelsChangedEvent(data.channelNames);
3444
+ }
3400
3445
  }
3401
3446
 
3402
3447
  const GlueWebPlatformControlName = "T42.Web.Platform.Control";
@@ -3489,7 +3534,7 @@ class GlueBridge {
3489
3534
  }
3490
3535
  async checkOperationSupported(domain, operation) {
3491
3536
  try {
3492
- const result = await this.send(domain, systemOperations.operationCheck, { operation: operation.name });
3537
+ const result = await this.send(domain, commonOperations.operationCheck, { operation: operation.name });
3493
3538
  return result;
3494
3539
  }
3495
3540
  catch (error) {
@@ -4537,7 +4582,7 @@ class IntentsController {
4537
4582
  }
4538
4583
  async isRaiseOperationSupported() {
4539
4584
  try {
4540
- const { isSupported } = await this.bridge.send("intents", systemOperations.operationCheck, { operation: "raise" });
4585
+ const { isSupported } = await this.bridge.send("intents", commonOperations.operationCheck, { operation: "raise" });
4541
4586
  return {
4542
4587
  supported: isSupported,
4543
4588
  reason: isSupported ? "" : "The platform of this client is outdated and does not support \"raise\" operation"
@@ -4730,6 +4775,9 @@ class IntentsController {
4730
4775
  return prefsForIntent?.handler;
4731
4776
  }
4732
4777
  async checkHandleRaiseWithRememberedHandler(intentRequest) {
4778
+ if (intentRequest.target) {
4779
+ return;
4780
+ }
4733
4781
  const rememberedHandler = await this.checkForRememberedHandler(intentRequest);
4734
4782
  if (!rememberedHandler) {
4735
4783
  return;
@@ -4760,7 +4808,7 @@ class IntentsController {
4760
4808
  }
4761
4809
 
4762
4810
  const operations$4 = {
4763
- addChannel: { name: "addChannel", dataDecoder: channelContextDecoder },
4811
+ addChannel: { name: "addChannel", dataDecoder: channelDefinitionDecoder },
4764
4812
  removeChannel: { name: "removeChannel", dataDecoder: removeChannelDataDecoder },
4765
4813
  getMyChannel: { name: "getMyChannel", resultDecoder: getMyChanelResultDecoder },
4766
4814
  getWindowIdsOnChannel: { name: "getWindowIdsOnChannel", dataDecoder: getWindowIdsOnChannelDataDecoder, resultDecoder: getWindowIdsOnChannelResultDecoder },
@@ -4768,7 +4816,10 @@ const operations$4 = {
4768
4816
  joinChannel: { name: "joinChannel", dataDecoder: joinChannelDataDecoder },
4769
4817
  restrict: { name: "restrict", dataDecoder: restrictionConfigDataDecoder },
4770
4818
  getRestrictions: { name: "getRestrictions", dataDecoder: getRestrictionsDataDecoder, resultDecoder: restrictionsDecoder },
4771
- restrictAll: { name: "restrictAll", dataDecoder: restrictAllDataDecoder }
4819
+ restrictAll: { name: "restrictAll", dataDecoder: restrictAllDataDecoder },
4820
+ notifyChannelsChanged: { name: "notifyChannelsChanged", dataDecoder: channelsChangedDataDecoder },
4821
+ leaveChannel: { name: "leaveChannel", dataDecoder: leaveChannelDataDecoder },
4822
+ requestChannelSelector: { name: "requestChannelSelector", dataDecoder: requestChannelSelectorConfigDecoder }
4772
4823
  };
4773
4824
 
4774
4825
  class ChannelsController {
@@ -4789,6 +4840,7 @@ class ChannelsController {
4789
4840
  addOperationsExecutors() {
4790
4841
  operations$4.getMyChannel.execute = this.handleGetMyChannel.bind(this);
4791
4842
  operations$4.joinChannel.execute = this.handleJoinChannel.bind(this);
4843
+ operations$4.leaveChannel.execute = this.handleLeaveChannel.bind(this);
4792
4844
  operations$4.restrict.execute = ({ config }) => this.restrict(config);
4793
4845
  operations$4.getRestrictions.execute = ({ windowId }) => this.getRestrictions(windowId);
4794
4846
  operations$4.restrictAll.execute = ({ restrictions }) => this.restrictAll(restrictions);
@@ -4805,6 +4857,14 @@ class ChannelsController {
4805
4857
  const api = this.toApi();
4806
4858
  coreGlue.channels = api;
4807
4859
  }
4860
+ async postStart(io, ioc) {
4861
+ try {
4862
+ await this.requestChannelSelector(io.appManager.myInstance);
4863
+ }
4864
+ catch (error) {
4865
+ this.logger.warn(`Failed to display channel selector: ${extractErrorMsg(error)}`);
4866
+ }
4867
+ }
4808
4868
  async handleBridgeMessage(args) {
4809
4869
  const operationName = runDecoderWithIOError(channelsOperationTypesDecoder, args.operation);
4810
4870
  const operation = operations$4[operationName];
@@ -4846,8 +4906,17 @@ class ChannelsController {
4846
4906
  onChanged(callback) {
4847
4907
  return this.changed(callback);
4848
4908
  }
4849
- async leave() {
4850
- await this.switchToChannel();
4909
+ async leave(config = {}) {
4910
+ runDecoderWithIOError(leaveChannelsConfig, config);
4911
+ if (!config.windowId || config.windowId === this.windowsController.my().id) {
4912
+ await this.switchToChannel();
4913
+ return;
4914
+ }
4915
+ const leaveData = { windowId: config.windowId, channelName: config.channel };
4916
+ await this.bridge.send("channels", operations$4.leaveChannel, leaveData, undefined, { includeOperationCheck: true });
4917
+ }
4918
+ handleLeaveChannel(data) {
4919
+ return this.leave({ channel: data.channelName });
4851
4920
  }
4852
4921
  toApi() {
4853
4922
  const api = {
@@ -4900,6 +4969,17 @@ class ChannelsController {
4900
4969
  }
4901
4970
  this.registry.execute(this.ChangedKey, name);
4902
4971
  this.sessionController.setWindowData({ currentName: name }, "channels");
4972
+ const windowId = this.windowsController.my().id;
4973
+ if (!windowId) {
4974
+ return;
4975
+ }
4976
+ const channelNames = this.currentChannelName ? [this.currentChannelName] : [];
4977
+ try {
4978
+ await this.bridge.send("channels", operations$4.notifyChannelsChanged, { channelNames: channelNames, windowId }, undefined, { includeOperationCheck: true });
4979
+ }
4980
+ catch (error) {
4981
+ this.logger.warn(`Failed to notify channel changed: ${extractErrorMsg(error)}`);
4982
+ }
4903
4983
  }
4904
4984
  async updateData(name, data) {
4905
4985
  const contextName = this.createContextName(name);
@@ -4933,25 +5013,35 @@ class ChannelsController {
4933
5013
  }
4934
5014
  return fdc3PropsArr[0].split("_").slice(1).join("_");
4935
5015
  }
4936
- subscribe(callback) {
5016
+ subscribe(callback, options) {
4937
5017
  if (typeof callback !== "function") {
4938
5018
  return ioError.raiseError("Cannot subscribe to channels, because the provided callback is not a function!");
4939
5019
  }
5020
+ if (options) {
5021
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5022
+ }
4940
5023
  const currentChannel = this.current();
4941
- const wrappedCallback = this.getWrappedSubscribeCallback(callback);
5024
+ const wrappedCallback = options?.contextType
5025
+ ? this.getWrappedSubscribeCallbackWithFdc3Type(callback, options.contextType)
5026
+ : this.getWrappedSubscribeCallback(callback);
4942
5027
  if (currentChannel) {
4943
5028
  this.replaySubscribe(wrappedCallback, currentChannel);
4944
5029
  }
4945
5030
  return this.registry.add(this.SubsKey, wrappedCallback);
4946
5031
  }
4947
- async subscribeFor(name, callback) {
5032
+ async subscribeFor(name, callback, options) {
4948
5033
  const channelNames = this.getAllChannelNames();
4949
5034
  runDecoderWithIOError(channelNameDecoder(channelNames), name);
4950
5035
  if (typeof callback !== "function") {
4951
5036
  return ioError.raiseError(`Cannot subscribe to channel ${name}, because the provided callback is not a function!`);
4952
5037
  }
5038
+ if (options) {
5039
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5040
+ }
4953
5041
  const contextName = this.createContextName(name);
4954
- const wrappedCallback = this.getWrappedSubscribeCallback(callback);
5042
+ const wrappedCallback = options?.contextType
5043
+ ? this.getWrappedSubscribeCallbackWithFdc3Type(callback, options.contextType)
5044
+ : this.getWrappedSubscribeCallback(callback);
4955
5045
  return this.contexts.subscribe(contextName, (context, _, __, ___, extraData) => {
4956
5046
  wrappedCallback(context.data, context, extraData?.updaterId);
4957
5047
  });
@@ -4982,16 +5072,38 @@ class ChannelsController {
4982
5072
  const channelNames = this.getAllChannelNames();
4983
5073
  return channelNames;
4984
5074
  }
4985
- async get(name) {
5075
+ async get(name, options) {
4986
5076
  const channelNames = this.getAllChannelNames();
4987
5077
  runDecoderWithIOError(channelNameDecoder(channelNames), name);
5078
+ if (options) {
5079
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5080
+ }
4988
5081
  const contextName = this.createContextName(name);
4989
5082
  const channelContext = await this.contexts.get(contextName);
5083
+ if (options?.contextType) {
5084
+ return this.getContextForFdc3Type(channelContext, options.contextType);
5085
+ }
4990
5086
  if (channelContext.latest_fdc3_type) {
4991
5087
  return this.getContextWithFdc3Data(channelContext);
4992
5088
  }
4993
5089
  return channelContext;
4994
5090
  }
5091
+ getContextForFdc3Type(channelContext, searchedType) {
5092
+ const encodedType = `fdc3_${searchedType.split(".").join("&")}`;
5093
+ if (!channelContext.data[encodedType]) {
5094
+ return {
5095
+ name: channelContext.name,
5096
+ meta: channelContext.meta,
5097
+ data: {}
5098
+ };
5099
+ }
5100
+ const fdc3Context = { type: searchedType, ...channelContext.data[encodedType] };
5101
+ return {
5102
+ name: channelContext.name,
5103
+ meta: channelContext.meta,
5104
+ data: { fdc3: fdc3Context }
5105
+ };
5106
+ }
4995
5107
  getContextWithFdc3Data(channelContext) {
4996
5108
  const { latest_fdc3_type, ...rest } = channelContext;
4997
5109
  const parsedType = latest_fdc3_type.split("&").join(".");
@@ -5017,13 +5129,17 @@ class ChannelsController {
5017
5129
  return this.registry.add(this.ChangedKey, callback);
5018
5130
  }
5019
5131
  async add(info) {
5020
- const channelContext = runDecoderWithIOError(channelContextDecoder, info);
5132
+ const channelContext = runDecoderWithIOError(channelDefinitionDecoder, info);
5021
5133
  const channelWithSuchNameExists = this.getAllChannelNames().includes(channelContext.name);
5022
5134
  if (channelWithSuchNameExists) {
5023
5135
  return ioError.raiseError("There's an already existing channel with such name");
5024
5136
  }
5025
5137
  await this.bridge.send("channels", operations$4.addChannel, channelContext);
5026
- return channelContext;
5138
+ return {
5139
+ name: channelContext.name,
5140
+ meta: channelContext.meta,
5141
+ data: channelContext.data || {}
5142
+ };
5027
5143
  }
5028
5144
  async remove(name) {
5029
5145
  runDecoderWithIOError(nonEmptyStringDecoder, name);
@@ -5051,11 +5167,14 @@ class ChannelsController {
5051
5167
  })
5052
5168
  .catch(err => this.logger.trace(err));
5053
5169
  };
5054
- async getMy() {
5170
+ async getMy(options) {
5055
5171
  if (!this.currentChannelName) {
5056
5172
  return;
5057
5173
  }
5058
- return this.get(this.currentChannelName);
5174
+ if (options) {
5175
+ runDecoderWithIOError(fdc3OptionsDecoder, options);
5176
+ }
5177
+ return this.get(this.currentChannelName, options);
5059
5178
  }
5060
5179
  async getWindowsOnChannel(channel) {
5061
5180
  const channelNames = this.getAllChannelNames();
@@ -5199,6 +5318,55 @@ class ChannelsController {
5199
5318
  };
5200
5319
  return wrappedCallback;
5201
5320
  }
5321
+ getWrappedSubscribeCallbackWithFdc3Type(callback, fdc3Type) {
5322
+ const didReplay = { replayed: false };
5323
+ const wrappedCallback = (_, context, updaterId) => {
5324
+ const canRead = this.isAllowedByRestrictions(context.name, "read");
5325
+ if (!canRead) {
5326
+ return;
5327
+ }
5328
+ const { data, latest_fdc3_type } = context;
5329
+ const searchedType = `fdc3_${fdc3Type.split(".").join("&")}`;
5330
+ if (!data[searchedType]) {
5331
+ return;
5332
+ }
5333
+ if (didReplay.replayed) {
5334
+ return this.parseDataAndInvokeSubscribeCallback({ latestFdc3TypeEncoded: latest_fdc3_type, searchedType: fdc3Type, callback, context, updaterId });
5335
+ }
5336
+ const fdc3Data = { type: fdc3Type, ...data[searchedType] };
5337
+ callback({ fdc3: fdc3Data }, context, updaterId);
5338
+ didReplay.replayed = true;
5339
+ };
5340
+ return wrappedCallback;
5341
+ }
5342
+ parseDataAndInvokeSubscribeCallback(args) {
5343
+ const { latestFdc3TypeEncoded, searchedType, callback, context, updaterId } = args;
5344
+ const latestPublishedType = latestFdc3TypeEncoded.split("&").join(".");
5345
+ if (latestPublishedType !== searchedType) {
5346
+ return;
5347
+ }
5348
+ const fdc3Data = { type: searchedType, ...context.data[`fdc3_${latestFdc3TypeEncoded}`] };
5349
+ callback({ fdc3: fdc3Data }, context, updaterId);
5350
+ }
5351
+ async requestChannelSelector(myInstance) {
5352
+ if (!myInstance) {
5353
+ return;
5354
+ }
5355
+ const myApplicationData = myInstance.application;
5356
+ const myAppDetails = myApplicationData.userProperties?.details;
5357
+ if (!myAppDetails) {
5358
+ return;
5359
+ }
5360
+ if (!myAppDetails?.channelSelector?.enabled) {
5361
+ return;
5362
+ }
5363
+ const { channels: channelsStorageData } = this.sessionController.getWindowData();
5364
+ const channelName = channelsStorageData?.currentName;
5365
+ const windowId = myInstance.id;
5366
+ const channelsNames = channelName ? [channelName] : [];
5367
+ const requestChannelSelectorConfig = { windowId, channelsNames };
5368
+ await this.bridge.send("channels", operations$4.requestChannelSelector, requestChannelSelectorConfig, undefined, { includeOperationCheck: true });
5369
+ }
5202
5370
  }
5203
5371
 
5204
5372
  const operations$3 = {
@@ -5793,8 +5961,8 @@ class LegacyIntentsHelper {
5793
5961
  }
5794
5962
  async tryGetWorkspaceBasedBounds() {
5795
5963
  try {
5796
- await this.bridge.send("workspaces", systemOperations.operationCheck, { operation: "getWorkspaceWindowFrameBounds" });
5797
- const bridgeResponse = await this.bridge.send("workspaces", systemOperations.getWorkspaceWindowFrameBounds, { itemId: this.windowsController.my().id });
5964
+ await this.bridge.send("workspaces", commonOperations.operationCheck, { operation: "getWorkspaceWindowFrameBounds" });
5965
+ const bridgeResponse = await this.bridge.send("workspaces", commonOperations.getWorkspaceWindowFrameBounds, { itemId: this.windowsController.my().id });
5798
5966
  const myWorkspaceBounds = bridgeResponse.bounds;
5799
5967
  this.logger.trace(`Opening the resolver UI relative to my workspace frame window bounds: ${JSON.stringify(myWorkspaceBounds)}`);
5800
5968
  return myWorkspaceBounds;
@@ -6296,16 +6464,12 @@ class IoC {
6296
6464
  }
6297
6465
  }
6298
6466
 
6299
- var version$1 = "3.4.5";
6467
+ var version$1 = "3.4.7";
6300
6468
 
6301
6469
  const createFactoryFunction = (coreFactoryFunction) => {
6302
- return async (userConfig) => {
6303
- if (window.glue42gd || window.iodesktop) {
6304
- return enterprise(userConfig);
6305
- }
6470
+ let cachedApiPromise;
6471
+ const initAPI = async (config) => {
6306
6472
  const ioc = new IoC();
6307
- const config = parseConfig(userConfig);
6308
- checkSingleton();
6309
6473
  const glue = await PromiseWrap(() => coreFactoryFunction(config, { version: version$1 }), 30000, "Glue Web initialization timed out, because core didn't resolve");
6310
6474
  const logger = glue.logger.subLogger("web.main.controller");
6311
6475
  ioc.defineGlue(glue);
@@ -6321,12 +6485,29 @@ const createFactoryFunction = (coreFactoryFunction) => {
6321
6485
  logger.trace("all libraries were started");
6322
6486
  ioc.eventsDispatcher.start(glue);
6323
6487
  logger.trace("start event dispatched, glue is ready, returning it");
6488
+ await Promise.all(Object.values(ioc.controllers).map((controller) => controller.postStart ? controller.postStart(glue, ioc) : Promise.resolve()));
6324
6489
  return glue;
6325
6490
  }
6326
6491
  catch (error) {
6327
6492
  return ioError.raiseError(error, true);
6328
6493
  }
6329
6494
  };
6495
+ const factory = (userConfig) => {
6496
+ if (window.glue42gd || window.iodesktop) {
6497
+ return enterprise(userConfig);
6498
+ }
6499
+ const config = parseConfig(userConfig);
6500
+ try {
6501
+ checkSingleton();
6502
+ }
6503
+ catch (error) {
6504
+ return typeof cachedApiPromise === "undefined" ? Promise.reject(new Error(error)) : cachedApiPromise;
6505
+ }
6506
+ const apiPromise = initAPI(config);
6507
+ cachedApiPromise = userConfig?.memoizeAPI ? apiPromise : undefined;
6508
+ return apiPromise;
6509
+ };
6510
+ return factory;
6330
6511
  };
6331
6512
 
6332
6513
  var MetricTypes = {
@@ -9667,10 +9848,6 @@ lodash_clonedeep.exports;
9667
9848
  function arrayReduce(array, iteratee, accumulator, initAccum) {
9668
9849
  var index = -1,
9669
9850
  length = array ? array.length : 0;
9670
-
9671
- if (initAccum && length) {
9672
- accumulator = array[++index];
9673
- }
9674
9851
  while (++index < length) {
9675
9852
  accumulator = iteratee(accumulator, array[index], index, array);
9676
9853
  }
@@ -10256,7 +10433,7 @@ lodash_clonedeep.exports;
10256
10433
  skipIndexes = !!length;
10257
10434
 
10258
10435
  for (var key in value) {
10259
- if ((inherited || hasOwnProperty.call(value, key)) &&
10436
+ if ((hasOwnProperty.call(value, key)) &&
10260
10437
  !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
10261
10438
  result.push(key);
10262
10439
  }
@@ -10609,9 +10786,7 @@ lodash_clonedeep.exports;
10609
10786
  while (++index < length) {
10610
10787
  var key = props[index];
10611
10788
 
10612
- var newValue = customizer
10613
- ? customizer(object[key], source[key], key, object, source)
10614
- : undefined;
10789
+ var newValue = undefined;
10615
10790
 
10616
10791
  assignValue(object, key, newValue === undefined ? source[key] : newValue);
10617
10792
  }