1import{d as C,b as W,c as A,w as D,o as F,g as l,h as e,i as o,as as y,F as c,A as w,j as m,t as i,k as x,p as f,r as _,f as a,_ as L,l as p,q as g,B as V,ae as M,a8 as z}from"./CYqbzUre.js";import{_ as E}from"./CLwQwBEX.js";import{u as H}from"./VAqPE0Bx.js";import{j as I}from"./B7t9klYu.js";const O={class:"bg-cream min-h-screen"},U={class:"max-w-4xl mx-auto px-6 py-10 space-y-8"},P={key:0,class:"space-y-4"},Y={key:1,class:"flex flex-col items-center justify-center py-20 text-center"},$={class:"w-20 h-20 bg-neutral-100 rounded-full flex items-center justify-center mb-6"},q={class:"bg-white rounded-2xl border border-neutral-100 shadow-sm p-6"},G={class:"font-display text-4xl font-bold text-neutral-900 mb-4"},R={class:"flex items-center gap-3"},S={key:0,class:"flex flex-col items-center justify-center py-12 text-center bg-white rounded-2xl border border-neutral-100 shadow-sm"},J={key:1,class:"space-y-3"},K={class:"flex items-start justify-between gap-4"},Q={class:"min-w-0"},X={class:"text-xs text-neutral-400 mb-1"},Z={class:"text-sm text-neutral-700 truncate"},ee={class:"flex flex-col items-end shrink-0 gap-1"},le=C({__name:"wallet",setup(te){const k=W(),{isAuthenticated:v}=A(),{safeGetMyWalletWithHistory:N}=H(),r=_(null),d=_([]),u=_(!1);D(v,n=>{n||z("/")},{immediate:!0});async function T(){u.value=!0;const n=await N();if(u.value=!1,n.success){const t=n.data.customer_wallet_with_usage_history;r.value=t.customer_wallet??null,d.value=t.customer_wallet_usage_history??[]}else n.error.code!=="WALLET_NOT_FOUND"&&k.add({title:"Error",description:"Failed to load your wallet. Please try again.",color:"error"}),r.value=null,d.value=[]}F(()=>{v.value&&T()});function j(n){return I(n)??n}return(n,t)=>{const b=L,h=E,B=M;return a(),l("div",O,[t[8]||(t[8]=e("div",{class:"bg-white border-b border-neutral-200"},[e("div",{class:"max-w-4xl mx-auto px-6 py-8"},[e("h1",{class:"font-display text-3xl font-semibold text-neutral-900 mb-2"},"My Wallet"),e("p",{class:"text-neutral-600"},"Your balance and transaction history")])],-1)),e("div",U,[o(u)?(a(),l("div",P,[t[1]||(t[1]=y('<div class="bg-white rounded-2xl border border-neutral-100 shadow-sm p-6 animate-pulse"><div class="h-4 bg-neutral-200 rounded w-24 mb-4"></div><div class="h-10 bg-neutral-200 rounded w-36 mb-4"></div><div class="h-6 bg-neutral-200 rounded-full w-20"></div></div><div class="h-5 bg-neutral-200 rounded w-48 animate-pulse"></div>',2)),(a(),l(c,null,w(3,s=>e("div",{key:s,class:"bg-white rounded-2xl border border-neutral-100 shadow-sm p-4 animate-pulse"},[...t[0]||(t[0]=[y('<div class="flex items-center justify-between"><div class="space-y-2"><div class="h-4 bg-neutral-200 rounded w-32"></div><div class="h-3 bg-neutral-200 rounded w-48"></div></div><div class="h-5 bg-neutral-200 rounded w-20"></div></div>',1)])])),64))])):!o(u)&&!o(r)?(a(),l("div",Y,[e("div",$,[m(b,{name:"i-heroicons-wallet",class:"w-10 h-10 text-neutral-400"})]),t[2]||(t[2]=e("h2",{class:"font-display text-xl font-bold text-neutral-700 mb-2"},"No wallet found",-1)),t[3]||(t[3]=e("p",{class:"text-neutral-500"},"You don't have a wallet yet. Contact support to get one set up.",-1))])):o(r)?(a(),l(c,{key:2},[e("div",q,[t[4]||(t[4]=e("p",{class:"text-sm text-neutral-500 mb-2"},"Current Balance",-1)),e("p",G," â¬"+i((o(r).amount??0).toFixed(2)),1),e("div",R,[m(h,{color:o(r).is_active?"success":"error",variant:"subtle",size:"md"},{default:x(()=>[p(i(o(r).is_active?"Active":"Inactive"),1)]),_:1},8,["color"])])]),e("div",null,[t[7]||(t[7]=e("h2",{class:"font-display text-xl font-semibold text-neutral-900 mb-4"},"Transaction History",-1)),!o(d)||o(d).length===0?(a(),l("div",S,[m(b,{name:"i-heroicons-document-text",class:"w-10 h-10 text-neutral-300 mb-3"}),t[5]||(t[5]=e("p",{class:"text-neutral-500"},"No transactions yet.",-1))])):(a(),l("div",J,[(a(!0),l(c,null,w(o(d),s=>(a(),l("div",{key:s.id,class:"bg-white rounded-2xl border border-neutral-100 shadow-sm p-4"},[e("div",K,[e("div",Q,[e("p",X,i(j(s.transaction_timestamp)),1),e("p",Z,i(s.note||"Transaction"),1),s.order_id?(a(),g(B,{key:0,to:"/orders",class:"text-xs text-primary-600 hover:underline mt-0.5 inline-block"},{default:x(()=>[p(" Order #"+i(s.order_id),1)]),_:2},1024)):f("",!0)]),e("div",ee,[e("span",{class:V(["font-semibold text-sm",(s.amount??0)>=0?"text-green-600":"text-red-600"])},i((s.amount??0)>=0?"+":"")+"â¬"+i(Math.abs(s.amount??0).toFixed(2)),3),s.is_refunded?(a(),g(h,{key:0,color:"warning",variant:"subtle",size:"xs"},{default:x(()=>[...t[6]||(t[6]=[p(" Refunded ",-1)])]),_:1})):f("",!0)])])]))),128))]))])],64)):f("",!0)])])}}});
1export{le 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.