@interopio/browser 3.5.1 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser.d.ts CHANGED
@@ -6,7 +6,6 @@ import { IOConnectCore } from "@interopio/core";
6
6
  import { IOConnectDesktop } from "@interopio/desktop";
7
7
  import { IOConnectWorkspaces } from "@interopio/workspaces-api";
8
8
  import { IOConnectSearch } from "@interopio/search-api";
9
- import { IOBrowserWidget } from "@interopio/widget";
10
9
  import { Context as FDC3Context } from "@finos/fdc3";
11
10
 
12
11
  /**
@@ -118,7 +117,61 @@ export namespace IOConnectBrowser {
118
117
  widget?: Widget;
119
118
  }
120
119
 
121
- export interface Widget extends IOBrowserWidget.Config {
120
+ export namespace Widget {
121
+ export type ChannelSelectorType = "directional" | "default";
122
+
123
+ export type ChannelsDisplayMode = "all" | "fdc3";
124
+
125
+ export type Position = "top" | "bottom" | "left" | "right";
126
+
127
+ export type Mode = "compact" | "default";
128
+
129
+ export interface ChannelSelectorConfig {
130
+ /**
131
+ * Configure whether Channel Selector will be added to the Widget component
132
+ * @default true
133
+ */
134
+ enable?: boolean;
135
+
136
+ type?: ChannelSelectorType;
137
+ }
138
+
139
+ export interface Channels {
140
+ selector?: ChannelSelectorConfig;
141
+ /**
142
+ * Configure whether to show only fdc3-enabled channels or all
143
+ * @default all
144
+ */
145
+ displayMode?: ChannelsDisplayMode;
146
+ }
147
+
148
+ export interface DefaultConfig {
149
+ enable: boolean;
150
+
151
+ channels?: Channels;
152
+
153
+ /**
154
+ * Starting position
155
+ * @default bottom
156
+ */
157
+ position?: Position;
158
+
159
+ /**
160
+ * Widget mode
161
+ * @default default
162
+ */
163
+ mode?: Mode;
164
+
165
+ /**
166
+ * If `true`, the widget will be visible in the app even if the app is currently in a Workspace.
167
+ * @default false
168
+ */
169
+ displayInWorkspace?: boolean;
170
+ }
171
+ }
172
+
173
+
174
+ export interface Widget extends Widget.DefaultConfig {
122
175
  /**
123
176
  * Whether to wait for IOBrowserWidget factory to resolve
124
177
  * @default true
@@ -530,6 +583,12 @@ export namespace IOConnectBrowser {
530
583
  /** Array of component objects describing the apps and Workspaces saved in the Layout. */
531
584
  components: Array<WindowComponent | WorkspaceFrameComponent | IOConnectWorkspaces.WorkspaceComponent>;
532
585
 
586
+ /**
587
+ * Used internally to audit operations.
588
+ * @ignore
589
+ */
590
+ token?: string;
591
+
533
592
  /** Context object passed when the Layout was saved. */
534
593
  context?: any;
535
594
 
package/changelog.md CHANGED
@@ -1,3 +1,5 @@
1
+ 3.5.2
2
+ fix: Update channels methods to work for iframes
1
3
  3.5.1
2
4
  chore: workspaces api bump
3
5
  3.5.0
@@ -2324,6 +2324,7 @@ const workspaceFrameComponentDecoder = object$1({
2324
2324
  const glueLayoutDecoder = object$1({
2325
2325
  name: nonEmptyStringDecoder,
2326
2326
  type: layoutTypeDecoder,
2327
+ token: optional$1(nonEmptyStringDecoder),
2327
2328
  components: array$1(oneOf$1(windowLayoutComponentDecoder, workspaceLayoutComponentDecoder, workspaceFrameComponentDecoder)),
2328
2329
  context: optional$1(anyJson$1()),
2329
2330
  metadata: optional$1(anyJson$1()),
@@ -4965,6 +4966,7 @@ class ChannelsController {
4965
4966
  registry = CallbackRegistryFactory$1();
4966
4967
  logger;
4967
4968
  contexts;
4969
+ interop;
4968
4970
  bridge;
4969
4971
  windowsController;
4970
4972
  sessionController;
@@ -4986,6 +4988,7 @@ class ChannelsController {
4986
4988
  this.logger = coreGlue.logger.subLogger("channels.controller.web");
4987
4989
  this.logger.trace("starting the web channels controller");
4988
4990
  this.contexts = coreGlue.contexts;
4991
+ this.interop = coreGlue.interop;
4989
4992
  this.addOperationsExecutors();
4990
4993
  this.bridge = ioc.bridge;
4991
4994
  this.windowsController = ioc.windowsController;
@@ -5031,7 +5034,7 @@ class ChannelsController {
5031
5034
  const channelNames = this.getAllChannelNames();
5032
5035
  runDecoderWithIOError(channelNameDecoder(channelNames), name);
5033
5036
  runDecoderWithIOError(optionalNonEmptyStringDecoder, windowId);
5034
- const forAnotherClient = windowId && windowId !== this.windowsController.my().id;
5037
+ const forAnotherClient = windowId && windowId !== this.interop.instance.instance;
5035
5038
  if (forAnotherClient) {
5036
5039
  return await this.bridge.send("channels", operations$5.joinChannel, { channel: name, windowId }, undefined, { includeOperationCheck: true });
5037
5040
  }
@@ -5052,7 +5055,8 @@ class ChannelsController {
5052
5055
  const channelNames = this.getAllChannelNames();
5053
5056
  runDecoderWithIOError(channelNameDecoder(channelNames), config.channel);
5054
5057
  }
5055
- if (config.windowId && config.windowId !== this.windowsController.my().id) {
5058
+ const forAnotherClient = config.windowId && config.windowId !== this.interop.instance.instance;
5059
+ if (config.windowId && forAnotherClient) {
5056
5060
  const leaveData = { windowId: config.windowId, channelName: config.channel };
5057
5061
  await this.bridge.send("channels", operations$5.leaveChannel, leaveData, undefined, { includeOperationCheck: true });
5058
5062
  return;
@@ -5392,7 +5396,7 @@ class ChannelsController {
5392
5396
  runDecoderWithIOError(channelRestrictionsDecoder, config);
5393
5397
  const channelNames = this.getAllChannelNames();
5394
5398
  runDecoderWithIOError(channelNameDecoder(channelNames), config.name);
5395
- const forAnotherClient = config.windowId && config.windowId !== this.windowsController.my().id;
5399
+ const forAnotherClient = config.windowId && config.windowId !== this.interop.instance.instance;
5396
5400
  if (forAnotherClient) {
5397
5401
  return this.bridge.send("channels", operations$5.restrict, { config }, undefined, { includeOperationCheck: true });
5398
5402
  }
@@ -5408,15 +5412,16 @@ class ChannelsController {
5408
5412
  }
5409
5413
  async getRestrictions(windowId) {
5410
5414
  runDecoderWithIOError(optionalNonEmptyStringDecoder, windowId);
5411
- if (!windowId || windowId === this.windowsController.my().id) {
5412
- return this.getMyRestrictions();
5415
+ const forAnotherClient = windowId && windowId !== this.interop.instance.instance;
5416
+ if (windowId && forAnotherClient) {
5417
+ return this.bridge.send("channels", operations$5.getRestrictions, { windowId }, undefined, { includeOperationCheck: true });
5413
5418
  }
5414
- return this.bridge.send("channels", operations$5.getRestrictions, { windowId }, undefined, { includeOperationCheck: true });
5419
+ return this.getMyRestrictions();
5415
5420
  }
5416
5421
  async restrictAll(restrictions) {
5417
5422
  runDecoderWithIOError(restrictionsConfigDecoder, restrictions);
5418
5423
  const allChannelNames = this.getAllChannelNames();
5419
- const forAnotherClient = restrictions.windowId && restrictions.windowId !== this.windowsController.my().id;
5424
+ const forAnotherClient = restrictions.windowId && restrictions.windowId !== this.interop.instance.instance;
5420
5425
  if (forAnotherClient) {
5421
5426
  return this.bridge.send("channels", operations$5.restrictAll, { restrictions }, undefined, { includeOperationCheck: true });
5422
5427
  }
@@ -6807,7 +6812,7 @@ class UIController {
6807
6812
  async invokeWidgetFactory(io) {
6808
6813
  const timeout = this.config?.widget?.timeout || defaultWidgetTimeout;
6809
6814
  await this.ioc.eventsDispatcher.widgetReady(timeout);
6810
- const config = deepmerge$1({ ...this.resources?.widget?.config, enable: true }, this.config?.widget || {});
6815
+ const config = deepmerge$1({ ...this.resources?.widget?.config, enable: this.displayWidget }, this.config?.widget || {});
6811
6816
  this.logger.trace(`IOBrowserWidget factory is available. Invoking it with config: ${JSON.stringify(config)}`);
6812
6817
  await window.IOBrowserWidget(io, config);
6813
6818
  }
@@ -7012,7 +7017,7 @@ class IoC {
7012
7017
  }
7013
7018
  }
7014
7019
 
7015
- var version$1 = "3.5.1";
7020
+ var version$1 = "3.5.3";
7016
7021
 
7017
7022
  const createFactoryFunction = (coreFactoryFunction) => {
7018
7023
  let cachedApiPromise;
@@ -9999,7 +10004,7 @@ const ContextMessageReplaySpec = {
9999
10004
  }
10000
10005
  };
10001
10006
 
10002
- var version = "6.5.0";
10007
+ var version = "6.5.1";
10003
10008
 
10004
10009
  function prepareConfig (configuration, ext, glue42gd) {
10005
10010
  let nodeStartingContext;
@@ -15285,18 +15290,27 @@ const IOConnectCoreFactory = (userConfig, ext) => {
15285
15290
  if (_allowTrace) {
15286
15291
  _logger.trace(`registering ${name} module`);
15287
15292
  }
15288
- const done = () => {
15293
+ const done = (e) => {
15289
15294
  inner.initTime = t.stop();
15290
15295
  inner.initEndTime = t.endTime;
15291
15296
  inner.marks = t.marks;
15292
- if (_allowTrace) {
15293
- _logger.trace(`${name} is ready - ${t.endTime - t.startTime}`);
15297
+ if (!_allowTrace) {
15298
+ return;
15294
15299
  }
15300
+ const traceMessage = e ?
15301
+ `${name} failed - ${e.message}` :
15302
+ `${name} is ready - ${t.endTime - t.startTime}`;
15303
+ _logger.trace(traceMessage);
15295
15304
  };
15296
15305
  inner.initStartTime = t.startTime;
15297
15306
  if (inner.ready) {
15298
- inner.ready().then(() => {
15307
+ inner.ready()
15308
+ .then(() => {
15299
15309
  done();
15310
+ })
15311
+ .catch((e) => {
15312
+ const error = typeof e === "string" ? new Error(e) : e;
15313
+ done(error);
15300
15314
  });
15301
15315
  }
15302
15316
  else {
@@ -15585,6 +15599,26 @@ if (typeof window !== "undefined") {
15585
15599
  IOConnectCoreFactory.version = version;
15586
15600
  IOConnectCoreFactory.default = IOConnectCoreFactory;
15587
15601
 
15602
+ const setupGlobalSystem = () => {
15603
+ return {
15604
+ getContainerInfo: async () => {
15605
+ if (window === window.parent) {
15606
+ return;
15607
+ }
15608
+ if (window.name.includes("#wsp")) {
15609
+ return {
15610
+ workspaceFrame: {
15611
+ id: "N/A"
15612
+ }
15613
+ };
15614
+ }
15615
+ return window.parent === window.top ?
15616
+ { top: {} } :
15617
+ { parent: {} };
15618
+ }
15619
+ };
15620
+ };
15621
+
15588
15622
  const iOConnectBrowserFactory = createFactoryFunction(IOConnectCoreFactory);
15589
15623
  if (typeof window !== "undefined") {
15590
15624
  const windowAny = window;
@@ -15597,6 +15631,9 @@ const ioGlobal = window.iodesktop || window.iobrowser;
15597
15631
  if (!legacyGlobal && !ioGlobal) {
15598
15632
  window.iobrowser = { webStarted: false };
15599
15633
  }
15634
+ if (!window.iobrowser.system) {
15635
+ window.iobrowser.system = setupGlobalSystem();
15636
+ }
15600
15637
  iOConnectBrowserFactory.version = version$1;
15601
15638
 
15602
15639
  export { iOConnectBrowserFactory as default };