@openfin/fdc3-api 45.100.48 → 45.100.50

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.
Files changed (2) hide show
  1. package/out/fdc3-api.js +322 -696
  2. package/package.json +1 -1
package/out/fdc3-api.js CHANGED
@@ -1,121 +1,53 @@
1
1
  'use strict';
2
2
 
3
- var require$$0 = require('lodash/isEqual');
3
+ var isEqual = require('lodash/isEqual');
4
4
 
5
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
-
7
- var fdc31_2 = {};
8
-
9
- var utils$2 = {};
10
-
11
- (function (exports) {
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.checkContextIntegrity = exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
14
- const generateId = () => `${Math.random()}${Date.now()}`;
15
- exports.generateId = generateId;
16
- const wrapInTryCatch = (f, prefix) => (...args) => {
17
- try {
18
- return f(...args);
19
- }
20
- catch (e) {
21
- throw new Error((prefix || '') + e);
22
- }
23
- };
24
- exports.wrapInTryCatch = wrapInTryCatch;
25
- const wrapContextHandler = (handler, handlerId) => {
26
- return async (context) => {
27
- try {
28
- await handler(context);
29
- }
30
- catch (error) {
31
- console.error(`Error thrown by handler ${handlerId} for context type ${context.type}: ${error}`);
32
- throw error;
33
- }
34
- };
35
- };
36
- exports.wrapContextHandler = wrapContextHandler;
37
- const generateOverrideError = (clientApi, brokerApi) => {
38
- return `You have tried to to use ${clientApi} but ${brokerApi} has not been overridden in the Interop Broker. Please override this function. Refer to our documentation for more info.`;
39
- };
40
- exports.generateOverrideError = generateOverrideError;
41
- const generateOverrideWarning = (fdc3ClientApi, brokerApi, identity, interopClientApi) => {
42
- const { uuid, name } = identity;
43
- const message = interopClientApi
44
- ? `Entity with identity: ${uuid}/${name} has called ${interopClientApi} or ${fdc3ClientApi} but ${brokerApi} has not been overridden.`
45
- : `Entity with identity: ${uuid}/${name} has called ${fdc3ClientApi} but ${brokerApi} has not been overridden.`;
46
- return message;
47
- };
48
- exports.generateOverrideWarning = generateOverrideWarning;
49
- exports.BROKER_ERRORS = {
50
- fireIntent: (0, exports.generateOverrideError)('fireIntent', 'handleFiredIntent'),
51
- fireIntentForContext: (0, exports.generateOverrideError)('fireIntentForContext', 'handleFiredIntentForContext'),
52
- getInfoForIntent: (0, exports.generateOverrideError)('getInfoForIntent', 'handleInfoForIntent'),
53
- getInfoForIntentsByContext: (0, exports.generateOverrideError)('getInfoForIntentsByContext', 'handleInfoForIntentsByContext'),
54
- joinSessionContextGroupWithJoinContextGroup: 'The Context Group you have tried to join is a Session Context Group. Custom Context Groups can only be defined by the Interop Broker through code or manifest configuration. Please use joinSessionContextGroup.',
55
- fdc3Open: (0, exports.generateOverrideError)('fdc3.open', 'fdc3HandleOpen'),
56
- fdc3FindInstances: (0, exports.generateOverrideError)('fdc3.findInstances', 'fdc3HandleFindInstances'),
57
- fdc3GetAppMetadata: (0, exports.generateOverrideError)('fdc3.getAppMetadata', 'fdc3HandleGetAppMetadata'),
58
- fdc3GetInfo: (0, exports.generateOverrideError)('fdc3.getInfo', 'fdc3HandleGetInfo')
59
- };
60
- const wrapIntentHandler = (handler, handlerId) => {
61
- return async (intent) => {
62
- try {
63
- return handler(intent);
64
- }
65
- catch (error) {
66
- console.error(`Error thrown by handler ${handlerId}: ${error}`);
67
- throw error;
68
- }
69
- };
70
- };
71
- exports.wrapIntentHandler = wrapIntentHandler;
72
- const checkContextIntegrity = (context) => {
73
- if (!context) {
74
- return { isValid: false, reason: 'No context supplied' };
75
- }
76
- if (typeof context !== 'object') {
77
- return { isValid: false, reason: 'Context must be an Object' };
78
- }
79
- if (!context.type) {
80
- return { isValid: false, reason: 'Context must have a type property' };
81
- }
82
- return { isValid: true };
83
- };
84
- exports.checkContextIntegrity = checkContextIntegrity;
85
- } (utils$2));
86
-
87
- var fdc3Common = {};
88
-
89
- var utils$1 = {};
90
-
91
- var PrivateChannelClient$1 = {};
92
-
93
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
94
- if (k2 === undefined) k2 = k;
95
- var desc = Object.getOwnPropertyDescriptor(m, k);
96
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
97
- desc = { enumerable: true, get: function() { return m[k]; } };
98
- }
99
- Object.defineProperty(o, k2, desc);
100
- }) : (function(o, m, k, k2) {
101
- if (k2 === undefined) k2 = k;
102
- o[k2] = m[k];
103
- }));
104
- var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
105
- Object.defineProperty(o, "default", { enumerable: true, value: v });
106
- }) : function(o, v) {
107
- o["default"] = v;
108
- });
109
- var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
110
- if (mod && mod.__esModule) return mod;
111
- var result = {};
112
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
113
- __setModuleDefault(result, mod);
114
- return result;
5
+ const generateId = () => `${Math.random()}${Date.now()}`;
6
+ const wrapInTryCatch = (f, prefix) => (...args) => {
7
+ try {
8
+ return f(...args);
9
+ }
10
+ catch (e) {
11
+ throw new Error((prefix || '') + e);
12
+ }
13
+ };
14
+ const wrapContextHandler = (handler, handlerId) => {
15
+ return async (context) => {
16
+ try {
17
+ await handler(context);
18
+ }
19
+ catch (error) {
20
+ console.error(`Error thrown by handler ${handlerId} for context type ${context.type}: ${error}`);
21
+ throw error;
22
+ }
23
+ };
24
+ };
25
+ const generateOverrideError = (clientApi, brokerApi) => {
26
+ return `You have tried to to use ${clientApi} but ${brokerApi} has not been overridden in the Interop Broker. Please override this function. Refer to our documentation for more info.`;
27
+ };
28
+ const BROKER_ERRORS = {
29
+ fireIntent: generateOverrideError('fireIntent', 'handleFiredIntent'),
30
+ fireIntentForContext: generateOverrideError('fireIntentForContext', 'handleFiredIntentForContext'),
31
+ getInfoForIntent: generateOverrideError('getInfoForIntent', 'handleInfoForIntent'),
32
+ getInfoForIntentsByContext: generateOverrideError('getInfoForIntentsByContext', 'handleInfoForIntentsByContext'),
33
+ joinSessionContextGroupWithJoinContextGroup: 'The Context Group you have tried to join is a Session Context Group. Custom Context Groups can only be defined by the Interop Broker through code or manifest configuration. Please use joinSessionContextGroup.',
34
+ fdc3Open: generateOverrideError('fdc3.open', 'fdc3HandleOpen'),
35
+ fdc3FindInstances: generateOverrideError('fdc3.findInstances', 'fdc3HandleFindInstances'),
36
+ fdc3GetAppMetadata: generateOverrideError('fdc3.getAppMetadata', 'fdc3HandleGetAppMetadata'),
37
+ fdc3GetInfo: generateOverrideError('fdc3.getInfo', 'fdc3HandleGetInfo')
115
38
  };
