@interopio/browser 3.1.0 → 3.1.2

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 { WindowOnChannelInfo, WindowWithChannelFilter } from "./src/channels/protocol";
10
9
 
11
10
  /**
12
11
  * Factory function that creates a new ioconnect instance.
@@ -858,9 +857,10 @@ export namespace IOConnectBrowser {
858
857
  /**
859
858
  * Joins a new channel by name. Leaves the current channel.
860
859
  * @param name The name of the channel to join.
860
+ * @param windowId ID of a window which to join to a Channel. If not provided, will join the current window to the specified Channel.
861
861
  * @returns Promise that resolves when the channel has been joined.
862
862
  */
863
- join(name: string): Promise<void>;
863
+ join(name: string, windowId?: string): Promise<void>;
864
864
 
865
865
  /**
866
866
  * Leaves the current channel.
@@ -936,6 +936,31 @@ export namespace IOConnectBrowser {
936
936
  /** Channel data. */
937
937
  data: any;
938
938
  }
939
+
940
+ /**
941
+ * Filter for retrieving windows that can use Channels.
942
+ */
943
+ export interface WindowWithChannelFilter {
944
+ /** Name of the app whose window instances to retrieve. */
945
+ application?: string;
946
+ /** List of Channel names. Only the windows that are joined to one of the specified Channels will be retrieved. */
947
+ channels?: string[];
948
+ /** IDs of windows to retrieve. */
949
+ windowIds?: string[];
950
+ }
951
+
952
+ /**
953
+ * Describes a window that can use Channels.
954
+ */
955
+ export interface WindowOnChannelInfo {
956
+ /** Name of the app to which the window instance belongs. */
957
+ application: string;
958
+ /** Name of the Channel to which the window is joined. */
959
+ channel: string | undefined;
960
+ /** Describes the window instance. */
961
+ window: IOConnectBrowser.Windows.WebWindow
962
+ }
963
+
939
964
  }
940
965
 
