@interopio/fdc3 2.4.1 → 2.4.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/changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ 2.4.2
2
+ fix: fdc3.raiseIntent with target { appId } starts a new instance
3
+ fix: context passed to io.intents.raise
4
+ chore: Add fdc3Info to window object
1
5
  2.4.1
2
6
  fix: fixed initialization delay when running in a io.cd clients outside of io.cd
3
7
  chore: improvement to getOrCreateChannel to be more compliant with the standard
@@ -894,7 +894,7 @@ const v2InteropDecoder = object$1({
894
894
  appChannels: optional$1(array$1(v2AppChannelDecoder))
895
895
  });
896
896
  const glue42ApplicationDetailsDecoder = object$1({
897
- url: nonEmptyStringDecoder$1,
897
+ url: optional$1(nonEmptyStringDecoder$1),
898
898
  top: optional$1(number$1()),
899
899
  left: optional$1(number$1()),
900
900
  width: optional$1(nonNegativeNumberDecoder),
@@ -912,10 +912,6 @@ const glue42HostManifestsBrowserDecoder = object$1({
912
912
  intents: optional$1(array$1(intentDefinitionDecoder)),
913
913
  hidden: optional$1(boolean())
914
914
  });
915
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
916
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
917
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
918
- }), anyJson$1());
919
915
  const v1DefinitionDecoder = object$1({
920
916
  name: nonEmptyStringDecoder$1,
921
917
  appId: nonEmptyStringDecoder$1,
@@ -950,7 +946,7 @@ const v2LocalizedDefinitionDecoder = object$1({
950
946
  moreInfo: optional$1(nonEmptyStringDecoder$1),
951
947
  publisher: optional$1(nonEmptyStringDecoder$1),
952
948
  customConfig: optional$1(array$1(anyJson$1())),
953
- hostManifests: optional$1(hostManifestsBrowserDecoder),
949
+ hostManifests: optional$1(anyJson$1()),
954
950
  interop: optional$1(v2InteropDecoder)
955
951
  });
956
952
  const v2DefinitionDecoder = object$1({
@@ -971,7 +967,7 @@ const v2DefinitionDecoder = object$1({
971
967
  moreInfo: optional$1(nonEmptyStringDecoder$1),
972
968
  publisher: optional$1(nonEmptyStringDecoder$1),
973
969
  customConfig: optional$1(array$1(anyJson$1())),
974
- hostManifests: optional$1(hostManifestsBrowserDecoder),
970
+ hostManifests: optional$1(anyJson$1()),
975
971
  interop: optional$1(v2InteropDecoder),
976
972
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
977
973
  });
@@ -3020,24 +3016,24 @@ class IntentsController {
3020
3016
  if (!searchedGlueIntent) {
3021
3017
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3022
3018
  }
3023
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3024
3019
  if (!target) {
3020
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3025
3021
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3026
3022
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3027
3023
  }
3028
- if (typeof target === "string" || !target.instanceId) {
3029
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3024
+ if (target?.instanceId) {
3025
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3030
3026
  return this.invokeRaiseIntent(commandId, {
3031
3027
  intent,
3032
3028
  context: glueContext,
3033
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3029
+ target: { instance: target.instanceId }
3034
3030
  });
3035
3031
  }
3036
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3032
+ const targetAppName = typeof target === "string" ? target : target.appId;
3037
3033
  return this.invokeRaiseIntent(commandId, {
3038
3034
  intent,
3039
3035
  context: glueContext,
3040
- target: { instance: target.instanceId }
3036
+ target: { app: targetAppName }
3041
3037
  });
3042
3038
  }
3043
3039
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3046,8 +3042,9 @@ class IntentsController {
3046
3042
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3047
3043
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3048
3044
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3045
+ const glueContext = { type: context.type, data: { ...context } };
3049
3046
  if (rememberedIntentHandlerForContextType) {
3050
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3047
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3051
3048
  }
3052
3049
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3053
3050
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3072,7 +3069,11 @@ class IntentsController {
3072
3069
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3073
3070
  throw new Error(ResolveError.IntentDeliveryFailed);
3074
3071
  }
3075
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3072
+ return this.invokeRaiseIntent(commandId, {
3073
+ intent: validIntent.intent,
3074
+ context: glueContext,
3075
+ target: { app: handler.applicationName, instance: handler.instanceId }
3076
+ });
3076
3077
  }
3077
3078
  async addIntentListener({ commandId, intent, handler }) {
3078
3079
  await this.glueController.gluePromise;
@@ -3303,8 +3304,6 @@ class IntentsController {
3303
3304
  }
3304
3305
  }
3305
3306
 
3306
- var version = "2.4.1";
3307
-
3308
3307
  class ApplicationsController {
3309
3308
  glueController;
3310
3309
  appsStateStore;
@@ -3379,10 +3378,11 @@ class ApplicationsController {
3379
3378
  await this.glueController.gluePromise;
3380
3379
  this.logger?.info(`${commandId} - getInfo() invoked`);
3381
3380
  const appMetadata = await this.getCurrentAppMetadata();
3381
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3382
3382
  return {
3383
- provider: "io.Connect",
3384
- providerVersion: version,
3385
- fdc3Version: "2.1",
3383
+ provider,
3384
+ providerVersion,
3385
+ fdc3Version: standardVersion,
3386
3386
  optionalFeatures: {
3387
3387
  OriginatingAppMetadata: true,
3388
3388
  UserChannelMembershipAPIs: true,
@@ -4690,7 +4690,14 @@ const fdc3Factory = () => {
4690
4690
  return ioc.fdc3;
4691
4691
  };
4692
4692
 
4693
+ var version = "2.4.2";
4694
+
4693
4695
  let globalFdc3 = window.fdc3;
4696
+ window.fdc3Info = {
4697
+ provider: "io.Connect",
4698
+ providerVersion: version,
4699
+ standardVersion: "2.1"
4700
+ };
4694
4701
  if (typeof globalFdc3 === "undefined") {
4695
4702
  globalFdc3 = fdc3Factory();
4696
4703
  checkIfInElectron(globalFdc3);
@@ -900,7 +900,7 @@
900
900
  appChannels: optional$1(array$1(v2AppChannelDecoder))
901
901
  });
902
902
  const glue42ApplicationDetailsDecoder = object$1({
903
- url: nonEmptyStringDecoder$1,
903
+ url: optional$1(nonEmptyStringDecoder$1),
904
904
  top: optional$1(number$1()),
905
905
  left: optional$1(number$1()),
906
906
  width: optional$1(nonNegativeNumberDecoder),
@@ -918,10 +918,6 @@
918
918
  intents: optional$1(array$1(intentDefinitionDecoder)),
919
919
  hidden: optional$1(boolean())
920
920
  });
921
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
922
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
923
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
924
- }), anyJson$1());
925
921
  const v1DefinitionDecoder = object$1({
926
922
  name: nonEmptyStringDecoder$1,
927
923
  appId: nonEmptyStringDecoder$1,
@@ -956,7 +952,7 @@
956
952
  moreInfo: optional$1(nonEmptyStringDecoder$1),
957
953
  publisher: optional$1(nonEmptyStringDecoder$1),
958
954
  customConfig: optional$1(array$1(anyJson$1())),
959
- hostManifests: optional$1(hostManifestsBrowserDecoder),
955
+ hostManifests: optional$1(anyJson$1()),
960
956
  interop: optional$1(v2InteropDecoder)
961
957
  });
962
958
  const v2DefinitionDecoder = object$1({
@@ -977,7 +973,7 @@
977
973
  moreInfo: optional$1(nonEmptyStringDecoder$1),
978
974
  publisher: optional$1(nonEmptyStringDecoder$1),
979
975
  customConfig: optional$1(array$1(anyJson$1())),
980
- hostManifests: optional$1(hostManifestsBrowserDecoder),
976
+ hostManifests: optional$1(anyJson$1()),
981
977
  interop: optional$1(v2InteropDecoder),
982
978
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
983
979
  });
@@ -3026,24 +3022,24 @@
3026
3022
  if (!searchedGlueIntent) {
3027
3023
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3028
3024
  }
3029
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3030
3025
  if (!target) {
3026
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3031
3027
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3032
3028
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3033
3029
  }
3034
- if (typeof target === "string" || !target.instanceId) {
3035
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3030
+ if (target?.instanceId) {
3031
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3036
3032
  return this.invokeRaiseIntent(commandId, {
3037
3033
  intent,
3038
3034
  context: glueContext,
3039
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3035
+ target: { instance: target.instanceId }
3040
3036
  });
3041
3037
  }
3042
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3038
+ const targetAppName = typeof target === "string" ? target : target.appId;
3043
3039
  return this.invokeRaiseIntent(commandId, {
3044
3040
  intent,
3045
3041
  context: glueContext,
3046
- target: { instance: target.instanceId }
3042
+ target: { app: targetAppName }
3047
3043
  });
3048
3044
  }
3049
3045
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3052,8 +3048,9 @@
3052
3048
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3053
3049
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3054
3050
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3051
+ const glueContext = { type: context.type, data: { ...context } };
3055
3052
  if (rememberedIntentHandlerForContextType) {
3056
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3053
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3057
3054
  }
3058
3055
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3059
3056
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3078,7 +3075,11 @@
3078
3075
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3079
3076
  throw new Error(ResolveError.IntentDeliveryFailed);
3080
3077
  }
3081
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3078
+ return this.invokeRaiseIntent(commandId, {
3079
+ intent: validIntent.intent,
3080
+ context: glueContext,
3081
+ target: { app: handler.applicationName, instance: handler.instanceId }
3082
+ });
3082
3083
  }
3083
3084
  async addIntentListener({ commandId, intent, handler }) {
3084
3085
  await this.glueController.gluePromise;
@@ -3309,8 +3310,6 @@
3309
3310
  }
3310
3311
  }
3311
3312
 
3312
- var version = "2.4.1";
3313
-
3314
3313
  class ApplicationsController {
3315
3314
  glueController;
3316
3315
  appsStateStore;
@@ -3385,10 +3384,11 @@
3385
3384
  await this.glueController.gluePromise;
3386
3385
  this.logger?.info(`${commandId} - getInfo() invoked`);
3387
3386
  const appMetadata = await this.getCurrentAppMetadata();
3387
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3388
3388
  return {
3389
- provider: "io.Connect",
3390
- providerVersion: version,
3391
- fdc3Version: "2.1",
3389
+ provider,
3390
+ providerVersion,
3391
+ fdc3Version: standardVersion,
3392
3392
  optionalFeatures: {
3393
3393
  OriginatingAppMetadata: true,
3394
3394
  UserChannelMembershipAPIs: true,
@@ -4696,7 +4696,14 @@
4696
4696
  return ioc.fdc3;
4697
4697
  };
4698
4698
 
4699
+ var version = "2.4.2";
4700
+
4699
4701
  let globalFdc3 = window.fdc3;
4702
+ window.fdc3Info = {
4703
+ provider: "io.Connect",
4704
+ providerVersion: version,
4705
+ standardVersion: "2.1"
4706
+ };
4700
4707
  if (typeof globalFdc3 === "undefined") {
4701
4708
  globalFdc3 = fdc3Factory();
4702
4709
  checkIfInElectron(globalFdc3);
package/dist/fdc3.es.js CHANGED
@@ -883,7 +883,7 @@ const v2InteropDecoder = object$1({
883
883
  appChannels: optional$1(array$1(v2AppChannelDecoder))
884
884
  });
885
885
  const glue42ApplicationDetailsDecoder = object$1({
886
- url: nonEmptyStringDecoder$1,
886
+ url: optional$1(nonEmptyStringDecoder$1),
887
887
  top: optional$1(number$1()),
888
888
  left: optional$1(number$1()),
889
889
  width: optional$1(nonNegativeNumberDecoder),
@@ -901,10 +901,6 @@ const glue42HostManifestsBrowserDecoder = object$1({
901
901
  intents: optional$1(array$1(intentDefinitionDecoder)),
902
902
  hidden: optional$1(boolean())
903
903
  });
904
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
905
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
906
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
907
- }), anyJson$1());
908
904
  const v1DefinitionDecoder = object$1({
909
905
  name: nonEmptyStringDecoder$1,
910
906
  appId: nonEmptyStringDecoder$1,
@@ -939,7 +935,7 @@ const v2LocalizedDefinitionDecoder = object$1({
939
935
  moreInfo: optional$1(nonEmptyStringDecoder$1),
940
936
  publisher: optional$1(nonEmptyStringDecoder$1),
941
937
  customConfig: optional$1(array$1(anyJson$1())),
942
- hostManifests: optional$1(hostManifestsBrowserDecoder),
938
+ hostManifests: optional$1(anyJson$1()),
943
939
  interop: optional$1(v2InteropDecoder)
944
940
  });
945
941
  const v2DefinitionDecoder = object$1({
@@ -960,7 +956,7 @@ const v2DefinitionDecoder = object$1({
960
956
  moreInfo: optional$1(nonEmptyStringDecoder$1),
961
957
  publisher: optional$1(nonEmptyStringDecoder$1),
962
958
  customConfig: optional$1(array$1(anyJson$1())),
963
- hostManifests: optional$1(hostManifestsBrowserDecoder),
959
+ hostManifests: optional$1(anyJson$1()),
964
960
  interop: optional$1(v2InteropDecoder),
965
961
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
966
962
  });
@@ -3009,24 +3005,24 @@ class IntentsController {
3009
3005
  if (!searchedGlueIntent) {
3010
3006
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3011
3007
  }
3012
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3013
3008
  if (!target) {
3009
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3014
3010
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3015
3011
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3016
3012
  }
3017
- if (typeof target === "string" || !target.instanceId) {
3018
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3013
+ if (target?.instanceId) {
3014
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3019
3015
  return this.invokeRaiseIntent(commandId, {
3020
3016
  intent,
3021
3017
  context: glueContext,
3022
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3018
+ target: { instance: target.instanceId }
3023
3019
  });
3024
3020
  }
3025
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3021
+ const targetAppName = typeof target === "string" ? target : target.appId;
3026
3022
  return this.invokeRaiseIntent(commandId, {
3027
3023
  intent,
3028
3024
  context: glueContext,
3029
- target: { instance: target.instanceId }
3025
+ target: { app: targetAppName }
3030
3026
  });
3031
3027
  }
3032
3028
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3035,8 +3031,9 @@ class IntentsController {
3035
3031
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3036
3032
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3037
3033
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3034
+ const glueContext = { type: context.type, data: { ...context } };
3038
3035
  if (rememberedIntentHandlerForContextType) {
3039
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3036
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3040
3037
  }
3041
3038
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3042
3039
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3061,7 +3058,11 @@ class IntentsController {
3061
3058
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3062
3059
  throw new Error(ResolveError.IntentDeliveryFailed);
3063
3060
  }
3064
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3061
+ return this.invokeRaiseIntent(commandId, {
3062
+ intent: validIntent.intent,
3063
+ context: glueContext,
3064
+ target: { app: handler.applicationName, instance: handler.instanceId }
3065
+ });
3065
3066
  }
3066
3067
  async addIntentListener({ commandId, intent, handler }) {
3067
3068
  await this.glueController.gluePromise;
@@ -3292,8 +3293,6 @@ class IntentsController {
3292
3293
  }
3293
3294
  }
3294
3295
 
3295
- var version = "2.4.1";
3296
-
3297
3296
  class ApplicationsController {
3298
3297
  glueController;
3299
3298
  appsStateStore;
@@ -3368,10 +3367,11 @@ class ApplicationsController {
3368
3367
  await this.glueController.gluePromise;
3369
3368
  this.logger?.info(`${commandId} - getInfo() invoked`);
3370
3369
  const appMetadata = await this.getCurrentAppMetadata();
3370
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3371
3371
  return {
3372
- provider: "io.Connect",
3373
- providerVersion: version,
3374
- fdc3Version: "2.1",
3372
+ provider,
3373
+ providerVersion,
3374
+ fdc3Version: standardVersion,
3375
3375
  optionalFeatures: {
3376
3376
  OriginatingAppMetadata: true,
3377
3377
  UserChannelMembershipAPIs: true,
@@ -4679,7 +4679,14 @@ const fdc3Factory = () => {
4679
4679
  return ioc.fdc3;
4680
4680
  };
4681
4681
 
4682
+ var version = "2.4.2";
4683
+
4682
4684
  let globalFdc3 = window.fdc3;
4685
+ window.fdc3Info = {
4686
+ provider: "io.Connect",
4687
+ providerVersion: version,
4688
+ standardVersion: "2.1"
4689
+ };
4683
4690
  if (typeof globalFdc3 === "undefined") {
4684
4691
  globalFdc3 = fdc3Factory();
4685
4692
  window.fdc3 = globalFdc3;
package/dist/fdc3.umd.js CHANGED
@@ -889,7 +889,7 @@
889
889
  appChannels: optional$1(array$1(v2AppChannelDecoder))
890
890
  });
891
891
  const glue42ApplicationDetailsDecoder = object$1({
892
- url: nonEmptyStringDecoder$1,
892
+ url: optional$1(nonEmptyStringDecoder$1),
893
893
  top: optional$1(number$1()),
894
894
  left: optional$1(number$1()),
895
895
  width: optional$1(nonNegativeNumberDecoder),
@@ -907,10 +907,6 @@
907
907
  intents: optional$1(array$1(intentDefinitionDecoder)),
908
908
  hidden: optional$1(boolean())
909
909
  });
910
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
911
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
912
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
913
- }), anyJson$1());
914
910
  const v1DefinitionDecoder = object$1({
915
911
  name: nonEmptyStringDecoder$1,
916
912
  appId: nonEmptyStringDecoder$1,
@@ -945,7 +941,7 @@
945
941
  moreInfo: optional$1(nonEmptyStringDecoder$1),
946
942
  publisher: optional$1(nonEmptyStringDecoder$1),
947
943
  customConfig: optional$1(array$1(anyJson$1())),
948
- hostManifests: optional$1(hostManifestsBrowserDecoder),
944
+ hostManifests: optional$1(anyJson$1()),
949
945
  interop: optional$1(v2InteropDecoder)
950
946
  });
951
947
  const v2DefinitionDecoder = object$1({
@@ -966,7 +962,7 @@
966
962
  moreInfo: optional$1(nonEmptyStringDecoder$1),
967
963
  publisher: optional$1(nonEmptyStringDecoder$1),
968
964
  customConfig: optional$1(array$1(anyJson$1())),
969
- hostManifests: optional$1(hostManifestsBrowserDecoder),
965
+ hostManifests: optional$1(anyJson$1()),
970
966
  interop: optional$1(v2InteropDecoder),
971
967
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
972
968
  });
@@ -3015,24 +3011,24 @@
3015
3011
  if (!searchedGlueIntent) {
3016
3012
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3017
3013
  }
3018
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3019
3014
  if (!target) {
3015
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3020
3016
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3021
3017
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3022
3018
  }
3023
- if (typeof target === "string" || !target.instanceId) {
3024
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3019
+ if (target?.instanceId) {
3020
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3025
3021
  return this.invokeRaiseIntent(commandId, {
3026
3022
  intent,
3027
3023
  context: glueContext,
3028
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3024
+ target: { instance: target.instanceId }
3029
3025
  });
3030
3026
  }
3031
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3027
+ const targetAppName = typeof target === "string" ? target : target.appId;
3032
3028
  return this.invokeRaiseIntent(commandId, {
3033
3029
  intent,
3034
3030
  context: glueContext,
3035
- target: { instance: target.instanceId }
3031
+ target: { app: targetAppName }
3036
3032
  });
3037
3033
  }
3038
3034
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3041,8 +3037,9 @@
3041
3037
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3042
3038
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3043
3039
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3040
+ const glueContext = { type: context.type, data: { ...context } };
3044
3041
  if (rememberedIntentHandlerForContextType) {
3045
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3042
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3046
3043
  }
3047
3044
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3048
3045
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3067,7 +3064,11 @@
3067
3064
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3068
3065
  throw new Error(ResolveError.IntentDeliveryFailed);
3069
3066
  }
3070
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3067
+ return this.invokeRaiseIntent(commandId, {
3068
+ intent: validIntent.intent,
3069
+ context: glueContext,
3070
+ target: { app: handler.applicationName, instance: handler.instanceId }
3071
+ });
3071
3072
  }
3072
3073
  async addIntentListener({ commandId, intent, handler }) {
3073
3074
  await this.glueController.gluePromise;
@@ -3298,8 +3299,6 @@
3298
3299
  }
3299
3300
  }
3300
3301
 
3301
- var version = "2.4.1";
3302
-
3303
3302
  class ApplicationsController {
3304
3303
  glueController;
3305
3304
  appsStateStore;
@@ -3374,10 +3373,11 @@
3374
3373
  await this.glueController.gluePromise;
3375
3374
  this.logger?.info(`${commandId} - getInfo() invoked`);
3376
3375
  const appMetadata = await this.getCurrentAppMetadata();
3376
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3377
3377
  return {
3378
- provider: "io.Connect",
3379
- providerVersion: version,
3380
- fdc3Version: "2.1",
3378
+ provider,
3379
+ providerVersion,
3380
+ fdc3Version: standardVersion,
3381
3381
  optionalFeatures: {
3382
3382
  OriginatingAppMetadata: true,
3383
3383
  UserChannelMembershipAPIs: true,
@@ -4685,7 +4685,14 @@
4685
4685
  return ioc.fdc3;
4686
4686
  };
4687
4687
 
4688
+ var version = "2.4.2";
4689
+
4688
4690
  let globalFdc3 = window.fdc3;
4691
+ window.fdc3Info = {
4692
+ provider: "io.Connect",
4693
+ providerVersion: version,
4694
+ standardVersion: "2.1"
4695
+ };
4689
4696
  if (typeof globalFdc3 === "undefined") {
4690
4697
  globalFdc3 = fdc3Factory();
4691
4698
  window.fdc3 = globalFdc3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interopio/fdc3",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "IO Connect implementation of the FDC3 standard",
5
5
  "main": "dist/fdc3.umd.js",
6
6
  "module": "dist/fdc3.es.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "license": "MIT",
34
34
  "devDependencies": {
35
- "@interopio/utils": "^1.4.0"
35
+ "@interopio/utils": "^1.4.1"
36
36
  },
37
37
  "dependencies": {
38
38
  "@finos/fdc3": "2.1.0"
@@ -41,5 +41,5 @@
41
41
  "@interopio:registry": "https://registry.npmjs.org",
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "fcada3f27f1e123cbcd1da9bb1195346f7fe1896"
44
+ "gitHead": "b190408346eec7b2eae403cee6ea92e8d71599e9"
45
45
  }