Skip to content

Commit 793f3a3

Browse files
committed
Introduce getGateDisplayCount()
1 parent c2de706 commit 793f3a3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

dotcom-rendering/src/components/SignInGate/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export interface AuxiaProxyGetTreatmentsPayload {
126126
hasConsented: boolean;
127127
shouldServeDismissible: boolean; // [2]
128128
showDefaultGate: ShowGateValues; // [3]
129+
gateDisplayCount: number;
129130
}
130131

131132
// [1]

dotcom-rendering/src/components/SignInGateSelector.importable.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ const fetchProxyGetTreatments = async (
293293
hasConsented: boolean,
294294
shouldServeDismissible: boolean,
295295
showDefaultGate: ShowGateValues,
296+
gateDisplayCount: number,
296297
): Promise<AuxiaProxyGetTreatmentsResponse> => {
297298
// pageId example: 'money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software'
298299
const articleIdentifier = `www.theguardian.com/${pageId}`;
@@ -317,6 +318,7 @@ const fetchProxyGetTreatments = async (
317318
hasConsented,
318319
shouldServeDismissible,
319320
showDefaultGate,
321+
gateDisplayCount,
320322
};
321323
const params = {
322324
method: 'POST',
@@ -372,6 +374,11 @@ const decideShowDefaultGate = (): ShowGateValues => {
372374
return undefined;
373375
};
374376

377+
const getGateDisplayCount = (): number => {
378+
// TODO: retrieve the number of time the page has been displayed
379+
return 0;
380+
};
381+
375382
const buildAuxiaGateDisplayData = async (
376383
contributionsServiceUrl: string,
377384
pageId: string,
@@ -410,8 +417,8 @@ const buildAuxiaGateDisplayData = async (
410417
}
411418

412419
const shouldServeDismissible = decideShouldServeDismissible();
413-
414420
const showDefaultGate = decideShowDefaultGate();
421+
const gateDisplayCount = getGateDisplayCount();
415422

416423
const response = await fetchProxyGetTreatments(
417424
contributionsServiceUrl,
@@ -430,6 +437,7 @@ const buildAuxiaGateDisplayData = async (
430437
readerPersonalData.hasConsented,
431438
shouldServeDismissible,
432439
showDefaultGate,
440+
gateDisplayCount,
433441
);
434442

435443
if (response.status && response.data) {

0 commit comments

Comments
 (0)