116
- Object.defineProperty(PrivateChannelClient$1, "__esModule", { value: true });
117
- PrivateChannelClient$1.PrivateChannelClient = void 0;
118
- const utils = __importStar(utils$2);
39
+ const wrapIntentHandler = (handler, handlerId) => {
40
+ return async (intent) => {
41
+ try {
42
+ return handler(intent);
43
+ }
44
+ catch (error) {
45
+ console.error(`Error thrown by handler ${handlerId}: ${error}`);
46
+ throw error;
47
+ }
48
+ };
49
+ };
50
+
119
51
  class PrivateChannelClient {
120
52
  constructor(client, id) {
121
53
  this.id = id;
@@ -134,12 +66,12 @@ class PrivateChannelClient {
134
66
  }
135
67
  let handlerId;
136
68
  if (contextType) {
137
- handlerId = `contextHandler:invoke-${this.id}-${contextType}-${utils.generateId()}`;
69
+ handlerId = `contextHandler:invoke-${this.id}-${contextType}-${generateId()}`;
138
70
  }
139
71
  else {
140
- handlerId = `contextHandler:invoke-${this.id}-${utils.generateId()}`;
72
+ handlerId = `contextHandler:invoke-${this.id}-${generateId()}`;
141
73
  }
142
- this.client.register(handlerId, utils.wrapContextHandler(handler, handlerId));
74
+ this.client.register(handlerId, wrapContextHandler(handler, handlerId));
143
75
  const listener = { unsubscribe: await this.createContextUnsubscribeCb(handlerId) };
144
76
  this.listeners.set(handlerId, listener);
145
77
  await this.client.dispatch(`contextHandlerAdded`, { handlerId, contextType });
@@ -160,7 +92,7 @@ class PrivateChannelClient {
160
92
  };
161
93
  }
162
94
  onAddContextListener(handler) {
163
- const handlerId = `onContextHandlerAdded:invoke-${this.id}-${utils.generateId()}`;
95
+ const handlerId = `onContextHandlerAdded:invoke-${this.id}-${generateId()}`;
164
96
  this.client.register(handlerId, handler);
165
97
  const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
166
98
  this.listeners.set(handlerId, listener);
@@ -168,7 +100,7 @@ class PrivateChannelClient {
168
100
  return listener;
169
101
  }
170
102
  onDisconnect(handler) {
171
- const handlerId = `onDisconnect:invoke-${this.id}-${utils.generateId()}`;
103
+ const handlerId = `onDisconnect:invoke-${this.id}-${generateId()}`;
172
104
  this.client.register(handlerId, handler);
173
105
  const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
174
106
  this.listeners.set(handlerId, listener);
@@ -176,7 +108,7 @@ class PrivateChannelClient {
176
108
  return listener;
177
109
  }
178
110
  onUnsubscribe(handler) {
179
- const handlerId = `onUnsubscribe:invoke-${this.id}-${utils.generateId()}`;
111
+ const handlerId = `onUnsubscribe:invoke-${this.id}-${generateId()}`;
180
112
  this.client.register(handlerId, handler);
181
113
  const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
182
114
  this.listeners.set(handlerId, listener);
@@ -201,18 +133,7 @@ class PrivateChannelClient {
201
133
  }
202
134
  }
203
135
  }
204
- PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
205
-
206
- var fdc3Channels2_0 = {};
207
-
208
- var fdc3Channels1_2 = {};
209
136
 
210
- var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
211
- return (mod && mod.__esModule) ? mod : { "default": mod };
212
- };
213
- Object.defineProperty(fdc3Channels1_2, "__esModule", { value: true });
214
- fdc3Channels1_2.createV1Channel = void 0;
215
- const isEqual_1$1 = __importDefault$2(require$$0);
216
137
  const createV1Channel = (sessionContextGroup) => {
217
138
  return {
218
139
  id: sessionContextGroup.id,
@@ -242,7 +163,7 @@ const createV1Channel = (sessionContextGroup) => {
242
163
  const wrappedHandler = (context, contextMetadata) => {
243
164
  if (first) {
244
165
  first = false;
245
- if ((0, isEqual_1$1.default)(currentContext, context)) {
166
+ if (isEqual(currentContext, context)) {
246
167
  return;
247
168
  }
248
169
  }
@@ -258,246 +179,217 @@ const createV1Channel = (sessionContextGroup) => {
258
179
  }
259
180
  };
260
181
  };
261
- fdc3Channels1_2.createV1Channel = createV1Channel;
262
182
 
263
- Object.defineProperty(fdc3Channels2_0, "__esModule", { value: true });
264
- fdc3Channels2_0.createV2Channel = void 0;
265
- const fdc3_channels_1_2_1$1 = fdc3Channels1_2;
266
183
  const createV2Channel = (sessionContextGroup) => {
267
- const channel = (0, fdc3_channels_1_2_1$1.createV1Channel)(sessionContextGroup);
184
+ const channel = createV1Channel(sessionContextGroup);
268
185
  return {
269
186
  ...channel,
270
187
  // @ts-expect-error Type incompatibility on signature.
271
188
  addContextListener: async (...args) => channel.addContextListener(...args)
272
189
  };
273
190
  };
274
- fdc3Channels2_0.createV2Channel = createV2Channel;
275
-
276
- (function (exports) {
277
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
278
- return (mod && mod.__esModule) ? mod : { "default": mod };
279
- };
280
- Object.defineProperty(exports, "__esModule", { value: true });
281
- exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
282
- const utils_1 = utils$2;
283
- const PrivateChannelClient_1 = PrivateChannelClient$1;
284
- __importDefault(require$$0);
285
- const fdc3_channels_2_0_1 = fdc3Channels2_0;
286
- const getUnsupportedChannelApis = (channelType) => {
287
- return {
288
- addContextListener: () => {
289
- throw new UnsupportedChannelApiError('Channel.addContextListener', channelType);
290
- },
291
- broadcast: () => {
292
- throw new UnsupportedChannelApiError('Channel.broadcast', channelType);
293
- },
294
- getCurrentContext: () => {
295
- throw new UnsupportedChannelApiError('Channel.getCurrentContext', channelType);
296
- }
297
- };
298
- };
299
- exports.getUnsupportedChannelApis = getUnsupportedChannelApis;
300
- class UnsupportedChannelApiError extends Error {
301
- constructor(apiName, channelType = 'System') {
302
- super(apiName);
303
- this.message = `Calling ${apiName} on an instance of a ${channelType} Channel returned by fdc3.get${channelType}Channels is not supported. If you would like to use a ${channelType} Channel, please use fdc3.joinChannel, fdc3.addContextListener, and fdc3.broadcast instead.`;
304
- }
305
- }
306
- exports.UnsupportedChannelApiError = UnsupportedChannelApiError;
307
- var ResultError;
308
- (function (ResultError) {
309
- /** Returned if the `IntentHandler` exited without returning a Promise or that
310
- * Promise was not resolved with a Context or Channel object.
311
- */
312
- ResultError["NoResultReturned"] = "NoResultReturned";
313
- /** Returned if the `IntentHandler` function processing the raised intent
314
- * throws an error or rejects the Promise it returned.
315
- */
316
- ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
317
- })(ResultError = exports.ResultError || (exports.ResultError = {}));
318
- (function (ChannelError) {
319
- /** Returned if the specified channel is not found when attempting to join a
320
- * channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
321
- */
322
- ChannelError["NoChannelFound"] = "NoChannelFound";
323
- /** SHOULD be returned when a request to join a user channel or to a retrieve
324
- * a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
325
- * of the DesktopAgent (`fdc3`) object is denied.
326
- */
327
- ChannelError["AccessDenied"] = "AccessDenied";
328
- /** SHOULD be returned when a channel cannot be created or retrieved via the
329
- * `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
330
- */
331
- ChannelError["CreationFailed"] = "CreationFailed";
332
- })(exports.ChannelError || (exports.ChannelError = {}));
333
- const buildPrivateChannelObject = (privateChannelClient) => {
334
- let clientDisconnected = false;
335
- const checkIfClientDisconnected = () => {
336
- if (clientDisconnected) {
337
- throw new Error('Private Channel Client has been disconnected from the Private Channel');
338
- }
339
- };
340
- return {
341
- id: privateChannelClient.id,
342
- type: 'private',
343
- broadcast: async (context) => {
344
- checkIfClientDisconnected();
345
- return privateChannelClient.broadcast(context);
346
- },
347
- getCurrentContext: async (contextType) => {
348
- checkIfClientDisconnected();
349
- return privateChannelClient.getCurrentContext(contextType);
350
- },
351
- // @ts-expect-error TODO [CORE-1524]
352
- addContextListener: async (contextType, handler) => {
353
- checkIfClientDisconnected();
354
- let handlerInUse = handler;
355
- let contextTypeInUse = contextType;
356
- if (typeof contextType === 'function') {
357
- console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
358
- handlerInUse = contextType;
359
- contextTypeInUse = null;
360
- }
361
- const listener = privateChannelClient.addContextListener(contextTypeInUse, handlerInUse);
362
- return listener;
363
- },
364
- onAddContextListener: (handler) => {
365
- checkIfClientDisconnected();
366
- return privateChannelClient.onAddContextListener(handler);
367
- },
368
- disconnect: async () => {
369
- checkIfClientDisconnected();
370
- clientDisconnected = true;
371
- return privateChannelClient.disconnect();
372
- },
373
- onDisconnect: (handler) => {
374
- checkIfClientDisconnected();
375
- return privateChannelClient.onDisconnect(handler);
376
- },
377
- onUnsubscribe: (handler) => {
378
- checkIfClientDisconnected();
379
- return privateChannelClient.onUnsubscribe(handler);
380
- }
381
- };
382
- };
383
- exports.buildPrivateChannelObject = buildPrivateChannelObject;
384
- const connectPrivateChannel = async (channelId) => {
385
- try {
386
- const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
387
- const privateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
388
- return (0, exports.buildPrivateChannelObject)(privateChannelClient);
389
- }
390
- catch (error) {
391
- throw new Error(`Private Channel with id: ${channelId} doesn't exist`);
392
- }
393
- };
394
- exports.connectPrivateChannel = connectPrivateChannel;
395
- const isContext = (context) => {
396
- if (context && typeof context === 'object' && 'type' in context) {
397
- const { type } = context;
398
- return typeof type === 'string';
399
- }
400
- return false;
401
- };
402
- exports.isContext = isContext;
403
- const isChannel = (channel) => {
404
- if (channel && typeof channel === 'object' && 'type' in channel && 'id' in channel) {
405
- const { type, id } = channel;
406
- return typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private');
407
- }
408
- return false;
409
- };
410
- exports.isChannel = isChannel;
411
- const getIntentResolution = async (interopModule, context, app, intent) => {
412
- // Generate an ID to make a session context group with. We will pass that ID to the Broker.
413
- // The broker will then setContext on that session context group later with our Intent Result,
414
- const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
415
- // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
416
- const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
417
- const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
418
- // Promise we'll use in getResult
419
- const getResultPromise = new Promise((resolve, reject) => {
420
- fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
421
- resolve(intentResult);
422
- }).catch(() => {
423
- // not supported in web, suppress the error
424
- if (interopModule.wire.environment.type === 'other') {
425
- resolve(undefined);
426
- }
427
- reject(new Error('getResult is not supported in this environment'));
428
- });
429
- });
430
- // Set up the getResult call.
431
- const getResult = async () => {
432
- let intentResult = await getResultPromise;
433
- // void / no payload, or web path where subscribe resolves undefined (see getResultPromise above)
434
- if (intentResult == null) {
435
- return undefined;
436
- }
437
- if (typeof intentResult !== 'object') {
438
- throw new Error(ResultError.NoResultReturned);
439
- }
440
- const { error } = intentResult;
441
- if (error) {
442
- throw new Error(ResultError.IntentHandlerRejected);
443
- }
444
- if ((0, exports.isChannel)(intentResult)) {
445
- const { id, type } = intentResult;
446
- switch (type) {
447
- case 'private': {
448
- intentResult = await (0, exports.connectPrivateChannel)(id);
449
- break;
450
- }
451
- case 'app': {
452
- const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
453
- intentResult = (0, fdc3_channels_2_0_1.createV2Channel)(sessionContextGroup);
454
- break;
455
- }
456
- }
457
- }
458
- else if (!(0, exports.isContext)(intentResult)) {
459
- throw new Error(ResultError.NoResultReturned);
460
- }
461
- return intentResult;
462
- };
463
- // Finally fire the intent.
464
- const intentResolutionInfoFromBroker = intent
465
- ? await interopModule.fireIntent(intentObj)
466
- : await interopModule.fireIntentForContext(intentObj);
467
- if (typeof intentResolutionInfoFromBroker !== 'object') {
468
- return {
469
- source: {
470
- appId: '',
471
- instanceId: ''
472
- },
473
- intent: '',
474
- version: '2.0',
475
- getResult
476
- };
477
- }
478
- return { ...intentResolutionInfoFromBroker, getResult };
479
- };
480
- exports.getIntentResolution = getIntentResolution;
481
- } (utils$1));
482
191
 
483
- var InteropClient$1 = {};
484
-
485
- var base = {};
192
+ const getUnsupportedChannelApis = (channelType) => {
193
+ return {
194
+ addContextListener: () => {
195
+ throw new UnsupportedChannelApiError('Channel.addContextListener', channelType);
196
+ },
197
+ broadcast: () => {
198
+ throw new UnsupportedChannelApiError('Channel.broadcast', channelType);
199
+ },
200
+ getCurrentContext: () => {
201
+ throw new UnsupportedChannelApiError('Channel.getCurrentContext', channelType);
202
+ }
203
+ };
204
+ };
205
+ class UnsupportedChannelApiError extends Error {
206
+ constructor(apiName, channelType = 'System') {
207
+ super(apiName);
208
+ this.message = `Calling ${apiName} on an instance of a ${channelType} Channel returned by fdc3.get${channelType}Channels is not supported. If you would like to use a ${channelType} Channel, please use fdc3.joinChannel, fdc3.addContextListener, and fdc3.broadcast instead.`;
209
+ }
210
+ }
211
+ var ResultError;
212
+ (function (ResultError) {
213
+ /** Returned if the `IntentHandler` exited without returning a Promise or that
214
+ * Promise was not resolved with a Context or Channel object.
215
+ */
216
+ ResultError["NoResultReturned"] = "NoResultReturned";
217
+ /** Returned if the `IntentHandler` function processing the raised intent
218
+ * throws an error or rejects the Promise it returned.
219
+ */
220
+ ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
221
+ })(ResultError || (ResultError = {}));
222
+ var ChannelError;
223
+ (function (ChannelError) {
224
+ /** Returned if the specified channel is not found when attempting to join a
225
+ * channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
226
+ */
227
+ ChannelError["NoChannelFound"] = "NoChannelFound";
228
+ /** SHOULD be returned when a request to join a user channel or to a retrieve
229
+ * a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
230
+ * of the DesktopAgent (`fdc3`) object is denied.
231
+ */
232
+ ChannelError["AccessDenied"] = "AccessDenied";
233
+ /** SHOULD be returned when a channel cannot be created or retrieved via the
234
+ * `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
235
+ */
236
+ ChannelError["CreationFailed"] = "CreationFailed";
237
+ })(ChannelError || (ChannelError = {}));
238
+ const buildPrivateChannelObject = (privateChannelClient) => {
239
+ let clientDisconnected = false;
240
+ const checkIfClientDisconnected = () => {
241
+ if (clientDisconnected) {
242
+ throw new Error('Private Channel Client has been disconnected from the Private Channel');
243
+ }
244
+ };
245
+ return {
246
+ id: privateChannelClient.id,
247
+ type: 'private',
248
+ broadcast: async (context) => {
249
+ checkIfClientDisconnected();
250
+ return privateChannelClient.broadcast(context);
251
+ },
252
+ getCurrentContext: async (contextType) => {
253
+ checkIfClientDisconnected();
254
+ return privateChannelClient.getCurrentContext(contextType);
255
+ },
256
+ // @ts-expect-error TODO [CORE-1524]
257
+ addContextListener: async (contextType, handler) => {
258
+ checkIfClientDisconnected();
259
+ let handlerInUse = handler;
260
+ let contextTypeInUse = contextType;
261
+ if (typeof contextType === 'function') {
262
+ console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
263
+ handlerInUse = contextType;
264
+ contextTypeInUse = null;
265
+ }
266
+ const listener = privateChannelClient.addContextListener(contextTypeInUse, handlerInUse);
267
+ return listener;
268
+ },
269
+ onAddContextListener: (handler) => {
270
+ checkIfClientDisconnected();
271
+ return privateChannelClient.onAddContextListener(handler);
272
+ },
273
+ disconnect: async () => {
274
+ checkIfClientDisconnected();
275
+ clientDisconnected = true;
276
+ return privateChannelClient.disconnect();
277
+ },
278
+ onDisconnect: (handler) => {
279
+ checkIfClientDisconnected();
280
+ return privateChannelClient.onDisconnect(handler);
281
+ },
282
+ onUnsubscribe: (handler) => {
283
+ checkIfClientDisconnected();
284
+ return privateChannelClient.onUnsubscribe(handler);
285
+ }
286
+ };
287
+ };
288
+ const connectPrivateChannel = async (channelId) => {
289
+ try {
290
+ const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
291
+ const privateChannelClient = new PrivateChannelClient(channelClient, channelId);
292
+ return buildPrivateChannelObject(privateChannelClient);
293
+ }
294
+ catch (error) {
295
+ throw new Error(`Private Channel with id: ${channelId} doesn't exist`);
296
+ }
297
+ };
298
+ const isContext = (context) => {
299
+ if (context && typeof context === 'object' && 'type' in context) {
300
+ const { type } = context;
301
+ return typeof type === 'string';
302
+ }
303
+ return false;
304
+ };
305
+ const isChannel = (channel) => {
306
+ if (channel && typeof channel === 'object' && 'type' in channel && 'id' in channel) {
307
+ const { type, id } = channel;
308
+ return typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private');
309
+ }
310
+ return false;
311
+ };
312
+ const getIntentResolution = async (interopModule, context, app, intent) => {
313
+ // Generate an ID to make a session context group with. We will pass that ID to the Broker.
314
+ // The broker will then setContext on that session context group later with our Intent Result,
315
+ const guid = generateId(); // TODO make this undefined in web
316
+ // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
317
+ const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
318
+ const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
319
+ // Promise we'll use in getResult
320
+ const getResultPromise = new Promise((resolve, reject) => {
321
+ fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
322
+ resolve(intentResult);
323
+ }).catch(() => {
324
+ // not supported in web, suppress the error
325
+ if (interopModule.wire.environment.type === 'other') {
326
+ resolve(undefined);
327
+ }
328
+ reject(new Error('getResult is not supported in this environment'));
329
+ });
330
+ });
331
+ // Set up the getResult call.
332
+ const getResult = async () => {
333
+ let intentResult = await getResultPromise;
334
+ // void / no payload, or web path where subscribe resolves undefined (see getResultPromise above)
335
+ if (intentResult == null) {
336
+ return undefined;
337
+ }
338
+ if (typeof intentResult !== 'object') {
339
+ throw new Error(ResultError.NoResultReturned);
340
+ }
341
+ const { error } = intentResult;
342
+ if (error) {
343
+ throw new Error(ResultError.IntentHandlerRejected);
344
+ }
345
+ if (isChannel(intentResult)) {
346
+ const { id, type } = intentResult;
347
+ switch (type) {
348
+ case 'private': {
349
+ intentResult = await connectPrivateChannel(id);
350
+ break;
351
+ }
352
+ case 'app': {
353
+ const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
354
+ intentResult = createV2Channel(sessionContextGroup);
355
+ break;
356
+ }
357
+ }
358
+ }
359
+ else if (!isContext(intentResult)) {
360
+ throw new Error(ResultError.NoResultReturned);
361
+ }
362
+ return intentResult;
363
+ };
364
+ // Finally fire the intent.
365
+ const intentResolutionInfoFromBroker = intent
366
+ ? await interopModule.fireIntent(intentObj)
367
+ : await interopModule.fireIntentForContext(intentObj);
368
+ if (typeof intentResolutionInfoFromBroker !== 'object') {
369
+ return {
370
+ source: {
371
+ appId: '',
372
+ instanceId: ''
373
+ },
374
+ intent: '',
375
+ version: '2.0',
376
+ getResult
377
+ };
378
+ }
379
+ return { ...intentResolutionInfoFromBroker, getResult };
380
+ };
486
381
 
