1import{r as i,b as B,c as P,j as e}from"./vendor-react-Dxo5VVMX.js";import{d as E,c as L,b as $}from"./vendor-firebase-firestore-BI8UjDC3.js";import{b as R,c as T}from"./firebase-BVnSfmn9.js";import{H as Y,A as U}from"./index-6F7UmCCt.js";import{N as w}from"./NavBar-DlpVal7E.js";import b from"./Footer-6unK-xz7.js";import{mixpanel as p}from"./mixpanel-BhrQiLh9.js";import{C}from"./credit-card-Dkq02ukL.js";import{U as M}from"./user-BqwTk-sH.js";import{C as k}from"./calendar-BuxqqRh-.js";import{S as Z}from"./star-CALyqH9L.js";import"./vendor-analytics-BolNmaul.js";import"./vendor-firebase-core-Bea8MryS.js";import"./vendor-firebase-extras-Butzwarm.js";import"./firebaseCore-DdWO-lul.js";import"./vendor-query-BGDNI3Fe.js";const oe=()=>{const[A,f]=i.useState(!0),[l,D]=i.useState([]),[I,y]=i.useState(""),[m,j]=i.useState(""),h=B(),{city:u}=P(),a=u==null?void 0:u.trim(),n=R.currentUser;i.useEffect(()=>{p.track("Page Viewed",{Page:"YourVouchers",Path:window.location.pathname,UserID:(n==null?void 0:n.uid)||"Not Logged In"})},[n]),i.useEffect(()=>{if(!n){h("/profile");return}(async()=>{f(!0),y(""),j("");try{console.log("Fetching vouchers for user:",n.uid);const t=E(T,"users",n.uid),d=L(t,"vouchers"),c=await $(d);if(console.log("Vouchers snapshot empty:",c.empty),console.log("Number of vouchers found:",c.docs.length),c.empty)y("No vouchers available"),p.track("No Vouchers Found",{Page:"YourVouchers",UserID:n.uid,Path:window.location.pathname});else{const g=c.docs.map(v=>{const N=v.data();return console.log("Raw voucher data:",N),{id:v.id,...N}});console.log("Processed voucher data:",g),D(g),p.track("Voucher Fetch Succeeded",{Page:"YourVouchers",UserID:n.uid,VoucherCount:g.length,Path:window.location.pathname})}}catch(t){console.error("Error fetching vouchers:",t),j("Failed to fetch vouchers: "+t.message),p.track("Voucher Fetch Failed",{Page:"YourVouchers",UserID:n.uid,Error:t.message,Path:window.location.pathname})}finally{f(!1)}})()},[n,h]);const x=r=>{if(console.log("Formatting date:",r),!r)return"N/A";try{if(r&&typeof r=="object"&&r.seconds)return new Date(r.seconds*1e3).toLocaleDateString("en-GB");if(r instanceof Date)return r.toLocaleDateString("en-GB");if(typeof r=="string"||typeof r=="number"){const t=new Date(r);if(!isNaN(t.getTime()))return t.toLocaleDateString("en-GB")}return"Invalid Date"}catch(t){return console.error("Error formatting date:",r,t),"Invalid Date"}},V=r=>{if(!r)return!0;try{let t;return r&&typeof r=="object"&&r.seconds?t=new Date(r.seconds*1e3):r instanceof Date?t=r:t=new Date(r),t<ne
1w Date}catch(t){return console.error("Error checking expiry:",t),!0}},z=()=>{h("/profile")},s={appColor:"#a855f7",darkText:"#212121",lightBackground:"#ffffff",cardBackground:"#f9f9f9",cardBorder:"#e0e0e0"},o=(a==null?void 0:a.charAt(0).toUpperCase())+(a==null?void 0:a.slice(1).toLowerCase()),S={"@context":"https://schema.org","@type":["TravelAgency","LocalBusiness","Organization","Car","AutomotiveBusiness","AutoDealer","AutoRental"],name:a?`Zymo - Self Drive Car Rentals in ${o}`:"Zymo - Self Drive Car Rentals in India",image:"https://zymo.app/images/AppLogo/zymo-logo.png","@id":a?`https://zymo.app/self-drive-car-rental-in-${a.toLowerCase()}`:"https://zymo.app/",url:a?`https://zymo.app/self-drive-car-rental-in-${a.toLowerCase()}`:"https://zymo.app/",serviceType:"Self Drive Car Rental",address:{"@type":"PostalAddress",streetAddress:"I/2002 Marina Enclave, Jankalyan Nagar, Malad West",addressLocality:"Mumbai",addressRegion:"MH",postalCode:"400095",addressCountry:"IN"},areaServed:{"@type":"City",name:a?o:"India",address:{"@type":"PostalAddress",addressLocality:a?o:"India",addressRegion:a?"STATE_NAME":"India",addressCountry:"India"}},priceRange:"â¹45-â¹499",sameAs:["https://play.google.com/store/apps/details?id=com.letzrent.letzrentnew","https://apps.apple.com/in/app/zymo-self-drive-car-rental/id1547829759","https://www.facebook.com/zymo.official/","https://www.instagram.com/zymo.app/","https://www.linkedin.com/company/zymoapp"],potentialAction:{"@type":"Action",name:a?`Book Self Drive Car in ${o}`:"Book Self Drive Car in India",target:{"@type":"EntryPoint",urlTemplate:a?`https://zymo.app/self-drive-car-rental-in-${a.toLowerCase()}`:"https://zymo.app/",inLanguage:"en",actionPlatform:["http://schema.org/DesktopWebPlatform","http://schema.org/MobileWebPlatform","http://schema.org/AndroidPlatform","http://schema.org/IOSPlatform"]}},aggregateRating:{"@type":"AggregateRating",ratingValue:"4.5",reviewCount:"8100"},mainEntity:[{"@type":"Question",name:`Which is the cheapest self-drive car rental in ${o||"India"}
1?`,acceptedAnswer:{"@type":"Answer",text:`Zymo offers affordable self-drive car rentals in ${o||"India"} with hourly, daily, and monthly plans â all with transparent pricing and no hidden charges.`}},{"@type":"Question",name:`Does Zymo provide airport pickup in ${o||"India"}?`,acceptedAnswer:{"@type":"Answer",text:`Yes, Zymo provides convenient airport pickup and doorstep delivery across ${o||"India"}.`}},{"@type":"Question",name:`What are the most popular cars available for rent in ${o||"India"}?`,acceptedAnswer:{"@type":"Answer",text:`The most popular self-drive cars in ${o||"India"} include Swift, Baleno, Creta, and XUV500.`}},{"@type":"Question",name:`Can I rent a car in ${o||"India"} without a deposit?`,acceptedAnswer:{"@type":"Answer",text:`Yes, Zymo offers zero-deposit car rental options in ${o||"India"}, making it easier and faster to book.`}}]};return A?e.jsxs(e.Fragment,{children:[e.jsx(w,{}),e.jsx("div",{className:"min-h-screen p-4",style:{backgroundColor:s.lightBackground},children:e.jsx("div",{className:"flex items-center justify-center min-h-96",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 mx-auto mb-4",style:{borderColor:s.darkText}}),e.jsx("p",{style:{color:s.darkText},children:"Loading your vouchers..."})]})})}),e.jsx(b,{})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx("title",{children:"Your Vouchers | Zymo"}),e.jsx("meta",{name:"description",content:"View and manage your Zymo vouchers. Check validity, status, and details of your active and expired vouchers."}),e.jsx("link",{rel:"canonical",href:"https://zymo.app/profile/vouchers"}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(S)})]}),e.jsx(w,{}),e.jsxs("div",{className:"min-h-screen p-4",style:{backgroundColor:s.lightBackgroun
1d},children:[e.jsxs("button",{onClick:z,className:"m-5 cursor-pointer flex items-center gap-2 hover:scale-105 transition-transform",style:{color:s.darkText},children:[e.jsx(U,{className:"w-6 h-6"}),e.jsx("span",{className:"text-lg font-semibold",children:"Back to Profile"})]}),e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-bold mb-8 text-center",style:{color:s.darkText},children:"Your Vouchers"}),m&&e.jsx("div",{className:"text-red-600 text-center mb-6 p-4 bg-red-50 border border-red-200 rounded-lg",children:m}),!m&&l.length===0&&e.jsxs("div",{className:"text-center p-8 rounded-lg border",style:{backgroundColor:s.cardBackground,borderColor:s.cardBorder},children:[e.jsx("div",{className:"mb-4",children:e.jsx(C,{size:64,className:"mx-auto mb-4",style:{color:s.appColor}})}),e.jsx("p",{className:"text-xl mb-2",style:{color:s.darkText},children:I||"No vouchers available"}),e.jsx("p",{className:"text-gray-600",children:"Your vouchers will appear here once they are added."})]}),l.length>0&&e.jsx("div",{className:"mb-6 text-center",children:e.jsxs("p",{style:{color:s.darkText},className:"text-lg",children:["You have ",l.length," voucher",l.length!==1?"s":""]})}),e.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:l.map((r,t)=>{const d=V(r.validTill),c=d?"Expired":r.status||"Active";return console.log(`Voucher ${t}:`,r),e.jsxs("div",{className:`rounded-lg p-6 shadow-lg border-2 transition-transform hover:scale-105 ${d?"opacity-75":""}`,style:{backgroundColor:s.cardBackground,borderColor:d?s.cardBorder:s.appColor},children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{style:{color:s.appColor}}),e.jsxs("span",{className:"text-3xl font-bold",style:{color:s.darkText},children:["â¹",r.amount||"N/A"]})]}),e.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-semibold ${c==="Active"?"bg-purple-500 text-white":c==="Expired"?"bg-gray-500 text-white":"bg-red-500 text-white"}`,children:c})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{size:18,style:{color:s.appColor}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-sm",children:"User"}),e.jsx("p",{className:"text-gray-800",children:r.userName||"N/A"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{size:18,style:{color:s.appColor}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-sm",children:"Valid From"}),e.jsx("p",{className:"text-gray-800",children:x(r.validFrom)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{size:18,style:{color:s.appColor}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-sm",children:"Valid Till"}),e.jsx("p",{className:"text-gray-800",children:x(r.validTill)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{size:18,style:{color:s.appColor}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-sm",children:"Voucher ID"}),e.jsx("p",{className:"text-gray-800 font-mono text-xs break-all",children:r.id||"N/A"})]})]}),r.createdAt&&e.jsx("div",{className:"pt-2 border-t border-gray-300",children:e.jsxs("p",{className:"text-gray-500 text-xs",children:["Created: ",x(r.createdAt)]})})]})]},r.id||t)})})]})]}),e.jsx(b,{})]})};export{oe as default};
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.