@hosty-sdk/app 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -11
- package/dist/assistant.d.ts +15 -0
- package/dist/assistant.js +38 -1
- package/dist/background-server.d.ts +16 -0
- package/dist/background-server.js +52 -0
- package/dist/browser-auth.d.ts +2 -0
- package/dist/browser-auth.js +5 -0
- package/dist/continuity-browser.d.ts +11 -0
- package/dist/continuity-browser.js +92 -0
- package/dist/continuity.d.ts +9 -0
- package/dist/continuity.js +9 -0
- package/dist/overlay-react.d.ts +5 -1
- package/dist/overlay-react.js +7 -4
- package/dist/providers-server.d.ts +3 -1
- package/dist/providers-server.js +4 -2
- package/dist/providers.d.ts +4 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +15 -1
- package/dist/server.d.ts +7 -0
- package/dist/server.js +11 -0
- package/dist/session-server.d.ts +2 -0
- package/dist/ui-context.d.ts +2 -0
- package/dist/ui-context.js +3 -0
- package/dist/ui-embedded.d.ts +45 -0
- package/dist/ui-embedded.js +278 -0
- package/dist/ui-frame.d.ts +30 -0
- package/dist/ui-frame.js +104 -0
- package/dist/ui-host.d.ts +80 -0
- package/dist/ui-host.js +439 -0
- package/dist/ui-react.d.ts +35 -0
- package/dist/ui-react.js +225 -0
- package/dist/ui-server.d.ts +32 -0
- package/dist/ui-server.js +123 -0
- package/dist/ui-transport.d.ts +16 -0
- package/dist/ui-transport.js +68 -0
- package/dist/ui-types.d.ts +99 -0
- package/dist/ui-types.js +43 -0
- package/dist/ui.d.ts +20 -0
- package/dist/ui.js +36 -0
- package/package.json +33 -1
package/dist/ui.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export * from "@hosty-sdk/app/ui/types";
|
|
2
|
+
let active = null;
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
const unavailable = (requestId) => ({ status: "unsupported", requestId, code: "host_unavailable" });
|
|
5
|
+
const initial = { mode: "standalone", connection: "connecting" };
|
|
6
|
+
/** One document-local facade shared by domain apps; it never selects a provider or opens popups. */
|
|
7
|
+
export const ui = {
|
|
8
|
+
getEnvironment: () => active?.getEnvironment() ?? initial,
|
|
9
|
+
openSurface: (target, options) => active?.openSurface(target, options) ?? Promise.resolve(unavailable(options.requestId)),
|
|
10
|
+
getPresentation: (id, options) => active?.getPresentation(id, options) ?? Promise.resolve(unavailable(id)),
|
|
11
|
+
subscribe(listener) { listeners.add(listener); listener({ type: "environment", value: ui.getEnvironment() }); return () => { listeners.delete(listener); }; },
|
|
12
|
+
reportSurfaceState: state => active?.reportSurfaceState(state),
|
|
13
|
+
};
|
|
14
|
+
/** Internal root integration; exported from this source only, not as an ambient browser global. */
|
|
15
|
+
export function bindUiClient(client) {
|
|
16
|
+
if (active && active !== client)
|
|
17
|
+
throw new Error("Mount one Hosty UI root per document.");
|
|
18
|
+
active = client;
|
|
19
|
+
const release = client.subscribe(event => { for (const listener of listeners)
|
|
20
|
+
listener(event); });
|
|
21
|
+
return () => {
|
|
22
|
+
release();
|
|
23
|
+
if (active === client) {
|
|
24
|
+
active = null;
|
|
25
|
+
for (const listener of listeners)
|
|
26
|
+
listener({ type: "environment", value: initial });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function createPresentationRequestId() {
|
|
31
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
32
|
+
bytes[6] = (bytes[6] & 15) | 64;
|
|
33
|
+
bytes[8] = (bytes[8] & 63) | 128;
|
|
34
|
+
const hex = Array.from(bytes, b => b.toString(16).padStart(2, "0")).join("");
|
|
35
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hosty-sdk/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Hosty app auth: session state machine, recovery bridge, Core revalidation, and the embedder responder.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -45,6 +45,26 @@
|
|
|
45
45
|
"types": "./dist/embedder.d.ts",
|
|
46
46
|
"default": "./dist/embedder.js"
|
|
47
47
|
},
|
|
48
|
+
"./ui": {
|
|
49
|
+
"types": "./dist/ui.d.ts",
|
|
50
|
+
"default": "./dist/ui.js"
|
|
51
|
+
},
|
|
52
|
+
"./ui/types": {
|
|
53
|
+
"types": "./dist/ui-types.d.ts",
|
|
54
|
+
"default": "./dist/ui-types.js"
|
|
55
|
+
},
|
|
56
|
+
"./ui/host": {
|
|
57
|
+
"types": "./dist/ui-host.d.ts",
|
|
58
|
+
"default": "./dist/ui-host.js"
|
|
59
|
+
},
|
|
60
|
+
"./ui/react": {
|
|
61
|
+
"types": "./dist/ui-react.d.ts",
|
|
62
|
+
"default": "./dist/ui-react.js"
|
|
63
|
+
},
|
|
64
|
+
"./ui/server": {
|
|
65
|
+
"types": "./dist/ui-server.d.ts",
|
|
66
|
+
"default": "./dist/ui-server.js"
|
|
67
|
+
},
|
|
48
68
|
"./theme": {
|
|
49
69
|
"types": "./dist/theme.d.ts",
|
|
50
70
|
"default": "./dist/theme.js"
|
|
@@ -84,6 +104,18 @@
|
|
|
84
104
|
"./permissions/react": {
|
|
85
105
|
"types": "./dist/permissions-react.d.ts",
|
|
86
106
|
"default": "./dist/permissions-react.js"
|
|
107
|
+
},
|
|
108
|
+
"./background/server": {
|
|
109
|
+
"types": "./dist/background-server.d.ts",
|
|
110
|
+
"default": "./dist/background-server.js"
|
|
111
|
+
},
|
|
112
|
+
"./continuity": {
|
|
113
|
+
"types": "./dist/continuity.d.ts",
|
|
114
|
+
"default": "./dist/continuity.js"
|
|
115
|
+
},
|
|
116
|
+
"./continuity/browser": {
|
|
117
|
+
"types": "./dist/continuity-browser.d.ts",
|
|
118
|
+
"default": "./dist/continuity-browser.js"
|
|
87
119
|
}
|
|
88
120
|
},
|
|
89
121
|
"scripts": {
|