@openfin/core 28.71.19 → 28.71.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OpenFin.d.ts +11 -3
- package/package.json +1 -1
- package/src/api/interop/InteropBroker.d.ts +13 -1
- package/src/api/interop/InteropBroker.js +33 -4
- package/src/api/interop/InteropClient.d.ts +2 -1
- package/src/api/interop/InteropClient.js +7 -2
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +22 -1
- package/src/api/interop/fdc3/fdc3-1.2.js +36 -4
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -0
- package/src/api/interop/fdc3/fdc3-2.0.js +126 -0
- package/src/api/interop/fdc3/fdc3.js +4 -1
- package/src/api/interop/fdc3/utils.d.ts +0 -3
- package/src/api/interop/fdc3/utils.js +1 -8
- package/src/api/interop/utils.d.ts +4 -1
- package/src/api/interop/utils.js +9 -3
- package/src/api/view/Instance.d.ts +16 -0
- package/src/api/view/Instance.js +16 -0
- package/src/api/window/Instance.d.ts +17 -0
- package/src/api/window/Instance.js +17 -0
package/OpenFin.d.ts
CHANGED
|
@@ -524,6 +524,7 @@ declare namespace OpenFin {
|
|
|
524
524
|
experimental: any;
|
|
525
525
|
fdc3InteropApi?: string;
|
|
526
526
|
enableBeforeUnload: boolean;
|
|
527
|
+
accelerator?: Partial<OpenFin.Accelerator>;
|
|
527
528
|
};
|
|
528
529
|
|
|
529
530
|
export type Certificate = {
|
|
@@ -1429,6 +1430,7 @@ declare namespace OpenFin {
|
|
|
1429
1430
|
|
|
1430
1431
|
export type IntentMetadata<TargetType = any> = {
|
|
1431
1432
|
target?: TargetType;
|
|
1433
|
+
resultType?: string;
|
|
1432
1434
|
};
|
|
1433
1435
|
|
|
1434
1436
|
export type IntentHandler = (intent: OpenFin.Intent) => void;
|
|
@@ -1482,9 +1484,15 @@ declare namespace OpenFin {
|
|
|
1482
1484
|
metadata?: MetadataType;
|
|
1483
1485
|
};
|
|
1484
1486
|
|
|
1485
|
-
export type InfoForIntentOptions = {
|
|
1487
|
+
export type InfoForIntentOptions<MetadataType = IntentMetadata> = {
|
|
1486
1488
|
name: string;
|
|
1487
1489
|
context?: OpenFin.Context;
|
|
1490
|
+
metadata?: MetadataType;
|
|
1491
|
+
};
|
|
1492
|
+
|
|
1493
|
+
export type FindIntentsByContextOptions<MetadataType = IntentMetadata> = {
|
|
1494
|
+
context: OpenFin.Context;
|
|
1495
|
+
metadata?: MetadataType;
|
|
1488
1496
|
};
|
|
1489
1497
|
|
|
1490
1498
|
export type ProviderIdentity = Identity & {
|
|
@@ -1693,11 +1701,11 @@ declare namespace OpenFin {
|
|
|
1693
1701
|
export type ExternalApplicationEvents = import('./src/api/events/externalApplication').ExternalApplicationEvents;
|
|
1694
1702
|
|
|
1695
1703
|
export type ContextMenuOptions = {
|
|
1696
|
-
template
|
|
1704
|
+
template?: Array<PrebuiltContextMenuItem>;
|
|
1697
1705
|
enabled?: boolean;
|
|
1698
1706
|
};
|
|
1699
1707
|
|
|
1700
|
-
export type
|
|
1708
|
+
export type PrebuiltContextMenuItem =
|
|
1701
1709
|
| 'separator'
|
|
1702
1710
|
| 'cut'
|
|
1703
1711
|
| 'copy'
|
package/package.json
CHANGED
|
@@ -304,7 +304,7 @@ export declare class InteropBroker extends Base {
|
|
|
304
304
|
* @tutorial interop.handleInfoForIntentsByContext
|
|
305
305
|
* @experimental
|
|
306
306
|
*/
|
|
307
|
-
handleInfoForIntentsByContext(context: OpenFin.Context, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
307
|
+
handleInfoForIntentsByContext(context: OpenFin.Context | OpenFin.FindIntentsByContextOptions, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
308
308
|
/**
|
|
309
309
|
* Responsible for resolving an Intent based on a specific Context.
|
|
310
310
|
* Must be overridden.
|
|
@@ -322,6 +322,18 @@ export declare class InteropBroker extends Base {
|
|
|
322
322
|
* @tutorial interop.clientDisconnected
|
|
323
323
|
*/
|
|
324
324
|
clientDisconnected(clientIdentity: OpenFin.ClientIdentity): Promise<void>;
|
|
325
|
+
/**
|
|
326
|
+
* Responsible for resolving an fdc3.open call.
|
|
327
|
+
* Must be overridden.
|
|
328
|
+
* @param { Fdc3OpenOptions } fdc3OpenOptions fdc3.open options
|
|
329
|
+
* @param { clientIdentity } clientIdentity Identity of the Client making the request.
|
|
330
|
+
*/
|
|
331
|
+
fdc3HandleOpen({ app, context }: {
|
|
332
|
+
app: FDC3.TargetApp;
|
|
333
|
+
context: OpenFin.Context;
|
|
334
|
+
}, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
|
|
335
|
+
fdc3HandleFindInstances(app: FDC3v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
336
|
+
fdc3HandleGetAppMetadata(app: FDC3v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
325
337
|
decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
|
|
326
338
|
applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
|
|
327
339
|
updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
|
|
@@ -513,7 +513,7 @@ class InteropBroker extends base_1.Base {
|
|
|
513
513
|
*/
|
|
514
514
|
// eslint-disable-next-line class-methods-use-this
|
|
515
515
|
async handleFiredIntent(intent, clientIdentity) {
|
|
516
|
-
const warning = utils_1.generateOverrideWarning('
|
|
516
|
+
const warning = utils_1.generateOverrideWarning('fdc3.raiseIntent', 'InteropBroker.handleFiredIntent', clientIdentity, 'interopClient.fireIntent');
|
|
517
517
|
console.warn(warning);
|
|
518
518
|
throw new Error(utils_1.BROKER_ERRORS.fireIntent);
|
|
519
519
|
}
|
|
@@ -571,7 +571,7 @@ class InteropBroker extends base_1.Base {
|
|
|
571
571
|
*/
|
|
572
572
|
// eslint-disable-next-line class-methods-use-this
|
|
573
573
|
async handleInfoForIntent(options, clientIdentity) {
|
|
574
|
-
const warning = utils_1.generateOverrideWarning('
|
|
574
|
+
const warning = utils_1.generateOverrideWarning('fdc3.findIntent', 'InteropBroker.handleInfoForIntent', clientIdentity, 'interopClient.getInfoForIntent');
|
|
575
575
|
console.warn(warning);
|
|
576
576
|
throw new Error(utils_1.BROKER_ERRORS.getInfoForIntent);
|
|
577
577
|
}
|
|
@@ -586,7 +586,7 @@ class InteropBroker extends base_1.Base {
|
|
|
586
586
|
*/
|
|
587
587
|
// eslint-disable-next-line class-methods-use-this
|
|
588
588
|
async handleInfoForIntentsByContext(context, clientIdentity) {
|
|
589
|
-
const warning = utils_1.generateOverrideWarning('
|
|
589
|
+
const warning = utils_1.generateOverrideWarning('fdc3.findIntentsByContext', 'InteropBroker.handleInfoForIntentsByContext', clientIdentity, 'interopClient.getInfoForIntentsByContext');
|
|
590
590
|
console.warn(warning);
|
|
591
591
|
throw new Error(utils_1.BROKER_ERRORS.getInfoForIntentsByContext);
|
|
592
592
|
}
|
|
@@ -601,7 +601,7 @@ class InteropBroker extends base_1.Base {
|
|
|
601
601
|
*/
|
|
602
602
|
// eslint-disable-next-line class-methods-use-this
|
|
603
603
|
async handleFiredIntentForContext(contextForIntent, clientIdentity) {
|
|
604
|
-
const warning = utils_1.generateOverrideWarning('
|
|
604
|
+
const warning = utils_1.generateOverrideWarning('fdc3.raiseIntentForContext', 'InteropBroker.handleFiredIntentForContext', clientIdentity, 'interopClient.fireIntentForContext');
|
|
605
605
|
console.warn(warning);
|
|
606
606
|
throw new Error(utils_1.BROKER_ERRORS.fireIntentForContext);
|
|
607
607
|
}
|
|
@@ -616,6 +616,30 @@ class InteropBroker extends base_1.Base {
|
|
|
616
616
|
// This function is called in channel.onDisconnection.
|
|
617
617
|
// It is meant to be overridden to inform when an Interop Client has been disconnected.
|
|
618
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Responsible for resolving an fdc3.open call.
|
|
621
|
+
* Must be overridden.
|
|
622
|
+
* @param { Fdc3OpenOptions } fdc3OpenOptions fdc3.open options
|
|
623
|
+
* @param { clientIdentity } clientIdentity Identity of the Client making the request.
|
|
624
|
+
*/
|
|
625
|
+
// eslint-disable-next-line class-methods-use-this
|
|
626
|
+
async fdc3HandleOpen({ app, context }, clientIdentity) {
|
|
627
|
+
const warning = utils_1.generateOverrideWarning('fdc3.open', 'InteropBroker.fdc3HandleOpen', clientIdentity);
|
|
628
|
+
console.warn(warning);
|
|
629
|
+
throw new Error(utils_1.BROKER_ERRORS.fdc3Open);
|
|
630
|
+
}
|
|
631
|
+
// eslint-disable-next-line class-methods-use-this
|
|
632
|
+
async fdc3HandleFindInstances(app, clientIdentity) {
|
|
633
|
+
const warning = utils_1.generateOverrideWarning('fdc3.open', 'InteropBroker.fdc3HandleFindInstances', clientIdentity);
|
|
634
|
+
console.warn(warning);
|
|
635
|
+
throw new Error(utils_1.BROKER_ERRORS.fdc3FindInstances);
|
|
636
|
+
}
|
|
637
|
+
// eslint-disable-next-line class-methods-use-this
|
|
638
|
+
async fdc3HandleGetAppMetadata(app, clientIdentity) {
|
|
639
|
+
const warning = utils_1.generateOverrideWarning('fdc3.getAppMetadata', 'InteropBroker.fdc3HandleGetAppMetadata', clientIdentity);
|
|
640
|
+
console.warn(warning);
|
|
641
|
+
throw new Error(utils_1.BROKER_ERRORS.fdc3FindInstances);
|
|
642
|
+
}
|
|
619
643
|
/*
|
|
620
644
|
Snapshot APIs
|
|
621
645
|
*/
|
|
@@ -922,6 +946,11 @@ class InteropBroker extends base_1.Base {
|
|
|
922
946
|
channel.register('intentHandlerRegistered', this.intentHandlerRegistered.bind(this));
|
|
923
947
|
channel.register('removeContextHandler', this.removeContextHandler.bind(this));
|
|
924
948
|
channel.register('sessionContextGroup:createIfNeeded', this.handleJoinSessionContextGroup.bind(this));
|
|
949
|
+
// fdc3 only methods
|
|
950
|
+
channel.register('fdc3Open', this.fdc3HandleOpen.bind(this));
|
|
951
|
+
channel.register('fdc3v2FindIntentsByContext', this.handleInfoForIntentsByContext.bind(this));
|
|
952
|
+
channel.register('fdc3FindInstances', this.fdc3HandleFindInstances.bind(this));
|
|
953
|
+
channel.register('fdc3GetAppMetadata', this.fdc3HandleGetAppMetadata.bind(this));
|
|
925
954
|
}
|
|
926
955
|
/**
|
|
927
956
|
* Can be used to completely prevent a connection. Return false to prevent connections. Allows all connections by default.
|
|
@@ -217,7 +217,7 @@ export declare class InteropClient extends Base {
|
|
|
217
217
|
* @tutorial interop.registerIntentHandler
|
|
218
218
|
* @experimental
|
|
219
219
|
*/
|
|
220
|
-
registerIntentHandler(handler: OpenFin.IntentHandler, intentName: string): Promise<{
|
|
220
|
+
registerIntentHandler(handler: OpenFin.IntentHandler, intentName: string, options?: any): Promise<{
|
|
221
221
|
unsubscribe: () => Promise<void>;
|
|
222
222
|
}>;
|
|
223
223
|
/**
|
|
@@ -272,4 +272,5 @@ export declare class InteropClient extends Base {
|
|
|
272
272
|
* @tutorial interop.onDisconnection
|
|
273
273
|
*/
|
|
274
274
|
onDisconnection(listener: OpenFin.InteropClientOnDisconnectionListener): Promise<void>;
|
|
275
|
+
static ferryFdc3Call(interopClient: OpenFin.InteropClient, action: string, payload: any): Promise<any>;
|
|
275
276
|
}
|
|
@@ -324,7 +324,7 @@ class InteropClient extends base_1.Base {
|
|
|
324
324
|
* @tutorial interop.registerIntentHandler
|
|
325
325
|
* @experimental
|
|
326
326
|
*/
|
|
327
|
-
async registerIntentHandler(handler, intentName) {
|
|
327
|
+
async registerIntentHandler(handler, intentName, options) {
|
|
328
328
|
this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
|
|
329
329
|
// don't expose, this is only for api analytics purposes
|
|
330
330
|
});
|
|
@@ -333,7 +333,7 @@ class InteropClient extends base_1.Base {
|
|
|
333
333
|
const wrappedHandler = utils_1.wrapIntentHandler(handler, handlerId);
|
|
334
334
|
try {
|
|
335
335
|
await client.register(handlerId, wrappedHandler);
|
|
336
|
-
await client.dispatch('intentHandlerRegistered', { handlerId });
|
|
336
|
+
await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
|
|
337
337
|
}
|
|
338
338
|
catch (error) {
|
|
339
339
|
throw new Error('Unable to register intent handler');
|
|
@@ -450,6 +450,11 @@ class InteropClient extends base_1.Base {
|
|
|
450
450
|
listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
+
// used to ferry fdc3-only calls from the fdc3 shim to the Interop Broker
|
|
454
|
+
static async ferryFdc3Call(interopClient, action, payload) {
|
|
455
|
+
const client = await __classPrivateFieldGet(interopClient, _clientPromise);
|
|
456
|
+
return client.dispatch(action, payload);
|
|
457
|
+
}
|
|
453
458
|
}
|
|
454
459
|
exports.InteropClient = InteropClient;
|
|
455
460
|
_clientPromise = new WeakMap(), _sessionContextGroups = new WeakMap();
|
|
@@ -70,6 +70,20 @@ import { Base } from '../../base';
|
|
|
70
70
|
*
|
|
71
71
|
* If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
|
|
72
72
|
*
|
|
73
|
+
* In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
|
|
74
|
+
*
|
|
75
|
+
* ```js
|
|
76
|
+
* function fdc3Action() {
|
|
77
|
+
* // Make some fdc3 API calls here
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* if (window.fdc3) {
|
|
81
|
+
* fdc3Action();
|
|
82
|
+
* } else {
|
|
83
|
+
* window.addEventListener('fdc3Ready', fdc3Action);
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
73
87
|
* @class
|
|
74
88
|
* @alias Fdc3
|
|
75
89
|
* @hideconstructor
|
|
@@ -180,7 +194,14 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
180
194
|
* @tutorial fdc3.getInfo
|
|
181
195
|
*/
|
|
182
196
|
getInfo(): FDC3.ImplementationMetadata;
|
|
183
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Launches an app with target information, which can either be a string or an AppMetadata object.
|
|
199
|
+
* @param { TargetApp } app
|
|
200
|
+
* @param { Context } [context]
|
|
201
|
+
* @return { Promise<void> }
|
|
202
|
+
* @tutorial fdc3.open
|
|
203
|
+
*/
|
|
204
|
+
open(app: FDC3.TargetApp, context?: OpenFin.Context): Promise<void>;
|
|
184
205
|
private getCurrentContextGroupInfo;
|
|
185
206
|
private buildChannelObject;
|
|
186
207
|
private buildAppChannelObject;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const base_1 = require("../../base");
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
const utils_2 = require("../utils");
|
|
6
|
+
const InteropClient_1 = require("../InteropClient");
|
|
6
7
|
/**
|
|
7
8
|
* @typedef { object } Listener
|
|
8
9
|
* @summary Listener object returned by addContextListener and addIntentListener
|
|
@@ -74,6 +75,20 @@ const utils_2 = require("../utils");
|
|
|
74
75
|
*
|
|
75
76
|
* If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
|
|
76
77
|
*
|
|
78
|
+
* In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
|
|
79
|
+
*
|
|
80
|
+
* ```js
|
|
81
|
+
* function fdc3Action() {
|
|
82
|
+
* // Make some fdc3 API calls here
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* if (window.fdc3) {
|
|
86
|
+
* fdc3Action();
|
|
87
|
+
* } else {
|
|
88
|
+
* window.addEventListener('fdc3Ready', fdc3Action);
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
77
92
|
* @class
|
|
78
93
|
* @alias Fdc3
|
|
79
94
|
* @hideconstructor
|
|
@@ -200,7 +215,9 @@ class Fdc3Module extends base_1.Base {
|
|
|
200
215
|
const contextHandler = (raisedIntent) => {
|
|
201
216
|
handler(raisedIntent.context);
|
|
202
217
|
};
|
|
203
|
-
const listener = this.fin.me.interop.registerIntentHandler(contextHandler, intent
|
|
218
|
+
const listener = this.fin.me.interop.registerIntentHandler(contextHandler, intent, {
|
|
219
|
+
fdc3Version: '1.2'
|
|
220
|
+
});
|
|
204
221
|
return {
|
|
205
222
|
...listener,
|
|
206
223
|
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
@@ -333,9 +350,24 @@ class Fdc3Module extends base_1.Base {
|
|
|
333
350
|
providerVersion: runtimeVersion
|
|
334
351
|
};
|
|
335
352
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Launches an app with target information, which can either be a string or an AppMetadata object.
|
|
355
|
+
* @param { TargetApp } app
|
|
356
|
+
* @param { Context } [context]
|
|
357
|
+
* @return { Promise<void> }
|
|
358
|
+
* @tutorial fdc3.open
|
|
359
|
+
*/
|
|
360
|
+
async open(app, context) {
|
|
361
|
+
this.wire.sendAction('fdc3-open').catch((e) => {
|
|
362
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
363
|
+
});
|
|
364
|
+
try {
|
|
365
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3Open', { app, context });
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error;
|
|
369
|
+
throw new Error(errorToThrow);
|
|
370
|
+
}
|
|
339
371
|
}
|
|
340
372
|
// utils
|
|
341
373
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Base } from '../../base';
|
|
2
|
+
import Transport from '../../../transport/transport';
|
|
3
|
+
export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
4
|
+
private fdc3Module;
|
|
5
|
+
constructor(wire: Transport);
|
|
6
|
+
open(app: FDC3v2.AppIdentifier | FDC3.TargetApp, context?: OpenFin.Context): Promise<FDC3v2.AppIdentifier | void>;
|
|
7
|
+
findInstances(app: FDC3v2.AppIdentifier): Promise<Array<FDC3v2.AppIdentifier>>;
|
|
8
|
+
getAppMetadata(app: FDC3v2.AppIdentifier): Promise<FDC3.AppMetadata>;
|
|
9
|
+
broadcast(context: OpenFin.Context): Promise<void>;
|
|
10
|
+
addContextListener(contextType: string | null, handler: OpenFin.ContextHandler): Promise<FDC3.Listener>;
|
|
11
|
+
findIntent(intent: string, context?: OpenFin.Context, resultType?: string): Promise<FDC3.AppIntent>;
|
|
12
|
+
findIntentsByContext(context: OpenFin.Context, resultType?: string): Promise<Array<FDC3.AppIntent>>;
|
|
13
|
+
raiseIntent(intent: string, context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3.IntentResolution>;
|
|
14
|
+
raiseIntentForContext(context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3.IntentResolution>;
|
|
15
|
+
addIntentListener(intent: string, handler: FDC3v2.IntentHandler): Promise<FDC3.Listener>;
|
|
16
|
+
getOrCreateChannel(channelId: string): Promise<FDC3.Channel>;
|
|
17
|
+
createPrivateChannel(): Promise<FDC3v2.PrivateChannel | void>;
|
|
18
|
+
getUserChannels(): Promise<Array<OpenFin.ContextGroupInfo>>;
|
|
19
|
+
getSystemChannels(): Promise<Array<OpenFin.ContextGroupInfo>>;
|
|
20
|
+
joinUserChannel(channelId: string): Promise<void>;
|
|
21
|
+
getCurrentChannel(): Promise<FDC3.Channel | null>;
|
|
22
|
+
leaveCurrentChannel(): Promise<void>;
|
|
23
|
+
getInfo(): Promise<FDC3.ImplementationMetadata>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// THIS IS NOT PRODUCTION-READY. Until we implement the missing features: getResult, Private Channels and Instance Management we should not document this.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const InteropClient_1 = require("../InteropClient");
|
|
7
|
+
const fdc3_1_2_1 = require("./fdc3-1.2");
|
|
8
|
+
class Fdc3Module2 extends base_1.Base {
|
|
9
|
+
constructor(wire) {
|
|
10
|
+
super(wire);
|
|
11
|
+
// we get the module for fdc 1.2 here so we can reuse it wherever we can
|
|
12
|
+
this.fdc3Module = new fdc3_1_2_1.default(this.wire);
|
|
13
|
+
}
|
|
14
|
+
async open(app, context) {
|
|
15
|
+
return this.fdc3Module.open(app, context);
|
|
16
|
+
}
|
|
17
|
+
async findInstances(app) {
|
|
18
|
+
this.wire.sendAction('fdc3-find-instances').catch((e) => {
|
|
19
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3FindInstances', app);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error;
|
|
26
|
+
throw new Error(errorToThrow);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async getAppMetadata(app) {
|
|
30
|
+
this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
|
|
31
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3GetAppMetadata', app);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error;
|
|
38
|
+
throw new Error(errorToThrow);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async broadcast(context) {
|
|
42
|
+
return this.fdc3Module.broadcast(context);
|
|
43
|
+
}
|
|
44
|
+
async addContextListener(contextType, handler) {
|
|
45
|
+
this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
|
|
46
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
47
|
+
});
|
|
48
|
+
let listener;
|
|
49
|
+
if (typeof contextType === 'function') {
|
|
50
|
+
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
51
|
+
listener = await this.fin.me.interop.addContextHandler(contextType);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
listener = await this.fin.me.interop.addContextHandler(handler, contextType === null ? undefined : contextType);
|
|
55
|
+
}
|
|
56
|
+
return listener;
|
|
57
|
+
}
|
|
58
|
+
async findIntent(intent, context, resultType) {
|
|
59
|
+
this.wire.sendAction('fdc3-find-intent').catch((e) => {
|
|
60
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
return await this.fin.me.interop.getInfoForIntent({ name: intent, context, metadata: { resultType } });
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error;
|
|
67
|
+
throw new Error(errorToThrow);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async findIntentsByContext(context, resultType) {
|
|
71
|
+
this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
|
|
72
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
73
|
+
});
|
|
74
|
+
try {
|
|
75
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2FindIntentsByContext', {
|
|
76
|
+
context,
|
|
77
|
+
resultType
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
|
|
82
|
+
throw new Error(errorToThrow);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async raiseIntent(intent, context, app) {
|
|
86
|
+
return this.fdc3Module.raiseIntent(intent, context, app);
|
|
87
|
+
}
|
|
88
|
+
async raiseIntentForContext(context, app) {
|
|
89
|
+
return this.fdc3Module.raiseIntentForContext(context, app);
|
|
90
|
+
}
|
|
91
|
+
async addIntentListener(intent, handler) {
|
|
92
|
+
this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
|
|
93
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
94
|
+
});
|
|
95
|
+
const contextHandler = (raisedIntent) => {
|
|
96
|
+
handler(raisedIntent.context);
|
|
97
|
+
};
|
|
98
|
+
return this.fin.me.interop.registerIntentHandler(contextHandler, intent, { fdc3Version: '2.0' });
|
|
99
|
+
}
|
|
100
|
+
async getOrCreateChannel(channelId) {
|
|
101
|
+
return this.fdc3Module.getOrCreateChannel(channelId);
|
|
102
|
+
}
|
|
103
|
+
// eslint-disable-next-line class-methods-use-this
|
|
104
|
+
async createPrivateChannel() {
|
|
105
|
+
// private channels will be implemented in another PR
|
|
106
|
+
}
|
|
107
|
+
async getUserChannels() {
|
|
108
|
+
return this.fdc3Module.getSystemChannels();
|
|
109
|
+
}
|
|
110
|
+
async getSystemChannels() {
|
|
111
|
+
return this.fdc3Module.getSystemChannels();
|
|
112
|
+
}
|
|
113
|
+
async joinUserChannel(channelId) {
|
|
114
|
+
return this.fdc3Module.joinChannel(channelId);
|
|
115
|
+
}
|
|
116
|
+
async getCurrentChannel() {
|
|
117
|
+
return this.fdc3Module.getCurrentChannel();
|
|
118
|
+
}
|
|
119
|
+
async leaveCurrentChannel() {
|
|
120
|
+
return this.leaveCurrentChannel();
|
|
121
|
+
}
|
|
122
|
+
async getInfo() {
|
|
123
|
+
return this.fdc3Module.getInfo();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.default = Fdc3Module2;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerFdc3Shim = exports.versionMap = void 0;
|
|
4
4
|
const fdc3_1_2_1 = require("./fdc3-1.2");
|
|
5
|
+
const fdc3_2_0_1 = require("./fdc3-2.0");
|
|
5
6
|
exports.versionMap = {
|
|
6
|
-
'1.2': fdc3_1_2_1.default
|
|
7
|
+
'1.2': fdc3_1_2_1.default,
|
|
8
|
+
'2.0': fdc3_2_0_1.default
|
|
7
9
|
};
|
|
8
10
|
function registerFdc3Shim(version, transport) {
|
|
9
11
|
if (Object.keys(exports.versionMap).includes(version)) {
|
|
10
12
|
const Api = exports.versionMap[version];
|
|
11
13
|
window.fdc3 = new Api(transport);
|
|
14
|
+
window.dispatchEvent(new CustomEvent('fdc3Ready'));
|
|
12
15
|
}
|
|
13
16
|
else {
|
|
14
17
|
console.error(`FDC3 API version ${version} is not supported`);
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedChannelApiError =
|
|
4
|
-
class UnsupportedError extends Error {
|
|
5
|
-
constructor(apiName) {
|
|
6
|
-
super(apiName);
|
|
7
|
-
this.message = `${apiName} is not a supported API`;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.UnsupportedError = UnsupportedError;
|
|
3
|
+
exports.UnsupportedChannelApiError = void 0;
|
|
11
4
|
class UnsupportedChannelApiError extends Error {
|
|
12
5
|
constructor(apiName) {
|
|
13
6
|
super(apiName);
|
|
@@ -2,12 +2,15 @@ export declare const generateId: () => string;
|
|
|
2
2
|
export declare const wrapInTryCatch: <T>(f: (...args: any[]) => T, prefix?: string) => (...args: any[]) => T;
|
|
3
3
|
export declare const wrapContextHandler: (handler: OpenFin.ContextHandler, handlerId: string) => (context: OpenFin.Context) => Promise<void>;
|
|
4
4
|
export declare const generateOverrideError: (clientApi: string, brokerApi: string) => string;
|
|
5
|
-
export declare const generateOverrideWarning: (
|
|
5
|
+
export declare const generateOverrideWarning: (fdc3ClientApi: string, brokerApi: string, identity: OpenFin.ClientIdentity, interopClientApi?: string) => string;
|
|
6
6
|
export declare const BROKER_ERRORS: {
|
|
7
7
|
fireIntent: string;
|
|
8
8
|
fireIntentForContext: string;
|
|
9
9
|
getInfoForIntent: string;
|
|
10
10
|
getInfoForIntentsByContext: string;
|
|
11
11
|
joinSessionContextGroupWithJoinContextGroup: string;
|
|
12
|
+
fdc3Open: string;
|
|
13
|
+
fdc3FindInstances: string;
|
|
14
|
+
fdc3GetAppMetadata: string;
|
|
12
15
|
};
|
|
13
16
|
export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
|
package/src/api/interop/utils.js
CHANGED
|
@@ -24,16 +24,22 @@ exports.wrapContextHandler = (handler, handlerId) => {
|
|
|
24
24
|
exports.generateOverrideError = (clientApi, brokerApi) => {
|
|
25
25
|
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.`;
|
|
26
26
|
};
|
|
27
|
-
exports.generateOverrideWarning = (
|
|
27
|
+
exports.generateOverrideWarning = (fdc3ClientApi, brokerApi, identity, interopClientApi) => {
|
|
28
28
|
const { uuid, name } = identity;
|
|
29
|
-
|
|
29
|
+
const message = interopClientApi
|
|
30
|
+
? `Entity with identity: ${uuid}/${name} has called ${interopClientApi} or ${fdc3ClientApi} but ${brokerApi} has not been overridden.`
|
|
31
|
+
: `Entity with identity: ${uuid}/${name} has called ${fdc3ClientApi} but ${brokerApi} has not been overridden.`;
|
|
32
|
+
return message;
|
|
30
33
|
};
|
|
31
34
|
exports.BROKER_ERRORS = {
|
|
32
35
|
fireIntent: exports.generateOverrideError('fireIntent', 'handleFiredIntent'),
|
|
33
36
|
fireIntentForContext: exports.generateOverrideError('fireIntentForContext', 'handleFiredIntentForContext'),
|
|
34
37
|
getInfoForIntent: exports.generateOverrideError('getInfoForIntent', 'handleInfoForIntent'),
|
|
35
38
|
getInfoForIntentsByContext: exports.generateOverrideError('getInfoForIntentsByContext', 'handleInfoForIntentsByContext'),
|
|
36
|
-
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.'
|
|
39
|
+
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.',
|
|
40
|
+
fdc3Open: exports.generateOverrideError('fdc3.open', 'fdc3HandleOpen'),
|
|
41
|
+
fdc3FindInstances: exports.generateOverrideError('fdc3.findInstances', 'fdc3HandleFindInstances'),
|
|
42
|
+
fdc3GetAppMetadata: exports.generateOverrideError('fdc3.getAppMetadata', 'fdc3HandleGetAppMetadata')
|
|
37
43
|
};
|
|
38
44
|
exports.wrapIntentHandler = (handler, handlerId) => {
|
|
39
45
|
return async (intent) => {
|
|
@@ -51,11 +51,27 @@ import UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
|
51
51
|
* @property {string[]} [contentRedirect.blacklist=[]] List of blacklisted URLs.
|
|
52
52
|
*
|
|
53
53
|
* @property {object} [contextMenuSettings] - _Updatable._
|
|
54
|
+
* Deprecated - superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax.
|
|
54
55
|
* Configure the context menu when right-clicking on a view.
|
|
55
56
|
* @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
|
|
56
57
|
* @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
|
|
57
58
|
* @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
|
|
58
59
|
*
|
|
60
|
+
* @property {object} [contextMenuOptions] - _Updatable._
|
|
61
|
+
* Configure the context menu when right-clicking on a view. Supported menu items:
|
|
62
|
+
* 'separator'
|
|
63
|
+
* 'cut'
|
|
64
|
+
* 'copy'
|
|
65
|
+
* 'paste'
|
|
66
|
+
* 'spellCheck'
|
|
67
|
+
* 'inspect'
|
|
68
|
+
* 'reload'
|
|
69
|
+
* 'navigateForward'
|
|
70
|
+
* 'navigateBack'
|
|
71
|
+
* 'print'
|
|
72
|
+
* @property {boolean} [contextMenuOptions.enabled = true] Should the context menu display on right click.
|
|
73
|
+
* @property {string[]} [contextMenuOptions.template=[]] List of context menu items to display on right-click.
|
|
74
|
+
*
|
|
59
75
|
* @property {any} [customData=""] - _Updatable._
|
|
60
76
|
* A field that the user can attach serializable data to be ferried around with the view options.
|
|
61
77
|
* _When omitted, the default value of this property is the empty string (`""`)._
|
package/src/api/view/Instance.js
CHANGED
|
@@ -54,11 +54,27 @@ const window_1 = require("../window");
|
|
|
54
54
|
* @property {string[]} [contentRedirect.blacklist=[]] List of blacklisted URLs.
|
|
55
55
|
*
|
|
56
56
|
* @property {object} [contextMenuSettings] - _Updatable._
|
|
57
|
+
* Deprecated - superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax.
|
|
57
58
|
* Configure the context menu when right-clicking on a view.
|
|
58
59
|
* @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
|
|
59
60
|
* @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
|
|
60
61
|
* @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
|
|
61
62
|
*
|
|
63
|
+
* @property {object} [contextMenuOptions] - _Updatable._
|
|
64
|
+
* Configure the context menu when right-clicking on a view. Supported menu items:
|
|
65
|
+
* 'separator'
|
|
66
|
+
* 'cut'
|
|
67
|
+
* 'copy'
|
|
68
|
+
* 'paste'
|
|
69
|
+
* 'spellCheck'
|
|
70
|
+
* 'inspect'
|
|
71
|
+
* 'reload'
|
|
72
|
+
* 'navigateForward'
|
|
73
|
+
* 'navigateBack'
|
|
74
|
+
* 'print'
|
|
75
|
+
* @property {boolean} [contextMenuOptions.enabled = true] Should the context menu display on right click.
|
|
76
|
+
* @property {string[]} [contextMenuOptions.template=[]] List of context menu items to display on right-click.
|
|
77
|
+
*
|
|
62
78
|
* @property {any} [customData=""] - _Updatable._
|
|
63
79
|
* A field that the user can attach serializable data to be ferried around with the view options.
|
|
64
80
|
* _When omitted, the default value of this property is the empty string (`""`)._
|
|
@@ -84,6 +84,7 @@ import WindowEvents = OpenFin.WindowEvents;
|
|
|
84
84
|
* `Command` + `Shift` + `R` _(Mac)_
|
|
85
85
|
*
|
|
86
86
|
* @property {boolean} [accelerator.zoom=false]
|
|
87
|
+
* NOTE: It is not recommended to set this value to true for Windows in Platforms as that may lead to unexpected visual shifts in layout.
|
|
87
88
|
* If `true`, enables the zoom keyboard shortcuts:<br>
|
|
88
89
|
* `Ctrl` + `+` _(Zoom In)_<br>
|
|
89
90
|
* `Ctrl` + `Shift` + `+` _(Zoom In)_<br>
|
|
@@ -160,11 +161,27 @@ import WindowEvents = OpenFin.WindowEvents;
|
|
|
160
161
|
* Gives access to the devtools for the window.
|
|
161
162
|
*
|
|
162
163
|
* @property {object} [contextMenuSettings] - _Updatable._
|
|
164
|
+
* Deprecated - superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax.
|
|
163
165
|
* Configure the context menu when right-clicking on a window.
|
|
164
166
|
* @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
|
|
165
167
|
* @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
|
|
166
168
|
* @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
|
|
167
169
|
*
|
|
170
|
+
* @property {object} [contextMenuOptions] - _Updatable._
|
|
171
|
+
* Configure the context menu when right-clicking on a window. Supported menu items:
|
|
172
|
+
* 'separator'
|
|
173
|
+
* 'cut'
|
|
174
|
+
* 'copy'
|
|
175
|
+
* 'paste'
|
|
176
|
+
* 'spellCheck'
|
|
177
|
+
* 'inspect'
|
|
178
|
+
* 'reload'
|
|
179
|
+
* 'navigateForward'
|
|
180
|
+
* 'navigateBack'
|
|
181
|
+
* 'print'
|
|
182
|
+
* @property {boolean} [contextMenuOptions.enabled = true] Should the context menu display on right click.
|
|
183
|
+
* @property {string[]} [contextMenuSettings.template=[]] List of context menu items to display on right-click.
|
|
184
|
+
*
|
|
168
185
|
* @property {object} [cornerRounding] - _Updatable._
|
|
169
186
|
* Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the
|
|
170
187
|
* average of _height_ and _width_.
|
|
@@ -91,6 +91,7 @@ const view_1 = require("../view");
|
|
|
91
91
|
* `Command` + `Shift` + `R` _(Mac)_
|
|
92
92
|
*
|
|
93
93
|
* @property {boolean} [accelerator.zoom=false]
|
|
94
|
+
* NOTE: It is not recommended to set this value to true for Windows in Platforms as that may lead to unexpected visual shifts in layout.
|
|
94
95
|
* If `true`, enables the zoom keyboard shortcuts:<br>
|
|
95
96
|
* `Ctrl` + `+` _(Zoom In)_<br>
|
|
96
97
|
* `Ctrl` + `Shift` + `+` _(Zoom In)_<br>
|
|
@@ -167,11 +168,27 @@ const view_1 = require("../view");
|
|
|
167
168
|
* Gives access to the devtools for the window.
|
|
168
169
|
*
|
|
169
170
|
* @property {object} [contextMenuSettings] - _Updatable._
|
|
171
|
+
* Deprecated - superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax.
|
|
170
172
|
* Configure the context menu when right-clicking on a window.
|
|
171
173
|
* @property {boolean} [contextMenuSettings.enable=true] Should the context menu display on right click.
|
|
172
174
|
* @property {boolean} [contextMenuSettings.devtools=true] Should the context menu contain a button for opening devtools.
|
|
173
175
|
* @property {boolean} [contextMenuSettings.reload=true] Should the context menu contain a button for reloading the page.
|
|
174
176
|
*
|
|
177
|
+
* @property {object} [contextMenuOptions] - _Updatable._
|
|
178
|
+
* Configure the context menu when right-clicking on a window. Supported menu items:
|
|
179
|
+
* 'separator'
|
|
180
|
+
* 'cut'
|
|
181
|
+
* 'copy'
|
|
182
|
+
* 'paste'
|
|
183
|
+
* 'spellCheck'
|
|
184
|
+
* 'inspect'
|
|
185
|
+
* 'reload'
|
|
186
|
+
* 'navigateForward'
|
|
187
|
+
* 'navigateBack'
|
|
188
|
+
* 'print'
|
|
189
|
+
* @property {boolean} [contextMenuOptions.enabled = true] Should the context menu display on right click.
|
|
190
|
+
* @property {string[]} [contextMenuSettings.template=[]] List of context menu items to display on right-click.
|
|
191
|
+
*
|
|
175
192
|
* @property {object} [cornerRounding] - _Updatable._
|
|
176
193
|
* Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the
|
|
177
194
|
* average of _height_ and _width_.
|