@openfin/core-web 0.38.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 (33) hide show
  1. package/LICENSE.md +4 -0
  2. package/README.md +45 -0
  3. package/docs/platform-developer-guide.md +229 -0
  4. package/docs/web-application-developer-guide.md +123 -0
  5. package/out/api-client.d.ts +140 -0
  6. package/out/api-client.js +1 -0
  7. package/out/docs/@openfin/core-web/README.md +49 -0
  8. package/out/docs/@openfin/core-web/functions/connect.md +54 -0
  9. package/out/docs/@openfin/core-web/iframe-broker/README.md +35 -0
  10. package/out/docs/@openfin/core-web/iframe-broker/functions/init.md +17 -0
  11. package/out/docs/@openfin/core-web/iframe-broker/functions/rejectConnections.md +19 -0
  12. package/out/docs/@openfin/core-web/iframe-broker/type-aliases/ConnectionOptions.md +23 -0
  13. package/out/docs/@openfin/core-web/shared-worker/README.md +16 -0
  14. package/out/docs/@openfin/core-web/shared-worker/variables/default.md +9 -0
  15. package/out/docs/@openfin/core-web/type-aliases/BaseConfig.md +18 -0
  16. package/out/docs/@openfin/core-web/type-aliases/BaseConnectionOptions.md +29 -0
  17. package/out/docs/@openfin/core-web/type-aliases/ConnectConfig.md +9 -0
  18. package/out/docs/@openfin/core-web/type-aliases/InheritModeConnectConfig.md +49 -0
  19. package/out/docs/@openfin/core-web/type-aliases/StandAloneConnectConfig.md +31 -0
  20. package/out/docs/@openfin/core-web/type-aliases/WebCreateLayoutOptions.md +15 -0
  21. package/out/docs/@openfin/core-web/type-aliases/WebLayoutComponent.md +23 -0
  22. package/out/docs/@openfin/core-web/type-aliases/WebLayoutInitOptions.md +15 -0
  23. package/out/docs/@openfin/core-web/type-aliases/WebLayoutOptions.md +15 -0
  24. package/out/docs/@openfin/core-web/type-aliases/WebLayoutPlatformOptions.md +15 -0
  25. package/out/docs/@openfin/core-web/type-aliases/WebLayoutSnapshot.md +15 -0
  26. package/out/docs/README.md +11 -0
  27. package/out/iframe-broker.d.ts +14 -0
  28. package/out/iframe-broker.js +1 -0
  29. package/out/main-77c8e2cd.js +1 -0
  30. package/out/main-993afa58.js +1 -0
  31. package/out/shared-worker.js +1 -0
  32. package/out/styles.css +737 -0
  33. package/package.json +59 -0
