AARP Personalized Nutrition: Meal Plans and More

0


AARP Personalized Nutrition: Meal Plans and More { const intItem = setInterval(() => { if (checkerFunction()) { clearInterval(intItem); resolve(); } }, 10); }); } async function loadAARPContent() { await awaitTheFollowing(() => window.baseAARPUrl !== undefined); const baseUrl = window.baseAARPUrl; await loadContent( `${baseUrl}/full-wrapper/master.head.html`, ‘head’, ); await awaitTheFollowing( () => window.AARP.readyStateLoader !== undefined && window.AARP.Externals.attachPageJsCallback !== undefined, ); await loadContent( `${baseUrl}/global-header/master.resource.root.html`, ‘aarp-header’, ); /*await loadContent( `${baseUrl}/global-header/master.bodyTargeting.html`, ‘aarp-context-hub-js’, );*/ await loadContent( `${baseUrl}/global-footer/master.resource.root.html`, ‘aarp-footer’, ); await loadContent( `${baseUrl}/full-wrapper/master.footer.html`, ‘aarp-page-js’, ); await awaitTheFollowing( () => window.headerJoinButtonURL !== undefined, ); let headerJoinButtonURL = window.headerJoinButtonURL; console.log( ‘headerJoinButtonURL::98:::::::::’, headerJoinButtonURL, ); await awaitTheFollowing( () => window.headerRenewButtonURL !== undefined, ); let headerRenewButtonURL = window.headerRenewButtonURL; console.log( ‘headerRenewButtonURL:::::107::::::’, headerRenewButtonURL, ); document.addEventListener(‘click’, function (event) { if ( event.target.tagName === ‘A’ && event.target.href.startsWith(‘http’) ) { const linkText = event.target.textContent .trim() .toLowerCase(); if (linkText === ‘logout’) { event.preventDefault(); localStorage.clear(); sessionStorage.clear(); window.location.href = `${ event.target.href }?referrer=${encodeURIComponent( window.location.origin, )}`; } else if (linkText === ‘join’) { console.log( ‘headerJoinButtonURL:::::::::::’, window.headerJoinButtonURL, ); event.preventDefault(); window.location.href = `${ window.headerJoinButtonURL }&referrer=${encodeURIComponent( window.location.href, )}`; console.log( ‘window.location.href::::::::join part—->’, window.location.href, ); } else if (linkText === ‘renew’) { console.log( ‘headerJoinButtonURL:::::::::::’, window.headerRenewButtonURL, ); event.preventDefault(); window.location.href = `${ window.headerRenewButtonURL }&referrer=${encodeURIComponent( window.location.href, )}`; console.log( ‘window.location.href::::::::renew part—->’, window.location.href, ); } else if (linkText === ‘login’) { event.preventDefault(); const clientId = window.clientId; const redirectUri = `${window.location.origin}`; const scope = ‘bui+bmi+ba+ami+aui+aa+si+dp+em’; const url = `${window.aarpBaseUrl}/applications/user/auth?promo=NSTYLE&response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}&scope=${scope}&state=${window.location.pathname}`; window.location.href = url; } } }); } loadAARPContent(); ]]>

{ if (!AARP.Externals.ContextHub.callbackRegistered) { ContextHub.Utils.Eventing().on( ContextHub.SegmentEngine.PageInteraction.Teaser .prototype.info.loadEvent, (event, detail) => { detail.data.forEach((teaser) => { window.performance.mark( `target_contexthub_finish [${teaser.variant.id}]`, ); }); window.performance.mark( ‘load event’, event, detail, ); }, ‘performance-mark’, false, ); AARP.Externals.ContextHub.callbackRegistered = true; window.performance.mark( ‘context-hub finish event loaded’, ); } else { window.performance.mark(‘context-hub not loaded’); } }); ]]>

You might also like