@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,683 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.InteropClient = void 0;
16
- const base_1 = require("../base");
17
- const SessionContextGroupClient_1 = require("./SessionContextGroupClient");
18
- const utils_1 = require("./utils");
19
- /**
20
- * @PORTED
21
- * @typedef { object } Intent
22
- * @summary The combination of an action and a context that is passed to an application for resolution.
23
- * @property { string } name Name of the intent.
24
- * @property { Context } context Data associated with the intent
25
- */
26
- /**
27
- * @REMOVED
28
- * @typedef { object } Subscription
29
- * @summary Object returned when subscribing a handler.
30
- * @property { function } unsubscribe Function to unsubscribe the handler.
31
- */
32
- /**
33
- * @typedef { function } ContextHandler
34
- * @summary Subscription function for addContextHandler.
35
- */
36
- /**
37
- * @typedef { function } IntentHandler
38
- * @summary Subscription function for registerIntentHandler
39
- */
40
- /**
41
- * @PORTED
42
- * @typedef { object } ClientIdentity
43
- * @summary The Identity for a Channel Client. Includes endpointId to differentiate between different connections for an entity.
44
- * @property {string} uuid GUID of an application.
45
- * @property {string} name Name of an entity in an application.
46
- * @property {string} endpointId Unique differentiator for different Channel connections for an entity.
47
- */
48
- /**
49
- * @PORTED
50
- * @typedef { object } ContextGroupInfo
51
- * @summary Information for a Context Group. Contains metadata for displaying the group properly.
52
- * @property {string} id Name of the context group
53
- * @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.
54
- */
55
- /**
56
- * @PORTED
57
- * @typedef { object } DisplayMetadata
58
- * @summary The display data for a Context Group.
59
- * @property {string} name A user-readable name for this context group, e.g: `"Red"`
60
- * @property {string} [color] The color that should be associated within this context group when displaying this context group in a UI, e.g: `0xFF0000`.
61
- * @property {string} [glyph] A URL of an image that can be used to display this context group
62
- */
63
- /**
64
- * @PORTED
65
- * @typedef { object } Context
66
- * @summary Data passed between entities and applications.
67
- * @property {object} [id] An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
68
- * @property {string} [name] User-readable name for the incoming context.
69
- * @property {string} type Conserved type for the context (e.g. `instrument` or `country`)
70
- */
71
- /**
72
- * @REMOVED
73
- * @typedef { object } ContextForIntent
74
- * @summary Data passed between entities and applications, including an optional metadata.
75
- * @property {object} [id] An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
76
- * @property {string} [name] User-readable name for the incoming context.
77
- * @property {string} type Conserved type for the context (e.g. `instrument` or `country`)
78
- * @property {any} [metadata]
79
- */
80
- /**
81
- * @REMOVED
82
- * @typedef { object } SessionContextGroup
83
- * @summary An instance of a SessionContextGroup
84
- * @property {string} id The SessionContextGroup's id.
85
- * @property {setContext} setContext Sets a context of a certain type
86
- * @property {getCurrentContext} getCurrentContext Gets the currently set context of a certain type
87
- * @property {addContextHandler} addContextHandler Adds a handler for context change.
88
- */
89
- /**
90
- * @typedef {function} setContext
91
- * @summary A SessionContextGroup instance method for setting a context in the SessionContextGroup.
92
- * @param context The Context to be set.
93
- *
94
- */
95
- /**
96
- * @typedef {function} getCurrentContext
97
- * @summary A SessionContextGroup instance method for getting the current context of a certain type.
98
- * @param contextType The Context Type to get. If not specified the last contextType set would get used.
99
- *
100
- */
101
- /**
102
- * @typedef {function} addContextHandler
103
- * @summary A SessionContextGroup instance method for adding a handler for context change.
104
- * @param contextHandler The callback to be invoked. Is invoked when (a) the context changes or (b) immediately after getting created if the context is already set.
105
- * @param contextType The context type this handler should listen to. If not specified, a global handler for all context types will get created. Only one global handler is allowed per SessionContextGroup.
106
- *
107
- */
108
- /**
109
- * {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
110
- *
111
- * The Interop Client API is broken up into two groups:
112
- *
113
- * **Content Facing APIs** - For Application Developers putting Views into a Platform Window, who care about Context. These are APIs that send out and receive the Context data that flows between applications. Think of this as the Water in the Interop Pipes.
114
- *
115
- * **Context Grouping APIs** - For Platform Developers, to add and remove Views to and from Context Groups. These APIs are utilized under-the-hood in Platforms, so they don't need to be used to participate in Interop. These are the APIs that decide which entities the context data flows between. Think of these as the valves or pipes that control the flow of Context Data for Interop.
116
- *
117
- * ---
118
- *
119
- * All APIs are available at the `fin.me.interop` namespace.
120
- *
121
- * ---
122
- *
123
- * **You only need 2 things to participate in Interop Context Grouping:**
124
- * * A Context Handler for incoming context: {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
125
- * * Call setContext on your context group when you want to share context with other group members: {@link InteropClient#setContext setContext(context)}
126
- *
127
- * ---
128
- *
129
- * ##### Constructor
130
- * Returned by {@link Interop.connectSync Interop.connectSync}.
131
- *
132
- * ---
133
- *
134
- * ##### Interop methods intended for Views
135
- *
136
- *
137
- * **Context Groups API**
138
- * * {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
139
- * * {@link InteropClient#setContext setContext(context)}
140
- * * {@link InteropClient#getCurrentContext getCurrentContext(contextType?)}
141
- * * {@link InteropClient#joinSessionContextGroup joinSessionContextGroup(sessionContextGroupId)}
142
- *
143
- *
144
- * **Intents API**
145
- * * {@link InteropClient#fireIntent fireIntent(intent)}
146
- * * {@link InteropClient#registerIntentHandler registerIntentHandler(intentHandler, intentName)}
147
- * * {@link InteropClient#getInfoForIntent getInfoForIntent(infoForIntentOptions)}
148
- * * {@link InteropClient#getInfoForIntentsByContext getInfoForIntentsByContext(context)}
149
- * * {@link InteropClient#fireIntentForContext fireIntentForContext(contextForIntent)}
150
- *
151
- * ##### Interop methods intended for Windows
152
- * * {@link InteropClient#getContextGroups getContextGroups()}
153
- * * {@link InteropClient#joinContextGroup joinContextGroup(contextGroupId, target?)}
154
- * * {@link InteropClient#removeFromContextGroup removeFromContextGroup(target?)}
155
- * * {@link InteropClient#getInfoForContextGroup getInfoForContextGroup(contextGroupId)}
156
- * * {@link InteropClient#getAllClientsInContextGroup getAllClientsInContextGroup(contextGroupId)}
157
- *
158
- */
159
- class InteropClient extends base_1.Base {
160
- /**
161
- * @internal
162
- */
163
- constructor(wire, name, interopConfig = {}) {
164
- super(wire);
165
- _InteropClient_clientPromise.set(this, void 0);
166
- _InteropClient_sessionContextGroups.set(this, void 0);
167
- __classPrivateFieldSet(this, _InteropClient_sessionContextGroups, new Map(), "f");
168
- __classPrivateFieldSet(this, _InteropClient_clientPromise, this.wire.environment.whenReady().then(() => {
169
- return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
170
- payload: interopConfig
171
- });
172
- }), "f");
173
- }
174
- /*
175
- Client APIs
176
- */
177
- /**
178
- * Sets a context for the context group of the current entity.
179
- *
180
- * @remarks The entity must be part of a context group in order set a context.
181
- *
182
- * @param context - New context to set.
183
- *
184
- * @example
185
- * ```js
186
- * setInstrumentContext = async (ticker) => {
187
- * fin.me.interop.setContext({type: 'instrument', id: {ticker}})
188
- * }
189
- *
190
- * // The user clicks an instrument of interest. We want to set that Instrument context so that the rest of our workflow updates with information for that instrument
191
- * instrumentElement.on('click', (evt) => {
192
- * setInstrumentContext(evt.ticker)
193
- * })
194
- * ```
195
- */
196
- async setContext(context) {
197
- this.wire.sendAction('interop-client-set-context').catch((e) => {
198
- // don't expose, analytics-only call
199
- });
200
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
201
- return client.dispatch('setContext', { context });
202
- }
203
- /**
204
- * Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler,
205
- * it will receive all of its declared contexts.
206
- *
207
- * @param handler - Handler for incoming context.
208
- * @param contextType - The type of context you wish to handle.
209
- *
210
- * @example
211
- * ```js
212
- * function handleIncomingContext(contextInfo) {
213
- * const { type, id } = contextInfo;
214
- * switch (type) {
215
- * case 'instrument':
216
- * handleInstrumentContext(contextInfo);
217
- * break;
218
- * case 'country':
219
- * handleCountryContext(contextInfo);
220
- * break;
221
- *
222
- * default:
223
- * break;
224
- * }
225
- * }
226
- *
227
- *
228
- * function handleInstrumentContext(contextInfo) {
229
- * const { type, id } = contextInfo;
230
- * console.log('contextInfo for instrument', contextInfo)
231
- * }
232
- *
233
- * function handleCountryContext(contextInfo) {
234
- * const { type, id } = contextInfo;
235
- * console.log('contextInfo for country', contextInfo)
236
- * }
237
- *
238
- * fin.me.interop.addContextHandler(handleIncomingContext);
239
- * ```
240
- *
241
- *
242
- * We are also testing the ability to add a context handler for specific contexts. If you would like to use
243
- * this, please make sure you add your context handlers at the top level of your application, on a page that
244
- * does not navigate/reload/re-render, to avoid memory leaks. This feature is experimental:
245
- *
246
- * ```js
247
- * function handleInstrumentContext(contextInfo) {
248
- * const { type, id } = contextInfo;
249
- * console.log('contextInfo for instrument', contextInfo)
250
- * }
251
- *
252
- * function handleCountryContext(contextInfo) {
253
- * const { type, id } = contextInfo;
254
- * console.log('contextInfo for country', contextInfo)
255
- * }
256
- *
257
- *
258
- * fin.me.interop.addContextHandler(handleInstrumentContext, 'instrument')
259
- * fin.me.interop.addContextHandler(handleCountryContext, 'country')
260
- * ```
261
- */
262
- async addContextHandler(handler, contextType) {
263
- this.wire.sendAction('interop-client-add-context-handler').catch((e) => {
264
- // don't expose, analytics-only call
265
- });
266
- if (typeof handler !== 'function') {
267
- throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
268
- }
269
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
270
- let handlerId;
271
- if (contextType) {
272
- handlerId = `invokeContextHandler-${contextType}-${(0, utils_1.generateId)()}`;
273
- console.warn(`Warning: By providing a contextType (${contextType}), you are using the experimental addContextHandler. To avoid issues, make sure you are adding your context handlers at the top level in your application.`);
274
- }
275
- else {
276
- handlerId = 'invokeContextHandler';
277
- }
278
- const wrappedHandler = (0, utils_1.wrapContextHandler)(handler, handlerId);
279
- client.register(handlerId, wrappedHandler);
280
- await client.dispatch('contextHandlerRegistered', { handlerId, contextType });
281
- return {
282
- unsubscribe: async () => {
283
- client.remove(handlerId);
284
- await client.dispatch('removeContextHandler', { handlerId });
285
- }
286
- };
287
- }
288
- /*
289
- Platform Window APIs
290
- */
291
- /**
292
- * Returns the Interop-Broker-defined context groups available for an entity to join.
293
- * Used by Platform Windows.
294
- *
295
- * @example
296
- * ```js
297
- * fin.me.interop.getContextGroups()
298
- * .then(contextGroups => {
299
- * contextGroups.forEach(contextGroup => {
300
- * console.log(contextGroup.displayMetadata.name)
301
- * console.log(contextGroup.displayMetadata.color)
302
- * })
303
- * })
304
- * ```
305
- */
306
- async getContextGroups() {
307
- this.wire.sendAction('interop-client-get-context-groups').catch((e) => {
308
- // don't expose, analytics-only call
309
- });
310
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
311
- return client.dispatch('getContextGroups');
312
- }
313
- /**
314
- * Join all Interop Clients at the given identity to context group `contextGroupId`.
315
- * If no target is specified, it adds the sender to the context group.
316
- *
317
- * @remarks 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.
318
- * 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.
319
- * For all intents and purposes, there will only be 1 connection present in Platform and Browser implmentations, so this point is more-or-less moot.
320
- * Used by Platform Windows.
321
- *
322
- * @param contextGroupId - Id of the context group.
323
- * @param target - Identity of the entity you wish to join to a context group.
324
- *
325
- * @example
326
- * ```js
327
- * joinViewToContextGroup = async (contextGroupId, view) => {
328
- * await fin.me.interop.joinContextGroup(contextGroupId, view);
329
- * }
330
- *
331
- * getLastFocusedView()
332
- * .then(lastFocusedViewIdentity => {
333
- * joinViewToContextGroup('red', lastFocusedViewIdentity)
334
- * })
335
- * ```
336
- */
337
- async joinContextGroup(contextGroupId, target) {
338
- this.wire.sendAction('interop-client-join-context-group').catch((e) => {
339
- // don't expose, analytics-only call
340
- });
341
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
342
- if (!contextGroupId) {
343
- throw new Error('No contextGroupId specified for joinContextGroup.');
344
- }
345
- return client.dispatch('joinContextGroup', { contextGroupId, target });
346
- }
347
- /**
348
- * Removes the specified target from a context group.
349
- * If no target is specified, it removes the sender from their context group.
350
- * Used by Platform Windows.
351
- *
352
- * @param target - Identity of the entity you wish to join to a context group.
353
- *
354
- * @example
355
- * ```js
356
- * removeViewFromContextGroup = async (view) => {
357
- * await fin.me.interop.removeFromContextGroup(view);
358
- * }
359
- *
360
- * getLastFocusedView()
361
- * .then(lastFocusedViewIdentity => {
362
- * removeViewFromContextGroup(lastFocusedViewIdentity)
363
- * })
364
- * ```
365
- */
366
- async removeFromContextGroup(target) {
367
- this.wire.sendAction('interop-client-remove-from-context-group').catch((e) => {
368
- // don't expose, analytics-only call
369
- });
370
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
371
- return client.dispatch('removeFromContextGroup', { target });
372
- }
373
- /**
374
- * Gets all clients for a context group.
375
- *
376
- * @remarks **This is primarily used for platform windows. Views within a platform should not have to use this API.**
377
- *
378
- * Returns the Interop-Broker-defined context groups available for an entity to join.
379
- * @param contextGroupId - The id of context group you wish to get clients for.
380
- *
381
- * @example
382
- * ```js
383
- * fin.me.interop.getAllClientsInContextGroup('red')
384
- * .then(clientsInContextGroup => {
385
- * console.log(clientsInContextGroup)
386
- * })
387
- * ```
388
- */
389
- async getAllClientsInContextGroup(contextGroupId) {
390
- this.wire.sendAction('interop-client-get-all-clients-in-context-group').catch((e) => {
391
- // don't expose, analytics-only call
392
- });
393
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
394
- if (!contextGroupId) {
395
- throw new Error('No contextGroupId specified for getAllClientsInContextGroup.');
396
- }
397
- return client.dispatch('getAllClientsInContextGroup', { contextGroupId });
398
- }
399
- /**
400
- * Gets display info for a context group
401
- *
402
- * @remarks Used by Platform Windows.
403
- * @param contextGroupId - The id of context group you wish to get display info for.
404
- *
405
- * @example
406
- * ```js
407
- * fin.me.interop.getInfoForContextGroup('red')
408
- * .then(contextGroupInfo => {
409
- * console.log(contextGroupInfo.displayMetadata.name)
410
- * console.log(contextGroupInfo.displayMetadata.color)
411
- * })
412
- * ```
413
- */
414
- async getInfoForContextGroup(contextGroupId) {
415
- this.wire.sendAction('interop-client-get-info-for-context-group').catch((e) => {
416
- // don't expose, analytics-only call
417
- });
418
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
419
- if (!contextGroupId) {
420
- throw new Error('No contextGroupId specified for getInfoForContextGroup.');
421
- }
422
- return client.dispatch('getInfoForContextGroup', { contextGroupId });
423
- }
424
- /**
425
- * Sends an intent to the Interop Broker to resolve.
426
- * @param intent - The combination of an action and a context that is passed to an application for resolution.
427
- *
428
- * @example
429
- * ```js
430
- * // View wants to fire an Intent after a user clicks on a ticker
431
- * tickerElement.on('click', (element) => {
432
- * const ticker = element.innerText;
433
- * const intent = {
434
- * name: 'ViewChart',
435
- * context: {type: 'fdc3.instrument', id: { ticker }}
436
- * }
437
- *
438
- * fin.me.interop.fireIntent(intent);
439
- * })
440
- * ```
441
- */
442
- async fireIntent(intent) {
443
- this.wire.sendAction('interop-client-fire-intent').catch((e) => {
444
- // don't expose, this is only for api analytics purposes
445
- });
446
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
447
- return client.dispatch('fireIntent', intent);
448
- }
449
- /**
450
- * Adds an intent handler for incoming intents. The last intent sent of the name subscribed to will be received.
451
- * @param handler - Registered function meant to handle a specific intent type.
452
- * @param intentName - The name of an intent.
453
- *
454
- * @example
455
- * ```js
456
- * const intentHandler = (intent) => {
457
- * const { context } = intent;
458
- * myViewChartHandler(context);
459
- * };
460
- *
461
- * const subscription = await fin.me.interop.registerIntentHandler(intentHandler, 'ViewChart');
462
- *
463
- * function myAppCloseSequence() {
464
- * // to unsubscribe the handler, simply call:
465
- * subscription.unsubscribe();
466
- * }
467
- * ```
468
- */
469
- async registerIntentHandler(handler, intentName, options) {
470
- this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
471
- // don't expose, this is only for api analytics purposes
472
- });
473
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
474
- const handlerId = `intent-handler-${intentName}`;
475
- const wrappedHandler = (0, utils_1.wrapIntentHandler)(handler, handlerId);
476
- try {
477
- await client.register(handlerId, wrappedHandler);
478
- await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
479
- }
480
- catch (error) {
481
- throw new Error('Unable to register intent handler');
482
- }
483
- return {
484
- unsubscribe: async () => {
485
- client.remove(handlerId);
486
- }
487
- };
488
- }
489
- /**
490
- * Gets the last context of the Context Group currently subscribed to. It takes an optional Context Type and returns the
491
- * last context of that type.
492
- * @param contextType
493
- *
494
- * @example
495
- * ```js
496
- * await fin.me.interop.joinContextGroup('yellow');
497
- * await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
498
- * const currentContext = await fin.me.interop.getCurrentContext();
499
- *
500
- * // with a specific context
501
- * await fin.me.interop.joinContextGroup('yellow');
502
- * await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
503
- * await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
504
- * const currentContext = await fin.me.interop.getCurrentContext('country');
505
- * ```
506
- */
507
- async getCurrentContext(contextType) {
508
- this.wire.sendAction('interop-client-get-current-context').catch((e) => {
509
- // don't expose, analytics-only call
510
- });
511
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
512
- return client.dispatch('getCurrentContext', { contextType });
513
- }
514
- /**
515
- * Get information for a particular Intent from the Interop Broker.
516
- *
517
- * @remarks To resolve this info, the function handleInfoForIntent is meant to be overridden in the Interop Broker.
518
- * The format for the response will be determined by the App Provider overriding the function.
519
- *
520
- * @param options
521
- *
522
- * @example
523
- * ```js
524
- * const intentInfo = await fin.me.interop.getInfoForIntent('ViewChart');
525
- * ```
526
- */
527
- async getInfoForIntent(options) {
528
- this.wire.sendAction('interop-client-get-info-for-intent').catch((e) => {
529
- // don't expose, analytics-only call
530
- });
531
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
532
- return client.dispatch('getInfoForIntent', options);
533
- }
534
- /**
535
- * Get information from the Interop Broker on all Intents that are meant to handle a particular context.
536
- *
537
- * @remarks To resolve this info, the function handleInfoForIntentsByContext is meant to be overridden in the Interop Broker.
538
- * The format for the response will be determined by the App Provider overriding the function.
539
- *
540
- * @param context
541
- *
542
- * @example
543
- * ```js
544
- * tickerElement.on('click', (element) => {
545
- * const ticker = element.innerText;
546
- *
547
- * const context = {
548
- * type: 'fdc3.instrument',
549
- * id: {
550
- * ticker
551
- * }
552
- * }
553
- *
554
- * const intentsInfo = await fin.me.interop.getInfoForIntentByContext(context);
555
- * })
556
- * ```
557
- */
558
- async getInfoForIntentsByContext(context) {
559
- this.wire.sendAction('interop-client-get-info-for-intents-by-context').catch((e) => {
560
- // don't expose, analytics-only call
561
- });
562
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
563
- return client.dispatch('getInfoForIntentsByContext', context);
564
- }
565
- /**
566
- * Sends a Context that will be resolved to an Intent by the Interop Broker.
567
- * This context accepts a metadata property.
568
- *
569
- * @remarks To resolve this info, the function handleFiredIntentByContext is meant to be overridden in the Interop Broker.
570
- * The format for the response will be determined by the App Provider overriding the function.
571
- *
572
- * @param context
573
- *
574
- * @example
575
- * ```js
576
- * tickerElement.on('click', (element) => {
577
- * const ticker = element.innerText;
578
- *
579
- * const context = {
580
- * type: 'fdc3.instrument',
581
- * id: {
582
- * ticker
583
- * }
584
- * }
585
- *
586
- * const intentResolution = await fin.me.interop.fireIntentForContext(context);
587
- * })
588
- * ```
589
- */
590
- async fireIntentForContext(context) {
591
- this.wire.sendAction('interop-client-fire-intent-for-context').catch((e) => {
592
- // don't expose, analytics-only call
593
- });
594
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
595
- return client.dispatch('fireIntentForContext', context);
596
- }
597
- /**
598
- * Join the current entity to session context group `sessionContextGroupId` and return a sessionContextGroup instance.
599
- * If the sessionContextGroup doesn't exist, one will get created.
600
- *
601
- * @remarks Session Context Groups do not persist between runs and aren't present on snapshots.
602
- * @param sessionContextGroupId - Id of the context group.
603
- *
604
- * @example
605
- * Say we want to have a Session Context Group that holds UI theme information for all apps to consume:
606
- *
607
- * My color-picker View:
608
- * ```js
609
- * const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
610
- *
611
- * const myColorPickerElement = document.getElementById('color-palette-picker');
612
- * myColorPickerElement.addEventListener('change', event => {
613
- * themeSessionContextGroup.setContext({ type: 'color-palette', selection: event.value });
614
- * });
615
- * ```
616
- *
617
- * In other views:
618
- * ```js
619
- * const themeSessionContextGroup = await fin.me.interop.joinSessionContextGroup('theme');
620
- *
621
- * const changeColorPalette = ({ selection }) => {
622
- * // change the color palette to the selection
623
- * };
624
- *
625
- * // If the context is already set by the time the handler was set, the handler will get invoked immediately with the current context.
626
- * themeSessionContextGroup.addContextHandler(changeColorPalette, 'color-palette');
627
- * ```
628
- */
629
- async joinSessionContextGroup(sessionContextGroupId) {
630
- try {
631
- const currentSessionContextGroup = __classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").get(sessionContextGroupId);
632
- if (currentSessionContextGroup) {
633
- return currentSessionContextGroup.getUserInstance();
634
- }
635
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
636
- const { hasConflict } = await client.dispatch('sessionContextGroup:createIfNeeded', {
637
- sessionContextGroupId
638
- });
639
- if (hasConflict) {
640
- console.warn(`A (non-session) context group with the name "${sessionContextGroupId}" already exists. If you are trying to join a Context Group, call joinContextGroup instead.`);
641
- }
642
- const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
643
- __classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").set(sessionContextGroupId, newSessionContextGroup);
644
- return newSessionContextGroup.getUserInstance();
645
- }
646
- catch (error) {
647
- console.error(`Error thrown trying to create Session Context Group with id "${sessionContextGroupId}": ${error}`);
648
- throw error;
649
- }
650
- }
651
- /**
652
- * Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
653
- * Only one listener per Interop Client can be set.
654
- * @param listener
655
- *
656
- * @example
657
- * ```js
658
- * const listener = (event) => {
659
- * const { type, topic, brokerName} = event;
660
- * console.log(`Disconnected from Interop Broker ${brokerName} `);
661
- * }
662
- *
663
- * await fin.me.interop.onDisconnection(listener);
664
- * ```
665
- */
666
- async onDisconnection(listener) {
667
- this.wire.sendAction('interop-client-add-ondisconnection-listener').catch((e) => {
668
- // don't expose, analytics-only call
669
- });
670
- const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
671
- return client.onDisconnection((event) => {
672
- const { uuid } = event;
673
- listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
674
- });
675
- }
676
- // used to ferry fdc3-only calls from the fdc3 shim to the Interop Broker
677
- static async ferryFdc3Call(interopClient, action, payload) {
678
- const client = await __classPrivateFieldGet(interopClient, _InteropClient_clientPromise, "f");
679
- return client.dispatch(action, payload || null);
680
- }
681
- }
682
- exports.InteropClient = InteropClient;
683
- _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap();