1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[67],{83037:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/new-year-report",function(){return s(20662)}])},20662:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSG:function(){return O},default:function(){return E}});var i,n,r=s(85893),l=s(67294),a=s(47041);async function o(e,t){try{let s=await fetch("https://tele2.kz"+"/apigw/v1/aux/new-year/report?msisdn=".concat(t),{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}}),i=await s.json();return i.data}catch(e){throw console.error("Failed to fetch new year report data:",e),Error("An error occurred while fetching the new year report data. Please try again later.")}}class d{static getInstance(){return d.instance||(d.instance=new d,this.slide=document.querySelector('[data-slide="slide"]'),this.active=0,this.init()),d.instance}static init(){var e,t;this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.items=null===(e=this.slide)||void 0===e?void 0:e.querySelectorAll(".slide-items > *"),this.thumb=null===(t=this.slide)||void 0===t?void 0:t.querySelector(".slide-thumbs"),this.addThumbItems(),this.activeSlide(0),this.addNavigation()}static activeSlide(e){var t,s,i,n;this.active=e||0,null===(t=this.thumbItems)||void 0===t||t.forEach(e=>e.classList.remove("active")),this.thumbItems[e].classList.add("active"),this.thumbItemsReady.forEach((e,t)=>{e?this.thumbItems[t].classList.add("ready"):this.thumbItems[t].classList.remove("ready")}),null===(s=this.items)||void 0===s||s.forEach(e=>e.classList.remove("active"));for(let t=0;t<e;t++)null===(n=this.thumbItems[t].classList)||void 0===n||n.add("ready");null===(i=this.items[e].classList)||void 0===i||i.add("active"),this.autoSlide()}static next(){this.active<this.items.length-1&&(this.thumbItemsReady[this.active]=!0,this.activeSlide(this.active+1))}static prev(){this.active>0?(this.activeSlide(this.active-1),this.thumbItemsReady[this.active]=!1):this.activeSlide(0)}static stop(){let e=document.getElementById("story");null==e||e.classList.add("pause"),clearTimeout(this.timeout)}static play(){let e=document.getElementById("story");null==e||e.classList.remove("pause"),this.autoSlide()}static addNavigation(){var e,t;let s=null===(e=this.slide)||void 0===e?void 0:e.querySelector(".slide-next"),i=null===(t=this.slide)||void 0===t?void 0:t.querySelector(".slide-prev"),n=document.getElementById("story"),r=document.getElementById("clickNext");null==r||r.addEventListener("click",this.next.bind(this)),null==s||s.addEventListener("touchend",this.next.bind(this)),null==i||i.addEventListener("touchend",this.prev.bind(this)),null==n||n.addEventListener("touchstart",this.stop.bind(this)),null==n||n.addEventListener("touchend",this.play.bind(this))}static addThumbItems(){this.items.forEach(()=>this.thumb.innerHTML+='<span class="slide-thumb-item"></span>'),this.thumbItems=Array.from(this.thumb.children),this.thumbItemsReady=Array(this.items.length).fill(!1)}static autoSlide(){clearTimeout(this.timeout),this.timeout=setTimeout(this.next.bind(this),5e3)}}function c(e){let{story:t,mock:s}=e;return(0,r.jsx)(r.Fragment,{children:t&&(0,r.jsx)("div",{className:"story",style:{backgroundImage:"url(".concat(null==t?void 0:t.background_image,")")},children:(0,r.jsxs)("div",{className:"story-block",children:[!!(null==t?void 0:t.string)&&(0,r.jsx)("div",{className:"story-title",children:(0,r.jsx)("h2",{style:{color:"white"},children:t.string})}),(0,r.jsx)("div",{className:"story-bottom",children:(0,r.jsx)("div",{className:"story-conf-info",children:(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:s.policy}})})})]})},null==t?void 0:t.code)})}d.thumbItemsReady=[],(i=n||(n={})).NO_REPORT_DATA="NO_REPORT_DATA",i.INITIAL="INITIAL",i.D_TOT_GB_seg1="D_TOT_GB_seg1",i.D_TOT_GB_seg2="D_TOT_GB_seg2",i.D_TOT_GB_seg3="D_TOT_GB_seg3",i.V_TOT_HH_seg1="V_TOT_HH_seg1",i.V_TOT_HH_seg2="V_TOT_HH_seg2",i.V_TOT_HH_seg3="V_TOT_HH_seg3",i.LT_IN_MONTH_seg1="LT_IN_MONTH_seg1",i.LT_IN_MONTH_seg2="LT_IN_MONTH_seg2",i.LT_IN_MONTH_seg3="LT_IN_MONTH_seg3",i.AVG_CALL_DUR="AVG_CALL_DUR",i.FINAL="FINAL",i.FINAL_NO_BONUS="FINAL_NO_BONUS";let u={D_TOT_GB:"D_TOT_GB",V_TOT_HH:"V_TOT_HH",ACTIVE_FOR:"LT_IN_MONTH",AVG_CALL_DUR:"AVG_CALL_DUR"};function h(e){var t,s;let{stories:i,data:n,mock:l}=e,a=i.filter(e=>{var t;return null===(t=e.code)||void 0===t?void 0:t.startsWith(u[n.key])}).find(e=>e.from<=n.value&&e.to>=n.value)||i.filter(e=>{var t;return null===(t=e.code)||void 0===t?void 0:t.startsWith(n.key)})[0];return(0,r.jsx)("div",{className:"story",style:{backgroundImage:"url(".concat(null==a?void 0:a.background_image,")")},children:(0,r.jsxs)("div",{className:"story-block",children:[!!(null==a?void 0:a.tag)&&(0,r.jsx)("div",{className:"story-report-tag",children:(0,r.jsx)("p",{children:a.tag})}),!!(null==a?void 0:a.string)&&(0,r.jsx)("div",{className:"story-report-title",children:(0,r.jsx)("h2",{style:{color:"white"},children:(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:a.string.replace("{{count}}",String(n.value))}})})}),!!(null===(t=null==a?void 0:a.string_array[0])||void 0===t?void 0:t.string)&&(0,r.jsx)("div",{className:"story-report-description",children:(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:null===(s=null==a?void 0:a.string_array[0])||void 0===s?void 0:s.string}})}),(0,r.jsx)("div",{className:"story-bottom",children:(0,r.jsx)("p",{className:"story-report-date",children:(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:l.reportDate}})})})]})})}var v=s(16568),_=s(75398),m=s(68583);async function g(e,t){try{let s=await fetch("https://tele2.kz"+"/apigw/v1/aux/new-year/gift/enable?msisdn=".concat(t),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}});if(s.ok)return s;{let e=await s.json();throw Error("Error: ".concat(s.status," - ").concat(e.message))}}catch(e){throw console.error("Failed to fetch new year report bonus:",e),Error("An error occurred while fetching the new year report bonus. Please try again later.")}}var y=s(27730);function N(e){var t,s,i,n;let{story:o,data:d,mock:c}=e,u=(0,a.getCookie)("accessToken")||"",h=(0,a.getCookie)("msisdn")||"",N=(0,a.getCookie)("activeMsisdn")||"",[T,x]=(0,l.useState)(!!(null==d?void 0:d.GOT_SERVICE_ENABLE)),[j,p]=(0,l.useState)(!1),[b,f]=v.ZP.useNotification(),I=()=>{p(!0),(0,y.S1)("56d3abd6fb0507cbd64f547efccf7d08",{userId:String(d.SUBS_ID)}),g(u,h||N).then(()=>{x(!0),p(!1),(0,y.j)("Get_Gift_Click",{responseCode:"success"},{user_id:String(d.SUBS_ID)})}).catch(()=>{p(!1),b.error({message:"",description:c.getBonusError,placement:"bottom"}),(0,y.j)("Get_Gift_Click",{responseCode:"error"})})};return(0,r.jsx)(r.Fragment,{children:!!o&&(0,r.jsxs)("div",{className:"story",style:{backgroundImage:"url(".concat(null==o?void 0:o.background_image,")")},children:[f,T&&(0,r.jsx)("div",{className:"slide-confetti",children:(0,r.jsx)(m.Z,{height:1e3,colors:["#e51e7d","#6AE28F","#5EC7FF","#FFF566"],opacity:.8,numberOfPieces:160,gravity:.03})}),(0,r.jsx)("div",{className:"story-block",children:(0,r.jsxs)("div",{className:"story-bottom",children:[!!(null==o?void 0:o.string)&&(0,r.jsx)("div",{className:"story-final-title",children:(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:o.string}})}),!!(null===(t=null==o?void 0:o.string_array[0])||void 0===t?void 0:t.string)&&(0,r.jsx)("div",{className:"story-final-description",children:(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:o.string_array[0].string}})}),(null===(s=null==o?void 0:o.string_array[1])||void 0===s?void 0:s.string)&&(0,r.jsx)("div",{className:"story-button",children:(0,r.jsx)(_.ZP,{size:"large",type:"primary",disabled:T,style:{width:"100%"},loading:j,onClick:()=>I(),children:T?null===(n=null==o?void 0:o.string_array[2])||void 0===n?void 0:n.string:null===(i=null==o?void 0:o.string_array[1])||void 0===i?void 0:i.string})})]})})]},null==o?void 0:o.code)})}function T(e){var t,s,i;let{story:n,mock:l}=e,a=()=>{let e=document.getElementById("close");e&&e.click()};return(0,r.jsx)(r.Fragment,{children:!!n&&(0,r.jsxs)("div",{className:"story",style:{backgroundImage:"url(".concat(n.background_image,")")},children:[(0,r.jsx)("div",{className:"slide-confetti",children:(0,r.jsx)(m.Z,{height:1e3,colors:["#e51e7d","#6AE28F","#5EC7FF","#FFF566"],opacity:.8,numberOfPieces:160,gravity:.03})}),(0,r.jsxs)("div",{className:"story-block",children:[!!(null==n?void 0:n.string)&&(0,r.jsx)("div",{className:"story-no-bonus-title",children:n.string}),!!(null===(t=null==n?void 0:n.string_array[0])||void 0===t?void 0:t.string)&&(0,r.jsx)("div",{className:"story-no-bonus-description",children:l.noReportDataDescription})]}),(0,r.jsx)("div",{className:"story-bottom",children:(null===(s=null==n?void 0:n.string_array[0])||void 0===s?void 0:s.string)&&(0,r.jsx)("div",{className:"story-no-bonus-button",children:(0,r.jsx)(_.ZP,{size:"large",type:"primary",style:{width:"100%"},onClick:()=>a(),children:null===(i=null==n?void 0:n.string_array[0])||void 0===i?void 0:i.string})})})]})})}function x(e){var t,s;let{story:i}=e;return(0,r.jsx)(r.Fragment,{children:!!i&&(0,r.jsxs)("div",{className:"story",style:{backgroundImage:"url(".concat(i.background_image,")")},children:[(0,r.jsx)("div",{className:"slide-confetti",children:(0,r.jsx)(m.Z,{height:1e3,colors:["#e51e7d","#6AE28F","#5EC7FF","#FFF566"],opacity:.8,numberOfPieces:160,gravity:.03})}),(0,r.jsxs)("div",{className:"story-block",children:[!!(null==i?void 0:i.string)&&(0,r.jsx)("div",{className:"story-no-bonus-title",children:i.string}),!!(null===(t=null==i?void 0:i.string_array[0])||void 0===t?void 0:t.string)&&(0,r.jsx)("div",{className:"story-no-bonus-description",children:null===(s=null==i?void 0:i.string_array[0])||void 0===s?void 0:s.string})]})]})})}function j(e){var t;let{locale:s,data:i}=e;return(0,l.useEffect)(()=>{s&&i&&d.getInstance()},[]),(0,r.jsx)("div",{className:"slide-items",children:(null==i?void 0:i.NO_REPORT_DATA)?(0,r.jsx)(T,{story:s.stories.find(e=>e.code===n.NO_REPORT_DATA),mock:s.mock}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c,{story:s.stories.find(e=>e.code===n.INITIAL),mock:s.mock}),null===(t=i.reports)||void 0===t?void 0:t.map(e=>(0,r.jsx)(l.Fragment,{children:!!e.value&&(0,r.jsx)(h,{mock:s.mock,stories:s.stories,data:e})},e.key)),i.BONUS_ACCESS?(0,r.jsx)(N,{story:s.stories.find(e=>e.code===n.FINAL),mock:s.mock,data:i}):(0,r.jsx)(x,{story:s.stories.find(e=>e.code===n.FINAL_NO_BONUS)})]})})}var p=s(25675),b=s.n(p);function f(){let e=()=>{let e=document.getElementById("close");e&&e.click()};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b(),{width:88,height:24,src:"/new/images/new-year/tele2_5g.svg",className:"slide-logo",alt:"tele2 logo"}),(0,r.jsx)("a",{id:"close",style:{display:"none"},href:"/closeNYReport",children:"close"}),(0,r.jsx)("button",{onClick:e,className:"slide-close",children:(0,r.jsx)(b(),{width:30,height:30,src:"".concat("https://tele2.kz/images/web","/new-tele2/images/close-white.svg"),alt:"close"})})]})}let I=["D_TOT_GB","V_TOT_HH","ACTIVE_FOR","AVG_CALL_DUR"];var O=!0,E=function(e){let{newYearReportLocale:t}=e,s=(0,a.getCookie)("i18next_lang")||"ru",i=(0,a.getCookie)("accessToken")||null,
1n=(0,a.getCookie)("msisdn")||null,d=(0,a.getCookie)("activeMsisdn")||"",c=t[s],[u,h]=(0,l.useState)(null);return(0,l.useEffect)(()=>{(n||d)&&i?o(i,n||d).then(e=>{null!==e&&Object.keys(e).length?h({reports:I.map(t=>({key:t,value:e[t]||0})),SUBS_ID:(null==e?void 0:e.SUBS_ID)||null,BONUS_ACCESS:(null==e?void 0:e.BONUS_ACCESS)||null,GOT_SERVICE_ENABLE:(null==e?void 0:e.GOT_SERVICE_ENABLE)||null}):h({NO_REPORT_DATA:!0})}).catch(()=>{h({NO_REPORT_DATA:!0})}):h({NO_REPORT_DATA:!0})},[n,d,i]),(0,r.jsx)("div",{id:"newYearStories",children:!!u&&(0,r.jsxs)("div",{"data-slide":"slide",className:"slide",id:"story",children:[(0,r.jsx)(f,{}),(0,r.jsx)(j,{data:u,locale:c}),(0,r.jsxs)("nav",{className:"slide-nav",children:[(0,r.jsx)("div",{className:"slide-thumbs"}),(0,r.jsx)("button",{className:"slide-prev"}),(0,r.jsx)("button",{className:"slide-next"})]})]})})}}},function(e){e.O(0,[6713,5398,5675,7730,7902,7820,9774,2888,179],function(){return e(e.s=83037)}),_N_E=e.O()}]);
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.