@floegence/floe-webapp-boot 0.56.8 → 0.56.10

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.
@@ -1,20 +1,22 @@
1
- import { clearAcquisitionSource as s, AcquisitionError as c, synchronizeAcquisitionSourceSnapshot as u } from "./acquisition.js";
2
- import { closeProxyBootstrap as l, synchronizeProxyBootstrap as a } from "./proxy-bootstrap.js";
3
- function y(t, i = {}) {
4
- let e = !1, r = null;
1
+ import { createSessionHealthMonitor as l } from "./session-health.js";
2
+ import { clearAcquisitionSource as u, AcquisitionError as s, synchronizeAcquisitionSourceSnapshot as a } from "./acquisition.js";
3
+ import { closeProxyBootstrap as f, synchronizeProxyBootstrap as d } from "./proxy-bootstrap.js";
4
+ function m(n, e = {}) {
5
+ let t = !1, r = null;
6
+ const c = l();
5
7
  return Object.freeze({
6
- synchronize(n) {
7
- if (e) throw new c("acquisition_lifecycle_disposed");
8
- const o = u(t, n);
9
- if (n.state === "connected" && o === null)
10
- throw new c("connected_acquisition_missing");
11
- i.proxyBootstrap !== void 0 && a(i.proxyBootstrap, o), o !== null && o !== r && i.onConnected?.(o), r = o;
8
+ synchronize(i) {
9
+ if (t) throw new s("acquisition_lifecycle_disposed");
10
+ const o = a(n, i);
11
+ if (i.state === "connected" && o === null)
12
+ throw new s("connected_acquisition_missing");
13
+ e.proxyBootstrap !== void 0 && d(e.proxyBootstrap, o), o !== null && o !== r && e.onConnected?.(o), r = o, c.synchronize(i.state === "connected" ? i.currentSession ?? null : null);
12
14
  },
13
15
  dispose() {
14
- e || (e = !0, r = null, i.proxyBootstrap !== void 0 && l(i.proxyBootstrap), s(t));
16
+ t || (t = !0, r = null, c.dispose(), e.proxyBootstrap !== void 0 && f(e.proxyBootstrap), u(n));
15
17
  }
16
18
  });
17
19
  }
18
20
  export {
19
- y as createAcquisitionConnectionLifecycle
21
+ m as createAcquisitionConnectionLifecycle
20
22
  };
@@ -0,0 +1,5 @@
1
+ import type { Session } from '@floegence/flowersec-core';
2
+ export declare function createSessionHealthMonitor(): Readonly<{
3
+ synchronize(next: Session | null): void;
4
+ dispose(): void;
5
+ }>;
@@ -0,0 +1,39 @@
1
+ function E() {
2
+ let e = null, i = !1, o, s;
3
+ const r = typeof window > "u" ? void 0 : window, c = typeof document > "u" ? void 0 : document, l = () => {
4
+ clearTimeout(o), o = void 0;
5
+ const t = s;
6
+ s = void 0, t?.abort();
7
+ }, u = () => {
8
+ clearTimeout(o), !i && e !== null && (o = setTimeout(n, 2e4));
9
+ }, n = () => {
10
+ if (i || e === null || s !== void 0) return;
11
+ const t = e, d = new AbortController();
12
+ s = d;
13
+ const a = () => !i && e === t && s === d, f = () => {
14
+ a() && (e = null, l(), t.close().catch(() => {
15
+ }));
16
+ };
17
+ clearTimeout(o), o = setTimeout(f, 1e4), (async () => {
18
+ try {
19
+ if (await t.probeLiveness({ signal: d.signal }), !a()) return;
20
+ s = void 0, u();
21
+ } catch {
22
+ f();
23
+ }
24
+ })();
25
+ }, v = () => {
26
+ c?.visibilityState === "visible" && n();
27
+ };
28
+ return r?.addEventListener("online", n), r?.addEventListener("focus", n), r?.addEventListener("pageshow", n), c?.addEventListener("visibilitychange", v), Object.freeze({
29
+ synchronize(t) {
30
+ i || t === e || (l(), e = t, u());
31
+ },
32
+ dispose() {
33
+ i || (i = !0, e = null, l(), r?.removeEventListener("online", n), r?.removeEventListener("focus", n), r?.removeEventListener("pageshow", n), c?.removeEventListener("visibilitychange", v));
34
+ }
35
+ });
36
+ }
37
+ export {
38
+ E as createSessionHealthMonitor
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-boot",
3
- "version": "0.56.8",
3
+ "version": "0.56.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",