487
- var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
382
+ (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
488
383
  if (kind === "m") throw new TypeError("Private method is not writable");
489
384
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
490
385
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
491
386
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
492
387
  };
493
- var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
388
+ (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
494
389
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
495
390
  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");
496
391
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
497
392
  };
498
- var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
499
- Object.defineProperty(base, "__esModule", { value: true });
500
- base.Reply = base.EmitterBase = base.Base = void 0;
501
393
  class Base {
502
394
  /**
503
395
  * @internal
@@ -537,236 +429,20 @@ class Base {
537
429
  return this.wire.me;
538
430
  }
539
431
  }
540
- base.Base = Base;
541
- /**
542
- * An entity that emits OpenFin events.
543
- *
544
- * @remarks Event-binding methods are asynchronous as they must cross process boundaries
545
- * and setup the listener in the browser process. When the `EventEmitter` receives an event from the browser process
546
- * and emits on the renderer, all of the functions attached to that specific event are called synchronously. Any values
547
- * returned by the called listeners are ignored and will be discarded. If the execution context of the window is destroyed
548
- * by page navigation or reload, any events that have been setup in that context will be destroyed.
549
- *
550
- * It is important to keep in mind that when an ordinary listener function is called, the standard `this` keyword is intentionally
551
- * set to reference the `EventEmitter` instance to which the listener is attached. It is possible to use ES6 Arrow Functions as
552
- * listeners, however, when doing so, the `this` keyword will no longer reference the `EventEmitter` instance.
553
- *
554
- * Events re-propagate from smaller/more-local scopes to larger/more-global scopes. For example, an event emitted on a specific
555
- * view will propagate to the window in which the view is embedded, and then to the application in which the window is running, and
556
- * finally to the OpenFin runtime itself at the "system" level. Re-propagated events are prefixed with the name of the scope in which
557
- * they originated - for example, a "shown" event emitted on a view will be re-propagated at the window level as "view-shown", and
558
- * then to the application as "window-view-shown", and finally at the system level as "application-window-view-shown".
559
- *
560
- * All event propagations are visible at the System level, regardless of source, so transitive re-propagations (e.g. from view to window
561
- * to application) are visible in their entirety at the system level. So, we can listen to the above event as "shown", "view-shown",
562
- * "window-view-shown", or "application-window-view-shown."
563
- */
564
- class EmitterBase extends Base {
565
- constructor(wire, topic, ...additionalAccessors) {
566
- super(wire);
567
- this.topic = topic;
568
- _EmitterBase_emitterAccessor.set(this, void 0);
569
- _EmitterBase_deregisterOnceListeners.set(this, void 0);
570
- this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
571
- /**
572
- * @internal
573
- */
574
- this.emit = (eventType, payload, ...args) => {
575
- return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
576
- };
577
- this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$4(this, _EmitterBase_emitterAccessor, "f"));
578
- this.getOrCreateEmitter = () => {
579
- return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$4(this, _EmitterBase_emitterAccessor, "f"));
580
- };
581
- this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
582
- this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
583
- this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
584
- const runtimeEvent = {
585
- ...this.identity,
586
- timestamp: options.timestamp || Date.now(),
587
- topic: this.topic,
588
- type: eventType
589
- };
590
- const emitter = this.getOrCreateEmitter();
591
- // We apply the subscription and then undo if the async call fails to avoid
592
- // indeterminacy in subscription application order, which can break things elsewhere
593
- applySubscription(emitter);
594
- try {
595
- await this.wire.sendAction('subscribe-to-desktop-event', runtimeEvent);
596
- }
597
- catch (e) {
598
- undoSubscription(emitter);
599
- this.deleteEmitterIfNothingRegistered(emitter);
600
- throw e;
601
- }
602
- };
603
- this.deregisterEventListener = async (eventType, options = {}) => {
604
- if (this.hasEmitter()) {
605
- const runtimeEvent = {
606
- ...this.identity,
607
- timestamp: options.timestamp || Date.now(),
608
- topic: this.topic,
609
- type: eventType
610
- };
611
- await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
612
- return this.getOrCreateEmitter();
613
- }
614
- // This will only be reached if unsubscribe from event that does not exist but do not want to error here
615
- return Promise.resolve();
616
- };
617
- __classPrivateFieldSet$4(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
618
- __classPrivateFieldSet$4(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
619
- }
620
- /**
621
- * Adds a listener to the end of the listeners array for the specified event.
622
- *
623
- * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
624
- */
625
- async on(eventType, listener, options) {
626
- await this.registerEventListener(eventType, options, (emitter) => {
627
- emitter.on(eventType, listener);
628
- }, (emitter) => {
629
- emitter.removeListener(eventType, listener);
630
- });
631
- return this;
632
- }
633
- /**
634
- * Adds a listener to the end of the listeners array for the specified event.
635
- */
636
- async addListener(eventType, listener, options) {
637
- return this.on(eventType, listener, options);
638
- }
639
- /**
640
- * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
641
- *
642
- * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
643
- */
644
- async once(eventType, listener, options) {
645
- const deregister = () => this.deregisterEventListener(eventType);
646
- __classPrivateFieldGet$4(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
647
- await this.registerEventListener(eventType, options, (emitter) => {
648
- emitter.once(eventType, deregister);
649
- emitter.once(eventType, listener);
650
- }, (emitter) => {
651
- emitter.removeListener(eventType, deregister);
652
- emitter.removeListener(eventType, listener);
653
- });
654
- return this;
655
- }
656
- /**
657
- * Adds a listener to the beginning of the listeners array for the specified event.
658
- *
659
- * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
660
- */
661
- async prependListener(eventType, listener, options) {
662
- await this.registerEventListener(eventType, options, (emitter) => {
663
- emitter.prependListener(eventType, listener);
664
- }, (emitter) => {
665
- emitter.removeListener(eventType, listener);
666
- });
667
- return this;
668
- }
669
- /**
670
- * Adds a one time listener for the event. The listener is invoked only the first time the event is fired,
671
- * after which it is removed. The listener is added to the beginning of the listeners array.
672
- *
673
- * @remarks Event payloads are documented in the {@link OpenFin.Events} namespace.
674
- */
675
- async prependOnceListener(eventType, listener, options) {
676
- const deregister = () => this.deregisterEventListener(eventType);
677
- __classPrivateFieldGet$4(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
678
- await this.registerEventListener(eventType, options, (emitter) => {
679
- emitter.prependOnceListener(eventType, listener);
680
- emitter.once(eventType, deregister);
681
- }, (emitter) => {
682
- emitter.removeListener(eventType, listener);
683
- emitter.removeListener(eventType, deregister);
684
- });
685
- return this;
686
- }
687
- /**
688
- * Remove a listener from the listener array for the specified event.
689
- *
690
- * @remarks Caution: Calling this method changes the array indices in the listener array behind the listener.
691
- */
692
- async removeListener(eventType, listener, options) {
693
- const emitter = await this.deregisterEventListener(eventType, options);
694
- if (emitter) {
695
- emitter.removeListener(eventType, listener);
696
- const deregister = __classPrivateFieldGet$4(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
697
- if (deregister) {
698
- emitter.removeListener(eventType, deregister);
699
- }
700
- this.deleteEmitterIfNothingRegistered(emitter);
701
- }
702
- return this;
703
- }
704
- async deregisterAllListeners(eventType) {
705
- const runtimeEvent = { ...this.identity, type: eventType, topic: this.topic };
706
- if (this.hasEmitter()) {
707
- const emitter = this.getOrCreateEmitter();
708
- const refCount = emitter.listenerCount(runtimeEvent.type);
709
- const unsubscribePromises = [];
710
- for (let i = 0; i < refCount; i++) {
711
- unsubscribePromises.push(this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null));
712
- }
713
- await Promise.all(unsubscribePromises);
714
- return emitter;
715
- }
716
- return undefined;
717
- }
718
- /**
719
- * Removes all listeners, or those of the specified event.
720
- *
721
- */
722
- async removeAllListeners(eventType) {
723
- const removeByEvent = async (event) => {
724
- const emitter = await this.deregisterAllListeners(event);
725
- if (emitter) {
726
- emitter.removeAllListeners(event);
727
- this.deleteEmitterIfNothingRegistered(emitter);
728
- }
729
- };
730
- if (eventType) {
731
- await removeByEvent(eventType);
732
- }
733
- else if (this.hasEmitter()) {
734
- const events = this.getOrCreateEmitter().eventNames();
735
- await Promise.all(events.map(removeByEvent));
736
- }
737
- return this;
738
- }
739
- deleteEmitterIfNothingRegistered(emitter) {
740
- // TODO: maybe emitterMap should clean up itself..
741
- if (emitter.eventNames().length === 0) {
742
- this.wire.eventAggregator.delete(__classPrivateFieldGet$4(this, _EmitterBase_emitterAccessor, "f"));
743
- }
744
- }
745
- }
746
- base.EmitterBase = EmitterBase;
747
- _EmitterBase_emitterAccessor = new WeakMap(), _EmitterBase_deregisterOnceListeners = new WeakMap();
748
- class Reply {
749
- }
750
- base.Reply = Reply;
751
-
752
- var SessionContextGroupClient$1 = {};
753
432
 
754
- var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
433
+ var __classPrivateFieldSet$3 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
755
434
  if (kind === "m") throw new TypeError("Private method is not writable");
756
435
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
757
436
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
758
437
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
759
438
  };
760
- var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
439
+ var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
761
440
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
762
441
  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");
763
442
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
764
443
  };
