1- import { useState , type FormEvent , type ReactNode } from 'react' ;
1+ import { useEffect , useState , type FormEvent } from 'react' ;
22import Head from '@docusaurus/Head' ;
33import Link from '@docusaurus/Link' ;
44import { useBaseUrlUtils } from '@docusaurus/useBaseUrl' ;
55import clsx from 'clsx' ;
66import styles from './business.module.css' ;
77import { buildPrompt , DAILY_PROMPTS , EXAMPLES , SOURCES , type Brief , type Source } from './_brief' ;
8+ import { sessionId , track } from '../../track' ;
89
910// The business landing (/business/) for founders who run their business with AI agents. It has its own
1011// header instead of the docs navbar, so it is not wrapped in the theme Layout. The screens are the drawn
@@ -15,6 +16,7 @@ const PAGE_DESCRIPTION = 'Agent-first business admin. Your coding agent builds t
1516const FONTS_URL = 'https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,500..800&family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap' ;
1617const BOOKING_URL = 'https://talk.devforth.io/book/30-minute-meeting' ;
1718const GITHUB_URL = 'https://github.com/devforth/adminforth' ;
19+ const START_URL = 'https://devforth.io/admin/api/af-start/business/' ;
1820
1921const PAINS = [
2022 {
@@ -411,7 +413,10 @@ function BriefBuilder(): JSX.Element {
411413 const [ state , setState ] = useState < ResultState > ( 'idle' ) ;
412414 const [ expanded , setExpanded ] = useState ( false ) ;
413415 const [ agent , setAgent ] = useState < 'claude' | 'codex' > ( 'claude' ) ;
414- const prompt = buildPrompt ( brief ) ;
416+ // the session id is in the browser only, the server render gets the link without it
417+ const [ startUrl , setStartUrl ] = useState ( START_URL ) ;
418+ useEffect ( ( ) => setStartUrl ( `${ START_URL } ?s=${ sessionId ( ) } ` ) , [ ] ) ;
419+ const prompt = buildPrompt ( brief , startUrl ) ;
415420
416421 const apply = ( id : string ) => {
417422 const { label : _label , ...fields } = EXAMPLES [ id ] ;
@@ -427,18 +432,21 @@ function BriefBuilder(): JSX.Element {
427432 } ;
428433 const prepare = ( e : FormEvent ) => {
429434 e . preventDefault ( ) ;
435+ track ( 'brief_prepared' ) ;
430436 setState ( 'ready' ) ;
431437 document . getElementById ( 'brief-ready-title' ) ?. focus ( ) ;
432438 } ;
433439 const copy = async ( ) => {
434440 try {
435441 await navigator . clipboard . writeText ( prompt ) ;
442+ track ( 'build_prompt_copied' ) ;
436443 setState ( 'copied' ) ;
437444 } catch {
438445 setState ( 'manual' ) ;
439446 }
440447 } ;
441448 const download = ( ) => {
449+ track ( 'brief_downloaded' ) ;
442450 const url = URL . createObjectURL ( new Blob ( [ prompt ] , { type : 'text/markdown' } ) ) ;
443451 const a = Object . assign ( document . createElement ( 'a' ) , { href : url , download : 'my-business-brief.md' } ) ;
444452 a . click ( ) ;
0 commit comments