PageSourceSearch

https://app.snapto.ai/assets/BlockContacts-Bp7NpvJ-.js

js snapto.ai collected 2026-10-05 15:07:45 UTC 8,785 bytes, 1 lines download raw bytes

1import{r as o,p as e,B as c,a0 as X,a1 as $,v as J,y as R,N as _,T as K,z as G,x as ee,aj as L,fn as U,L as S,w as A,bh as N,ag as H,bj as D,bs as te,bD as ae,aZ as se}from"./index-C9IH3k-2.js";import{N as Y,I as oe,aa as V,g as re,aR as ne}from"./TemplateUtil-D1DzmWLm.js";import{a as ie}from"./AuditConstant-C6syQHOu.js";import{u as le}from"./HelperMethods-C-ewwU_x.js";import{P as ce}from"./PageDescription-BrOUsEZE.js";import{K as de}from"./KeywordTagsInput-BkCTfm_l.js";import{a as pe}from"./MainApp-BoiAvjMg.js";import{P as me}from"./index-C0dhduHx.js";import{C as ue}from"./ContactImportModal-DTGgpDln.js";import{R as he}from"./FileAddOutlined-AdYKRQbz.js";import{F as xe}from"./Table-isZ0WXp4.js";import"./Wrapper-ChjuDa3w.js";import"./index-CmSVNJzc.js";import"./index-Bv3SRNsl.js";import"./CalendarOutlined-DyzsKNdO.js";import"./ClockCircleOutlined-Cym7vptW.js";import"./papaparse.min-CbyEf3Jx.js";import"./ContactUtil-CNNd5h8z.js";import"./InfoCircleOutlined-B7sKwm1k.js";import"./InboxOutlined-C0X09Vz7.js";import"./index-BOwvFOZJ.js";import"./Pagination-D1z-xPUv.js";import"./HolderOutlined-YOHjCGKZ.js";const{Text:ge}=K,fe=b=>{const{disabled:k}=b,[j,T]=o.useState({optOutWords:[],optInWords:[]}),[d,C]=o.useState(null),[F,u]=o.useState(!1),[h,v]=o.useState(!1),[I,O]=o.useState(!1),B=async()=>{try{v(!0);const s=await ee("/api/v1/contact/blocked/config");if(s.status===200){const{optOutWords:p,optInWords:w}=s.data;C(s.data),T({optOutWords:p||[],optInWords:w||[]})}}catch{_.error("Failed to fetch keywords.")}finally{v(!1)}},x=()=>{u(!0),B()},E=()=>{u(!1)},P=async()=>{O(!0);const s={...d?.id&&{id:d.id},...j};try{await R("/api/v1/contact/blocked/config",s),_.success("Keywords saved successfully!"),u(!1)}catch{_.error("Failed to save keywords.")}finally{O(!1)}},l=async()=>{if(d){const s=await G(`/api/v1/contact/blocked/config/${d.id}`);s.status===200&&_.info(s.data.message),u(!1)}},f=(s,p,w)=>e.jsx(oe,{title:p,style:{marginBottom:"20px"},extra:e.jsx(ge,{type:"secondary",style:{fontSize:"12px"},children:"Type a keyword and click elsewhere or press Enter to add"}),children:e.jsx(de,{value:j[s],onChange:y=>T({...j,[s]:y}),color:w})});return e.jsxs(e.Fragment,{children:[e.jsx(c,{type:"primary",icon:e.jsx(pe,{}),onClick:x,children:"Block / Unblock Keywords"}),e.jsx(Y,{width:800,title:"Manage Block Unblock Keywords Configurations",open:F,loading:h,onCancel:E,onOk:P,okButtonProps:{disabled:k},confirmLoading:I,footer:e.jsxs(X,{justify:"space-between",children:[e.jsx($,{children:e.jsx(me,{title:"This will clear all Opt-out and Opt-in keywords. Are you sure you want to continue?",onConfirm:()=>l(),okText:"Yes",cancelText:"No",children:e.jsx(c,{type:"dashed",disabled:!d?.id,children:"Delete"})})}),e.jsx($,{children:e.jsxs(J,{children:[e.jsx(c,{type:"default",onClick:E,disabled:I,children:"Cancel"}),e.jsx(c,{type:"primary",onClick:P,loading:I,disabled:k,children:"Save"})]})})]}),children:h?e.jsx("div",{style:{textAlign:"center",padding:"30px"},children:"Loading keywords..."}):e.jsxs(e.Fragment,{children:[f("optOutWords","Opt-Out Keywords","red"),f("optInWords","Opt-In Keywords","green")]})})]})},ye="/api/v1/contact/blocked/upload",be=[{text:"API",value:"API"},{text:"UI",value:"UI"},{text:"OTHER",value:"OTHER"},{text:"OPT_OUT_LIST_MATCH",value:"OPT_OUT_LIST_MATCH"},{text:"CHATBOT",value:"CHATBOT"},{text:"BULK_UPLOAD",value:"BULK_UPLOAD"},{text:"OPT_OUT",value:"OPT_OUT"}],ze=()=>{const[b,k]=o.useState([]),[j,T]=o.useState(0),[d,C]=o.useState(!1),[F,u]=o.useState(!1),[h]=L.useForm(),[v,I]=o.useState({}),[O,B]=o.useState(!1),[x,E]=o.useState(U),P=o.useRef(null),l=le(),f=async(a,t,r)=>{t()},s=(a,t,r)=>{const m={current:a?.current??1,pageSize:a?.pageSize??te},g=r.order?[{fieldName:r.columnKey,dir:r.order==="descend"?"desc":"asc"}]:U.order,n=Object.entries(t??{}).map(([i,M])=>({fieldName:i,value:M!==null?i!=="creationTime"&&i!=="lastUpdateTime"?M:M.map(V):null})).filter(({value:i})=>i);E({...x,pagination:m,search:n,order:g}),y({pagination:m,search:n,order:g})},p=(a,t)=>({filterDropdown:({setSelectedKeys:r,selectedKeys:m,confirm:g,close:n})=>e.jsxs(S,{gap:"small",vertical:!0,style:{padding:8},children:[e.jsx(H,{ref:P,placeholder:`Search ${t}`,value:m[0],onChange:i=>r(i.target.value?[i.target.value]:[]),onPressEnter:()=>f(m,g)}),e.jsxs(J,{children:[e.jsx(c,{type:"primary",onClick:()=>f(m,g),icon:e.jsx(se,{}),children:"Search"}),e.jsx(c,{type:"link",onClick:()=>n(),children:"Close"})]})]})}),w=[{title:"Phone Number",dataIndex:"receiverNumber",key:"receiverNumber",...p("receiverNumber","Phone Number")},{title:"Stop Word",dataIndex:"word",key:"word",...p("word","Stop Word")},{title:"Source",dataIndex:"source",key:"source",filters:be},{title:"Blocked by",dataIndex:"type",key:"type",...p("type","Blocked by")}
1,{title:"Last Update Time",dataIndex:"lastUpdateTime",key:"lastUpdateTime",sorter:(a,t)=>a.lastUpdateTime-t.lastUpdateTime,...ie("lastUpdateTime","Last Update Time",()=>{},()=>{},f),render:(a,t)=>e.jsx(K.Text,{children:re(t.lastUpdateTime)})},{title:"Action",dataIndex:"Action",key:"Action",render:(a,t)=>e.jsxs(S,{gap:"small",children:[e.jsx(A,{title:l("manage_contacts")?"":N,children:e.jsx(c,{onClick:()=>{q(t.id)},disabled:!l("manage_contacts"),children:e.jsx(ae,{})})}),e.jsx(A,{title:l("manage_contacts")?"":N,children:e.jsx(c,{onClick:()=>Z(t.id),disabled:!l("manage_contacts"),children:e.jsx(ne,{})})})]})}],y=async a=>{const{pagination:t,search:r,order:m}=a,g={pagination:{current:t.current,pageSize:t.pageSize},search:(r||[]).map(({fieldName:n,value:i})=>({fieldName:n,value:i!==null?n!=="lastUpdateTime"?i:i.map(V):null})),order:m||U.order};try{const n=await R("/api/v1/contact/blocked/list",g);n?(k(n.data.results||[]),T(n.data.total||0)):(k([]),T(0))}catch(n){console.error("Error fetching table data:",n),D.error({title:"Error",description:"Failed to fetch data."})}};o.useEffect(()=>{y(U)},[]);const Z=async a=>{const t=await G(`/api/v1/contact/blocked/${a}`);t&&(y(x),D.success({title:"Success",description:t.data.message}))},q=a=>{const t=b.findIndex(r=>
1r.id===a);if(t!==-1){const r=b[t];I(r),z("EDIT",r)}else D.error({title:"Error",description:"Error Record Not Found!"})},W=()=>{C(!1),u(!1),h.resetFields()},Q=async a=>{const t=await R("/api/v1/contact/blocked/save",{...a,id:d?v.id:void 0});t&&(y(x),D.success({title:"Success",description:t.data?.message}),W())},z=(a,t)=>{a==="CREATE"?C(!1):a==="EDIT"&&(h.setFieldsValue({receiverNumber:t.receiverNumber}),C(!0)),u(!0)};return e.jsxs(S,{vertical:!0,gap:"large",children:[e.jsxs(S,{justify:"space-between",align:"center",wrap:!0,children:[e.jsx(K.Title,{level:4,style:{margin:0},children:"Block Contacts"}),e.jsxs(S,{gap:"small",wrap:!0,children:[e.jsx(A,{title:l("manage_contacts")?"":N,children:e.jsx(c,{onClick:()=>B(!0),icon:e.jsx(he,{}),type:"primary",disabled:!l("manage_contacts"),children:"Import Block Contacts"})}),e.jsx(fe,{disabled:!l("manage_contact_related")}),e.jsx(A,{title:l("manage_contacts")?"":N,children:e.jsx(c,{type:"primary",onClick:()=>z("CREATE"),disabled:!l("manage_contacts"),children:"Block Contact"})})]})]}),e.jsx(ce,{children:e.jsxs("ul",{style:{margin:0,paddingLeft:18},children:[e.jsxs("li",{children:["Blocked contacts will ",e.jsx("b",{children:"not receive any marketing (promotional) template messages"}),"."]}),e.jsxs("li",{children:["Blocked contacts ",e.jsx("b",{children:"will still receive all utility and service messages"})," (e.g., OTPs, alerts, updates)."]}),e.jsxs("li",{children:["When a user receives a marketing message, an info button allows them to select ",e.jsx("b",{children:"Interested"})," or ",e.jsx("b",{children:"Not Interested"}),"."]}),e.jsxs("li",{children:["If a user selects ",e.jsx("b",{children:"Not Interested"}),", they are automatically blocked from future marketing messages, but not from utility messages."]}),e.jsx("li",{children:'You can block contacts manually using the "Block Contact" button or upload a list in bulk using "Import Block Contacts".'}),e.jsx("li",{children:"The Block/Unblock Keywords tool lets users send specific keywords to block or unblock themselves from marketing messages."})]})}),e.jsx(xe,{columns:w,dataSource:b,rowKey:"id",scroll:{x:"max-content"},onChange:s,pagination:{current:x.pagination.current,pageSize:x.pagination.pageSize,total:j,showSizeChanger:!0,showQuickJumper:!0,showTotal:(a,t)=>`${t[0]}-${t[1]} of ${a} items`}}),e.jsx(Y,{title:d?"Edit Blocked Contact":"Block Contact",open:F,onOk:()=>h.submit(),onCancel:W,children:e.jsx(L,{form:h,onFinish:Q,labelCol:{span:7},wrapperCol:{span:20},children:e.jsx(L.Item,{name:"receiverNumber",label:"Phone Number",children:e.jsx(H,{placeholder:"Phone Number"})})})}),e.jsx(ue,{title:"Import Block Contacts",visible:O,onCancel:()=>B(!1),uploadContactType:ye,hideAttributes:!0})]})};export{ze 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.