PageSourceSearch

https://tax.network/assets/MembershipOrders-CdMhWrnB.js

js tax.network collected 2026-10-10 02:02:03 UTC 4,497 bytes, 7 lines download raw bytes

1import{f as C,bv as T,cj as k,s as g,e as I,u as M,r as F,j as e,d as _,C as y,Q as j,a1 as m,aJ as R,aK as B,T as f,aU as O,ae as S,aV as V,aW as A,b1 as x,aY as D,n as E}from"./index-Dmg8doHl.js";import{E as H}from"./empty-state-DSE09XWP.js";import{B as c}from"./badges-dbGwWQMq.js";import{u as L}from"./useFiscalInvoices-BO__YG7g.js";import{u as P}from"./useLocalizedFormatting-BXSEkDDV.js";import{R as U}from"./receipt-DEUplBIG.js";import{p as q}from"./parseISO-CfvjzqXV.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Y=C("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);function $(){return T({queryKey:k.orders.mine(),queryFn:async()=>{const{data:{user:t}}=await g.auth.getUser();if(!t)return[];const n=await I.fetchTop("users_order_history","*",50,{filters:[{column:"user_id",operator:"eq",value:t.id}],orderBy:{column:"order_date",ascending:!1}})??[],i=n.filter(l=>l.payment_status==="success"),r=n[0];return r&&r.payment_status==="pending"&&!i.some(l=>l.id===r.id)&&i.unshift(r),i}})}const z=({onClick:t,icon:n,tooltip:i,isLoading:r=!1})=>e.jsxs(V,{children:[e.jsx(A,{asChild:!0,children:t?e.jsx("button",{type:"button",onClick:()=>{t()},disabled:r,"aria-busy":r,className:"bg-transparent border-0 p-0 cursor-pointer disabled:cursor-wait",children:r?e.jsx(_,{className:`${x.inline} text-foreground animate-spin`}):e.jsx(n,{className:`${x.inline} text-foreground hover:text-primary transition-colors`})}):e.jsx("span",{children:e.jsx(n,{className:`${x.inline} text-muted-foreground/40 cursor-not-allowed`})})}),e.jsx(D,{children:i})]}),G={success:c.success,pending:c.warning,failed:c.error,refunded:c.info,cancelled:c.secondary},se=()=>{const{data:t=[],isLoading:n}=$(),{data:i=[]}=L(),r=new Map(i.filter(s=>s.status==="issued"&&s.id).map(s=>[s.order_id,s])),{lPages:l}=M(),{date:b,currency:w}=P(),[v,h]=F.useState(null),N=async s=>{var u;const o=window.open("","_blank","noopener,noreferrer");h(s);try{const{data:a,error:p}=await g.functions.invoke("nfeio-invoice",{body:{action:"get-pdf-url",invoiceId:s}});if(p||!(a!=null&&a.success)||!((u=a==null?void 0:a.data)!=null&&u.signed_url)){o==null||o.close(),E.error(l("membership_orders.toast.download_failed",{defaultValue:"Could not generate download link"}));return}const d=a.data.signed_url;o?o.location.href=d:window.location.href=d}finally{h(null)}};return n?e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(_,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):t.length===0?e.jsx(e.Fragment,{children:e.jsx(y,{children:e.jsx(j,{children:e.jsx(H,{icon:U,title:e.jsx(m,{id:"membership_orders.empty.title",defaultValue:"No orders yet"}),description:e.jsx(m,{id:"membership_orders.empty.description",defaultValue:"Your order history will appear here once you make a purchase."}),variant:"card"})})})}):e.jsx(e.Fragment,{children:e.jsxs(y,{children:[e.jsx(R,{children:e.jsx(B,{className:f.cardTitle,children:e.jsx(m,{id:"membership_orders.order_history.title",defaultValue:"Order History"})})}),e.jsx(j,{children:e.jsx(O,{children:e.jsx("div",{className:"divide-y divide-border",children:t.map(s=>{var d;const o=G[s.payment_status]??c.secondary,u=((d=s.currency)==null?void 0:d.toUpperCase())==="BRL",a=r.get(s.id),p=a?()=>N(a.id):null;return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 py-3 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:f.body,children:s.order_number}),e.jsx(S,{className:o,children:s.payment_status.charAt(0).toUpperCase()+s.payment_status.slice(1)})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[b(q(s.order_date)),s.payment_provider&&` · ${s.payment_provider}`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:f.body,children:w(s.amount,s.currency)}),u&&e.jsx(z,{onClick:p,icon:Y,tooltip:l("membership_orders.tooltip.fiscal_receipt",{defaultValue:"Download Fiscal Receipt"}),isLoading:v===(a==null?void 0:a.id)})]})]},s.id)})})})})]})})};export{se as default};
7//# sourceMappingURL=MembershipOrders-CdMhWrnB.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.