941
966
  /**
@@ -1254,8 +1279,8 @@ export namespace IOConnectBrowser {
1254
1279
  intents?: Intent[];
1255
1280
  }
1256
1281
 
1257
- /** App Image holder */
1258
- interface ImageV1 {
1282
+ /** App Image holder */
1283
+ interface ImageV1 {
1259
1284
  /**
1260
1285
  * App Image URL.
1261
1286
  */
@@ -1417,7 +1442,7 @@ export namespace IOConnectBrowser {
1417
1442
  size?: string;
1418
1443
  type?: string;
1419
1444
  }
1420
-
1445
+
1421
1446
  interface ImageV2 {
1422
1447
  src: string;
1423
1448
  size?: string;
@@ -1431,19 +1456,19 @@ export namespace IOConnectBrowser {
1431
1456
  listensFor?: { [intentName: string]: IntentV2 };
1432
1457
  raises?: { [intentName: string]: string[] };
1433
1458
  }
1434
-
1459
+
1435
1460
  interface InteropUserChannelV2 {
1436
1461
  broadcasts?: string[];
1437
1462
  listensFor?: string[];
1438
1463
  }
1439
-
1464
+
1440
1465
  interface InteropAppChannelV2 {
1441
1466
  name: string;
1442
1467
  description?: string;
1443
1468
  broadcasts?: string[];
1444
1469
  listensFor?: string[];
1445
1470
  }
1446
-
1471
+
1447
1472
  interface InteropV2 {
1448
1473
  intents?: InteropIntentsV2;
1449
1474
  userChannels?: InteropUserChannelV2;
@@ -1620,10 +1645,10 @@ export namespace IOConnectBrowser {
1620
1645
  * The handler callback will be invoked whenever an intent is raised and your app was selected as an IntentTarget.
1621
1646
  * You can also use this method to register new dynamic intents, that will have the the same lifespan as your application instance.
1622
1647
  * @param intent The intent to be handled. The intent name of an object containing the intent, contextTypes that the intent can handle and a display name.
1623
- * @param handler The callback that will handle a raised intent. Will be called with an IntentContext if it is provided by the raising application.
1648
+ * @param handler The callback that will handle a raised intent. Will be called with an IntentContext if it is provided by the raising application and caller - the Interop Instance which raised the intent.
1624
1649
  * @returns Promise that resolves to an object with an unsubscribe function under the unsubscribe property.
1625
1650
  */
1626
- register(intent: string | AddIntentListenerRequest, handler: (context: IntentContext) => any): Promise<{ unsubscribe: UnsubscribeFunction }>;
1651
+ register(intent: string | AddIntentListenerRequest, handler: (context: IntentContext, caller?: IOConnectCore.Interop.Instance) => any): Promise<{ unsubscribe: UnsubscribeFunction }>;
1627
1652
 
1628
1653
  /**
1629
1654
  * Searches for registered intents.
package/changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ 3.1.2
2
+ feat: caller interop instance is now passed to the intent handler
3
+ fix: added missing optional arg to channels.join
4
+ fix: fixed an issue caused by the d.ts importing types from src
5
+ 3.1.1
6
+ chore: bump due to utils update
1
7
  3.1.0
2
8
  fix: Update application title to be optional in intent handler interface
3
9
  feat: Added the option to configure the iframe sandboxing
@@ -1946,7 +1946,7 @@ class FDC3Service {
1946
1946
  mergeBaseAppDataWithGlueManifest(baseAppData, hostManifestDefinition) {
1947
1947
  let baseApplicationDefinition = baseAppData;
1948
1948
  if (hostManifestDefinition.details) {
1949
- const details = hostManifestDefinition.details;
1949
+ const details = Object.assign(Object.assign({}, baseAppData.createOptions), hostManifestDefinition.details);
1950
1950
  baseApplicationDefinition.createOptions = details;
1951
1951
  baseApplicationDefinition.userProperties.details = details;
1952
1952
  }
@@ -1959,8 +1959,7 @@ class FDC3Service {
1959
1959
  return baseApplicationDefinition;
1960
1960
  }
1961
1961
  mergeDesktopConfigWithGlueManifest(config, desktopDefinition) {
1962
- let appConfig = Object.assign({}, config);
1963
- appConfig = Object.assign(Object.assign({}, config), desktopDefinition);
1962
+ const appConfig = Object.assign({}, config, desktopDefinition, { details: Object.assign(Object.assign({}, config.details), desktopDefinition.details) });
1964
1963
  if (Array.isArray(desktopDefinition.intents)) {
1965
1964
  appConfig.intents = (config.intents || []).concat(desktopDefinition.intents);
1966
1965
  }
@@ -4774,7 +4773,8 @@ class IntentsController {
4774
4773
  }
4775
4774
  registerPromise = this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
4776
4775
  if (this.myIntents.has(intentName)) {
4777
- return handler(args);
4776
+ const rest = __rest$2(args, ["_initialCallerId"]);
4777
+ return handler(rest);
4778
4778
  }
4779
4779
  });
4780
4780
  registerPromise.catch(err => {
@@ -4805,7 +4805,9 @@ class IntentsController {
4805
4805
  try {
4806
4806
  yield this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
4807
4807
  if (this.myIntents.has(intentName)) {
4808
- return handler(args);
4808
+ const { _initialCallerId } = args, rest = __rest$2(args, ["_initialCallerId"]);
4809
+ const caller = this.interop.servers().find((server) => server.instance === _initialCallerId);
4810
+ return handler(rest, caller);
4809
4811
  }
4810
4812
  });
4811
4813
  }
@@ -6116,7 +6118,7 @@ class IoC {
6116
6118
  }
6117
6119
  }
6118
6120
 
6119
- var version$2 = "3.1.0";
6121
+ var version$2 = "3.1.2";
6120
6122
 
6121
6123
  const createFactoryFunction = (coreFactoryFunction) => {
6122
6124
  return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {