PageSourceSearch

https://joby.io/assets/PhoneMasking-WduXT1rz.js

js joby.io collected 2026-10-09 21:35:53 UTC 4,789 bytes, 1 lines download raw bytes

1import{u as T,r as c,j as e}from"./vendor-react-DG2JURgY.js";import{a8 as F,u as D,eY as J,s as o,j as k,bK as j,bL as N,bM as _,k as S,N as w,B as L,U as C}from"./index-D9SMt8-k.js";import{P as A}from"./PhoneNumberSelect-B8XwYStx.js";import{P as B}from"./vendor-icons-DpqNBvzF.js";import"./vendor-query-CmTXP490.js";import"./vendor-supabase-CTw48tL1.js";import"./vendor-dnd-D18xonzr.js";import"./vendor-maps-CXvJbabn.js";import"./vendor-twilio-DyBYtDnD.js";/*! joby-crm cache-bust 2026-06-22 */function Y(){T();const{toast:l}=F(),{organizationId:s}=D(),{isSuperAdmin:m}=J(),[u,p]=c.useState(!1),[r,h]=c.useState(""),[g,b]=c.useState(""),[f,z]=c.useState([]),[x,v]=c.useState({});c.useEffect(()=>{E(),M()},[s]);const E=async()=>{if(s)try{const{data:a,error:t}=await o.from("app_settings").select("value").eq("key","masking_number").eq("organization_id",s).maybeSingle();if(!t&&a){const d=a.value;h(d||""),b(d||"")}const{data:n,error:i}=await o.from("app_settings").select("value").eq("key","masking_job_type_numbers").eq("organization_id",s).maybeSingle();!i&&n&&v(n.value||{})}catch{}},M=async()=>{if(s)try{const{data:a,error:t}=await o.from("crm_job_types").select("*").eq("organization_id",s).eq("active",!0).order("name");if(t)throw t;z(a||[])}catch{l({title:"Error",description:"Failed to load service types",variant:"destructive"})}},q=async()=>{try{if(p(!0),!r){l({title:"Error",description:"Please select a phone number",variant:"destructive"});return}const{error:a}=await o.from("app_settings").upsert({key:"masking_number",value:r,...s?{organization_id:s}:{}},{onConflict:"key,organization_id"});if(a)throw a;if(s){const{data:i}=await o.from("call_groups").select("id").eq("organization_id",s).eq("name","Masking System").single();if(i){const{error:d}=await o.from("phone_numbers").update({group_id:i.id}).eq("e164",r).eq("organization_id",s).select();d&&console.error("Failed to reassign phone to masking group:",d)}}const{data:t,error:n}=await o.functions.invoke("configure-masking-webhooks",{body:{phoneNumber:r,organizationId:s}});n&&console.error("Webhook configuration failed:",n),b(r),l({title:"Success",description:"Masking number saved and webhooks configured"})}catch{l({title:"Error",description:"Failed to save masking number",variant:"destructive"})}finally{p(!1)}},P=async(a,t)=>{const n={...x,[a]:t};v(n);try{const{error:i}=await o.from("app_settings").upsert({key:"masking_job_type_numbers",value:n,...s?{organization_id:s}:{}},{onConflict:"key,organization_id"});if(i)throw i}catch{l({title:"Error",description:"Failed to save service type number",variant:"destructive"})}},y=r!==g&&r!=="";return e.jsx("div",{className:"flex h-full min-h-0 flex-col pb-16 md:pb-0",children:e.jsxs("div",{className:"page-content min-h-0 flex-1 overflow-y-auto overflow-x-hidden space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Phone Masking Communication"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Configure your phone masking system (completely separate from regular phone operations)"})]}),e.jsxs(k,{children:[e.jsxs(j,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-5 w-5"}),"Masking Number Configuration"]}),e.jsx(_,{children:m?"Select a phone number from your account to use as the masking number":"The number your customers see on masked calls"})]}),e.jsx(S,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{children:"Masking Number"}),m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1","data-intercom-target":"setting-phone-masking-number-select",children:e.jsx(A,{value:r,onChange:a=>h(a),placeholder:"Select a phone number for masking..."})}),e.jsx(L,{onClick:q,disabled:u||!r||!y,"data-intercom-target":"setting-phone-masking-save",children:u?"Saving...":"Save"})]}),y&&e.jsx("p",{className:"text-sm text-destructive font-medium",children:"Number changed — click Save to apply"})]}):e.jsx(C,{value:g||"—",readOnly:!0,disabled:!0})]})})]}),e.jsxs(k,{children:[e.jsxs(j,{children:[e.jsx(N,{children:"Service Type Display Numbers"}),e.jsx(_,{children:"Configure which phone numbers customers will see based on the service type"})]}),e.jsx(S,{children:f.length===0?e.jsx("p",{className:"text-muted-foreground",children:"No active service types found"}):e.jsx("div",{className:"space-y-4",children:f.map(a=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx(w,{htmlFor:`jobtype-${a.id}`,children:a.name})}),e.jsx("div",{className:"flex-1",children:e.jsx(C,{id:`jobtype-${a.id}`,placeholder:"+1234567890",value:x[a.name]||"",onChange:t=>P(a.name,t.target.value)})})]},a.id))})})]})]})})}export{Y 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.