@openfin/core 28.72.10 → 28.72.13
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 +45 -35
- package/package.json +1 -1
- package/src/api/interop/InteropBroker.d.ts +1 -3
- package/src/api/interop/InteropBroker.js +0 -15
- package/src/api/interop/InteropClient.d.ts +1 -1
- package/src/api/interop/InteropClient.js +2 -2
- package/src/api/interop/fdc3/fdc3-1.2.js +1 -3
- package/src/api/interop/fdc3/fdc3.js +1 -3
- package/src/api/interop/utils.d.ts +0 -2
- package/src/api/interop/utils.js +1 -3
- package/src/api/platform/layout/Instance.d.ts +1 -1
- package/src/api/window/Instance.d.ts +3 -0
- package/src/api/window/Instance.js +3 -0
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -24
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -126
package/OpenFin.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ declare namespace OpenFin {
|
|
|
154
154
|
| 'resizable'
|
|
155
155
|
| 'resizeRegion'
|
|
156
156
|
| 'saveWindowState'
|
|
157
|
+
| 'ignoreSavedWindowState'
|
|
157
158
|
| 'shadow'
|
|
158
159
|
| 'showTaskbarIcon'
|
|
159
160
|
| 'smallWindow'
|
|
@@ -254,13 +255,13 @@ declare namespace OpenFin {
|
|
|
254
255
|
|
|
255
256
|
export type WindowOptions = MutableWindowOptions & ConstWindowOptions;
|
|
256
257
|
|
|
257
|
-
export type ViewVisibilityOption = {
|
|
258
|
+
export type ViewVisibilityOption = {
|
|
258
259
|
enabled?: boolean;
|
|
259
|
-
}
|
|
260
|
+
};
|
|
260
261
|
|
|
261
|
-
export type ShowViewOnWindowResizeOptions =
|
|
262
|
+
export type ShowViewOnWindowResizeOptions = ViewVisibilityOption & {
|
|
262
263
|
paintIntervalMs?: number;
|
|
263
|
-
}
|
|
264
|
+
};
|
|
264
265
|
|
|
265
266
|
export type ViewVisibilityOptions = {
|
|
266
267
|
showViewsOnWindowResize?: ShowViewOnWindowResizeOptions;
|
|
@@ -289,12 +290,13 @@ declare namespace OpenFin {
|
|
|
289
290
|
height: number;
|
|
290
291
|
hideOnClose: boolean;
|
|
291
292
|
includeInSnapshots: boolean;
|
|
292
|
-
layout:
|
|
293
|
+
layout: LayoutOptions;
|
|
293
294
|
modalParentIdentity: Identity;
|
|
294
295
|
name: string;
|
|
295
296
|
preloadScripts: PreloadScript[];
|
|
296
297
|
processAffinity: string;
|
|
297
298
|
saveWindowState: boolean;
|
|
299
|
+
ignoreSavedWindowState: boolean;
|
|
298
300
|
shadow: boolean;
|
|
299
301
|
smallWindow: boolean;
|
|
300
302
|
state: WindowState;
|
|
@@ -729,35 +731,50 @@ declare namespace OpenFin {
|
|
|
729
731
|
};
|
|
730
732
|
};
|
|
731
733
|
|
|
734
|
+
export type LayoutContent = (LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent)[];
|
|
735
|
+
|
|
736
|
+
export type LayoutItemConfig = {
|
|
737
|
+
type: string;
|
|
738
|
+
content?: LayoutContent;
|
|
739
|
+
width?: number;
|
|
740
|
+
height?: number;
|
|
741
|
+
id?: string | string[];
|
|
742
|
+
isClosable?: boolean;
|
|
743
|
+
title?: string;
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
export interface LayoutRow extends LayoutItemConfig {
|
|
747
|
+
type: 'row';
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export interface LayoutColumn extends LayoutItemConfig {
|
|
751
|
+
type: 'column';
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export interface LayoutComponent extends LayoutItemConfig {
|
|
755
|
+
componentName: 'view';
|
|
756
|
+
componentState?: Partial<ViewCreationOptions>;
|
|
757
|
+
}
|
|
758
|
+
|
|
732
759
|
export type LayoutOptions = {
|
|
733
|
-
settings
|
|
760
|
+
settings?: {
|
|
734
761
|
popoutWholeStack?: boolean;
|
|
735
762
|
constrainDragToContainer?: boolean;
|
|
736
763
|
showPopoutIcon?: boolean;
|
|
737
764
|
showMaximiseIcon?: boolean;
|
|
738
765
|
showCloseIcon?: boolean;
|
|
739
766
|
constrainDragToHeaders?: boolean;
|
|
767
|
+
hasHeaders?: boolean;
|
|
768
|
+
reorderEnabled?: boolean;
|
|
769
|
+
preventDragOut?: boolean;
|
|
770
|
+
preventDragIn?: boolean;
|
|
740
771
|
};
|
|
741
|
-
content
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
type: 'row';
|
|
748
|
-
content: LayoutContent;
|
|
749
|
-
};
|
|
750
|
-
export type LayoutColumn = {
|
|
751
|
-
type: 'column';
|
|
752
|
-
content: LayoutContent;
|
|
753
|
-
};
|
|
754
|
-
export type LayoutComponent = {
|
|
755
|
-
type: 'component';
|
|
756
|
-
componentName: 'view';
|
|
757
|
-
componentState: {
|
|
758
|
-
name: string;
|
|
759
|
-
url: string;
|
|
760
|
-
title?: string;
|
|
772
|
+
content?: LayoutContent;
|
|
773
|
+
dimensions?: {
|
|
774
|
+
borderWidth?: number;
|
|
775
|
+
minItemHeight?: number;
|
|
776
|
+
minItemWidth?: number;
|
|
777
|
+
headerHeight?: number;
|
|
761
778
|
};
|
|
762
779
|
};
|
|
763
780
|
|
|
@@ -1431,7 +1448,6 @@ declare namespace OpenFin {
|
|
|
1431
1448
|
|
|
1432
1449
|
export type IntentMetadata<TargetType = any> = {
|
|
1433
1450
|
target?: TargetType;
|
|
1434
|
-
resultType?: string;
|
|
1435
1451
|
};
|
|
1436
1452
|
|
|
1437
1453
|
export type IntentHandler = (intent: OpenFin.Intent) => void;
|
|
@@ -1485,15 +1501,9 @@ declare namespace OpenFin {
|
|
|
1485
1501
|
metadata?: MetadataType;
|
|
1486
1502
|
};
|
|
1487
1503
|
|
|
1488
|
-
export type InfoForIntentOptions
|
|
1504
|
+
export type InfoForIntentOptions = {
|
|
1489
1505
|
name: string;
|
|
1490
1506
|
context?: OpenFin.Context;
|
|
1491
|
-
metadata?: MetadataType;
|
|
1492
|
-
};
|
|
1493
|
-
|
|
1494
|
-
export type FindIntentsByContextOptions<MetadataType = IntentMetadata> = {
|
|
1495
|
-
context: OpenFin.Context;
|
|
1496
|
-
metadata?: MetadataType;
|
|
1497
1507
|
};
|
|
1498
1508
|
|
|
1499
1509
|
export type ProviderIdentity = Identity & {
|
|
@@ -1555,7 +1565,7 @@ declare namespace OpenFin {
|
|
|
1555
1565
|
topic: string,
|
|
1556
1566
|
payload: unknown,
|
|
1557
1567
|
senderIdentity: ProviderIdentity | OpenFin.ClientIdentity
|
|
1558
|
-
) => Promise<unknown> |unknown;
|
|
1568
|
+
) => Promise<unknown> | unknown;
|
|
1559
1569
|
|
|
1560
1570
|
export type ErrorMiddleware = (
|
|
1561
1571
|
topic: string,
|
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
|
|
307
|
+
handleInfoForIntentsByContext(context: OpenFin.Context, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
308
308
|
/**
|
|
309
309
|
* Responsible for resolving an Intent based on a specific Context.
|
|
310
310
|
* Must be overridden.
|
|
@@ -332,8 +332,6 @@ export declare class InteropBroker extends Base {
|
|
|
332
332
|
app: FDC3.TargetApp;
|
|
333
333
|
context: OpenFin.Context;
|
|
334
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>;
|
|
337
335
|
decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
|
|
338
336
|
applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
|
|
339
337
|
updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
|
|
@@ -628,18 +628,6 @@ class InteropBroker extends base_1.Base {
|
|
|
628
628
|
console.warn(warning);
|
|
629
629
|
throw new Error(utils_1.BROKER_ERRORS.fdc3Open);
|
|
630
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
|
-
}
|
|
643
631
|
/*
|
|
644
632
|
Snapshot APIs
|
|
645
633
|
*/
|
|
@@ -948,9 +936,6 @@ class InteropBroker extends base_1.Base {
|
|
|
948
936
|
channel.register('sessionContextGroup:createIfNeeded', this.handleJoinSessionContextGroup.bind(this));
|
|
949
937
|
// fdc3 only methods
|
|
950
938
|
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));
|
|
954
939
|
}
|
|
955
940
|
/**
|
|
956
941
|
* 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
|
|
220
|
+
registerIntentHandler(handler: OpenFin.IntentHandler, intentName: string): Promise<{
|
|
221
221
|
unsubscribe: () => Promise<void>;
|
|
222
222
|
}>;
|
|
223
223
|
/**
|
|
@@ -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) {
|
|
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 });
|
|
337
337
|
}
|
|
338
338
|
catch (error) {
|
|
339
339
|
throw new Error('Unable to register intent handler');
|
|
@@ -215,9 +215,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
215
215
|
const contextHandler = (raisedIntent) => {
|
|
216
216
|
handler(raisedIntent.context);
|
|
217
217
|
};
|
|
218
|
-
const listener = this.fin.me.interop.registerIntentHandler(contextHandler, intent
|
|
219
|
-
fdc3Version: '1.2'
|
|
220
|
-
});
|
|
218
|
+
const listener = this.fin.me.interop.registerIntentHandler(contextHandler, intent);
|
|
221
219
|
return {
|
|
222
220
|
...listener,
|
|
223
221
|
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
@@ -2,10 +2,8 @@
|
|
|
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");
|
|
6
5
|
exports.versionMap = {
|
|
7
|
-
'1.2': fdc3_1_2_1.default
|
|
8
|
-
'2.0': fdc3_2_0_1.default
|
|
6
|
+
'1.2': fdc3_1_2_1.default
|
|
9
7
|
};
|
|
10
8
|
function registerFdc3Shim(version, transport) {
|
|
11
9
|
if (Object.keys(exports.versionMap).includes(version)) {
|
|
@@ -10,7 +10,5 @@ export declare const BROKER_ERRORS: {
|
|
|
10
10
|
getInfoForIntentsByContext: string;
|
|
11
11
|
joinSessionContextGroupWithJoinContextGroup: string;
|
|
12
12
|
fdc3Open: string;
|
|
13
|
-
fdc3FindInstances: string;
|
|
14
|
-
fdc3GetAppMetadata: string;
|
|
15
13
|
};
|
|
16
14
|
export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
|
package/src/api/interop/utils.js
CHANGED
|
@@ -37,9 +37,7 @@ exports.BROKER_ERRORS = {
|
|
|
37
37
|
getInfoForIntent: exports.generateOverrideError('getInfoForIntent', 'handleInfoForIntent'),
|
|
38
38
|
getInfoForIntentsByContext: exports.generateOverrideError('getInfoForIntentsByContext', 'handleInfoForIntentsByContext'),
|
|
39
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')
|
|
40
|
+
fdc3Open: exports.generateOverrideError('fdc3.open', 'fdc3HandleOpen')
|
|
43
41
|
};
|
|
44
42
|
exports.wrapIntentHandler = (handler, handlerId) => {
|
|
45
43
|
return async (intent) => {
|
|
@@ -26,7 +26,7 @@ export declare class Layout extends Base {
|
|
|
26
26
|
* @return { Promise<void> }
|
|
27
27
|
* @tutorial Layout.replace
|
|
28
28
|
*/
|
|
29
|
-
replace: (layout:
|
|
29
|
+
replace: (layout: OpenFin.LayoutOptions) => Promise<void>;
|
|
30
30
|
/**
|
|
31
31
|
* Replaces the specified view with a view with the provided configuration.
|
|
32
32
|
* The old view is stripped of its listeners and either closed or attached to the provider window
|
|
@@ -307,6 +307,9 @@ import WindowEvents = OpenFin.WindowEvents;
|
|
|
307
307
|
* A flag to cache the location of the window.
|
|
308
308
|
* ** note ** - This option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior.
|
|
309
309
|
*
|
|
310
|
+
* @property {boolean} [ignoreSavedWindowState]
|
|
311
|
+
* A flag to ignore previously cached state of the window. It defaults the opposite value of `saveWindowState` to maintain backwards compatibility.
|
|
312
|
+
*
|
|
310
313
|
* @property {boolean} [shadow=false]
|
|
311
314
|
* A flag to display a shadow on frameless windows.
|
|
312
315
|
* `shadow` and `cornerRounding` are mutually exclusive.
|
|
@@ -314,6 +314,9 @@ const view_1 = require("../view");
|
|
|
314
314
|
* A flag to cache the location of the window.
|
|
315
315
|
* ** note ** - This option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior.
|
|
316
316
|
*
|
|
317
|
+
* @property {boolean} [ignoreSavedWindowState]
|
|
318
|
+
* A flag to ignore previously cached state of the window. It defaults the opposite value of `saveWindowState` to maintain backwards compatibility.
|
|
319
|
+
*
|
|
317
320
|
* @property {boolean} [shadow=false]
|
|
318
321
|
* A flag to display a shadow on frameless windows.
|
|
319
322
|
* `shadow` and `cornerRounding` are mutually exclusive.
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
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;
|