@@ -290,7 +290,7 @@ const fetchProxyGetTreatments = async (
290290 mvtId : number ,
291291 should_show_legacy_gate_tmp : boolean ,
292292 hasConsented : boolean ,
293- shouldNotServeNonDismissible : boolean ,
293+ shouldNotServeMandatory : boolean ,
294294) : Promise < AuxiaProxyGetTreatmentsResponse > => {
295295 // pageId example: 'money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
296296 const articleIdentifier = `www.theguardian.com/${ pageId } ` ;
@@ -313,7 +313,7 @@ const fetchProxyGetTreatments = async (
313313 mvtId,
314314 should_show_legacy_gate_tmp,
315315 hasConsented,
316- shouldNotServeNonDismissible ,
316+ shouldNotServeMandatory ,
317317 } ;
318318 const params = {
319319 method : 'POST' ,
@@ -328,6 +328,23 @@ const fetchProxyGetTreatments = async (
328328 return Promise . resolve ( response ) ;
329329} ;
330330
331+ const decideShouldNotServeMandatory = ( ) : boolean => {
332+ // Return a boolean indicating whether or not we accept mandatory gates for this call.
333+ // If the answer is `false` this doesn't decide whether the gate should be displayed or not,
334+ // it only means that if a gate is returned, then it must be mandatory.
335+
336+ // Now the question is how do we decide the answer ?
337+ // We return false if the following query parameter is present in the url:
338+ // utm_source=newsshowcase
339+
340+ // This may be extended in the future.
341+
342+ const params = new URLSearchParams ( window . location . search ) ;
343+ const value : string | null = params . get ( 'utm_source' ) ;
344+
345+ return value === 'newsshowcase' ;
346+ } ;
347+
331348const buildAuxiaGateDisplayData = async (
332349 contributionsServiceUrl : string ,
333350 pageId : string ,
@@ -365,7 +382,7 @@ const buildAuxiaGateDisplayData = async (
365382 ) ;
366383 }
367384
368- const shouldNotServeNonDismissible = false ; // todo get the value.
385+ const shouldNotServeMandatory = decideShouldNotServeMandatory ( ) ;
369386
370387 const response = await fetchProxyGetTreatments (
371388 contributionsServiceUrl ,
@@ -382,7 +399,7 @@ const buildAuxiaGateDisplayData = async (
382399 readerPersonalData . mvtId ,
383400 should_show_legacy_gate_tmp ,
384401 readerPersonalData . hasConsented ,
385- shouldNotServeNonDismissible ,
402+ shouldNotServeMandatory ,
386403 ) ;
387404
388405 if ( response . status && response . data ) {
0 commit comments