"use strict";(()=>{var e={};e.id=2185,e.ids=[2185],e.modules={72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},1942:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>v,patchFetch:()=>y,requestAsyncStorage:()=>x,routeModule:()=>m,serverHooks:()=>b,staticGenerationAsyncStorage:()=>h});var a={};s.r(a),s.d(a,{GET:()=>l,POST:()=>g});var n=s(49303),o=s(88716),r=s(60670),u=s(87070),i=s(19191),c=s(70446),d=s(90455),p=s(56089);async function l(e){let t=await (0,c.Gg)(),s=(0,d.LP)(t)||(0,d.I2)(),a=t.user?.id??"",n=e.nextUrl.searchParams.get("tabId")||"1";try{let e=(await (0,i.q)(`/customers/v1/${a}/active_bonus_screen?tabId=${n}&cityId=${t.cityId||1}&businessTypeId=1&latitude=${t.storageLatitude||0}&longitude=${t.storageLongitude||0}&limit=20&offset=-1`,{apiBase:"mobile",token:s,langCode:t.langCode||"al",cache:"no-store"})).data,o=(e?.businesses??e?.restaurants??[]).map(p.wT);return u.NextResponse.json({success:!0,tabs:e?.tabs??e?.tabList??[],data:o})}catch(e){return console.error("[discount] GET error:",e),u.NextResponse.json({success:!1,tabs:[],data:[]})}}async function g(e){let t=await (0,c.Gg)(),s=(0,d.LP)(t)||(0,d.I2)(),a=await e.json(),n=t.user?.id??"",o=t.user?.phone??"";try{let e=await (0,i.q)("/customers/v1/discounts/coupons",{apiBase:"mobile",method:"POST",token:s,langCode:t.langCode||"al",body:{couponCode:a.couponCode,restaurant:{restaurantID:a.restaurantId},customer:{id:n,phone:o}},cache:"no-store"});if(e.statusMessage?.status===200||e.statusMessage?.success)return u.NextResponse.json({success:!0,data:e.data});return u.NextResponse.json({success:!1,message:e.statusMessage?.message||"Kuponi nuk eshte i vlefshme."})}catch{return u.NextResponse.json({success:!1,message:"Kuponi nuk eshte i vlefshme."},{status:400})}}let m=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/discount/route",pathname:"/api/discount",filename:"route",bundlePath:"app/api/discount/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/discount/route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:x,staticGenerationAsyncStorage:h,serverHooks:b}=m,v="/api/discount/route";function y(){return(0,r.patchFetch)({serverHooks:b,staticGenerationAsyncStorage:h})}}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[8948,3314,8632,5972,5476],()=>s(1942));module.exports=a})();