1"use strict";(globalThis.webpackChunk_telia_company_tv_web_logged_in=globalThis.webpackChunk_telia_company_tv_web_logged_in||[]).push([[136],{"./src/page/views/HomepageView.tsx"(e,t,o){o.r(t),o.d(t,{default:()=>T});var n=o("./src/auth/providers/AuthProvider.tsx"),s=o("./src/core/router/components/ChildSafeRoute.tsx"),a=o("./src/profiles/guards/NoProfileGuard.tsx"),r=o("./src/shared/components/ui/Modal/index.ts"),c=o("./src/profiles/providers/UserProvider/UserProvider.tsx"),i=o("../../../node_modules/.pnpm/@[email protected]/node_modules/@telia-company/tv.common-sdk/dist/DataManager.js"),d=o("../../../node_modules/.pnpm/@[email protected]/node_modules/@telia-company/tv.common-sdk/dist/ServiceConfig.js"),l=o("../../libs/error-monitoring/dist/index.mjs");const m="targetedAdsConsent",p=e=>d.ServiceConfig.getService("engagementgateway").getUrl(e),u=async({type:e})=>{try{const t=i.DataManager.instance(),o=p(`/rest/secure/v1/consent/${e}/latest`);return await t.sendGet(o,m,{secure:!0})}catch(t){throw(0,l.vV)(new Error(`Failed to get latest consent for type: ${e}`,{cause:t}),{context:"ConsentAPI"}),t}};const _="telia_targeted_ads_consent",g=(e,t)=>{const o={firstCheckConsent:e.firstCheckConsent,latestConsent:e.latestConsent,response:void 0!==t?t?"APPROVED":"DECLINED":null,timestamp:Date.now(),version:"1.0"};try{localStorage.setItem(_,JSON.stringify(o))}catch(e){(0,l.vV)(new Error("Failed to save consent to localStorage",{cause:e}),{context:"ConsentStorage"})}},y=()=>{try{localStorage.removeItem(_)}catch(e){(0,l.vV)(new Error("Failed to clear consent from localStorage",{cause:e}),{context:"ConsentStorage"})}};var v=o("../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@telia-company/tv.common-sdk-authentication/dist/Authentication.js"),h=o("../../../node_modules/.pnpm/[email protected]/node_modules/react/index.js");const C=()=>{const[e,t]=(0,h.useState)(!1),{isChildProfile:o}=(0,c.u)(),n=(0,h.useCallback)(e=>{if(e.latestConsent)return!1;if(!e.firstCheckConsent)return!1;const t=new Date(e.firstCheckConsent.dateTime).getTime()+6048e5;return Date.now()>=t},[]),s=(0,h.useCallback)(async()=>{if(!o)try{const e=await u({type:"PERSONAL_VIDEO_ADS"});if(e.latestConsent){const o=e.latestConsent.approved;g(e,o),t(!1)}else{const o=n(e);g(e),t(o)}}catch(e){(0,l.vV)(new Error("Failed to sync consent from backend",{cause:e}),{context:"useTargetedAdsConsent"})}},[o,n]),a=(0,h.useCallback)(async(e,o)=>{try{await(async({payload:e})=>{try{const t=i.DataManager.instance(),o=p("/rest/secure/v1/consent");await t.sendPost(o,m,{post:e,postAsJson:!0,secure:!0})}catch(t){throw(0,l.vV)(new Error(`Failed to create consent for type: ${e.type}`,{cause:t}),{context:"ConsentAPI"}),t}})({payload:{approved:e,informationProvided:o,method:"IN_APP_UI",type:"PERSONAL_VIDEO_ADS"}});const n=await u({type:"PERSONAL_VIDEO_ADS"});g(n,e),t(!1)}catch(t){throw(0,l.vV)(new Error(`Failed to submit consent (approved: ${e})`,{cause:t}),{context:"useTargetedAdsConsent"}),t}},[]),r=(0,h.useCallback)(e=>a(!0,e),[a]),d=(0,h.useCallback)(e=>a(!1,e),[a]);return(0,h.useEffect)(()=>{let e=!0;const o=v.Authentication.statics.events.authentication.on(async({loggedin:o})=>{e&&(o?(y(),await s()):t(!1))});return v.Authentication.instance().isLoggedin().then(t=>{e&&t&&(y(),s())}),()=>{e=!1,v.Authentication.statics.events.authentication.off(o)}},[s]),{onAccept:r,onDecline:d,shouldShowModal:e}};var f=o("../../../node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/react-i18next/dist/es/index.js"),w=o("../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_support_a0dcb4b0ae680db98626d6fd11a2b9d9/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js"),A=o("../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_f734d82c55a697af95f95e7d1443e8d9/node_modules/@telia-company/tv.one-design-system-web/lib/index.js");
1const b=(0,w.A)("h2",{target:"ezdqtjn1"})(A.ue.typography.headingSecondary,";color:",A.ue.color.text.primary,";margin-bottom:16px;"),P=(0,w.A)("div",{target:"ezdqtjn0"})(A.ue.typography.textPrimary,";color:",A.ue.color.text.primary,";line-height:1.5;margin:0;");var E=o("../../../node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");const D=()=>{const{t:e}=(0,f.Bd)(),{onAccept:t,onDecline:o,shouldShowModal:n}=C();if(!n)return null;const s=e("TARGETED_ADS_POPUP_TITLE"),a=e("TARGETED_ADS_POPUP_TEXT"),c=`${s} - ${a}`;return(0,E.FD)(r.aF,{actions:[{label:e("TARGETED_ADS_DISAGREE"),onClick:()=>{o(c)},variant:"secondary"},{label:e("TARGETED_ADS_AGREE"),onClick:()=>{t(c)},variant:"secondary"}],actionsPlacement:"flex-end",closeOnClickOutside:!1,dismissable:!1,onHide:()=>{},overlayEventTrackingData:{overlay_title:"Targeted Ads Consent"},visible:n,children:[(0,E.Y)(b,{children:s}),(0,E.Y)(P,{children:a})]})};var x=o("../../../node_modules/.pnpm/@[email protected]/node_modules/@telia-company/tv.common-sdk/dist/Config.js"),k=o("./src/page/views/PageView/components/PagePanels/PagePanels.tsx"),S=o("./src/page/views/PageView/PageView.tsx");const T=()=>{const{isLoggedIn:e}=(0,n.Z)();return e?(0,E.Y)(a.A,{children:(0,E.FD)(s.N,{children:[(0,E.Y)(S.default,{pageId:x.Config.get("page/home/id")}),x.Config.get("app/targetedAds/consentModal/enabled")&&(0,E.Y)(D,{})]})}):(0,E.Y)(k.j,{navbarOverrideProps:{addOffsetTop:!0,showMenuItems:!1},pageId:"logged-out"})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.