765
444
  var _SessionContextGroupClient_clientPromise;
766
- Object.defineProperty(SessionContextGroupClient$1, "__esModule", { value: true });
767
- const base_1$1 = base;
768
- const utils_1$4 = utils$2;
769
- class SessionContextGroupClient extends base_1$1.Base {
445
+ class SessionContextGroupClient extends Base {
770
446
  constructor(wire, client, id) {
771
447
  super(wire);
772
448
  _SessionContextGroupClient_clientPromise.set(this, void 0);
@@ -809,12 +485,12 @@ class SessionContextGroupClient extends base_1$1.Base {
809
485
  const client = await __classPrivateFieldGet$3(this, _SessionContextGroupClient_clientPromise, "f");
810
486
  let handlerId;
811
487
  if (contextType) {
812
- handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$4.generateId)()}`;
488
+ handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${generateId()}`;
813
489
  }
814
490
  else {
815
491
  handlerId = `sessionContextHandler:invoke-${this.id}`;
816
492
  }
817
- client.register(handlerId, (0, utils_1$4.wrapContextHandler)(contextHandler, handlerId));
493
+ client.register(handlerId, wrapContextHandler(contextHandler, handlerId));
818
494
  await client.dispatch(`sessionContextGroup:handlerAdded-${this.id}`, { handlerId, contextType });
819
495
  return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
820
496
  }
@@ -828,31 +504,26 @@ class SessionContextGroupClient extends base_1$1.Base {
828
504
  getUserInstance() {
829
505
  return {
830
506
  id: this.id,
831
- setContext: (0, utils_1$4.wrapInTryCatch)(this.setContext.bind(this), 'Failed to set context: '),
832
- getCurrentContext: (0, utils_1$4.wrapInTryCatch)(this.getCurrentContext.bind(this), 'Failed to get context: '),
833
- addContextHandler: (0, utils_1$4.wrapInTryCatch)(this.addContextHandler.bind(this), 'Failed to add context handler: ')
507
+ setContext: wrapInTryCatch(this.setContext.bind(this), 'Failed to set context: '),
508
+ getCurrentContext: wrapInTryCatch(this.getCurrentContext.bind(this), 'Failed to get context: '),
509
+ addContextHandler: wrapInTryCatch(this.addContextHandler.bind(this), 'Failed to add context handler: ')
834
510
  };
835
511
  }
836
512
  }
837
- SessionContextGroupClient$1.default = SessionContextGroupClient;
838
513
  _SessionContextGroupClient_clientPromise = new WeakMap();
839
514
 
840
- var channelEvents = {};
841
-
842
- var __classPrivateFieldSet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
515
+ var __classPrivateFieldSet$2 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
843
516
  if (kind === "m") throw new TypeError("Private method is not writable");
844
517
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
845
518
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
846
519
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
847
520
  };
