PageSourceSearch

https://app.smartdialog.ai/assets/AdBanServiceEdit-DCT2n2ym.js

js smartdialog.ai collected 2026-10-05 12:39:41 UTC 17,151 bytes, 1 lines download raw bytes

1import{bK as Y,a2 as Q,b as j,d as V,R as e,O as J,cI as ge,a4 as X,bP as L,r as _,b1 as we,b2 as ke,T as k,b3 as Ie,b5 as le,b6 as re,b7 as h,w as ce,G as Z,N as ae,A as H,ba as Ae,E as x,U as R,bY as Be,c6 as oe,bG as C,b8 as ie,gI as pe,ai as T,p as ee,cS as W,y as E,c_ as Te,aD as $,am as xe,a6 as Re,af as De,d4 as Ne,b0 as Me,q as Ee,c$ as fe,bZ as ve,be as Se,bx as ne,d2 as de,d5 as me,b4 as ye,gH as se,gJ as be,c9 as ue,gK as Ke,gL as Le,P as Pe}from"./index-CpcUj6vn.js";import{R as $e}from"./RoutedStepper-B2K1ef8A.js";import{C as he}from"./ArrowBackRounded-BNNIYZIL.js";import"./Stepper-DOnYgvt3.js";const z=ce({root:{borderBottom:"none"}})(ie),Fe=Y(()=>({formControl:{width:"100%"},smsIcon:{width:"100%",height:"100%"}})),Ce=a=>{const b=Fe(),{error:d,success:f}=Q(),v=j(),{serviceId:D}=V(),{onClose:s,open:c,action:m,inputSources:o}=a,[r,g]=e.useState(""),[S,P]=e.useState(""),[I]=e.useState(["SMS","RCS"]),n=e.useMemo(()=>o?.find(t=>t?.id===S)??null,[o,S]),N=e.useMemo(()=>o.filter(t=>I.some(i=>i===t?.inputSource?.type)&&t?.inputSource?.address!=="Root")??[],[o,I]),w=e.useMemo(()=>N?.map(t=>e.createElement(J,{key:t?.id,value:t?.id},t?.inputSource?.type==="RCS"?t?.inputSource?.metadata?.find?.(i=>i.key===ge)?.value??t?.inputSource?.address:t?.inputSource?.address,!!t?.keywordPrefix&&` - ${t?.keywordPrefix}`)),[N]),{loading:F,mutate:M}=X(t=>({method:"POST",endpoint:`/messaging/services/adban/actions/${D}`,body:t})),O=async()=>{const t={inputSourceId:n?.inputSource?.id,keyword:n.keywordPrefix?`${n.keywordPrefix} ${r}`:r,action:m},{error:i,errorMessages:y,status:u}=await M(t);i?d(u===403?"You don´t have access to create/update this service":u===409?"Error creating keyword. Keyword already in use":y):(f("Keyword created"),v(pe())),await v(C(!1))},U=t=>{P(t.target.value),v(C(!0))},K=t=>{g(t.target.value),v(C(!0))},l=()=>{v(C(!1)),s()};return F?e.createElement(L,null):e.createElement(_.Suspense,{fallback:e.createElement(L,null)},e.createElement(we,{onClose:l,"aria-labelledby":"add adban action keyword popup",open:c,fullWidth:!0,maxWidth:"sm"},e.createElement(ke,{disableTypography:!0},e.createElement(k,{variant:"h4"},"Add Action Keyword")),e.createElement(Ie,null,e.createElement(le,null,e.createElement("colgroup",null,e.createElement("col",{width:"40%"}),e.createElement("col",{width:"60%"})),e.createElement(re,null,e.createElement(h,null,e.createElement(z,{align:"left"},"Inputsource"),e.createElement(z,{align:"left"},e.createElement(Z,{className:b.formControl},e.createElement(ae,{placeholder:"Select code",labelId:"codeSelect-label",id:"codeSelect",value:S,onChange:U},w)))),n&&e.createElement(h,null,e.createElement(z,{align:"left"},"Keyword"),e.createElement(z,{align:"left"},e.createElement(Z,{className:b.formControl},e.createElement(H,{name:"defaultSender",onChange:K,value:r,InputProps:{startAdornment:e.createElement("div",null,n?.keywordPrefix?e.createElement(e.Fragment,null,`${n.keywordPrefix}`," "):"")}}))))))),e.createElement(Ae,null,e.createElement(x,{"aria-label":"cancel",onClick:l},e.createElement(R,{title:"Cancel"},e.createElement(Be,null))),e.createElement(x,{"aria-label":"save",onClick:O},e.createElement(R,{title:"Create keyword"},e.createElement(oe,null))))))};Ce.propTypes={onClose:T.func.isRequired,open:T.bool.isRequired,action:T.string.isRequired,inputSources:T.array.isRequired};const Oe=Y(a=>({listItem:{marginBottom:"5px"},listItemText:{textAlign:"center"},paper:{padding:a.spacing(2)}}));function q({action:a,serviceId:b,inputSources:d}){const f=Oe(),v=j(),{error:D,success:s}=Q(),[c,m]=e.useState(!1),[o,r]=e.useState(null),{selectedAdBanService:g}=ee(t=>t.adbanservice),[S,P]=e.useState(null),{payload:I,loading:n}=W({method:"GET",endpoint:`/messaging/services/adban/inputsources/servicekeywords/${b}`});e.useEffect(()=>{I&&P(I)},[I]);const N=()=>{m(!0)},w=()=>{m(!1)},{loading:F,mutate:M}=X(t=>({method:"DELETE",endpoint:`/messaging/services/adban/actions/${b}/${t?.id}/${a}/${t?.text}`})),O=e.useCallback(M,[]),U=async t=>{const i=S?.availableKeywords?.find(y=>y?.text===t)??null;i!==null&&r({id:i.id,text:t})},K=async()=>{const{error:t,errorMessages:i}=await O(o);t?D(i):(r(null),v(pe()),s("Action keyword deleted"))},l=t=>{const i=S?.availableKeywords?.find(y=>y?.text===t);if(i!==void 0){const y=d?.find(te=>te?.inputSource?.id===i?.inputSourceId);let u=y?.inputSource?.address??"";return y.inputSource.type==="RCS"&&(u=y?.inputSource?.metadata?.find?.(te=>te.key===ge)?.value??u),`${u} - ${t}`}return""};return F||n?e.createElement(L,null):e.createElement(_.Suspense,{fallback:e.createElement(L,null)},e.createElement(E,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",className:f.toolbar},e.createElement(E,{item:!0,className:f.gridItem},e.createElement(x,{"aria-label":"add",onClick:N},e.createElement(R,{title:"Add keyword"},e.createElement(Te,null))))),e.createElement($,{className:f.paper},e.createElement(xe,{component:"nav","aria-label":"Actions"},g?.serviceConfiguration?.actions?.filter(t=>t.action===a)?.map(t=>e.createElement("div",{key:t},t.keywords?.map(i=>e.createElement(Re,{key:i,button:!0,className:f.listItem},e.createElement(De,{className:f.listItemText,primary:l(i)}),e.createElement(x,{"aria-label":"remove",onClick:()=>U(i)},e.createElement(R,{title:"Remove keyword"},e.createElement(Ne,null))))))))),e.createElement(Ce,{open:c,onClose:w,action:a,inputSources:d}),e.createElement(Me,{title:"Delete action keyword",open:o!==null,setOpen:()=>r(null),onConfirm:()=>K()},e.createElement(k,{variant:"body1"},'Are you sure you want to delete this "',e.createElement("b",null,o?.text),'" keyword?')))}q.propTypes={action:T.string,serviceId:T.string,inputSources:T.any.isRequired};const A=ce({root:{borderBottom:"none"}})(ie),Ue=Y(a=>({select:{width:"100%",minWidth:"40%"},card:{backgroundColor:"#fbfbfb"},paper:{padding:a.spacing(2),height:"100%"},gridItem:{width:"100%",textAlign:"right"}})),qe=()=>({defaultSender:"",dlrUrl:"",endDate:null,messagingAccountId:"",name:"",serviceState:"Active",startDate:new Date,serviceConfiguration:{responseMessages:{}},hiddenContent:!1}),He=["SMS","RCS"],Ge=()=>{const a=Ee(),{customerId:b,serviceId:d}=V(),{showInfo:f}=fe(),{error:v,success:D}=Q(),s=Ue(),c=j(),m=!!d,[o,r]=e.useState(!1),[g,S]=e.useState(null),{selectedAdBanService:P,selectedAdBanServiceLoading:I}=ee(u=>u.adbanservice),[n,N]=e.useState(P??qe()),{payload:w,loading:F}=W({method:"GET",endpoint:"/messaging/services/adban/defaultmessages"});e.useEffect(()=>{w&&r(w)},[w,c]);const{payload:M,loading:O}=W({method:"GET",endpoint:"/messaging/services/adban/inputsources"});e.useEffect(()=>{M&&S(M?.filter(u=>He.some(G=>G===u?.inputSource?.type))??[])},[M,c]);const{loading:U,mutate:K}=X(u=>({method:"PUT",endpoint:"/messaging/services/adban",body:u,headers:{serviceId:u.id}})),l=async()=>{const{error:u,errorMessages:G}=await K(n);u?v(G):(D("Opt-out service updated successfully"),c(se(n))),await c(C(!1))},p=u=>{const G={...n,serviceConfiguration:{...n.serviceConfiguration,responseMessages:{...n.serviceConfiguration.responseMessages,[u.target.name]:u.target.value}}};N(G),c(C(!0))},t=async()=>{await c(C(!1)),a.push(`/${b}/management/optoutservices/${d}/info`)},i=I||U||F||O;!i&&n?.id===void 0&&N(P);let y=!1;return(m===!1||m&&n?.id!==void 0)&&(y=!0),e.createElement("div",{className:s.container},i?e.createElement(L,null):e.createElement(_.Suspense,{fallback:e.createElement(L,null)},e.createElement(E,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",className:s.toolbar},e.createElement(E,{item:!0,className:s.gridItem},e.createElement(x,{"aria-label":"info",onClick:f},e.createElement(R,{title:"Info"},e.createElement(ve,null))),e.createElement(x,{"aria-label":"back",onClick:t},e.createElement(R,{title:"Back to service info"},e.createElement(he,null))))),e.createElement(Se,null),y?e.createElement(e.Fragment,null,e.createElement(ne,{className:s.card},e.createElement(de,{avatar:e.createElement(k,{variant:"h5"},"Response messages"),action:e.createElement(x,{"aria-label":"save",onClick:l},e.createElement(R,{title:"Save changes"},e.createElement(oe,null)))}),e.createElement(me,{className:s.cardContent},e.createElement(E,{container:!0,spacing:2},e.createElement(E,{item:!0,xs:12,md:12},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"Response Messages"),e.createElement(ye,null,e.createElement(le,null,e.createElement("colgroup",null,e.createElement("col",{width:"30%"}),e.createElement("col",{width:"70%"})),e.createElement(re,null,e.createElement(h,{key:"addedtobanlist"},e.createElement(A,{align:"left"},"Added to ban list:"),e.createElement(A,{align:"left"}
1,e.createElement(H,{name:"addedToBanList",onChange:p,value:n?.serviceConfiguration?.responseMessages?.addedToBanList||"",placeholder:o.addedToBanList,className:s.select}))),e.createElement(h,{key:"alreadyexistsinbanlist"},e.createElement(A,{align:"left"},"Already exists in ban list:"),e.createElement(A,{align:"left"},e.createElement(H,{name:"alreadyExistsInBanList",onChange:p,value:n?.serviceConfiguration?.responseMessages?.alreadyExistsInBanList||"",placeholder:o.alreadyExistsInBanList,className:s.select}))),e.createElement(h,{key:"removedfrombanlist"},e.createElement(A,{align:"left"},"Removed from ban list:"),e.createElement(A,{align:"left"},e.createElement(H,{name:"removedFromBanList",onChange:p,value:n?.serviceConfiguration?.responseMessages?.removedFromBanList||"",placeholder:o.removedFromBanList,className:s.select}))),e.createElement(h,{key:"failedtoremovefrombanlist"},e.createElement(A,{align:"left"},"Failed to remove from ban list:"),e.createElement(A,{align:"left"},e.createElement(H,{name:"failedToRemoveFromBanList",onChange:p,value:n?.serviceConfiguration?.responseMessages?.failedToRemoveFromBanList||"",placeholder:o.failedToRemoveFromBanList,className:s.select}))),e.createElement(h,{key:"notfoundinbanlist"},e.createElement(A,{align:"left"},"Not found in ban list:"),e.createElement(A,{align:"left"},e.createElement(H,{name:"notFoundInBanList",onChange:p,value:n?.serviceConfiguration?.responseMessages?.notFoundInBanList||"",placeholder:o.notFoundInBanList,className:s.select}))))))))))),e.createElement("br",null),e.createElement(ne,{className:s.card},e.createElement(de,{avatar:e.createElement(k,{variant:"h5"},"Action Keywords")}),e.createElement(me,{className:s.cardContent},e.createElement(E,{container:!0,spacing:2},e.createElement(E,{item:!0,xs:12,md:6},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"'Block' Action Keywords"),e.createElement(q,{serviceId:n.id,action:"Block",inputSources:g}))),e.createElement(E,{item:!0,xs:12,md:6},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"'Block All' Action Keywords"),e.createElement(q,{serviceId:n.id,action:"BlockAll",inputSources:g}))),e.createElement(E,{item:!0,xs:12,md:6},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"'Block Sender' Action Keywords"),e.createElement(q,{serviceId:n.id,action:"BlockSender",inputSources:g}))),e.createElement(E,{item:!0,xs:12,md:6},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"'Unblock' Action Keywords"),e.createElement(q,{serviceId:n.id,action:"Unblock",inputSources:g}))),e.createElement(E,{item:!0,xs:12,md:6},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"'Unblock All' Action Keywords"),e.createElement(q,{serviceId:n.id,action:"UnblockAll",inputSources:g}))),e.createElement(E,{item:!0,xs:12,md:6},e.createElement($,{className:s.paper},e.createElement(k,{variant:"h5"},"'Unblock Sender' Action Keywords"),e.createElement(q,{serviceId:n.id,action:"UnblockSender",inputSources:g})))))),e.createElement("br",null)):null))},B=ce({root:{borderBottom:"none"}})(ie),Ye=Y(a=>({lastTableRow:{border:"0"},select:{minWidth:"40%"},root:{width:"100%"},button:{marginRight:a.spacing(1)},completed:{display:"inline-block"},instructions:{marginTop:a.spacing(1),marginBottom:a.spacing(1)},helper:{color:"#546e7a",margin:"0",fontSize:"12px",marginTop:"3px",textAlign:"left",fontFamily:"Rajdhani",fontWeight:"400",lineHeight:"13px",letterSpacing:"0.33px"}})),We={defaultSender:"",dlrUrl:"",endDate:null,messagingAccountId:"",name:"",rCodeServiceId:"",serviceState:"Active",startDate:null,serviceConfiguration:{customContactProperties:[],responseMessages:{}},hiddenContent:!1},je=()=>{const a=Ee(),{customerId:b,serviceId:d}=V(),{showInfo:f}=fe(),{error:v,success:D}=Q(),{messagingAccounts:s}=ee(l=>l.messagingAccounts),c=Ye(),m=j(),o=!!d,[r,g]=e.useState({...We,customerId:b}),{payload:S,loading:P}=W({method:"GET",endpoint:`/messaging/services/adban/${d}`,params:{includeUncachedProperties:!0}});e.useEffect(()=>{S&&(g(S),m(be(S)))},[S,m]);const{loading:I,mutate:n}=X(l=>({method:"PUT",endpoint:"/messaging/services/adban",body:l,headers:{serviceId:l.id}})),N=async()=>{const{error:l,errorMessages:p}=await n(r);l?v(p):(D("Opt-out service updated successfully"),m(Ke(r))),await m(C(!1))},w=l=>{const p={...r,[l.target.name]:l.target.value};g(p),m(C(!0))},F=l=>{const p={...r,startDate:l._d};g(p),m(C(!0))},M=l=>{const p={...r,endDate:l._d};g(p),m(C(!0))},O=async()=>{await m(C(!1)),a.push(`/${b}/management/optoutservices/${d}/info`)},U=P||I;let K=!1;return(o===!1||o&&r?.id!==void 0)&&(K=!0),e.createElement("div",{className:c.container},U?e.createElement(L,null):e.createElement(_.Suspense,{fallback:e.createElement(L,null)},e.createElement(E,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",className:c.toolbar},e.createElement(E,{item:!0,className:c.gridItem},e.createElement(x,{"aria-label":"info",onClick:f},e.createElement(R,{title:"Info"},e.createElement(ve,null))),e.createElement(x,{"aria-label":"back",onClick:O},e.createElement(R,{title:"Back to service info"},e.createElement(he,null))),e.createElement(x,{"aria-label":"save",onClick:N},e.createElement(R,{title:"Save changes"},e.createElement(oe,null))))),e.createElement(Se,null),K?e.createElement(ye,null,e.createElement(le,{xs:6,sm:3},e.createElement("colgroup",null,e.createElement("col",{width:"20%"}),e.createElement("col",{width:"80%"})),e.createElement(re,null,e.createElement(h,{key:"name"},e.createElement(B,{align:"left"},"Service name (*)"),e.createElement(B,{align:"left"},e.createElement(H,{name:"name",onChange:w,value:r?.name||"",className:c.select}))),e.createElement(h,{key:"servicestate"},e.createElement(B,{align:"left"},"Service state"),e.createElement(B,{align:"left"},e.createElement(Z,{className:c.formControl},e.createElement(ae,{id:"state-select",value:r?.serviceState,onChange:w,name:"serviceState"},e.createElement(J,{value:"Active"},"Active"),e.createElement(J,{value:"Passive"},"Passive"))))),e.createElement(h,{key:"messagingaccount"},e.createElement(B,{align:"left"},"Messaging account"),e.createElement(B,{align:"left"},e.createElement(Z,{className:c.formControl},e.createElement(ae,{id:"messaging-account-select",onChange:w,name:"messagingAccountId",value:r?.messagingAccountId},s?.map(l=>e.createElement(J,{key:l.id,value:l.id},l.name)))))),e.createElement(h,{key:"startdate"},e.createElement(B,{align:"left"},"Start date (*)"),e.createElement(B,{align:"left"},e.createElement(ue,{autoOk:!0,hideTabs:!0,ampm:!1,value:r?.startDate,onChange:F,name:"startDate",format:"D.M.YYYY HH.mm"}))),e.createElement(h,{key:"enddate"},e.createElement(B,{align:"left"},"End date"),e.createElement(B,{align:"left"},e.createElement(ue,{autoOk:!0,hideTabs:!0,ampm:!1,value:r?.endDate,onChange:M,name:"endDate",format:"D.M.YYYY HH.mm"})))))):null))},_e=Y(a=>({lastTableRow:{border:"0"},card:{width:"100%",marginBottom:0},select:{minWidth:"40%"},root:{width:"100%",height:"100%"},button:{marginRight:a.spacing(1)},completed:{display:"inline-block"},instructions:{marginTop:a.spacing(1),marginBottom:a.spacing(1)},stepperContainer:{padding:a.spacing(2)},stepperControllersContainer:{paddingTop:a.spacing(4)}}
1)),ze=()=>{const a=_e(),{serviceId:b}=V(),d=j(),{refreshSelectedAdBanService:f}=ee(m=>m.adbanservice),[v,D]=e.useState(!1),{query:s}=W({method:"GET",endpoint:`/messaging/services/adban/${b}`,params:{includeUncachedProperties:!0}},!1),c=e.useCallback(s,[]);return e.useEffect(()=>{(!v||f)&&((async()=>{d(Le(!0));const{payload:o,error:r}=await c();r?d(se(null)):(d(se(o)),d(be(o)))})(),D(!0))},[d,c,v,f]),e.createElement("div",{className:a.root},e.createElement(_.Suspense,{fallback:e.createElement(L,null)},e.createElement(ne,{className:a.card},e.createElement($e,{steps:[{id:"basicSettings",title:"Basic Settings",path:"/basicsettings",component:je},{id:"advancedSettings",title:"Advanced Settings",path:"/advancedsettings",component:Ge}]}))))};Y(a=>({contentContainer:{width:"100%",padding:a.spacing(2)},gridItem:{margin:a.spacing(1)},toggleContainer:{margin:a.spacing(2,0)},formControl:{margin:a.spacing(1),minWidth:120},appBar:{backgroundColor:"#fff"},panelContainer:{flexGrow:1,width:"100%",padding:a.spacing(0),paddingTop:a.spacing(3)},panel:{width:"100%",margin:a.spacing(0),padding:a.spacing(0)}}));T.node,T.any.isRequired,T.any.isRequired;const Xe=()=>e.createElement(Pe,{title:"Opt-out service edit"},e.createElement(ze,null));export{Xe 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.