@hanzo/rooms 0.1.62 → 0.1.63

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/App.js CHANGED
@@ -24,9 +24,9 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
24
24
  // stranger sees is the host's.
25
25
  //
26
26
  // THE ORGANIZATION COMES FIRST (Orgs.tsx), and the app mounts it itself, so no
27
- // host draws the app without it: a reader with none makes one, a reader with
28
- // several picks one, and one whose plan is not live is asked for it before the
29
- // app is drawn.
27
+ // host draws the app without it: a reader with none makes one and a reader
28
+ // with several picks one. No plan is asked for here: that is the workspace's,
29
+ // behind its own front door.
30
30
  //
31
31
  // THE SIDEBAR'S TOGGLE IS AT THE WINDOW'S TOP-LEFT. In a browser tab it leads
32
32
  // the rail. A host that is a window of its own (`bar`) has no browser around
package/dist/Orgs.js CHANGED
@@ -4,26 +4,28 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
4
4
  //
5
5
  // An organization owns every agent, credit and member. A signed-in reader who
6
6
  // has none is shown one thing: make one. A reader with several picks the one
7
- // they are working in when they arrive. And an organization whose plan is not
8
- // live is asked for it before any room is drawn. Only past all three does the
9
- // workspace render, and every request under it then carries that organization
10
- // (lib/auth/session.ts `scope`, hooks/useAi.ts).
7
+ // they are working in when they arrive. Past both the app renders, and every
8
+ // request under it then carries that organization (lib/auth/session.ts
9
+ // `scope`, hooks/useAi.ts).
11
10
  //
12
- // FREE IS FOR ONE PERSON. A personal organization on the Free tier opens /chat
13
- // and /dev on every host but hanzo.team; the workspace's own host asks every
14
- // organization for a paid plan. A personal organization starts on Free and may
15
- // upgrade at creation; a team organization is sold the per-seat Team plan, and
16
- // that is the plan the subscribe ask offers. Plans are the catalog's, read live
17
- // and seeded from @hanzo/plans for first paint. Checkout is hanzo.ai/pay in
18
- // this tab; it returns here, and the tier is read again on return.
11
+ // NO PLAN STANDS IN FRONT OF CHAT OR DEV. Off the front door every
12
+ // organization opens, whatever its plan: what it may spend is the API's to
13
+ // meter, per plan, on every call. The per-seat Team plan is the workspace's to
14
+ // ask for, behind its front door, and nowhere else. It used to be asked of
15
+ // every organization that was not personal and not on a live plan, on every
16
+ // host, which put each member of a team on Free, and every account filed in the
17
+ // shared sign-up organization, in front of a wall at hanzo.ai/chat. Plans are
18
+ // the catalog's, read live and seeded from @hanzo/plans for first paint.
19
+ // Checkout is hanzo.ai/pay in this tab; it returns here, and the tier is read
20
+ // again on return.
19
21
  //
20
22
  // THE FRONT DOOR. A workspace rooted at `/` (hanzo.team) draws its host's
21
23
  // Landing for a stranger at Home (`front`) and its host's Signup at /start
22
24
  // (`signup`). Behind either, a reader with no team names one, invites people
23
- // and takes the per-seat plan (`Start`, `Plan`) instead of the create dialog
24
- // and the subscribe ask; a personal organization on Free is offered a team,
25
- // and an open one is sent on (`forward`). Without those props nothing here
26
- // changes.
25
+ // and takes the per-seat plan (`Start`, `Plan`) instead of the create dialog;
26
+ // a team without a live plan is offered that plan, a personal organization on
27
+ // Free is offered a team, and an open one is sent on (`forward`). Behind the
28
+ // door, and only there, nothing opens without a live plan.
27
29
  import { dev } from './lib/host.js';
28
30
  import { useCallback, useEffect, useMemo, useState } from 'react';
29
31
  import { useIam } from '@hanzo/iam/react';
@@ -78,21 +80,19 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
78
80
  // The team being set up in this page. Once its name is taken the setup owns
79
81
  // the screen until checkout, whatever `Orgs` reads of the new organization.
