1- import type { UseFormResult } from '../../components/form' ;
21import { useForm } from '../../components/form' ;
32import { setup } from '../../machine/setup' ;
43import { useMachine } from '../../machine/use-machine' ;
5- import type { WaitlistModel , WaitlistStep , WaitlistValues } from './waitlist.types' ;
4+ import type { WaitlistModel } from './waitlist.types' ;
5+ import type { WaitlistViewProps } from './waitlist.view' ;
66
77export const WAITLIST_REDIRECT_DELAY_MS = 2000 ;
88
@@ -25,27 +25,17 @@ const waitlistMachine = createMachine({
2525 joined : {
2626 after : {
2727 [ WAITLIST_REDIRECT_DELAY_MS ] : {
28- target : 'redirected' ,
2928 guard : context => context . onRedirect !== undefined ,
3029 actions : context => context . onRedirect ?.( ) ,
3130 } ,
3231 } ,
3332 } ,
34- redirected : { type : 'final' } ,
3533 } ,
3634} ) ;
3735
3836export type WaitlistReadyModel = Extract < WaitlistModel , { status : 'ready' } > ;
3937
40- export interface WaitlistController {
41- step : WaitlistStep ;
42- form : UseFormResult < WaitlistValues > ;
43- renderBranding : boolean ;
44- isRedirecting : boolean ;
45- onSignIn : ( ) => void ;
46- }
47-
48- export function useWaitlistController ( model : WaitlistReadyModel ) : WaitlistController {
38+ export function useWaitlistController ( model : WaitlistReadyModel ) : WaitlistViewProps {
4939 const { initialEmailAddress, renderBranding, onJoinWaitlist, onSignIn, onRedirect } = model ;
5040 const [ snapshot , send ] = useMachine ( waitlistMachine , { context : { onRedirect } } ) ;
5141 const form = useForm ( {
0 commit comments