PageSourceSearch

https://app.smartblockisland.com/assets/MyWallet-CqIHMTbK.js

js smartblockisland.com collected 2026-10-04 06:54:58 UTC 9,640 bytes, 2 lines download raw bytes

1import{n as A,r,p as h,i as u,j as e,W as f,q as F,L as C,s as M,z as W,v as L,l as E,A as B,D as O}from"./index-CI87p2h-.js";import{T}from"./TabNavigation-CCKJX5Ui.js";import{P as R}from"./PersonalWalletCard-CALaU4BH.js";import{W as U}from"./WalletConnectRow-BHEcx3Wo.js";import"./refresh-cw-LXiivB_N.js";const D=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],I=A("Flame",D),z=a=>a.slice(0,6)+"..."+a.slice(-4),H=()=>{const[a,p]=r.useState(null),[n,b]=r.useState(null),[o,d]=r.useState(!0),[j,y]=r.useState(!1),[i,x]=r.useState(!1),[l,w]=r.useState(null),[t,c]=r.useState({address:"",label:"Tax reserve wallet",purpose:"tax_reserve",account_code:""}),m=r.useCallback(async()=>{d(!0);try{const[s,_]=await Promise.all([h(await fetch("/api/wallets/me/wallets/own-addresses",{headers:await u()})),h(await fetch("/api/wallets/me/accounting/gas",{headers:await u()}))]);p(s?.data||null),b(_?.data||null)}finally{d(!1)}},[]);r.useEffect(()=>{m()},[m]);const S=async()=>{x(!0),w(null);try{const s=await h(await fetch("/api/wallets/me/wallets/own-addresses",{method:"POST",headers:await u(),body:JSON.stringify({...t,account_code:t.account_code||void 0})}));s?.error?w(s.error):(w("Wallet registered. Moves to and from it now post as transfers."),c({address:"",label:"Payroll wallet",purpose:"payroll",account_code:""}),y(!1),await m())}finally{x(!1)}},k=async s=>{window.confirm("Remove this wallet? Future moves to it will show as exceptions.")&&(await h(await fetch("/api/wallets/me/wallets/own-addresses/"+encodeURIComponent(s),{method:"DELETE",headers:await u()})),await m())},v=a?.addresses||[],P=a?.bankAccounts||[];return e.jsxs("div",{className:"bg-white border border-card-border rounded-md p-4 md:p-6 space-y-3 mt-4",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-lg font-medium text-black flex items-center gap-2",children:[e.jsx(f,{className:"w-5 h-5 text-[#005C53]"})," Other company wallets"]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Tax reserve, payroll, savings. Money moved between your own wallets is a transfer, not income or expense, and never shows as an exception."})]}),e.jsxs("button",{onClick:()=>y(s=>!s),className:"inline-flex items-center gap-1 text-sm border border-[#005C53] text-[#005C53] px-3 py-1.5 rounded-md",children:[e.jsx(F,{className:"w-4 h-4"})," Register a wallet"]})]}),l?e.jsx("p",{className:"text-sm "+(/registered/i.test(l)?"text-green-700":"text-red-600"),children:l}):null,j?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-3 text-xs text-gray-600 rounded-lg border border-gray-200 bg-gray-50 p-3",children:[e.jsxs("label",{className:"flex flex-col gap-1 md:col-span-2",children:["Address",e.jsx("input",{value:t.address,onChange:s=>c({...t,address:s.target.value}),placeholder:"0x...",className:"border border-gray-200 rounded px-2 py-1.5 text-sm font-mono"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:["Name",e.jsx("input",{value:t.label,onChange:s=>c({...t,label:s.target.value}),className:"border border-gray-200 rounded px-2 py-1.5 text-sm"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:["Purpose",e.jsxs("select",{value:t.purpose,onChange:s=>c({...t,purpose:s.target.value}),className:"border border-gray-200 rounded px-2 py-1.5 text-sm bg-white",children:[e.jsx("option",{value:"tax_reserve",children:"Tax reserve"}),e.jsx("option",{value:"payroll",children:"Payroll"}),e.jsx("option",{value:"savings",children:"Savings"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("label",{className:"flex flex-col gap-1 md:col-span-3",children:["Bank account in the chart",e.jsxs("select",{value:t.account_code,onChange:s=>c({...t,account_code:s.target.value}),className:"border border-gray-200 rounded px-2 py-1.5 text-sm bg-white",children:[e.jsx("option",{value:"",children:"Create a new Bank account for it"}),P.map(s=>e.jsxs("option",{value:s.code,children:[s.code," ",s.name]},s.code))]})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("button",{onClick:S,disabled:i||!t.address||!t.label,className:"inline-flex items-center gap-1 text-sm bg-[#005C53] text-white px-3 py-1.5 rounded-md disabled:opacity-50",children:[i?e.jsx(C,{className:"w-3 h-3 animate-spin"}):null," Save"]})})]}):null,o&&!a?e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(C,{className:"w-3 h-3 animate-spin"})," Loading..."]}):v.length===0?e.jsx("p",{className:"text-xs text-gray-500",children:"No other wallets registered."}):e.jsx("table",{className:"w-full text-sm",children:e.jsx("tbody",{children:v.map(s=>e.jsxs("tr",{className:"border-b border-gray-50",children:[e.jsxs("td",{className:"py-1.5 pr-3 text-gray-900",children:[s.label,e.jsx("span",{className:"block text-[10px] text-gray-400",children:s.purpose})]}),e.jsx("td",{className:"py-1.5 pr-3 font-mono text-xs text-gray-600",children:z(s.address)}),e.jsx("td",{className:"py-1.5 pr-3 text-xs text-gray-600",children:s.account_code}),e.jsx("td",{className:"py-1.5 text-right",children:e.jsx("button",{onClick:()=>k(s.id),className:"text-gray-400 hover:text-red-600",children:e.jsx(M,{className:"w-4 h-4"})})})]},s.id))})}),n?e.jsxs("p",{className:"text-xs text-gray-600 flex items-center gap-1 border-t border-gray-100 pt-2",children:[e.jsx(I,{className:"w-3.5 h-3.5 text-amber-600"})," Network fees so far: ",Number(n.feeEth||0).toFixed(6)," ETH",n.feeUsd?" (~$"+Number(n.feeUsd).toFixed(2)+")":""," over ",n.txCount," transaction(s). Posted to 5320 Network / Gas Fees automatically.",n.ethUsdNow?" ETH now $"+Number(n.ethUsdNow).toFixed(0)+".":""]}):null]})},g=({label:a})=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xl font-bold text-gray-900",children:"$0.00"}),e.jsx("span",{className:"text-sm text-gray-600",children:a})]}),N=({children:a})=>e.jsx("p",{className:"text-xs text-gray-400 mt-3",children:a}),$=()=>e.jsx("div",{className:"p-6 bg-gray-50 min-h-screen",children:e.jsxs("div",{className:"max-w-6xl mx-auto grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-6",children:"Invoices"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[e.jsx(g,{label:"Unpaid"}),e.jsx(g,{label:"Last 365 days"})]}),e.jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full mb-6"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[e.jsx(g,{label:"Paid"}),e.jsx(g,{label:"Last 30 days"})]}),e.jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full"}),e.jsx(N,{children:"No invoices yet. Fills in from Stripe once payments run through SBI."})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-6",children:"Sales"}),e.jsx("div",{className:"text-3xl font-bold text-gray-900 mb-1",children:"$0.00"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Past 6 months"}),e.jsx("div",{className:"mt-6 h-32 flex items-end",children:e.jsx("div",{className:"w-full border-b border-gray-200"})}),e.jsx(N,{children:"No sales recorded yet. Fills in from the wallet ledger."})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-6",children:"Auto Distribution (%)"}),e.jsx("div",{className:"text-3xl font-bold text-gray-900 mb-1",children:"0"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Total Tokens distributed"}),e.jsx("div",{className:"mt-6 flex items-center justify-center",children:e.jsx("div",{className:"w-28 h-28 rounded-full border-[14px] border-gray-200"})}),e.jsx(N,{children:"No distributions yet. Fills in from on-chain distribution records."})]})]})}),K=()=>{const{info:a,loading:p}=W(),n=a?.reason==="no_business",[b]=L(),o=b.get("tab"),[d,j]=r.useState(o&&["allocations","wallet","setup"].includes(o)?o:"wallet"),{user:y}=E(),i=[{id:"allocations",label:"Allocations",icon:({className:l})=>
1e.jsxs("svg",{className:l,fill:"currentColor",viewBox:"0 0 20 20",children:[e.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),e.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]})},{id:"wallet",label:"My Wallet",icon:({className:l})=>e.jsx(f,{className:l})},{id:"setup",label:"Payments Setup",icon:({className:l})=>e.jsx(B,{className:l})}],x=()=>{switch(d){case"allocations":return e.jsx($,{});case"wallet":return e.jsx("div",{className:"p-6 bg-gray-50 min-h-screen",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx(U,{}),e.jsx(H,{})]})});case"setup":return e.jsx(O,{embedded:!0})}};return p&&!a?e.jsx("div",{className:"w-full min-h-screen bg-gray-50 p-6 text-sm text-gray-500",children:"Loading..."}):n?e.jsxs("div",{className:"w-full min-h-screen bg-gray-50",children:[e.jsx(T,{title:"My Wallet",tabs:[{id:"wallet",label:"My Personal Wallet",icon:({className:l})=>e.jsx(f,{className:l})}],activeTab:"wallet",onTabClick:()=>{}}),e.jsx("div",{className:"p-6",children:e.jsx("div",{className:"max-w-3xl mx-auto",children:e.jsx(R,{})})})]}):e.jsxs("div",{className:"w-full min-h-screen bg-gray-50",children:[e.jsx(T,{title:"My Business Account",tabs:i,activeTab:d,onTabClick:j}),e.jsx("div",{className:"bg-white",children:x()})]})};export{K as default};
2//# sourceMappingURL=MyWallet-CqIHMTbK.js.map

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.