@hanzo/app 0.3.78 → 0.3.80

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
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // The web app as the whole window, in three modes: Chat, a conversation with
4
4
  // the product's AI; Dev, @hanzo/build's `<Builder>` without a rail of its own;
5
5
  // and Studio, @hanzo/studio's `<Studio>` the same way, its places (`nav`) in the
@@ -330,7 +330,7 @@ function Window({ bar, betas }) {
330
330
  shut();
331
331
  setFinding(true);
332
332
  };
333
- return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsx(UsageProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...floor, flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", "$max-md": bar ? undefined : { display: 'none' }, onMouseDown: bar ? dragWindow : undefined, onDoubleClick: bar ? toggleWindowMaximize : undefined, ...(bar?.drag ?? null), children: [_jsxs(XStack, { "data-slot": "title-bar-start", height: "100%", items: "center", gap: 2, pl: (bar?.inset ?? 0) + 4, pr: 6, shrink: 0, width: closed ? RAIL : `calc(${RAIL}px + var(--app-sidebar-span, ${SIDE}px))`, ...(bar?.drag ?? null), children: [_jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) }), _jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) })] }), _jsxs(XStack, { id: "hanzo-titlebar-slot", "data-slot": "title-bar-main", flex: 1, minW: 0, self: "stretch", items: "center", justify: "space-between", pl: 14, pr: 10, gap: 6, ...(bar?.drag ?? null), children: [_jsx(XStack, { "data-slot": "titlebar-fallback", flex: 1, minW: 0, items: "center", justify: "space-between", gap: 8, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: mode === 'chat' ? '' : mode === 'dev' ? 'Dev' : mode === 'studio' ? 'Studio' : mode === 'design' ? 'Design' : mode === 'flow' ? 'Flow' : mode === 'tabs' ? 'Tabs' : '' }) }), bar ? (bar.controls !== undefined ? (bar.controls) : !bar.inset ? (_jsx(WindowControls, {})) : null) : null] })] }), _jsxs(XStack, { ref: drawer.pane, "data-app": mode, "data-slot": "frame", bg: "transparent", ...drawer.slide, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
333
+ return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsx(UsageProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...floor, flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", "$max-md": bar ? undefined : { display: 'none' }, onMouseDown: bar ? dragWindow : undefined, onDoubleClick: bar ? toggleWindowMaximize : undefined, ...(bar?.drag ?? null), children: [_jsxs(XStack, { "data-slot": "title-bar-start", height: "100%", items: "center", gap: 2, pl: (bar?.inset ?? 0) + 4, pr: 6, shrink: 0, width: closed ? RAIL : `calc(${RAIL}px + var(--app-sidebar-span, ${SIDE}px))`, ...(bar?.drag ?? null), children: [_jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) }), bar ? (_jsxs(_Fragment, { children: [_jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) })] })) : null] }), _jsxs(XStack, { id: "hanzo-titlebar-slot", "data-slot": "title-bar-main", flex: 1, minW: 0, self: "stretch", items: "center", justify: "space-between", pl: 14, pr: 10, gap: 6, ...(bar?.drag ?? null), children: [_jsx(XStack, { "data-slot": "titlebar-fallback", flex: 1, minW: 0, items: "center", justify: "space-between", gap: 8, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: mode === 'chat' ? '' : mode === 'dev' ? 'Dev' : mode === 'studio' ? 'Studio' : mode === 'design' ? 'Design' : mode === 'flow' ? 'Flow' : mode === 'tabs' ? 'Tabs' : '' }) }), bar ? (bar.controls !== undefined ? (bar.controls) : !bar.inset ? (_jsx(WindowControls, {})) : null) : null] })] }), _jsxs(XStack, { ref: drawer.pane, "data-app": mode, "data-slot": "frame", bg: "transparent", ...drawer.slide, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
334
334
  // The gap above the pane is the gap at its end and foot; a window's own bar above it is that gap.
335
335
  pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsxs(YStack, { height: "100%", position: "relative", "$max-md": { display: 'none' }, children: [_jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), closed ? (_jsx(YStack, { "data-slot": "sidebar-reopen-edge", position: "absolute", t: 0, b: 0, r: -4, width: 8, z: 20, cursor: "ew-resize", onDoubleClick: () => setClosed(false), onMouseDown: (down) => {
336
336
  const e = down;
@@ -80,6 +80,11 @@ export declare function onward(search: string): string | undefined;
80
80
  * lists its callback), and hanzo.ai opened with no app's authorize request in
81
81
  * its address, where a session would land on the site rather than in the app.
82
82
  * hanzo.app starts its own request and comes back to hanzo.ai's page with it.
83
+ *
84
+ * Except a sign-in that goes on to hanzo.ai's checkout (`paying`): the session
85
+ * has to land on the site, since the checkout is the site's, so hanzo.ai signs
86
+ * that one in itself.
87
+ *
83
88
  * Anywhere else, do nothing and report false so the caller signs in here.
84
89
  */
85
90
  export declare function handoff(address: string): boolean;
@@ -161,12 +161,36 @@ export function onward(search) {
161
161
  const next = new URLSearchParams(search).get("next");
162
162
  return next && safe(next, "") === next ? next : undefined;
163
163
  }
164
+ /** hanzo.ai's checkout: hanzo-inc/pay mounted at hanzo.ai/pay (lib/pay `BILLING_URL`), and every path under it. */
165
+ const CHECKOUT = /^\/pay(?:\/|$)/;
166
+ /**
167
+ * Whether the sign-in at `address` goes on to hanzo.ai's checkout: its `next`
168
+ * (or `redirect`, which the sign-in page reads too) is a path on this site
169
+ * (`safe`) under /pay. pay sends a buyer with no session there exactly so
170
+ * (hanzo-inc/pay lib/auth `login`, `/login?next=/pay/…`).
171
+ *
172
+ * The checkout is served on hanzo.ai alone and reads the session hanzo.ai's
173
+ * origin keeps. hanzo.app answers /pay by sending it to hanzo.ai/pay, so a
174
+ * session made on hanzo.app never reaches the checkout, which finds none and
175
+ * sends the buyer to sign in again: hanzo.ai/pay, hanzo.ai/login, hanzo.app/login,
176
+ * hanzo.app/pay, hanzo.ai/pay, without end ("Add funds", 2026-11-13).
177
+ */
178
+ function paying(address) {
179
+ const q = new URLSearchParams(address.split("#")[0].split("?")[1] ?? "");
180
+ const to = safe(q.get("next") || q.get("redirect"), "");
181
+ return to !== "" && CHECKOUT.test(new URL(to, HERE).pathname);
182
+ }
164
183
  /**
165
184
  * Send this sign-in to `address` on hanzo.app, the app's host, and report that
166
185
  * it left, from a host that cannot start one for itself: a `guest` (no client
167
186
  * lists its callback), and hanzo.ai opened with no app's authorize request in
168
187
  * its address, where a session would land on the site rather than in the app.
169
188
  * hanzo.app starts its own request and comes back to hanzo.ai's page with it.
189
+ *
190
+ * Except a sign-in that goes on to hanzo.ai's checkout (`paying`): the session
191
+ * has to land on the site, since the checkout is the site's, so hanzo.ai signs
192
+ * that one in itself.
193
+ *
170
194
  * Anywhere else, do nothing and report false so the caller signs in here.
171
195
  */
172
196
  export function handoff(address) {
@@ -174,7 +198,7 @@ export function handoff(address) {
174
198
  return false;
175
199
  const host = window.location.hostname;
176
200
  const asked = new URLSearchParams(address.split("#")[0].split("?")[1] ?? "").has("client_id");
177
- if (!guest(host) && !(signs(host) && !asked))
201
+ if (!guest(host) && !(signs(host) && !asked && !paying(address)))
178
202
  return false;
179
203
  window.location.assign(HOST + address);
180
204
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.78",
3
+ "version": "0.3.80",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",