PageSourceSearch

https://genealogydirect.net/assets/FinanceDashboard-C2p5kYQ4.js

js genealogydirect.net collected 2026-09-24 14:25:45 UTC 22,956 bytes, 1 lines download raw bytes

1import{r as g,u as F,j as t,W as Q,P as K}from"./index-D1aKNduO.js";import{P as J}from"./papaparse.min-DH3ClDLU.js";import{P as W}from"./PageBreadCrumb-BHH2LLyg.js";import{C as A}from"./ComponentCard-1Sxg2XrY.js";import{B as X}from"./Button-cszLhf2L.js";import{B as C}from"./Badge-BZRezhTy.js";import{S as Z}from"./download-BRmjMDsW.js";import{S as ee}from"./bank-iMCE28hZ.js";import{S as te}from"./credit-card-DbN79Xzd.js";import{S as ae}from"./money-bag-CJDc9DHK.js";import{S as re}from"./gauge-AoUEXwhs.js";import{S as se}from"./timer-CBfMXWhO.js";import{f as k,d as ne}from"./stripeTransaction-DE2ymnON.js";import{C as U}from"./react-apexcharts.min-KESHtALr.js";import{a as R}from"./priceFormatting-BRJIJJ2C.js";import{D as P,c as oe,a as ie,u as ce}from"./usePricingConfig-O--UPKwz.js";import{g as le}from"./request-CsEOAxak.js";import{n as de}from"./forumPriceBadge-CfZBc8k6.js";import{T as ue,a as me,b as T,c as j,d as pe}from"./index-mkL64Lnu.js";import{c as ge}from"./ChooseProceedsTarget-CcvyW0z7.js";import{u as xe}from"./useAllGenealogyRequests-CxvWPvh3.js";import"./firebase-DGovvYsO.js";import"./buttonStyles-B3V8uqct.js";import"./index-Chjiymov.js";import"./DocumentType-DfzLkOxU.js";import"./format-DJFnJxm-.js";import"./RequestService-CYJ_tVm3.js";const fe=e=>g.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.4164 2.79175C13.4164 2.37753 13.0806 2.04175 12.6664 2.04175C12.2522 2.04175 11.9164 2.37753 11.9164 2.79175V4.39876C9.94768 4.67329 8.43237 6.36366 8.43237 8.40795C8.43237 10.0954 9.47908 11.6058 11.0591 12.1984L13.7474 13.2066C14.7419 13.5795 15.4008 14.5303 15.4008 15.5925C15.4008 16.9998 14.2599 18.1407 12.8526 18.1407H11.7957C10.7666 18.1407 9.93237 17.3064 9.93237 16.2773C9.93237 15.8631 9.59659 15.5273 9.18237 15.5273C8.76816 15.5273 8.43237 15.8631 8.43237 16.2773C8.43237 18.1348 9.9382 19.6407 11.7957 19.6407H11.9164V21.2083C11.9164 21.6225 12.2522 21.9583 12.6664 21.9583C13.0806 21.9583 13.4164 21.6225 13.4164 21.2083V19.6017C15.3853 19.3274 16.9008 17.6369 16.9008 15.5925C16.9008 13.905 15.8541 12.3946 14.2741 11.8021L11.5858 10.7939C10.5912 10.4209 9.93237 9.47013 9.93237 8.40795C9.93237 7.00063 11.0732 5.85976 12.4806 5.85976H13.5374C14.5665 5.85976 15.4008 6.69401 15.4008 7.72311C15.4008 8.13732 15.7366 8.47311 16.1508 8.47311C16.565 8.47311 16.9008 8.13732 16.9008 7.72311C16.9008 5.86558 15.395 4.35976 13.5374 4.35976H13.4164V2.79175Z",fill:"currentColor"}));function ye({label:e,value:a,description:n,icon:r,iconClassName:i}){return t.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 dark:border-gray-800 dark:bg-white/[0.03] md:p-6",children:[t.jsx("div",{className:`flex items-center justify-center w-12 h-12 rounded-xl ${i}`,children:t.jsx(r,{className:"size-6"})}),t.jsxs("div",{className:"mt-5",children:[t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),t.jsx("h4",{className:"mt-2 font-bold text-gray-800 text-title-sm dark:text-white/90",children:a}),t.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:n})]})]})}function he({totals:e,currency:a,loading:n}){const{i18n:r}=F(),i=s=>n?"…":k(s,a,r.language),c=s=>n?"…":s.toLocaleString(),o=[{label:"Realized platform fees",value:i(e.realizedFeeMajor),description:"Earned — service delivered & paid out",icon:fe,iconClassName:"bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-300"},{label:"Expected platform fees",value:i(e.expectedFeeMajor),description:"Projected from active paid work",icon:ae,iconClassName:"bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-300"},{label:"Gross request value",value:i(e.grossMajor),description:"Realized + expected, charged to requestors",icon:ee,iconClassName:"bg-brand-50 text-brand-600 dark:bg-brand-500/10 dark:text-brand-200"},{label:"Paid requests",value:c(e.paidRequestCount),description:"In the active pipeline",icon:te,iconClassName:"bg-purple-50 text-purple-600 dark:bg-purple-500/10 dark:text-purple-300"},{label:"Avg. fee / request",value:i(e.avgFeeMajor),description:"Across paid requests",icon:re,iconClassName:"bg-sky-50 text-sky-600 dark:bg-sky-500/10 dark:text-sky-300"},{label:"Backlog fee value",value:i(e.backlogFeeMajor),description:"Expected fees not yet realized",icon:se,iconClassName:"bg-rose-50 text-rose-600 dar
1k:bg-rose-500/10 dark:text-rose-300"}];return t.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3 md:gap-6",children:o.map(s=>t.jsx(ye,{...s},s.label))})}const je=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function be(e){const[a,n]=e.split("-"),r=Number(n)-1;return r<0||r>11?e:`${je[r]} ${a}`}function ke({points:e,currency:a}){const{i18n:n}=F(),r=e.map(o=>be(o.month)),i=[{name:"Realized",data:e.map(o=>o.realizedFeeMajor)},{name:"Expected",data:e.map(o=>o.expectedFeeMajor)}],c={legend:{show:!0,position:"top",horizontalAlign:"left",fontFamily:"Outfit"},colors:["#39B54A","#F59E0B"],chart:{fontFamily:"Outfit, sans-serif",height:310,type:"area",toolbar:{show:!1}},stroke:{curve:"smooth",width:[2,2]},fill:{type:"gradient",gradient:{opacityFrom:.45,opacityTo:0}},markers:{size:0,hover:{size:5}},dataLabels:{enabled:!1},grid:{xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}}},xaxis:{type:"category",categories:r,axisBorder:{show:!1},axisTicks:{show:!1},tooltip:{enabled:!1}},yaxis:{labels:{formatter:o=>R(Math.round(o),a,n.language)}},tooltip:{y:{formatter:o=>R(o,a,n.language)}}};return t.jsx(A,{title:"Platform fee over time",desc:`Realized vs expected platform fees by month (${a})`,children:e.length===0?t.jsx("p",{className:"py-10 text-center text-sm text-gray-500 dark:text-gray-400",children:"No paid requests in this currency yet."}):t.jsx(U,{options:c,series:i,type:"area",height:310})})}const w=e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const a=Number(e);if(Number.isFinite(a))return a}return null},b=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(e&&typeof e.toDate=="function")try{return e.toDate()}catch{return null}return null},L=(e,a)=>{if(!e)return null;const n=a.getTime()-e.getTime();return!Number.isFinite(n)||n<0?0:Math.floor(n/(1e3*60*60*24))};function O(e,a,n,r){const i=de(e?.currency??n,"EUR"),c=w(e?.amount),o=w(e?.platformFee)??w(e?.platformFeeAmount);if(c!==null&&c>0&&o!==null&&o>=0)return{grossMajor:c/100,platformFeeMajor:o/100,currency:i};const s=w(a);if(s!==null&&s>0){const l=oe(Math.round(s*100),i,r);return{grossMajor:l.totalChargeMinor/100,platformFeeMajor:l.platformFeeMinor/100,currency:i}}if(c!==null&&c>0){const{platformFeeMinor:l}=ie(c,i,r);return{grossMajor:c/100,platformFeeMajor:l/100,currency:i}}return null}const Me=new Set(["CANCELED","REJECTED","EXPIRED"]);function Fe(e){return!!(e.refundedAt||e.refundId||e.paymentDetails?.status==="refunded")}function Ce(e){if(Fe(e))return"refunded";if(Me.has(e.status))return"cancelled";switch(ne(e)){case"FUNDS_SENT":return"realized";case"REFUNDED":return"refunded";case"ERROR":return"disputed";case"FUNDS_RECEIVED":case"TO_REVIEW":return"expected";default:return"expected"}}const Ne=new Set(["CANCELLED_BY_OWNER","CLOSED_BY_MOD","ARCHIVED_NO_PARTICIPATION"]);function ve(e){const a=e.paymentDetails?.status;return a==="refunded"?"refunded":a==="failed"?"disputed":Ne.has(e.status)?"cancelled":e.status==="SOLVED"?"realized":"expected"}function De(e){return!!(e.openForPaidOffers&&e.acceptedBidId&&e.assignedResearcherId&&e.paymentDetails)}function we(e,a,n={}){const r=n.config??P,i=n.now??new Date,c=n.language??"en",o=[];for(const s of e){if(s.status==="DRAFT")continue;const l=O(s.paymentDetails,s.fixedPrice,s.currency??"EUR",r);if(!l)continue;const d=Ce(s),h=b(s.createdAt)??b(s.dateSubmitted),m=b(s.assignedAt)??b(s.paymentDetails?.capturedAt)??h,p=d==="realized"?b(s.paymentReleasedAt)??b(s.dateFulfilled)??b(s.updatedAt)??m:null,u=s.paymentDetails?.payeeType,x=u==="charity",E=w(s.paymentDetails?.transferAmount),z=x?E!==null?E/100:Math.max(l.grossMajor-l.platformFeeMajor,0):void 0;o.push({id:s.id,kind:"document_copy",label:le(s,c),bucket:d,rawStatus:s.status,currency:l.currency,grossMajor:l.grossMajor,platformFeeMajor:l.platformFeeMajor,createdAt:h,activeAt:m,realizedAt:p,ageDays:d==="expected"?L(m??h,i):null,payeeType:u,charityId:x?s.paymentDetails?.payeeAccountId??void 0:void 0,charityAmountMajor:z})}for(const s of a){if(!De(s))continue;const l=O(s.paymentDetails,null,s.paymentDetails?.currency??"EUR",r);
1if(!l)continue;const d=ve(s),h=b(s.createdAt),m=b(s.paymentDetails?.capturedAt)??h,p=d==="realized"?m:null;o.push({id:s.id,kind:"research_question",label:s.title||"Paid research question",bucket:d,rawStatus:s.status,currency:l.currency,grossMajor:l.grossMajor,platformFeeMajor:l.platformFeeMajor,createdAt:h,activeAt:m,realizedAt:p,ageDays:d==="expected"?L(m??h,i):null})}return o}const f=e=>Math.round(e*100)/100;function Ae(e){let a=0,n=0,r=0,i=0,c=0,o=0,s=0;for(const d of e)switch(d.bucket){case"realized":a+=d.platformFeeMajor,r+=d.grossMajor,i+=1;break;case"expected":n+=d.platformFeeMajor,r+=d.grossMajor,i+=1;break;case"refunded":c+=d.platformFeeMajor;break;case"disputed":o+=1;break;case"cancelled":s+=1;break}const l=a+n;return{realizedFeeMajor:f(a),expectedFeeMajor:f(n),grossMajor:f(r),paidRequestCount:i,avgFeeMajor:i>0?f(l/i):0,backlogFeeMajor:f(n),refundedFeeMajor:f(c),disputedCount:o,cancelledCount:s}}function Ee(e){return e.bucket==="realized"?e.realizedAt??e.activeAt??e.createdAt:e.activeAt??e.createdAt}function Re(e){const a=new Map;for(const n of e){if(!n.charityId||n.charityAmountMajor===void 0||n.bucket!=="realized"&&n.bucket!=="expected")continue;const r=a.get(n.charityId)??{count:0,realized:0,pending:0};r.count+=1,n.bucket==="realized"?r.realized+=n.charityAmountMajor:r.pending+=n.charityAmountMajor,a.set(n.charityId,r)}return Array.from(a.entries()).map(([n,r])=>({charityId:n,requestCount:r.count,realizedMajor:f(r.realized),pendingMajor:f(r.pending)})).sort((n,r)=>r.realizedMajor+r.pendingMajor-(n.realizedMajor+n.pendingMajor))}const Se=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`;function ze(e){const a=new Map,n=(r,i,c)=>{if(!r)return;const o=Se(r),s=a.get(o)??{realized:0,expected:0};s[i]+=c,a.set(o,s)};for(const r of e)r.bucket==="realized"?n(r.realizedAt??r.activeAt??r.createdAt,"realized",r.platformFeeMajor):r.bucket==="expected"&&n(r.activeAt??r.createdAt,"expected",r.platformFeeMajor);return Array.from(a.entries()).sort(([r],[i])=>r.localeCompare(i)).map(([r,i])=>({month:r,realizedFeeMajor:f(i.realized),expectedFeeMajor:f(i.expected)}))}function Te(e){return["document_copy","research_question"].map(n=>{let r=0,i=0,c=0;for(const o of e)o.kind===n&&(o.bucket==="realized"?(r+=o.platformFeeMajor,c+=1):o.bucket==="expected"&&(i+=o.platformFeeMajor,c+=1));return{kind:n,realizedFeeMajor:f(r),expectedFeeMajor:f(i),count:c}})}const _e=[{label:"0–7 days",minDays:0,maxDays:8},{label:"8–15 days",minDays:8,maxDays:16},{label:"16–30 days",minDays:16,maxDays:31},{label:"30+ days",minDays:31,maxDays:null}];function Be(e){return _e.map(a=>{let n=0,r=0;for(const i of e){if(i.bucket!=="expected"||i.ageDays===null)continue;const c=i.ageDays,o=c>=a.minDays,s=a.maxDays===null||c<a.maxDays;o&&s&&(n+=1,r+=i.platformFeeMajor)}return{...a,count:n,feeMajor:f(r)}})}function Ie(e){const a=new Map;for(const n of e)a.set(n.currency,(a.get(n.currency)??0)+1);return Array.from(a.entries()).sort((n,r)=>r[1]-n[1]||n[0].localeCompare(r[0])).map(([n])=>n)}const Le={EUR:1,USD:.886},B="EUR";function Oe(e){if(e.currency===B)return e;const a=Le[e.currency]??1;return{...e,currency:B,grossMajor:e.grossMajor*a,platformFeeMajor:e.platformFeeMajor*a,charityAmountMajor:e.charityAmountMajor!==void 0?e.charityAmountMajor*a:void 0}}const qe={realized:"Realized",expected:"Expected",refunded:"Refunded",disputed:"Disputed",cancelled:"Cancelled"},S={document_copy:"Document Copy",research_question:"Research Question"};function Ue({rows:e,currency:a}){const{i18n:n}=F(),r=e.map(s=>S[s.kind]),i=e.some(s=>s.realizedFeeMajor>0||s.expectedFeeMajor>0),c=[{name:"Realized",data:e.map(s=>s.realizedFeeMajor)},{name:"Expected",data:e.map(s=>s.expectedFeeMajor)}],o={colors:["#39B54A","#F59E0B"],chart:{fontFamily:"Outfit, sans-serif",type:"bar",stacked:!0,height:260,toolbar:{show:!1}},plotOptions:{bar:{horizontal:!0,borderRadius:4,columnWidth:"45%"}},dataLabels:{enabled:!1},legend:{show:!0,position:"top",horizontalAlign:"left",fontFamily:"Outfit"},xaxis:{categories:r,labels:{formatter:s=>R(Math.round(Number(s)),a,n.language)},axisBorder:{show:!1},axisTicks:{show:!1}},grid:{yaxis:{lines:{show:!1}}},tooltip:{y:{formatter:s=>R(s,a,n.language)}}};return t.jsx(A,{title:"Platform fees by request type",desc:`Realized vs expected (${a})`,children:i?t.jsx(U,{options:o,series:c,type:"bar",height:260}):t.jsx("p",{className:"py-10 text-center text-sm text-gray-500 dark:text-gray-400",children:"No paid requests in this currency yet."})})}const Pe={"0–7 days":"success","8–15 days":"warning","16–30 days":"warning","30+ days":"error"};function He({buckets:e,currency:a}){const{i18n:n}=F(),r=e.reduce((c,o)=>c+o.count,0),i=e.reduce((c,o)=>c+o.feeMajor,0);return t.jsx(A,{title:"Backlog aging",desc:"Expected platform fees by how long active work has been outstanding",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs(ue,{children:[t.jsx(me,{className:"border-b border-gray-100 dark:border-gray-800",children:t.jsxs(T,{children:[t.jsx(j,{isHeader:!0,className:"px-4 py-3 text-start text-xs font-medium text-gray-500 dark:text-gray-400",children:"Age"}),t.jsx(j,{isHeader:!0,className:"px-4 py-3 text-start text-xs font-medium text-gray-500 dark:text-gray-400",children:"Requests"}),t.jsx(j,{isHeader:!0,className:"px-4 py-3 text-end text-xs font-medium text-gray-500 dark:text-gray-400",children:"Expected fee"})]})}),t.jsxs(pe,{className:"divide-y divide-gray-100 dark:divide-gray-800",children:[e.map(c=>t.jsxs(T,{children:[t.jsx(j,{className:"px-4 py-3 text-start",children:t.jsx(C,{size:"sm",color:Pe[c.label]??"gray",children:c.label})}),t.jsx(j,{className:"px-4 py-3 text-start text-sm text-gray-700 dark:text-gray-300",children:c.count.toLocaleStr
1ing()}),t.jsx(j,{className:"px-4 py-3 text-end text-sm font-medium text-gray-800 dark:text-white/90",children:k(c.feeMajor,a,n.language)})]},c.label)),t.jsxs(T,{className:"bg-gray-50 dark:bg-white/[0.02]",children:[t.jsx(j,{className:"px-4 py-3 text-start text-sm font-semibold text-gray-800 dark:text-white/90",children:"Total"}),t.jsx(j,{className:"px-4 py-3 text-start text-sm font-semibold text-gray-800 dark:text-white/90",children:r.toLocaleString()}),t.jsx(j,{className:"px-4 py-3 text-end text-sm font-semibold text-gray-800 dark:text-white/90",children:k(i,a,n.language)})]})]})]})})})}const $e=new Map(ge.map(e=>[e.id,e]));function Ve({rows:e,currency:a}){const{t:n,i18n:r}=F(),i=e.reduce((o,s)=>o+s.realizedMajor,0),c=e.reduce((o,s)=>o+s.pendingMajor,0);return t.jsx(A,{title:"Donations to charity",desc:`Funds routed to charities, transferred vs pledged (${a})`,children:e.length===0?t.jsx("p",{className:"py-10 text-center text-sm text-gray-500 dark:text-gray-400",children:"No charity-directed payouts in this currency yet."}):t.jsxs("div",{className:"space-y-3",children:[e.map(o=>{const s=$e.get(o.charityId),l=s?n(s.charityNameKey,s.mainName):o.charityId;
1return t.jsxs("div",{className:"flex items-center gap-4 rounded-xl border border-gray-100 p-3 dark:border-gray-800",children:[t.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-gray-50 dark:bg-white/[0.04]",children:s?t.jsx("img",{src:s.logoName,alt:l,className:"size-full object-contain"}):t.jsx("span",{className:"text-lg",children:"❤"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium text-gray-800 dark:text-white/90",children:l}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[o.requestCount.toLocaleString()," request",o.requestCount===1?"":"s"]})]}),t.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[t.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:k(o.realizedMajor,a,r.language)}),o.pendingMajor>0&&t.jsxs(C,{size:"sm",color:"warning",variant:"light",children:[k(o.pendingMajor,a,r.language)," pending"]})]})]},o.charityId)}),t.jsxs("div",{className:"flex items-center justify-between border-t border-gray-100 pt-3 dark:border-gray-800",children:[t.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:"Total"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-gray-800 dark:text-white/90",children:k(i,a,r.language)}),c>0&&t.jsxs(C,{size:"sm",color:"warning",variant:"light",children:[k(c,a,r.language)," pending"]})]})]})]})})}function Ye(){const{i18n:e}=F(),{requests:a,loading:n,error:r}=xe(),{questions:i,loading:c}=Q(),{config:o}=ce();return{records:g.useMemo(()=>we(a,i,{config:o??P,language:e.language}),[a,i,o,e.language]),loading:n||c,error:r}}const Ge=[{key:"all",label:"All time"},{key:"12m",label:"12 months"},{key:"6m",label:"6 months"},{key:"3m",label:"3 months"},{key:"ytd",label:"YTD"}],q="__combined__",Qe=[{key:"all",label:"All types"},{key:"document_copy",label:S.document_copy},{key:"research_question",label:S.research_question}];function Ke(e,a){switch(e){case"ytd":return new Date(a.getFullYear(),0,1);case"3m":return new Date(a.getFullYear(),a.getMonth()-3,a.getDate());case"6m":return new Date(a.getFullYear(),a.getMonth()-6,a.getDate());case"12m":return new Date(a.getFullYear()-1,a.getMonth(),a.getDate());default:return null}}function _({options:e,value:a,onChange:n}){return t.jsx("div",{className:"inline-flex flex-wrap gap-1 rounded-lg bg-gray-100 p-1 dark:bg-white/[0.05]",children:e.map(r=>t.jsx("button",{type:"button",onClick:()=>n(r.key),className:`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${a===r.key?"bg-white text-gray-900 shadow-sm dark:bg-white/[0.1] dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"}`,children:r.label},r.key))})}const Ft=()=>{const{i18n:e}=F(),{records:a,loading:n}=Ye(),[r,i]=g.useState(null),[c,o]=g.useState("all"),[s,l]=g.useState("all"),d=g.useMemo(()=>Ie(a),[a]);g.useEffect(()=>{r===null&&d.length>0&&i(d[0])},[d,r]);const h=r??d[0]??"EUR",m=h===q,p=m?B:h,u=g.useMemo(()=>{const M=Ke(s,new Date);return(m?a.map(Oe):a).filter(N=>{if(!m&&N.currency!==p||c!=="all"&&N.kind!==c)return!1;if(M){const v=Ee(N);if(v&&v<M)return!1}return!0})},[a,m,p,c,s]),x=g.useMemo(()=>Ae(u),[u]),E=g.useMemo(()=>ze(u),[u]),z=g.useMemo(()=>Te(u),[u]),H=g.useMemo(()=>Be(u),[u]),$=g.useMemo(()=>Re(u),[u]),V=()=>{const M=u.map(y=>({id:y.id,type:S[y.kind],status:qe[y.bucket],raw_status:y.rawStatus,currency:y.currency,gross:y.grossMajor.toFixed(2),platform_fee:y.platformFeeMajor.toFixed(2),created_at:y.createdAt?.toISOString()??"",active_at:y.activeAt?.toISOString()??"",realized_at:y.realizedAt?.toISOString()??"",age_days:y.ageDays??"",label:y.label})),I=J.unparse(M),N=new Blob([I],{type:"text/csv;charset=utf-8;"}),v=URL.createObjectURL(N),D=document.createElement("a");D.href=v;const G=m?"combined-eur":p;D.download=`finance-${G}-${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(v)},Y=x.refundedFeeMajor>0||x.disputedCount>0||x.cancelledCount>0;return t.jsxs(t.Fragment,{children:[t.jsx(K,{title:"Finance Dashboard | Admin",description:"Realized and projected platform fees across the paid request pipeline."}),t.jsx(W,{pageTitle:"Finance",breadcrumbs:[{label:"Admin",path:"/admin"}]}),t.jsxs("div",{className:"space-y-5 md:space-y-6",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(_,{options:Ge,value:s,onChange:l}),t.jsx(_,{options:Qe,value:c,onChange:o}),d.length>1&&t.jsx(_,{options:[...d.map(M=>({key:M,label:M})),{key:q,label:"Combined"}],value:h,onChange:i})]}),t.jsx(X,{size:"sm",variant:"outline",startIcon:t.jsx(Z,{className:"size-4"}),onClick:V,disabled:u.length===0,children:"Export CSV"})]}),d.length>1&&t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:m?t.jsxs(t.Fragment,{children:["Combined view — all currencies converted to"," ",t.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:"EUR"})," at an indicative rate of 1 USD = 0.886 EUR (not a live FX rate)."]}):t.jsxs(t.Fragment,{children:["Currencies are reported separately — figures below cover"," ",t.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:p})," ","only."]})}),t.jsx(he,{totals:x,currency:p,loading:n}),Y&&t.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-2xl border border-gray-200 bg-white px-5 py-4 dark:border-gray-800 dark:bg-white/[0.03]",children:[t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Excluded from fee totals:"}),x.refundedFeeMajor>0&&t.jsxs(C,{color:"error",variant:"light",children:["Refunded ",k(x.refundedFeeMajor,p,e.language)]}),x.disputedCount>0&&t.jsxs(C,{color:"warning",variant:"light",children:[x.disputedCount," disputed / error"]}),x.cancelledCount>0&&t.jsxs(C,{color:"gray",variant:"light",children:[x.cancelledCount," cancelled"]})]}),t.jsx(ke,{points:E,currency:p}),t.jsxs("div",{className:"grid grid-cols-1 gap-5 md:gap-6 xl:grid-cols-2",children:[t.jsx(Ue,{rows:z,currency:p}),t.jsx(He,{buckets:H,currency:p})]}),t.jsx(Ve,{rows:$,currency:p}),t.jsx(A,{title:"How these figures are classified",children:t.jsxs("ul",{className:"list-disc space-y-1 pl-5 text-sm text-gray-600 dark:text-gray-400",children:[t.jsxs("li",{children:["The ",t.jsx("strong",{children:"platform fee"})," — not the full request value — is GenealogyDirect's revenue. Fees reuse the same calculation as the request and checkout flows."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Realized"})," fees are counted only once the service is delivered and funds have moved to the payee. Funds merely captured and held count as ",t.jsx("strong",{children:"Expected"}),"."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Refunded"}),", ",t.jsx("strong",{children:"disputed"})," and ",t.jsx("strong",{children:"cancelled"})," ","requests are excluded from realized and expected totals and shown separately."]}),t.jsx("li",{children:"Document Copy requests are included once they carry a fixed price or accepted offer; Research Questions once assigned to a researcher through the paid workflow."}),t.jsx("li",{children:"Each request is counted once; currencies are never combined."})]})})]})]})};export{Ft 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.