PageSourceSearch

https://new.proline.app/assets/directorii-kOG5yjzO.js

js proline.app collected 2026-10-04 20:09:02 UTC 7,747 bytes, 1 lines download raw bytes

1import{o as r,p as s,w as v,q as V,r as g,t as c,j as a,s as k,bM as L,bJ as $,B as G,a1 as f,bh as q,bi as H,bj as J,bk as Q,bm as _,cm as Y}from"./index-CcCY4UFy.js";import{A as Z,b as z}from"./alert-DrCasA9D.js";import{S as X}from"./webhook-builder-types-DIxiS9QC.js";import{I as ee}from"./integration-card-CWd3pWMW.js";import{I as ae}from"./integration-page-layout-BpEUC5Zy.js";import{a as te,C as se}from"./credential-display-C4_Kltlb.js";import{C as oe}from"./circle-alert-CzERthCN.js";import{P as re}from"./plug-zap-CUomH3U9.js";import"./circle-x-CtQkVlk3.js";function he(){const t=r(s.crud.directoriiConfigs.getByCompany),i=v(s.integrations.directorii.auth.ensureSetup),u=v(s.integrations.directorii.auth.enableIntegration),p=v(s.integrations.directorii.auth.disableIntegration),m=V(s.crud.directoriiConfigs.updateConfig),o=r(s.crud.workflows.getByCompany,{}),j=r(s.crud.pipelines.getWithStages,{type:"Project"}),y=r(s.crud.users.getByCompany,{}),x=r(s.crud.services.getByCompany,{}),C=r(s.crud.projectCategories.getByCompany,{}),N=r(s.crud.projectTypes.getByCompany,{}),I=r(s.crud.projectTags.getByCompany),S=r(s.crud.contactTypes.getByCompany,{}),w=r(s.crud.leadSources.getByCompany,{}),T=r(s.crud.tags.getByType,{type:"contact"}),[D,h]=g.useState(!1),[A,B]=g.useState(!1),M=t!=null,O=t===void 0||o===void 0||j===void 0||y===void 0||x===void 0||C===void 0||N===void 0||I===void 0||S===void 0||w===void 0||T===void 0,W=g.useMemo(()=>(o??[]).filter(e=>e.type==="project").sort((e,l)=>e.name.localeCompare(l.name)).map(e=>({value:e._id,label:e.name})),[o]),F=g.useMemo(()=>(j??[]).flatMap(e=>e.stages.map(l=>({value:l._id,label:`${e.name} / ${l.name}`}))),[j]),b=t?.webhookApiKey,R=`${X}/webhooks/directorii`;g.useEffect(()=>{t===void 0||A||t?.webhookApiKey||(B(!0),i().then(e=>{e.success||c.error(e.error??"Failed to prepare Directorii setup")}))},[t,i,A]);const K=async()=>{h(!0);try{const e=await u();if(!e.success){c.error(e.error??"Failed to enable Directorii integration");return}c.success("Directorii integration enabled")}catch(e){c.error(e instanceof Error?e.message:"Failed to enable Directorii integration")}finally{h(!1)}},U=async()=>{if(confirm("Disable Directorii? Your settings will be preserved, but new Directorii leads will stop creating contacts and projects until you re-enable it.")){h(!0);try{const e=await p();if(!e.success){c.error(e.error??"Failed to disable Directorii");return}c.success("Directorii disabled")}catch(e){c.error(e instanceof Error?e.message:"Failed to disable Directorii")}finally{h(!1)}}},n=async e=>{try{await m(e),c.success("Saved")}catch(l){c.error(l instanceof Error?l.message:"Failed to save")}};return O?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(k,{className:"h-6 w-6 animate-spin"})}):a.jsx(ae,{title:"Directorii",description:"Automatically send new Directorii leads into a ProLine Speed-To-Lead workflow.",children:a.jsx(ee,{title:"Directorii Integration",description:"Copy the webhook and token below, then configure how Directorii leads should be routed in ProLine.",isConfigured:M,isActive:t?.isActive??!1,children:D?a.jsxs("div",{className:"flex items-center gap-2 py-4",children:[a.jsx(k,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{children:"Updating Directorii..."})]}):a.jsxs("div",{className:"space-y-5",children:[a.jsxs("section",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-base font-semibold",children:"Step 1: Add the Webhook to Directorii"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Copy the webhook and token below. On the Webhooks page of Directorii input these values into the provided fields."})]}),a.jsx(P,{label:"Webhook URL",value:R}),a.jsx(P,{label:"Token",value:b,displayValue:b?te(b):void 0,placeholder:"Preparing token..."})]}),t?.lastError?a.jsxs(Z,{variant:"destructive",children:[a.jsx(oe,{className:"h-4 w-4"}),a.jsxs(z,{children:["Last error: ",t?.lastError]})]}):null,a.jsxs("section",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-base font-semibold",children:"Step 2. Configure Integration"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Set integration rules for ProLine projects and contacts created by Directorii."})]}),a.jsx(d,{label:"Workflow",noneLabel:"No Workflow",value:t?.integrationWorkflowId??void 0,options:W,onChange:e=>n({integrationWorkflowId:e??null})}),a.jsx(d,{label:"Assigned Team Member",noneLabel:"Account Owner",value:t?.assigneeId??void 0,options:(y??[]).sort((e,l)=>L(e).localeCompare(L(l))).map(e=>({value:e._id,label:$(e)})),onChange:e=>n({assigneeId:e??null})}),a.jsx(d,{label:"Project Stage",noneLabel:"Default Stage",value:t?.projectStageId??void 0,options:F,onChange:e=>n({projectStageId:e??null})}),a.jsx(d,{label:"Project Category",noneLabel:"Default Category",value:t?.categoryId??void 0,options:(C??[]).map(e=>({value:e._id,label:e.name})),onChange:e=>n({categoryId:e??null})}),a.jsx(d,{label:"Project Type",noneLabel:"Default Project Type",value:t?.projectTypeId??void 0,options:(N??[]).map(e=>({value:e._id,label:e.name})),onChange:e=>n({projectTypeId:e??null})}),a.jsx(E,{label:"Project Services",value:t?.serviceIds??[],options:(x??[]).map(e=>({value:e._id,label:e.name})),placeholder:"Default Services",searchPlaceholder:"Search project services...",onChange:e=>n({serviceIds:e.length>0?e:null})}),a.jsx(E,{label:"Project Tags",value:t?.projectTagIds??[],options:(I??[]).map(e=>({value:e._id,label:e.name})),placeholder:"No Project Tags",searchPlaceholder:"Search project tags...",onChange:e=>n({projectTagIds:e.length>0?e:null})}),a.jsx(d,{label:"Contact Type (New Contacts Only)",noneLabel:"Default Contact Type",value:t?.contactTypeId??void 0,options:(S??[]).map(e=>({value:e._id,label:e.name})),onChange:e=>n({contactTypeId:e??null})}),a.jsx(d,{label:"Lead Source (New Contacts Only)",noneLabel:"No Lead Source",value:t?.leadSourceId??void 0,options:(w??[]).map(e=>({value:e._id,label:e.name})),onChange:e=>n({leadSourceId:e??null})}),a.jsx(d,{label:"Contact Tag",noneLabel:"No Contact Tag",value:t?.contactTagId??void 0,options:(T??[]).map(e=>({value:e._id,label:e.name})),onChange:e=>n({contactTagId:e??null})})]}),a.jsxs("div",{className:"space-y-3 pt-2 text-center",children:[a.jsxs("p",{className:t?.isActive?"font-semibold text-green-600":"font-semibold text-muted-foreground",children:["This integration is currently ",t?.isActive?"on":"off"]}),a.jsxs(G,{className:"w-full",variant:t?.isActive?"outline":"default",onClick:t?.isActive?U:K,disabled:D,children:[a.jsx(re,{className:"mr-2 h-4 w-4"}),t?.isActive?"DISABLE INTEGRATION":"ENABLE INTEGRATION"]})]})]})})})}function P({label:t,value:i,displayValue:u,placeholder:p}){return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(f,{className:"text-sm",children:t}),a.jsx(se,{value:i,displayValue:u??i,placeholder:p,copyLabel:`Copy ${t}`})]})}function d({label:t,noneLabel:i="None",value:u,options:p,onChange:m}){return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(f,{className:"text-sm",children:t}),a.jsxs(q,{value:u??"__none__",onValueChange:o=>m(o==="__none__"?void 0:o),children:[a.jsx(H,{className:"w-full",children:a.jsx(J,{placeholder:i})}),a.jsxs(Q,{children:[a.jsx(_,{value:"__none__",children:a.jsx("span",{className:"text-muted-foreground",children:i})}),p.map(o=>a.jsx(_,{value:o.value,children:o.label},o.value))]})]})]})}function E({label:t,value:i,options:u,placeholder:p,searchPlaceholder:m,onCh
1ange:o}){return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(f,{className:"text-sm",children:t}),a.jsx(Y,{value:i,onChange:o,options:u,placeholder:p,searchPlaceholder:m})]})}export{he as DirectoriiPage,he 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.