PageSourceSearch

https://vizops360.ai/assets/useSalesTeamEmployees-B4P2K3K2.js

js vizops360.ai collected 2026-10-05 13:50:28 UTC 4,486 bytes, 1 lines download raw bytes

1import{r as y,iv as k,di as U}from"./index-CpeGhXo5.js";import{m as N,t as A}from"./orgTree-_S0Xal9w.js";function C(e){return e.userId??e.id}function g(e){return[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||C(e)}function K(e){return e&&`${e.firstName?.[0]??""}${e.lastName?.[0]??""}`.toUpperCase()||"?"}function S(e,t){if(!t)return;const i=t.trim().toLowerCase();return e.find(a=>{if(!a)return!1;const c=(a.userId??"").trim().toLowerCase();if(c&&c===i)return!0;const r=(a.id??"").trim().toLowerCase();if(r&&r===i)return!0;const s=(C(a)??"").trim().toLowerCase();if(s&&s===i)return!0;const n=(a.authUserId??"").trim().toLowerCase();if(n&&n===i)return!0;const u=(a.employeeId??"").trim().toLowerCase();if(u&&u===i)return!0;const d=(a.workEmail??a.email??"").trim().toLowerCase();return!!(d&&d===i)})}function L(e){return e?.trim().toLowerCase()||""}function E(e){return g(e).trim().toLowerCase().replace(/\s+/g," ")}function $(e){const t=(r,s)=>{const n={...r,...s,avatar:r.avatar||s.avatar||null,empCode:r.empCode||s.empCode||"",userId:r.userId||s.userId||r.authUserId||s.authUserId||r.id||s.id,id:r.id||s.id,workEmail:r.workEmail||s.workEmail||"",designation:r.designation||s.designation||"",status:r.status||s.status||"Active",firstName:r.firstName||s.firstName,lastName:r.lastName||s.lastName};return(r.authUserId||s.authUserId)&&(n.authUserId=r.authUserId||s.authUserId),(r.employeeId||s.employeeId)&&(n.employeeId=r.employeeId||s.employeeId),n},i=r=>{const s=[],n=r.id?.trim(),u=r.userId?.trim(),d=C(r)?.trim(),h=r.authUserId?.trim(),m=r.employeeId?.trim();n&&s.push(`id:${n.toLowerCase()}`),u&&s.push(`uid:${u.toLowerCase()}`),d&&s.push(`uid:${d.toLowerCase()}`),h&&s.push(`uid:${h.toLowerCase()}`),m&&s.push(`id:${m.toLowerCase()}`);const I=L(r.workEmail||r.email);return I&&s.push(`em:${I}`),s},a=[],c=new Map;for(const r of e){const s=i(r);let n=-1;for(const u of s){const d=c.get(u);if(d!==void 0){n=d;break}}if(n===-1){const u=E(r),d=L(r.workEmail);u&&(n=a.findIndex(h=>{if(E(h)!==u)return!1;const m=L(h.workEmail);return d&&m?d===m:!d||!m}))}if(n===-1){const u=a.length;a.push(r);for(const d of s)c.set(d,u);continue}a[n]=t(a[n],r);for(const u of i(a[n]))c.set(u,n)}return a.sort((r,s)=>g(r).localeCompare(g(s)))}function f(e){if(!e)return!1;const t=e.toLowerCase().trim();return t.includes("sales")||t.includes("business development")||t.includes("pre-sales")||t.includes("presales")||t==="growth"||t==="gro"||t==="bde"||t==="bda"||t==="bd"||t.startsWith("bd ")||t.endsWith(" bd")||t.includes(" bd ")}function T(e){if(!e)return!0;const t=e.toLowerCase().trim();return t==="active"||t==="probation"||t==="confirmed"}function x(e){if(!e)return!0;const t=e.toLowerCase().trim();return T(t)||t==="on leave"||t==="notice period"}function M(e,t){if(!e)return!1;if(e.departments&&Array.isArray(e.departments)){for(const i of e.departments)if(typeof i=="string"){if(f(i)||t&&t.has(i))return!0}else if(i&&typeof i=="object"&&(t&&i.departmentId&&t.has(i.departmentId)||t&&i.id&&t.has(i.id)||f(i.departmentName)||f(i.name)))return!0}return!!(e.departmentId&&t&&t.has(e.departmentId)||f(e.departmentName)||f(e.department)||f(e.departmentLabel)||f(e.department?.name)||f(e.rawData?.Department)||f(e.rawData?.department)||f(e.designation)||f(e.jobTitle)||f(e.role))}const F=[];function O(e){const t=(e?.includeUserIds??[]).join("|"),i=y.useMemo(()=>[...new Set((e?.includeUserIds??[]).filter(Boolean))],[t]),a=e?.skip===!0,{data:c,isLoading:r,isFetching:s}=k(void 0,{skip:a}),n=c??F,{data:u,isLoading:d,isFetching:h}=U({limit:5e3},{skip:a}),m=u?.items??[],I=y.useMemo(()=>{const w=m.filter(p=>x(p.status));return new Set(N(w.map(A)).map(p=>p.id))},[m]);return{employees:y.useMemo(()=>{const w=new Map;for(const o of m)o.userId&&w.set(o.userId.toLowerCase(),o),o.id&&w.set(o.id.toLowerCase(),o);const p=[];for(const o of n){if(o.hasSalesAccess!==!0||o.assignmentActive===!1||o.employmentActive===!1)continue;const l=w.get(o.userId.toLowerCase());l&&p.push({...l,avatar:l.avatar||o.avatar})}const v=new Set(n.filter(o=>o.assignmentActive===!1).map(o=>o.userId.toLowerCase()));for(const o of m)!o.id||!I.has(o.id)||o.userId&&v.has(o.userId.toLowerCase())||p.push(o);for(const o of i){const l=S(m,o);l&&p.push(l)}return $(p).sort((o,l)=>`${o.firstName??""} ${o.lastName??""}`.trim().localeCompare(`${l.firstName??""} ${l.lastName??""}`.trim()))},[m,i,I,n]),salesTeam:n,isEmployeeInSales:M,isLoading:r||d,isFetching:s||h}}export{g as a,K as b,$ as d,C as e,S as f,T as i,O as u};

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.