1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4871],{25493:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/open-box",function(){return t(13793)}])},30605:function(e,n,t){"use strict";var o=t(85893),a=t(67294),i=t(57891);t(88178);let s=(0,a.forwardRef)((e,n)=>{let{children:t,id:a="button-primary",type:s="button",className:r="",leftIcon:c,rightIcon:l,variants:u,...p}=e;return(0,o.jsxs)(i.m.button,{whileTap:{scale:.95},whileHover:{filter:"brightness(110%)"},...p,ref:n,id:a,variants:u,initial:"start",animate:"animate",exit:"exit",type:s,className:"btn__primary-default ".concat(r),children:[c&&(0,o.jsx)("img",{src:c,alt:"btn-icon"}),t,l&&(0,o.jsx)("img",{src:l,alt:"btn-icon"})]})});n.Z=s},13793:function(e,n,t){"use strict";t.r(n);var o=t(85893),a=t(9008),i=t.n(a),s=t(89755),r=t.n(s),c=t(11163),l=t(67294),u=t(86501),p=t(9473),d=t(43290),x=t(13770),f=t(30605);let _={NORMAL:{close:"/images/open-box/fliper/normal.png",loading:"/images/open-box/fliper/normal-loading.png",open:"/images/open-box/fliper/normal-opened.png"},LANGKA:{close:"/images/open-box/fliper/rare.png",loading:"/images/open-box/fliper/rare-loading.png",open:"/images/open-box/fliper/rare-opened.png"},"SUPER LANGKA":{close:"/images/open-box/fliper/super.png",loading:"/images/open-box/fliper/super-loading.png",open:"/images/open-box/fliper/super-opened.png"}};n.default=()=>{let e=(0,c.useRouter)(),n=(0,p.I0)(),{isLogin:t}=(0,p.v9)(e=>e.authStore),{box:a}=(0,p.v9)(e=>e.raffleStore),[s,m]=(0,l.useState)(!1),[g,h]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),[w,j]=(0,l.useState)(),[v,N]=(0,l.useState)(!1);(0,l.useEffect)(()=>(t&&a||e.push("/"),()=>n((0,x.RS)())),[]);let handleOpen=async()=>{if(!w&&a.qty>0){m(!0);try{let e=await (0,d.z)(a.grade);j(e.data),setTimeout(()=>{h(!0)},1e3),setTimeout(()=>{m(!1),N(!0),n((0,x.dl)({...a,qty:a.qty-1}))},2e3),setTimeout(()=>{b(!0)},4e3)}catch(e){m(!1),u.ZP.error(e.message||"Failed open box")}}};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i(),{children:(0,o.jsx)("title",{children:"Open Box"})}),(0,o.jsx)("section",{className:"open-box",children:a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"open-box__prize ".concat(v&&w?"show":""," ").concat(y?"scale":""),children:(0,o.jsx)("div",{className:"open-box__prize__stickers",children:w?(0,o.jsxs)("div",{className:"open-box__prize__stickers__item",children:[(0,o.jsx)(r(),{src:w.imageUrl,width:366,height:366,layout:"fixed"}),w.isLocked?(0,o.jsx)("div",{className:"exclusive"}):""]},w.id):void 0})}),(0,o.jsxs)("div",{className:"open-box__item ".concat(v?"finish":""),children:[(0,o.jsxs)("div",{className:"open-box__item__box ".concat(s?"open":""),onClick:handleOpen,children:[(0,o.jsx)("div",{className:"open-box__item__box__front",children:(0,o.jsx)(r(),{src:g?_[a.grade].open:_[a.grade].close,width:222,height:328,layout:"fixed"})}),(0,o.jsx)("div",{className:"open-box__item__box__back",children:(0,o.jsx)(r(),{src:_[a.grade].loading,width:222,height:328,layout:"fixed"})})]}),v||s?(0,o.jsx)("span",{className:"open-box__item__qty",children:"\xa0"}):(0,o.jsxs)("span",{className:"open-box__item__qty",children:["x ",a.qty]}),(0,o.jsx)("div",{className:"open-box__item__background ".concat(v?"finish":"")})]}),(0,o.jsxs)("div",{className:"open-box__tap-button ".concat(s||v?"hide":""),children:[(0,o.jsx)("p",{className:"open-box__tap-button__label",children:"Klik"}),(0,o.jsx)(r(),{src:"/images/open-box/arrow.svg",width:32,height:32,layout:"fixed"})]}),(0,o.jsxs)("div",{className:"open-box__collection-button ".concat(v?"show":""),onClick:()=>e.push("/my-collection"),children:["Cek My Collection"," ",(0,o.jsx)(r(),{src:"/images/open-box/arrow-right.svg",width:16,height:16,layout:"fixed"})]}),v&&a.qty>0?(0,o.jsx)("div",{className:"open-box__button",children:(0,o.jsx)(f.Z,{onClick:()=>{m(!1),j(void 0),N(!1),h(!1),b(!1)},children:"Buka Lagi"})}):void 0]})})]})}},13770:function(e,n,t){"use strict";t.d(n,{RS:function(){return removeBox},Vw:function(){return getMyPrizes},cV:function(){return toggleRaffleModal},dl:function(){return openBox},w_:function(){return getRaffleCoupons}});var o=t(86501),a=t(37950);function getRaffleCoupons(e){return async n=>{n({type:"GET_COUPONS"});try{let t=await (0,a.D7)(e);n({type:"SUCCESS_COUPONS",payload:{myCoupons:t.meta.total||0,history:t.data}})}catch(e){o.ZP.error(e.message||"Failed to get coupons",{})}}}function getMyPrizes(e){return async n=>{n({type:"GET_PRIZES"});try{let t=await (0,a.tX)(e);n({type:"SUCCESS_PRIZES",payload:{myPrizes:t.data}})}catch(e){o.ZP.error(e.message||"Failed to get prizes",{})}}}function openBox(e){return async n=>{n({type:"OPEN_BOX",payload:{box:e}})}}function removeBox(){return async e=>{e({type:"REMOVE_BOX"})}}function toggleRaffleModal(){return async e=>{e({type:"TOGGLE_RAFFLE_MODAL"})}}},43290:function(e,n,t){"use strict";t.d(n,{r:function(){return GetCollection},z:function(){return PutOpenMysteryBox}});var o=t(8759),a=t(44777);async function GetCollection(e,n){let t=new URLSearchParams({page:e,size:n}),i=await (0,a.Z)("GET","".concat(o.bl,"/collections?").concat(t));return i}async function PutOpenMysteryBox(e){let n=await (0,a.Z)("PUT","".concat(o.bl,"/collections/open-mystery-boxes"),{grade:e});return n}},37950:function(e,n,t){"use strict";t.d(n,{D7:function(){return GetRaffleCoupons},DL:function(){return PostClaimCoupon},tX:function(){return GetMyPrizes}});var o=t(8759),a=t(44777);async function GetRaffleCoupons(e){let n=new URLSearchParams({eventId:e}),t=await (0,a.Z)("GET","".concat(o.bl,"/raffle-coupons/mine?").concat(n));return t}async function GetMyPrizes(e){let n=new URLSearchParams({eventId:e}),t=await (0,a.Z)("GET","".concat(o.bl,"/raffle-prizes/mine?").concat(n));return t}async function PostClaimCoupon(){let e=await (0,a.Z)("POST","".concat(o.bl,"/raffle-coupons/claim"));return e}},9008:function(e,n,t){e.exports=t(79201)}},function(e){e.O(0,[9755,9774,2888,179],function(){return e(e.s=25493)}),_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.