@@ -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,33 +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 dma = subscriber ? true : await locker . user . isInDMA ( ) ;
35- const nonsubscriberOutOfMarket = ! subscriber && ! dma ;
36- const domainName = locker . getConfig ( 'domainName' ) ;
37- const allowedDomains = [ "www.bnd.com" , "www.myrtlebeachonline.com" ] ;
38- const cadence = allowedDomains . includes ( domainName ) && nonsubscriberOutOfMarket ? 2 : ( subscriber ? 4 : 3 ) ;
39-
40- zones . distribute ( cadence ) ;
41-
42- // Temporary cleanup
43- story . cleanup ( ) ;
44- break ;
45- case "homepage" :
46- await config . load ( locker . config . homepage ) ;
47- break ;
48- case "sectfront" :
49- await config . load ( locker . config . section ) ;
50- break ;
51- default :
52- 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" ) ;
5336 }
5437
38+ // Temporary cleanup
39+ if ( locker . pageType == "story" ) {
40+ story . cleanup ( ) ;
41+ }
42+
43+ // Render and resolve
5544 zones . render ( ) ;
5645 resolve ( "zones-loaded" )
5746 } ) ;
0 commit comments