6
6
} from '../lib/contributions' ;
7
7
import { getDailyArticleCount , getToday } from '../lib/dailyArticleCount' ;
8
8
import type { EditionId } from '../lib/edition' ;
9
+ import { getLocaleCode } from '../lib/getCountryCode' ;
9
10
import { isUserLoggedIn } from '../lib/identity' ;
10
11
import { parseCheckoutCompleteCookieData } from '../lib/parser/parseCheckoutOutCookieData' ;
11
12
import { constructQuery } from '../lib/querystring' ;
@@ -503,10 +504,12 @@ const decideAuxiaProxyReaderPersonalData =
503
504
const dailyArticleCount = decideDailyArticleCount ( ) ;
504
505
const hasConsent = await hasCmpConsentForBrowserId ( ) ;
505
506
const isSupporter = decideIsSupporter ( ) ;
507
+ const countryCode = ( await getLocaleCode ( ) ) ?? '' ; // default to empty string
506
508
const data = {
507
509
browserId : hasConsent ? browserId : undefined ,
508
510
dailyArticleCount,
509
511
isSupporter,
512
+ countryCode,
510
513
} ;
511
514
return Promise . resolve ( data ) ;
512
515
} ;
@@ -522,6 +525,7 @@ const fetchProxyGetTreatments = async (
522
525
sectionId : string ,
523
526
tagIds : string [ ] ,
524
527
gateDismissCount : number ,
528
+ countryCode : string ,
525
529
) : Promise < AuxiaProxyGetTreatmentsResponse > => {
526
530
// pageId example: 'money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
527
531
const articleIdentifier = `www.theguardian.com/${ pageId } ` ;
@@ -539,6 +543,7 @@ const fetchProxyGetTreatments = async (
539
543
sectionId,
540
544
tagIds,
541
545
gateDismissCount,
546
+ countryCode,
542
547
} ;
543
548
const params = {
544
549
method : 'POST' ,
@@ -575,6 +580,7 @@ const buildAuxiaGateDisplayData = async (
575
580
sectionId ,
576
581
tagIds ,
577
582
gateDismissCount ,
583
+ readerPersonalData . countryCode ,
578
584
) ;
579
585
if ( response . status && response . data ) {
580
586
const answer = {
0 commit comments