@hanzo/rooms 0.1.63 → 0.1.64

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
@@ -26,7 +26,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
26
26
  // THE ORGANIZATION COMES FIRST (Orgs.tsx), and the app mounts it itself, so no
27
27
  // host draws the app without it: a reader with none makes one and a reader
28
28
  // with several picks one. No plan is asked for here: that is the workspace's,
29
- // behind its own front door.
29
+ // on its own host (hanzo.team) and behind its 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
@@ -8,13 +8,14 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
8
8
  // request under it then carries that organization (lib/auth/session.ts
9
9
  // `scope`, hooks/useAi.ts).
10
10
  //
11
- // NO PLAN STANDS IN FRONT OF CHAT OR DEV. Off the front door every
11
+ // NO PLAN STANDS IN FRONT OF CHAT OR DEV. Off the workspace every
12
12
  // organization opens, whatever its plan: what it may spend is the API's to
13
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
14
+ // ask for, on its host (hanzo.team) and behind its front door, and nowhere
15
+ // else. It used to be asked of every organization that was not personal and
16
+ // not on a live plan, on every host, which put each member of a team on Free,
17
+ // and every account filed in the shared sign-up organization, in front of a
18
+ // wall at hanzo.ai/chat. Plans are
18
19
  // the catalog's, read live and seeded from @hanzo/plans for first paint.
19
20
  // Checkout is hanzo.ai/pay in this tab; it returns here, and the tier is read
20
21
  // again on return.
@@ -80,8 +81,11 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
80
81
  // The team being set up in this page. Once its name is taken the setup owns
81
82
  // the screen until checkout, whatever `Orgs` reads of the new organization.
82
83
  const [founding, setFounding] = useState(null);
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);
84
+ // The workspace asks for the plan, on its host and behind its front door, and
85
+ // only there is it read: nowhere else does it decide anything.
86
+ const onTeam = workspace(useHost());
87
+ const asks = door || onTeam;
88
+ const { tier, wrong, reload } = useTier(Boolean(asks && isAuthenticated && current), current);
85
89
  // A plan is live when billing READ one for this organization and it is not the free rung.
86
90
  const live = Boolean(tier?.tier && tier.tier.name !== FREE_TIER);
87
91
  // Behind the front door every organization without a live plan is read for
@@ -92,7 +96,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
92
96
  // plan: support is there to see what the organization has, and what it spends
93
97
  // is billed to the operator's own books, never the organization's.
94
98
  const supporting = Boolean(current) && assumed() === current;
95
- const open = !door || live || supporting;
99
+ const open = !asks || live || supporting;
96
100
  const { client } = useAi();
97
101
  useEffect(() => {
98
102
  try {
@@ -197,7 +201,7 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
197
201
  return _jsx(Pick, { members: members, onPick: choose });
198
202
  if (open)
199
203
  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
204
+ // IN THE WORKSPACE NOTHING OPENS WITHOUT A LIVE PLAN. Every branch here
201
205
  // used to hand the room over when the answer was anything but a plain
202
206
  // "free": an error of any kind, a read still in flight, a document with no
203
207
  // plan in it. Each was a way in without paying — a refusal, a slow network,
@@ -208,15 +212,20 @@ export function Orgs({ children, front = false, forward, signup = false, }) {
208
212
  if (free && personal === null)
209
213
  return _jsxs(_Fragment, { children: [_jsx(Held, { veiled: true, children: children }), _jsx(Veil, {})] });
210
214
  const swap = () => setPicked(false);
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 });
215
+ if (door) {
216
+ // A billing OUTAGE is ours; the plan is still the condition.
217
+ if (!tier)
218
+ return _jsx(Plan, { org: current, members: members, onSwitch: swap, outage: outage(wrong), onRetry: reload });
219
+ if (personal) {
220
+ if (front && Landing)
221
+ return _jsx(Landing, { member: true });
222
+ return _jsx(Start, { onFounded: setFounding, first: false, members: members, onSwitch: swap });
223
+ }
224
+ return _jsx(Plan, { org: current, members: members, onSwitch: swap });
218
225
  }
219
- return _jsx(Plan, { org: current, members: members, onSwitch: swap });
226
+ // The workspace's host off its front door: no live plan, or none read, does
227
+ // not open the room.
228
+ return _jsx(Subscribe, { org: current, members: members, onSwitch: swap });
220
229
  }
221
230
  /**
222
231
  * A link that asks to arrive signed in.
@@ -453,6 +462,12 @@ function CreateDialog({ onClose }) {
453
462
  function Pick({ members, onPick }) {
454
463
  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))) })] }) }));
455
464
  }
465
+ /** On the workspace's host, an organization whose plan is not live: it is offered the per-seat Team plan. */
466
+ function Subscribe({ org, members, onSwitch, }) {
467
+ const { plan, price } = usePlan('team');
468
+ const seat = plan?.pricePerUser ? ' / seat' : '';
469
+ 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] })] }) }));
470
+ }
456
471
  // ── the front door's setup ─────────────────────────────────────────────────────
457
472
  /**
458
473
  * CREATE YOUR TEAM: its name, then who else is in it, then its plan.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/rooms",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
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",