@@ -17,7 +17,7 @@ type GroupedCounts = {
17
17
18
18
export type AdCandidateMobile = Pick <
19
19
DCRCollectionType ,
20
- 'collectionType' | 'containerLevel'
20
+ 'collectionType' | 'containerLevel' | 'containerPalette'
21
21
> ;
22
22
23
23
/** The Merch high slot is directly before the most viewed container */
@@ -41,6 +41,11 @@ const isMerchHighPosition = (
41
41
const isBeforeThrasher = ( index : number , collections : AdCandidateMobile [ ] ) =>
42
42
collections [ index + 1 ] ?. collectionType === 'fixed/thrasher' ;
43
43
44
+ const isBeforeBrandedContainer = (
45
+ index : number ,
46
+ collections : AdCandidateMobile [ ] ,
47
+ ) => collections [ index + 1 ] ?. containerPalette === 'Branded' ;
48
+
44
49
const isMostViewedContainer = ( collection : AdCandidateMobile ) =>
45
50
collection . collectionType === 'news/most-popular' ;
46
51
@@ -74,12 +79,14 @@ const canInsertMobileAd =
74
79
* - Is NOT the slot used for the merch high position
75
80
* - Is NOT a thrasher if it is the first container
76
81
* - Is NOT before a thrasher
82
+ * - Is NOT before a branded container
77
83
* - Is NOT the most viewed container
78
84
*/
79
85
const rules = [
80
86
! isMerchHighPosition ( index , merchHighPosition ) ,
81
87
! isFirstContainerAndThrasher ( collection . collectionType , index ) ,
82
88
! isBeforeThrasher ( index , collections ) ,
89
+ ! isBeforeBrandedContainer ( index , collections ) ,
83
90
! isMostViewedContainer ( collection ) ,
84
91
] ;
85
92
0 commit comments