80
82
  const [founding, setFounding] = useState(null);
81
- const { tier, wrong, reload } = useTier(Boolean(isAuthenticated && current), current);
83
+ // The plan is read behind the front door only: nowhere else does it decide anything.
84
+ const { tier, wrong, reload } = useTier(Boolean(door && isAuthenticated && current), current);
82
85
  // A plan is live when billing READ one for this organization and it is not the free rung.
83
86
  const live = Boolean(tier?.tier && tier.tier.name !== FREE_TIER);
84
- // A Free organization off the workspace's host is asked what kind it is, and a
85
- // personal one opens: Free is the plan a person uses the app on alone. Behind
86
- // the front door every organization without a live plan is read for its kind:
87
- // a team is offered the plan, a personal one is offered a team.
88
- const onTeam = workspace(useHost());
89
- const free = door ? Boolean(tier) && !live : !live && !onTeam && tier?.tier?.name === FREE_TIER;
87
+ // Behind the front door every organization without a live plan is read for
88
+ // its kind: a team is offered the plan, a personal one is offered a team.
89
+ const free = door && Boolean(tier) && !live;
90
90
  const personal = usePersonal(current, free);
91
91
  // A SuperAdmin IAM stepped into this organization sees its rooms whatever its
92
92
  // plan: support is there to see what the organization has, and what it spends
93
93
  // is billed to the operator's own books, never the organization's.
94
94
  const supporting = Boolean(current) && assumed() === current;
95
- const open = live || (!door && free && personal === true) || supporting;
95
+ const open = !door || live || supporting;
96
96
  const { client } = useAi();