848
- var __classPrivateFieldGet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
521
+ var __classPrivateFieldGet$2 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
849
522
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
850
523
  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");
851
524
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
852
525
  };
853
526
  var _a, _ChannelEvents_channelClient, _ChannelEvents_isChannelReady, _ChannelEvents_actionsByClient, _ChannelEvents_getActions, _ChannelEvents_createRegistration, _ChannelEvents_getRegistration, _ChannelEvents_getOrCreateRegistration;
854
- Object.defineProperty(channelEvents, "__esModule", { value: true });
855
- channelEvents.ChannelEvents = void 0;
856
527
  /**
857
528
  * Channel events creates a event like syntax out of a channel action, allowing multiple events to be triggered
858
529
  * from a single action (normally only one callback can be created per action).
@@ -960,7 +631,6 @@ class ChannelEvents {
960
631
  });
961
632
  }
962
633
  }
963
- channelEvents.ChannelEvents = ChannelEvents;
964
634
  _a = ChannelEvents, _ChannelEvents_channelClient = new WeakMap(), _ChannelEvents_isChannelReady = new WeakMap(), _ChannelEvents_getActions = new WeakMap(), _ChannelEvents_createRegistration = new WeakMap(), _ChannelEvents_getRegistration = new WeakMap(), _ChannelEvents_getOrCreateRegistration = new WeakMap();
965
635
  /**
966
636
  * Static map of actions by channel client. This ensures we can reuse the same event and keep track of all its callbacks.
@@ -970,27 +640,18 @@ _a = ChannelEvents, _ChannelEvents_channelClient = new WeakMap(), _ChannelEvents
970
640
  */
