import{j as s,ej as x,Y as V,h as p,i as m,Q as R,av as g,o,at as S,aR as T}from"./app-BgLa5dit.js";import{D as f}from"./C4BcftDO.chunk.js";import{C as b}from"./WqgNB-L4.chunk.js";import{T as j}from"./lZO4aq5x.chunk.js";import{I as u}from"./c8ptyyqg.chunk.js";import{C as P}from"./c3I67AiW.chunk.js";import{I as _}from"./Bm4DWMcW.chunk.js";import{C as U}from"./C2cKa2R1.chunk.js";import{C as y,a as D}from"./8iu0vnCW.chunk.js";import{C as v}from"./q-IBKcuF.chunk.js";import"./0GREfvNX.chunk.js";import"./C8_78Eqq.chunk.js";import"./3nM7jLnE.chunk.js";import"./CPXlV0fg.chunk.js";import"./ChrB5FYK.chunk.js";import"./DR2FaZH9.chunk.js";import"./KUnagq9Z.chunk.js";import"./DULWIWQR.chunk.js";import"./CCcwLDvu.chunk.js";import"./DDfKZ_ng.chunk.js";import"./DUpYPoLs.chunk.js";import"./EZim8aq-.chunk.js";import"./BD9MrUJP.chunk.js";import"./s6cGcwlA.chunk.js";import"./Zwjmkasg.chunk.js";import"./4qGb1BIY.chunk.js";import"./DnXDEnAR.chunk.js";import"./DpUpv6rY.chunk.js";import"./CG7zbly5.chunk.js";import"./m4aqaK_l.chunk.js";import"./MEkA24R1.chunk.js";import"./C53kfXmd.chunk.js";const E={[u.V4]:"bg-blue",[u.V6]:"bg-green"};function L(t){return`${E[t]??"bg-secondary"} rounded-pill text-white py-1 px-2 d-flex align-items-center w-fit`}function w(t){return s.jsx("div",{className:L(t.ipVersion),children:t.ipVersion===u.V4?"IPv4":"IPv6"})}const a=x(),n={ipVersion:()=>a.accessor("ipVersion",{id:"ipVersion",header:"IP Version",cell:t=>{const e=t.getValue();return s.jsx(w,{ipVersion:e})},size:100}),ipRange:()=>a.accessor(t=>t,{id:"ipRange",header:"IP Range",cell:t=>{const e=t.getValue(),r=e.endAddress!==e.startAddress?`${e.startAddress} - ${e.endAddress}`:e.startAddress;return s.jsx("span",{children:r})},size:300}),actions:t=>a.accessor(e=>e,{id:"actions",header:"",cell:e=>{const r=e.getValue();return s.jsx(V,{appLink:{application:m.CRM_STUDIO,action:p.CrmStudio.REMOVE_CUSTOMER_IP_AUTH_RANGE,args:[t,r.id]},children:s.jsx(R,{className:"svg-container cursor-pointer ms-2",svg:g})})},size:50})};function M(t){const e=[n.ipVersion(),n.ipRange(),n.actions(t.customerId)];return s.jsx(j,{data:t.data,columns:e,theme:P})}function Ct(t){var l,h,C;const e=o(v.customer(t.id)),r=o(T.currentUser()),I=e.hasCompleted&&r.hasCompleted,i=o(_.getIpAuthByCustomer(t.id)),d=(l=i.data)==null?void 0:l.id,A=!!d,c={application:m.CRM_STUDIO,action:p.CrmStudio.ADD_CUSTOMER_IP_AUTH_RANGE,args:[t.id]};return i.hasCompleted?s.jsx(y,{view:D.Customers,children:s.jsx(U,{title:"IP Auth",currentTabId:"ipAuth",id:t.id,loading:!I,rightContent:A&&s.jsx(S,{className:"btn btn-outline-dark",svg:g,appLink:{application:m.CRM_STUDIO,action:p.CrmStudio.DISABLE_CUSTOMER_IP_AUTH,args:[t.id,d]},children:"Disable IP Auth"}),children:i.data?s.jsx(f,{heading:"IP range",disableCollapse:!0,buttonText:"Add an IP range",buttonAppLink:c,children:(h=i.data)!=null&&h.ipRanges.length?s.jsx(M,{data:(C=i.data)==null?void 0:C.ipRanges,customerId:t.id}):s.jsx("p",{className:"px-3 pt-3",children:"There are currently no IP range setup for this customer."})}):s.jsx(b,{heading:"IP auth hasn’t been set up yet",ctaText:"Set up IP auth",appLink:c})})}):s.jsx(s.Fragment,{})}export{Ct as CustomerIpAuthView};
//# sourceMappingURL=BRjqkpMi.chunk.js.map