@@ -0,0 +1,17 @@
1
+ **@openfin/core-web** • [API](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../../README.md) / [@openfin/core-web/iframe-broker](../README.md) / init
6
+
7
+ # Function: init()
8
+
9
+ > **init**(`options`): `Promise`\<`void`\>
10
+
11
+ ## Parameters
12
+
13
+ • **options**: [`ConnectionOptions`](../type-aliases/ConnectionOptions.md)
14
+
15
+ ## Returns
16
+
17
+ `Promise`\<`void`\>
@@ -0,0 +1,19 @@
1
+ **@openfin/core-web** • [API](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../../README.md) / [@openfin/core-web/iframe-broker](../README.md) / rejectConnections
6
+
7
+ # Function: rejectConnections()
8
+
9
+ > **rejectConnections**(`options`?): `void`
10
+
11
+ ## Parameters
12
+
13
+ • **options?**
14
+
15
+ • **options\.reason?**: `string`
16
+
17
+ ## Returns
18
+
19
+ `void`
@@ -0,0 +1,23 @@
1
+ **@openfin/core-web** • [API](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../../README.md) / [@openfin/core-web/iframe-broker](../README.md) / ConnectionOptions
6
+
7
+ # Type alias: ConnectionOptions
8
+
9
+ > **ConnectionOptions**: `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### experimental?
14
+
15
+ > **`optional`** **experimental**: `object`
16
+
17
+ ### experimental.crossTab?
18
+
19
+ > **`optional`** **crossTab**: `"same-site"` \| `"none"`
20
+
21
+ ### sharedWorkerUrl
22
+
23
+ > **sharedWorkerUrl**: `string`
@@ -0,0 +1,16 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / @openfin/core-web/shared-worker
6
+
7
+ # @openfin/core-web/shared-worker
8
+
9
+ This file is the entry point for the worker powering web-interop.
10
+ It has no exports and is intended to be hosted with the url given to the `sharedWorkerUrl` option in the Iframe Broker (see: ["@openfin/core-web/iframe-broker"](../iframe-broker/README.md)).
11
+
12
+ ## Index
13
+
14
+ ### Variables
15
+
16
+ - [default](variables/default.md)
@@ -0,0 +1,9 @@
1
+ **@openfin/core-web** • [API](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../../README.md) / [@openfin/core-web/shared-worker](../README.md) / default
6
+
7
+ # Variable: default
8
+
9
+ > **default**: `null`
@@ -0,0 +1,18 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / BaseConfig
6
+
7
+ # Type alias: BaseConfig
8
+
9
+ > **BaseConfig**: `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### platform?
14
+
15
+ > **`optional`** **platform**: [`WebLayoutPlatformOptions`](WebLayoutPlatformOptions.md)
16
+
17
+ Options used to initialize Web Layouts related features. If omitted, calling `fin.Platform.Layout.init()`
18
+ will not work.
@@ -0,0 +1,29 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / BaseConnectionOptions
6
+
7
+ # Type alias: BaseConnectionOptions
8
+
9
+ > **BaseConnectionOptions**: `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### brokerUrl
14
+
15
+ > **brokerUrl**: `string`
16
+
17
+ The URL of the Web Interop broker to connect to.
18
+
19
+ ### interopConfig?
20
+
21
+ > **`optional`** **interopConfig**: `Partial`\<`OpenFin.InteropConfig`\>
22
+
23
+ Interop options to use to generate an interop client in `fin.me.interop`
24
+
25
+ ### timeout?
26
+
27
+ > **`optional`** **timeout**: `number`
28
+
29
+ Tears down and cancels the connection attempt if it is not complete within the specified timeout (in ms).
@@ -0,0 +1,9 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / ConnectConfig
6
+
7
+ # Type alias: ConnectConfig
8
+
9
+ > **ConnectConfig**: [`StandAloneConnectConfig`](StandAloneConnectConfig.md) \| [`InheritModeConnectConfig`](InheritModeConnectConfig.md)
@@ -0,0 +1,49 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / InheritModeConnectConfig
6
+
7
+ # Type alias: InheritModeConnectConfig
8
+
9
+ > **InheritModeConnectConfig**: [`BaseConfig`](BaseConfig.md) & `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### connectionInheritance
14
+
15
+ > **connectionInheritance**: `"enabled"`
16
+
17
+ #### Default Value
18
+
19
+ 'disabled'
20
+
21
+ If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
22
+ This means that the `brokerUrl` and `Identity` of the connection will be determined by the WebBroker
23
+ of the page where the WebLayout is instantiated via `fin.Platform.Layout.init()` call.
24
+
25
+ If 'disabled', the `options` property is required.
26
+
27
+ ### options?
28
+
29
+ > **`optional`** **options**: [`BaseConnectionOptions`](BaseConnectionOptions.md)
30
+
31
+ Options used to connect to an OpenFin Web Broker. Please note, these will be overriden if connectionInheritance
32
+ is 'enabled' and supported for the current browsing context. In the case that inherited options are unavailable,
33
+ these options will be used.
34
+
35
+ ### validateOptions()?
36
+
37
+ > **`optional`** **validateOptions**: (`inheritedOptions`) => `boolean` \| `Promise`\<`boolean`\>
38
+
39
+ Validates the inherited connection options from the parent browsing context, if available.
40
+
41
+ #### Parameters
42
+
43
+ • **inheritedOptions**: `Omit`\<[`BaseConnectionOptions`](BaseConnectionOptions.md), `"timeout"`\>
44
+
45
+ Inherited options
46
+
47
+ #### Returns
48
+
49
+ `boolean` \| `Promise`\<`boolean`\>
@@ -0,0 +1,31 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / StandAloneConnectConfig
6
+
7
+ # Type alias: StandAloneConnectConfig
8
+
9
+ > **StandAloneConnectConfig**: [`BaseConfig`](BaseConfig.md) & `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### connectionInheritance?
14
+
15
+ > **`optional`** **connectionInheritance**: `"disabled"`
16
+
17
+ #### Default Value
18
+
19
+ 'disabled'
20
+
21
+ If 'enabled', attempts to inherit connection options if it is running as a View within an OpenFin WebLayout.
22
+ This means that the `brokerUrl` and `Identity` of the connection will be determined by the WebBroker
23
+ of the page where the WebLayout is instantiated via `fin.Platform.Layout.init()` call.
24
+
25
+ If 'disabled', the `options` property is required.
26
+
27
+ ### options
28
+
29
+ > **options**: [`BaseConnectionOptions`](BaseConnectionOptions.md)
30
+
31
+ Options used to connect to an OpenFin Web Broker. Mandatory if StandAloneConnectConfig.connectionInheritance is 'disabled'.
@@ -0,0 +1,15 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebCreateLayoutOptions
6
+
7
+ # Type alias: WebCreateLayoutOptions
8
+
9
+ > **WebCreateLayoutOptions**: `Omit`\<`OpenFin.CreateLayoutOptions`, `"layout"`\> & `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### layout
14
+
15
+ > **layout**: [`WebLayoutOptions`](WebLayoutOptions.md)
@@ -0,0 +1,23 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutComponent
6
+
7
+ # Type alias: WebLayoutComponent
8
+
9
+ > **WebLayoutComponent**: `OpenFin.LayoutComponent` & `object`
10
+
11
+ Web-only component supplied to IframeViewComponent as it's config
12
+
13
+ ## Type declaration
14
+
15
+ ### componentState?
16
+
17
+ > **`optional`** **componentState**: `OpenFin.LayoutComponent`\[`"componentState"`\] & `object`
18
+
19
+ #### Type declaration
20
+
21
+ ##### web?
22
+
23
+ > **`optional`** **web**: `WebState`
@@ -0,0 +1,15 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutInitOptions
6
+
7
+ # Type alias: WebLayoutInitOptions
8
+
9
+ > **WebLayoutInitOptions**: `Omit`\<`OpenFin.InitLayoutOptions`, `"layoutManagerOverride"`\> & `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### layoutManagerOverride?
14
+
15
+ > **`optional`** **layoutManagerOverride**: `OpenFin.LayoutManagerOverride`\<[`WebLayoutSnapshot`](WebLayoutSnapshot.md)\>
@@ -0,0 +1,15 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutOptions
6
+
7
+ # Type alias: WebLayoutOptions
8
+
9
+ > **WebLayoutOptions**: `Omit`\<`OpenFin.LayoutOptions`, `"content"`\> & `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### content?
14
+
15
+ > **`optional`** **content**: `WebLayoutContent`
@@ -0,0 +1,15 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutPlatformOptions
6
+
7
+ # Type alias: WebLayoutPlatformOptions
8
+
9
+ > **WebLayoutPlatformOptions**: `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### layoutSnapshot
14
+
15
+ > **layoutSnapshot**: [`WebLayoutSnapshot`](WebLayoutSnapshot.md)
@@ -0,0 +1,15 @@
1
+ **@openfin/core-web** • [API](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@openfin/core-web](../../../README.md) / [@openfin/core-web](../README.md) / WebLayoutSnapshot
6
+
7
+ # Type alias: WebLayoutSnapshot
8
+
9
+ > **WebLayoutSnapshot**: `object`
10
+
11
+ ## Type declaration
12
+
13
+ ### layouts
14
+
15
+ > **layouts**: `Record`\<`string`, [`WebLayoutOptions`](WebLayoutOptions.md)\>
@@ -0,0 +1,11 @@
1
+ **@openfin/core-web** • API
2
+
3
+ ***
4
+
5
+ # @openfin/core-web
6
+
7
+ ## Modules
8
+
9
+ - [@openfin/core-web](@openfin/core-web/README.md)
10
+ - [@openfin/core-web/iframe-broker](@openfin/core-web/iframe-broker/README.md)
11
+ - [@openfin/core-web/shared-worker](@openfin/core-web/shared-worker/README.md)
@@ -0,0 +1,14 @@
1
+ export declare type ConnectionOptions = {
2
+ sharedWorkerUrl: string;
3
+ experimental?: {
4
+ crossTab?: 'same-site' | 'none';
5
+ };
6
+ };
7
+
8
+ export declare const init: (options: ConnectionOptions) => Promise<void>;
9
+
10
+ export declare function rejectConnections(options?: {
11
+ reason: string;
12
+ }): void;
13
+
14
+ export { }
@@ -0,0 +1 @@
1
+ "use strict";const e="web-broker-ports-ready",t="worker-initialize-connection",r="create-fallback-connection",i="request-fallback-connection",o=e=>`ack-${e}`,n=(...e)=>({log:(...t)=>console.log(`[${(new Date).toISOString()}]`,...(e=>e.map((e=>`[${e}]`)))(e),...t),getLogger:(...t)=>n(...e,...t)});class s{static get lockApi(){return navigator.locks}constructor(e){this.name=e,this.releaseCallback=null,s.pending.add(this),this.lockAcquiredPromise=new Promise(((e,t)=>{this.lockReleasedPromise=s.lockApi.request(this.name,(()=>(s.pending.delete(this),e(),new Promise((e=>{s.held.add(this),this.releaseCallback=e}))))).catch((e=>{throw t(e),e}))}))}async acquired(){await this.lockAcquiredPromise}async release(){if(!this.releaseCallback)throw new Error(`Lock ${this.name} not acquired.`);this.releaseCallback(),this.releaseCallback=null,await this.lockReleasedPromise,s.held.delete(this)}async onReleased(e){if(!this.lockReleasedPromise)throw new Error(`Lock ${this.name} not queued.`);return this.lockReleasedPromise.then(e)}autoRelease(){this.acquired().then((()=>this.release()))}static async releaseAll(){const e=Promise.all([...this.pending].map((async e=>{await e.acquired(),await e.release()})));await Promise.all([...this.held].map((async e=>{await e.release()}))),await e}}s.pending=new Set,s.held=new Set;const a=e=>window.top===e,c=(e,t)=>{try{return e.origin===t.origin}catch(e){return!1}},d="openfin/web-shared-worker";class h{constructor(e,t,n){this.workerUrl=e,this.iframeWindow=t,this.forceWorker=n,this.isSharedWorkerSupported=()=>!this.forceWorker&&!!window.SharedWorker,this.state="ready",this.establishWorkerConnectionViaWindow=async e=>{if(c(this.iframeWindow,e)){const t=new MessageChannel;return new Promise(((n,s)=>{t.port1.addEventListener("message",(e=>{e.data.topic===o(r)&&(e.data.success?n(t.port1):s(e.data.reason))})),t.port1.start();const a={topic:i};e.postMessage(a,location.origin,[t.port2])}))}throw new Error("Could not connect via top level browsing context as its origin does not much the web interop broker.")},this.listenForNestedConnections=e=>{"top-window"===this.state&&c(this.iframeWindow,this.iframeWindow.parent)&&this.iframeWindow.parent.addEventListener("message",(t=>{if(t.origin===location.origin&&t.data.topic===i){const[i]=t.ports,o={topic:r};e.postMessage(o,[i])}}))},this.initialize=async()=>{if("ready"!==this.state)throw new Error("Worker connection already initialized");if((e=>{const t=r=>!(!(e=>{try{return!e.origin}catch(e){return!0}})(r)&&r.origin===e.origin)||!a(r)&&t(r.parent);return!a(e)&&t(e.parent)})(this.iframeWindow)&&c(this.iframeWindow,this.iframeWindow.top))return this.state="partitioned-frame",this.establishWorkerConnectionViaWindow(this.iframeWindow.top);if(a(this.iframeWindow.parent)){let e;return this.state="top-window",e=this.isSharedWorkerSupported()?new SharedWorker(this.workerUrl,d).port:new Worker(this.workerUrl),this.listenForNestedConnections(e),e}{if(this.state="frame",!this.isSharedWorkerSupported())try{return await this.establishWorkerConnectionViaWindow(this.iframeWindow.top)}catch(e){throw new Error(`SharedWorker is not supported and an unexpected error occured when trying to connect via fallback mechanism: ${e.message}`)}const{port:e}=new SharedWorker(this.workerUrl,d);return e}}}}const l=n("@openfin/core-web/iframe-broker"),w=()=>{const e=((e,t)=>{const r=new RegExp(`^${t}<(?<meta>.*)>$`).exec(e)?.groups?.meta;if(r)try{return JSON.parse(atob(r))}catch(e){throw new Error(`Failed to decode JSON from ${r}.`)}})(window.name,"of-broker");if(!e)throw new Error("Invalid or missing identity string in iframe context. Ensure that this iframe is being renderered via the @openfin/core-web library.");return e};function p(t){const r={topic:o(e),success:!1,reason:t?.reason??"Connection Rejected"};window.parent.postMessage(r,"*")}exports.init=async r=>{try{const{sharedWorkerUrl:i}=r;await("loading"===document.readyState?new Promise((e=>{const t=()=>{e(),window.removeEventListener("DOMContentLoaded",t)};window.addEventListener("DOMContentLoaded",t)})):Promise.resolve());const n=w(),a=new h(i,window,"same-site"!==r.experimental?.crossTab),c=await a.initialize();l.log(`Loading ${i} in ${a.state} mode...`);const d=await(async(r,i,n)=>{const a=new MessageChannel,c=new MessageChannel,d={topic:t,payload:{identity:n}},h=new s((e=>`__OPENFIN__${e.uuid}_${e.name}`)(n));await h.acquired(),await new Promise(((e,r)=>{i.addEventListener("message",(i=>{i.data.topic===o(t)&&(i.data.success?e():r(new Error(i.data.reason)))})),i.start?.(),i.postMessage(d,[c.port2])}));const l={topic:o(e),success:!0,payload:{identity:n}};return r.postMessage(l,"*",[a.port2,c.port1]),a.port1})(window.parent,c,n);d.start(),c.start?.(),l.log(`Port transfer complete in ${a.state} mode. Connection established with identity ${JSON.stringify(n)}. SharedWorker support=${a.isSharedWorkerSupported()}`)}catch(e){const t=new Error(`An unexpected error occured during initialization. ${e.message}`);p({reason:t.message}),console.error(t)}},exports.rejectConnections=p;