@@ -86,13 +86,28 @@ export type BootCacheData = Pick<
8686 | 'geo'
8787> & { lastModifier ?: string ; isAndroidApp ?: boolean } ;
8888
89- const getBootURL = ( app : string , url ?: string ) => {
89+ /**
90+ * Get normalized referrer type from pathname
91+ * Only returns known referrer identifiers for privacy
92+ */
93+ const getReferrerType = ( pathname ?: string ) : string | undefined => {
94+ if ( pathname ?. startsWith ( '/recruiter' ) ) {
95+ return 'recruiter' ;
96+ }
97+ return undefined ;
98+ } ;
99+
100+ const getBootURL = ( app : string , url ?: string , pathname ?: string ) => {
90101 const appRoute = app === 'companion' ? '/companion' : '' ;
91102 const params = new URLSearchParams ( ) ;
92103 params . append ( 'v' , process . env . CURRENT_VERSION ) ;
93104 if ( url ) {
94105 params . append ( 'url' , url ) ;
95106 }
107+ const referrer = getReferrerType ( pathname ) ;
108+ if ( referrer ) {
109+ params . append ( 'referrer' , referrer ) ;
110+ }
96111
97112 return `${ apiUrl } /boot${ appRoute } ?${ params } ` ;
98113} ;
@@ -108,19 +123,27 @@ const enrichBootWithFeatures = async (boot: Boot): Promise<Boot> => {
108123 return { ...boot , exp : { ...boot . exp , features : JSON . parse ( features ) } } ;
109124} ;
110125
111- export async function getBootData (
112- app : string ,
113- url ?: string ,
114- options ?: Record < 'cookies' , string > ,
115- ) : Promise < Boot > {
116- const bootURL = getBootURL ( app , url ) ;
126+ interface GetBootDataParams {
127+ app : string ;
128+ url ?: string ;
129+ cookies ?: string ;
130+ pathname ?: string ;
131+ }
132+
133+ export async function getBootData ( {
134+ app,
135+ url,
136+ cookies,
137+ pathname,
138+ } : GetBootDataParams ) : Promise < Boot > {
139+ const bootURL = getBootURL ( app , url , pathname ) ;
117140 const res = await fetch ( bootURL , {
118141 method : 'GET' ,
119142 credentials : 'include' ,
120143 headers : {
121144 app,
122145 'Content-Type' : 'application/json' ,
123- ...( options ?. cookies && { Cookie : options . cookies } ) ,
146+ ...( cookies && { Cookie : cookies } ) ,
124147 } ,
125148 } ) ;
126149 const result = await res . json ( ) ;
0 commit comments