@openfin/core 33.76.31 → 33.76.38
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 +1 -1
- package/README.md +29 -4
- package/fin.d.ts +2 -2
- package/{src → out}/GlobalOpenFin.d.ts +1 -1
- package/out/mock-alpha.d.ts +16112 -0
- package/out/mock-beta.d.ts +16112 -0
- package/out/mock-public.d.ts +16112 -0
- package/out/mock.d.ts +16797 -0
- package/out/mock.js +17104 -0
- package/package.json +30 -23
- package/LICENSE +0 -13
- package/NOTICE +0 -16
- package/openfin-core-33.76.31.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3080
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +0 -28
- package/src/api/api-exposer/api-consumer.js +0 -28
- package/src/api/api-exposer/api-exposer.d.ts +0 -35
- package/src/api/api-exposer/api-exposer.js +0 -38
- package/src/api/api-exposer/decorators.d.ts +0 -10
- package/src/api/api-exposer/decorators.js +0 -18
- package/src/api/api-exposer/index.d.ts +0 -4
- package/src/api/api-exposer/index.js +0 -20
- package/src/api/api-exposer/strategies/index.d.ts +0 -1
- package/src/api/api-exposer/strategies/index.js +0 -17
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
- package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
- package/src/api/application/Factory.d.ts +0 -148
- package/src/api/application/Factory.js +0 -230
- package/src/api/application/Instance.d.ts +0 -321
- package/src/api/application/Instance.js +0 -453
- package/src/api/application/index.d.ts +0 -3
- package/src/api/application/index.js +0 -19
- package/src/api/base.d.ts +0 -48
- package/src/api/base.js +0 -177
- package/src/api/clipboard/index.d.ts +0 -92
- package/src/api/clipboard/index.js +0 -120
- package/src/api/events/application.d.ts +0 -146
- package/src/api/events/application.js +0 -2
- package/src/api/events/base.d.ts +0 -42
- package/src/api/events/base.js +0 -2
- package/src/api/events/channel.d.ts +0 -30
- package/src/api/events/channel.js +0 -2
- package/src/api/events/emitterMap.d.ts +0 -11
- package/src/api/events/emitterMap.js +0 -35
- package/src/api/events/eventAggregator.d.ts +0 -5
- package/src/api/events/eventAggregator.js +0 -35
- package/src/api/events/externalApplication.d.ts +0 -19
- package/src/api/events/externalApplication.js +0 -2
- package/src/api/events/frame.d.ts +0 -30
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -20
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -26
- package/src/api/events/platform.js +0 -2
- package/src/api/events/system.d.ts +0 -113
- package/src/api/events/system.js +0 -2
- package/src/api/events/typedEventEmitter.d.ts +0 -20
- package/src/api/events/typedEventEmitter.js +0 -2
- package/src/api/events/view.d.ts +0 -82
- package/src/api/events/view.js +0 -2
- package/src/api/events/webcontents.d.ts +0 -266
- package/src/api/events/webcontents.js +0 -2
- package/src/api/events/window.d.ts +0 -352
- package/src/api/events/window.js +0 -2
- package/src/api/external-application/Factory.d.ts +0 -27
- package/src/api/external-application/Factory.js +0 -40
- package/src/api/external-application/Instance.d.ts +0 -102
- package/src/api/external-application/Instance.js +0 -109
- package/src/api/external-application/index.d.ts +0 -3
- package/src/api/external-application/index.js +0 -19
- package/src/api/fin.d.ts +0 -51
- package/src/api/fin.js +0 -42
- package/src/api/frame/Factory.d.ts +0 -37
- package/src/api/frame/Factory.js +0 -69
- package/src/api/frame/Instance.d.ts +0 -123
- package/src/api/frame/Instance.js +0 -130
- package/src/api/frame/index.d.ts +0 -3
- package/src/api/frame/index.js +0 -19
- package/src/api/global-hotkey/index.d.ts +0 -38
- package/src/api/global-hotkey/index.js +0 -64
- package/src/api/interappbus/channel/channel.d.ts +0 -28
- package/src/api/interappbus/channel/channel.js +0 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -340
- package/src/api/interappbus/channel/channels-docs.js +0 -398
- package/src/api/interappbus/channel/client.d.ts +0 -24
- package/src/api/interappbus/channel/client.js +0 -89
- package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
- package/src/api/interappbus/channel/connection-manager.js +0 -246
- package/src/api/interappbus/channel/index.d.ts +0 -25
- package/src/api/interappbus/channel/index.js +0 -169
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
- package/src/api/interappbus/channel/protocols/index.js +0 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
- package/src/api/interappbus/channel/protocols/strategy.js +0 -2
- package/src/api/interappbus/channel/provider.d.ts +0 -34
- package/src/api/interappbus/channel/provider.js +0 -166
- package/src/api/interappbus/index.d.ts +0 -85
- package/src/api/interappbus/index.js +0 -175
- package/src/api/interop/Factory.d.ts +0 -37
- package/src/api/interop/Factory.js +0 -76
- package/src/api/interop/InteropBroker.d.ts +0 -437
- package/src/api/interop/InteropBroker.js +0 -1085
- package/src/api/interop/InteropClient.d.ts +0 -278
- package/src/api/interop/InteropClient.js +0 -459
- package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
- package/src/api/interop/SessionContextGroupBroker.js +0 -108
- package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
- package/src/api/interop/SessionContextGroupClient.js +0 -86
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
- package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
- package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -208
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -438
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -301
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -482
- package/src/api/interop/fdc3/fdc3.d.ts +0 -12
- package/src/api/interop/fdc3/fdc3.js +0 -35
- package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
- package/src/api/interop/fdc3/overrideCheck.js +0 -32
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
- package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
- package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
- package/src/api/interop/fdc3/utils.d.ts +0 -45
- package/src/api/interop/fdc3/utils.js +0 -239
- package/src/api/interop/fdc3/versions.d.ts +0 -1
- package/src/api/interop/fdc3/versions.js +0 -2
- package/src/api/interop/index.d.ts +0 -4
- package/src/api/interop/index.js +0 -20
- package/src/api/interop/utils.d.ts +0 -18
- package/src/api/interop/utils.js +0 -61
- package/src/api/me.d.ts +0 -40
- package/src/api/me.js +0 -134
- package/src/api/platform/Factory.d.ts +0 -115
- package/src/api/platform/Factory.js +0 -184
- package/src/api/platform/Instance.d.ts +0 -150
- package/src/api/platform/Instance.js +0 -332
- package/src/api/platform/common-utils.d.ts +0 -7
- package/src/api/platform/common-utils.js +0 -16
- package/src/api/platform/index.d.ts +0 -3
- package/src/api/platform/index.js +0 -19
- package/src/api/platform/layout/Factory.d.ts +0 -114
- package/src/api/platform/layout/Factory.js +0 -174
- package/src/api/platform/layout/Instance.d.ts +0 -57
- package/src/api/platform/layout/Instance.js +0 -126
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
- package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
- package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
- package/src/api/platform/layout/entities/layout-entities.d.ts +0 -235
- package/src/api/platform/layout/entities/layout-entities.js +0 -312
- package/src/api/platform/layout/entities/shapes.d.ts +0 -6
- package/src/api/platform/layout/entities/shapes.js +0 -2
- package/src/api/platform/layout/index.d.ts +0 -2
- package/src/api/platform/layout/index.js +0 -18
- package/src/api/platform/layout/layout.constants.d.ts +0 -1
- package/src/api/platform/layout/layout.constants.js +0 -4
- package/src/api/platform/layout/shapes.d.ts +0 -16
- package/src/api/platform/layout/shapes.js +0 -2
- package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
- package/src/api/platform/layout/utils/layout-traversal.js +0 -65
- package/src/api/platform/provider.d.ts +0 -163
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -38
- package/src/api/snapshot-source/Factory.js +0 -66
- package/src/api/snapshot-source/Instance.d.ts +0 -31
- package/src/api/snapshot-source/Instance.js +0 -132
- package/src/api/snapshot-source/index.d.ts +0 -3
- package/src/api/snapshot-source/index.js +0 -19
- package/src/api/snapshot-source/utils.d.ts +0 -2
- package/src/api/snapshot-source/utils.js +0 -6
- package/src/api/system/index.d.ts +0 -517
- package/src/api/system/index.js +0 -895
- package/src/api/view/Factory.d.ts +0 -50
- package/src/api/view/Factory.js +0 -103
- package/src/api/view/Instance.d.ts +0 -487
- package/src/api/view/Instance.js +0 -557
- package/src/api/view/index.d.ts +0 -3
- package/src/api/view/index.js +0 -19
- package/src/api/webcontents/main.d.ts +0 -32
- package/src/api/webcontents/main.js +0 -156
- package/src/api/window/Factory.d.ts +0 -45
- package/src/api/window/Factory.js +0 -91
- package/src/api/window/Instance.d.ts +0 -1090
- package/src/api/window/Instance.js +0 -1349
- package/src/api/window/index.d.ts +0 -3
- package/src/api/window/index.js +0 -19
- package/src/browser.d.ts +0 -10
- package/src/browser.js +0 -36
- package/src/environment/browser.d.ts +0 -29
- package/src/environment/browser.js +0 -60
- package/src/environment/environment.d.ts +0 -33
- package/src/environment/environment.js +0 -4
- package/src/environment/mockEnvironment.d.ts +0 -27
- package/src/environment/mockEnvironment.js +0 -61
- package/src/environment/node-env.d.ts +0 -29
- package/src/environment/node-env.js +0 -72
- package/src/fdc3.d.ts +0 -3
- package/src/fdc3.js +0 -9
- package/src/mock.d.ts +0 -3
- package/src/mock.js +0 -18
- package/src/namespaces.d.ts +0 -21
- package/src/namespaces.js +0 -24
- package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
- package/src/shapes/ERROR_BOX_TYPES.js +0 -2
- package/src/shapes/WebOptions.d.ts +0 -13
- package/src/shapes/WebOptions.js +0 -2
- package/src/shapes/WindowOptions.d.ts +0 -43
- package/src/shapes/WindowOptions.js +0 -2
- package/src/shapes/protocol.d.ts +0 -200
- package/src/shapes/protocol.js +0 -2
- package/src/transport/mockWire.d.ts +0 -11
- package/src/transport/mockWire.js +0 -26
- package/src/transport/transport-errors.d.ts +0 -31
- package/src/transport/transport-errors.js +0 -79
- package/src/transport/transport.d.ts +0 -73
- package/src/transport/transport.js +0 -219
- package/src/transport/wire.d.ts +0 -77
- package/src/transport/wire.js +0 -36
- package/src/util/asyncFilter.d.ts +0 -1
- package/src/util/asyncFilter.js +0 -7
- package/src/util/channel-api-relay.d.ts +0 -13
- package/src/util/channel-api-relay.js +0 -47
- package/src/util/errors.d.ts +0 -10
- package/src/util/errors.js +0 -12
- package/src/util/exhaustive.d.ts +0 -1
- package/src/util/exhaustive.js +0 -7
- package/src/util/http.d.ts +0 -11
- package/src/util/http.js +0 -90
- package/src/util/inaccessibleObject.d.ts +0 -2
- package/src/util/inaccessibleObject.js +0 -49
- package/src/util/lazy.d.ts +0 -34
- package/src/util/lazy.js +0 -54
- package/src/util/normalize-config.d.ts +0 -3
- package/src/util/normalize-config.js +0 -52
- package/src/util/promises.d.ts +0 -5
- package/src/util/promises.js +0 -27
- package/src/util/ref-counter.d.ts +0 -7
- package/src/util/ref-counter.js +0 -52
- package/src/util/reversible-map.d.ts +0 -11
- package/src/util/reversible-map.js +0 -49
- package/src/util/runtimeVersioning.d.ts +0 -3
- package/src/util/runtimeVersioning.js +0 -25
- package/src/util/utilTypes.d.ts +0 -8
- package/src/util/utilTypes.js +0 -2
- package/src/util/validate.d.ts +0 -3
- package/src/util/validate.js +0 -11
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import type * as FDC3v1 from './shapes/fdc3v1';
|
|
2
|
-
import { Base } from '../../base';
|
|
3
|
-
/**
|
|
4
|
-
* @typedef { object } Listener
|
|
5
|
-
* @summary Listener object returned by addContextListener and addIntentListener
|
|
6
|
-
* @property {function} unsubscribe function for addContextListener and addIntentListener.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @typedef { object } Channel
|
|
10
|
-
* @summary Information for a Context Group. Contains metadata for displaying the group properly.
|
|
11
|
-
* @property {string} id Name of the context group
|
|
12
|
-
* @property {DisplayMetadata} displayMetadata Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker.
|
|
13
|
-
* @property {string} type Defaults to system.
|
|
14
|
-
* @property {function} broadcast Broadcasts a context for the channel.
|
|
15
|
-
* @property {function} addContextListener Add a context handler for incoming context.
|
|
16
|
-
* @property {function} getCurrentContext Gets the current context for the channel.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* @typedef { object } AppMetadata
|
|
20
|
-
* @summary App metadata is provided by the FDC3 App Directory.
|
|
21
|
-
* @property {string} name
|
|
22
|
-
* @property {string} [appId]
|
|
23
|
-
* @property {string} [version]
|
|
24
|
-
* @property {string} [title]
|
|
25
|
-
* @property {string} [tooltip]
|
|
26
|
-
* @property {string} [description]
|
|
27
|
-
* @property {Array<string>} [icons]
|
|
28
|
-
* @property {Array<string>} [images]
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* @typedef { string | AppMetadata } TargetApp
|
|
32
|
-
* @summary Some operations can identify an app just by its name, or pass full app metadata.
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* @typedef { object } IntentResolution
|
|
36
|
-
* @summary IntentResolution provides a standard format for data returned upon resolving an Intent.
|
|
37
|
-
* @property { TargetApp } source identifier for the Application resolving the Intent (null if the Intent could not be resolved)
|
|
38
|
-
* @property { string } [data] Return data structure - if one is provided for the given Intent.
|
|
39
|
-
* @property { string } version The version number of the Intents schema being used
|
|
40
|
-
*/
|
|
41
|
-
/**
|
|
42
|
-
* @typedef { object } AppIntent
|
|
43
|
-
* @summary An interface that represents the binding of an intent to apps.
|
|
44
|
-
* @property { Intent } intent
|
|
45
|
-
* @property { Array<AppMetadata> } apps
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* @typedef { object } ImplementationMetadata
|
|
49
|
-
* @summary An interface that represents FDC3 implementation meta data.
|
|
50
|
-
* @property { string } fdc3Version The FDC3 version
|
|
51
|
-
* @property { string } provider The provider uuid with prepend 'openfin'
|
|
52
|
-
* @property { string } [providerVersion] The provider runtime version
|
|
53
|
-
*/
|
|
54
|
-
/**
|
|
55
|
-
* @class
|
|
56
|
-
* @alias fdc3
|
|
57
|
-
* @version 1.2
|
|
58
|
-
* @hideconstructor
|
|
59
|
-
* @desc The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
|
|
60
|
-
* while using our Interop API under the hood. In order to use this set of APIs
|
|
61
|
-
* you will need to set up your own {@link InteropBroker InteropBroker} or use a Platform application, which does the setup for you. Refer to our documentation on
|
|
62
|
-
* our {@link https://developers.openfin.co/of-docs/docs/enable-color-linking Interop API}.
|
|
63
|
-
*
|
|
64
|
-
* To enable the FDC3 APIs in a {@link Window Window} or {@link View View}, add the fdc3InteropApi
|
|
65
|
-
* property to its options:
|
|
66
|
-
*
|
|
67
|
-
* ```js
|
|
68
|
-
* {
|
|
69
|
-
* autoShow: false,
|
|
70
|
-
* saveWindowState: true,
|
|
71
|
-
* url: 'https://openfin.co',
|
|
72
|
-
* fdc3InteropApi: '1.2'
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
|
|
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
|
-
*/
|
|
92
|
-
export default class Fdc3Module extends Base implements FDC3v1.DesktopAgent {
|
|
93
|
-
/**
|
|
94
|
-
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
|
|
95
|
-
* @param { string | null } contextType - The type of context you wish to handle.
|
|
96
|
-
* @param { ContextHandler } handler - Handler for incoming context.
|
|
97
|
-
* @returns { Listener }
|
|
98
|
-
* @tutorial fdc3.addContextListener
|
|
99
|
-
* @static
|
|
100
|
-
*/
|
|
101
|
-
addContextListener(contextType: string | null, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
|
|
102
|
-
/**
|
|
103
|
-
* Broadcasts a context for the channel of the current entity.
|
|
104
|
-
* @param { Context } context - New context to set.
|
|
105
|
-
* @returns { Promise<void> }
|
|
106
|
-
* @tutorial fdc3.broadcast
|
|
107
|
-
* @static
|
|
108
|
-
*/
|
|
109
|
-
broadcast(context: FDC3v1.Context): Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
|
112
|
-
* @returns { Promise<Channel[]>}
|
|
113
|
-
* @tutorial fdc3.getSystemChannels
|
|
114
|
-
* @static
|
|
115
|
-
*/
|
|
116
|
-
getSystemChannels(): Promise<FDC3v1.SystemChannel[]>;
|
|
117
|
-
/**
|
|
118
|
-
* Join all Interop Clients at the given identity to context group `contextGroupId`.
|
|
119
|
-
* If no target is specified, it adds the sender to the context group.
|
|
120
|
-
* Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
|
|
121
|
-
* If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
|
|
122
|
-
* For all intents and purposes, there will only be 1 connection present in Platform and Browser implementations, so this point is more-or-less moot.
|
|
123
|
-
* @param { string } channelId - Id of the context group.
|
|
124
|
-
* @returns { Promise<void> }
|
|
125
|
-
* @tutorial fdc3.joinChannel
|
|
126
|
-
* @static
|
|
127
|
-
*/
|
|
128
|
-
joinChannel(channelId: string): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* Removes the specified target from a context group.
|
|
131
|
-
* If no target is specified, it removes the sender from their context group.
|
|
132
|
-
* @returns { Promise<void> }
|
|
133
|
-
* @tutorial fdc3.leaveCurrentChannel
|
|
134
|
-
* @static
|
|
135
|
-
*/
|
|
136
|
-
leaveCurrentChannel(): Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* Adds a listener for incoming Intents.
|
|
139
|
-
* @param { string } intent - Name of the Intent
|
|
140
|
-
* @param { IntentHandler } handler - Handler for incoming Intent
|
|
141
|
-
* @returns { Listener }
|
|
142
|
-
* @tutorial fdc3.addIntentListener
|
|
143
|
-
* @static
|
|
144
|
-
*/
|
|
145
|
-
addIntentListener(intent: string, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
|
|
146
|
-
/**
|
|
147
|
-
* Raises a specific intent.
|
|
148
|
-
* @param { string } intent Name of the Intent.
|
|
149
|
-
* @param { Context } context Context associated with the Intent.
|
|
150
|
-
* @param { TargetApp } app App that will resolve the Intent. This is added as metadata to the Intent. Can be accessed by the app provider in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
|
|
151
|
-
* @returns { IntentResolution }
|
|
152
|
-
* @tutorial fdc3.raiseIntent
|
|
153
|
-
* @static
|
|
154
|
-
*/
|
|
155
|
-
raiseIntent(intent: string, context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
|
|
156
|
-
/**
|
|
157
|
-
* Returns the Channel that the entity is subscribed to. Returns null if not joined to a channel.
|
|
158
|
-
* @returns { Channel | null }
|
|
159
|
-
* @tutorial fdc3.getCurrentChannel
|
|
160
|
-
*/
|
|
161
|
-
getCurrentChannel(): Promise<FDC3v1.Channel | null>;
|
|
162
|
-
/**
|
|
163
|
-
* Find out more information about a particular intent by passing its name, and optionally its context.
|
|
164
|
-
* @param { string } intent Name of the Intent
|
|
165
|
-
* @param { Context } [context]
|
|
166
|
-
* @return { Promise<AppIntent> }
|
|
167
|
-
* @tutorial fdc3.findIntent
|
|
168
|
-
*/
|
|
169
|
-
findIntent(intent: string, context?: FDC3v1.Context): Promise<FDC3v1.AppIntent>;
|
|
170
|
-
/**
|
|
171
|
-
* Find all the available intents for a particular context.
|
|
172
|
-
* @param { Context } context
|
|
173
|
-
* @return { Promise<Array<AppIntent>> }
|
|
174
|
-
* @tutorial fdc3.findIntentsByContext
|
|
175
|
-
*/
|
|
176
|
-
findIntentsByContext(context: FDC3v1.Context): Promise<Array<FDC3v1.AppIntent>>;
|
|
177
|
-
/**
|
|
178
|
-
* Finds and raises an intent against a target app based purely on context data.
|
|
179
|
-
* @param { Context } context
|
|
180
|
-
* @param { TargetApp } [app]
|
|
181
|
-
* @return { Promise<IntentResolution> }
|
|
182
|
-
* @tutorial fdc3.raiseIntentForContext
|
|
183
|
-
*/
|
|
184
|
-
raiseIntentForContext(context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
|
|
185
|
-
/**
|
|
186
|
-
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
|
187
|
-
* @param channelId
|
|
188
|
-
* @returns { Promise<Channel> }
|
|
189
|
-
* @tutorial fdc3.getOrCreateChannel
|
|
190
|
-
*/
|
|
191
|
-
getOrCreateChannel(channelId: string): Promise<FDC3v1.Channel>;
|
|
192
|
-
/**
|
|
193
|
-
* 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.
|
|
194
|
-
* @return { Promise<ImplementationMetadata> }
|
|
195
|
-
* @tutorial fdc3.getInfo
|
|
196
|
-
*/
|
|
197
|
-
getInfo(): FDC3v1.ImplementationMetadata;
|
|
198
|
-
/**
|
|
199
|
-
* Launches an app with target information, which can either be a string or an AppMetadata object.
|
|
200
|
-
* @param { TargetApp } app
|
|
201
|
-
* @param { Context } [context]
|
|
202
|
-
* @return { Promise<void> }
|
|
203
|
-
* @tutorial fdc3.open
|
|
204
|
-
*/
|
|
205
|
-
open(app: FDC3v1.TargetApp, context?: FDC3v1.Context): Promise<void>;
|
|
206
|
-
private getCurrentContextGroupInfo;
|
|
207
|
-
private buildChannelObject;
|
|
208
|
-
}
|
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const base_1 = require("../../base");
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
const utils_2 = require("../utils");
|
|
6
|
-
const InteropClient_1 = require("../InteropClient");
|
|
7
|
-
const lodash_1 = require("lodash");
|
|
8
|
-
/**
|
|
9
|
-
* @typedef { object } Listener
|
|
10
|
-
* @summary Listener object returned by addContextListener and addIntentListener
|
|
11
|
-
* @property {function} unsubscribe function for addContextListener and addIntentListener.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @typedef { object } Channel
|
|
15
|
-
* @summary Information for a Context Group. Contains metadata for displaying the group properly.
|
|
16
|
-
* @property {string} id Name of the context group
|
|
17
|
-
* @property {DisplayMetadata} displayMetadata Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker.
|
|
18
|
-
* @property {string} type Defaults to system.
|
|
19
|
-
* @property {function} broadcast Broadcasts a context for the channel.
|
|
20
|
-
* @property {function} addContextListener Add a context handler for incoming context.
|
|
21
|
-
* @property {function} getCurrentContext Gets the current context for the channel.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* @typedef { object } AppMetadata
|
|
25
|
-
* @summary App metadata is provided by the FDC3 App Directory.
|
|
26
|
-
* @property {string} name
|
|
27
|
-
* @property {string} [appId]
|
|
28
|
-
* @property {string} [version]
|
|
29
|
-
* @property {string} [title]
|
|
30
|
-
* @property {string} [tooltip]
|
|
31
|
-
* @property {string} [description]
|
|
32
|
-
* @property {Array<string>} [icons]
|
|
33
|
-
* @property {Array<string>} [images]
|
|
34
|
-
*/
|
|
35
|
-
/**
|
|
36
|
-
* @typedef { string | AppMetadata } TargetApp
|
|
37
|
-
* @summary Some operations can identify an app just by its name, or pass full app metadata.
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* @typedef { object } IntentResolution
|
|
41
|
-
* @summary IntentResolution provides a standard format for data returned upon resolving an Intent.
|
|
42
|
-
* @property { TargetApp } source identifier for the Application resolving the Intent (null if the Intent could not be resolved)
|
|
43
|
-
* @property { string } [data] Return data structure - if one is provided for the given Intent.
|
|
44
|
-
* @property { string } version The version number of the Intents schema being used
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* @typedef { object } AppIntent
|
|
48
|
-
* @summary An interface that represents the binding of an intent to apps.
|
|
49
|
-
* @property { Intent } intent
|
|
50
|
-
* @property { Array<AppMetadata> } apps
|
|
51
|
-
*/
|
|
52
|
-
/**
|
|
53
|
-
* @typedef { object } ImplementationMetadata
|
|
54
|
-
* @summary An interface that represents FDC3 implementation meta data.
|
|
55
|
-
* @property { string } fdc3Version The FDC3 version
|
|
56
|
-
* @property { string } provider The provider uuid with prepend 'openfin'
|
|
57
|
-
* @property { string } [providerVersion] The provider runtime version
|
|
58
|
-
*/
|
|
59
|
-
/**
|
|
60
|
-
* @class
|
|
61
|
-
* @alias fdc3
|
|
62
|
-
* @version 1.2
|
|
63
|
-
* @hideconstructor
|
|
64
|
-
* @desc The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
|
|
65
|
-
* while using our Interop API under the hood. In order to use this set of APIs
|
|
66
|
-
* you will need to set up your own {@link InteropBroker InteropBroker} or use a Platform application, which does the setup for you. Refer to our documentation on
|
|
67
|
-
* our {@link https://developers.openfin.co/of-docs/docs/enable-color-linking Interop API}.
|
|
68
|
-
*
|
|
69
|
-
* To enable the FDC3 APIs in a {@link Window Window} or {@link View View}, add the fdc3InteropApi
|
|
70
|
-
* property to its options:
|
|
71
|
-
*
|
|
72
|
-
* ```js
|
|
73
|
-
* {
|
|
74
|
-
* autoShow: false,
|
|
75
|
-
* saveWindowState: true,
|
|
76
|
-
* url: 'https://openfin.co',
|
|
77
|
-
* fdc3InteropApi: '1.2'
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
|
|
82
|
-
*
|
|
83
|
-
* In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
|
|
84
|
-
*
|
|
85
|
-
* ```js
|
|
86
|
-
* function fdc3Action() {
|
|
87
|
-
* // Make some fdc3 API calls here
|
|
88
|
-
* }
|
|
89
|
-
*
|
|
90
|
-
* if (window.fdc3) {
|
|
91
|
-
* fdc3Action();
|
|
92
|
-
* } else {
|
|
93
|
-
* window.addEventListener('fdc3Ready', fdc3Action);
|
|
94
|
-
* }
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
class Fdc3Module extends base_1.Base {
|
|
98
|
-
/**
|
|
99
|
-
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
|
|
100
|
-
* @param { string | null } contextType - The type of context you wish to handle.
|
|
101
|
-
* @param { ContextHandler } handler - Handler for incoming context.
|
|
102
|
-
* @returns { Listener }
|
|
103
|
-
* @tutorial fdc3.addContextListener
|
|
104
|
-
* @static
|
|
105
|
-
*/
|
|
106
|
-
addContextListener(contextType, handler) {
|
|
107
|
-
this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
|
|
108
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
109
|
-
});
|
|
110
|
-
let listener;
|
|
111
|
-
if (typeof contextType === 'function') {
|
|
112
|
-
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
113
|
-
listener = this.fin.me.interop.addContextHandler(contextType);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
listener = this.fin.me.interop.addContextHandler(handler, contextType === null ? undefined : contextType);
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
...listener,
|
|
120
|
-
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Broadcasts a context for the channel of the current entity.
|
|
125
|
-
* @param { Context } context - New context to set.
|
|
126
|
-
* @returns { Promise<void> }
|
|
127
|
-
* @tutorial fdc3.broadcast
|
|
128
|
-
* @static
|
|
129
|
-
*/
|
|
130
|
-
async broadcast(context) {
|
|
131
|
-
this.wire.sendAction('fdc3-broadcast').catch((e) => {
|
|
132
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
133
|
-
});
|
|
134
|
-
return this.fin.me.interop.setContext(context);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
|
138
|
-
* @returns { Promise<Channel[]>}
|
|
139
|
-
* @tutorial fdc3.getSystemChannels
|
|
140
|
-
* @static
|
|
141
|
-
*/
|
|
142
|
-
async getSystemChannels() {
|
|
143
|
-
this.wire.sendAction('fdc3-get-system-channels').catch((e) => {
|
|
144
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
145
|
-
});
|
|
146
|
-
const channels = await this.fin.me.interop.getContextGroups();
|
|
147
|
-
// fdc3 implementation of getSystemChannels returns on array of channels, have to decorate over
|
|
148
|
-
// this so people know that these APIs are not supported
|
|
149
|
-
return channels.map((channel) => {
|
|
150
|
-
return { ...channel, type: 'system', ...(0, utils_1.getUnsupportedChannelApis)() };
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Join all Interop Clients at the given identity to context group `contextGroupId`.
|
|
155
|
-
* If no target is specified, it adds the sender to the context group.
|
|
156
|
-
* Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
|
|
157
|
-
* If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
|
|
158
|
-
* For all intents and purposes, there will only be 1 connection present in Platform and Browser implementations, so this point is more-or-less moot.
|
|
159
|
-
* @param { string } channelId - Id of the context group.
|
|
160
|
-
* @returns { Promise<void> }
|
|
161
|
-
* @tutorial fdc3.joinChannel
|
|
162
|
-
* @static
|
|
163
|
-
*/
|
|
164
|
-
async joinChannel(channelId) {
|
|
165
|
-
this.wire.sendAction('fdc3-join-channel').catch((e) => {
|
|
166
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
167
|
-
});
|
|
168
|
-
try {
|
|
169
|
-
return await this.fin.me.interop.joinContextGroup(channelId);
|
|
170
|
-
}
|
|
171
|
-
catch (error) {
|
|
172
|
-
if (error.message === utils_2.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
|
|
173
|
-
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.');
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
console.error(error.message);
|
|
177
|
-
}
|
|
178
|
-
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
179
|
-
throw new Error(utils_1.ChannelError.NoChannelFound);
|
|
180
|
-
}
|
|
181
|
-
throw new Error(utils_1.ChannelError.AccessDenied);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Removes the specified target from a context group.
|
|
186
|
-
* If no target is specified, it removes the sender from their context group.
|
|
187
|
-
* @returns { Promise<void> }
|
|
188
|
-
* @tutorial fdc3.leaveCurrentChannel
|
|
189
|
-
* @static
|
|
190
|
-
*/
|
|
191
|
-
async leaveCurrentChannel() {
|
|
192
|
-
this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
|
|
193
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
194
|
-
});
|
|
195
|
-
return this.fin.me.interop.removeFromContextGroup();
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Adds a listener for incoming Intents.
|
|
199
|
-
* @param { string } intent - Name of the Intent
|
|
200
|
-
* @param { IntentHandler } handler - Handler for incoming Intent
|
|
201
|
-
* @returns { Listener }
|
|
202
|
-
* @tutorial fdc3.addIntentListener
|
|
203
|
-
* @static
|
|
204
|
-
*/
|
|
205
|
-
addIntentListener(intent, handler) {
|
|
206
|
-
this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
|
|
207
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
208
|
-
});
|
|
209
|
-
const contextHandler = (raisedIntent) => {
|
|
210
|
-
handler(raisedIntent.context);
|
|
211
|
-
};
|
|
212
|
-
const listener = this.fin.me.interop.registerIntentHandler(contextHandler, intent, {
|
|
213
|
-
fdc3Version: '1.2'
|
|
214
|
-
});
|
|
215
|
-
return {
|
|
216
|
-
...listener,
|
|
217
|
-
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Raises a specific intent.
|
|
222
|
-
* @param { string } intent Name of the Intent.
|
|
223
|
-
* @param { Context } context Context associated with the Intent.
|
|
224
|
-
* @param { TargetApp } app App that will resolve the Intent. This is added as metadata to the Intent. Can be accessed by the app provider in {@link InteropBroker#handleFiredIntent InteropBroker.handleFiredIntent}.
|
|
225
|
-
* @returns { IntentResolution }
|
|
226
|
-
* @tutorial fdc3.raiseIntent
|
|
227
|
-
* @static
|
|
228
|
-
*/
|
|
229
|
-
async raiseIntent(intent, context, app) {
|
|
230
|
-
this.wire.sendAction('fdc3-raise-intent').catch((e) => {
|
|
231
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
232
|
-
});
|
|
233
|
-
const intentObj = app
|
|
234
|
-
? { name: intent, context, metadata: { target: app } }
|
|
235
|
-
: { name: intent, context };
|
|
236
|
-
try {
|
|
237
|
-
return await this.fin.me.interop.fireIntent(intentObj);
|
|
238
|
-
}
|
|
239
|
-
catch (error) {
|
|
240
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
|
241
|
-
throw new Error(errorToThrow);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Returns the Channel that the entity is subscribed to. Returns null if not joined to a channel.
|
|
246
|
-
* @returns { Channel | null }
|
|
247
|
-
* @tutorial fdc3.getCurrentChannel
|
|
248
|
-
*/
|
|
249
|
-
async getCurrentChannel() {
|
|
250
|
-
this.wire.sendAction('fdc3-get-current-channel').catch((e) => {
|
|
251
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
252
|
-
});
|
|
253
|
-
const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
|
|
254
|
-
if (!currentContextGroupInfo) {
|
|
255
|
-
return null;
|
|
256
|
-
}
|
|
257
|
-
return this.buildChannelObject(currentContextGroupInfo);
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Find out more information about a particular intent by passing its name, and optionally its context.
|
|
261
|
-
* @param { string } intent Name of the Intent
|
|
262
|
-
* @param { Context } [context]
|
|
263
|
-
* @return { Promise<AppIntent> }
|
|
264
|
-
* @tutorial fdc3.findIntent
|
|
265
|
-
*/
|
|
266
|
-
async findIntent(intent, context) {
|
|
267
|
-
this.wire.sendAction('fdc3-find-intent').catch((e) => {
|
|
268
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
269
|
-
});
|
|
270
|
-
try {
|
|
271
|
-
return await this.fin.me.interop.getInfoForIntent({ name: intent, context });
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
|
|
275
|
-
throw new Error(errorToThrow);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Find all the available intents for a particular context.
|
|
280
|
-
* @param { Context } context
|
|
281
|
-
* @return { Promise<Array<AppIntent>> }
|
|
282
|
-
* @tutorial fdc3.findIntentsByContext
|
|
283
|
-
*/
|
|
284
|
-
async findIntentsByContext(context) {
|
|
285
|
-
this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
|
|
286
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
287
|
-
});
|
|
288
|
-
try {
|
|
289
|
-
return await this.fin.me.interop.getInfoForIntentsByContext(context);
|
|
290
|
-
}
|
|
291
|
-
catch (error) {
|
|
292
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
|
|
293
|
-
throw new Error(errorToThrow);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Finds and raises an intent against a target app based purely on context data.
|
|
298
|
-
* @param { Context } context
|
|
299
|
-
* @param { TargetApp } [app]
|
|
300
|
-
* @return { Promise<IntentResolution> }
|
|
301
|
-
* @tutorial fdc3.raiseIntentForContext
|
|
302
|
-
*/
|
|
303
|
-
async raiseIntentForContext(context, app) {
|
|
304
|
-
this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
|
|
305
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
306
|
-
});
|
|
307
|
-
try {
|
|
308
|
-
return await this.fin.me.interop.fireIntentForContext({ ...context, metadata: { target: app } });
|
|
309
|
-
}
|
|
310
|
-
catch (error) {
|
|
311
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error.message;
|
|
312
|
-
throw new Error(errorToThrow);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
|
317
|
-
* @param channelId
|
|
318
|
-
* @returns { Promise<Channel> }
|
|
319
|
-
* @tutorial fdc3.getOrCreateChannel
|
|
320
|
-
*/
|
|
321
|
-
async getOrCreateChannel(channelId) {
|
|
322
|
-
this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
|
|
323
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
324
|
-
});
|
|
325
|
-
const systemChannels = await this.getSystemChannels();
|
|
326
|
-
const userChannel = systemChannels.find((channel) => channel.id === channelId);
|
|
327
|
-
if (userChannel) {
|
|
328
|
-
return { ...userChannel, type: 'system', ...(0, utils_1.getUnsupportedChannelApis)() };
|
|
329
|
-
}
|
|
330
|
-
try {
|
|
331
|
-
const sessionContextGroup = await this.fin.me.interop.joinSessionContextGroup(channelId);
|
|
332
|
-
return (0, utils_1.buildAppChannelObject)(sessionContextGroup);
|
|
333
|
-
}
|
|
334
|
-
catch (error) {
|
|
335
|
-
console.error(error.message);
|
|
336
|
-
throw new Error(utils_1.ChannelError.CreationFailed);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* 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.
|
|
341
|
-
* @return { Promise<ImplementationMetadata> }
|
|
342
|
-
* @tutorial fdc3.getInfo
|
|
343
|
-
*/
|
|
344
|
-
getInfo() {
|
|
345
|
-
this.wire.sendAction('fdc3-get-info').catch((e) => {
|
|
346
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
347
|
-
});
|
|
348
|
-
// @ts-expect-error
|
|
349
|
-
const { uuid, fdc3InteropApi } = fin.__internal_.initialOptions;
|
|
350
|
-
// @ts-expect-error
|
|
351
|
-
const runtimeVersion = fin.desktop.getVersion();
|
|
352
|
-
return {
|
|
353
|
-
fdc3Version: fdc3InteropApi,
|
|
354
|
-
provider: `openfin-${uuid}`,
|
|
355
|
-
providerVersion: runtimeVersion
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Launches an app with target information, which can either be a string or an AppMetadata object.
|
|
360
|
-
* @param { TargetApp } app
|
|
361
|
-
* @param { Context } [context]
|
|
362
|
-
* @return { Promise<void> }
|
|
363
|
-
* @tutorial fdc3.open
|
|
364
|
-
*/
|
|
365
|
-
async open(app, context) {
|
|
366
|
-
this.wire.sendAction('fdc3-open').catch((e) => {
|
|
367
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
368
|
-
});
|
|
369
|
-
try {
|
|
370
|
-
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3Open', { app, context });
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error.message;
|
|
374
|
-
throw new Error(errorToThrow);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
// utils
|
|
378
|
-
// eslint-disable-next-line class-methods-use-this
|
|
379
|
-
async getCurrentContextGroupInfo() {
|
|
380
|
-
const contextGroups = await this.fin.me.interop.getContextGroups();
|
|
381
|
-
const clientsInCtxGroupsPromise = contextGroups.map(async (ctxGroup) => {
|
|
382
|
-
return this.fin.me.interop.getAllClientsInContextGroup(ctxGroup.id);
|
|
383
|
-
});
|
|
384
|
-
const clientsInCtxGroups = await Promise.all(clientsInCtxGroupsPromise);
|
|
385
|
-
const clientIdx = clientsInCtxGroups.findIndex((clientIdentityArr) => {
|
|
386
|
-
return clientIdentityArr.some((clientIdentity) => {
|
|
387
|
-
const { uuid, name } = clientIdentity;
|
|
388
|
-
return this.fin.me.uuid === uuid && this.fin.me.name === name;
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
return contextGroups[clientIdx];
|
|
392
|
-
}
|
|
393
|
-
async buildChannelObject(currentContextGroupInfo) {
|
|
394
|
-
return {
|
|
395
|
-
...currentContextGroupInfo,
|
|
396
|
-
type: 'system',
|
|
397
|
-
addContextListener: (contextType, handler) => {
|
|
398
|
-
let realHandler;
|
|
399
|
-
let realType;
|
|
400
|
-
if (typeof contextType === 'function') {
|
|
401
|
-
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
402
|
-
realHandler = contextType;
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
realHandler = handler;
|
|
406
|
-
if (typeof contextType === 'string') {
|
|
407
|
-
realType = contextType;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
const listener = (async () => {
|
|
411
|
-
let first = true;
|
|
412
|
-
const currentContext = await this.fin.me.interop.getCurrentContext(realType);
|
|
413
|
-
const wrappedHandler = (context, contextMetadata) => {
|
|
414
|
-
if (first) {
|
|
415
|
-
first = false;
|
|
416
|
-
if ((0, lodash_1.isEqual)(currentContext, context)) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
// eslint-disable-next-line consistent-return
|
|
421
|
-
return realHandler(context, contextMetadata);
|
|
422
|
-
};
|
|
423
|
-
return this.fin.me.interop.addContextHandler(wrappedHandler, realType);
|
|
424
|
-
})();
|
|
425
|
-
return {
|
|
426
|
-
...listener,
|
|
427
|
-
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
428
|
-
};
|
|
429
|
-
},
|
|
430
|
-
broadcast: this.broadcast.bind(this),
|
|
431
|
-
getCurrentContext: async (contextType) => {
|
|
432
|
-
const context = await this.fin.me.interop.getCurrentContext(contextType);
|
|
433
|
-
return context === undefined ? null : context;
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
exports.default = Fdc3Module;
|