971
641
  _ChannelEvents_actionsByClient = { value: new WeakMap() };
972
642
 
973
- var __classPrivateFieldSet$1 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
643
+ var __classPrivateFieldSet$1 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
974
644
  if (kind === "m") throw new TypeError("Private method is not writable");
975
645
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
976
646
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
977
647
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
978
648
  };
979
- var __classPrivateFieldGet$1 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
649
+ var __classPrivateFieldGet$1 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
980
650
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
981
651
  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");
982
652
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
983
653
  };
984
- var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
985
- return (mod && mod.__esModule) ? mod : { "default": mod };
986
- };
987
654
  var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory, _InteropClient_channelEvents;
988
- Object.defineProperty(InteropClient$1, "__esModule", { value: true });
989
- InteropClient$1.InteropClient = void 0;
990
- const base_1 = base;
991
- const SessionContextGroupClient_1 = __importDefault$1(SessionContextGroupClient$1);
992
- const utils_1$3 = utils$2;
993
- const channel_events_1 = channelEvents;
994
655
  /**
995
656
  * The Interop Client API is broken up into two groups:
996
657
  *
@@ -1040,7 +701,7 @@ const channel_events_1 = channelEvents;
1040
701
  * * {@link InteropClient#getAllClientsInContextGroup getAllClientsInContextGroup(contextGroupId)}
1041
702
  *
1042
703
  */
