@@ -58,6 +58,18 @@ export const hasRequiredConsents = (): Promise<boolean> =>
58
58
. then ( ( { canTarget } : ConsentState ) => canTarget )
59
59
. catch ( ( ) => false ) ;
60
60
61
+ export const pageMetaDataMakesItEligibleForGateDisplay = (
62
+ contentType : string ,
63
+ sectionId : string | undefined ,
64
+ tags : TagType [ ] ,
65
+ ) : boolean => {
66
+ return (
67
+ isValidContentType ( contentType ) &&
68
+ isValidSection ( sectionId ) &&
69
+ isValidTag ( tags )
70
+ ) ;
71
+ } ;
72
+
61
73
export const canShowSignInGate = ( {
62
74
isSignedIn,
63
75
currentTest,
@@ -66,23 +78,30 @@ export const canShowSignInGate = ({
66
78
tags,
67
79
isPaidContent,
68
80
isPreview,
69
- } : CanShowGateProps ) : Promise < boolean > =>
70
- Promise . resolve (
81
+ } : CanShowGateProps ) : Promise < boolean > => {
82
+ // This check is functionally identical to the same check in SDC
83
+ // This logically ensures that SDC will get a subset of the pages for which
84
+ // pageMetaDataMakesItEligibleForGateDisplay return true
85
+ if (
86
+ ! pageMetaDataMakesItEligibleForGateDisplay ( contentType , sectionId , tags )
87
+ ) {
88
+ return Promise . resolve ( false ) ;
89
+ }
90
+
91
+ return Promise . resolve (
71
92
! isSignedIn &&
72
93
! hasUserDismissedGateMoreThanCount (
73
94
currentTest . variant ,
74
95
currentTest . name ,
75
96
5 ,
76
97
) &&
77
98
isNPageOrHigherPageView ( 3 ) &&
78
- isValidContentType ( contentType ) &&
79
- isValidSection ( sectionId ) &&
80
- isValidTag ( tags ) &&
81
99
// hide the sign in gate on isPaidContent
82
100
! isPaidContent &&
83
101
// hide the sign in gate on internal tools preview &&
84
102
! isPreview ,
85
103
) ;
104
+ } ;
86
105
87
106
export const canShowSignInGateMandatory : ( {
88
107
isSignedIn,
0 commit comments