File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,14 @@ const locker = {
1414 // generic pageInfo getter
1515 getConfig ( key ) {
1616 switch ( key ) {
17+ case "domainName" :
18+ return "www.kansascity.com" ;
19+ case "articleCredit" :
20+ return "The Kansas City Star" ;
1721 case "marketInfo.domain" :
1822 return "miamiherald" ;
1923 case "marketInfo.taxonomy" :
2024 return "News/Sports//" ;
21- case "articleCredit" :
22- return "The Kansas City Star" ;
2325 case "zone.carousel" :
2426 return true ;
2527 case "zone.zeeto" :
Original file line number Diff line number Diff line change @@ -91,6 +91,11 @@ export function load(url) {
9191 zone . zephr ( feature ) ;
9292 }
9393
94+ // CUE connection
95+ if ( config . cue ) {
96+ zone . cue ( config . cue ) ;
97+ }
98+
9499 // Add classes
95100 if ( config . classList ) {
96101 zone . classList . add ( ...config . classList )
Original file line number Diff line number Diff line change @@ -101,6 +101,27 @@ export class Zone {
101101 }
102102 }
103103
104+ /*
105+ * CUE content item functionality
106+ * @param id {string} the content id in CUE
107+ */
108+
109+ async cue ( id ) {
110+ const market = locker . getConfig ( "domainName" ) ;
111+ const endpoint = `https://${ market } /webapi-public/v2/content/${ id } `
112+
113+ const req = await fetch ( endpoint ) ;
114+ const response = await req . json ( ) ;
115+ const payload = response . content ;
116+
117+ if ( payload ) {
118+ const range = document . createRange ( ) . createContextualFragment ( payload ) ;
119+ this . element . append ( range ) ;
120+ } else {
121+ this . log ( "CUE payload was empty" ) ;
122+ }
123+ }
124+
104125 /*
105126 * Injects this zone
106127 * @param ele {element} the injection point
You can’t perform that action at this time.
0 commit comments