97
97
  useEffect(() => {
98
98
  try {
@@ -195,34 +195,28 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
195
195
  }
196
196
  if (!current || (members.length > 1 && !picked))
197
197
  return _jsx(Pick, { members: members, onPick: choose });
198
- // NOTHING OPENS WITHOUT A LIVE PLAN. Every branch here used to hand the room
199
- // over when the answer was anything but a plain "free": an error of any kind,
200
- // a read still in flight, a document with no plan in it. Each was a way in
201
- // without paying — a refusal, a slow network, or devtools blocking one request
202
- // all read as permission. The default is now the ask, and the room is the
203
- // exception rather than the fallback. The one exception to the plan is a
204
- // personal organization on Free, off hanzo.team, and its kind is read first.
198
+ if (open)
199
+ return forward ? _jsx(Forward, { to: forward }) : _jsx(_Fragment, { children: _jsx(Held, { veiled: false, children: children }) });
200
+ // BEHIND THE FRONT DOOR NOTHING OPENS WITHOUT A LIVE PLAN. Every branch here
201
+ // used to hand the room over when the answer was anything but a plain
202
+ // "free": an error of any kind, a read still in flight, a document with no
203
+ // plan in it. Each was a way in without paying — a refusal, a slow network,
204
+ // or devtools blocking one request all read as permission. The default is the
205
+ // ask, and the room is the exception rather than the fallback.
205
206
  if (!tier && !wrong)
206
207
  return _jsxs(_Fragment, { children: [_jsx(Held, { veiled: true, children: children }), _jsx(Veil, {})] });
207
208
  if (free && personal === null)
208
209
  return _jsxs(_Fragment, { children: [_jsx(Held, { veiled: true, children: children }), _jsx(Veil, {})] });
209
- if (open)
210
- return forward ? _jsx(Forward, { to: forward }) : _jsx(_Fragment, { children: _jsx(Held, { veiled: false, children: children }) });
211
210
  const swap = () => setPicked(false);
212
- if (door) {
213
- // A billing OUTAGE is ours; the plan is still the condition.
214
- if (!tier)
215
- return _jsx(Plan, { org: current, members: members, onSwitch: swap, outage: outage(wrong), onRetry: reload });
216
- if (personal) {
217
- if (front && Landing)
218
- return _jsx(Landing, { member: true });
219
- return _jsx(Start, { onFounded: setFounding, first: false, members: members, onSwitch: swap });
220
- }
221
- return _jsx(Plan, { org: current, members: members, onSwitch: swap });
211
+ // A billing OUTAGE is ours; the plan is still the condition.
212
+ if (!tier)
213
+ return _jsx(Plan, { org: current, members: members, onSwitch: swap, outage: outage(wrong), onRetry: reload });
214
+ if (personal) {
215
+ if (front && Landing)
216
+ return _jsx(Landing, { member: true });
217
+ return _jsx(Start, { onFounded: setFounding, first: false, members: members, onSwitch: swap });
222
218
  }
223
- // A billing OUTAGE is not a bill: it is ours, and saying "subscribe" to
224
- // someone who already has would be a lie. It still does not open the room.
225
- return _jsx(Subscribe, { org: current, members: members, onSwitch: swap, outage: outage(wrong), onRetry: reload });
219
+ return _jsx(Plan, { org: current, members: members, onSwitch: swap });
226
220
  }
227
221
  /**
228
222
  * A link that asks to arrive signed in.
@@ -459,12 +453,6 @@ function CreateDialog({ onClose }) {
459
453
  function Pick({ members, onPick }) {
460
454
  return (_jsx(Page, { label: "Choose an organization", children: _jsxs(Column, { children: [_jsx(Brand, {}), _jsx(Heading, { title: "Choose an organization", lede: _jsx(_Fragment, { children: "Everything you open \u2014 chats, agents, credit \u2014 is this one's." }) }), _jsx(Rule, {}), _jsx(View, { display: "grid", gap: 10, children: members.map((o) => (_jsx(View, { render: "button", onClick: () => onPick(o), items: "flex-start", px: 16, py: 14, rounded: 12, borderWidth: 1, borderColor: "var(--border)", bg: "transparent", cursor: "pointer", children: _jsx(Text, { fontSize: "$4", color: "var(--foreground)", text: "left", children: o }) }, o))) })] }) }));
461
455
  }
462
- /** The organization exists and its plan is not live: it is offered the per-seat Team plan. */
463
- function Subscribe({ org, members, onSwitch, outage, onRetry, }) {
464
- const { plan, price } = usePlan('team');
465
- const seat = plan?.pricePerUser ? ' / seat' : '';
466
- return (_jsx(Page, { label: "Subscribe", children: _jsxs(Column, { children: [_jsx(Brand, {}), _jsx(Heading, { title: org, lead: 22.5, lede: plan ? `This organization runs on the ${plan.name} plan at ${price}${seat} / month, and nothing in it works until that plan is live.` : 'Its plan is not live yet.' }), _jsx(Rule, {}), _jsxs(XStack, { gap: 10, flexWrap: "wrap", children: [plan ? (_jsx(Button, { asChild: true, variant: "primary", size: "lg", children: _jsx("a", { href: checkout(plan), children: `Subscribe — ${price}${seat} / month` }) })) : null, members.length > 1 ? (_jsx(Button, { size: "lg", onClick: onSwitch, children: "Switch organization" })) : null] })] }) }));
467
- }
468
456
  // ── the front door's setup ─────────────────────────────────────────────────────
469
457
  /**
470
458
  * CREATE YOUR TEAM: its name, then who else is in it, then its plan.
package/dist/Room.js CHANGED
@@ -33,8 +33,9 @@ export function Room({ mode, front = false, children, }) {
33
33
  if (to)
34
34
  return null;
35
35
  // A session comes first, then the organization: nothing of the workspace is
36
- // drawn until the reader has signed in at hanzo.id, belongs to an
37
- // organization that is paid for, and has picked the one they are working in.
36
+ // drawn until the reader has signed in at hanzo.id and picked the
37
+ // organization they are working in, and on the workspace's own host until
38
+ // that organization's plan is live (`Orgs`).
38
39
  // Going to a room from the apex is going to hanzo.team, in this tab.
39
40
  return (_jsx(Orgs, { front: front, children: _jsx(Workspace, { mode: mode, navigate: (route) => {
40
41
  // A page of another origin — hanzo.ai's from hanzo.team — is a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/rooms",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
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",