5
5
shouldHideSupportMessaging ,
6
6
} from '../lib/contributions' ;
7
7
import { getDailyArticleCount , getToday } from '../lib/dailyArticleCount' ;
8
+ import type { EditionId } from '../lib/edition' ;
8
9
import { parseCheckoutCompleteCookieData } from '../lib/parser/parseCheckoutOutCookieData' ;
9
10
import { constructQuery } from '../lib/querystring' ;
10
11
import { useAB } from '../lib/useAB' ;
@@ -57,6 +58,19 @@ type Props = {
57
58
idUrl ?: string ;
58
59
switches : Switches ;
59
60
contributionsServiceUrl : string ;
61
+ editionId : EditionId ;
62
+ } ;
63
+
64
+ type PropsDefault = {
65
+ contentType : string ;
66
+ sectionId ?: string ;
67
+ tags : TagType [ ] ;
68
+ isPaidContent : boolean ;
69
+ isPreview : boolean ;
70
+ host ?: string ;
71
+ pageId : string ;
72
+ idUrl ?: string ;
73
+ switches : Switches ;
60
74
} ;
61
75
62
76
// interface for the component which shows the sign in gate
@@ -214,14 +228,7 @@ const SignInGateSelectorDefault = ({
214
228
pageId,
215
229
idUrl = 'https://profile.theguardian.com' ,
216
230
switches,
217
- contributionsServiceUrl,
218
- } : Props ) => {
219
- // comment group: auxia-prototype-e55a86ef
220
- // The following (useless) instruction only exists to avoid linting error
221
- // so that SignInGateSelectorDefault, SignInGateSelectorAuxia and SignInGateSelector
222
- // all have the same signature, while we give shape to the Auxia prototype.
223
- contributionsServiceUrl ;
224
-
231
+ } : PropsDefault ) => {
225
232
const authStatus = useAuthStatus ( ) ;
226
233
const isSignedIn =
227
234
authStatus . kind === 'SignedInWithOkta' ||
@@ -372,6 +379,7 @@ export const SignInGateSelector = ({
372
379
idUrl = 'https://profile.theguardian.com' ,
373
380
switches,
374
381
contributionsServiceUrl,
382
+ editionId,
375
383
} : Props ) => {
376
384
const abTestAPI = useAB ( ) ?. api ;
377
385
const userIsInAuxiaExperiment = ! ! abTestAPI ?. isUserInVariant (
@@ -391,7 +399,6 @@ export const SignInGateSelector = ({
391
399
pageId = { pageId }
392
400
idUrl = { idUrl }
393
401
switches = { switches }
394
- contributionsServiceUrl = { contributionsServiceUrl }
395
402
/>
396
403
) ;
397
404
} else {
@@ -401,6 +408,7 @@ export const SignInGateSelector = ({
401
408
pageId = { pageId }
402
409
idUrl = { idUrl }
403
410
contributionsServiceUrl = { contributionsServiceUrl }
411
+ editionId = { editionId }
404
412
/>
405
413
) ;
406
414
}
@@ -434,6 +442,7 @@ type PropsAuxia = {
434
442
pageId : string ;
435
443
idUrl : string ;
436
444
contributionsServiceUrl : string ;
445
+ editionId : EditionId ;
437
446
} ;
438
447
439
448
interface ShowSignInGateAuxiaProps {
@@ -495,10 +504,10 @@ const fetchProxyGetTreatments = async (
495
504
browserId : string | undefined ,
496
505
isSupporter : boolean ,
497
506
dailyArticleCount : number ,
507
+ editionId : EditionId ,
498
508
) : Promise < AuxiaProxyGetTreatmentsResponse > => {
499
509
// pageId example: 'money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
500
510
const articleIdentifier = `www.theguardian.com/${ pageId } ` ;
501
-
502
511
const url = `${ contributionsServiceUrl } /auxia/get-treatments` ;
503
512
const headers = {
504
513
'Content-Type' : 'application/json' ,
@@ -508,6 +517,7 @@ const fetchProxyGetTreatments = async (
508
517
isSupporter,
509
518
dailyArticleCount,
510
519
articleIdentifier,
520
+ editionId,
511
521
} ;
512
522
const params = {
513
523
method : 'POST' ,
@@ -525,6 +535,7 @@ const fetchProxyGetTreatments = async (
525
535
const buildAuxiaGateDisplayData = async (
526
536
contributionsServiceUrl : string ,
527
537
pageId : string ,
538
+ editionId : EditionId ,
528
539
) : Promise < AuxiaGateDisplayData | undefined > => {
529
540
const readerPersonalData = await decideAuxiaProxyReaderPersonalData ( ) ;
530
541
const response = await fetchProxyGetTreatments (
@@ -533,6 +544,7 @@ const buildAuxiaGateDisplayData = async (
533
544
readerPersonalData . browserId ,
534
545
readerPersonalData . isSupporter ,
535
546
readerPersonalData . dailyArticleCount ,
547
+ editionId ,
536
548
) ;
537
549
if ( response . status && response . data ) {
538
550
const answer = {
@@ -581,6 +593,7 @@ const SignInGateSelectorAuxia = ({
581
593
pageId,
582
594
idUrl,
583
595
contributionsServiceUrl,
596
+ editionId,
584
597
} : PropsAuxia ) => {
585
598
/*
586
599
comment group: auxia-prototype-e55a86ef
@@ -643,6 +656,7 @@ const SignInGateSelectorAuxia = ({
643
656
const data = await buildAuxiaGateDisplayData (
644
657
contributionsServiceUrl ,
645
658
pageId ,
659
+ editionId ,
646
660
) ;
647
661
if ( data !== undefined ) {
648
662
setAuxiaGateDisplayData ( data ) ;
0 commit comments