(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[119],{739:(e,t,r)=>{Promise.resolve().then(r.bind(r,2180))},2180:(e,t,r)=>{"use strict";r.d(t,{MyPromocodes:()=>l});var o=r(5155);r(2115);var a=r(5279),s=r(4536),n=r(2800),d=r(8018);let l=()=>{let{promocodes:e,loading:t}=a.J.useGetPromocodes();return t?(0,o.jsx)(d.d.Loader,{}):(0,o.jsx)(d.d.MotionWrapper,{children:(0,o.jsxs)(d.d.SafeAreaView,{children:[(0,o.jsx)(d.d.Header,{showGoBack:!0,title:"My Promocodes"}),(0,o.jsx)("main",{style:{marginTop:n.A.sizes.headerHeight,paddingLeft:20,paddingRight:20,paddingBottom:20,paddingTop:20,...n.A.flex.flexColumn,gap:20,overflowY:"auto"},children:null==e?void 0:e.map(e=>(0,o.jsx)(s.l.PromocodeItem,{promocode:e},e.id))})]})})}},5279:(e,t,r)=>{"use strict";r.d(t,{J:()=>d});var o=r(5125),a=r(2115);let s="https://george-fx.github.io/yummer-api/",n={GET_OFFERS:"".concat(s,"offers.json"),GET_DISHES:"".concat(s,"dishes.json"),GET_PROMOCODES:"".concat(s,"promocodes.json")},d={useGetDish:e=>{let[t,r]=(0,a.useState)(null),[s,d]=(0,a.useState)(!0),l=async()=>{d(!0);try{var t;let a=await o.A.get(n.GET_DISHES),s=(null!=(t=a.data.dishes)?t:a.data).find(t=>t.id===e);return r(s||null),d(!1),s}catch(e){throw d(!1),console.error("Error fetching dishes:",e),e}};return(0,a.useEffect)(()=>{l()},[e]),{dish:t,isLoading:s}},useFormField:e=>{let[t,r]=(0,a.useState)(e);return{form:t,setForm:r,handleChangeField:(e,o)=>{let a=window.prompt("Enter your ".concat(o),t[e]);null!==a&&r(t=>({...t,[e]:a}))}}},useGetDishes:()=>{let[e,t]=(0,a.useState)([]),[r,s]=(0,a.useState)(!0),d=async()=>{s(!0);try{let e=await o.A.get(n.GET_DISHES);if(!e.data)throw Error("No data in response");let r=e.data.dishes||e.data||[];t(r)}catch(e){throw console.error("API request failed:",e),e}finally{s(!1)}};return(0,a.useEffect)(()=>{d()},[]),{dishes:e,loading:r}},useBodyColor:e=>{(0,a.useEffect)(()=>{let t=document.body.style.backgroundColor;return document.body.style.backgroundColor=e,()=>{document.body.style.backgroundColor=t}},[e])},useGetOffers:()=>{let[e,t]=(0,a.useState)([]),[r,s]=(0,a.useState)(!0),d=async()=>{s(!0);try{let e=await o.A.get(n.GET_OFFERS);if(!e.data)throw Error("No data in response");let r=e.data.offers||e.data||[];t(r)}catch(e){throw console.error("API request failed:",e),e}finally{s(!1)}};return(0,a.useEffect)(()=>{d()},[]),{offers:e,loading:r}},useThemeColor:e=>{(0,a.useEffect)(()=>{let t=document.querySelector('meta[name="theme-color"]');t||((t=document.createElement("meta")).setAttribute("name","theme-color"),document.head.appendChild(t));let r=t.getAttribute("content");return t.setAttribute("content",e),()=>{r&&t.setAttribute("content",r)}},[e])},useGetPromocodes:()=>{let[e,t]=(0,a.useState)([]),[r,s]=(0,a.useState)(!0),d=async()=>{s(!0);try{let e=await o.A.get(n.GET_PROMOCODES);if(!e.data)throw Error("No data in response");let r=e.data.promocodes||e.data||[];t(r)}catch(e){throw console.error("API request failed:",e),e}finally{s(!1)}};return(0,a.useEffect)(()=>{d()},[]),{promocodes:e,loading:r}}}}},e=>{e.O(0,[171,385,125,406,18,155,441,315,358],()=>e(e.s=739)),_N_E=e.O()}]);