1043
- class InteropClient extends base_1.Base {
704
+ class InteropClient extends Base {
1044
705
  /**
1045
706
  * @internal
1046
707
  */
@@ -1084,7 +745,7 @@ class InteropClient extends base_1.Base {
1084
745
  __classPrivateFieldSet$1(this, _InteropClient_sessionContextGroups, new Map(), "f");
1085
746
  __classPrivateFieldSet$1(this, _InteropClient_clientPromise, clientPromise, "f");
1086
747
  __classPrivateFieldSet$1(this, _InteropClient_fdc3Factory, fdc3Factory, "f");
1087
- __classPrivateFieldSet$1(this, _InteropClient_channelEvents, new channel_events_1.ChannelEvents(clientPromise), "f");
748
+ __classPrivateFieldSet$1(this, _InteropClient_channelEvents, new ChannelEvents(clientPromise), "f");
1088
749
  }
1089
750
  /**
1090
751
  * Sets a context for the context group of the current entity.
@@ -1179,12 +840,12 @@ class InteropClient extends base_1.Base {
1179
840
  const client = await __classPrivateFieldGet$1(this, _InteropClient_clientPromise, "f");
1180
841
  let handlerId;
1181
842
  if (contextType) {
1182
- handlerId = `invokeContextHandler-${contextType}-${(0, utils_1$3.generateId)()}`;
843
+ handlerId = `invokeContextHandler-${contextType}-${generateId()}`;
1183
844
  }
1184
845
  else {
1185
846
  handlerId = 'invokeContextHandler';
1186
847
  }
1187
- const wrappedHandler = (0, utils_1$3.wrapContextHandler)(handler, handlerId);
848
+ const wrappedHandler = wrapContextHandler(handler, handlerId);
1188
849
  client.register(handlerId, wrappedHandler);
1189
850
  await client.dispatch('contextHandlerRegistered', { handlerId, contextType });
1190
851
  return {
@@ -1381,7 +1042,7 @@ class InteropClient extends base_1.Base {
1381
1042
  });
1382
1043
  const client = await __classPrivateFieldGet$1(this, _InteropClient_clientPromise, "f");
1383
1044
  const handlerId = `intent-handler-${intentName}`;
1384
- const wrappedHandler = (0, utils_1$3.wrapIntentHandler)(handler, handlerId);
1045
+ const wrappedHandler = wrapIntentHandler(handler, handlerId);
1385
1046
  try {
1386
1047
  await client.register(handlerId, wrappedHandler);
1387
1048
  await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
@@ -1548,7 +1209,7 @@ class InteropClient extends base_1.Base {
1548
1209
  if (hasConflict) {
1549
1210
  console.warn(`A (non-session) context group with the name "${sessionContextGroupId}" already exists. If you are trying to join a Context Group, call joinContextGroup instead.`);
1550
1211
  }
1551
- const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet$1(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
1212
+ const newSessionContextGroup = new SessionContextGroupClient(this.wire, __classPrivateFieldGet$1(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
1552
1213
  __classPrivateFieldGet$1(this, _InteropClient_sessionContextGroups, "f").set(sessionContextGroupId, newSessionContextGroup);
1553
1214
  return newSessionContextGroup.getUserInstance();
1554
1215
  }
@@ -1598,30 +1259,20 @@ class InteropClient extends base_1.Base {
1598
1259
  return client.dispatch(action, payload || null);
1599
1260
  }
1600
1261
  }
1601
- InteropClient$1.InteropClient = InteropClient;
1602
1262
  _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap(), _InteropClient_channelEvents = new WeakMap();
1603
1263
 
1604
- var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1264
+ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1605
1265
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1606
1266
  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");
1607
1267
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1608
1268
  };
1609
- var __classPrivateFieldSet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1269
+ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1610
1270
  if (kind === "m") throw new TypeError("Private method is not writable");
1611
1271
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1612
1272
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1613
1273
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1614
1274
  };
1615
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1616
- return (mod && mod.__esModule) ? mod : { "default": mod };
1617
- };
1618
1275
  var _FDC3ModuleBase_producer;
1619
- Object.defineProperty(fdc3Common, "__esModule", { value: true });
1620
- fdc3Common.FDC3ModuleBase = void 0;
1621
- const utils_1$2 = utils$1;
1622
- const utils_2$1 = utils$2;
1623
- const InteropClient_1$1 = InteropClient$1;
1624
- const isEqual_1 = __importDefault(require$$0);
1625
1276
  class FDC3ModuleBase {
1626
1277
  get client() {
1627
1278
  return __classPrivateFieldGet(this, _FDC3ModuleBase_producer, "f").call(this);
@@ -1660,10 +1311,10 @@ class FDC3ModuleBase {
1660
1311
  // we do not want to expose this error, just continue if this analytics-only call fails
1661
1312
  });
1662
1313
  try {
1663
- return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
1314
+ return await InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
1664
1315
  }
1665
1316
  catch (error) {
1666
- const errorToThrow = error.message === utils_2$1.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error.message;
1317
+ const errorToThrow = error.message === BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error.message;
1667
1318
  throw new Error(errorToThrow);
1668
1319
  }
1669
1320
  }
@@ -1672,7 +1323,7 @@ class FDC3ModuleBase {
1672
1323
  // fdc3 implementation of getSystemChannels returns an array of channels, have to decorate over
1673
1324
  // this so people know that these APIs are not supported
1674
1325
  return channels.map((channel) => {
1675
- return { ...channel, type: 'system', ...(0, utils_1$2.getUnsupportedChannelApis)() };
1326
+ return { ...channel, type: 'system', ...getUnsupportedChannelApis() };
1676
1327
  });
1677
1328
  }
1678
1329
  /**
@@ -1685,16 +1336,16 @@ class FDC3ModuleBase {
1685
1336
  this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
1686
1337
  // we do not want to expose this error, just continue if this analytics-only call fails
1687
1338
  });
1688
- const hasChannelIdBeenUsed = await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
1339
+ const hasChannelIdBeenUsed = await InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
1689
1340
  channelId
1690
1341
  });
1691
1342
  if (hasChannelIdBeenUsed) {
1692
- throw new Error(utils_1$2.ChannelError.AccessDenied);
1343
+ throw new Error(ChannelError.AccessDenied);
1693
1344
  }
1694
1345
  const systemChannels = await this._getChannels();
1695
1346
  const userChannel = systemChannels.find((channel) => channel.id === channelId);
1696
1347
  if (userChannel) {
1697
- return { ...userChannel, type: 'system', ...(0, utils_1$2.getUnsupportedChannelApis)() };
1348
+ return { ...userChannel, type: 'system', ...getUnsupportedChannelApis() };
1698
1349
  }
1699
1350
  try {
1700
1351
  const sessionContextGroup = await this.client.joinSessionContextGroup(channelId);
@@ -1702,7 +1353,7 @@ class FDC3ModuleBase {
1702
1353
  }
1703
1354
  catch (error) {
1704
1355
  console.error(error.message);
1705
- throw new Error(utils_1$2.ChannelError.CreationFailed);
1356
+ throw new Error(ChannelError.CreationFailed);
1706
1357
  }
1707
1358
  }
1708
1359
  /**
@@ -1736,16 +1387,16 @@ class FDC3ModuleBase {
1736
1387
  return await this.client.joinContextGroup(channelId);
1737
1388
  }
1738
1389
  catch (error) {
1739
- if (error.message === utils_2$1.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
1390
+ if (error.message === BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
1740
1391
  console.error('The Channel you have tried to join is an App Channel. Custom Channels can only be defined by the Interop Broker through code or manifest configuration. Please use getOrCreateChannel.');
1741
1392
  }
1742
1393
  else {
1743
1394
  console.error(error.message);
1744
1395
  }
1745
1396
  if (error.message.startsWith('Attempting to join a context group that does not exist')) {
1746
- throw new Error(utils_1$2.ChannelError.NoChannelFound);
1397
+ throw new Error(ChannelError.NoChannelFound);
1747
1398
  }
1748
- throw new Error(utils_1$2.ChannelError.AccessDenied);
1399
+ throw new Error(ChannelError.AccessDenied);
1749
1400
  }
1750
1401
  }
1751
1402
  /**
@@ -1816,7 +1467,7 @@ class FDC3ModuleBase {
1816
1467
  const wrappedHandler = (context, contextMetadata) => {
1817
1468
  if (first) {
1818
1469
  first = false;
1819
- if ((0, isEqual_1.default)(currentContext, context)) {
1470
+ if (isEqual(currentContext, context)) {
1820
1471
  return;
1821
1472
  }
1822
1473
  }
@@ -1841,14 +1492,8 @@ class FDC3ModuleBase {
1841
1492
  };
1842
1493
  }
1843
1494
  }
1844
- fdc3Common.FDC3ModuleBase = FDC3ModuleBase;
1845
1495
  _FDC3ModuleBase_producer = new WeakMap();
1846
1496
 
1847
- Object.defineProperty(fdc31_2, "__esModule", { value: true });
1848
- exports.Fdc3Module = fdc31_2.Fdc3Module = void 0;
1849
- const utils_1$1 = utils$2;
1850
- const fdc3_common_1$1 = fdc3Common;
1851
- const fdc3_channels_1_2_1 = fdc3Channels1_2;
1852
1497
  /**
1853
1498
  * @version 1.2
1854
1499
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -1884,7 +1529,7 @@ const fdc3_channels_1_2_1 = fdc3Channels1_2;
1884
1529
  * }
1885
1530
  * ```
1886
1531
  */
1887
- class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
1532
+ class Fdc3Module extends FDC3ModuleBase {
1888
1533
  async open(app, context) {
1889
1534
  // eslint-disable-next-line no-underscore-dangle
1890
1535
  await super._open(app, context);
@@ -1964,7 +1609,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
1964
1609
  return await this.client.fireIntent(intentObj);
1965
1610
  }
1966
1611
  catch (error) {
1967
- const errorToThrow = error.message === utils_1$1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
1612
+ const errorToThrow = error.message === BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
1968
1613
  throw new Error(errorToThrow);
1969
1614
  }
1970
1615
  }
@@ -1983,7 +1628,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
1983
1628
  return await this.client.getInfoForIntent({ name: intent, context });
1984
1629
  }
1985
1630
  catch (error) {
1986
- const errorToThrow = error.message === utils_1$1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
1631
+ const errorToThrow = error.message === BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
1987
1632
  throw new Error(errorToThrow);
1988
1633
  }
1989
1634
  }
@@ -2001,7 +1646,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
2001
1646
  return await this.client.getInfoForIntentsByContext(context);
2002
1647
  }
2003
1648
  catch (error) {
2004
- const errorToThrow = error.message === utils_1$1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
1649
+ const errorToThrow = error.message === BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
2005
1650
  throw new Error(errorToThrow);
2006
1651
  }
2007
1652
  }
@@ -2020,7 +1665,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
2020
1665
  return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
2021
1666
  }
2022
1667
  catch (error) {
2023
- const errorToThrow = error.message === utils_1$1.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error.message;
1668
+ const errorToThrow = error.message === BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error.message;
2024
1669
  throw new Error(errorToThrow);
2025
1670
  }
2026
1671
  }
@@ -2031,7 +1676,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
2031
1676
  * @tutorial fdc3.getOrCreateChannel
2032
1677
  */
2033
1678
  async getOrCreateChannel(channelId) {
2034
- return super.getOrCreateChannel(channelId, fdc3_channels_1_2_1.createV1Channel);
1679
+ return super.getOrCreateChannel(channelId, createV1Channel);
2035
1680
  }
2036
1681
  /**
2037
1682
  * 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.
@@ -2050,20 +1695,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
2050
1695
  };
2051
1696
  }
2052
1697
  }
2053
- exports.Fdc3Module = fdc31_2.Fdc3Module = Fdc3Module;
2054
1698
 
2055
- var fdc3 = {};
2056
-
2057
- var fdc32_0 = {};
2058
-
2059
- Object.defineProperty(fdc32_0, "__esModule", { value: true });
2060
- exports.Fdc3Module2 = fdc32_0.Fdc3Module2 = void 0;
2061
- const fdc3_common_1 = fdc3Common;
2062
- const utils_1 = utils$2;
2063
- const InteropClient_1 = InteropClient$1;
2064
- const utils_2 = utils$1;
2065
- const PrivateChannelClient_1 = PrivateChannelClient$1;
2066
- const fdc3_channels_2_0_1 = fdc3Channels2_0;
2067
1699
  /**
2068
1700
  * @version 2.0
2069
1701
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -2099,7 +1731,7 @@ const fdc3_channels_2_0_1 = fdc3Channels2_0;
2099
1731
  * }
2100
1732
  * ```
2101
1733
  */
