@openfin/core 41.102.8 → 41.103.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.
@@ -4572,7 +4572,22 @@ declare type DomainSettings = {
4572
4572
  };
4573
4573
 
4574
4574
  /**
4575
- * Map of preload scripts that can enable new scripts or disable options defined preloadScripts.
4575
+ * Enables or disables specific preload scripts by URL.
4576
+ *
4577
+ * Uses the script's full URL as the key and an object
4578
+ * with an `enabled` boolean property as the value.
4579
+ * @example
4580
+ * ```js
4581
+ * {
4582
+ "match": ["<all_urls>"],
4583
+ "options": {
4584
+ "preloadScripts": {
4585
+ "http://localhost:53000/block-preload.js": { "enabled": false }
4586
+ "http://localhost:53000/allow-preload.js": { "enabled": true }
4587
+ }
4588
+ }
4589
+ }
4590
+ * ```
4576
4591
  */
4577
4592
  declare type DomainSettingsPreloadScripts = Record<string, {
4578
4593
  enabled: boolean;
@@ -4572,7 +4572,22 @@ declare type DomainSettings = {
4572
4572
  };
4573
4573
 
4574
4574
  /**
4575
- * Map of preload scripts that can enable new scripts or disable options defined preloadScripts.
4575
+ * Enables or disables specific preload scripts by URL.
4576
+ *
4577
+ * Uses the script's full URL as the key and an object
4578
+ * with an `enabled` boolean property as the value.
4579
+ * @example
4580
+ * ```js
4581
+ * {
4582
+ "match": ["<all_urls>"],
4583
+ "options": {
4584
+ "preloadScripts": {
4585
+ "http://localhost:53000/block-preload.js": { "enabled": false }
4586
+ "http://localhost:53000/allow-preload.js": { "enabled": true }
4587
+ }
4588
+ }
4589
+ }
4590
+ * ```
4576
4591
  */
4577
4592
  declare type DomainSettingsPreloadScripts = Record<string, {
4578
4593
  enabled: boolean;
@@ -4572,7 +4572,22 @@ declare type DomainSettings = {
4572
4572
  };
4573
4573
 
4574
4574
  /**
4575
- * Map of preload scripts that can enable new scripts or disable options defined preloadScripts.
4575
+ * Enables or disables specific preload scripts by URL.
4576
+ *
4577
+ * Uses the script's full URL as the key and an object
4578
+ * with an `enabled` boolean property as the value.
4579
+ * @example
4580
+ * ```js
4581
+ * {
4582
+ "match": ["<all_urls>"],
4583
+ "options": {
4584
+ "preloadScripts": {
4585
+ "http://localhost:53000/block-preload.js": { "enabled": false }
4586
+ "http://localhost:53000/allow-preload.js": { "enabled": true }
4587
+ }
4588
+ }
4589
+ }
4590
+ * ```
4576
4591
  */
4577
4592
  declare type DomainSettingsPreloadScripts = Record<string, {
4578
4593
  enabled: boolean;
package/out/stub.d.ts CHANGED
@@ -4631,7 +4631,22 @@ declare type DomainSettings = {
4631
4631
  };
4632
4632
 
4633
4633
  /**
4634
- * Map of preload scripts that can enable new scripts or disable options defined preloadScripts.
4634
+ * Enables or disables specific preload scripts by URL.
4635
+ *
4636
+ * Uses the script's full URL as the key and an object
4637
+ * with an `enabled` boolean property as the value.
4638
+ * @example
4639
+ * ```js
4640
+ * {
4641
+ "match": ["<all_urls>"],
4642
+ "options": {
4643
+ "preloadScripts": {
4644
+ "http://localhost:53000/block-preload.js": { "enabled": false }
4645
+ "http://localhost:53000/allow-preload.js": { "enabled": true }
4646
+ }
4647
+ }
4648
+ }
4649
+ * ```
4635
4650
  */
4636
4651
  declare type DomainSettingsPreloadScripts = Record<string, {
4637
4652
  enabled: boolean;
package/out/stub.js CHANGED
@@ -9025,7 +9025,7 @@ var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateF
9025
9025
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9026
9026
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9027
9027
  };
9028
- var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
9028
+ var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
9029
9029
  return (mod && mod.__esModule) ? mod : { "default": mod };
9030
9030
  };
9031
9031
  var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
@@ -9039,7 +9039,7 @@ const ice_manager_1 = iceManager;
9039
9039
  const provider_1$1 = provider;
9040
9040
  const message_receiver_1 = messageReceiver;
9041
9041
  const protocol_manager_1 = protocolManager;
9042
- const strategy_3 = __importDefault$5(strategy);
9042
+ const strategy_3 = __importDefault$6(strategy);
9043
9043
  class ConnectionManager extends base_1$i.Base {
9044
9044
  static getProtocolOptionsFromStrings(protocols) {
9045
9045
  return protocols.map((protocol) => {
@@ -13739,16 +13739,16 @@ var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateF
13739
13739
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13740
13740
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13741
13741
  };
13742
- var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
13742
+ var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
13743
13743
  return (mod && mod.__esModule) ? mod : { "default": mod };
13744
13744
  };
13745
13745
  var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
13746
13746
  Object.defineProperty(InteropBroker$1, "__esModule", { value: true });
13747
13747
  InteropBroker$1.InteropBroker = void 0;
13748
13748
  const base_1$5 = base;
13749
- const SessionContextGroupBroker_1 = __importDefault$4(SessionContextGroupBroker$1);
13749
+ const SessionContextGroupBroker_1 = __importDefault$5(SessionContextGroupBroker$1);
13750
13750
  const utils_1$7 = utils$3;
13751
- const isEqual_1$1 = __importDefault$4(require$$3);
13751
+ const isEqual_1$2 = __importDefault$5(require$$3);
13752
13752
  const PrivateChannelProvider_1 = PrivateChannelProvider$1;
13753
13753
  const lazy_1 = lazy;
13754
13754
  const defaultContextGroups = [
@@ -13947,7 +13947,7 @@ class InteropBroker extends base_1$5.Base {
13947
13947
  constructor(...unused) {
13948
13948
  if (unused.length) {
13949
13949
  const [_ignore1, ignore2, opts] = unused;
13950
- if (opts && typeof opts === 'object' && !(0, isEqual_1$1.default)(opts, args[2])) {
13950
+ if (opts && typeof opts === 'object' && !(0, isEqual_1$2.default)(opts, args[2])) {
13951
13951
  // eslint-disable-next-line no-console
13952
13952
  console.warn('You have modified the parameters of the InteropOverride constructor. This behavior is deprecated and will be removed in a future version. You can modify these options in your manifest. Please consult our Interop docs for guidance on migrating to the new override scheme.');
13953
13953
  super(args[0], args[1], opts);
@@ -15099,14 +15099,14 @@ var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateF
15099
15099
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
15100
15100
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15101
15101
  };
15102
- var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15102
+ var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15103
15103
  return (mod && mod.__esModule) ? mod : { "default": mod };
15104
15104
  };
15105
15105
  var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
15106
15106
  Object.defineProperty(InteropClient$1, "__esModule", { value: true });
15107
15107
  InteropClient$1.InteropClient = void 0;
15108
15108
  const base_1$3 = base;
15109
- const SessionContextGroupClient_1 = __importDefault$3(SessionContextGroupClient$1);
15109
+ const SessionContextGroupClient_1 = __importDefault$4(SessionContextGroupClient$1);
15110
15110
  const utils_1$5 = utils$3;
15111
15111
  /**
15112
15112
  * The Interop Client API is broken up into two groups:
@@ -15848,15 +15848,86 @@ class PrivateChannelClient {
15848
15848
  }
15849
15849
  PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
15850
15850
 
15851
+ var fdc3Channels2_0 = {};
15852
+
15853
+ var fdc3Channels1_2 = {};
15854
+
15855
+ var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15856
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15857
+ };
15858
+ Object.defineProperty(fdc3Channels1_2, "__esModule", { value: true });
15859
+ fdc3Channels1_2.createV1Channel = void 0;
15860
+ const isEqual_1$1 = __importDefault$3(require$$3);
15861
+ const createV1Channel = (sessionContextGroup) => {
15862
+ return {
15863
+ id: sessionContextGroup.id,
15864
+ type: 'app',
15865
+ broadcast: sessionContextGroup.setContext,
15866
+ getCurrentContext: async (contextType) => {
15867
+ const context = await sessionContextGroup.getCurrentContext(contextType);
15868
+ return context === undefined ? null : context;
15869
+ },
15870
+ // @ts-expect-error TODO [CORE-1524]
15871
+ addContextListener: (contextType, handler) => {
15872
+ let realHandler;
15873
+ let realType;
15874
+ if (typeof contextType === 'function') {
15875
+ console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
15876
+ realHandler = contextType;
15877
+ }
15878
+ else {
15879
+ realHandler = handler;
15880
+ if (typeof contextType === 'string') {
15881
+ realType = contextType;
15882
+ }
15883
+ }
15884
+ const listener = (async () => {
15885
+ let first = true;
15886
+ const currentContext = await sessionContextGroup.getCurrentContext(realType);
15887
+ const wrappedHandler = (context, contextMetadata) => {
15888
+ if (first) {
15889
+ first = false;
15890
+ if ((0, isEqual_1$1.default)(currentContext, context)) {
15891
+ return;
15892
+ }
15893
+ }
15894
+ // eslint-disable-next-line consistent-return
15895
+ return realHandler(context, contextMetadata);
15896
+ };
15897
+ return sessionContextGroup.addContextHandler(wrappedHandler, realType);
15898
+ })();
15899
+ return {
15900
+ ...listener,
15901
+ unsubscribe: () => listener.then((l) => l.unsubscribe())
15902
+ };
15903
+ }
15904
+ };
15905
+ };
15906
+ fdc3Channels1_2.createV1Channel = createV1Channel;
15907
+
15908
+ Object.defineProperty(fdc3Channels2_0, "__esModule", { value: true });
15909
+ fdc3Channels2_0.createV2Channel = void 0;
15910
+ const fdc3_channels_1_2_1$1 = fdc3Channels1_2;
15911
+ const createV2Channel = (sessionContextGroup) => {
15912
+ const channel = (0, fdc3_channels_1_2_1$1.createV1Channel)(sessionContextGroup);
15913
+ return {
15914
+ ...channel,
15915
+ // @ts-expect-error Type incompatibility on signature.
15916
+ addContextListener: async (...args) => channel.addContextListener(...args)
15917
+ };
15918
+ };
15919
+ fdc3Channels2_0.createV2Channel = createV2Channel;
15920
+
15851
15921
  (function (exports) {
15852
15922
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15853
15923
  return (mod && mod.__esModule) ? mod : { "default": mod };
15854
15924
  };
15855
15925
  Object.defineProperty(exports, "__esModule", { value: true });
15856
- exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
15926
+ exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
15857
15927
  const utils_1 = utils$3;
15858
15928
  const PrivateChannelClient_1 = PrivateChannelClient$1;
15859
- const isEqual_1 = __importDefault(require$$3);
15929
+ __importDefault(require$$3);
15930
+ const fdc3_channels_2_0_1 = fdc3Channels2_0;
15860
15931
  const getUnsupportedChannelApis = (channelType) => {
15861
15932
  return {
15862
15933
  addContextListener: () => {
@@ -15955,52 +16026,6 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
15955
16026
  };
15956
16027
  };
15957
16028
  exports.buildPrivateChannelObject = buildPrivateChannelObject;
15958
- const buildAppChannelObject = (sessionContextGroup) => {
15959
- return {
15960
- id: sessionContextGroup.id,
15961
- type: 'app',
15962
- broadcast: sessionContextGroup.setContext,
15963
- getCurrentContext: async (contextType) => {
15964
- const context = await sessionContextGroup.getCurrentContext(contextType);
15965
- return context === undefined ? null : context;
15966
- },
15967
- // @ts-expect-error TODO [CORE-1524]
15968
- addContextListener: (contextType, handler) => {
15969
- let realHandler;
15970
- let realType;
15971
- if (typeof contextType === 'function') {
15972
- console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
15973
- realHandler = contextType;
15974
- }
15975
- else {
15976
- realHandler = handler;
15977
- if (typeof contextType === 'string') {
15978
- realType = contextType;
15979
- }
15980
- }
15981
- const listener = (async () => {
15982
- let first = true;
15983
- const currentContext = await sessionContextGroup.getCurrentContext(realType);
15984
- const wrappedHandler = (context, contextMetadata) => {
15985
- if (first) {
15986
- first = false;
15987
- if ((0, isEqual_1.default)(currentContext, context)) {
15988
- return;
15989
- }
15990
- }
15991
- // eslint-disable-next-line consistent-return
15992
- return realHandler(context, contextMetadata);
15993
- };
15994
- return sessionContextGroup.addContextHandler(wrappedHandler, realType);
15995
- })();
15996
- return {
15997
- ...listener,
15998
- unsubscribe: () => listener.then((l) => l.unsubscribe())
15999
- };
16000
- }
16001
- };
16002
- };
16003
- exports.buildAppChannelObject = buildAppChannelObject;
16004
16029
  const connectPrivateChannel = async (channelId) => {
16005
16030
  try {
16006
16031
  const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
@@ -16032,6 +16057,10 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16032
16057
  // Generate an ID to make a session context group with. We will pass that ID to the Broker.
16033
16058
  // The broker will then setContext on that session context group later with our Intent Result,
16034
16059
  const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
16060
+ let isPromiseSettled = false;
16061
+ // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
16062
+ const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
16063
+ const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
16035
16064
  // Promise we'll use in getResult
16036
16065
  const getResultPromise = new Promise((resolve, reject) => {
16037
16066
  fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
@@ -16044,13 +16073,24 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16044
16073
  reject(new Error('getResult is not supported in this environment'));
16045
16074
  });
16046
16075
  });
16047
- // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
16048
- const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
16049
- const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
16076
+ getResultPromise
16077
+ .then(() => {
16078
+ isPromiseSettled = true;
16079
+ })
16080
+ .catch(() => {
16081
+ isPromiseSettled = true;
16082
+ });
16050
16083
  // Set up the getResult call.
16051
16084
  const getResult = async () => {
16085
+ // All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
16086
+ if (!isPromiseSettled) {
16087
+ return undefined;
16088
+ }
16052
16089
  let intentResult = await getResultPromise;
16053
- if (!intentResult || typeof intentResult !== 'object') {
16090
+ if (isPromiseSettled && !intentResult) {
16091
+ return undefined;
16092
+ }
16093
+ if (typeof intentResult !== 'object') {
16054
16094
  throw new Error(ResultError.NoResultReturned);
16055
16095
  }
16056
16096
  const { error } = intentResult;
@@ -16066,7 +16106,7 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16066
16106
  }
16067
16107
  case 'app': {
16068
16108
  const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
16069
- intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
16109
+ intentResult = (0, fdc3_channels_2_0_1.createV2Channel)(sessionContextGroup);
16070
16110
  break;
16071
16111
  }
16072
16112
  }
@@ -16176,7 +16216,7 @@ class FDC3ModuleBase {
16176
16216
  *
16177
16217
  * @tutorial fdc3.getOrCreateChannel
16178
16218
  */
16179
- async getOrCreateChannel(channelId) {
16219
+ async getOrCreateChannel(channelId, fdc3Factory) {
16180
16220
  this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
16181
16221
  // we do not want to expose this error, just continue if this analytics-only call fails
16182
16222
  });
@@ -16193,7 +16233,7 @@ class FDC3ModuleBase {
16193
16233
  }
16194
16234
  try {
16195
16235
  const sessionContextGroup = await this.client.joinSessionContextGroup(channelId);
16196
- return (0, utils_1$4.buildAppChannelObject)(sessionContextGroup);
16236
+ return fdc3Factory(sessionContextGroup);
16197
16237
  }
16198
16238
  catch (error) {
16199
16239
  console.error(error.message);
@@ -16343,6 +16383,7 @@ Object.defineProperty(fdc31_2, "__esModule", { value: true });
16343
16383
  fdc31_2.Fdc3Module = void 0;
16344
16384
  const utils_1$3 = utils$3;
16345
16385
  const fdc3_common_1$1 = fdc3Common;
16386
+ const fdc3_channels_1_2_1 = fdc3Channels1_2;
16346
16387
  /**
16347
16388
  * @version 1.2
16348
16389
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -16525,7 +16566,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16525
16566
  * @tutorial fdc3.getOrCreateChannel
16526
16567
  */
16527
16568
  async getOrCreateChannel(channelId) {
16528
- return super.getOrCreateChannel(channelId);
16569
+ return super.getOrCreateChannel(channelId, fdc3_channels_1_2_1.createV1Channel);
16529
16570
  }
16530
16571
  /**
16531
16572
  * Returns metadata relating to the FDC3 object and its provider, including the supported version of the FDC3 specification and the name of the provider of the implementation.
@@ -16555,6 +16596,7 @@ const utils_1$2 = utils$3;
16555
16596
  const InteropClient_1$1 = InteropClient$1;
16556
16597
  const utils_2 = utils$2;
16557
16598
  const PrivateChannelClient_1 = PrivateChannelClient$1;
16599
+ const fdc3_channels_2_0_1 = fdc3Channels2_0;
16558
16600
  /**
16559
16601
  * @version 2.0
16560
16602
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -16806,7 +16848,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16806
16848
  * @tutorial fdc3.getOrCreateChannel
16807
16849
  */
16808
16850
  async getOrCreateChannel(channelId) {
16809
- return super.getOrCreateChannel(channelId);
16851
+ return super.getOrCreateChannel(channelId, fdc3_channels_2_0_1.createV2Channel);
16810
16852
  }
16811
16853
  /**
16812
16854
  * Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "41.102.8",
3
+ "version": "41.103.3",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/stub.js",