@openfin/core 33.76.36 → 33.77.1

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