2102
- class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
1734
+ class Fdc3Module2 extends FDC3ModuleBase {
2103
1735
  /**
2104
1736
  * Launches an app, specified via an AppIdentifier object.
2105
1737
  * @param app
@@ -2125,10 +1757,10 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2125
1757
  // we do not want to expose this error, just continue if this analytics-only call fails
2126
1758
  });
2127
1759
  try {
2128
- return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
1760
+ return await InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
2129
1761
  }
2130
1762
  catch (error) {
2131
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error.message;
1763
+ const errorToThrow = error.message === BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error.message;
2132
1764
  throw new Error(errorToThrow);
2133
1765
  }
2134
1766
  }
@@ -2143,10 +1775,10 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2143
1775
  // we do not want to expose this error, just continue if this analytics-only call fails
2144
1776
  });
2145
1777
  try {
2146
- return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
1778
+ return await InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
2147
1779
  }
2148
1780
  catch (error) {
2149
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error.message;
1781
+ const errorToThrow = error.message === BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error.message;
2150
1782
  throw new Error(errorToThrow);
2151
1783
  }
2152
1784
  }
@@ -2197,7 +1829,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2197
1829
  return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
2198
1830
  }
2199
1831
  catch (error) {
2200
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
1832
+ const errorToThrow = error.message === BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
2201
1833
  throw new Error(errorToThrow);
2202
1834
  }
2203
1835
  }
@@ -2214,10 +1846,10 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2214
1846
  });
2215
1847
  const payload = resultType ? { context, metadata: { resultType } } : context;
2216
1848
  try {
2217
- return await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
1849
+ return await InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
2218
1850
  }
2219
1851
  catch (error) {
2220
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
1852
+ const errorToThrow = error.message === BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
2221
1853
  throw new Error(errorToThrow);
2222
1854
  }
2223
1855
  }
@@ -2237,10 +1869,10 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2237
1869
  if (typeof app === 'string') {
2238
1870
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
2239
1871
  }
2240
- return (0, utils_2.getIntentResolution)(this.client, context, app, intent);
1872
+ return getIntentResolution(this.client, context, app, intent);
2241
1873
  }
2242
1874
  catch (error) {
2243
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
1875
+ const errorToThrow = error.message === BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
2244
1876
  throw new Error(errorToThrow);
2245
1877
  }
2246
1878
  }
@@ -2260,10 +1892,10 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2260
1892
  if (typeof app === 'string') {
2261
1893
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
2262
1894
  }
2263
- return (0, utils_2.getIntentResolution)(this.client, context, app);
1895
+ return getIntentResolution(this.client, context, app);
2264
1896
  }
2265
1897
  catch (error) {
2266
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
1898
+ const errorToThrow = error.message === BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
2267
1899
  throw new Error(errorToThrow);
2268
1900
  }
2269
1901
  }
@@ -2315,7 +1947,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2315
1947
  * @tutorial fdc3.getOrCreateChannel
2316
1948
  */
2317
1949
  async getOrCreateChannel(channelId) {
2318
- return super.getOrCreateChannel(channelId, fdc3_channels_2_0_1.createV2Channel);
1950
+ return super.getOrCreateChannel(channelId, createV2Channel);
2319
1951
  }
2320
1952
  /**
2321
1953
  * 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.
@@ -2323,11 +1955,11 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2323
1955
  * @tutorial fdc3v2.createPrivateChannel
2324
1956
  */
2325
1957
  async createPrivateChannel() {
2326
- const channelId = (0, utils_1.generateId)();
2327
- await InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'createPrivateChannelProvider', { channelId });
1958
+ const channelId = generateId();
1959
+ await InteropClient.ferryFdc3Call(this.client, 'createPrivateChannelProvider', { channelId });
2328
1960
  const channelClient = await this.fin.InterApplicationBus.Channel.connect(channelId);
2329
- const newPrivateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
2330
- return (0, utils_2.buildPrivateChannelObject)(newPrivateChannelClient);
1961
+ const newPrivateChannelClient = new PrivateChannelClient(channelClient, channelId);
1962
+ return buildPrivateChannelObject(newPrivateChannelClient);
2331
1963
  }
2332
1964
  /**
2333
1965
  * Retrieves a list of the User Channels available for the app to join.
@@ -2340,7 +1972,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2340
1972
  // this so people know that these APIs are not supported
2341
1973
  return channels.map((channel) => {
2342
1974
  // @ts-expect-error TODO [CORE-1524]
2343
- return { ...channel, type: 'user', ...(0, utils_2.getUnsupportedChannelApis)('User') };
1975
+ return { ...channel, type: 'user', ...getUnsupportedChannelApis('User') };
2344
1976
  });
2345
1977
  }
2346
1978
  /**
@@ -2396,40 +2028,34 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
2396
2028
  * @tutorial fdc3v2.getInfo
2397
2029
  */
2398
2030
  async getInfo() {
2399
- return InteropClient_1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
2031
+ return InteropClient.ferryFdc3Call(this.client, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
2400
2032
  }
2401
2033
  }
2402
- exports.Fdc3Module2 = fdc32_0.Fdc3Module2 = Fdc3Module2;
2403
2034
 
2404
- (function (exports) {
2405
- Object.defineProperty(exports, "__esModule", { value: true });
2406
- exports.getFdc3 = exports.versionMap = void 0;
2407
- /* eslint-disable no-console */
2408
- /* eslint-disable no-param-reassign */
2409
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2410
- const fdc3_1_2_1 = fdc31_2;
2411
- const fdc3_2_0_1 = fdc32_0;
2412
- exports.versionMap = {
2413
- '1.2': fdc3_1_2_1.Fdc3Module,
2414
- '2.0': fdc3_2_0_1.Fdc3Module2
2415
- };
2416
- const latestVersion = '2.0';
2417
- function getFdc3(transport, version = latestVersion) {
2418
- if (!(version in exports.versionMap)) {
2419
- console.warn(`FDC3 API version: ${version} is not supported. Defaulting to latest version: ${latestVersion}.`);
2420
- version = latestVersion;
2421
- }
2422
- const Fdc3Api = exports.versionMap[version];
2423
- const fdc3 = new Fdc3Api(() => transport.getFin().me.interop, transport);
2424
- window.dispatchEvent(new CustomEvent('fdc3Ready'));
2425
- return fdc3;
2426
- }
2427
- exports.getFdc3 = getFdc3;
2428
- } (fdc3));
2035
+ /* eslint-disable no-console */
2036
+ /* eslint-disable no-param-reassign */
2037
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2038
+ const versionMap = {
2039
+ '1.2': Fdc3Module,
2040
+ '2.0': Fdc3Module2
2041
+ };
2042
+ const latestVersion = '2.0';
2043
+ function getFdc3(transport, version = latestVersion) {
2044
+ if (!(version in versionMap)) {
2045
+ console.warn(`FDC3 API version: ${version} is not supported. Defaulting to latest version: ${latestVersion}.`);
2046
+ version = latestVersion;
2047
+ }
2048
+ const Fdc3Api = versionMap[version];
2049
+ const fdc3 = new Fdc3Api(() => transport.getFin().me.interop, transport);
2050
+ window.dispatchEvent(new CustomEvent('fdc3Ready'));
2051
+ return fdc3;
2052
+ }
2429
2053
 
2430
2054
  async function fdc3FromFin(fin, { fdc3Version } = { fdc3Version: '2.0' }) {
2431
2055
  // @ts-expect-error
2432
- return fdc3.getFdc3(fin.wire, fdc3Version);
2056
+ return getFdc3(fin.wire, fdc3Version);
2433
2057
  }
2434
2058
 
2059
+ exports.Fdc3Module = Fdc3Module;
2060
+ exports.Fdc3Module2 = Fdc3Module2;
2435
2061
  exports.fdc3FromFin = fdc3FromFin;