@@ -290,7 +290,7 @@ const fetchProxyGetTreatments = async (
290
290
mvtId : number ,
291
291
should_show_legacy_gate_tmp : boolean ,
292
292
hasConsented : boolean ,
293
- shouldNotServeNonDismissible : boolean ,
293
+ shouldNotServeMandatory : boolean ,
294
294
) : Promise < AuxiaProxyGetTreatmentsResponse > => {
295
295
// pageId example: 'money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
296
296
const articleIdentifier = `www.theguardian.com/${ pageId } ` ;
@@ -313,7 +313,7 @@ const fetchProxyGetTreatments = async (
313
313
mvtId,
314
314
should_show_legacy_gate_tmp,
315
315
hasConsented,
316
- shouldNotServeNonDismissible ,
316
+ shouldNotServeMandatory ,
317
317
} ;
318
318
const params = {
319
319
method : 'POST' ,
@@ -328,6 +328,23 @@ const fetchProxyGetTreatments = async (
328
328
return Promise . resolve ( response ) ;
329
329
} ;
330
330
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
+
331
348
const buildAuxiaGateDisplayData = async (
332
349
contributionsServiceUrl : string ,
333
350
pageId : string ,
@@ -365,7 +382,7 @@ const buildAuxiaGateDisplayData = async (
365
382
) ;
366
383
}
367
384
368
- const shouldNotServeNonDismissible = false ; // todo get the value.
385
+ const shouldNotServeMandatory = decideShouldNotServeMandatory ( ) ;
369
386
370
387
const response = await fetchProxyGetTreatments (
371
388
contributionsServiceUrl ,
@@ -382,7 +399,7 @@ const buildAuxiaGateDisplayData = async (
382
399
readerPersonalData . mvtId ,
383
400
should_show_legacy_gate_tmp ,
384
401
readerPersonalData . hasConsented ,
385
- shouldNotServeNonDismissible ,
402
+ shouldNotServeMandatory ,
386
403
) ;
387
404
388
405
if ( response . status && response . data ) {
0 commit comments