@hanzo/rooms 0.1.55 → 0.1.56
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/dist/lib/host.d.ts +11 -4
- package/dist/lib/host.js +18 -6
- package/dist/lib/signout.d.ts +1 -1
- package/dist/lib/signout.js +3 -11
- package/package.json +1 -1
package/dist/lib/host.d.ts
CHANGED
|
@@ -130,9 +130,16 @@ export declare const WEB = "https://hanzo.ai/chat";
|
|
|
130
130
|
export declare const guest: (hostname: string) => boolean;
|
|
131
131
|
/**
|
|
132
132
|
* Whether a host is the devnet's: its production twin with `-dev` on the one
|
|
133
|
-
* label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai)
|
|
134
|
-
*
|
|
135
|
-
* (
|
|
136
|
-
*
|
|
133
|
+
* label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai). A
|
|
134
|
+
* deeper name (a.b-dev.hanzo.ai) is not one, and neither is a name that only
|
|
135
|
+
* contains the suffix (app-dev.hanzo.ai.example.com). dev.hanzo.ai is not one
|
|
136
|
+
* either: it is hanzo.ai/dev's old address and redirects there.
|
|
137
137
|
*/
|
|
138
138
|
export declare function devnet(hostname: string): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Whether a host answers IAM's sign-in and sign-out calls on its own origin, so
|
|
141
|
+
* a page there signs in without leaving it. Every devnet host does: app-dev's
|
|
142
|
+
* /v1 is the devnet cloud, whose IAM is the devnet's own (universe hanzo-devnet
|
|
143
|
+
* cloud.yaml).
|
|
144
|
+
*/
|
|
145
|
+
export declare const answers: (hostname: string) => boolean;
|
package/dist/lib/host.js
CHANGED
|
@@ -201,16 +201,28 @@ export const guest = (hostname) => hostname === 'hanzo.app' || hostname.endsWith
|
|
|
201
201
|
const DEVNET = '-dev.hanzo.ai';
|
|
202
202
|
/**
|
|
203
203
|
* Whether a host is the devnet's: its production twin with `-dev` on the one
|
|
204
|
-
* label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai)
|
|
205
|
-
*
|
|
206
|
-
* (
|
|
207
|
-
*
|
|
204
|
+
* label under hanzo.ai (app-dev.hanzo.ai, api-dev.hanzo.ai, id-dev.hanzo.ai). A
|
|
205
|
+
* deeper name (a.b-dev.hanzo.ai) is not one, and neither is a name that only
|
|
206
|
+
* contains the suffix (app-dev.hanzo.ai.example.com). dev.hanzo.ai is not one
|
|
207
|
+
* either: it is hanzo.ai/dev's old address and redirects there.
|
|
208
208
|
*/
|
|
209
209
|
export function devnet(hostname) {
|
|
210
|
-
if (hostname === 'dev.hanzo.ai')
|
|
211
|
-
return true;
|
|
212
210
|
if (!hostname.endsWith(DEVNET))
|
|
213
211
|
return false;
|
|
214
212
|
const label = hostname.slice(0, -'.hanzo.ai'.length);
|
|
215
213
|
return label.length > '-dev'.length && !label.includes('.');
|
|
216
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* The hosts that answer IAM's sign-in and sign-out calls on their own origin:
|
|
217
|
+
* every host this export is served on and signs in at (universe static-sites
|
|
218
|
+
* `iam-on-hanzo-ai` and cloud.yaml `iam-signin`), testnet's test.hanzo.ai, and
|
|
219
|
+
* the dev server's /v1 proxy.
|
|
220
|
+
*/
|
|
221
|
+
const ANSWERS = new Set([...APEX, 'cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai', 'test.hanzo.ai', 'localhost', '127.0.0.1']);
|
|
222
|
+
/**
|
|
223
|
+
* Whether a host answers IAM's sign-in and sign-out calls on its own origin, so
|
|
224
|
+
* a page there signs in without leaving it. Every devnet host does: app-dev's
|
|
225
|
+
* /v1 is the devnet cloud, whose IAM is the devnet's own (universe hanzo-devnet
|
|
226
|
+
* cloud.yaml).
|
|
227
|
+
*/
|
|
228
|
+
export const answers = (hostname) => ANSWERS.has(hostname) || devnet(hostname);
|
package/dist/lib/signout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAM } from '@hanzo/iam';
|
|
2
|
-
/** Whether the page in front of us is on
|
|
2
|
+
/** Whether the page in front of us is on an origin that answers IAM itself (`answers` in host.ts). */
|
|
3
3
|
export declare const here: () => boolean;
|
|
4
4
|
/** The IAM client for this page; the token exchange at the callback shares its PKCE store. */
|
|
5
5
|
export declare function useClient(): IAM;
|
package/dist/lib/signout.js
CHANGED
|
@@ -12,17 +12,9 @@ import { IAM } from '@hanzo/iam';
|
|
|
12
12
|
import { useIam } from '@hanzo/iam/react';
|
|
13
13
|
import { useSignOut as useUiSignOut } from '@hanzo/ui/auth';
|
|
14
14
|
import { track } from './tags.js';
|
|
15
|
-
import {
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
* every host this export is served on and signs in at (universe static-sites
|
|
19
|
-
* `iam-on-hanzo-ai` and cloud.yaml `iam-signin`), each network's own
|
|
20
|
-
* (test.hanzo.ai for testnet, dev.hanzo.ai for devnet), and the dev server's
|
|
21
|
-
* /v1 proxy.
|
|
22
|
-
*/
|
|
23
|
-
const HOSTS = new Set([...APEX, 'cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai', 'test.hanzo.ai', 'dev.hanzo.ai', 'localhost', '127.0.0.1']);
|
|
24
|
-
/** Whether the page in front of us is on such an origin. */
|
|
25
|
-
export const here = () => typeof window !== 'undefined' && HOSTS.has(window.location.hostname);
|
|
15
|
+
import { answers } from './host.js';
|
|
16
|
+
/** Whether the page in front of us is on an origin that answers IAM itself (`answers` in host.ts). */
|
|
17
|
+
export const here = () => typeof window !== 'undefined' && answers(window.location.hostname);
|
|
26
18
|
/** The IAM client for this page; the token exchange at the callback shares its PKCE store. */
|
|
27
19
|
export function useClient() {
|
|
28
20
|
const { config } = useIam();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/rooms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.56",
|
|
4
4
|
"description": "The workspace rooms — Home, Chat, Inbox, Contacts, Meet, Cal, Drive, Board, Work, Bots — and the frame that holds them, once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|