PageSourceSearch

https://incommand.ai/assets/PublicProposalView-BSszQwoU.js

js incommand.ai collected 2026-10-05 15:01:15 UTC 24,942 bytes, 7 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/applyRedlineToDatabase--8rv26O2.js","assets/index-Epr9psQo.js","assets/vendor-radix-BnNg3BH5.js","assets/vendor-react-67mgcWXU.js","assets/vendor-supabase-CTlrDMdV.js","assets/vendor-charts-Dck3qfzI.js","assets/vendor-query-PMAhJHCS.js","assets/vendor-motion-CSzk-Fqg.js","assets/index-D4Cg7d-c.css","assets/applyRedlineChange-DAyZGHg9.js"])))=>i.map(i=>d[i]);
2import{d as Me,s as v,D as Pe,aa as Ae,B as U,e as Ve,f as Le,g as Ie,w as le,x as ce,y as de,z as me,A as pe,u as Fe,a0 as Oe,F as He,_ as qe}from"./index-Epr9psQo.js";import{j as e}from"./vendor-radix-BnNg3BH5.js";import{r as o,i as $e,h as Be}from"./vendor-react-67mgcWXU.js";import{D as ze}from"./skeleton-patterns-BEEjmRD3.js";import{C as I,a as Y,b as J,d as F}from"./card-DpKBVi42.js";import{B as K}from"./badge-Cl7apleB.js";import{S as E}from"./separator-C2IB9E9R.js";import{t as ue,i as Ge,u as We,P as Ue,T as xe,M as Ye,a as Je,f as Ke,b as Qe,c as Xe,d as Ze,e as es,g as ss,R as ts}from"./engagementAnalytics-r5BigE_7.js";import"./avatar-DkXZyfFy.js";import{S as as}from"./scroll-area-OnGFamwr.js";import{H as se}from"./history-B94lpOJ0.js";import{A as ge}from"./arrow-right-LjC5fuTq.js";import{f as $}from"./format-Bw8okCdv.js";import{M as he}from"./message-square-7cL_4-It.js";import{m as L}from"./vendor-motion-CSzk-Fqg.js";import{T as rs}from"./triangle-alert-C6ISfBPd.js";import{M as G}from"./index-BMcbOcU5.js";import{r as W}from"./index-BLdMKek_.js";import{C as ns}from"./clock-BYWbH6MV.js";import"./vendor-charts-Dck3qfzI.js";import"./vendor-query-PMAhJHCS.js";import"./vendor-supabase-CTlrDMdV.js";import"./skeleton-CXDkv5zX.js";import"./collapsible-CKRfPF8i.js";import"./index-Jdtl9AIN.js";import"./pen-line-DWItyULb.js";import"./circle-alert-CFN03ksH.js";import"./circle-check-Cv8aCTuA.js";import"./circle-x-HEsvXgN2.js";import"./refresh-cw-j1umLsSM.js";import"./formatDistanceToNow--Gw1Xv78.js";import"./constructNow-LutmP3uJ.js";import"./en-US-DJiZ5LCQ.js";import"./differenceInMonths-ODK8TVL-.js";import"./differenceInCalendarMonths-CBq9QhqA.js";import"./endOfDay-CV7hhp0x.js";import"./endOfMonth-BJH_LSY0.js";import"./differenceInMilliseconds-BS2m-4UB.js";import"./filter-idQrjp7H.js";import"./upload-2-rh2XwF.js";import"./building-2-DODpaxwc.js";import"./metric-DK0Tcl4m.js";import"./dollar-sign-CC-jyV1q.js";import"./users-uAR6_Qvs.js";import"./calendar-Ce69BthR.js";import"./credit-card-rF6FfvWR.js";import"./lock-Nw6CqB2t.js";import"./checkbox-CaPhqoy3.js";import"./plus-DRTmwF2W.js";import"./trending-up-CXZcoU_y.js";import"./trash-2-EIFrPvgK.js";import"./sanitizeHtml-CdEpntpt.js";import"./file-check-Du927KJ7.js";import"./switch-ZTMCvIb3.js";import"./type-I7ngmJ26.js";import"./pen-tool-DJc6Udl0.js";import"./shield-BI9NGrnO.js";import"./vendor-editor-CEJKB4cc.js";/**
3 * @license lucide-react v0.462.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const is=Me("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);function os(d){const[f,m]=o.useState([]),[j,y]=o.useState(!0),s=o.useCallback(async()=>{if(d)try{const{data:x,error:b}=await v.from("proposal_versions").select("*").eq("proposal_id",d).order("version_number",{ascending:!1});if(b)throw b;m((x||[]).map(c=>({...c,snapshot:typeof c.snapshot=="object"?c.snapshot:{}})))}catch(x){console.error("Error fetching versions:",x)}finally{y(!1)}},[d]);return o.useEffect(()=>{s()},[s]),{versions:f,isLoading:j,refresh:s,compareVersions:(x,b)=>{const c=[],l=x.snapshot,i=b.snapshot;l.title!==i.title&&c.push({field:"Title",from:l.title,to:i.title}),l.total_value!==i.total_value&&c.push({field:"Total Value",from:l.total_value,to:i.total_value}),l.status!==i.status&&c.push({field:"Status",from:l.status,to:i.status});const g=l.workstreams?.length||0,u=i.workstreams?.length||0;g!==u&&c.push({field:"Workstreams",from:`${g} phases`,to:`${u} phases`});const C=l.deliverables_list?.length||0,a=i.deliverables_list?.length||0;
7return C!==a&&c.push({field:"Deliverables",from:`${C} items`,to:`${a} items`}),l.msa_content!==i.msa_content&&c.push({field:"MSA Content",from:"Modified",to:"Updated"}),c}}}function ls({proposalId:d,trigger:f}){const{versions:m,isLoading:j,compareVersions:y}=os(d),[s,p]=o.useState(""),[x,b]=o.useState(""),[c,l]=o.useState(!1),i=m.find(a=>a.id===s),g=m.find(a=>a.id===x),u=i&&g?y(i,g):[],C=a=>{l(a),a&&m.length>=2&&!s&&!x&&(p(m[1]?.id||""),b(m[0]?.id||""))};return e.jsxs(Pe,{open:c,onOpenChange:C,children:[e.jsx(Ae,{asChild:!0,children:f||e.jsxs(U,{variant:"outline",size:"sm",children:[e.jsx(is,{className:"h-4 w-4 mr-2"}),"Compare Versions"]})}),e.jsxs(Ve,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Le,{children:e.jsxs(Ie,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-5 w-5"}),"Version History & Comparison"]})}),j?e.jsx("div",{className:"py-12 text-center text-muted-foreground",children:"Loading versions..."}):m.length===0?e.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e.jsx(se,{className:"h-12 w-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:"No version history available yet"}),e.jsx("p",{className:"text-sm mt-1",children:"Versions are created automatically when the proposal status changes"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 py-4 border-b",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"From Version"}),e.jsxs(le,{value:s,onValueChange:p,children:[e.jsx(ce,{children:e.jsx(de,{placeholder:"Select version"})}),e.jsx(me,{children:m.map(a=>e.jsxs(pe,{value:a.id,disabled:a.id===x,children:["v",a.version_number," -"," ",$(new Date(a.created_at),"MMM d, yyyy HH:mm")]},a.id))})]})]}),e.jsx(ge,{className:"h-5 w-5 text-muted-foreground mt-6"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"To Version"}),e.jsxs(le,{value:x,onValueChange:b,children:[e.jsx(ce,{children:e.jsx(de,{placeholder:"Select version"})}),e.jsx(me,{children:m.map(a=>e.jsxs(pe,{value:a.id,disabled:a.id===s,children:["v",a.version_number," -"," ",$(new Date(a.created_at),"MMM d, yyyy HH:mm")]},a.id))})]})]})]}),e.jsxs(as,{className:"flex-1 min-h-0",children:[i&&g?e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(I,{className:"bg-destructive/5 border-destructive/20",children:[e.jsx(Y,{className:"py-3 px-4",children:e.jsxs(J,{className:"text-sm flex items-center justify-between",children:[e.jsxs("span",{children:["Version ",i.version_number]}),e.jsx(K,{variant:"outline",className:"text-xs",children:i.snapshot.status||"draft"})]})}),e.jsxs(F,{className:"py-2 px-4 text-sm text-muted-foreground",children:[e.jsx("p",{children:$(new Date(i.created_at),"MMM d, yyyy 'at' h:mm a")}),i.change_summary&&e.jsx("p",{className:"mt-1 text-xs",children:i.change_summary})]})]}),e.jsxs(I,{className:"bg-success/5 border-success/20",children:[e.jsx(Y,{className:"py-3 px-4",children:e.jsxs(J,{className:"text-sm flex items-center justify-between",children:[e.jsxs("span",{children:["Version ",g.version_number]}),e.jsx(K,{variant:"outline",className:"text-xs",children:g.snapshot.status||"draft"})]})}),e.jsxs(F,{className:"py-2 px-4 text-sm text-muted-foreground",children:[e.jsx("p",{children:$(new Date(g.created_at),"MMM d, yyyy 'at' h:mm a")}),g.change_summary&&e.jsx("p",{className:"mt-1 text-xs",children:g.change_summary})]})]})]}),e.jsxs(I,{children:[e.jsx(Y,{className:"py-3 px-4",children:e.jsxs(J,{className:"text-sm",children:["Changes (",u.length,")"]})}),e.jsx(F,{className:"py-2 px-4",children:u.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No differences detected between these versions"}):e.jsx("div",{className:"space-y-3",children:u.map((a,N)=>e.jsxs("div",{className:"flex items-start gap-4 py-2 border-b last:border-0",children:[e.jsx("span",{className:"text-sm font-medium w-28 flex-shrink-0",children:a.field}),e.jsxs("div",{className:"flex-1 flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"px-2 py-1 rounded bg-destructive/10 text-destructive line-through",children:String(a.from||"—")}),e.jsx(ge,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"px-2 py-1 rounded bg-success/10 text-success",children:String(a.to||"—")})]})]},N))})})]})]}):e.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Select two versions to compare"}),e.jsxs("div",{className:"py-4",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"All Versions"}),e.jsx("div",{className:"space-y-2",children:m.map((a,N)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>{N<m.length-1&&(p(m[N+1]?.id||""),b(a.id))},children:[e.jsxs("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-sm font-bold text-primary",children:["v",a.version_number]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:a.change_summary||`Version ${a.version_number}`}),e.jsx("p",{className:"text-xs text-muted-foreground",children:$(new Date(a.created_at),"MMM d, yyyy 'at' h:mm a")})]}),e.jsx(K,{variant:"secondary",className:"text-xs",children:a.snapshot.status||"draft"})]},a.id))})]})]})]})]})]})}function cs({proposalId:d,clientEmail:f,deviceType:m,enabled:j=!0}){const y=o.useRef(new Map),s=o.useRef(Date.now()),p=o.useRef(null),x=o.useCallback(async()=>
7{if(!j||y.current.size===0)return;const l=Date.now();s.current=l;for(const[i,g]of y.current.entries()){const u=(l-g)/1e3;u>2&&await ue(d,i,Math.round(u),f)}for(const i of y.current.keys())y.current.set(i,l)},[d,f,j]);o.useEffect(()=>{if(!j)return;const l=u=>{for(const C of u){const a=C.target.getAttribute("data-section-id");if(a)if(C.isIntersecting)y.current.has(a)||(y.current.set(a,Date.now()),Ge(d,a,f,m));else{const N=y.current.get(a);if(N){const B=(Date.now()-N)/1e3;B>2&&ue(d,a,Math.round(B),f),y.current.delete(a)}}}};p.current=new IntersectionObserver(l,{threshold:.5,rootMargin:"0px"}),document.querySelectorAll("[data-section-id]").forEach(u=>{p.current?.observe(u)});const g=setInterval(x,3e4);return()=>{p.current?.disconnect(),clearInterval(g),x()}},[d,f,m,j,x]);const b=o.useCallback(l=>{l&&p.current&&p.current.observe(l)},[]),c=o.useCallback(l=>{l&&p.current&&p.current.unobserve(l)},[]);return{observeSection:b,unobserveSection:c,flushTimeData:x}}const ds=new Set(["internal_approver","provider","internal"]),ms=d=>{const f=m=>d.find(j=>j.key===m)?.value||null;return{clientName:f("CLIENT_LEGAL_NAME"),clientEntityType:f("CLIENT_ENTITY_TYPE"),clientState:f("CLIENT_STATE"),clientAddress:f("CLIENT_ADDRESS")}};function ht(){const{token:d}=$e(),[f]=Be(),{toast:m}=Fe(),[j,y]=o.useState(!0),[s,p]=o.useState(null),[x,b]=o.useState([]),[c,l]=o.useState(null),[i,g]=o.useState(null),[u,C]=o.useState(null),[a,N]=o.useState(!1),[B,Q]=o.useState(!1),[w,O]=o.useState(""),[T,H]=o.useState(""),[X,te]=o.useState([]),Z=f.get("signer"),{redlines:ae,isLoading:fe,pendingCount:M,createRedline:_e,updateRedlineStatus:z,addComment:ye}=We(s?.id,d),ve=/Mobi|Android/i.test(navigator.userAgent)?"mobile":"desktop";cs({proposalId:s?.id||"",clientEmail:w||void 0,deviceType:ve,enabled:!!s?.id&&!j}),o.useEffect(()=>{re()},[d]);const re=async()=>{if(d)try{const{data:t,error:n}=await v.functions.invoke("get-public-proposal",{body:{public_token:d}});if(n||!t?.proposal)throw new Error(n?.message||"Proposal not found");const r=t.proposal;await v.from("proposal_views").insert({proposal_id:r.id,ip_address:"anonymous",user_agent:navigator.userAgent}).select().maybeSingle();const k={...r,workstreams:r.workstreams||[],key_personnel:r.key_personnel||[],deliverables_list:r.deliverables_list||[],msa_variables:r.msa_variables||[]};p(k);const D=r.msa_variables||[];D.length>0&&te(D);try{const{data:h,error:A}=await v.functions.invoke("get-proposal-signers",{body:{proposal_id:r.id,public_token:d}});if(!A&&h?.signers){const _=h.signers;if(b(_),Z){O(Z);const V=_.find(q=>q.signer_email.toLowerCase()===Z.toLowerCase());V&&H(V.signer_name)}else{const V=_.find(q=>!ds.has((q.signer_role||"").toLowerCase())&&(q.status==="pending"||q.status==="sent"));V?(O(V.signer_email),H(V.signer_name)):r.signatory_email&&(O(r.signatory_email),r.signatory_name&&H(r.signatory_name))}}else r.signatory_email&&O(r.signatory_email),r.signatory_name&&H(r.signatory_name)}catch(h){Oe.warn("Failed to load signers via edge function:",h),r.signatory_email&&O(r.signatory_email),r.signatory_name&&H(r.signatory_name)}if(r.signed_at&&N(!0),await v.from("proposals").update({viewed_at:new Date().toISOString()}).eq("id",r.id),r.tenant_id){const{data:h}=await v.from("msa_settings").select("*").eq("tenant_id",r.tenant_id).maybeSingle();h&&l(h)}if(r.tenant_id){const{data:h}=await v.from("brand_settings").select("*").eq("tenant_id",r.tenant_id).maybeSingle();h&&g(h)}if(r.tenant_id){const{data:h}=await v.from("tenants").select("name, logo_url").eq("id",r.tenant_id).maybeSingle();h&&C(h)}await v.from("proposal_audit_log").insert({proposal_id:r.id,action:"viewed",actor_type:"client",user_agent:navigator.userAgent})}catch(t){console.error("Error loading proposal:",t),m({title:"Proposal not found",variant:"destructive"})}finally{y(!1)}},je=t=>{s&&p({...s,prospect_logo_url:t})},be=()=>{N(!0),re()},we=async(t,n)=>{if(!s)return;const r=s.workstreams.map(k=>k.id===t?{...k,is_selected:n}:k);p({...s,workstreams:r});try{await v.from("proposals").update({workstreams:r,updated_at:new Date().toISOString()}).eq("id",s.id),await v.from("proposal_audit_log").insert({proposal_id:s.id,action:n?"addon_selected":"addon_deselected",actor_type:"client",actor_email:w||null,details:{workstream_id:t,selected:n}})}catch(k){console.error("Error updating add-on selection:",k),p({...s})}},P=async t=>{s&&await _e({...t,proposal_id:s.id})},Ne=async(t,n)=>{try{const{applyRedlineToDatabase:r,fetchRedlineById:k}=await qe(async()=>{const{applyRedlineToDatabase:h,fetchRedlineById:A}=await import("./applyRedlineToDatabase--8rv26O2.js");return{applyRedlineToDatabase:h,fetchRedlineById:A}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),D=await k(t);D&&await r(D)}catch(r){console.error("Failed to apply redline content change:",r)}await z(t,"accepted",n)},Se=async(t,n)=>{await z(t,"rejected",n)},ke=async(t,n)=>{await z(t,"counter_proposed",n)},Ce=async(t,n)=>{await z(t,"resolved",n)},Te=async(t,n)=>{await ye(t,n,w,T,"client")},De=async t=>{if(s){te(t);try{await v.from("proposals").update({msa_variables:t,updated_at:new Date().toISOString()}).eq("id",s.id)}catch(n){console.error("Error saving MSA variables:",n)}}};if(j)return e.jsx("div",{className:"p-6 space-y-6",children:e.jsx(ze,{})});if(!s)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx(I,{className:"max-w-md w-full mx-4",children:e.jsxs(F,{className:"pt-6 text-center",children:[e.jsx(He,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Proposal Not Found"}),e.jsx("p",{className:"text-muted-foreground",children:"This proposal link may have expired or is invali
7d."})]})})});const ne=s.workstreams.filter(t=>t.is_plan||t.tier_group_id||t.is_optional?t.is_selected:!0),Re=ne.reduce((t,n)=>t+(n.hours||0),0),ie=s.project_cap||s.total_value||0,oe=ne.filter(t=>t.pricing_model==="retainer").map(t=>t.retainer_months||0).reduce((t,n)=>Math.max(t,n),0),Ee=s.estimated_duration||(oe>0?`${oe} months`:`${Re} hours`),S=s.content_locked||s.proposal_status==="signed",R=(s.proposal_status==="in_review"||s.proposal_status==="negotiation"||s.proposal_status==="sent_for_signature")&&!S,ee=s.valid_until&&new Date(s.valid_until)<new Date;return e.jsxs("div",{className:"min-h-screen bg-muted/30",children:[e.jsx(Ue,{providerLogo:s.provider_logo_url||i?.logo_primary_url||u?.logo_url,providerName:c?.company_legal_name||i?.brand_name||u?.name||"Provider",prospectLogo:s.prospect_logo_url,prospectName:s.client_legal_name||"Client",proposalId:s.id,proposalTitle:s.title,isSigned:a,isLocked:S,onLogoFetched:je}),(R||M>0)&&e.jsx("div",{className:"fixed bottom-6 right-6 z-30",children:e.jsxs(U,{size:"lg",onClick:()=>Q(!0),className:"shadow-lg",children:[e.jsx(he,{className:"h-5 w-5 mr-2"}),"Redlines",M>0&&e.jsx(K,{variant:"secondary",className:"ml-2",children:M})]})}),e.jsxs("main",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-8 space-y-8",children:[ee&&e.jsxs(L.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"flex items-center gap-3 p-4 rounded-lg bg-destructive/10 border border-destructive/20",children:[e.jsx(rs,{className:"h-5 w-5 text-destructive flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-destructive",children:"This proposal has expired"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please contact the sender for an updated proposal."})]})]}),M>0&&!S&&e.jsxs(L.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"flex items-center justify-between gap-3 p-4 rounded-lg bg-warning/10 border border-warning/20",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(he,{className:"h-5 w-5 text-warning flex-shrink-0"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[M," redline",M!==1?"s":""," pending review"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your change requests are being reviewed by the provider."})]})]}),e.jsx(U,{variant:"outline",size:"sm",onClick:()=>Q(!0),children:"View All"})]}),s.description&&e.jsx(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.05},"data-section-id":"description",children:e.jsx(I,{className:"border-primary/20 bg-gradient-to-br from-primary/5 via-background to-primary/5 shadow-lg",children:e.jsx(F,{className:"py-8 px-6 sm:px-10",children:R?e.jsx(xe,{sectionType:"description",canRedline:!0,onCreateRedline:P,userEmail:w,userName:T,userRole:"client",children:e.jsx("div",{className:"prose prose-sm sm:prose-base dark:prose-invert max-w-none text-foreground",children:e.jsx(G,{remarkPlugins:[W],children:s.description})})}):e.jsx("div",{className:"prose prose-sm sm:prose-base dark:prose-invert max-w-none text-foreground",children:e.jsx(G,{remarkPlugins:[W],children:s.description})})})})}),X.length>0&&!a&&e.jsxs(e.Fragment,{children:[e.jsx(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},children:e.jsx(Ye,{variables:X,prospectData:{company_name:s.client_legal_name},signingDate:new Date,onChange:De,isLocked:S||a})}),e.jsx(E,{className:"my-8"})]}),e.jsx("div",{"data-section-id":"summary",children:e.jsx(Je,{workstreams:s.workstreams||[],baseInvestment:ie,duration:Ee,teamMembersCount:s.key_personnel?.length||0,startDate:s.effective_date,paymentTerms:Ke({billingTiming:s.billing_timing,netTermsDays:s.net_terms_days,fixedBillingTiming:s.fixed_billing_timing,fixedNetTermsDays:s.fixed_net_terms_days,tmBillingTiming:s.tm_billing_timing,tmNetTermsDays:s.tm_net_terms_days})})}),e.jsx(E,{className:"my-8"}),e.jsx("div",{"data-section-id":"sow",children:e.jsx(Qe,{workstreams:s.workstreams,tierGroups:(()=>{const t=s.tier_groups;return Array.isArray(t)?t:[]})(),commercialModel:s.commercial_model,showRates:!1,canRedline:R,isLocked:S,userEmail:w,userName:T,userRole:"client",onCreateRedline:P,onToggleAddOn:S?void 0:we,onSelectTier:S?void 0:async(t,n)=>{if(!s)return;const r=s.tier_groups,D=(Array.isArray(r)?r:[]).find(_=>_.id===t),h=!D||D.selection_mode==="pick_one",A=s.workstreams.map(_=>_.tier_group_id===t?h?{..._,is_selected:_.id===n}:_.id===n?{..._,is_selected:!_.is_selected}:_:_);p({...s,workstreams:A});try{await v.from("proposals").update({workstreams:A,updated_at:new Date().toISOString()}).eq("id",s.id),await v.from("proposal_audit_log").insert({proposal_id:s.id,action:"tier_selected",actor_type:"client",actor_email:w||null,details:{group_id:t,workstream_id:n}})}catch(_){console.error("Error updating tier selection:",_)}},isClientView:!0})}),s.deliverables_list&&s.deliverables_list.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"my-8"}),e.jsx("div",{"data-section-id":"deliverables",children:e.jsx(Xe,{deliverables:(s.deliverables_list||[]).filter(t=>{if(!t.workstream_id)return!0;const n=(s.workstreams||[]).find(r=>r.id===t.workstream_id);return n&&n.is_plan?n.is_selected:!0}),workstreams:(s.workstreams||[]).filter(t=>!t.is_plan||t.is_selected).map(t=>({id:t.id,name:t.name,is_optional:t.is_optional})),canRedline:R,isLocked:S,userEmail:w,userName:T,userRole:"client",onCreateRedline:P})})]}),s.key_personnel&&s.key_personnel.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"my-8"}),e.jsx("div",{"data-section-id":"team",children:e.jsx(Ze,{team:s.key_personnel})})]}),s.assumptions&&e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"my-8"}),e.jsx(L.div,{initial:{opacity:0,y:20}
7,animate:{opacity:1,y:0},transition:{delay:.5},"data-section-id":"assumptions",children:e.jsxs(I,{children:[e.jsx(Y,{children:e.jsx(J,{children:"Assumptions & Exclusions"})}),e.jsx(F,{children:R?e.jsx(xe,{sectionType:"assumptions",canRedline:!0,onCreateRedline:P,userEmail:w,userName:T,userRole:"client",children:e.jsx("div",{className:"text-muted-foreground leading-relaxed prose prose-sm dark:prose-invert max-w-none",children:e.jsx(G,{remarkPlugins:[W],children:s.assumptions})})}):e.jsx("div",{className:"text-muted-foreground leading-relaxed prose prose-sm dark:prose-invert max-w-none",children:e.jsx(G,{remarkPlugins:[W],children:s.assumptions})})})]})})]}),e.jsx(E,{className:"my-8"}),e.jsx("div",{"data-section-id":"msa",children:(()=>{const t=ms(X);return e.jsx(es,{msaContent:s.msa_content,msaSections:s.msa_sections,partyDetails:{providerName:c?.company_legal_name||i?.brand_name||u?.name,providerEntityType:c?.entity_type,providerState:c?.state_of_formation,providerAddress:c?.company_address,clientName:t.clientName||s.client_legal_name,clientEntityType:t.clientEntityType||void 0,clientState:t.clientState||void 0,clientAddress:t.clientAddress||void 0},isLocked:S,canRedline:R,pendingRedlinesCount:ae.filter(n=>n.section_type==="msa"&&n.status==="pending").length,userEmail:w,userName:T,userRole:"client",onCreateRedline:P})})()}),e.jsx(E,{className:"my-8"}),s.valid_until&&!ee&&(()=>{const t=Math.ceil((new Date(s.valid_until).getTime()-Date.now())/864e5);return t<=14?e.jsxs(L.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex items-center gap-3 p-4 rounded-lg border ${t<=3?"bg-destructive/10 border-destructive/20":"bg-warning/10 border-warning/20"}`,children:[e.jsx(ns,{className:`h-5 w-5 flex-shrink-0 ${t<=3?"text-destructive":"text-warning"}`}),e.jsxs("div",{children:[e.jsx("p",{className:`font-medium ${t<=3?"text-destructive":"text-warning"}`,children:t<=1?"Expires today":`Expires in ${t} days`}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This proposal is valid until ",new Date(s.valid_until).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]})]}):null})(),!ee&&e.jsx("div",{"data-section-id":"signature",children:e.jsx(ss,{proposalId:s.id,isSigned:a,isLocked:S,signers:x,prefillName:s.signatory_name||"",prefillCompany:s.client_legal_name,currentSignerEmail:w,publicToken:d||void 0,onSignComplete:be,proposalData:{id:s.id,title:s.title,workstreams:s.workstreams,total_value:ie},providerName:c?.company_legal_name||i?.brand_name||u?.name||"Provider",prospectName:s.client_legal_name||"Client",tenantId:s.tenant_id||void 0,alwaysShowDualParty:!0})})]}),e.jsx(ts,{redlines:ae,isLoading:fe,isOpen:B,onClose:()=>Q(!1),isInternal:!1,currentUserEmail:w,currentUserName:T,onAccept:Ne,onReject:Se,onCounter:ke,onResolve:Ce,onAddComment:Te,onSubmitGeneralFeedback:R?async t=>{await P({section_type:"general",change_type:"comment",proposed_change:t,created_by_email:w,created_by_name:T,created_by_role:"client"})}:void 0}),e.jsx("footer",{className:"border-t bg-background py-6 mt-12",children:e.jsx("div",{className:"max-w-5xl mx-auto px-4 sm:px-6",children:e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("p",{children:[c?.company_legal_name||i?.brand_name||"Provider"," ·"," ",new Date().getFullYear()]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ls,{proposalId:s.id,trigger:e.jsxs(U,{variant:"ghost",size:"sm",className:"text-muted-foreground",children:[e.jsx(se,{className:"h-4 w-4 mr-1"}),"Version History"]})}),e.jsx("span",{children:"Powered by CommandOS"})]})]})})})]})}export{ht 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.