@hanzo/rooms 0.1.65 → 0.1.67

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/host.js CHANGED
@@ -25,7 +25,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
25
25
  import { createContext, useContext } from 'react';
26
26
  import { useIam, useOrganizations } from '@hanzo/iam/react';
27
27
  import { useAppearance } from '@hanzo/appearance';
28
- import { iam } from './lib/api.js';
28
+ import { api } from './lib/api.js';
29
29
  const Plain = ({ prefetch: _prefetch, ...rest }) => _jsx("a", { ...rest });
30
30
  const Context = createContext({
31
31
  router: {
@@ -59,7 +59,7 @@ export function useLook() {
59
59
  // passing through a room on the way to sign in sends nothing to the issuer.
60
60
  return useAppearance({
61
61
  org: org.id,
62
- account: accessToken ? { base: iam(), token: accessToken } : undefined,
62
+ account: accessToken ? { base: api(), token: accessToken } : undefined,
63
63
  });
64
64
  }
65
65
  /**
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { createContext, useContext, useState, useEffect, useMemo } from 'react';
4
4
  import { useIam, useIamIdentity, useIamToken, useOrganizations } from '@hanzo/iam/react';
5
- import { iam } from './api.js';
5
+ import { api } from './api.js';
6
6
  const AccountContext = createContext(undefined);
7
7
  function mapUser(u) {
8
8
  return {
@@ -54,8 +54,8 @@ function mapOrg(o, role) {
54
54
  // once the new address has proved it can receive one. That is the verification
55
55
  // flow's job, not a profile save's, so they are not here and this app does not
56
56
  // draw a control that pretends otherwise.
57
- /** IAM's self-scoped account door, at the host's IAM. */
58
- const account = () => `${iam()}/v1/iam/account`;
57
+ /** IAM's self-scoped account door, asked through the gateway (`api()`), which answers /v1/iam. */
58
+ const account = () => `${api()}/v1/iam/account`;
59
59
  // ── The read ───────────────────────────────────────────────────────────────
60
60
  //
61
61
  // THE SAME DOOR, and that is the point: the row this page edits is the row it
package/dist/lib/api.d.ts CHANGED
@@ -43,6 +43,11 @@ export declare function api(): string;
43
43
  * Two spellings of one setting are indistinguishable from a working one until
44
44
  * the day it is changed.
45
45
  */
46
+ /**
47
+ * The identity origin, for IAM's own PAGES (/account, /join). IAM's API is asked
48
+ * through the gateway, `api()`, which answers /v1/iam for every Hanzo origin, so
49
+ * a browser on hanzo.ai sends nothing to the identity origin.
50
+ */
46
51
  export declare function iam(): string;
47
52
  /**
48
53
  * The IAM application hanzo.ai signs people in through, and the one an invited
package/dist/lib/api.js CHANGED
@@ -64,6 +64,11 @@ export function api() {
64
64
  * Two spellings of one setting are indistinguishable from a working one until
65
65
  * the day it is changed.
66
66
  */
67
+ /**
68
+ * The identity origin, for IAM's own PAGES (/account, /join). IAM's API is asked
69
+ * through the gateway, `api()`, which answers /v1/iam for every Hanzo origin, so
70
+ * a browser on hanzo.ai sends nothing to the identity origin.
71
+ */
67
72
  export function iam() {
68
73
  if (onDevnet())
69
74
  return IAM_DEV;
@@ -141,6 +141,8 @@ export declare const guest: (hostname: string) => boolean;
141
141
  * either: it is hanzo.ai/dev's old address and redirects there.
142
142
  */
143
143
  export declare function devnet(hostname: string): boolean;
144
+ /** Whether a host signs in on hanzo.ai with its own request (`VISITS`). */
145
+ export declare const visits: (hostname: string) => boolean;
144
146
  /**
145
147
  * Whether a host answers IAM's sign-in and sign-out calls on its own origin, so
146
148
  * a page there signs in without leaving it. Every devnet host does: app-dev's
package/dist/lib/host.js CHANGED
@@ -221,11 +221,22 @@ export function devnet(hostname) {
221
221
  }
222
222
  /**
223
223
  * The hosts that answer IAM's sign-in and sign-out calls on their own origin:
224
- * every host this export is served on and signs in at (universe static-sites
225
- * `iam-on-hanzo-ai` and cloud.yaml `iam-signin`), testnet's test.hanzo.ai, and
226
- * the dev server's /v1 proxy.
224
+ * hanzo.ai, where Hanzo signs in (universe static-sites `iam-on-hanzo-ai` and
225
+ * cloud.yaml `iam-signin`), testnet's test.hanzo.ai, and the dev server's /v1
226
+ * proxy.
227
227
  */
228
- const ANSWERS = new Set([...APEX, 'cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai', 'test.hanzo.ai', 'localhost', '127.0.0.1']);
228
+ const ANSWERS = new Set([...APEX, 'test.hanzo.ai', 'localhost', '127.0.0.1']);
229
+ /**
230
+ * The hosts this export is served on that keep a session of their own and sign
231
+ * in on hanzo.ai: a person signed out there is sent to hanzo.ai/login carrying
232
+ * the host's OWN authorize request (its callback, its PKCE challenge), which
233
+ * hanzo.ai's page finishes, and the code comes back to the host's
234
+ * /auth/callback. One sign-in page for Hanzo, and nobody types a credential on
235
+ * these hosts.
236
+ */
237
+ const VISITS = new Set(['cloud.hanzo.ai', 'hanzo.bot', 'bot.hanzo.ai']);
238
+ /** Whether a host signs in on hanzo.ai with its own request (`VISITS`). */
239
+ export const visits = (hostname) => VISITS.has(hostname);
229
240
  /**
230
241
  * Whether a host answers IAM's sign-in and sign-out calls on its own origin, so
231
242
  * a page there signs in without leaving it. Every devnet host does: app-dev's
package/dist/look.js CHANGED
@@ -12,11 +12,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import { Text, YStack } from "@hanzo/ui";
13
13
  import { Appearance } from "@hanzo/appearance";
14
14
  import { useIam } from "@hanzo/iam/react";
15
- import { iam } from "./lib/api.js";
15
+ import { api } from "./lib/api.js";
16
16
  import { useOrg } from "./host.js";
17
17
  import { brand } from "./where.js";
18
18
  export function Look() {
19
19
  const { accessToken } = useIam();
20
20
  const org = useOrg();
21
- return (_jsxs(YStack, { gap: "$3", maxW: 420, children: [_jsx(Text, { fontSize: "$3", color: "$soft", children: "Kept with your account, so it follows you to every Hanzo surface." }), _jsx(Appearance, { org: org.id, orgName: org.name || brand(), account: { base: iam(), token: accessToken ?? undefined } })] }));
21
+ return (_jsxs(YStack, { gap: "$3", maxW: 420, children: [_jsx(Text, { fontSize: "$3", color: "$soft", children: "Kept with your account, so it follows you to every Hanzo surface." }), _jsx(Appearance, { org: org.id, orgName: org.name || brand(), account: { base: api(), token: accessToken ?? undefined } })] }));
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/rooms",
3
- "version": "0.1.65",
3
+ "version": "0.1.67",
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",