From ec55dd24506e12d08b2b7eb2c5be6393bd949411 Mon Sep 17 00:00:00 2001 From: Jay Pilgreen Date: Wed, 20 Sep 2023 08:50:33 -0500 Subject: [PATCH] config structure simplification --- config/homepage.json | 33 ++---- config/section.json | 12 +-- config/story.json | 125 +++++++--------------- demo/demo.css | 4 + demo/homepage/index.html | 86 +++++++++++++++ demo/locker.js | 12 ++- demo/section/index.html | 2 +- demo/story/index.html | 2 + index.js | 6 +- lib/config.js | 226 ++++++++++++++++++--------------------- lib/zones.js | 108 +++++++++++++++---- 11 files changed, 347 insertions(+), 269 deletions(-) create mode 100644 demo/homepage/index.html diff --git a/config/homepage.json b/config/homepage.json index f4e8757..a63ffec 100644 --- a/config/homepage.json +++ b/config/homepage.json @@ -2,42 +2,23 @@ "zones": [ { "id": "zone-community-events", + "vip": "#secondary-story-9", "type": "editorial", - "filters": [ - { - "type": "config", - "name": "zone.communityEvents", - "value": true - } - ], + "filters": { + "zone.communityEvents": true + }, "zephr": { "feature": "zone-community-events", - "dataset": [ - { - "type": "config", - "name": "market", - "value": "marketInfo.domain" - } - ] - }, - "placement": { - "type": "query", - "value": "#secondary-story-9" + "dataset": ["marketInfo.domain"] } }, { "id": "zone-el-9", - "placement": { - "type": "query", - "value": "#secondary-story-6" - } + "vip": "#seconddary-story-6" }, { "id": "zone-el-11", - "placement": { - "type": "query", - "value": "#secondary-story-10" - } + "vip": "#secondary-story-10" } ] } diff --git a/config/section.json b/config/section.json index a26a0e1..b706084 100644 --- a/config/section.json +++ b/config/section.json @@ -2,15 +2,9 @@ "zones": [ { "id": "zone-el-9", - "filters": [ - { - "type": "subscriber", - "value": false - } - ], - "placement": { - "type": "query", - "value": ".grid > :nth-child(14)" + "vip": ".grid > :nth-child(14)", + "filters": { + "subscriber": false } } ] diff --git a/config/story.json b/config/story.json index d8b87a8..e6a2f7a 100644 --- a/config/story.json +++ b/config/story.json @@ -1,5 +1,5 @@ { - "base": ".story-body [id^=zone-el]", + "wps": ".story-body [id^=zone-el]", "ignore": ["zone-el-16"], "cadence": { "subscriber": 4, @@ -7,119 +7,72 @@ "standard": 2 }, "zones": [ + { + "id": "zone-el-1", + "vip": ".flag", + "position": "afterend", + "filters": { + "subscriber": false, + "zone.sponsoredArticle": false + } + }, { "id": "zone-taboola-recommendations", - "filters": [ - { - "type": "config", - "name": "zone.taboolaRecommendations", - "value": true - } - ], + "after": "zone-el-101", + "tracking": true, + "filters": { + "zone.taboolaRecommendations": true + }, "zephr": { "feature": "zone-taboola-recommendations", - "dataset": [ - { - "type": "dma", - "name": "dma" - } - ] - }, - "placement": { - "type": "after", - "value": "zone-el-101" - }, - "tracking": true + "dataset": ["dma"] + } }, { "id": "zone-si-tickets", "cue": 278143207, - "filters": [ - { - "type": "config", - "name": "zone.siTickets", - "value": true - } - ], - "placement": { - "type": "after", - "value": "zone-el-101" + "after": "zone-el-101", + "filters": { + "zone.siTickets": true } }, { "id": "zone-gamecocks-nav", + "vip": ".story-body", "cue": 278142507, - "filters": [ - { - "type": "config", - "name": "zone.gamecocksNav", - "value": true - } - ], - "placement": { - "type": "query", - "value": ".story-body" + "filters": { + "zone.gamecocksNav": true } }, { "id": "zone-sponsored-article", "cue": 277282728, - "filters": [ - { - "type": "config", - "name": "zone.sponsoredArticle", - "value": true - } - ], - "placement": { - "type": "query", - "value": ".story-body > .header" - }, - "classList": ["hidden"] + "vip": ".story-body > .header", + "classList": ["hidden"], + "filters": { + "zone.sponsoredArticle": true + } }, { "id": "zone-local-news-digest", "tracking": true, - "filters": [ - { - "type": "config", - "name": "zone.localNewsDigest", - "value": true - }, - { - "type": "dma", - "value": true - } - ], + "after": "zone-el-101", + "classList": ["stn-player"], + "filters": { + "dma": true, + "zone.localNewsDigest": true + }, "zephr": { "feature": "zone-local-news-digest", - "dataset": [ - { - "type": "config", - "name": "domain", - "value": "marketInfo.domain" - } - ] - }, - "placement": { - "type": "after", - "value": "zone-el-101" - }, - "classList": ["stn-player"] + "dataset": ["marketInfo.domain"] + } }, { "id": "zone-lexgoeat-sponsor", + "vip": ".story-body", "cue": 266575046, - "filters": [ - { - "type": "config", - "name": "zone.lexgoEatSponsor", - "value": true - } - ], - "placement": { - "type": "query", - "value": ".story-body" + "filters": { + "zone.lexgoEatSponsor": true } } ] diff --git a/demo/demo.css b/demo/demo.css index 17ac86a..06ca630 100644 --- a/demo/demo.css +++ b/demo/demo.css @@ -6,6 +6,10 @@ min-height: 300px; } +.digest { + min-height: 600px; +} + .lead-item { min-height: 600px; } diff --git a/demo/homepage/index.html b/demo/homepage/index.html new file mode 100644 index 0000000..a5e5b9c --- /dev/null +++ b/demo/homepage/index.html @@ -0,0 +1,86 @@ + + + + Zones homepage demo + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+ +
+
+ Digest group +
+
+
+
+
+ +
+
+ +
+ +
+
+ Digest group +
+
+
+
+
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+ + diff --git a/demo/locker.js b/demo/locker.js index 30e7861..4386440 100644 --- a/demo/locker.js +++ b/demo/locker.js @@ -27,14 +27,16 @@ const locker = { case "zone.communityEvents": return true; case "zone.taboolaRecommendations": - return true; + return false; case "zone.siTickets": return false; case "zone.gamecocksNav": return false; case "zone.sponsoredArticle": - return true; + return false; case "zone.lexgoEatSponsor": + return false; + case "zone.localNewsDigest": return true; default: return undefined; @@ -44,7 +46,7 @@ const locker = { // user info user: { isSubscriber() { - return true; + return false; }, isLoggedIn() { @@ -52,7 +54,7 @@ const locker = { }, isInDMA() { - return Promise.resolve(false); + return Promise.resolve(true); } }, @@ -95,7 +97,7 @@ const locker = { // Demo only for now config: { homepage: "/config/homepage.json", - section: "/config/section.json", + sectfront: "/config/section.json", story: "/config/story.json" } } diff --git a/demo/section/index.html b/demo/section/index.html index 1170cbf..bca06ea 100644 --- a/demo/section/index.html +++ b/demo/section/index.html @@ -11,7 +11,7 @@ - +