PageSourceSearch

https://app.draftyai.com/static/js/3026.204f48b8.chunk.js

js draftyai.com collected 2026-10-05 09:44:54 UTC 15,663 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkdraftyai_frontend=globalThis.webpackChunkdraftyai_frontend||[]).push([[3026],{1057(e,t,r){r.d(t,{W$:()=>m,kU:()=>h,mI:()=>x,tx:()=>u});var s=r(9950),a=r(8970),n=r(6243),i=r(4414);const l="flag_override_",o="draftyai:integration-flag-override-change",d=()=>{if(!n.Ay.isStaging||"undefined"===typeof window)return{};const e={};try{for(let t=0;t<window.sessionStorage.length;t+=1){const r=window.sessionStorage.key(t);if(!r||!r.startsWith(l))continue;const s=window.sessionStorage.getItem(r);"true"!==s&&"false"!==s||(e[r.slice(14)]="true"===s)}}catch{}return e},c=(0,s.createContext)({overrides:{},setOverride:()=>{},clearOverride:()=>{}}),m=e=>{let{children:t}=e;const[r,a]=(0,s.useState)(d);(0,s.useEffect)(()=>{if(!n.Ay.isStaging||"undefined"===typeof window)return;const e=e=>{e&&e.detail&&"object"===typeof e.detail&&a(e.detail)};return window.addEventListener(o,e),()=>window.removeEventListener(o,e)},[]);const m=(0,s.useCallback)((e,t)=>{n.Ay.isStaging&&e&&"boolean"===typeof t&&a(r=>{const s={...r,[e]:t};try{window.sessionStorage.setItem(l+e,String(t))}catch{}try{window.dispatchEvent(new CustomEvent(o,{detail:s}))}catch{}return s})},[]),u=(0,s.useCallback)(e=>{n.Ay.isStaging&&e&&a(t=>{if(!(e in t))return t;const r={...t};delete r[e];try{window.sessionStorage.removeItem(l+e)}catch{}try{window.dispatchEvent(new CustomEvent(o,{detail:r}))}catch{}return r})},[]),x=(0,s.useMemo)(()=>({overrides:r,setOverride:m,clearOverride:u}),[r,m,u]);return(0,i.jsx)(c.Provider,{value:x,children:t})},u=e=>{if(n.Ay.isStaging){if("undefined"!==typeof window)try{const t=window.sessionStorage.getItem(l+e);if("true"===t)return!0;if("false"===t)return!1}catch{}return!0}try{return Boolean(a.default.isFeatureEnabled(e))}catch{return!1}},x=e=>{const{overrides:t}=(0,s.useContext)(c);if(n.Ay.isStaging){const r=t[e];return"boolean"===typeof r?r:u(e)}return u(e)},h=()=>{const{overrides:e,setOverride:t,clearOverride:r}=(0,s.useContext)(c);return{overrides:e,setOverride:t,clearOverride:r}}},4214(e,t,r){r.d(t,{fm:()=>a});function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();const r=function(e){if(!e)return null;const t=String(e),r=/(z|[+-]\d{2}:?\d{2})$/i.test(t),s=new Date(r?t:`${t}Z`);return Number.isNaN(s.getTime())?null:s}(e);if(!r)return null;const s=t instanceof Date?t.getTime():t;return Math.max(0,Math.ceil((r.getTime()-s)/864e5))}function a(e){const t=s(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now());return null===t?"":0===t?"Permanently deleted soon":1===t?"Permanently deleted in 1 day":`Permanently deleted in ${t} days`}},4377(e,t,r){r.d(t,{A:()=>c});var s=r(9950),a=r(7088),n=r(1139),i=r(7733),l=r(4414);const o=["Contacts","Matters"],d=()=>(0,l.jsx)("svg",{className:"w-4 h-4 text-green-500",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),c=(0,a.WQ)("store")((0,a.PA)(e=>{var t,r;let{store:a,isOpen:c,onClose:m}=e;
1const[u,x]=(0,s.useState)(0),[h,p]=(0,s.useState)([]),[g,y]=(0,s.useState)([]),[f,b]=(0,s.useState)(new Set),[v,w]=(0,s.useState)(new Set),[j,_]=(0,s.useState)(""),[N,C]=(0,s.useState)(!1),[k,S]=(0,s.useState)(!1),[L,A]=(0,s.useState)(null),[I,$]=(0,s.useState)(!0),[M,O]=(0,s.useState)(1),[U,B]=(0,s.useState)(1),[E,W]=(0,s.useState)(!1),[z,D]=(0,s.useState)(!1),P=(0,s.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;C(!0);try{const t=await a.fetchClioContacts(e);p(1===e?t.contacts:e=>[...e,...t.contacts]),W(t.has_next),O(e)}catch{}finally{C(!1)}},[a]),F=(0,s.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;C(!0);try{const t=await a.fetchClioMatters(e);y(1===e?t.matters:e=>[...e,...t.matters]),D(t.has_next),B(e)}catch{}finally{C(!1)}},[a]);(0,s.useEffect)(()=>{c&&(A(null),b(new Set),w(new Set),_(""),P(1),F(1))},[c,P,F]);const T=(0,s.useMemo)(()=>{if(!j)return h;const e=j.toLowerCase();return h.filter(t=>{var r,s,a;return(null===(r=t.name)||void 0===r?void 0:r.toLowerCase().includes(e))||(null===(s=t.first_name)||void 0===s?void 0:s.toLowerCase().includes(e))||(null===(a=t.last_name)||void 0===a?void 0:a.toLowerCase().includes(e))})},[h,j]),R=(0,s.useMemo)(()=>{if(!j)return g;const e=j.toLowerCase();return g.filter(t=>{var r,s,a,n;return(null===(r=t.description)||void 0===r?void 0:r.toLowerCase().includes(e))||(null===(s=t.display_number)||void 0===s?void 0:s.toLowerCase().includes(e))||(null===(a=t.client_name)||void 0===a?void 0:a.toLowerCase().includes(e))||(null===(n=t.practice_area)||void 0===n?void 0:n.toLowerCase().includes(e))})},[g,j]),H=f.size+v.size;return(0,l.jsx)(n.A,{isOpen:c,onClose:m,maxWidth:"4xl",disableBackdropClose:k,children:(0,l.jsxs)("div",{className:"bg-white rounded-2xl max-h-[85vh] flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-100",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Import from Clio"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Select contacts and matters to import into DraftyAI"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("button",{onClick:()=>{P(1),F(1)},disabled:N||k,title:"Refresh from Clio",className:"p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors disabled:opacity-50",children:(0,l.jsx)("svg",{className:"w-5 h-5 "+(N?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,l.jsx)("button",{onClick:m,disabled:k,className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,l.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,l.jsx)("div",{className:"flex border-b border-gray-100 px-6",children:o.map((e,t)=>(0,l.jsxs)("button",{onClick:()=>{x(t),_("")},className:"px-4 py-3 text-sm font-medium border-b-2 transition-colors "+(u===t?"border-blue-600 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"),children:[e,0===t&&f.size>0&&(0,l.jsx)("span",{className:"ml-2 px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded-full",children:f.size}),1===t&&v.size>0&&(0,l.jsx)("span",{className:"ml-2 px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded-full",children:v.size})]},e))}),(0,l.jsx)("div",{className:"px-6 pt-4",children:(0,l.jsx)(i.A,{type:"text",value:j,onChange:e=>_(e.target.value),placeholder:0===u?"Search contacts...":"Search matters...",className:"py-2.5 text-sm"})}),(0,l.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-3 min-h-[300px]",children:N&&0===h.length&&0===g.length?(0,l.jsxs)("div",{className:"flex items-center justify-center h-48 text-gray-400",children:[(0,l.jsxs)("svg",{className:"animate-spin w-6 h-6 mr-2",fill:"none",viewBox:"0 0 24 24",children:[(0,l.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,l.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading from Clio..."]}):0===u?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,l.jsx)("button",{onClick:()=>{const e=T.filter(e=>!e.already_imported);e.every(e=>f.has(e.clio_id))?b(new Set):b(new Set(e.map(e=>e.clio_id)))},className:"text-xs text-blue-600 hover:text-blue-700 font-medium",children:T.filter(e=>!e.already_imported).every(e=>f.has(e.clio_id))&&T.filter(e=>!e.already_imported).length>0?"Deselect All":"Select All"}),(0,l.jsxs)("span",{className:"text-xs text-gray-400",children:[T.length," contacts"]})]}),T.map(e=>(0,l.jsxs)("div",{onClick:()=>{return!e.already_imported&&(t=e.clio_id,void b(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}));var t},className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 cursor-pointer transition-colors "+(e.already_imported?"bg-gray-50 opacity-60 cursor-default":f.has(e.clio_id)?"bg-blue-50 border border-blue-200":"hover:bg-gray-50"),children:[(0,l.jsx)("input",{type:"checkbox",checked:e.already_imported||f.has(e.clio_id),disabled:e.already_imported,onChange:()=>{},className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate",children:e.name||`${e.first_name} ${e.last_name}`}),e.date_of_birth&&(0,l.jsxs)("p",{className:"text-xs text-gray-400",children:["DOB: ",e.date_of_birth]})]}),e.already_imported&&(0,l.jsxs)("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[(0,l.jsx)(d,{})," Imported"]})]},e.clio_id)),E&&(0,l.jsx)("button",{onClick:()=>P(M+1),disabled:N,className:"w-full py-2 text-sm text-blue-600 hover:text-blue-700 font-medium",children:N?"Loa
1ding...":"Load More"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,l.jsx)("button",{onClick:()=>{const e=R.filter(e=>!e.already_imported);e.every(e=>v.has(e.clio_id))?w(new Set):w(new Set(e.map(e=>e.clio_id)))},className:"text-xs text-blue-600 hover:text-blue-700 font-medium",children:R.filter(e=>!e.already_imported).every(e=>v.has(e.clio_id))&&R.filter(e=>!e.already_imported).length>0?"Deselect All":"Select All"}),(0,l.jsxs)("span",{className:"text-xs text-gray-400",children:[R.length," matters"]})]}),R.map(e=>(0,l.jsxs)("div",{onClick:()=>{return!e.already_imported&&(t=e.clio_id,void w(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r}));var t},className:"flex items-center gap-3 px-4 py-3 rounded-lg mb-1 cursor-pointer transition-colors "+(e.already_imported?"bg-gray-50 opacity-60 cursor-default":v.has(e.clio_id)?"bg-blue-50 border border-blue-200":"hover:bg-gray-50"),children:[(0,l.jsx)("input",{type:"checkbox",checked:e.already_imported||v.has(e.clio_id),disabled:e.already_imported,onChange:()=>{},className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate",children:e.description||e.display_number||`Matter #${e.clio_id}`}),e.status&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-xs bg-gray-100 text-gray-600 rounded",children:e.status})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[e.client_name&&(0,l.jsx)("span",{className:"text-xs text-gray-500",children:e.client_name}),e.practice_area&&(0,l.jsxs)("span",{className:"text-xs text-gray-400",children:["| ",e.practice_area]})]}),!e.client_imported&&e.client_clio_id&&(0,l.jsx)("p",{className:"text-xs text-amber-600 mt-0.5",children:"Client will be auto-imported"})]}),e.already_imported&&(0,l.jsxs)("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[(0,l.jsx)(d,{})," Imported"]})]},e.clio_id)),z&&(0,l.jsx)("button",{onClick:()=>F(U+1),disabled:N,className:"w-full py-2 text-sm text-blue-600 hover:text-blue-700 font-medium",children:N?"Loading...":"Load More"})]})}),L&&(0,l.jsxs)("div",{className:"mx-6 mb-3 p-4 rounded-lg text-sm "+((null===(t=L.errors)||void 0===t?void 0:t.length)>0&&!L.contacts_imported&&!L.matters_imported?"bg-red-50 text-red-700":"bg-green-50 text-green-700"),children:[L.contacts_imported>0&&(0,l.jsxs)("p",{children:[L.contacts_imported," contact(s) imported"]}),L.matters_imported>0&&(0,l.jsxs)("p",{children:[L.matters_imported," matter(s) imported"]}),L.documents_imported>0&&(0,l.jsxs)("p",{children:[L.documents_imported," document(s) imported"]}),L.contacts_skipped>0&&(0,l.jsxs)("p",{className:"text-gray-500",children:[L.contacts_skipped," contact(s) already existed"]}),L.matters_skipped>0&&(0,l.jsxs)("p",{className:"text-gray-500",children:[L.matters_skipped," matter(s) already existed"]}),null===(r=L.errors)||void 0===r?void 0:r.map((e,t)=>(0,l.jsx)("p",{className:"text-red-600",children:e},t))]}),(0,l.jsxs)("div",{className:"flex items-center justify-between p-6 border-t border-gray-100 bg-gray-50 rounded-b-2xl",children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,l.jsx)("input",{type:"checkbox",checked:I,onChange:e=>$(e.target.checked),className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),"Include documents"]}),(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("button",{onClick:m,disabled:k,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50",children:"Cancel"}),(0,l.jsx)("button",{onClick:async()=>{S(!0),A(null);try{const e=await a.importFromClio({contact_ids:[...f],matter_ids:[...v],include_documents:I,import_contacts_for_matters:!0});A(e),P(1),F(1),a.getAllClients&&a.getAllClients()}catch(e){A({errors:[e.message||"Import failed"]})}finally{S(!1)}},disabled:k||0===H,className:"px-5 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:k?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("svg",{className:"animate-spin w-4 h-4",fill:"none",viewBox:"0 0 24 24",children:[(0,l.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,l.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Importing..."]}):"Import "+(H>0?`(${H})`:"")})]})]})]})})}))},947(e,t,r){r.d(t,{A:()=>
1o});var s=r(9950),a=r(7088);const n={admin:"admin",attorney:"attorney",paralegal:"paralegal",staff:"staff"},i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Created by",{showRole:r=!0,selfLabel:s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;let a=(e=>{if(!e)return null;if(e.is_self)return"you";const t=e.email||"";if(!t)return`User #${e.id}`;const r=t.split("@")[0];return r?r.split(/[._-]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):t})(e);e.is_self&&s&&(a=s);return`${t} ${a}${r?(e=>{if(!e)return"";const t=String(e).toLowerCase();return` (${n[t]||t})`})(e.role):""}`.trim()};var l=r(4414);const o=(0,a.WQ)("store")((0,a.PA)(e=>{let{store:t,userId:r,attorneyId:a,prefix:n="Created by",className:o="",emptyLabel:d="\u2014",tooltipEmail:c=!0,showRole:m=!0}=e;const u=null!=r||null!=a;if((0,s.useEffect)(()=>{t.isLoggedIn&&u&&!t.orgUsersLoaded&&!t.orgUsersLoading&&t.fetchOrgUsers()},[t.isLoggedIn,u,t.orgUsersLoaded,t.orgUsersLoading,t]),!u)return(0,l.jsx)("span",{className:`text-gray-400 ${o}`,"aria-label":"Pre-org row",children:d});let x=null;if(null!=r&&t.getOrgUserById&&(x=t.getOrgUserById(r)),!x&&null!=a&&t.getOrgUserByAttorneyId&&(x=t.getOrgUserByAttorneyId(a)),!x){if(!t.orgUsersLoaded)return(0,l.jsxs)("span",{className:`text-gray-400 ${o}`,"aria-busy":"true",children:[n," \u2026"]});const e=null!=r?`User #${r}`:`Attorney #${a}`;return(0,l.jsxs)("span",{className:`text-gray-500 ${o}`,title:e,children:[n," unknown user"]})}const h=i(x,n,{showRole:m});return(0,l.jsx)("span",{className:`text-gray-600 ${o}`,title:c?x.email:void 0,children:h})}))}}]);

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.