Files
zeekay 6c65e3e941 @hanzo/app 0.2.0: the app SDK, renamed from @hanzo/rooms
Every import, the catalog pin and the docs name @hanzo/app and
github.com/hanzoai/app. lib/rooms.ts is lib/app.ts and
components/rooms.tsx is components/app.tsx.
2026-10-22 19:07:20 -07:00

37 lines
1.2 KiB
TypeScript

'use client'
import dynamic from 'next/dynamic'
import { useEffect } from 'react'
import { useRouter } from 'next/navigation'
import { useIam } from '@hanzo/iam/react'
import { PICKER } from '@hanzo/app/lib/destination'
import { chat, take } from './prompt'
import { useRoute } from './route'
/**
* The field a page ends on, drawn by the footer. The voice client and the chat
* client weigh more than the rest of the chrome together, so it loads where it
* is drawn.
*/
export const Ask = dynamic(() => import('./bar'))
/**
* The hand-off of a prompt written before signing in: it is delivered the
* moment there is a session, wherever the visitor lands. /auth/callback and the
* plan picker are left out: each is on its way somewhere, and the picker goes on
* to where the sign-in was headed, where the prompt is handed over.
*/
export default function Handoff() {
const path = useRoute()
const router = useRouter()
const { isAuthenticated } = useIam()
useEffect(() => {
if (!isAuthenticated || path === '/auth/callback' || path.startsWith(PICKER)) return
const held = take()
if (held) router.replace(chat(held))
}, [isAuthenticated, path, router])
return null
}