PageSourceSearch

https://www.gemphere.com/assets/CRM-fzF1VH0r.js

js gemphere.com collected 2026-10-02 01:30:09 UTC 14,171 bytes, 6 lines download raw bytes

1import{bm as J,u as K,r as u,j as e,bT as Q,b_ as k,ab as X,bS as U,b$ as Y,c0 as Z}from"./index-t4UNL-er.js";import{H as T,C as I,c as w}from"./card-DbH3HPdJ.js";import{T as ee,a as te,b as $,c as O}from"./tabs-sgZtMKX6.js";import{P as re}from"./ProfilePopup-acBF9Pse.js";import"./index-BiHj8eX2.js";import"./index-BjqtNt-N.js";import"./Combination-HGhFtX4F.js";import"./briefcase-DoSn8kXa.js";import"./external-link-GaWiUDyf.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 se=J("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);function ne(t){const r={drafted:null,introRequested:null,optInPending:null,optInAccepted:null,optInRejected:null,introSent:null,inConvo:null,closed:null};for(const s of t){const i=String(s.name).toLowerCase().trim();i==="drafted"?r.drafted=s:i==="intro requested"?r.introRequested=s:i.startsWith("investor opt in")&&i.includes("pending")?r.optInPending=s:i.startsWith("investor opt in")&&i.includes("accepted")||i==="accepted"?r.optInAccepted=s:i.startsWith("investor opt in")&&i.includes("rejected")||i==="rejected"?r.optInRejected=s:i==="intro sent"?r.introSent=s:i==="in convo"||i==="in conversation"?r.inConvo=s:i==="closed"&&(r.closed=s)}return r}function ie(t,r){var s,i;return t&&((s=r.optInAccepted)==null?void 0:s.id)===t?"accepted":t&&((i=r.optInRejected)==null?void 0:i.id)===t?"rejected":"pending"}function M(t,r){var s,i,c;return t?t===((s=r.optInPending)==null?void 0:s.id)||t===((i=r.optInAccepted)==null?void 0:i.id)||t===((c=r.optInRejected)==null?void 0:c.id):!1}const ae=["Drafted","Intro Requested","Investor Opt In","Intro Sent","In Convo","Closed"];function de(t,r){var s,i,c,l,m;return t?((s=r.drafted)==null?void 0:s.id)===t?"Drafted":((i=r.introRequested)==null?void 0:i.id)===t?"Intro Requested":M(t,r)?"Investor Opt In":((c=r.introSent)==null?void 0:c.id)===t?"Intro Sent":((l=r.inConvo)==null?void 0:l.id)===t?"In Convo":((m=r.closed)==null?void 0:m.id)===t?"Closed":"":""}function q(t,r,s){return t==="Drafted"?r?"bg-slate-500/15 border-slate-500/40 text-slate-700 dark:text-slate-300":"border-border text-muted-foreground":t==="Intro Requested"?r?"bg-sky-500/15 border-sky-500/40 text-sky-700 dark:text-sky-300":"border-border text-muted-foreground":t==="Investor Opt In"?r?s==="accepted"?"bg-emerald-500/15 border-emerald-500/40 text-emerald-700 dark:text-emerald-400":s==="rejected"?"bg-red-500/15 border-red-500/40 text-red-700 dark:text-red-400":"bg-amber-500/15 border-amber-500/40 text-amber-700 dark:text-amber-400":"border-border text-muted-foreground":t==="Intro Sent"?r?"bg-indigo-500/15 border-indigo-500/40 text-indigo-700 dark:text-indigo-300":"border-border text-muted-foreground":t==="In Convo"?r?"bg-violet-500/15 border-violet-500/40 text-violet-700 dark:text-violet-300":"border-border text-muted-foreground":t==="Closed"&&r?"bg-muted border-border text-muted-foreground":"border-border text-muted-foreground"}function D(t){return t==="accepted"?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400":t==="rejected"?"bg-red-500/15 text-red-700 dark:text-red-400":"bg-amber-500/15 text-amber-700 dark:text-amber-400"}function E(t){const r=t.toLowerCase().trim();if(r==="drafted")return{label:"Drafted",cls:"bg-slate-500/15 text-slate-700 dark:text-slate-300"};if(r==="intro requested")return{label:"Intro Requested",cls:"bg-sky-500/15 text-sky-700 dark:text-sky-300"};if(r==="intro sent")return{label:"Intro Sent",cls:"bg-indigo-500/15 text-indigo-700 dark:text-indigo-300"};if(r==="in convo"||r==="in conversation")return{label:"In Convo",cls:"bg-violet-500/15 text-violet-700 dark:text-violet-300"};if(r==="closed")return{label:"Closed",cls:"bg-muted text-muted-foreground"};if(r.startsWith("investor opt in")||r==="accepted"||r==="rejected"){const s=r.includes("accepted")||r==="accepted"?"accepted":r.includes("rejected")||r==="rejected"?"rejected":"pending";return{label:`Investor Opt In (${s.charAt(0).toUpperCase()+s.slice(1)})`,cls:D(s)}}return{label:t,cls:"bg-muted text-muted-foreground"}}function v(t){var s;const r=((s=t==null?void 0:t.user)==null?void 0:s.fullname)??(t==null?void 0:t.fullname);return typeof r=="string"&&r.trim()||"Unknown"}function oe(t){var s;const r=((s=t==null?void 0:t.user)==null?void 0:s.id)??(t==null?void 0:t.id);return typeof r=="number"&&r===0}function V(t){var r;return((r=t==null?void 0:t.user)==null?void 0:r.id)??(t==null?void 0:t.id)??0}function W(t){var r;return((r=t==null?void 0:t.user)==null?void 0:r.profilePhoto)??(t==null?void 0:t.profilePhoto)??null}function F(t){const r=t.replace(/\s+/g," ").trim().split(" ").filter(
6Boolean);return r.length>=2?(r[0][0]+r[r.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()||"?"}function y({party:t,onAvatarClick:r}){const s=v(t),i=oe(t),c=V(t),l=W(t);return i?e.jsx("span",{className:"inline-flex max-w-full items-center rounded-full bg-sky-500/15 text-sky-700 dark:text-sky-300 text-[11px] px-2 py-0.5",children:e.jsx("span",{className:"truncate",children:s})}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 min-w-0",children:[e.jsx("button",{type:"button",onClick:m=>{m.stopPropagation(),c>0&&r&&r(c,s,l)},className:"shrink-0 w-6 h-6 rounded-full overflow-hidden bg-muted flex items-center justify-center ring-1 ring-border/60 hover:ring-primary/60 hover:scale-110 transition-all cursor-pointer",title:`View ${s}'s profile`,children:l&&String(l).trim()?e.jsx("img",{src:String(l).trim(),alt:"",className:"w-full h-full object-cover",onError:m=>{m.target.style.display="none"}}):e.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:F(s)})}),e.jsx("span",{className:"truncate",children:s})]})}function B(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":r.toLocaleString()}function be(){const{user:t}=K(),r=(t==null?void 0:t.accessToken)??"",[s,i]=u.useState(!0),[c,l]=u.useState(null),[m,_]=u.useState([]),[p,C]=u.useState(null),[o,G]=u.useState(null),[z,S]=u.useState(!1),[x,P]=u.useState(null),j=(n,a,d)=>{P({id:n,name:a,photo:d})},N=u.useMemo(()=>m.find(n=>n.id===p)??null,[m,p]);async function R(){var n,a;if(r){i(!0),l(null);try{const d=await Y(r);_(d.data??[]),!p&&(((a=(n=d.data)==null?void 0:n[0])==null?void 0:a.id)??0)>0&&C(d.data[0].id)}catch(d){l(d instanceof Error?d.message:"Failed to load CRM")}finally{i(!1)}}}async function H(n){if(r){S(!0),l(null);try{const a=await Z(r,n);G(a)}catch(a){l(a instanceof Error?a.message:"Failed to load intro")}finally{S(!1)}}}return u.useEffect(()=>{R()},[r]),u.useEffect(()=>{p&&H(p)},[p]),t?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(T,{}),e.jsxs("main",{className:"pt-24 pb-12 px-4 sm:px-6 max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-start sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight",children:"CRM"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mt-1",children:"Track your warm intros in a clean timeline with stages."})]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:R,disabled:s,children:[e.jsx(k,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"Refresh"]})]}),c&&e.jsx("div",{className:"mb-4 rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:c}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[360px_1fr] gap-4",children:[e.jsx(I,{className:"border-border/60 bg-card/80",children:e.jsxs(w,{className:"p-3",children:[e.jsxs("div",{className:"text-sm font-semibold px-2 py-2 flex items-center gap-2",children:[e.jsx(X,{className:"w-4 h-4 text-muted-foreground"}),"Intros"]}),s?e.jsx("div",{className:"py-10 flex items-center justify-center",children:e.jsx(k,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):m.length===0?e.jsx("div",{className:"py-10 px-3 text-sm text-muted-foreground",children:"No CRM intros yet."}):e.jsx("div",{className:"space-y-2",children:m.map(n=>{var a;return e.jsxs("button",{type:"button",onClick:()=>C(n.id),className:`w-full text-left rounded-xl border px-3 py-3 transition-colors ${p===n.id?"border-primary bg-primary/5":"border-border hover:bg-accent/30"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:n.title||"Warm intro"}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5 flex flex-wrap items-center gap-1",children:[e.jsx(y,{party:n.partyAUser,onAvatarClick:j}),e.jsx("span",{className:"mx-1",children:"↔"}),e.jsx(y,{party:n.partyBUser,onAvatarClick:j})]})]}),(a=n.currentStage)!=null&&a.name?(()=>{const d=E(n.currentStage.name);return e.jsx("span",{className:`shrink-0 text-[11px] px-2 py-0.5 rounded-full ${d.cls}`,title:d.label,children:d.label})})():null]}),v(n.createdByUser)!=="Unknown"&&e.jsxs("div",{className:"text-[11px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[e.jsx(U,{className:"w-3 h-3 shrink-0"}),e.jsxs("span",{children:["Introduced by ",e.jsx("span",{className:"font-medium text-foreground
6/70",children:v(n.createdByUser)})]})]}),e.jsxs("div",{className:"text-[11px] text-muted-foreground mt-1",children:["Updated ",B(n.updatedAt),n.isClosed?" • Closed":""]})]},n.id)})})]})}),e.jsx(I,{className:"border-border/60 bg-card/80",children:e.jsx(w,{className:"p-5",children:!p||!N?e.jsx("div",{className:"py-10 text-sm text-muted-foreground",children:"Select an intro to view the timeline."}):z?e.jsx("div",{className:"py-10 flex items-center justify-center",children:e.jsx(k,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 mb-4",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-semibold",children:N.title||"Warm intro"}),e.jsxs("div",{className:"text-sm text-muted-foreground mt-0.5 flex flex-wrap items-center gap-2",children:[e.jsx(y,{party:N.partyAUser,onAvatarClick:j}),e.jsx("span",{children:"↔"}),e.jsx(y,{party:N.partyBUser,onAvatarClick:j})]}),(()=>{const n=(o==null?void 0:o.createdByUser)??N.createdByUser,a=v(n);if(a==="Unknown")return null;const d=V(n),f=W(n);return e.jsxs("div",{className:"text-xs text-muted-foreground mt-2 flex items-center gap-1.5",children:[e.jsx(U,{className:"w-3.5 h-3.5 shrink-0 text-primary/60"}),e.jsx("span",{children:"Introduced by"}),d>0?e.jsxs("button",{type:"button",onClick:()=>j(d,a,f),className:"inline-flex items-center gap-1 font-medium text-primary hover:underline",children:[e.jsx("span",{className:"w-4 h-4 rounded-full overflow-hidden bg-muted flex items-center justify-center ring-1 ring-border/60 shrink-0",children:f&&String(f).trim()?e.jsx("img",{src:String(f).trim(),alt:"",className:"w-full h-full object-cover"}):e.jsx("span",{className:"text-[7px] font-semibold text-muted-foreground",children:F(a)})}),a]}):e.jsx("span",{className:"font-medium",children:a})]})})()]})}),e.jsxs(ee,{defaultValue:"timeline",className:"w-full",children:[e.jsxs(te,{className:"bg-muted/60",children:[e.jsx($,{value:"timeline",children:"Timeline"}),e.jsx($,{value:"stages",children:"Stages"})]}),e.jsx(O,{value:"timeline",className:"mt-4",children:e.jsx("div",{className:"space-y-3",children:((o==null?void 0:o.events)??[]).length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-6",children:"No timeline events yet."}):((o==null?void 0:o.events)??[]).map(n=>e.jsxs("div",{className:"rounded-xl border border-border p-4 bg-background/40",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium",children:n.type==="created"?"Intro created":n.type==="stage_changed"?"Stage moved":n.type==="note"?"Note":n.type}),e.jsx("div",{className:"text-xs text-muted-foreground",children:B(n.createdAt)})]}),n.stageId?e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:["Stage:"," ",(()=>{var f;const a=((f=((o==null?void 0:o.stages)??[]).find(h=>h.id===n.stageId))==null?void 0:f.name)??"",d=a?E(a):{label:`#${n.stageId}`,cls:"text-foreground"};return e.jsx("span",{className:`font-medium inline-flex items-center gap-1 px-1.5 py-0.5 rounded ${d.cls}`,children:d.label})})()]}):null,n.note?e.jsx("div",{className:"mt-3 text-sm text-foreground whitespace-pre-wrap",children:n.note}):null]},n.id))})}),e.jsx(O,{value:"stages",className:"mt-4",children:(()=>{var A;const n=(o==null?void 0:o.stages)??[],a=ne(n),d=(A=o==null?void 0:o.intro)==null?void 0:A.currentStageId,f=de(d,a),h=M(d,a),b=ie(d,a);return e.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(g=>{const L=g===f;return g==="Investor Opt In"?e.jsxs("span",{title:`Investor Opt In: ${h?b.charAt(0).toUpperCase()+b.slice(1):"Pending"}`,className:`px-3 py-1.5 rounded-full text-sm border ${q(g,L,h?b:"pending")}
6`,children:["Investor Opt In",e.jsx("span",{className:`ml-1.5 text-[10px] px-1.5 py-0.5 rounded-full ${D(h?b:"pending")}`,children:h?b.charAt(0).toUpperCase()+b.slice(1):"Pending"})]},g):e.jsx("span",{className:`px-3 py-1.5 rounded-full text-sm border ${q(g,L)}`,children:g},g)})})})()})]})]})})})]}),e.jsx(re,{open:!!x,onOpenChange:n=>{n||P(null)},userId:(x==null?void 0:x.id)??0,accessToken:r,initialName:x==null?void 0:x.name,initialPhoto:x==null?void 0:x.photo})]})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(T,{}),e.jsx("main",{className:"pt-24 pb-12 px-4 max-w-5xl mx-auto",children:e.jsx(I,{className:"border-border/60 bg-card/80",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"CRM"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Log in to view your intros."})]})]})})})})]})}export{be 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.