@@ -16,6 +16,10 @@ import { logger } from '../utils/logger'
1616import { saveFreebuffModelPreference } from '../utils/settings'
1717
1818import type { FreebuffSessionResponse } from '../types/freebuff-session'
19+ import type {
20+ FreebuffCountryBlockReason ,
21+ FreebuffIpPrivacySignal ,
22+ } from '@codebuff/common/types/freebuff-session'
1923
2024const POLL_INTERVAL_QUEUED_MS = 5_000
2125const POLL_INTERVAL_ACTIVE_MS = 30_000
@@ -319,10 +323,30 @@ export function markFreebuffSessionSuperseded(): void {
319323 * Transitioning the session state here unmounts the Chat surface in favor of
320324 * the waiting-room's country_blocked message, so the user can't keep typing
321325 * and sending doomed requests. */
322- export function markFreebuffSessionCountryBlocked ( countryCode : string ) : void {
326+ export function markFreebuffSessionCountryBlocked (
327+ params :
328+ | string
329+ | {
330+ countryCode : string
331+ countryBlockReason ?: string
332+ ipPrivacySignals ?: string [ ]
333+ } ,
334+ ) : void {
323335 if ( ! IS_FREEBUFF ) return
336+ const next =
337+ typeof params === 'string'
338+ ? { countryCode : params }
339+ : {
340+ countryCode : params . countryCode ,
341+ countryBlockReason : params . countryBlockReason as
342+ | FreebuffCountryBlockReason
343+ | undefined ,
344+ ipPrivacySignals : params . ipPrivacySignals as
345+ | FreebuffIpPrivacySignal [ ]
346+ | undefined ,
347+ }
324348 controller ?. abort ( )
325- controller ?. apply ( { status : 'country_blocked' , countryCode } )
349+ controller ?. apply ( { status : 'country_blocked' , ... next } )
326350 // Best-effort DELETE so we don't hold a waiting-room seat on a session the
327351 // server is already refusing to serve at chat time.
328352 releaseFreebuffSlot ( ) . catch ( ( ) => { } )
0 commit comments