@@ -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
@@ -88,6 +93,8 @@ const canInsertMobileAd =
88
93
// Allow insertion after first container at any time but for all other situations,
89
94
// prevent insertion before a secondary level container
90
95
index === 0 || ! isBeforeSecondaryLevelContainer ( index , collections ) ,
96
+ // Prevent insertion before a branded container
97
+ ! isBeforeBrandedContainer ( index , collections ) ,
91
98
] ;
92
99
93
100
// Ad insertion is possible if every condition is met
0 commit comments