@@ -10,11 +10,11 @@ function distributeZones(locker) {
1010 // Setup
1111 zones . setLocker ( locker ) ;
1212
13- // Configs
13+ // Config files
1414 if ( ! locker . config ) {
1515 locker . config = {
1616 homepage : "/static/hi/zones/homepage.json" ,
17- section : "/static/hi/zones/section.json" ,
17+ sectfront : "/static/hi/zones/section.json" ,
1818 story : "/static/hi/zones/story.json"
1919 }
2020 }
@@ -25,28 +25,22 @@ function distributeZones(locker) {
2525 // Give the performance team a promise
2626 return new Promise ( ( resolve , reject ) => {
2727 locker . executeWhenDOMReady ( async ( ) => {
28- switch ( locker . pageType ) {
29- case "story" :
30- await config . load ( locker . config . story ) ;
31-
32- // Set cadence for subscriber vs. nonsubscriber vs. nonsubscriber out of market in test domains
33- const subscriber = locker . user . isSubscriber ( ) ;
34- const cadence = subscriber ? 4 : 2 ;
35- zones . distribute ( cadence ) ;
36-
37- // Temporary cleanup
38- story . cleanup ( ) ;
39- break ;
40- case "homepage" :
41- await config . load ( locker . config . homepage ) ;
42- break ;
43- case "sectfront" :
44- await config . load ( locker . config . section ) ;
45- break ;
46- default :
47- reject ( "not a matching page type" ) ;
28+ // Config keys match pageType coming from Yozons
29+ const file = locker . config [ locker . pageType ] ;
30+
31+ // Load config file
32+ if ( file ) {
33+ await config . load ( file ) ;
34+ } else {
35+ reject ( "not a matching page type" ) ;
4836 }
4937
38+ // Temporary cleanup
39+ if ( locker . pageType == "story" ) {
40+ story . cleanup ( ) ;
41+ }
42+
43+ // Render and resolve
5044 zones . render ( ) ;
5145 resolve ( "zones-loaded" )
5246 } ) ;
0 commit comments