Skip to content

Commit fbb936a

Browse files
committed
Prevent mobile front ads from being placed before a labs container
1 parent 8f10440 commit fbb936a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dotcom-rendering/src/lib/getFrontsAdPositions.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type GroupedCounts = {
1717

1818
export type AdCandidateMobile = Pick<
1919
DCRCollectionType,
20-
'collectionType' | 'containerLevel'
20+
'collectionType' | 'containerLevel' | 'containerPalette'
2121
>;
2222

2323
/** The Merch high slot is directly before the most viewed container */
@@ -41,6 +41,11 @@ const isMerchHighPosition = (
4141
const isBeforeThrasher = (index: number, collections: AdCandidateMobile[]) =>
4242
collections[index + 1]?.collectionType === 'fixed/thrasher';
4343

44+
const isBeforeBrandedContainer = (
45+
index: number,
46+
collections: AdCandidateMobile[],
47+
) => collections[index + 1]?.containerPalette === 'Branded';
48+
4449
const isMostViewedContainer = (collection: AdCandidateMobile) =>
4550
collection.collectionType === 'news/most-popular';
4651

@@ -74,12 +79,14 @@ const canInsertMobileAd =
7479
* - Is NOT the slot used for the merch high position
7580
* - Is NOT a thrasher if it is the first container
7681
* - Is NOT before a thrasher
82+
* - Is NOT before a branded container
7783
* - Is NOT the most viewed container
7884
*/
7985
const rules = [
8086
!isMerchHighPosition(index, merchHighPosition),
8187
!isFirstContainerAndThrasher(collection.collectionType, index),
8288
!isBeforeThrasher(index, collections),
89+
!isBeforeBrandedContainer(index, collections),
8390
!isMostViewedContainer(collection),
8491
];
8592

0 commit comments

Comments
 (0)